11// RUN: %clang_cc1 -fsycl -fsycl-is-device -fsyntax-only -verify -DTRIGGER_ERROR %s
22// RUN: %clang_cc1 -fsycl -fsycl-is-device -ast-dump %s | FileCheck %s
33
4- [[cl::intel_reqd_sub_group_size (4 )]] void foo () {} // expected-note {{conflicting attribute is here}}
4+ [[intel::reqd_sub_group_size (4 )]] void foo () {} // expected-note {{conflicting attribute is here}}
55// expected-note@-1 {{conflicting attribute is here}}
6- [[cl::intel_reqd_sub_group_size (32 )]] void baz () {} // expected-note {{conflicting attribute is here}}
6+ [[intel::reqd_sub_group_size (32 )]] void baz () {} // expected-note {{conflicting attribute is here}}
77
88class Functor16 {
99public:
10+ // expected-warning@+2 {{attribute 'intel_reqd_sub_group_size' is deprecated}}
11+ // expected-note@+1 {{did you mean to use 'intel::reqd_sub_group_size' instead?}}
1012 [[cl::intel_reqd_sub_group_size(16 )]] void operator ()() {}
1113};
1214
1315class Functor8 { // expected-error {{conflicting attributes applied to a SYCL kernel}}
1416public:
15- [[cl::intel_reqd_sub_group_size (8 )]] void operator ()() { // expected-note {{conflicting attribute is here}}
17+ [[intel::reqd_sub_group_size (8 )]] void operator ()() { // expected-note {{conflicting attribute is here}}
1618 foo ();
1719 }
1820};
1921
22+ class Functor4 {
23+ public:
24+ [[intel::reqd_sub_group_size(12 )]] void operator ()() {}
25+ };
26+
2027class Functor {
2128public:
2229 void operator ()() {
@@ -46,24 +53,31 @@ void bar() {
4653 });
4754#endif
4855
49- kernel<class kernel_name5 >([]() [[cl::intel_reqd_sub_group_size (2 )]] { });
50- kernel<class kernel_name6 >([]() [[cl::intel_reqd_sub_group_size (4 )]] { foo (); });
56+ kernel<class kernel_name5 >([]() [[intel::reqd_sub_group_size (2 )]]{});
57+ kernel<class kernel_name6 >([]() [[intel::reqd_sub_group_size (4 )]] { foo (); });
58+ // expected-warning@+2 {{attribute 'intel_reqd_sub_group_size' is deprecated}}
59+ // expected-note@+1 {{did you mean to use 'intel::reqd_sub_group_size' instead?}}
60+ kernel<class kernel_name7 >([]() [[cl::intel_reqd_sub_group_size (6 )]]{});
61+
62+ Functor4 f4;
63+ kernel<class kernel_name8 >(f4);
5164}
5265
53- [[cl::intel_reqd_sub_group_size (16 )]] SYCL_EXTERNAL void B ();
54- [[cl::intel_reqd_sub_group_size (16 )]] void A () {
66+ [[intel::reqd_sub_group_size (16 )]] SYCL_EXTERNAL void B ();
67+ [[intel::reqd_sub_group_size (16 )]] void A () {
5568}
56- [[cl::intel_reqd_sub_group_size(16 )]] SYCL_EXTERNAL void B () {
69+
70+ [[intel::reqd_sub_group_size(16 )]] SYCL_EXTERNAL void B () {
5771 A ();
5872}
5973
6074#ifdef TRIGGER_ERROR
6175// expected-note@+1 {{conflicting attribute is here}}
62- [[cl::intel_reqd_sub_group_size (2 )]] void sg_size2 () {}
76+ [[intel::reqd_sub_group_size (2 )]] void sg_size2 () {}
6377
6478// expected-note@+2 {{conflicting attribute is here}}
6579// expected-error@+1 {{conflicting attributes applied to a SYCL kernel}}
66- [[cl::intel_reqd_sub_group_size (4 )]] __attribute__((sycl_device)) void sg_size4 () {
80+ [[intel::reqd_sub_group_size (4 )]] __attribute__((sycl_device)) void sg_size4 () {
6781 sg_size2 ();
6882}
6983#endif
@@ -77,3 +91,9 @@ void bar() {
7791// CHECK: FunctionDecl {{.*}} {{.*}}kernel_name5
7892// CHECK: IntelReqdSubGroupSizeAttr {{.*}}
7993// CHECK-NEXT: IntegerLiteral{{.*}}2{{$}}
94+ // CHECK: FunctionDecl {{.*}} {{.*}}kernel_name7
95+ // CHECK: IntelReqdSubGroupSizeAttr {{.*}}
96+ // CHECK-NEXT: IntegerLiteral{{.*}}6{{$}}
97+ // CHECK: FunctionDecl {{.*}} {{.*}}kernel_name8
98+ // CHECK: IntelReqdSubGroupSizeAttr {{.*}}
99+ // CHECK-NEXT: IntegerLiteral{{.*}}12{{$}}
0 commit comments