[flang][OpenMP] Implement HAS_DEVICE_ADDR clause #252
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The HAS_DEVICE_ADDR indicates that the object(s) listed exists at an address that is a valid device address. Specifically,
has_device_addr(x)
means that (in C/C++ terms)&x
is a device address.When entering a target region,
x
does not need to be allocated on the device, or have its contents copied over (in the absence of additional mapping clauses). Passing its address verbatim to the region for use is sufficient, and is the intended goal of the clause.Some Fortran objects use descriptors in their in-memory representation. If
x
had a descriptor, both the descriptor and the contents ofx
would be located in the device memory. However, the descriptors are managed by the compiler, and can be regenerated at various points as needed. The address of the effective descriptor may change, hence it's not safe to pass the address of the descriptor to the target region. Instead, the descriptor itself is always copied, but for objects likex
, no further mapping takes place (as this keeps the storage pointer in the descriptor unchanged).To accommodate this, descriptor mappings will be marked with the OMP_MAP_DESCRIPTOR flag.
This fixes #207