Skip to content

Commit 916fcba

Browse files
committed
[SYCL] update tests after deprecating old attribute
1 parent 5ff233f commit 916fcba

File tree

8 files changed

+60
-88
lines changed

8 files changed

+60
-88
lines changed

clang/lib/Sema/SemaSYCLDeclAttr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ void SemaSYCL::checkDeprecatedSYCLAttributeSpelling(const ParsedAttr &A,
132132
return;
133133
}
134134

135-
// Additionally, diagnose deprecated [[sycl::reqd_sub_group_size]] spelling
135+
// Additionally, diagnose deprecated [[intel::reqd_sub_group_size]] spelling
136136
if (A.getKind() == ParsedAttr::AT_IntelReqdSubGroupSize &&
137-
A.getAttrName()->isStr("reqd_sub_group_size") && A.getScopeName()->isStr("intel")) {
137+
A.getScopeName()->isStr("intel")) {
138138
diagnoseDeprecatedAttribute(A, "sycl", "reqd_sub_group_size");
139139
return;
140140
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -fsycl-is-device -Wno-error=deprecated-declarations -internal-isystem %S/Inputs -ast-dump %s | FileCheck %s
1+
// RUN: %clang_cc1 -fsycl-is-device -internal-isystem %S/Inputs -ast-dump %s | FileCheck %s
22

33
// The test checks AST of [[intel::reqd_sub_group_size()]] attribute.
44

@@ -9,14 +9,14 @@ queue q;
99

1010
class Functor16 {
1111
public:
12-
[[intel::reqd_sub_group_size(16)]] void operator()() const {}
12+
[[sycl::reqd_sub_group_size(16)]] void operator()() const {}
1313
};
1414

1515
// Test that checks template parameter support on member function of class template.
1616
template <int SIZE>
1717
class KernelFunctor {
1818
public:
19-
[[intel::reqd_sub_group_size(SIZE)]] void operator()() const {}
19+
[[sycl::reqd_sub_group_size(SIZE)]] void operator()() const {}
2020
};
2121

2222
// Test that checks template parameter support on function.
@@ -35,7 +35,7 @@ class KernelFunctor {
3535
// CHECK-NEXT: NonTypeTemplateParmDecl
3636
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 12
3737
template <int N>
38-
[[intel::reqd_sub_group_size(N)]] void func() {}
38+
[[sycl::reqd_sub_group_size(N)]] void func() {}
3939

4040
int main() {
4141
q.submit([&](handler &h) {
@@ -52,14 +52,14 @@ int main() {
5252
// CHECK-NEXT: ConstantExpr {{.*}} 'int'
5353
// CHECK-NEXT: value: Int 2
5454
// CHECK-NEXT: IntegerLiteral{{.*}}2{{$}}
55-
h.single_task<class kernel_name3>([]() [[intel::reqd_sub_group_size(2)]] {});
55+
h.single_task<class kernel_name3>([]() [[sycl::reqd_sub_group_size(2)]] {});
5656

5757
// CHECK: FunctionDecl {{.*}} {{.*}}kernel_name5
5858
// CHECK: IntelReqdSubGroupSizeAttr {{.*}} reqd_sub_group_size
5959
// CHECK-NEXT: ConstantExpr {{.*}} 'int'
6060
// CHECK-NEXT: value: Int 6
6161
// CHECK-NEXT: IntegerLiteral{{.*}}6{{$}}
62-
h.single_task<class kernel_name5>([]() [[intel::reqd_sub_group_size(6)]] {});
62+
h.single_task<class kernel_name5>([]() [[sycl::reqd_sub_group_size(6)]] {});
6363

6464
// CHECK: FunctionDecl {{.*}}kernel_name_6
6565
// CHECK: IntelReqdSubGroupSizeAttr {{.*}} reqd_sub_group_size
@@ -79,8 +79,8 @@ int main() {
7979
// CHECK-NEXT: value: Int 8
8080
// CHECK-NEXT: IntegerLiteral{{.*}}8{{$}}
8181
// CHECK-NOT: IntelReqdSubGroupSizeAttr
82-
[]() [[intel::reqd_sub_group_size(8),
83-
intel::reqd_sub_group_size(8)]] {});
82+
[]() [[sycl::reqd_sub_group_size(8),
83+
sycl::reqd_sub_group_size(8)]] {});
8484
});
8585
func<12>();
8686
return 0;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// RUN: %clang_cc1 -fsycl-is-host -Wno-error=deprecated-declarations -fsyntax-only -verify %s
1+
// RUN: %clang_cc1 -fsycl-is-host -fsyntax-only -verify %s
22
// expected-no-diagnostics
33

4-
[[intel::reqd_sub_group_size(8)]] void fun() {}
4+
[[sycl::reqd_sub_group_size(8)]] void fun() {}
55

66
class Functor {
77
public:
8-
[[intel::reqd_sub_group_size(16)]] void operator()() {}
8+
[[sycl::reqd_sub_group_size(16)]] void operator()() {}
99
};

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

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// RUN: %clang_cc1 -fsycl-is-device -Wno-error=deprecated-declarations -internal-isystem %S/Inputs -fsyntax-only -verify -pedantic %s
1+
// RUN: %clang_cc1 -fsycl-is-device -internal-isystem %S/Inputs -fsyntax-only -verify -pedantic %s
22

3-
// The test checks functionality of [[intel::reqd_sub_group_size()]] attribute on SYCL kernel.
3+
// The test checks functionality of [[sycl::reqd_sub_group_size()]] attribute on SYCL kernel and [[intel::reqd_sub_group_size()]] is deprecated.
44

55

66
#include "sycl.hpp" //clang/test/SemaSYCL/Inputs/sycl.hpp
@@ -32,44 +32,48 @@ int main() {
3232
});
3333
return 0;
3434
}
35-
[[intel::reqd_sub_group_size(16)]] SYCL_EXTERNAL void B();
36-
[[intel::reqd_sub_group_size(16)]] void A() // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
35+
[[sycl::reqd_sub_group_size(16)]] SYCL_EXTERNAL void B();
36+
[[sycl::reqd_sub_group_size(16)]] void A() // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
3737
{
3838
}
3939

40-
[[intel::reqd_sub_group_size(16)]] SYCL_EXTERNAL void B() { // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
40+
// expected-note@+2 {{did you mean to use 'sycl::reqd_sub_group_size' instead?}}
41+
// expected-warning@+1{{attribute 'intel::reqd_sub_group_size' is deprecated}}
42+
[[intel::reqd_sub_group_size(16)]] SYCL_EXTERNAL void B();
43+
44+
[[sycl::reqd_sub_group_size(16)]] SYCL_EXTERNAL void B() { // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
4145
A();
4246
}
4347
// expected-note@+1 {{conflicting attribute is here}}
44-
[[intel::reqd_sub_group_size(2)]] void sg_size2() {} // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
48+
[[sycl::reqd_sub_group_size(2)]] void sg_size2() {} // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
4549

4650
// expected-note@+3 {{conflicting attribute is here}}
4751
// expected-error@+2 {{conflicting attributes applied to a SYCL kernel}}
4852
// expected-warning@+1 {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
49-
[[intel::reqd_sub_group_size(4)]] __attribute__((sycl_device)) void sg_size4() {
53+
[[sycl::reqd_sub_group_size(4)]] __attribute__((sycl_device)) void sg_size4() {
5054
sg_size2();
5155
}
5256

5357
// Test that checks support and functionality of reqd_sub_group_size attribute support on function.
5458

5559
// Tests for incorrect argument values for Intel reqd_sub_group_size attribute.
56-
[[intel::reqd_sub_group_size]] void one() {} // expected-error {{'reqd_sub_group_size' attribute takes one argument}}
57-
[[intel::reqd_sub_group_size(5)]] int a; // expected-error{{'reqd_sub_group_size' attribute only applies to functions}}
58-
[[intel::reqd_sub_group_size("foo")]] void func() {} // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'const char[4]'}}
59-
[[intel::reqd_sub_group_size(-1)]] void func1() {} // expected-error{{'reqd_sub_group_size' attribute requires a positive integral compile time constant expression}}
60-
[[intel::reqd_sub_group_size(0, 1)]] void arg() {} // expected-error{{'reqd_sub_group_size' attribute takes one argument}}
60+
[[sycl::reqd_sub_group_size]] void one() {} // expected-error {{'reqd_sub_group_size' attribute takes one argument}}
61+
[[sycl::reqd_sub_group_size(5)]] int a; // expected-error{{'reqd_sub_group_size' attribute only applies to functions}}
62+
[[sycl::reqd_sub_group_size("foo")]] void func() {} // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'const char[4]'}}
63+
[[sycl::reqd_sub_group_size(-1)]] void func1() {} // expected-error{{'reqd_sub_group_size' attribute requires a positive integral compile time constant expression}}
64+
[[sycl::reqd_sub_group_size(0, 1)]] void arg() {} // expected-error{{'reqd_sub_group_size' attribute takes one argument}}
6165

6266
// Diagnostic is emitted because the arguments mismatch.
63-
[[intel::reqd_sub_group_size(12)]] void quux(); // expected-note {{previous attribute is here}}
64-
[[intel::reqd_sub_group_size(100)]] void quux(); // expected-warning {{attribute 'reqd_sub_group_size' is already applied with different arguments}} expected-note {{previous attribute is here}}
67+
[[sycl::reqd_sub_group_size(12)]] void quux(); // expected-note {{previous attribute is here}}
68+
[[sycl::reqd_sub_group_size(100)]] void quux(); // expected-warning {{attribute 'reqd_sub_group_size' is already applied with different arguments}} expected-note {{previous attribute is here}}
6569
[[sycl::reqd_sub_group_size(200)]] void quux(); // expected-warning {{attribute 'reqd_sub_group_size' is already applied with different arguments}}
6670

6771
// Make sure there's at least one argument passed.
6872
[[sycl::reqd_sub_group_size]] void quibble(); // expected-error {{'reqd_sub_group_size' attribute takes one argument}}
6973

7074
// No diagnostic is emitted because the arguments match.
71-
[[intel::reqd_sub_group_size(12)]] void same();
72-
[[intel::reqd_sub_group_size(12)]] void same() {} // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
75+
[[sycl::reqd_sub_group_size(12)]] void same();
76+
[[sycl::reqd_sub_group_size(12)]] void same() {} // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
7377

7478
// No diagnostic because the attributes are synonyms with identical behavior.
7579
[[sycl::reqd_sub_group_size(12)]] void same(); // OK
@@ -80,7 +84,7 @@ template <typename Ty>
8084
// expected-error@+3{{'reqd_sub_group_size' attribute requires a positive integral compile time constant expression}}
8185
// expected-error@+2 {{integral constant expression must have integral or unscoped enumeration type, not 'S'}}
8286
// expected-error@+1 {{integral constant expression must have integral or unscoped enumeration type, not 'float'}}
83-
[[intel::reqd_sub_group_size(Ty{})]] void func() {}
87+
[[sycl::reqd_sub_group_size(Ty{})]] void func() {}
8488

8589
struct S {};
8690
void test() {
@@ -97,18 +101,18 @@ void test() {
97101
int foo1();
98102
// expected-error@+2{{expression is not an integral constant expression}}
99103
// expected-note@+1{{non-constexpr function 'foo1' cannot be used in a constant expression}}
100-
[[intel::reqd_sub_group_size(foo1() + 12)]] void func1();
104+
[[sycl::reqd_sub_group_size(foo1() + 12)]] void func1();
101105

102106
// Test that checks expression is a constant expression.
103107
constexpr int bar1() { return 0; }
104-
[[intel::reqd_sub_group_size(bar1() + 12)]] void func2(); // OK
108+
[[sycl::reqd_sub_group_size(bar1() + 12)]] void func2(); // OK
105109

106110
// Test that checks template parameter support on member function of class template.
107111
template <int SIZE>
108112
class KernelFunctor {
109113
public:
110114
// expected-error@+1{{'reqd_sub_group_size' attribute requires a positive integral compile time constant expression}}
111-
[[intel::reqd_sub_group_size(SIZE)]] void operator()() {}
115+
[[sycl::reqd_sub_group_size(SIZE)]] void operator()() {}
112116
};
113117

114118
int check() {
@@ -121,14 +125,14 @@ int check() {
121125
template <int N>
122126
// expected-error@+2{{'reqd_sub_group_size' attribute requires a positive integral compile time constant expression}}
123127
// expected-warning@+1 {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
124-
[[intel::reqd_sub_group_size(N)]] void func3() {}
128+
[[sycl::reqd_sub_group_size(N)]] void func3() {}
125129

126130
template <int N>
127131
// expected-warning@+1 {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
128-
[[intel::reqd_sub_group_size(4)]] void func4(); // expected-note {{previous attribute is here}}
132+
[[sycl::reqd_sub_group_size(4)]] void func4(); // expected-note {{previous attribute is here}}
129133

130134
template <int N>
131-
[[intel::reqd_sub_group_size(N)]] void func4() {} // expected-warning {{attribute 'reqd_sub_group_size' is already applied with different arguments}}
135+
[[sycl::reqd_sub_group_size(N)]] void func4() {} // expected-warning {{attribute 'reqd_sub_group_size' is already applied with different arguments}}
132136

133137
int check1() {
134138
// no error expected

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
// RUN: %clang_cc1 -internal-isystem %S/Inputs -fsycl-is-device -sycl-std=2020 -internal-isystem %S/Inputs -fsyntax-only -verify=expected,primary,integer %s
22
// RUN: %clang_cc1 -internal-isystem %S/Inputs -fsycl-is-device -fsycl-default-sub-group-size=primary -sycl-std=2020 -internal-isystem %S/Inputs -fsyntax-only -verify=expected,integer %s
3-
// RUN: %clang_cc1 -internal-isystem %S/Inputs -Wno-error=deprecated-declarations -fsycl-is-device -fsycl-default-sub-group-size=10 -sycl-std=2020 -internal-isystem %S/Inputs -fsyntax-only -verify=expected,primary %s
3+
// RUN: %clang_cc1 -internal-isystem %S/Inputs -fsycl-is-device -fsycl-default-sub-group-size=10 -sycl-std=2020 -internal-isystem %S/Inputs -fsyntax-only -verify=expected,primary %s
44

55
// Validate the semantic analysis checks for the interaction betwen the
6-
// named_sub_group_size and sub_group_size attributes. These are not able to be
6+
// named_sub_group_size and reqd_sub_group_size attributes. These are not able to be
77
// combined, and require that they only be applied to non-sycl-kernel/
88
// non-sycl-device functions if they match the kernel they are being called
99
// from.
1010

1111
#include "Inputs/sycl.hpp"
1212

13-
// expected-error@+2 {{'named_sub_group_size' and 'sub_group_size' attributes are not compatible}}
13+
// expected-error@+2 {{'named_sub_group_size' and 'reqd_sub_group_size' attributes are not compatible}}
1414
// expected-note@+1 {{conflicting attribute is here}}
15-
[[intel::sub_group_size(1)]] [[intel::named_sub_group_size(automatic)]] void f1();
16-
// expected-error@+2 {{'sub_group_size' and 'named_sub_group_size' attributes are not compatible}}
15+
[[sycl::reqd_sub_group_size(1)]] [[intel::named_sub_group_size(automatic)]] void f1();
16+
// expected-error@+2 {{'reqd_sub_group_size' and 'named_sub_group_size' attributes are not compatible}}
1717
// expected-note@+1 {{conflicting attribute is here}}
18-
[[intel::named_sub_group_size(primary)]] [[intel::sub_group_size(1)]] void f2();
18+
[[intel::named_sub_group_size(primary)]] [[sycl::reqd_sub_group_size(1)]] void f2();
1919

2020
// expected-note@+1 {{conflicting attribute is here}}
21-
[[intel::sub_group_size(1)]] void f3();
22-
// expected-error@+1 {{'named_sub_group_size' and 'sub_group_size' attributes are not compatible}}
21+
[[sycl::reqd_sub_group_size(1)]] void f3();
22+
// expected-error@+1 {{'named_sub_group_size' and 'reqd_sub_group_size' attributes are not compatible}}
2323
[[intel::named_sub_group_size(primary)]] void f3();
2424

2525
// expected-note@+1 {{conflicting attribute is here}}
2626
[[intel::named_sub_group_size(primary)]] void f4();
27-
// expected-error@+1 {{'sub_group_size' and 'named_sub_group_size' attributes are not compatible}}
28-
[[intel::sub_group_size(1)]] void f4();
27+
// expected-error@+1 {{'reqd_sub_group_size' and 'named_sub_group_size' attributes are not compatible}}
28+
[[sycl::reqd_sub_group_size(1)]] void f4();
2929

3030
// expected-note@+1 {{previous attribute is here}}
3131
[[intel::named_sub_group_size(automatic)]] void f5();
@@ -43,9 +43,9 @@
4343
// expected-error@+2 {{'named_sub_group_size' and 'sycl_explicit_simd' attributes are not compatible}}
4444
// expected-note@+1 {{conflicting attribute is here}}
4545
[[intel::sycl_explicit_simd]] [[intel::named_sub_group_size(automatic)]] void f8();
46-
// expected-error@+2 {{'sub_group_size' and 'sycl_explicit_simd' attributes are not compatible}}
46+
// expected-error@+2 {{'reqd_sub_group_size' and 'sycl_explicit_simd' attributes are not compatible}}
4747
// expected-note@+1 {{conflicting attribute is here}}
48-
[[intel::sycl_explicit_simd]] [[intel::sub_group_size(1)]] void f9();
48+
[[intel::sycl_explicit_simd]] [[sycl::reqd_sub_group_size(1)]] void f9();
4949

5050
// expected-note@+1 {{conflicting attribute is here}}
5151
[[intel::named_sub_group_size(primary)]] void f10();
@@ -115,19 +115,19 @@ void calls_kernel_3() {
115115
});
116116
}
117117

118-
[[intel::sub_group_size(10)]] void AttrFunc2() {} // #AttrFunc2
119-
[[intel::sub_group_size(10)]] SYCL_EXTERNAL void AttrExternalDefined2() {} // #AttrExternalDefined2
120-
[[intel::sub_group_size(10)]] SYCL_EXTERNAL void AttrExternalNotDefined2(); // #AttrExternalNotDefined2
118+
[[sycl::reqd_sub_group_size(10)]] void AttrFunc2() {} // #AttrFunc2
119+
[[sycl::reqd_sub_group_size(10)]] SYCL_EXTERNAL void AttrExternalDefined2() {} // #AttrExternalDefined2
120+
[[sycl::reqd_sub_group_size(10)]] SYCL_EXTERNAL void AttrExternalNotDefined2(); // #AttrExternalNotDefined2
121121

122122
void calls_kernel_4() {
123123
sycl::kernel_single_task<class Kernel4>([]() { // #Kernel4
124124
// integer-error@#AttrFunc2{{kernel-called function must have a sub group size that matches the size specified for the kernel}}
125125
// integer-note@#Kernel4{{kernel declared here}}
126-
// expected-warning@#AttrFunc2 {{'sub_group_size' attribute can only be applied to a SYCL kernel function}}
126+
// expected-warning@#AttrFunc2 {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
127127
AttrFunc2();
128128
// integer-error@#AttrExternalDefined2{{kernel-called function must have a sub group size that matches the size specified for the kernel}}
129129
// integer-note@#Kernel4{{kernel declared here}}
130-
// expected-warning@#AttrExternalDefined2 {{'sub_group_size' attribute can only be applied to a SYCL kernel function}}
130+
// expected-warning@#AttrExternalDefined2 {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
131131
AttrExternalDefined2();
132132
// integer-error@#AttrExternalNotDefined2{{kernel-called function must have a sub group size that matches the size specified for the kernel}}
133133
// integer-note@#Kernel4{{kernel declared here}}
@@ -153,7 +153,7 @@ void calls_kernel_5() {
153153

154154
// Don't diag with the old sub-group-size.
155155
void calls_kernel_6() {
156-
sycl::kernel_single_task<class Kernel6>([]() [[intel::reqd_sub_group_size(10)]] { // #Kernel6
156+
sycl::kernel_single_task<class Kernel6>([]() [[sycl::reqd_sub_group_size(10)]] { // #Kernel6
157157
NoAttrExternalNotDefined();
158158
});
159159
}

clang/test/SemaSYCL/sycl-attr-warn-non-kernel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[[sycl::reqd_work_group_size(16)]] void f1(){ // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
88
}
99

10-
[[intel::reqd_sub_group_size(12)]] void f3(){ // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
10+
[[sycl::reqd_sub_group_size(12)]] void f3(){ // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
1111
}
1212

1313
[[sycl::reqd_work_group_size(16)]] void f4(){ // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
@@ -41,7 +41,7 @@ class Functor16x16x16 {
4141

4242
class FunctorSubGroupSize4 {
4343
public:
44-
[[intel::reqd_sub_group_size(4)]] void operator()() const{} // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
44+
[[sycl::reqd_sub_group_size(4)]] void operator()() const{} // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
4545
};
4646

4747
class Functor8 {

sycl/test/warnings/warnings.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
using namespace sycl;
77

88

9-
class FunctorModern {
10-
public:
11-
[[sycl::reqd_sub_group_size(16)]] void operator()() const {}
12-
};
13-
14-
159
int main() {
1610
vec<long, 4> newVec;
1711
queue myQueue;
@@ -21,8 +15,6 @@ int main() {
2115
cgh.single_task<class kernel_name>([=]() {
2216
writeResult[0] = (vec<int, 4>{1, 2, 3, 4}).template convert<long>();
2317
});
24-
FunctorModern fModern;
25-
cgh.single_task<class kernel_name2>(fModern);
2618
});
2719
(void)event;
2820
return 0;

sycl/test/warnings/warnings_deprecated.cpp

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)