[gomp4] add support for allocatable scalars in OpenACC declare constructs

Cesar Philippidis cesar@codesourcery.com
Wed Apr 19 18:11:00 GMT 2017


I've applied this patch to gomp-4_0-branch to add support for fortran
allocatable scalars inside OpenACC declare constructs. In order to
update the declared variable on the device, the fortran FE now uses the
GOMP_MAP_ALWAYS_POINTERS for declared allocatable scalars. That
necessitated some minor tweaking in the runtime. Note that I didn't add
support for allocatable derived types in this patch as the OpenACC 2.5
spec is still unclear on them.

Included in this patch is a bug fix for non-declared allocatable
scalars. Specifically, prior to this patch, the gimplifier would treat
allocatable scalar variables like C pointers, so only the pointer would
be updated on the accelerator and not the value being pointed to. If the
user explicitly specified a data clause for the variable, the fortran FE
itself would generate code to copy the value being pointed to along with
the pointer itself. I.e. this bug only affects implicit firstprivate
allocatable scalar variables. To resolve this issue, this patch teaches
lower_omp_target to pass the value being pointed to by a
GOMP_MAP_FIRSTPRIVATE_INT data mapping instead of the pointer itself to
the accelerator, then on entry to the offloaded region, lower_omp_target
will create a local copy of the pointed to value on target and along
with a local pointer to it.

Cesar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gomp4-allocatable-scalars.diff
Type: text/x-patch
Size: 17771 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20170419/a181be91/attachment.bin>


More information about the Fortran mailing list