[gomp4] add support for fortran allocate support with declare create

Cesar Philippidis cesar@codesourcery.com
Wed Apr 5 15:24:00 GMT 2017


This patch implements the OpenACC 2.5 behavior of fortran allocate on
variables marked with declare create as defined in Section 2.13.2 in the
OpenACC spec. To do so, I've added two new data mappings,
GOMP_MAP_DECLARE_ALLOCATE and GOMP_MAP_DECLARE_DEALLOCATE.

While working on adding support for allocate, I noticed that OpenACC
declare has a number of quirks. For starters, the fortran FE wasn't
lowering them properly, so there was no way for omplower to utilize them
inside acc parallel regions.

Next, I think the "omp declare target" attribute that was being
improperly assigned to all declared variables. The semantics of OpenACC
declare is slightly different from OpenMP. In OpenACC, declared
variables may have non-global lifetimes. Therefore, this patch relaxes
the fortran FE to only apply "omp declare target" to OpenACC declared
variables with the device_resident clause (which specifies that only a
device can have a copy of a variable). This ultimately enabled the use
of declared variables inside update directives, which in turn enables
additional declare testing.

There is still some unimplemented functionality.

 * The c and c++ FEs should be updated with the same declare behavior
   and we can use more declare test coverage in general.

 * Allocate only works on arrays, not scalar values.

 * This doesn't implement support for allocate as specified in Section
   2.13.1. That one involves adding malloc support inside acc routines
   and possibly other fortran runtime changes.

I've applied this patch to gomp-4_0-branch.

Cesar

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gomp4-declare-allocatable.diff
Type: text/x-patch
Size: 19403 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20170405/a0881b02/attachment.bin>


More information about the Fortran mailing list