Skip to content

[Flang][LLVM][OpenMP] Relax target data restrictions to be more inline with the specification #82537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion flang/test/Semantics/OpenMP/device-constructs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
! Check OpenMP clause validity for the following directives:
! 2.10 Device constructs
program main
use iso_c_binding

real(8) :: arrayA(256), arrayB(256)
integer :: N
type(c_ptr) :: cptr

arrayA = 1.414
arrayB = 3.14
Expand Down Expand Up @@ -135,7 +137,15 @@ program main
enddo
!$omp end target data

!ERROR: At least one of MAP clause must appear on the TARGET DATA directive
!$omp target data device(0) use_device_addr(cptr)
cptr = c_null_ptr
!$omp end target data

!$omp target data device(0) use_device_addr(cptr)
cptr = c_null_ptr
!$omp end target data

!ERROR: At least one of MAP, USE_DEVICE_ADDR, USE_DEVICE_PTR clause must appear on the TARGET DATA directive
!$omp target data device(0)
do i = 1, N
a = 3.14
Expand Down
8 changes: 3 additions & 5 deletions llvm/include/llvm/Frontend/OpenMP/OMP.td
Original file line number Diff line number Diff line change
Expand Up @@ -710,16 +710,14 @@ def OMP_Requires : Directive<"requires"> {
}
def OMP_Nothing : Directive<"nothing"> {}
def OMP_TargetData : Directive<"target data"> {
let allowedClauses = [
VersionedClause<OMPC_UseDevicePtr>,
VersionedClause<OMPC_UseDeviceAddr, 50>
];
let allowedOnceClauses = [
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_If>
];
let requiredClauses = [
VersionedClause<OMPC_Map>
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_UseDevicePtr>,
VersionedClause<OMPC_UseDeviceAddr, 50>
];
}
def OMP_TargetEnterData : Directive<"target enter data"> {
Expand Down