From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1534) id B309F3858C54; Wed, 7 Jun 2023 09:03:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B309F3858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686128603; bh=sAaK5/TQ0KaB/Z1E++x7t3zT5jgpAD7+9W2aHPXdbm4=; h=From:To:Subject:Date:From; b=sSZQCVoH3z5iz6XGzuShAUlgDjhllErSCmLFHQWgG5G36sLRzFtZFFI1Isq9mrxmE eJyikH/lAaPMHae5Q+zHI9ONerhEHvqa7CSUBrW/9EG18sfwiZcThC5NBrymxqKrWQ r1F/zfxRS2CTjFZe+ULm8Sn+O61nUuVQ+580aGC0= 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-13] libgomp: plugin-gcn - support 'unified_address' X-Act-Checkin: gcc X-Git-Author: Tobias Burnus X-Git-Refname: refs/heads/devel/omp/gcc-13 X-Git-Oldrev: 07a5187c0c9a705868abbedd0ccaa013cf564d64 X-Git-Newrev: 04538859740c4cf7bfe9e80757f3aff34c7a2f1d Message-Id: <20230607090323.B309F3858C54@sourceware.org> Date: Wed, 7 Jun 2023 09:03:23 +0000 (GMT) List-Id: https://gcc.gnu.org/g:04538859740c4cf7bfe9e80757f3aff34c7a2f1d commit 04538859740c4cf7bfe9e80757f3aff34c7a2f1d Author: Tobias Burnus Date: Wed Jun 7 10:09:42 2023 +0200 libgomp: plugin-gcn - support 'unified_address' Effectively, for GCN (as for nvptx) there is a common address space between host and device, whether being accessible or not. Thus, this commit permits to use 'omp requires unified_address' with GCN devices. (nvptx accepts this requirement since r13-3460-g131d18e928a3ea.) OG13 note: unified_address was supported before for GCN via OG13 commit 3ddf3565fae amdgcn: libgomp plugin USM implementation Thus, this cherry pick just uses the mainline/GCC14 syntax in the C file; additionally, it updates the documentation. libgomp/ * plugin/plugin-gcn.c (GOMP_OFFLOAD_get_num_devices): Regard unified_address requirement as supported. * libgomp.texi (OpenMP 5.0, AMD Radeon, nvptx): Remove 'unified_address' from the not-supported requirements. (cherry picked from commit f1af7d65ff64fe7102d1490ef46ea491a533e641) Diff: --- libgomp/ChangeLog.omp | 10 ++++++++++ libgomp/libgomp.texi | 9 ++++----- libgomp/plugin/plugin-gcn.c | 7 ++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp index 4283134a5a5..82c8690fd68 100644 --- a/libgomp/ChangeLog.omp +++ b/libgomp/ChangeLog.omp @@ -1,3 +1,13 @@ +2023-06-07 Tobias Burnus + + Backported from master: + 2023-06-06 Tobias Burnus + + * plugin/plugin-gcn.c (GOMP_OFFLOAD_get_num_devices): Use + mainline syntax for mark unified_address requirement as supported. + * libgomp.texi (OpenMP 5.0, AMD Radeon, nvptx): Remove + 'unified_address' from the not-supported requirements. + 2023-06-01 Tobias Burnus Backported from master: diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi index dcd2c2d3ea9..e9e74ce8ddb 100644 --- a/libgomp/libgomp.texi +++ b/libgomp/libgomp.texi @@ -192,8 +192,7 @@ The OpenMP 4.5 specification is fully supported. env variable @tab Y @tab @item Nested-parallel changes to @emph{max-active-levels-var} ICV @tab Y @tab @item @code{requires} directive @tab P - @tab complete but no non-host devices provides @code{unified_address} or - @code{unified_shared_memory} + @tab complete but no non-host devices provides @code{unified_shared_memory} @item @code{teams} construct outside an enclosing target region @tab Y @tab @item Non-rectangular loop nests @tab P @tab Full support for C/C++, partial for Fortran @item @code{!=} as relational-op in canonical loop form for C/C++ @tab Y @tab @@ -4484,7 +4483,7 @@ The implementation remark: @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 +@item OpenMP code that has a @code{requires} directive with @code{unified_shared_memory} will remove any GCN device from the list of available devices (``host fallback''). @item OpenMP @emph{pinned} memory (@code{omp_atk_pinned}, @@ -4553,8 +4552,8 @@ The implementation remark: Per device, reverse offload regions are processed serially 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 nvptx device from the +@item OpenMP code that has a @code{requires} directive with + @code{unified_shared_memory} will remove any nvptx device from the list of available devices (``host fallback''). @item OpenMP @emph{pinned} memory (@code{omp_atk_pinned}, @code{ompx_pinned_mem_alloc}, for example) diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c index d6b3c615ca0..3df9fbe8d80 100644 --- a/libgomp/plugin/plugin-gcn.c +++ b/libgomp/plugin/plugin-gcn.c @@ -3387,10 +3387,11 @@ GOMP_OFFLOAD_get_num_devices (unsigned int omp_requires_mask) devices were present. Note: not all devices support USM, but the compiler refuses to create binaries for those that don't anyway. */ - omp_requires_mask &= ~(GOMP_REQUIRES_UNIFIED_ADDRESS - | GOMP_REQUIRES_UNIFIED_SHARED_MEMORY); + omp_requires_mask &= ~GOMP_REQUIRES_UNIFIED_SHARED_MEMORY; if (hsa_context.agent_count > 0 - && (omp_requires_mask & ~GOMP_REQUIRES_REVERSE_OFFLOAD) != 0) + && ((omp_requires_mask + & ~(GOMP_REQUIRES_UNIFIED_ADDRESS + | GOMP_REQUIRES_REVERSE_OFFLOAD)) != 0)) return -1; return hsa_context.agent_count; }