diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2022-10-28 15:06:45 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2022-11-02 20:51:41 +0100 |
commit | f6ce1e77bbf5d3a096f52e674bfd7354c6537d10 (patch) | |
tree | 0a96485301ff432fc7643279ba3b3844b4faf450 /libgomp/oacc-mem.c | |
parent | da8e0e1191c5512244a752b30dea0eba83e3d10c (diff) | |
download | gcc-f6ce1e77bbf5d3a096f52e674bfd7354c6537d10.zip gcc-f6ce1e77bbf5d3a096f52e674bfd7354c6537d10.tar.gz gcc-f6ce1e77bbf5d3a096f52e674bfd7354c6537d10.tar.bz2 |
Support OpenACC 'declare create' with Fortran allocatable arrays, part II [PR106643, PR96668]
PR libgomp/106643
PR fortran/96668
libgomp/
* oacc-mem.c (goacc_enter_data_internal): Support
OpenACC 'declare create' with Fortran allocatable arrays, part II.
* testsuite/libgomp.oacc-fortran/declare-allocatable-array_descriptor-1-directive.f90:
Adjust.
* testsuite/libgomp.oacc-fortran/pr106643-1.f90: New.
Diffstat (limited to 'libgomp/oacc-mem.c')
-rw-r--r-- | libgomp/oacc-mem.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c index ba010fd..233fe0e 100644 --- a/libgomp/oacc-mem.c +++ b/libgomp/oacc-mem.c @@ -1166,7 +1166,10 @@ goacc_enter_data_internal (struct gomp_device_descr *acc_dev, size_t mapnum, struct target_mem_desc *tgt = n->tgt; - /* Arrange so that OpenACC 'declare' code à la PR106643 + /* Minimal OpenACC variant corresponding to PR96668 + "[OpenMP] Re-mapping allocated but previously unallocated + allocatable does not work" 'libgomp/target.c' changes, so that + OpenACC 'declare' code à la PR106643 "[gfortran + OpenACC] Allocate in module causes refcount error" has a chance to work. */ if ((kinds[i] & 0xff) == GOMP_MAP_TO_PSET @@ -1181,6 +1184,16 @@ goacc_enter_data_internal (struct gomp_device_descr *acc_dev, size_t mapnum, assert ((kinds[i + k] & 0xff) == GOMP_MAP_POINTER); } + /* Let 'goacc_map_vars' -> 'gomp_map_vars_internal' handle + this. */ + gomp_mutex_unlock (&acc_dev->lock); + struct target_mem_desc *tgt_ + = goacc_map_vars (acc_dev, aq, groupnum, &hostaddrs[i], NULL, + &sizes[i], &kinds[i], true, + GOMP_MAP_VARS_ENTER_DATA); + assert (tgt_ == NULL); + gomp_mutex_lock (&acc_dev->lock); + /* Given that 'goacc_exit_data_internal'/'goacc_exit_datum_1' will always see 'n->refcount == REFCOUNT_INFINITY', there's no need to adjust 'n->dynamic_refcount' here. */ |