Initial support for USE_DEVICE_PTR clause on OMP TARGET DATA directive.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Are you planning to implement this check:
A list item that specifies a given variable may not appear in more than one use_device_ptr clause.
flang/test/Semantics/OpenMP/use_device_ptr.f90 | ||
---|---|---|
22 | New line here. |
Yes, in a future patch in which I am thinking to add more checks related to restrictions.
Thanks for the patch. I have a few comments inline.
flang/lib/Semantics/resolve-directives.cpp | ||
---|---|---|
440 | We probably need a debug-dump-symbols test to show that the SymbolFlag is applied. | |
510 | From the standard:
Since the pointer in the use_device_ptr is privatised, it is best to follow the representation for privatised variables i.e represent them with a new Symbol. It is probably good to add Symbol::Flag::OmpUseDevicePtr to ompFlagsRequireNewSymbol. | |
flang/test/Semantics/OpenMP/use_device_ptr.f90 | ||
16 | If the location pointed to by b inside the region is different from the location pointed outside to by b then it is probably better to create a new symbol for b inside the region. |
At the moment a new symbol is not created because target data does not create a scope at the moment. We have to modify the OmpVisitor::NeedsScope function in resolve-names.cpp file to create a scope.
Please update the document (https://github.com/llvm/llvm-project/blob/main/flang/docs/OpenMP-semantics.md) to include that new scope is created for target data and new Symbol is created for use_device_pointer. Also include the reason.
flang/test/Semantics/OpenMP/use_device_ptr.f90 | ||
---|---|---|
15 | The test should check both the original symbol and the host-associated symbol. |
Can you please point me to the location where I should be adding the reason. Should it be mentioned in flang/docs/OpenMP-semantics.md? If so under which section should I mention it.
LGTM. Thanks for the patch and for addressing the review comments.
Yes, in flang/docs/OpenMP-semantics.md. Please add as additional info in the sections where you made changes.
We probably need a debug-dump-symbols test to show that the SymbolFlag is applied.