[PATCH][OpenACC] Add support for firstprivate Fortran allocatable scalars

Cesar Philippidis cesar@codesourcery.com
Tue Aug 7 21:55:00 GMT 2018


This patch updates the way that lower_omp_target uses firstprivate
pointers in OpenACC offloaded regions. On host side, when preparing
firstprivate data mapping for pointer type objects, not to be confused
with GOMP_MAP_FIRSTPRIVATE_POINTER, the compiler passes passes the
address of the value being pointed to and not the address of the pointer
itself to the runtime. Correspondingly, on the device side, the compiler
generates to code to dereference the remapped pointer once to copy the
data to a local buffer.

While this behavior looks like it would break things, it will not affect
C or C++ data mappings, because those languages transfer pointers via
GOMP_MAP_FIRSTPRIVATE_POINTER. In addition, this will not cause
problems with array types, because the default remapping rules for
OpenACC is to transfer them in via copy. Besides it really doesn't
make sense to allow arrays to be transferred in via firstprivate
because that would use up a lot of memory on the accelerator.

Is this OK for trunk? I bootstrapped and regtested it for x86_64 with
nvptx offloading.

Thanks,
Cesar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-OpenACC-Add-support-for-firstprivate-Fortran-allocat.patch
Type: text/x-patch
Size: 4272 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180807/a9ca46e7/attachment.bin>


More information about the Gcc-patches mailing list