mbox series

[0/7,OpenACC] Dynamic reference counts for mapped data

Message ID cover.1590182783.git.julian@codesourcery.com
Headers show
Series Dynamic reference counts for mapped data | expand

Message

Julian Brown May 22, 2020, 10:16 p.m. UTC
After questions from Thomas:

https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545399.html

here is a patch series that adjusts how reference counting works
(again) for dynamic data lifetimes in OpenACC.  Since the "overhaul"
patch was applied,

https://gcc.gnu.org/legacy-ml/gcc-patches/2019-12/msg01249.html

dynamic data lifetimes have been represented by counting "excess"
references beyond those that are explicitly part of the linked splay
tree/target memory descriptor data structure.  This allowed self-test
code to be written to ensure that reference counts remained consistent
throughout execution.

However, there were some awkward corner-cases, which -- though fixable
-- made some of the code more complex than it could have been.  So,
this patch series reverts the dynamic reference counting implementation
to the previous semantics, which are that the dynamic reference count
recorded in each mapping's splay tree key corresponds more directly to
the source-level semantics (i.e. "enter data" operations increment the
reference count, and "exit data" operations decrement it).

This is not a plain revert of the "overhaul" patch above.  I have tried
to keep various refactoring introduced in that patch in place, though
I have re-introduced some error checking that the aforementioned patch
removed.

I have also managed to adjust the (still optional, development use only)
self-checking code to be able to work with the "dynamic_refcount" scheme.
A couple of patches containing minor cleanups are included too.

Tested with offloading to NVPTX (as a series). OK?

Julian Brown (7):
  [OpenACC] Missing unlocking on error paths in attach/detach code
  [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] Distinguish structural/dynamic mappings in libgomp
  [OpenACC] Reference count self-checking (dynamic_refcount version)
  [OpenACC] Stricter dynamic data unmapping testing (WIP)

 libgomp/libgomp.h                             |  29 +-
 libgomp/oacc-int.h                            |   3 +
 libgomp/oacc-mem.c                            | 306 +++++++++++++-----
 libgomp/oacc-parallel.c                       |  27 ++
 libgomp/target.c                              | 231 +++++++++++--
 .../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 ++
 8 files changed, 542 insertions(+), 117 deletions(-)
 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