diff options
author | Julian Brown <julian@codesourcery.com> | 2020-06-18 05:11:08 -0700 |
---|---|---|
committer | Julian Brown <julian@codesourcery.com> | 2020-07-27 09:16:57 -0700 |
commit | bc4ed079dc09a62168699227a794ac52a5b6f6a4 (patch) | |
tree | 48c5dac67ba13e457724af37f8cec35501cf3d2e /libgomp/libgomp.h | |
parent | 2251b4a5423efa8ee0d7e67537b63e404a1f6afa (diff) | |
download | gcc-bc4ed079dc09a62168699227a794ac52a5b6f6a4.zip gcc-bc4ed079dc09a62168699227a794ac52a5b6f6a4.tar.gz gcc-bc4ed079dc09a62168699227a794ac52a5b6f6a4.tar.bz2 |
openacc: Deep copy attach/detach should not affect reference counts
Attach and detach operations are not supposed to affect structural or
dynamic reference counts for OpenACC. Previously they did so, which led to
subtle problems in some circumstances. We can avoid reference-counting
attach/detach operations by extending and slightly repurposing the
do_detach field in target_var_desc. It is now called is_attach to better
reflect its new role.
2020-07-27 Julian Brown <julian@codesourcery.com>
Thomas Schwinge <thomas@codesourcery.com>
libgomp/
* libgomp.h (struct target_var_desc): Rename do_detach field to
is_attach.
* oacc-mem.c (goacc_exit_datum_1): Add assert. Don't set finalize for
GOMP_MAP_FORCE_DETACH. Update checking to use is_attach field.
(goacc_enter_data_internal): Don't affect reference counts
for attach mappings.
(goacc_exit_data_internal): Don't affect reference counts for detach
mappings.
* target.c (gomp_map_vars_existing): Don't affect reference counts for
attach mappings.
(gomp_map_vars_internal): Set renamed is_attach flag unconditionally to
mark attach mappings.
(gomp_unmap_vars_internal): Use is_attach flag to prevent affecting
reference count for attach mappings.
* testsuite/libgomp.oacc-c-c++-common/mdc-refcount-1.c: New test.
* testsuite/libgomp.oacc-c-c++-common/mdc-refcount-2.c: New test.
* testsuite/libgomp.oacc-c-c++-common/mdc-refcount-2.c: New test.
* testsuite/libgomp.oacc-fortran/deep-copy-6-no_finalize.F90: Mark
test as shouldfail.
* testsuite/libgomp.oacc-fortran/deep-copy-6.f90: Adjust to fail
gracefully in no-finalize mode.
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
Diffstat (limited to 'libgomp/libgomp.h')
-rw-r--r-- | libgomp/libgomp.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h index 7b52ce7..f9080e9 100644 --- a/libgomp/libgomp.h +++ b/libgomp/libgomp.h @@ -952,8 +952,8 @@ struct target_var_desc { bool copy_from; /* True if data always should be copied from device to host at the end. */ bool always_copy_from; - /* True if variable should be detached at end of region. */ - bool do_detach; + /* True if this is for OpenACC 'attach'. */ + bool is_attach; /* Relative offset against key host_start. */ uintptr_t offset; /* Actual length. */ |