Skip to content

Commit c4ab882

Browse files
committed
follow up clean up of tests
1 parent b6286e1 commit c4ab882

File tree

6 files changed

+32
-125
lines changed

6 files changed

+32
-125
lines changed

clang/test/SemaSYCL/check-work-group-size-hint-device.cpp

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717

1818
// Produce a conflicting attribute warning when the args are different.
1919
[[sycl::work_group_size_hint(4, 1, 1)]] void f3(); // expected-note {{previous attribute is here}}
20-
[[sycl::work_group_size_hint(1, 1, 32)]] void f3() {} // expected-warning {{attribute 'work_group_size_hint' is already applied with different arguments}} \
21-
// expected-warning {{'work_group_size_hint' attribute can only be applied to a SYCL kernel function}}
20+
[[sycl::work_group_size_hint(1, 1, 32)]] void f3(); // expected-warning {{attribute 'work_group_size_hint' is already applied with different arguments}}
2221

2322
// 1 and 2 dim versions
2423
[[sycl::work_group_size_hint(2)]] void f4(); // ok
@@ -44,13 +43,6 @@ class Functor_1 {
4443
template <int N>
4544
[[sycl::work_group_size_hint(N, 1, 1)]] void f8(); // #f8
4645

47-
// Test that template redeclarations also get diagnosed properly.
48-
template <int X, int Y, int Z>
49-
[[sycl::work_group_size_hint(1, 1, 1)]] void f9(); // #f9prev
50-
51-
template <int X, int Y, int Z>
52-
[[sycl::work_group_size_hint(X, Y, Z)]] void f9() {} // #f9
53-
5446
// Test that a template redeclaration where the difference is known up front is
5547
// diagnosed immediately, even without instantiation.
5648
template <int X, int Y, int Z>
@@ -70,15 +62,6 @@ void instantiate() {
7062
// expected-error@#f8 {{'work_group_size_hint' attribute requires a positive integral compile time constant expression}}
7163
f8<0>(); // expected-note {{in instantiation}}
7264
#endif
73-
74-
// expected-warning@#f9prev {{'work_group_size_hint' attribute can only be applied to a SYCL kernel function}}
75-
f9<1, 1, 1>(); // OK, args are the same on the redecl.
76-
77-
// expected-warning@#f9 {{attribute 'work_group_size_hint' is already applied with different arguments}}
78-
// expected-note@#f9prev {{previous attribute is here}}
79-
// expected-warning@#f9prev {{'work_group_size_hint' attribute can only be applied to a SYCL kernel function}}
80-
81-
f9<1, 2, 3>(); // expected-note {{in instantiation}}
8265
}
8366

8467
// Show that the attribute works on member functions.
@@ -101,20 +84,7 @@ class Functor16x2x1 {
10184

10285
class Functor4x4x4 {
10386
public:
104-
[[sycl::work_group_size_hint(4, 4, 4)]] void operator()() const {}; // expected-warning {{'work_group_size_hint' attribute can only be applied to a SYCL kernel function}}
105-
};
106-
107-
// Checking whether propagation of the attribute happens or not, according to the SYCL version.
108-
#if defined(EXPECT_PROP) // if attribute is propagated, then we expect errors here
109-
void f8x8x8(){};
110-
#else // otherwise no error
111-
[[sycl::work_group_size_hint(8, 8, 8)]] void f8x8x8(){}; // expected-warning {{'work_group_size_hint' attribute can only be applied to a SYCL kernel function}}
112-
#endif
113-
class FunctorNoProp {
114-
public:
115-
void operator()() const {
116-
f8x8x8();
117-
};
87+
[[sycl::work_group_size_hint(4, 4, 4)]] void operator()() const {};
11888
};
11989

12090
void invoke() {
@@ -137,12 +107,6 @@ void invoke() {
137107
// CHECK-NEXT: value: Int 1
138108
// CHECK-NEXT: IntegerLiteral{{.*}}1{{$}}
139109

140-
141-
FunctorNoProp fNoProp;
142-
h.single_task<class kernel_3>(fNoProp);
143-
// CHECK: FunctionDecl {{.*}} {{.*}}kernel_3
144-
// CHECK-NOT: SYCLWorkGroupSizeHintAttr
145-
146110
h.single_task<class kernel_name4>([]() [[sycl::work_group_size_hint(4,4,4)]] {});
147111
// CHECK: FunctionDecl {{.*}}kernel_name4
148112
// CHECK: SYCLWorkGroupSizeHintAttr {{.*}}
@@ -156,6 +120,7 @@ void invoke() {
156120
// CHECK-NEXT: value: Int 4
157121
// CHECK-NEXT: IntegerLiteral{{.*}}4{{$}}
158122

123+
h.single_task<class kernel_name5>(f4x4x4);
159124
});
160125

161126
// FIXME: Add tests with the C++23 lambda attribute syntax.

clang/test/SemaSYCL/intel-max-work-group-size.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,14 @@ void instantiate() {
7070
// a declaration along with [[sycl::reqd_work_group_size(X1, Y1, Z1)]]
7171
// attribute, check to see if values of reqd_work_group_size arguments are
7272
// equal or less than values coming from max_work_group_size attribute.
73-
[[sycl::reqd_work_group_size(64, 64, 64)]] // expected-note {{conflicting attribute is here}} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
73+
[[sycl::reqd_work_group_size(64, 64, 64)]] // expected-note {{conflicting attribute is here}}
7474
[[intel::max_work_group_size(64, 16, 64)]] // expected-error {{'max_work_group_size' attribute conflicts with 'reqd_work_group_size' attribute}}
7575
void
76-
f9() {}
76+
f9();
7777

7878
[[intel::max_work_group_size(4, 4, 4)]] void f10();
7979
[[sycl::reqd_work_group_size(2, 2, 2)]] void f10(); // OK
8080

81-
[[sycl::reqd_work_group_size(2, 2, 2)]] [[intel::max_work_group_size(4, 4, 4)]] void f11() {} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
8281

8382
[[sycl::reqd_work_group_size(64, 64, 64)]] void f12(); // expected-note {{conflicting attribute is here}}
8483
[[intel::max_work_group_size(16, 16, 16)]] void f12(); // expected-error {{'max_work_group_size' attribute conflicts with 'reqd_work_group_size' attribute}}
@@ -91,14 +90,14 @@ f13() {}
9190
[[sycl::reqd_work_group_size(64, 64, 64)]] void f14(); // expected-error{{'reqd_work_group_size' attribute conflicts with 'max_work_group_size' attribute}}
9291

9392
[[cl::reqd_work_group_size(1, 2, 3)]] // expected-warning {{attribute 'cl::reqd_work_group_size' is deprecated}} \
94-
// expected-note {{did you mean to use 'sycl::reqd_work_group_size' instead?}} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
93+
// expected-note {{did you mean to use 'sycl::reqd_work_group_size' instead?}}
9594
[[intel::max_work_group_size(1, 2, 3)]] void
96-
f15() {} // OK
95+
f15(); // OK
9796

9897
[[intel::max_work_group_size(2, 3, 7)]] void f16(); // expected-note {{conflicting attribute is here}}
9998
[[sycl::reqd_work_group_size(7, 3, 2)]] void f16(); // expected-error{{'reqd_work_group_size' attribute conflicts with 'max_work_group_size' attribute}}
10099

101-
[[intel::max_work_group_size(1, 2, 3)]] [[sycl::reqd_work_group_size(1, 2, 3)]] void f17(){}; // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
100+
[[intel::max_work_group_size(1, 2, 3)]] [[sycl::reqd_work_group_size(1, 2, 3)]] void f17();
102101

103102
[[sycl::reqd_work_group_size(16)]] // expected-note {{conflicting attribute is here}}
104103
[[intel::max_work_group_size(16, 1, 1)]] void // expected-error {{'max_work_group_size' attribute conflicts with 'reqd_work_group_size' attribute}}

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

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,7 @@ int main() {
3333
return 0;
3434
}
3535
[[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}}
37-
{
38-
}
3936

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}}
41-
A();
42-
}
43-
// 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}}
45-
46-
// expected-note@+3 {{conflicting attribute is here}}
47-
// expected-error@+2 {{conflicting attributes applied to a SYCL kernel}}
48-
// 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() {
50-
sg_size2();
51-
}
5237

5338
// Test that checks support and functionality of reqd_sub_group_size attribute support on function.
5439

@@ -69,7 +54,7 @@ int main() {
6954

7055
// No diagnostic is emitted because the arguments match.
7156
[[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}}
57+
[[intel::reqd_sub_group_size(12)]] void same();
7358

7459
// No diagnostic because the attributes are synonyms with identical behavior.
7560
[[sycl::reqd_sub_group_size(12)]] void same(); // OK
@@ -119,16 +104,14 @@ int check() {
119104

120105
// Test that checks template parameter support on function.
121106
template <int N>
122-
// expected-error@+2{{'reqd_sub_group_size' attribute requires a positive integral compile time constant expression}}
123-
// 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() {}
107+
// expected-error@+1{{'reqd_sub_group_size' attribute requires a positive integral compile time constant expression}}
108+
[[intel::reqd_sub_group_size(N)]] void func3();
125109

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

130113
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}}
114+
[[intel::reqd_sub_group_size(N)]] void func4(); // expected-warning {{attribute 'reqd_sub_group_size' is already applied with different arguments}}
132115

133116
int check1() {
134117
// no error expected

clang/test/SemaSYCL/reqd_work_group_size.cpp

Lines changed: 18 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -22,44 +22,31 @@ class Functor30 {
2222

2323
// Tests for 'reqd_work_group_size' attribute duplication.
2424
// No diagnostic is emitted because the arguments match. Duplicate attribute is silently ignored.
25-
// expected-warning@+1 {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
26-
[[sycl::reqd_work_group_size(6, 6, 6)]] [[sycl::reqd_work_group_size(6, 6, 6)]] void f2() {}
25+
[[sycl::reqd_work_group_size(6, 6, 6)]] [[sycl::reqd_work_group_size(6, 6, 6)]] void f2();
2726

2827
// No diagnostic is emitted because the arguments match.
2928
[[sycl::reqd_work_group_size(32, 32, 32)]] void f3();
3029
[[sycl::reqd_work_group_size(32, 32, 32)]] void f3(); // OK
3130

3231
// Produce a conflicting attribute warning when the args are different.
33-
[[sycl::reqd_work_group_size(6, 6, 6)]] // expected-note {{previous attribute is here}} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
32+
[[sycl::reqd_work_group_size(6, 6, 6)]] // expected-note {{previous attribute is here}}
3433
[[sycl::reqd_work_group_size(16, 16, 16)]] void // expected-error {{attribute 'reqd_work_group_size' is already applied with different arguments}}
35-
f4() {}
34+
f4();
3635

3736
// Catch the easy case where the attributes are all specified at once with
3837
// different arguments.
3938
struct TRIFuncObjGood1 {
40-
// expected-note@+3 {{previous attribute is here}}
41-
// expected-error@+2 {{attribute 'reqd_work_group_size' is already applied with different arguments}}
42-
// expected-warning@+1 {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
43-
[[sycl::reqd_work_group_size(64)]] [[sycl::reqd_work_group_size(128)]] void operator()() const {}
39+
// expected-note@+2 {{previous attribute is here}}
40+
// expected-error@+1 {{attribute 'reqd_work_group_size' is already applied with different arguments}}
41+
[[sycl::reqd_work_group_size(64)]] [[sycl::reqd_work_group_size(128)]] void operator()() const;
4442
};
4543

4644
struct TRIFuncObjGood2 {
47-
// expected-note@+3 {{previous attribute is here}}
48-
// expected-error@+2 {{attribute 'reqd_work_group_size' is already applied with different arguments}}
49-
// expected-warning@+1 {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
50-
[[sycl::reqd_work_group_size(64, 64)]] [[sycl::reqd_work_group_size(128, 128)]] void operator()() const {}
45+
// expected-note@+2 {{previous attribute is here}}
46+
// expected-error@+1 {{attribute 'reqd_work_group_size' is already applied with different arguments}}
47+
[[sycl::reqd_work_group_size(64, 64)]] [[sycl::reqd_work_group_size(128, 128)]] void operator()() const;
5148
};
5249

53-
struct TRIFuncObjGood3 {
54-
[[sycl::reqd_work_group_size(8, 8)]] void // expected-note {{previous attribute is here}}
55-
operator()() const;
56-
};
57-
58-
[[sycl::reqd_work_group_size(4, 4)]] // expected-error {{attribute 'reqd_work_group_size' is already applied with different arguments}} \
59-
// expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
60-
void
61-
TRIFuncObjGood3::operator()() const {}
62-
6350
// Show that the attribute works on member functions.
6451
class Functor {
6552
public:
@@ -77,9 +64,9 @@ class FunctorC {
7764

7865
class Functor32 {
7966
public:
80-
[[sycl::reqd_work_group_size(32, 1, 1)]] // expected-note {{previous attribute is here}} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
67+
[[sycl::reqd_work_group_size(32, 1, 1)]] // expected-note {{previous attribute is here}}
8168
[[sycl::reqd_work_group_size(1, 1, 32)]] void // expected-error{{attribute 'reqd_work_group_size' is already applied with different arguments}}
82-
operator()() const {}
69+
operator()() const;
8370
};
8471

8572
// Ensure that template arguments behave appropriately based on instantiations.
@@ -91,7 +78,7 @@ template <int X, int Y, int Z>
9178
[[sycl::reqd_work_group_size(1, 1, 1)]] void f7(); // #f7prev
9279

9380
template <int X, int Y, int Z>
94-
[[sycl::reqd_work_group_size(X, Y, Z)]] void f7() {} // #f7
81+
[[sycl::reqd_work_group_size(X, Y, Z)]] void f7(); // #f7
9582

9683
// Test that a template redeclaration where the difference is known up front is
9784
// diagnosed immediately, even without instantiation.
@@ -109,45 +96,31 @@ void instantiate() {
10996
f7<1, 1, 1>(); // OK, args are the same on the redecl.
11097
// expected-error@#f7 {{attribute 'reqd_work_group_size' is already applied with different arguments}}
11198
// expected-note@#f7prev {{previous attribute is here}}
112-
// expected-warning@#f7prev {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
113-
// expected-warning@#f7prev {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
11499
f7<2, 2, 2>(); // expected-note {{in instantiation}}
115100
}
116101

117102
// Tests for 'reqd_work_group_size' attribute duplication.
118103

119-
[[sycl::reqd_work_group_size(8)]] // expected-note {{previous attribute is here}} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
104+
[[sycl::reqd_work_group_size(8)]] // expected-note {{previous attribute is here}}
120105
[[sycl::reqd_work_group_size(1, 1, 8)]] void // expected-error {{attribute 'reqd_work_group_size' is already applied with different arguments}}
121-
f8(){};
106+
f8();
122107

123-
[[sycl::reqd_work_group_size(32, 32, 1)]] // expected-note {{previous attribute is here}} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
124-
[[sycl::reqd_work_group_size(32, 32)]] void f9() {} // expected-error {{attribute 'reqd_work_group_size' is already applied with different arguments}}
108+
[[sycl::reqd_work_group_size(32, 32, 1)]] // expected-note {{previous attribute is here}}
109+
[[sycl::reqd_work_group_size(32, 32)]] void f9(); // expected-error {{attribute 'reqd_work_group_size' is already applied with different arguments}}
125110

126111
// Test that template redeclarations also get diagnosed properly.
127112
template <int X, int Y, int Z>
128113
[[sycl::reqd_work_group_size(64, 1, 1)]] void f10(); // #f10prev
129114
template <int X, int Y, int Z>
130-
[[sycl::reqd_work_group_size(X, Y, Z)]] void f10() {} // #f10err
115+
[[sycl::reqd_work_group_size(X, Y, Z)]] void f10(); // #f10err
131116

132117
void test() {
133118
f10<64, 1, 1>(); // OK, args are the same on the redecl.
134119
// expected-error@#f10err {{attribute 'reqd_work_group_size' is already applied with different arguments}}
135120
// expected-note@#f10prev {{previous attribute is here}}
136-
// expected-warning@#f10prev {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
137-
// expected-warning@#f10prev {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
138121
f10<1, 1, 64>(); // expected-note {{in instantiation}}
139122
}
140123

141-
struct TRIFuncObjBad {
142-
[[sycl::reqd_work_group_size(32, 1, 1)]] void // expected-note {{previous attribute is here}}
143-
operator()() const;
144-
};
145-
146-
[[sycl::reqd_work_group_size(1, 1, 32)]] // expected-error {{attribute 'reqd_work_group_size' is already applied with different arguments}} \
147-
// expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
148-
void
149-
TRIFuncObjBad::operator()() const {}
150-
151124
// Test that checks wrong function template instantiation and ensures that the type
152125
// is checked properly when instantiating from the template definition.
153126

@@ -183,9 +156,8 @@ int main() {
183156
KernelFunctor<16, 1, 1>();
184157
}
185158
// Test that checks template parameter support on function.
186-
// expected-warning@+2 {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
187159
template <int N, int N1, int N2>
188-
[[sycl::reqd_work_group_size(N, N1, N2)]] void func3() {}
160+
[[sycl::reqd_work_group_size(N, N1, N2)]] void func3();
189161

190162
int check() {
191163
func3<8, 8, 8>();

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,20 +115,10 @@ 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
120118
[[intel::sub_group_size(10)]] SYCL_EXTERNAL void AttrExternalNotDefined2(); // #AttrExternalNotDefined2
121119

122120
void calls_kernel_4() {
123121
sycl::kernel_single_task<class Kernel4>([]() { // #Kernel4
124-
// integer-error@#AttrFunc2{{kernel-called function must have a sub group size that matches the size specified for the kernel}}
125-
// integer-note@#Kernel4{{kernel declared here}}
126-
// expected-warning@#AttrFunc2 {{'sub_group_size' attribute can only be applied to a SYCL kernel function}}
127-
AttrFunc2();
128-
// integer-error@#AttrExternalDefined2{{kernel-called function must have a sub group size that matches the size specified for the kernel}}
129-
// integer-note@#Kernel4{{kernel declared here}}
130-
// expected-warning@#AttrExternalDefined2 {{'sub_group_size' attribute can only be applied to a SYCL kernel function}}
131-
AttrExternalDefined2();
132122
// integer-error@#AttrExternalNotDefined2{{kernel-called function must have a sub group size that matches the size specified for the kernel}}
133123
// integer-note@#Kernel4{{kernel declared here}}
134124
AttrExternalNotDefined2();

clang/test/SemaSYCL/sycl-device-intel-reqd-work-group-size-template.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ int main() {
5858
// CHECK-NEXT: IntegerLiteral{{.*}}1{{$}}
5959

6060
// Test that checks template parameter support on function.
61-
// expected-warning@+2 {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
6261
template <int N, int N1, int N2>
63-
[[sycl::reqd_work_group_size(N, N1, N2)]] void func3() {}
62+
[[sycl::reqd_work_group_size(N, N1, N2)]] void func3();
6463

6564
int check() {
6665
func3<8, 8, 8>();
@@ -87,8 +86,7 @@ int check() {
8786
// CHECK-NEXT: IntegerLiteral{{.*}}8{{$}}
8887

8988
// No diagnostic is emitted because the arguments match. Duplicate attribute is silently ignored.
90-
// expected-warning@+1 {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
91-
[[sycl::reqd_work_group_size(4, 4, 4)]] [[sycl::reqd_work_group_size(4, 4, 4)]] void func4() {}
89+
[[sycl::reqd_work_group_size(4, 4, 4)]] [[sycl::reqd_work_group_size(4, 4, 4)]] void func4();
9290
// CHECK: FunctionDecl {{.*}} {{.*}} func4 'void ()'
9391
// CHECK: SYCLReqdWorkGroupSizeAttr
9492
// CHECK-NEXT: ConstantExpr{{.*}}'int'

0 commit comments

Comments
 (0)