This patch series collects several improvements/bugfixes to the reference counting and manual deep-copy implementation for OpenACC, mostly based on review feedback from Thomas. In short, areas addressed are:
- Some unexpectedly-dead code in goacc_enter_data_internal introduced by "Adjust dynamic reference count semantics" is no longer dead. Flagged by Thomas in: https://gcc.gnu.org/pipermail/gcc-patches/2020-June/547196.html - PR95270 ("OpenACC 'enter data attach' looks up target memory object displaced by pointer size") has been fixed for C, C++ and Fortran. - As part of the Fortran fix above, we no longer strip GOMP_MAP_TO_PSET, GOMP_MAP_POINTER from OpenACC "enter data" and "exit data" directives. - We now suppress detach operations for "no-op" exit data operations when the dynamic refcount for the associated data is zero, fixing several newishly-added testcases. Further discussion on individual patches. Tested (as a series) with offloading to NVPTX. OK? Thanks, Julian Julian Brown (9): [OpenACC] Fortran derived-type mapping fix [OpenACC] GOMP_MAP_ATTACH handling in find_group_last [OpenACC] Adjust dynamic reference count semantics [OpenACC] Don't pass kind array via pointer to goacc_enter_datum [OpenACC] Fix incompatible copyout for acc_map_data (PR92843) [OpenACC] Set bias to zero for explicit attach/detach clauses in C and C++ [OpenACC] Do not strip GOMP_MAP_TO_PSET/GOMP_MAP_POINTER for enter/exit data directives [OpenACC] Fix standalone attach for Fortran assumed-shape array pointers [OpenACC] Don't detach for no-op exit data with zero dynamic refcount gcc/c/c-typeck.c | 8 + gcc/cp/semantics.c | 8 + gcc/fortran/trans-openmp.c | 44 +++- gcc/gimplify.c | 11 +- gcc/testsuite/c-c++-common/goacc/mdc-1.c | 14 +- gcc/testsuite/gfortran.dg/goacc/finalize-1.f | 4 +- .../gfortran.dg/goacc/mapping-tests-3.f90 | 15 ++ .../gfortran.dg/goacc/mapping-tests-4.f90 | 17 ++ libgomp/libgomp.h | 8 +- libgomp/oacc-mem.c | 243 ++++++++++++++---- libgomp/target.c | 38 +-- .../libgomp.oacc-c-c++-common/pr92843-1.c | 1 - .../libgomp.oacc-c-c++-common/refcounting-1.c | 31 +++ .../libgomp.oacc-c-c++-common/refcounting-2.c | 31 +++ .../attach-descriptor-1.f90 | 51 ++++ .../libgomp.oacc-fortran/deep-copy-6.f90 | 6 +- .../mdc-refcount-1-1-1.f90 | 6 +- .../mdc-refcount-1-1-2.F90 | 2 +- .../mdc-refcount-1-2-1.f90 | 6 +- .../mdc-refcount-1-2-2.f90 | 6 +- .../mdc-refcount-1-3-1.f90 | 6 +- .../mdc-refcount-1-3-2.f90 | 5 +- .../mdc-refcount-1-4-1.f90 | 6 +- .../mdc-refcount-1-4-2.f90 | 5 +- 24 files changed, 430 insertions(+), 142 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/goacc/mapping-tests-3.f90 create mode 100644 gcc/testsuite/gfortran.dg/goacc/mapping-tests-4.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/refcounting-1.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/refcounting-2.c create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/attach-descriptor-1.f90 -- 2.23.0