From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 1B2253861030 for ; Thu, 10 Jun 2021 11:15:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1B2253861030 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: /M0NYpMhzDnwyl69GxjXSSh1kMgnvY95UnaneqkVVsQdwC+A6++F5ci8D95GEFi7MbbidJwqjH RZRca48sajgiDdAbYtZIx1/I6yaUw0iGWagHCgLnJqsypGL6BYp4WtA5ZQvKO5h5nulO8IBUAH t6Cb4G55SNpfbx2EjkJJ/0cQV/pavx5CY6QB2NxQhCWaQa+II/lpJMGrIl5jiu7LztWFO8sw+e hOZwfcg6aBN5YDz+/O7qK51PVmm/NblUy4/hyEySwGZpbFp0MyEcx9X2ZHgjN9MQbeAcv9ZOeW e1Y= X-IronPort-AV: E=Sophos;i="5.83,263,1616486400"; d="scan'208,223";a="64656849" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 10 Jun 2021 03:15:50 -0800 IronPort-SDR: hI5dK3bmAem3RUSO0yTqt7OAn5mA69k/Dnfj6nl+QVWcvJmXABvaQ4g2FUdOwBDokGIeqixUFE pgV9Em+tVejfnilDJ1mXduVaJXJrGzNJChqg0sXXyQ4i2WdCrnYqHVG89XoIg0sJNjhP+vZ56H bIhkQFUd0v/Kv/xb0HkdKTZrQRMYHlJOUNMO/DQ6xOv5bvs7GguVbNP9QhnBuT5Pc6fM8uxQkc e4n5x3zhnmrR1gX5Exw3qcnM0gzmZzdhJv6L4jdjCRODvDPBmIIci6Y36J4cUB8DVP587l5eGC dbc= From: Thomas Schwinge To: CC: Andrew Stubbs Subject: Re: [OpenACC] declare directive In-Reply-To: <562FDBF8.1040105@mentor.com> References: <562FDBF8.1040105@mentor.com> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Thu, 10 Jun 2021 13:15:34 +0200 Message-ID: <87mtryvull.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LOTSOFHASH, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jun 2021 11:15:53 -0000 --=-=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi! While working on something else... ;-) On 2015-10-27T15:18:00-0500, James Norris wrote: > --- a/libgomp/oacc-parallel.c > +++ b/libgomp/oacc-parallel.c > +GOACC_declare (int device, size_t mapnum, > + void **hostaddrs, size_t *sizes, unsigned short *kinds) > +{ > + int i; > + > + for (i =3D 0; i < mapnum; i++) > + { > + unsigned char kind =3D kinds[i] & 0xff; > + > + if (kind =3D=3D GOMP_MAP_POINTER || kind =3D=3D GOMP_MAP_TO_PSET) > + continue; > + > + switch (kind) > + { > + case GOMP_MAP_FORCE_ALLOC: > + case GOMP_MAP_FORCE_DEALLOC: > + case GOMP_MAP_FORCE_FROM: > + case GOMP_MAP_FORCE_TO: > + case GOMP_MAP_POINTER: > +[...] ... Andrew had noticed that given that we 'continue' for 'GOMP_MAP_POINTER', we cannot possibly encounter it afterwards. I've pushed "Clean up 'GOMP_MAP_POINTER' handling in 'libgomp/oacc-parallel.c:GOACC_declare'" to master branch in commit ae33c6deb158911548a5f1d383b683abb799be4a, see attached. Also, to facilitate later changes I've pushed "Move 'libgomp/oacc-parallel.c:GOACC_declare' into 'libgomp/oacc-mem.c'" to master branch in commit 0a77c7033ae4ed05a2f7e78600522610a8d82225, see attached. Gr=C3=BC=C3=9Fe Thomas ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 M=C3=BCnchen R= egistergericht M=C3=BCnchen HRB 106955, Gesch=C3=A4ftsf=C3=BChrer: Thomas H= eurung, Frank Th=C3=BCrauf --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename="0001-Clean-up-GOMP_MAP_POINTER-handling-in-libgomp-oacc-p.patch" >From ae33c6deb158911548a5f1d383b683abb799be4a Mon Sep 17 00:00:00 2001 From: Andrew Stubbs Date: Wed, 29 Jul 2020 15:05:45 +0100 Subject: [PATCH 1/2] Clean up 'GOMP_MAP_POINTER' handling in 'libgomp/oacc-parallel.c:GOACC_declare' Given that we 'continue' for 'GOMP_MAP_POINTER', we cannot possibly encounter it afterwards. Small fix-up for r230275 (commit 6e232ba4246ca324a663ec5ddf0ba4db5cf3fbad) "[OpenACC] declare directive". libgomp/ * oacc-parallel.c (GOACC_declare): Clean up 'GOMP_MAP_POINTER' handling. Co-Authored-By: Thomas Schwinge --- libgomp/oacc-parallel.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libgomp/oacc-parallel.c b/libgomp/oacc-parallel.c index cf1baf6291d..d05b3d87097 100644 --- a/libgomp/oacc-parallel.c +++ b/libgomp/oacc-parallel.c @@ -747,7 +747,6 @@ GOACC_declare (int flags_m, size_t mapnum, case GOMP_MAP_FORCE_ALLOC: case GOMP_MAP_FORCE_FROM: case GOMP_MAP_FORCE_TO: - case GOMP_MAP_POINTER: case GOMP_MAP_RELEASE: case GOMP_MAP_DELETE: GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i], -- 2.30.2 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename="0002-Move-libgomp-oacc-parallel.c-GOACC_declare-into-libg.patch" >From 0a77c7033ae4ed05a2f7e78600522610a8d82225 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 8 Jun 2021 17:15:19 +0200 Subject: [PATCH 2/2] Move 'libgomp/oacc-parallel.c:GOACC_declare' into 'libgomp/oacc-mem.c' This deals with data management, after all. Small fix-up for r230275 (commit 6e232ba4246ca324a663ec5ddf0ba4db5cf3fbad) "[OpenACC] declare directive". libgomp/ * oacc-parallel.c (GOACC_declare): Move... * oacc-mem.c: ... here. * libgomp_g.h: Adjust. --- libgomp/libgomp_g.h | 2 +- libgomp/oacc-mem.c | 54 ++++++++++++++++++++++++++++++++++++++ libgomp/oacc-parallel.c | 57 ----------------------------------------- 3 files changed, 55 insertions(+), 58 deletions(-) diff --git a/libgomp/libgomp_g.h b/libgomp/libgomp_g.h index 3cbe0a4ca89..b66b6978202 100644 --- a/libgomp/libgomp_g.h +++ b/libgomp/libgomp_g.h @@ -370,6 +370,7 @@ extern void GOACC_wait (int, int, ...); extern void GOACC_enter_exit_data (int, size_t, void **, size_t *, unsigned short *, int, int, ...); +extern void GOACC_declare (int, size_t, void **, size_t *, unsigned short *); /* oacc-parallel.c */ @@ -384,6 +385,5 @@ extern void GOACC_update (int, size_t, void **, size_t *, unsigned short *, int, int, ...); extern int GOACC_get_num_threads (void); extern int GOACC_get_thread_num (void); -extern void GOACC_declare (int, size_t, void **, size_t *, unsigned short *); #endif /* LIBGOMP_G_H */ diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c index 405574dfa2b..056600aca52 100644 --- a/libgomp/oacc-mem.c +++ b/libgomp/oacc-mem.c @@ -1461,3 +1461,57 @@ GOACC_enter_exit_data (int flags_m, size_t mapnum, void **hostaddrs, thr->api_info = NULL; } } + +void +GOACC_declare (int flags_m, size_t mapnum, + void **hostaddrs, size_t *sizes, unsigned short *kinds) +{ + for (size_t i = 0; i < mapnum; i++) + { + unsigned char kind = kinds[i] & 0xff; + + if (kind == GOMP_MAP_POINTER || kind == GOMP_MAP_TO_PSET) + continue; + + switch (kind) + { + case GOMP_MAP_FORCE_ALLOC: + case GOMP_MAP_FORCE_FROM: + case GOMP_MAP_FORCE_TO: + case GOMP_MAP_RELEASE: + case GOMP_MAP_DELETE: + GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i], + &kinds[i], GOMP_ASYNC_SYNC, 0); + break; + + case GOMP_MAP_FORCE_DEVICEPTR: + break; + + case GOMP_MAP_ALLOC: + if (!acc_is_present (hostaddrs[i], sizes[i])) + GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i], + &kinds[i], GOMP_ASYNC_SYNC, 0); + break; + + case GOMP_MAP_TO: + GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i], + &kinds[i], GOMP_ASYNC_SYNC, 0); + break; + + case GOMP_MAP_FROM: + GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i], + &kinds[i], GOMP_ASYNC_SYNC, 0); + break; + + case GOMP_MAP_FORCE_PRESENT: + if (!acc_is_present (hostaddrs[i], sizes[i])) + gomp_fatal ("[%p,%ld] is not mapped", hostaddrs[i], + (unsigned long) sizes[i]); + break; + + default: + assert (0); + break; + } + } +} diff --git a/libgomp/oacc-parallel.c b/libgomp/oacc-parallel.c index d05b3d87097..939e09f2b0c 100644 --- a/libgomp/oacc-parallel.c +++ b/libgomp/oacc-parallel.c @@ -728,60 +728,3 @@ GOACC_get_thread_num (void) { return 0; } - -void -GOACC_declare (int flags_m, size_t mapnum, - void **hostaddrs, size_t *sizes, unsigned short *kinds) -{ - int i; - - for (i = 0; i < mapnum; i++) - { - unsigned char kind = kinds[i] & 0xff; - - if (kind == GOMP_MAP_POINTER || kind == GOMP_MAP_TO_PSET) - continue; - - switch (kind) - { - case GOMP_MAP_FORCE_ALLOC: - case GOMP_MAP_FORCE_FROM: - case GOMP_MAP_FORCE_TO: - case GOMP_MAP_RELEASE: - case GOMP_MAP_DELETE: - GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i], - &kinds[i], GOMP_ASYNC_SYNC, 0); - break; - - case GOMP_MAP_FORCE_DEVICEPTR: - break; - - case GOMP_MAP_ALLOC: - if (!acc_is_present (hostaddrs[i], sizes[i])) - GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i], - &kinds[i], GOMP_ASYNC_SYNC, 0); - break; - - case GOMP_MAP_TO: - GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i], - &kinds[i], GOMP_ASYNC_SYNC, 0); - - break; - - case GOMP_MAP_FROM: - GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i], - &kinds[i], GOMP_ASYNC_SYNC, 0); - break; - - case GOMP_MAP_FORCE_PRESENT: - if (!acc_is_present (hostaddrs[i], sizes[i])) - gomp_fatal ("[%p,%ld] is not mapped", hostaddrs[i], - (unsigned long) sizes[i]); - break; - - default: - assert (0); - break; - } - } -} -- 2.30.2 --=-=-=--