[clang] 969b765 - [OpenACC] Enable 'wait' for combined constructs

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 27 08:32:38 PST 2024


Author: erichkeane
Date: 2024-11-27T08:32:33-08:00
New Revision: 969b7658fe34cf7638e1385d813e765a4c61dfc7

URL: https://github.com/llvm/llvm-project/commit/969b7658fe34cf7638e1385d813e765a4c61dfc7
DIFF: https://github.com/llvm/llvm-project/commit/969b7658fe34cf7638e1385d813e765a4c61dfc7.diff

LOG: [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.

Added: 
    

Modified: 
    clang/lib/Sema/SemaOpenACC.cpp
    clang/test/AST/ast-print-openacc-combined-construct.cpp
    clang/test/SemaOpenACC/combined-construct-auto_seq_independent-clauses.c
    clang/test/SemaOpenACC/combined-construct-device_type-clause.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaOpenACC.cpp b/clang/lib/Sema/SemaOpenACC.cpp
index f9c002d116b20d..00514f4cf5b4ee 100644
--- a/clang/lib/Sema/SemaOpenACC.cpp
+++ b/clang/lib/Sema/SemaOpenACC.cpp
@@ -984,10 +984,11 @@ OpenACCClause *SemaOpenACCClauseVisitor::VisitDevicePtrClause(
 
 OpenACCClause *SemaOpenACCClauseVisitor::VisitWaitClause(
     SemaOpenACC::OpenACCParsedClause &Clause) {
-  // Restrictions only properly implemented on 'compute' constructs, and
-  // 'compute' constructs are the only construct that can do anything with
-  // this yet, so skip/treat as unimplemented in this case.
-  if (!isOpenACCComputeDirectiveKind(Clause.getDirectiveKind()))
+  // Restrictions only properly implemented on 'compute'/'combined' constructs,
+  // and 'compute'/'combined' constructs are the only construct that can do
+  // anything with this yet, so skip/treat as unimplemented in this case.
+  if (!isOpenACCComputeDirectiveKind(Clause.getDirectiveKind()) &&
+      !isOpenACCCombinedDirectiveKind(Clause.getDirectiveKind()))
     return isNotImplemented();
 
   return OpenACCWaitClause::Create(

diff  --git a/clang/test/AST/ast-print-openacc-combined-construct.cpp b/clang/test/AST/ast-print-openacc-combined-construct.cpp
index 0d02d3daad162e..42c0d248c79fff 100644
--- a/clang/test/AST/ast-print-openacc-combined-construct.cpp
+++ b/clang/test/AST/ast-print-openacc-combined-construct.cpp
@@ -137,4 +137,25 @@ void foo() {
   // CHECK: #pragma acc kernels loop deviceptr(iPtr, arrayPtr[0])
 #pragma acc kernels loop deviceptr(iPtr, arrayPtr[0])
   for(int i = 0;i<5;++i);
+
+// CHECK: #pragma acc parallel loop wait()
+#pragma acc parallel loop wait()
+  for(int i = 0;i<5;++i);
+
+// CHECK: #pragma acc parallel loop wait(*iPtr, i)
+#pragma acc parallel loop wait(*iPtr, i)
+  for(int i = 0;i<5;++i);
+
+// CHECK: #pragma acc parallel loop wait(queues: *iPtr, i)
+#pragma acc parallel loop wait(queues:*iPtr, i)
+  for(int i = 0;i<5;++i);
+
+// CHECK: #pragma acc parallel loop wait(devnum: i : *iPtr, i)
+#pragma acc parallel loop wait(devnum:i:*iPtr, i)
+  for(int i = 0;i<5;++i);
+
+// CHECK: #pragma acc parallel loop wait(devnum: i : queues: *iPtr, i)
+#pragma acc parallel loop wait(devnum:i:queues:*iPtr, i)
+  for(int i = 0;i<5;++i);
+
 }

diff  --git a/clang/test/SemaOpenACC/combined-construct-auto_seq_independent-clauses.c b/clang/test/SemaOpenACC/combined-construct-auto_seq_independent-clauses.c
index fe86960cac4ba1..e338177cf93afc 100644
--- a/clang/test/SemaOpenACC/combined-construct-auto_seq_independent-clauses.c
+++ b/clang/test/SemaOpenACC/combined-construct-auto_seq_independent-clauses.c
@@ -195,8 +195,6 @@ void uses() {
   // expected-warning at +1{{OpenACC clause 'gang' not yet implemented}}
 #pragma acc parallel loop auto gang
   for(unsigned i = 0; i < 5; ++i);
-  // TODOexpected-error at +1{{OpenACC 'wait' clause is not valid on 'parallel loop' directive}}
-  // expected-warning at +1{{OpenACC clause 'wait' not yet implemented}}
 #pragma acc parallel loop auto wait
   for(unsigned i = 0; i < 5; ++i);
 
@@ -354,8 +352,6 @@ void uses() {
   // expected-warning at +1{{OpenACC clause 'gang' not yet implemented}}
 #pragma acc parallel loop gang auto
   for(unsigned i = 0; i < 5; ++i);
-  // TODOexpected-error at +1{{OpenACC 'wait' clause is not valid on 'parallel loop' directive}}
-  // expected-warning at +1{{OpenACC clause 'wait' not yet implemented}}
 #pragma acc parallel loop wait auto
   for(unsigned i = 0; i < 5; ++i);
 
@@ -514,8 +510,6 @@ void uses() {
   // expected-warning at +1{{OpenACC clause 'gang' not yet implemented}}
 #pragma acc parallel loop independent gang
   for(unsigned i = 0; i < 5; ++i);
-  // TODOexpected-error at +1{{OpenACC 'wait' clause is not valid on 'parallel loop' directive}}
-  // expected-warning at +1{{OpenACC clause 'wait' not yet implemented}}
 #pragma acc parallel loop independent wait
   for(unsigned i = 0; i < 5; ++i);
 
@@ -673,8 +667,6 @@ void uses() {
   // expected-warning at +1{{OpenACC clause 'gang' not yet implemented}}
 #pragma acc parallel loop gang independent
   for(unsigned i = 0; i < 5; ++i);
-  // TODOexpected-error at +1{{OpenACC 'wait' clause is not valid on 'parallel loop' directive}}
-  // expected-warning at +1{{OpenACC clause 'wait' not yet implemented}}
 #pragma acc parallel loop wait independent
   for(unsigned i = 0; i < 5; ++i);
 
@@ -836,8 +828,6 @@ void uses() {
 #pragma acc parallel loop seq tile(1+2, 1)
   for(;;)
     for(unsigned i = 0; i < 5; ++i);
-  // TODOexpected-error at +1{{OpenACC 'wait' clause is not valid on 'parallel loop' directive}}
-  // expected-warning at +1{{OpenACC clause 'wait' not yet implemented}}
 #pragma acc parallel loop seq wait
   for(unsigned i = 0; i < 5; ++i);
 
@@ -1001,8 +991,6 @@ void uses() {
 #pragma acc parallel loop tile(1+2, 1) seq
   for(;;)
     for(unsigned i = 0; i < 5; ++i);
-  // TODOexpected-error at +1{{OpenACC 'wait' clause is not valid on 'parallel loop' directive}}
-  // expected-warning at +1{{OpenACC clause 'wait' not yet implemented}}
 #pragma acc parallel loop wait seq
   for(unsigned i = 0; i < 5; ++i);
 }

diff  --git a/clang/test/SemaOpenACC/combined-construct-device_type-clause.c b/clang/test/SemaOpenACC/combined-construct-device_type-clause.c
index 9b7a3ec6b0adae..58b3cdc2820bcf 100644
--- a/clang/test/SemaOpenACC/combined-construct-device_type-clause.c
+++ b/clang/test/SemaOpenACC/combined-construct-device_type-clause.c
@@ -218,7 +218,6 @@ void uses() {
   // expected-warning at +1{{OpenACC clause 'gang' not yet implemented, clause ignored}}
 #pragma acc serial loop dtype(*) gang
   for(int i = 0; i < 5; ++i);
-  // expected-warning at +1{{OpenACC clause 'wait' not yet implemented, clause ignored}}
 #pragma acc parallel loop device_type(*) wait
   for(int i = 0; i < 5; ++i);
 }


        


More information about the cfe-commits mailing list