Skip to content

Commit 1f2aeef

Browse files
committedDec 2, 2024·
[OpenACC] Enable copy/create clauses for combined constructs
This is the last set of 'no op' changes, and are all incredibly similar, so they are being done together. They work the exact same for combined constructs as they do for compute constructs, so this adds tests and enables them.
1 parent 02eaeec commit 1f2aeef

18 files changed

+1238
-218
lines changed
 

‎clang/lib/Sema/SemaOpenACC.cpp

+20-16
Original file line numberDiff line numberDiff line change
@@ -877,10 +877,11 @@ OpenACCClause *SemaOpenACCClauseVisitor::VisitPresentClause(
877877

878878
OpenACCClause *SemaOpenACCClauseVisitor::VisitCopyClause(
879879
SemaOpenACC::OpenACCParsedClause &Clause) {
880-
// Restrictions only properly implemented on 'compute' constructs, and
881-
// 'compute' constructs are the only construct that can do anything with
882-
// this yet, so skip/treat as unimplemented in this case.
883-
if (!isOpenACCComputeDirectiveKind(Clause.getDirectiveKind()))
880+
// Restrictions only properly implemented on 'compute'/'combined' constructs,
881+
// and 'compute'/'combined' constructs are the only construct that can do
882+
// anything with this yet, so skip/treat as unimplemented in this case.
883+
if (!isOpenACCComputeDirectiveKind(Clause.getDirectiveKind()) &&
884+
!isOpenACCCombinedDirectiveKind(Clause.getDirectiveKind()))
884885
return isNotImplemented();
885886
// ActOnVar ensured that everything is a valid variable reference, so there
886887
// really isn't anything to do here. GCC does some duplicate-finding, though
@@ -893,10 +894,11 @@ OpenACCClause *SemaOpenACCClauseVisitor::VisitCopyClause(
893894

894895
OpenACCClause *SemaOpenACCClauseVisitor::VisitCopyInClause(
895896
SemaOpenACC::OpenACCParsedClause &Clause) {
896-
// Restrictions only properly implemented on 'compute' constructs, and
897-
// 'compute' constructs are the only construct that can do anything with
898-
// this yet, so skip/treat as unimplemented in this case.
899-
if (!isOpenACCComputeDirectiveKind(Clause.getDirectiveKind()))
897+
// Restrictions only properly implemented on 'compute'/'combined' constructs,
898+
// and 'compute'/'combined' constructs are the only construct that can do
899+
// anything with this yet, so skip/treat as unimplemented in this case.
900+
if (!isOpenACCComputeDirectiveKind(Clause.getDirectiveKind()) &&
901+
!isOpenACCCombinedDirectiveKind(Clause.getDirectiveKind()))
900902
return isNotImplemented();
901903
// ActOnVar ensured that everything is a valid variable reference, so there
902904
// really isn't anything to do here. GCC does some duplicate-finding, though
@@ -909,10 +911,11 @@ OpenACCClause *SemaOpenACCClauseVisitor::VisitCopyInClause(
909911

910912
OpenACCClause *SemaOpenACCClauseVisitor::VisitCopyOutClause(
911913
SemaOpenACC::OpenACCParsedClause &Clause) {
912-
// Restrictions only properly implemented on 'compute' constructs, and
913-
// 'compute' constructs are the only construct that can do anything with
914-
// this yet, so skip/treat as unimplemented in this case.
915-
if (!isOpenACCComputeDirectiveKind(Clause.getDirectiveKind()))
914+
// Restrictions only properly implemented on 'compute'/'combined' constructs,
915+
// and 'compute'/'combined' constructs are the only construct that can do
916+
// anything with this yet, so skip/treat as unimplemented in this case.
917+
if (!isOpenACCComputeDirectiveKind(Clause.getDirectiveKind()) &&
918+
!isOpenACCCombinedDirectiveKind(Clause.getDirectiveKind()))
916919
return isNotImplemented();
917920
// ActOnVar ensured that everything is a valid variable reference, so there
918921
// really isn't anything to do here. GCC does some duplicate-finding, though
@@ -925,10 +928,11 @@ OpenACCClause *SemaOpenACCClauseVisitor::VisitCopyOutClause(
925928

926929
OpenACCClause *SemaOpenACCClauseVisitor::VisitCreateClause(
927930
SemaOpenACC::OpenACCParsedClause &Clause) {
928-
// Restrictions only properly implemented on 'compute' constructs, and
929-
// 'compute' constructs are the only construct that can do anything with
930-
// this yet, so skip/treat as unimplemented in this case.
931-
if (!isOpenACCComputeDirectiveKind(Clause.getDirectiveKind()))
931+
// Restrictions only properly implemented on 'compute'/'combined' constructs,
932+
// and 'compute'/'combined' constructs are the only construct that can do
933+
// anything with this yet, so skip/treat as unimplemented in this case.
934+
if (!isOpenACCComputeDirectiveKind(Clause.getDirectiveKind()) &&
935+
!isOpenACCCombinedDirectiveKind(Clause.getDirectiveKind()))
932936
return isNotImplemented();
933937
// ActOnVar ensured that everything is a valid variable reference, so there
934938
// really isn't anything to do here. GCC does some duplicate-finding, though

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

+15
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,19 @@ void foo() {
170170
#pragma acc parallel loop no_create(i, array[1], array, array[1:2]) present(i, array[1], array, array[1:2])
171171
for(int i = 0;i<5;++i);
172172

173+
// CHECK: #pragma acc parallel loop copy(i, array[1], array, array[1:2]) pcopy(i, array[1], array, array[1:2]) present_or_copy(i, array[1], array, array[1:2])
174+
#pragma acc parallel loop copy(i, array[1], array, array[1:2]) pcopy(i, array[1], array, array[1:2]) present_or_copy(i, array[1], array, array[1:2])
175+
for(int i = 0;i<5;++i);
176+
177+
// CHECK: #pragma acc parallel loop copyin(i, array[1], array, array[1:2]) pcopyin(readonly: i, array[1], array, array[1:2]) present_or_copyin(i, array[1], array, array[1:2])
178+
#pragma acc parallel loop copyin(i, array[1], array, array[1:2]) pcopyin(readonly:i, array[1], array, array[1:2]) present_or_copyin(i, array[1], array, array[1:2])
179+
for(int i = 0;i<5;++i);
180+
181+
// CHECK: #pragma acc parallel loop copyout(i, array[1], array, array[1:2]) pcopyout(zero: i, array[1], array, array[1:2]) present_or_copyout(i, array[1], array, array[1:2])
182+
#pragma acc parallel loop copyout(i, array[1], array, array[1:2]) pcopyout(zero: i, array[1], array, array[1:2]) present_or_copyout(i, array[1], array, array[1:2])
183+
for(int i = 0;i<5;++i);
184+
185+
// CHECK: #pragma acc parallel loop create(i, array[1], array, array[1:2]) pcreate(zero: i, array[1], array, array[1:2]) present_or_create(i, array[1], array, array[1:2])
186+
#pragma acc parallel loop create(i, array[1], array, array[1:2]) pcreate(zero: i, array[1], array, array[1:2]) present_or_create(i, array[1], array, array[1:2])
187+
for(int i = 0;i<5;++i);
173188
}

0 commit comments

Comments
 (0)
Please sign in to comment.