[og7] Update deviceptr handling in Fortran

Cesar Philippidis cesar@codesourcery.com
Mon May 7 15:49:00 GMT 2018


This patch teaches both the Fortran FE and the gimplifier how to only
utilize one data mapping for OpenACC deviceptr clauses. Before, the
Fortran FE would create three (one for the dereferenced pointer data,
one for the array descriptor, and another for a firstprivate pointer)
and gimplifier would create two (one for the dereferenced pointer data,
and another for a pointer). Additionally, this patch teaches the
gimplifer to propagate the deviceptr clause to OpenACC parallel and
kernels nested inside OpenACC data regions. E.g.

  !$acc data deviceptr (a)
  !$acc parallel loop
  do ...
  enddo
  !$acc end data

Before this patch, variable 'a' would be implicitly assigned a copy data
clause. Now the gimplifier assigns a deviceptr clause to it.

In addition to XPASS'ing devicetpr-1.f90, this patch resolves a couple
of regressions that Thomas encountered while rebasing the og7 patches on
top of GCC 8. Specifically, the new libgomp gomp_copy_host2dev
optimization creates a copy of the data mapping arguments to a host
buffer so the multiple adjacent data mappings can be uploaded to the
accelerator using a single device host2dev copy. Naturally, this fails
when the runtime tries to deference deviceptrs because those pointers
may not be valid on the host.

I've applied this patch to og7, and I'll backport the gomp_copy_host2dev
enhancements to og7 in a followup patch. It was tempting to remove the
XFAIL from deviceptr-1.f90, but the test case still fails on at least
one legacy driver.

Cesar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: og7-gfc-deviceptr.diff
Type: text/x-patch
Size: 3959 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180507/01f8e97f/attachment.bin>


More information about the Gcc-patches mailing list