This patch series provides fixes for some cases of mixing static and dynamic data lifetimes in OpenACC, hopefully addressing some of Thomas's concerns in PR92843 -- in particular that an "exit data"-type operation on a given variable inside a structured block (also mapping that variable) should be a no-op.
On further investigation of related patterns, other cases of mixing static and dynamic lifetimes also turn out to problematic at present. Some of these cases are handled by this patch series, and others are diagnosed as errors (rather than allowing silent and hard-to-diagnose failures later during runtime). The first two patches are sufficient to fix the test case introduced for PR92843, and the third patch provides further support/diagnostics for dynamic unmapping operations taking place within structured blocks. Further commentary provided alongside individual patches. Tested with offloading to NVPTX, also with a version of my refcount-verification patch (not currently on trunk). I believe this (at least the first two parts) fixes a regression (for the pr92843-1.c test case), so OK for stage 4? Thanks, Julian Julian Brown (3): Introduce dynamic data mapping sentinel for OpenACC Don't copy back vars mapped with acc_map_data OpenACC dynamic data lifetimes ending within structured blocks libgomp/libgomp.h | 3 +- libgomp/oacc-int.h | 2 + libgomp/oacc-mem.c | 158 ++++++++++++--- libgomp/target.c | 56 +++++- .../libgomp.oacc-c-c++-common/pr92843-1.c | 4 +- .../static-dynamic-lifetimes-1-lib.c | 3 + .../static-dynamic-lifetimes-1.c | 160 +++++++++++++++ .../static-dynamic-lifetimes-2-lib.c | 3 + .../static-dynamic-lifetimes-2.c | 166 ++++++++++++++++ .../static-dynamic-lifetimes-3-lib.c | 3 + .../static-dynamic-lifetimes-3.c | 183 ++++++++++++++++++ .../static-dynamic-lifetimes-4-lib.c | 6 + .../static-dynamic-lifetimes-4.c | 71 +++++++ .../static-dynamic-lifetimes-5-lib.c | 6 + .../static-dynamic-lifetimes-5.c | 63 ++++++ .../static-dynamic-lifetimes-6-lib.c | 5 + .../static-dynamic-lifetimes-6.c | 46 +++++ .../static-dynamic-lifetimes-7-lib.c | 5 + .../static-dynamic-lifetimes-7.c | 45 +++++ .../static-dynamic-lifetimes-8-lib.c | 5 + .../static-dynamic-lifetimes-8.c | 50 +++++ 21 files changed, 1000 insertions(+), 43 deletions(-) create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-1-lib.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-1.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-2-lib.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-2.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-3-lib.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-3.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-4-lib.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-4.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-5-lib.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-5.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-6-lib.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-6.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-7-lib.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-7.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-8-lib.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/static-dynamic-lifetimes-8.c -- 2.23.0