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

--- Comment #3 from Chung-Lin Tang <cltang at gcc dot gnu.org> ---
The problem, at a low-level, is that the Fortran FE is using always_pointer,
while C/C++ front-ends generate attach_detach (and turns in attach after
gimplify).

attach and always_pointer both modify the GPU-side field into the correct GPU
pointer, but only attach will "clean-up" at the end, restoring the host-side
pointer contents, before the full implicit struct mapping copies back to the
host (due to tofrom map-kind).

Since Fortran array descriptors are like little structs, I think quickest fix
is to make the Fortran FE use 'attach_detach' for the array data pointer field.
That should immediately make things work.

A more elaborate way is to try to turn off the creation of the implicit mapping
for the whole array descriptor, which should be a killer of performance. (not
sure when this started, although prior changes did put implicit mappings to the
very front of the sequence)

Reply via email to