Hi!

On 2020-04-17T17:57:06+0200, Tobias Burnus <tob...@codesourcery.com> wrote:
> On 4/17/20 5:54 PM, Tobias Burnus wrote:
>> It turned out that doing
>>   omp enter data map(alloc:FortranArray)
>>   omp exit data map(delete:FortranArray)
>> left the array descriptor (fortranarray [as opposed to
>> fortranarray.data])
>> on the device. (cf. -fdump-tree-omplower in the PR.)
>>
>> Mapping FortranArray again (e.g. "map(tofrom:FortranArray)")
>> then failed by returning garbage.
>>
>> This patch now removes the descriptor with 'data exit',
>> which was passed as MAP_TO_PSET clause to the middle end,
>> but got removed.

So this is a fix-up for trunk r277631 "Fortran/OpenMP] Don't create
"alloc:" for 'target exit data'".  (Also cross-referencing PR92929
"OpenACC/OpenMP 'target' 'exit data'/'update' optimizations".)

>> Instead, the clause is now turned into MAP_DELETE.

Really 'GOMP_MAP_DELETE', or should that rather be 'GOMP_MAP_RELEASE'?
Considering nested data regions, for example:

  - 'enter data' // Increment reference count.
  - 'enter data' // Increment reference count.
  - 'exit data' // Should not "delete" here, but just "release"?
  - 'exit data' // Here, reference count the is zero, so "release" then equals 
"delete".

(I have neither tested this, not fully thought that through, especially
in context of (a) OpenMP, and (b) Fortran.)  ;-)


> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.fortran/target-enter-data-2.F90
> @@ -0,0 +1,40 @@
> +! { dg-additional-options "-DMEM_SHARED" { target offload_device_shared_as } 
> }
> +!
> +! PR middle-end/94635
> +  implicit none

As obvious, pushed the attached to master branch in commit
3f5d94c192b81a3868f32f309dadd5571ef51cdf "Add 'dg-do run' to
'libgomp.fortran/target-enter-data-2.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 3f5d94c192b81a3868f32f309dadd5571ef51cdf Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tho...@codesourcery.com>
Date: Mon, 20 Apr 2020 16:15:07 +0200
Subject: [PATCH] Add 'dg-do run' to 'libgomp.fortran/target-enter-data-2.F90'

Fix-up for commit af557050fd011a03d21dc26b31959033061a0443 "[OpenMP] Fix 'omp
exit data' for Fortran arrays (PR 94635)".

	libgomp/
	PR middle-end/94635
	* testsuite/libgomp.fortran/target-enter-data-2.F90: Add 'dg-do
	run'.
---
 libgomp/ChangeLog                                         | 6 ++++++
 libgomp/testsuite/libgomp.fortran/target-enter-data-2.F90 | 1 +
 2 files changed, 7 insertions(+)

diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index b1cf297a0d7..c524abbbfb6 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,9 @@
+2020-04-20  Thomas Schwinge  <tho...@codesourcery.com>
+
+	PR middle-end/94635
+	* testsuite/libgomp.fortran/target-enter-data-2.F90: Add 'dg-do
+	run'.
+
 2020-04-20  Tobias Burnus  <tob...@codesourcery.com>
 
 	PR middle-end/94120
diff --git a/libgomp/testsuite/libgomp.fortran/target-enter-data-2.F90 b/libgomp/testsuite/libgomp.fortran/target-enter-data-2.F90
index 320d8bf419f..36a2ed5ef11 100644
--- a/libgomp/testsuite/libgomp.fortran/target-enter-data-2.F90
+++ b/libgomp/testsuite/libgomp.fortran/target-enter-data-2.F90
@@ -1,4 +1,5 @@
 ! { dg-additional-options "-DMEM_SHARED" { target offload_device_shared_as } }
+! { dg-do run }
 !
 ! PR middle-end/94635
   implicit none
-- 
2.17.1

Reply via email to