[Patch] OpenACC – support "if" + "if_present" clauses with "host_data"

Tobias Burnus tobias@codesourcery.com
Tue Dec 24 14:24:00 GMT 2019


On the front-end side, adding "if" and "if_present" to the  "acc 
host_data" directive is simple as other directives already support those 
clauses.

The 'if_present' status has to be passed along the use_device_ptr flag; 
for this a new flag has been introduced, using the gap in the 
gomp_map_kind enum (16 was still free; now used for 
GOMP_MAP_USE_DEVICE_PTR_IF_PRESENT, use_device_ptr has 14).

There was some forth and back whether a new enum should be used or a 
flag (passed in the device argument, as OpenACC only uses host and 
device and not a device number). Initial version was with new enum, then 
with flag and now again a new enum.

On the libgomp side, one simply needs to skip the if-not-present error 
and otherwise handle it as use_device_ptr.

Build on x86-64-gnu-linux without offloading and with nvptx offloading.
OK for the trunk?

Cheers,

Tobias

PS: History: The initial version (not public) used an enum but Thomas 
was wondering whether a flag is not the better solution, cf. discussion 
at https://gcc.gnu.org/ml/gcc/2018-12/msg00118.html – Hence, the first 
public version has switched to a flag and submitted for the OG8 
(openacc-gcc-8-branch GIT) branch at 
https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01559.html and has been 
committed as Rev. b52c8d006581b2a657ac3d81ab2527bb398b6615 (this commit 
is also part of OG9. — A minor fix was committed to OG8?/OG9 as Rev. 
995f9680a46c3a7246fe465faa847f8009e47ed8.

Thomas now wonders whether the flag will be future safe, hence, it now 
uses again an enum as in the original version.

PPS: Changes to OG9: Using again an enum; Fortran run-time test and rediffs.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: if_present-v2.diff
Type: text/x-patch
Size: 15821 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20191224/a80c46ba/attachment.bin>


More information about the Fortran mailing list