]> git.ipfire.org Git - thirdparty/gcc.git/commit
OpenACC 2.7: Adjust acc_map_data/acc_unmap_data interaction with reference counters
authorChung-Lin Tang <cltang@baylibre.com>
Tue, 16 Apr 2024 09:03:21 +0000 (09:03 +0000)
committerChung-Lin Tang <cltang@baylibre.com>
Tue, 16 Apr 2024 09:04:11 +0000 (09:04 +0000)
commita7578a077ed8b64b94282aa55faf7037690abbc5
tree1ec72d713dc1e66fa238d3b15396b21b30d75144
parent274f6bbe2328f899fd4e24636e0d71ac08c99856
OpenACC 2.7: Adjust acc_map_data/acc_unmap_data interaction with reference counters

This patch adjusts the implementation of acc_map_data/acc_unmap_data API library
routines to more fit the description in the OpenACC 2.7 specification.

Instead of using REFCOUNT_INFINITY, we now define a REFCOUNT_ACC_MAP_DATA
special value to mark acc_map_data-created mappings. Adjustment around
mapping related code to respect OpenACC semantics are also added.

libgomp/ChangeLog:

* libgomp.h (REFCOUNT_ACC_MAP_DATA): Define as (REFCOUNT_SPECIAL | 2).
* oacc-mem.c (acc_map_data): Adjust to use REFCOUNT_ACC_MAP_DATA,
initialize dynamic_refcount as 1.
(acc_unmap_data): Adjust to use REFCOUNT_ACC_MAP_DATA,
(goacc_map_var_existing): Add REFCOUNT_ACC_MAP_DATA case.
(goacc_exit_datum_1): Add REFCOUNT_ACC_MAP_DATA case, respect
REFCOUNT_ACC_MAP_DATA when decrementing/finalizing. Force lowest
dynamic_refcount to be 1 for REFCOUNT_ACC_MAP_DATA.
(goacc_enter_data_internal): Add REFCOUNT_ACC_MAP_DATA case.
* target.c (gomp_increment_refcount): Return early for
REFCOUNT_ACC_MAP_DATA case.
(gomp_decrement_refcount): Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-96.c: New testcase.
* testsuite/libgomp.oacc-c-c++-common/unmap-infinity-1.c: Adjust
testcase error output scan test.
libgomp/libgomp.h
libgomp/oacc-mem.c
libgomp/target.c
libgomp/testsuite/libgomp.oacc-c-c++-common/lib-96.c [new file with mode: 0644]
libgomp/testsuite/libgomp.oacc-c-c++-common/unmap-infinity-1.c