Without this patch, the following example fails but shouldn't
according to OpenMP TR8:
#pragma omp target enter data map(alloc:i) #pragma omp target data map(present, alloc: i) { #pragma omp target exit data map(delete:i) } // fails presence check here
OpenMP TR8 sec. 2.22.7.1 "map Clause", p. 321, L23-26 states:
If the map clause appears on a target, target data, target enter
data or target exit data construct with a present map-type-modifier
then on entry to the region if the corresponding list item does not
appear in the device data environment an error occurs and the
program terminates.
There is no corresponding statement about the exit from a region.
Thus, the present modifier should:
- Check for presence upon entry into any region, including a target exit data region. This behavior is already implemented correctly.
- Should not check for presence upon exit from any region, including a target or target data region. Without this patch, this behavior is not implemented correctly, breaking the above example.
In the case of target data, this patch fixes the latter behavior by
removing the present modifier from the map types Clang generates for
the runtime call at the end of the region.
In the case of target, we have not found a valid OpenMP program for
which such a fix would matter. It appears that, if a program can
guarantee that data is present at the beginning of a target region
so that there's no error there, that data is also guaranteed to be
present at the end.
Can this new flag be encapsulated in Info?