public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/2] [OpenACC] Attached deep-copy pointers, diagnostics & modifications
@ 2020-06-22 12:14 Julian Brown
  2020-06-22 12:14 ` [PATCH 1/2] [OpenACC] Refuse update/copyout for blocks with attached pointers Julian Brown
  2020-06-22 12:14 ` [PATCH 2/2] [OpenACC] Detect pointer updates for attach operations (PR95590) Julian Brown
  0 siblings, 2 replies; 6+ messages in thread
From: Julian Brown @ 2020-06-22 12:14 UTC (permalink / raw)
  To: gcc-patches; +Cc: Thomas Schwinge, Jakub Jelinek, Catherine Moore

Investigating PR95590, I realised that we can do better at diagnosing
some potentially troublesome usage of OpenACC "attach" behaviour, namely
updating blocks with attached pointers. Updating either the host copy
or device copy of such a block is problematic -- for a host update,
the host may get a clobbered (device) version of a host pointer in its
local version of the block (e.g. struct). A device update may clobber
an attached device pointer with a host pointer.

The spec text (OpenACC 3.0, "2.6.8. Attachment Counter") covering this
case is:

  "Pointer members of structs, classes, or derived types in device
   or host memory can be overwritten due to update directives or API
   routines. It is the user’s responsibility to ensure that the pointers
   have the appropriate values before or after the data movement in
   either direction. The behavior of the program is undefined if any
   of the pointer members are attached when an update of a composite
   variable is performed."

The first patch in this series addresses that paragraph by making
such updates (as well as copyouts, similarly) be runtime errors. The same
text *might* also be an argument _against_ the fix in the second patch,
though that is perhaps debatable (further discussion on that patch).

Tested with offloading to NVPTX. OK?

Julian

Julian Brown (2):
  [OpenACC] Refuse update/copyout for blocks with attached pointers
  [OpenACC] Detect pointer updates for attach operations (PR95590)

 libgomp/oacc-mem.c                            | 42 +++++++++--
 libgomp/target.c                              | 56 ++++++++++++--
 .../attach-ptr-change-1.c                     | 74 +++++++++++++++++++
 .../copyback-attached-dynamic-1.c             | 31 ++++++++
 .../copyback-attached-structural-1.c          | 30 ++++++++
 .../copyback-attached-structural-2.c          | 31 ++++++++
 .../copyback-attached-structural-3.c          | 26 +++++++
 .../delete-attached-dynamic-1.c               | 26 +++++++
 .../delete-attached-structural-1.c            | 25 +++++++
 .../delete-attached-structural-2.c            | 26 +++++++
 .../update-attached-1.c                       | 33 +++++++++
 .../deep-copy-6-no_finalize.F90               |  6 +-
 12 files changed, 390 insertions(+), 16 deletions(-)
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/attach-ptr-change-1.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/copyback-attached-dynamic-1.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/copyback-attached-structural-1.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/copyback-attached-structural-2.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/copyback-attached-structural-3.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/delete-attached-dynamic-1.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/delete-attached-structural-1.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/delete-attached-structural-2.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/update-attached-1.c

-- 
2.23.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-24 22:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22 12:14 [PATCH 0/2] [OpenACC] Attached deep-copy pointers, diagnostics & modifications Julian Brown
2020-06-22 12:14 ` [PATCH 1/2] [OpenACC] Refuse update/copyout for blocks with attached pointers Julian Brown
2020-07-24 13:37   ` Thomas Schwinge
2020-06-22 12:14 ` [PATCH 2/2] [OpenACC] Detect pointer updates for attach operations (PR95590) Julian Brown
2020-07-24 14:04   ` Thomas Schwinge
2020-07-24 22:36     ` Julian Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).