Skip to content

Commit 338b390

Browse files
authored
[SYCL] Provide a mechanism to silence incorrect sub group size warning (#11991)
As a follow up to #11687, this PR adds a mechanism to silence the warning using dedicated switch `-Wno-incorrect-sub-group-size` that is wrapped in the `-Wno-attribute` group.
1 parent 15af532 commit 338b390

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,9 +780,11 @@ def SyclIvdepAttribute : DiagGroup<"ivdep-compat">;
780780
def IndependentClassAttribute : DiagGroup<"IndependentClass-attribute">;
781781
def UnknownAttributes : DiagGroup<"unknown-attributes">;
782782
def IgnoredAttributes : DiagGroup<"ignored-attributes", [SyclIvdepAttribute]>;
783+
def IncorrectSubGroupSize: DiagGroup<"incorrect-sub-group-size">;
783784
def AcceptedAttributes : DiagGroup<"accepted-attributes">;
784785
def Attributes : DiagGroup<"attributes", [UnknownAttributes,
785786
IgnoredAttributes,
787+
IncorrectSubGroupSize,
786788
AcceptedAttributes]>;
787789
def UnknownSanitizers : DiagGroup<"unknown-sanitizers">;
788790
def UnnamedTypeTemplateArgs : DiagGroup<"unnamed-type-template-args",

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3539,7 +3539,7 @@ def warn_attribute_on_direct_kernel_callee_only : Warning<"%0 attribute allowed"
35393539
def warn_reqd_sub_group_attribute_n
35403540
: Warning<"attribute argument %0 is invalid and will be ignored; %1 "
35413541
"requires sub_group size %2">,
3542-
InGroup<IgnoredAttributes>;
3542+
InGroup<IncorrectSubGroupSize>;
35433543
def warn_nothrow_attribute_ignored : Warning<"'nothrow' attribute conflicts with"
35443544
" exception specification; attribute ignored">,
35453545
InGroup<IgnoredAttributes>;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: %clang_cc1 -fsycl-is-device -triple nvptx -internal-isystem %S/Inputs -std=c++2b -verify -Wno-incorrect-sub-group-size %s
2+
// RUN: %clang_cc1 -fsycl-is-device -triple nvptx -internal-isystem %S/Inputs -std=c++2b -verify -Wno-attributes %s
3+
// RUN: %clang_cc1 -fsycl-is-device -triple amdgcn-amd-amdhsa -target-cpu gfx90a -internal-isystem %S/Inputs -std=c++2b -verify -Wno-incorrect-sub-group-size %s
4+
// RUN: %clang_cc1 -fsycl-is-device -triple amdgcn-amd-amdhsa -target-cpu gfx90a -internal-isystem %S/Inputs -std=c++2b -verify -Wno-attributes %s
5+
// RUN: %clang_cc1 -fsycl-is-device -triple amdgcn-amd-amdhsa -target-cpu gfx1010 -internal-isystem %S/Inputs -std=c++2b -verify -Wno-incorrect-sub-group-size %s
6+
// RUN: %clang_cc1 -fsycl-is-device -triple amdgcn-amd-amdhsa -target-cpu gfx1010 -internal-isystem %S/Inputs -std=c++2b -verify -Wno-attributes %s
7+
//
8+
// Sub group size of 8 is incompatible with both CUDA and HIP, expect it to be
9+
// silenced. Check both the dedicated switch '-Wno-incorrect-sub-group-size' and
10+
// the catch all '-Wno-attributes'.
11+
#include "sycl.hpp"
12+
13+
14+
// expected-no-diagnostics
15+
int main() {
16+
17+
sycl::queue Q;
18+
19+
Q.submit([&](sycl::handler &h) {
20+
h.single_task<class invalid_kernel>([=] [[sycl::reqd_sub_group_size(8)]] {});
21+
});
22+
23+
return 0;
24+
}

0 commit comments

Comments
 (0)