https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120194

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
> ... this is ill-formed OpenMP?

For 'requires unified_shared_memory', you are in the realm of un(der)specified
behavior as OpenMP does not even mention how this case is handled.

If you do (A) - or (B.1) + (B.2) - you are on the safe side.
[I think; having 'map' clauses while the library otherwise assumes shared
memory might have some corner-case issues.]

(A) also works without USM (ignoring pointer members) while (B) means that host
and device data are always in sync.

* * *

Note that for 'self_maps' the following applies:

"all corresponding list items created by the 'enter' clauses specified by
'declare target' directives in the compilation unit share storage with the
original list items." [I note that this doesn't talk about the 'link' clause,
though.]

While GCC supports 'self_maps' since GCC 15, this feature subfeature is not yet
implemented and on my to-do list for GCC 16. The idea is to implement it as
(B.1) [i.e. turn 'enter' to 'link'] plus (B.2) - but simply setting all 'link'
pointers by the host pointer.

For 'unified_shared_memory' (B.2) is probably useful as well, but regarding
'enter' → 'link' I am not sure.

Reply via email to