From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1534) id DCB213858D33; Tue, 6 Jun 2023 16:06:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DCB213858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686067593; bh=5BrWmH3XGnsANsmHf52QtB9v0JWU1S1hJWZB/N+8Bfc=; h=From:To:Subject:Date:From; b=E00fiitDt1cqg5oE5KPhwiw/PVjEScnUGrsl7YT8pLhs6wNiAjBTka0LprBfdvl9E kbq7G4q1o9mFiYMizaZRy/AtIKWZAmAWAOuT2+Qa3ROo+RxA6+cr1IGFvKGFIY3UMP snZ/h4AWtEZpdXZh4Rmw1gdLyuGAEjjKdMcdgdzg= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Tobias Burnus To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1584] libgomp: plugin-gcn - support 'unified_address' X-Act-Checkin: gcc X-Git-Author: Tobias Burnus X-Git-Refname: refs/heads/master X-Git-Oldrev: 192665feef71294510b1632bfaaedd4d824c744f X-Git-Newrev: f1af7d65ff64fe7102d1490ef46ea491a533e641 Message-Id: <20230606160633.DCB213858D33@sourceware.org> Date: Tue, 6 Jun 2023 16:06:33 +0000 (GMT) List-Id: https://gcc.gnu.org/g:f1af7d65ff64fe7102d1490ef46ea491a533e641 commit r14-1584-gf1af7d65ff64fe7102d1490ef46ea491a533e641 Author: Tobias Burnus Date: Tue Jun 6 18:06:14 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.) 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. Diff: --- libgomp/libgomp.texi | 9 ++++----- libgomp/plugin/plugin-gcn.c | 4 +++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi index 76c56a73969..a3d370a0fb3 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 @@ -4460,7 +4459,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 The available stack size can be changed using the @code{GCN_STACK_SIZE} @@ -4522,8 +4521,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''). @end itemize diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c index 2181bf0235f..ef22d48da79 100644 --- a/libgomp/plugin/plugin-gcn.c +++ b/libgomp/plugin/plugin-gcn.c @@ -3231,7 +3231,9 @@ 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_REVERSE_OFFLOAD) != 0) + && ((omp_requires_mask + & ~(GOMP_REQUIRES_UNIFIED_ADDRESS + | GOMP_REQUIRES_REVERSE_OFFLOAD)) != 0)) return -1; return hsa_context.agent_count; }