Skip to content

Commit 4fc91bd

Browse files
author
Erich Keane
committed
Fix check-sycl tests by excluding old-spelling from the test
Really we should probably be checking this, but since it is a pattern that is apparently commonly used, AND is a breaking change, we won't enforce this rule. The standard doesn't require us to (since it is pretty silent on mixing attribute types).
1 parent 3129b5f commit 4fc91bd

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3626,6 +3626,13 @@ static void CheckSYCL2020SubGroupSizes(Sema &S, FunctionDecl *SYCLKernel,
36263626

36273627
// Else this doesn't have an attribute, which can only be caused by this being
36283628
// an undefined SYCL_EXTERNAL, and the kernel has an attribute that conflicts.
3629+
if (const auto *A = SYCLKernel->getAttr<IntelReqdSubGroupSizeAttr>()) {
3630+
// Don't diagnose this if the kernel got its size from the 'old' attribute
3631+
// spelling.
3632+
if (!A->isSYCL2020Spelling())
3633+
return;
3634+
}
3635+
36293636
assert(KernelAttrLoc.isValid() && "Kernel doesn't have attribute either?");
36303637
S.Diag(FD->getLocation(), diag::err_sycl_mismatch_group_size)
36313638
<< /*undefined SYCL_EXTERNAL*/ 1;

clang/test/SemaSYCL/sub-group-size.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,10 @@ void calls_kernel_5() {
142142

143143
});
144144
}
145+
146+
// Don't diag with the old sub-group-size.
147+
void calls_kernel_6() {
148+
sycl::kernel_single_task<class Kernel6>([]() [[intel::reqd_sub_group_size(10)]] { // #Kernel6
149+
NoAttrExternalNotDefined();
150+
});
151+
}

0 commit comments

Comments
 (0)