Skip to content

Commit

Permalink
[flang][openacc] Allow multiple wait clauses
Browse files Browse the repository at this point in the history
kernels loop and enter data had a too restrictive constraint for the wait clause.
The wait clause is allowed multiple times and not only once. This patch fix this problem.

Reviewed By: SouraVX

Differential Revision: https://reviews.llvm.org/D95469
  • Loading branch information
clementval committed Jan 27, 2021
1 parent 90407b1 commit f30c523
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions flang/test/Semantics/OpenACC/acc-data.f90
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ program openacc_data_validity

!$acc enter data create(aa) wait(wait1, wait2)

!$acc enter data create(aa) wait(wait1) wait(wait2)

!$acc enter data attach(bb)

!ERROR: At least one of COPYOUT, DELETE, DETACH clause must appear on the EXIT DATA directive
Expand Down
5 changes: 5 additions & 0 deletions flang/test/Semantics/OpenACC/acc-kernels-loop.f90
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ program openacc_kernels_loop_validity
a(i) = 3.14
end do

!$acc kernels loop wait(wait1) wait(wait2)
do i = 1, N
a(i) = 3.14
end do

!$acc kernels loop wait(1, 2) async(3)
do i = 1, N
a(i) = 3.14
Expand Down
10 changes: 6 additions & 4 deletions llvm/include/llvm/Frontend/OpenACC/ACC.td
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,12 @@ def ACC_Wait : Directive<"wait"> {

// 2.14.6
def ACC_EnterData : Directive<"enter data"> {
let allowedClauses = [
VersionedClause<ACCC_Wait>
];
let allowedOnceClauses = [
VersionedClause<ACCC_Async>,
VersionedClause<ACCC_If>,
VersionedClause<ACCC_Wait>
VersionedClause<ACCC_If>
];
let requiredClauses = [
VersionedClause<ACCC_Attach>,
Expand Down Expand Up @@ -529,7 +531,8 @@ def ACC_KernelsLoop : Directive<"kernels loop"> {
VersionedClause<ACCC_Present>,
VersionedClause<ACCC_Private>,
VersionedClause<ACCC_DevicePtr>,
VersionedClause<ACCC_Attach>
VersionedClause<ACCC_Attach>,
VersionedClause<ACCC_Wait>
];
let allowedOnceClauses = [
VersionedClause<ACCC_Async>,
Expand All @@ -544,7 +547,6 @@ def ACC_KernelsLoop : Directive<"kernels loop"> {
VersionedClause<ACCC_Tile>,
VersionedClause<ACCC_Vector>,
VersionedClause<ACCC_VectorLength>,
VersionedClause<ACCC_Wait>,
VersionedClause<ACCC_Worker>
];
let allowedExclusiveClauses = [
Expand Down

0 comments on commit f30c523

Please sign in to comment.