diff --git a/flang/docs/OpenMP-semantics.md b/flang/docs/OpenMP-semantics.md --- a/flang/docs/OpenMP-semantics.md +++ b/flang/docs/OpenMP-semantics.md @@ -418,6 +418,16 @@ OmpUseDevicePtr + + use_device_addr + + Yes + + New Symbol + + OmpUseDeviceAddr + + To determine the right data-sharing attribute, @@ -535,6 +545,11 @@ corresponding list items in the device data environment are assigned into the private versions so it is best to follow the representation for privatised variables i.e represent them with a new Symbol and `OmpUseDevicePtr` flag. +If a list item that appears in a use_device_addr clause has corresponding +storage in the device data environment, references to the list item in the +associated structured block are converted into references to the corresponding +list item so following the same i.e. represent them with a new Symbol and +`OmpUseDeviceAddr` flag. The basic steps to determine the data-mapping attribute are: diff --git a/flang/include/flang/Semantics/symbol.h b/flang/include/flang/Semantics/symbol.h --- a/flang/include/flang/Semantics/symbol.h +++ b/flang/include/flang/Semantics/symbol.h @@ -560,7 +560,7 @@ OmpShared, OmpPrivate, OmpLinear, OmpFirstPrivate, OmpLastPrivate, // OpenMP data-mapping attribute OmpMapTo, OmpMapFrom, OmpMapAlloc, OmpMapRelease, OmpMapDelete, - OmpUseDevicePtr, + OmpUseDevicePtr, OmpUseDeviceAddr, // OpenMP data-copying attribute OmpCopyIn, OmpCopyPrivate, // OpenMP miscellaneous flags diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp --- a/flang/lib/Parser/openmp-parsers.cpp +++ b/flang/lib/Parser/openmp-parsers.cpp @@ -336,6 +336,9 @@ parenthesized(Parser{}))) || "USE_DEVICE_PTR" >> construct(construct( parenthesized(Parser{}))) || + "USE_DEVICE_ADDR" >> + construct(construct( + parenthesized(Parser{}))) || "UNIFIED_ADDRESS" >> construct(construct()) || "UNIFIED_SHARED_MEMORY" >> diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp --- a/flang/lib/Semantics/check-omp-structure.cpp +++ b/flang/lib/Semantics/check-omp-structure.cpp @@ -2806,12 +2806,12 @@ const parser::OmpClause &clause) { // Clauses with OmpObjectList as its data member - using MemberObjectListClauses = - std::tuple; + using MemberObjectListClauses = std::tuple; // Clauses with OmpObjectList in the tuple using TupleObjectListClauses = std::tuple { let clangClass = "OMPUseDeviceAddrClause"; + let flangClass = "OmpObjectList"; } def OMPC_Uniform : Clause<"uniform"> { let flangClass = "Name";