From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1534) id A886C3858D1E; Tue, 7 Feb 2023 08:59:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A886C3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675760340; bh=Vd11bYvwjYF8iO+eemi0bHRmH/pp1M7CwmtZomBUzw8=; h=From:To:Subject:Date:From; b=tysqOnC3s4sqektMyTe3xXLEVq+2mtSWFiKsDBQkt30K4EP75tR56V6hgGQJtKObw LiorGkNUukqDSC4cfmc6scDUBCHR4p21eP7eUS5jnmDc9+JZYnytctLXdMUIrKcpEg 6cGjW37ePtnOC4awnYxcCBxFjqSnPRh4rbN38MVQ= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Tobias Burnus To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-12] libgomp: enable reverse offload for AMDGCN X-Act-Checkin: gcc X-Git-Author: Tobias Burnus X-Git-Refname: refs/heads/devel/omp/gcc-12 X-Git-Oldrev: b15627a0cc116ed460904f464ffa8db098e4dcb0 X-Git-Newrev: fea797e012e89463a5f93d6799462e10d1c2a9dd Message-Id: <20230207085900.A886C3858D1E@sourceware.org> Date: Tue, 7 Feb 2023 08:59:00 +0000 (GMT) List-Id: https://gcc.gnu.org/g:fea797e012e89463a5f93d6799462e10d1c2a9dd commit fea797e012e89463a5f93d6799462e10d1c2a9dd Author: Tobias Burnus Date: Tue Feb 7 09:58:46 2023 +0100 libgomp: enable reverse offload for AMDGCN libgomp/ChangeLog: * libgomp.texi (5.0 Impl. Status, gcn specifics): Update for reverse offload. * plugin/plugin-gcn.c (GOMP_OFFLOAD_get_num_devices): Accept reverse-offload requirement. (cherry picked from commit f84fdb134dec02f68fd9a39a58e726023470e537) Diff: --- libgomp/ChangeLog.omp | 12 +++++++++++- libgomp/libgomp.texi | 13 ++++++++----- libgomp/plugin/plugin-gcn.c | 3 ++- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp index 2012eabb5d1..595792316ca 100644 --- a/libgomp/ChangeLog.omp +++ b/libgomp/ChangeLog.omp @@ -1,4 +1,14 @@ -2023-02-02 Tobias Burnus +2023-02-07 Tobias Burnus + + Backported from master: + 2023-02-03 Tobias Burnus + + * libgomp.texi (5.0 Impl. Status, gcn specifics): Update for + reverse offload. + * plugin/plugin-gcn.c (GOMP_OFFLOAD_get_num_devices): Accept + reverse-offload requirement. + +2023-02-07 Tobias Burnus Backported from master: 2023-02-02 Tobias Burnus diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi index b6d004e59b3..1ac7646dbcb 100644 --- a/libgomp/libgomp.texi +++ b/libgomp/libgomp.texi @@ -227,8 +227,7 @@ The OpenMP 4.5 specification is fully supported. @item @code{allocate} directive @tab N @tab @item @code{allocate} clause @tab P @tab Initial support @item @code{use_device_addr} clause on @code{target data} @tab Y @tab -@item @code{ancestor} modifier on @code{device} clause - @tab Y @tab Host fallback with GCN devices +@item @code{ancestor} modifier on @code{device} clause @tab Y @tab @item Implicit declare target directive @tab Y @tab @item Discontiguous array section with @code{target update} construct @tab N @tab @@ -4450,9 +4449,13 @@ The implementation remark: @item I/O within OpenMP target regions and OpenACC compute regions is supported using the C library @code{printf} functions and the Fortran @code{print}/@code{write} statements. -@item OpenMP code that has a requires directive with @code{unified_address}, - @code{unified_shared_memory} or @code{reverse_offload} will remove - any GCN device from the list of available devices (``host fallback''). +@item Reverse offload (i.e. @code{target} regions with + @code{device(ancestor:1)}) are processed serially per @code{target} region + such that the next reverse offload region is only executed after the previous + one returned. +@item OpenMP code that has a requires directive with @code{unified_address} or + @code{unified_shared_memory} will remove any GCN device from the list of + available devices (``host fallback''). @end itemize diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c index 0e22aec87cb..70a555a24a2 100644 --- a/libgomp/plugin/plugin-gcn.c +++ b/libgomp/plugin/plugin-gcn.c @@ -3395,7 +3395,8 @@ GOMP_OFFLOAD_get_num_devices (unsigned int omp_requires_mask) /* Return -1 if no omp_requires_mask cannot be fulfilled but devices were present. */ if (hsa_context.agent_count > 0 - && (omp_requires_mask & ~(GOMP_REQUIRES_UNIFIED_ADDRESS + && (omp_requires_mask & ~(GOMP_REQUIRES_REVERSE_OFFLOAD + | GOMP_REQUIRES_UNIFIED_ADDRESS | GOMP_REQUIRES_UNIFIED_SHARED_MEMORY))) return -1; return hsa_context.agent_count;