From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1698) id 581343844044; Fri, 10 Jul 2020 20:29:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 581343844044 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594412968; bh=HMDzIth4GAYFB1dT21grRffrR0QwUd7eHGpxDitiNiM=; h=From:To:Subject:Date:From; b=h4FGxGjhLTNXkgQtzlDnEp0IZumQqdXD+5YZ03OMSCuGmFeCS/tjOpFGeOtYcEmZA WgMYBiF5rHlpgH0Hp8Q5bTZsOuYv7s3UbiqNRv7v4IXNUssK1eaNLUs9r35Wc5NBid OYoIajEloLypwv6pV6cufie6fttfSpArOefh7etU= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Iain D Sandoe To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/c++-coroutines] openacc: GOMP_MAP_ATTACH handling in find_group_last X-Act-Checkin: gcc X-Git-Author: Julian Brown X-Git-Refname: refs/heads/devel/c++-coroutines X-Git-Oldrev: ac8996edb14eef0a15cd0ce850fde2be5e227e69 X-Git-Newrev: 8d2e5026d22b3f30e7df7adfd4ebf4ebc1e77e2d Message-Id: <20200710202928.581343844044@sourceware.org> Date: Fri, 10 Jul 2020 20:29:28 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jul 2020 20:29:28 -0000 https://gcc.gnu.org/g:8d2e5026d22b3f30e7df7adfd4ebf4ebc1e77e2d commit 8d2e5026d22b3f30e7df7adfd4ebf4ebc1e77e2d Author: Julian Brown Date: Thu Jun 11 06:43:59 2020 -0700 openacc: GOMP_MAP_ATTACH handling in find_group_last Arrange for GOMP_MAP_ATTACH to be grouped together with a preceding GOMP_MAP_TO_PSET or other "to" data movement clause, except in cases where an explicit "attach" clause is used. 2020-07-09 Julian Brown include/ * gomp-constants.h (gomp_map_kind): Update comment for GOMP_MAP_TO_PSET. libgomp/ * oacc-mem.c (find_group_last): Group data-movement clauses (GOMP_MAP_TO_PSET, GOMP_MAP_TO, etc.) together with a subsequent GOMP_MAP_ATTACH. Allow standalone GOMP_MAP_ATTACH also. Diff: --- include/gomp-constants.h | 5 ++++- libgomp/oacc-mem.c | 22 +++++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/include/gomp-constants.h b/include/gomp-constants.h index 1587e4d2ba2..b42b41403aa 100644 --- a/include/gomp-constants.h +++ b/include/gomp-constants.h @@ -65,7 +65,10 @@ enum gomp_map_kind /* Also internal, behaves like GOMP_MAP_TO, but additionally any GOMP_MAP_POINTER records consecutive after it which have addresses falling into that range will not be ignored if GOMP_MAP_TO_PSET wasn't - mapped already. */ + mapped already. + For OpenACC attach operations (e.g. copyin of struct members), + GOMP_MAP_TO_PSET is followed by a single GOMP_MAP_ATTACH mapping + instead. */ GOMP_MAP_TO_PSET = (GOMP_MAP_FLAG_SPECIAL_0 | 1), /* Must already be present. */ GOMP_MAP_FORCE_PRESENT = (GOMP_MAP_FLAG_SPECIAL_0 | 2), diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c index 4fb78ee9634..247ca135804 100644 --- a/libgomp/oacc-mem.c +++ b/libgomp/oacc-mem.c @@ -985,9 +985,15 @@ find_group_last (int pos, size_t mapnum, size_t *sizes, unsigned short *kinds) switch (kind0) { case GOMP_MAP_TO_PSET: - while (pos + 1 < mapnum && (kinds[pos + 1] & 0xff) == GOMP_MAP_POINTER) + if (pos + 1 < mapnum + && (kinds[pos + 1] & 0xff) == GOMP_MAP_ATTACH) + return pos + 1; + + while (pos + 1 < mapnum + && (kinds[pos + 1] & 0xff) == GOMP_MAP_POINTER) pos++; - /* We expect at least one GOMP_MAP_POINTER after a GOMP_MAP_TO_PSET. */ + /* We expect at least one GOMP_MAP_POINTER (if not a single + GOMP_MAP_ATTACH) after a GOMP_MAP_TO_PSET. */ assert (pos > first_pos); break; @@ -1002,6 +1008,9 @@ find_group_last (int pos, size_t mapnum, size_t *sizes, unsigned short *kinds) gomp_fatal ("unexpected mapping"); break; + case GOMP_MAP_ATTACH: + break; + default: /* GOMP_MAP_ALWAYS_POINTER can only appear directly after some other mapping. */ @@ -1012,9 +1021,16 @@ find_group_last (int pos, size_t mapnum, size_t *sizes, unsigned short *kinds) return pos + 1; } + /* We can have a single GOMP_MAP_ATTACH mapping after a to/from + mapping. */ + if (pos + 1 < mapnum + && (kinds[pos + 1] & 0xff) == GOMP_MAP_ATTACH) + return pos + 1; + /* We can have zero or more GOMP_MAP_POINTER mappings after a to/from (etc.) mapping. */ - while (pos + 1 < mapnum && (kinds[pos + 1] & 0xff) == GOMP_MAP_POINTER) + while (pos + 1 < mapnum + && (kinds[pos + 1] & 0xff) == GOMP_MAP_POINTER) pos++; }