Skip to content

Commit 969b765

Browse files
committed
[OpenACC] Enable 'wait' for combined constructs
Once again a situation where the combined and compute do the exact same thing as far as Sema/AST/etc is concerned, so this patch adds tests and enables it.
1 parent d668304 commit 969b765

File tree

4 files changed

+26
-17
lines changed

4 files changed

+26
-17
lines changed

clang/lib/Sema/SemaOpenACC.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -984,10 +984,11 @@ OpenACCClause *SemaOpenACCClauseVisitor::VisitDevicePtrClause(
984984

985985
OpenACCClause *SemaOpenACCClauseVisitor::VisitWaitClause(
986986
SemaOpenACC::OpenACCParsedClause &Clause) {
987-
// Restrictions only properly implemented on 'compute' constructs, and
988-
// 'compute' constructs are the only construct that can do anything with
989-
// this yet, so skip/treat as unimplemented in this case.
990-
if (!isOpenACCComputeDirectiveKind(Clause.getDirectiveKind()))
987+
// Restrictions only properly implemented on 'compute'/'combined' constructs,
988+
// and 'compute'/'combined' constructs are the only construct that can do
989+
// anything with this yet, so skip/treat as unimplemented in this case.
990+
if (!isOpenACCComputeDirectiveKind(Clause.getDirectiveKind()) &&
991+
!isOpenACCCombinedDirectiveKind(Clause.getDirectiveKind()))
991992
return isNotImplemented();
992993

993994
return OpenACCWaitClause::Create(

clang/test/AST/ast-print-openacc-combined-construct.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,25 @@ void foo() {
137137
// CHECK: #pragma acc kernels loop deviceptr(iPtr, arrayPtr[0])
138138
#pragma acc kernels loop deviceptr(iPtr, arrayPtr[0])
139139
for(int i = 0;i<5;++i);
140+
141+
// CHECK: #pragma acc parallel loop wait()
142+
#pragma acc parallel loop wait()
143+
for(int i = 0;i<5;++i);
144+
145+
// CHECK: #pragma acc parallel loop wait(*iPtr, i)
146+
#pragma acc parallel loop wait(*iPtr, i)
147+
for(int i = 0;i<5;++i);
148+
149+
// CHECK: #pragma acc parallel loop wait(queues: *iPtr, i)
150+
#pragma acc parallel loop wait(queues:*iPtr, i)
151+
for(int i = 0;i<5;++i);
152+
153+
// CHECK: #pragma acc parallel loop wait(devnum: i : *iPtr, i)
154+
#pragma acc parallel loop wait(devnum:i:*iPtr, i)
155+
for(int i = 0;i<5;++i);
156+
157+
// CHECK: #pragma acc parallel loop wait(devnum: i : queues: *iPtr, i)
158+
#pragma acc parallel loop wait(devnum:i:queues:*iPtr, i)
159+
for(int i = 0;i<5;++i);
160+
140161
}

clang/test/SemaOpenACC/combined-construct-auto_seq_independent-clauses.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,6 @@ void uses() {
195195
// expected-warning@+1{{OpenACC clause 'gang' not yet implemented}}
196196
#pragma acc parallel loop auto gang
197197
for(unsigned i = 0; i < 5; ++i);
198-
// TODOexpected-error@+1{{OpenACC 'wait' clause is not valid on 'parallel loop' directive}}
199-
// expected-warning@+1{{OpenACC clause 'wait' not yet implemented}}
200198
#pragma acc parallel loop auto wait
201199
for(unsigned i = 0; i < 5; ++i);
202200

@@ -354,8 +352,6 @@ void uses() {
354352
// expected-warning@+1{{OpenACC clause 'gang' not yet implemented}}
355353
#pragma acc parallel loop gang auto
356354
for(unsigned i = 0; i < 5; ++i);
357-
// TODOexpected-error@+1{{OpenACC 'wait' clause is not valid on 'parallel loop' directive}}
358-
// expected-warning@+1{{OpenACC clause 'wait' not yet implemented}}
359355
#pragma acc parallel loop wait auto
360356
for(unsigned i = 0; i < 5; ++i);
361357

@@ -514,8 +510,6 @@ void uses() {
514510
// expected-warning@+1{{OpenACC clause 'gang' not yet implemented}}
515511
#pragma acc parallel loop independent gang
516512
for(unsigned i = 0; i < 5; ++i);
517-
// TODOexpected-error@+1{{OpenACC 'wait' clause is not valid on 'parallel loop' directive}}
518-
// expected-warning@+1{{OpenACC clause 'wait' not yet implemented}}
519513
#pragma acc parallel loop independent wait
520514
for(unsigned i = 0; i < 5; ++i);
521515

@@ -673,8 +667,6 @@ void uses() {
673667
// expected-warning@+1{{OpenACC clause 'gang' not yet implemented}}
674668
#pragma acc parallel loop gang independent
675669
for(unsigned i = 0; i < 5; ++i);
676-
// TODOexpected-error@+1{{OpenACC 'wait' clause is not valid on 'parallel loop' directive}}
677-
// expected-warning@+1{{OpenACC clause 'wait' not yet implemented}}
678670
#pragma acc parallel loop wait independent
679671
for(unsigned i = 0; i < 5; ++i);
680672

@@ -836,8 +828,6 @@ void uses() {
836828
#pragma acc parallel loop seq tile(1+2, 1)
837829
for(;;)
838830
for(unsigned i = 0; i < 5; ++i);
839-
// TODOexpected-error@+1{{OpenACC 'wait' clause is not valid on 'parallel loop' directive}}
840-
// expected-warning@+1{{OpenACC clause 'wait' not yet implemented}}
841831
#pragma acc parallel loop seq wait
842832
for(unsigned i = 0; i < 5; ++i);
843833

@@ -1001,8 +991,6 @@ void uses() {
1001991
#pragma acc parallel loop tile(1+2, 1) seq
1002992
for(;;)
1003993
for(unsigned i = 0; i < 5; ++i);
1004-
// TODOexpected-error@+1{{OpenACC 'wait' clause is not valid on 'parallel loop' directive}}
1005-
// expected-warning@+1{{OpenACC clause 'wait' not yet implemented}}
1006994
#pragma acc parallel loop wait seq
1007995
for(unsigned i = 0; i < 5; ++i);
1008996
}

clang/test/SemaOpenACC/combined-construct-device_type-clause.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ void uses() {
218218
// expected-warning@+1{{OpenACC clause 'gang' not yet implemented, clause ignored}}
219219
#pragma acc serial loop dtype(*) gang
220220
for(int i = 0; i < 5; ++i);
221-
// expected-warning@+1{{OpenACC clause 'wait' not yet implemented, clause ignored}}
222221
#pragma acc parallel loop device_type(*) wait
223222
for(int i = 0; i < 5; ++i);
224223
}

0 commit comments

Comments
 (0)