Hi! On 2020-03-31T19:41:40+0200, Tobias Burnus <tob...@codesourcery.com> wrote: > libgomp – fix handling of 'target enter data' > > * target.c (GOMP_target_enter_exit_data): Handle PSET/MAP_POINTER. > * testsuite/libgomp.fortran/target-enter-data-1.f90: New. > > libgomp/target.c | 13 +++++++- > .../libgomp.fortran/target-enter-data-1.f90 | 36 > ++++++++++++++++++++++ > 2 files changed, 48 insertions(+), 1 deletion(-)
> --- a/libgomp/target.c > +++ b/libgomp/target.c > @@ -2480,7 +2480,9 @@ GOMP_target_enter_exit_data (int device, size_t mapnum, > void **hostaddrs, > } > } > > - size_t i; > + /* The variables are mapped separately such that they can be released > + independently. */ > + size_t i, j; > if ((flags & GOMP_TARGET_FLAG_EXIT_DATA) == 0) > for (i = 0; i < mapnum; i++) > if ((kinds[i] & 0xff) == GOMP_MAP_STRUCT) > @@ -2489,6 +2491,15 @@ GOMP_target_enter_exit_data (int device, size_t > mapnum, void **hostaddrs, > &kinds[i], true, GOMP_MAP_VARS_ENTER_DATA); > i += sizes[i]; > } > + else if ((kinds[i] & 0xff) == GOMP_MAP_TO_PSET) > + { > + for (j = i + 1; j < mapnum; j++) > + if (!GOMP_MAP_POINTER_P (get_kind (true, kinds, j) & 0xff)) > + break; > + gomp_map_vars (devicep, j-i, &hostaddrs[i], NULL, &sizes[i], > + &kinds[i], true, GOMP_MAP_VARS_ENTER_DATA); > + i += j - i - 1; > + } > else > gomp_map_vars (devicep, 1, &hostaddrs[i], NULL, &sizes[i], &kinds[i], > true, GOMP_MAP_VARS_ENTER_DATA); Aha, thanks -- that resolves doubts I had (but Julian and I couldn't allocate time to track down): see 'GOMP_target_enter_exit_data' mentioned in <http://mid.mail-archive.com/87pngsz1qy.fsf@euler.schwinge.homeip.net> ff., for example. Isn't that a pretty severe Fortran OpenMP offloading issue, and should get a PR allocated, and fixed on release branches, too? > --- /dev/null > +++ b/libgomp/testsuite/libgomp.fortran/target-enter-data-1.f90 > @@ -0,0 +1,36 @@ > +program main > +[...] I pushed to master branch commit 6b816a5f0ed078cb2d380e10e68a95fb7e3d6778 "Add 'dg-do run' to 'libgomp.fortran/target-enter-data-1.f90'", see attached. Grüße Thomas ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
>From 6b816a5f0ed078cb2d380e10e68a95fb7e3d6778 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge <tho...@codesourcery.com> Date: Wed, 1 Apr 2020 23:26:56 +0200 Subject: [PATCH] Add 'dg-do run' to 'libgomp.fortran/target-enter-data-1.f90' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix-up for commit 689418b97e5eb6a221871a2439bca3e6283ac579 "libgomp – fix handling of 'target enter data'". libgomp/ * testsuite/libgomp.fortran/target-enter-data-1.f90: Add 'dg-do run'. --- libgomp/ChangeLog | 5 +++++ libgomp/testsuite/libgomp.fortran/target-enter-data-1.f90 | 2 ++ 2 files changed, 7 insertions(+) diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 0e4958f0c67..beff3d65b44 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2020-04-10 Thomas Schwinge <tho...@codesourcery.com> + + * testsuite/libgomp.fortran/target-enter-data-1.f90: Add 'dg-do + run'. + 2020-04-08 Tobias Burnus <tob...@codesourcery.com> PR middle-end/94120 diff --git a/libgomp/testsuite/libgomp.fortran/target-enter-data-1.f90 b/libgomp/testsuite/libgomp.fortran/target-enter-data-1.f90 index 91dedebf0a0..39faffd44c2 100644 --- a/libgomp/testsuite/libgomp.fortran/target-enter-data-1.f90 +++ b/libgomp/testsuite/libgomp.fortran/target-enter-data-1.f90 @@ -1,3 +1,5 @@ +! { dg-do run } + program main implicit none integer, allocatable, dimension(:) :: AA, BB, CC, DD -- 2.17.1