Skip to content

Commit 8ef7eac

Browse files
authored
[SYCL] Deprecate [[intel::reqd_work_group_size]] attribute spelling (#3927)
Since we have SYCL 2020 replacement for `intel::reqd_work_group_size` - sycl::reqd_work_group_size, it makes sense do deprecate intel one. Signed-off-by: Soumi Manna <[email protected]>
1 parent ce820b8 commit 8ef7eac

11 files changed

+87
-71
lines changed

clang/include/clang/Basic/AttrDocs.td

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2526,14 +2526,14 @@ of the kernel the attribute is applied to.
25262526
// argument to the attribute is the one which increments fastest.
25272527
struct func {
25282528
[[intel::num_simd_work_items(4)]]
2529-
[[intel::reqd_work_group_size(7, 4, 64)]]
2529+
[[sycl::reqd_work_group_size(7, 4, 64)]]
25302530
void operator()() const {}
25312531
};
25322532

25332533
// Note, '8' is evenly divisible by '8'; in SYCL, the last
25342534
// argument to the attribute is the one which increments fastest.
25352535
struct bar {
2536-
[[intel::reqd_work_group_size(1, 1, 8)]]
2536+
[[sycl::reqd_work_group_size(1, 1, 8)]]
25372537
[[intel::num_simd_work_items(8)]]
25382538
void operator()() const {}
25392539
};
@@ -2659,6 +2659,10 @@ As an Intel extension, the ``[[intel::reqd_work_group_size(X, Y, Z)]]``
26592659
spelling is supported with the same semantics as the
26602660
``[[sycl::reqd_work_group_size(X, Y, Z)]]`` spelling.
26612661

2662+
The ``[[intel::reqd_work_group_size(X, Y, Z)]]`` attribute spelling
2663+
is deprecated in favor of the SYCL 2020 attribute spelling
2664+
``[[sycl::reqd_work_group_size]]``.
2665+
26622666
In OpenCL C, this attribute is available with the GNU spelling
26632667
(``__attribute__((reqd_work_group_size(X, Y, Z)))``), see section
26642668
6.7.2 Optional Attribute Qualifiers of OpenCL 1.2 specification for details.
@@ -2714,14 +2718,14 @@ in the ``reqd_work_group_size`` attribute.
27142718
// argument to the attribute is the one which increments fastest.
27152719
struct func {
27162720
[[intel::num_simd_work_items(4)]]
2717-
[[intel::reqd_work_group_size(7, 4, 64)]]
2721+
[[sycl::reqd_work_group_size(7, 4, 64)]]
27182722
void operator()() const {}
27192723
};
27202724

27212725
// Note, '8' is evenly divisible by '8'; in SYCL, the last
27222726
// argument to the attribute is the one which increments fastest.
27232727
struct bar {
2724-
[[intel::reqd_work_group_size(1, 1, 8)]]
2728+
[[sycl::reqd_work_group_size(1, 1, 8)]]
27252729
[[intel::num_simd_work_items(8)]]
27262730
void operator()() const {}
27272731
};

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,14 @@ void Sema::CheckDeprecatedSYCLAttributeSpelling(const ParsedAttr &A,
337337
return;
338338
}
339339

340+
// Deprecate [[intel::reqd_work_group_size]] attribute spelling in favor
341+
// of the SYCL 2020 attribute spelling [[sycl::reqd_work_group_size]].
342+
if (A.getKind() == ParsedAttr::AT_ReqdWorkGroupSize && A.hasScope() &&
343+
A.getScopeName()->isStr("intel")) {
344+
DiagnoseDeprecatedAttribute(A, "sycl", NewName);
345+
return;
346+
}
347+
340348
// All GNU-style spellings are deprecated in favor of a C++-style spelling.
341349
if (A.getSyntax() == ParsedAttr::AS_GNU) {
342350
// Note: we cannot suggest an automatic fix-it because GNU-style

clang/test/CodeGenSYCL/sycl-multi-kernel-attr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ class Functor {
1212

1313
class Functor1 {
1414
public:
15-
[[intel::reqd_sub_group_size(2), intel::reqd_work_group_size(64, 32, 32)]] void operator()() const {}
15+
[[intel::reqd_sub_group_size(2), sycl::reqd_work_group_size(64, 32, 32)]] void operator()() const {}
1616
};
1717

1818
template <int SIZE, int SIZE1, int SIZE2>
1919
class Functor2 {
2020
public:
21-
[[intel::reqd_work_group_size(SIZE, SIZE1, SIZE2)]] void operator()() const {}
21+
[[sycl::reqd_work_group_size(SIZE, SIZE1, SIZE2)]] void operator()() const {}
2222
};
2323

2424
template <int N, int N1, int N2>
25-
[[intel::reqd_work_group_size(N, N1, N2)]] void func() {}
25+
[[sycl::reqd_work_group_size(N, N1, N2)]] void func() {}
2626

2727
int main() {
2828
q.submit([&](handler &h) {

clang/test/SemaSYCL/intel-max-global-work-dim-device.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ struct TRIFuncObjGood2 {
6767
};
6868

6969
struct TRIFuncObjGood3 {
70-
[[intel::reqd_work_group_size(1)]]
70+
[[sycl::reqd_work_group_size(1)]]
7171
[[intel::max_global_work_dim(0)]] void
7272
operator()() const {}
7373
};
@@ -85,7 +85,7 @@ struct TRIFuncObjGood5 {
8585
};
8686

8787
struct TRIFuncObjGood6 {
88-
[[intel::reqd_work_group_size(4, 1, 1)]]
88+
[[sycl::reqd_work_group_size(4, 1, 1)]]
8989
[[intel::max_global_work_dim(3)]] void
9090
operator()() const {}
9191
};
@@ -119,7 +119,7 @@ void TRIFuncObjBad::operator()() const {}
119119
// attributes when merging, so the test compiles without
120120
// any diagnostic when it shouldn't.
121121
struct TRIFuncObjBad1 {
122-
[[intel::reqd_work_group_size(4, 4, 4)]] void
122+
[[sycl::reqd_work_group_size(4, 4, 4)]] void
123123
operator()() const;
124124
};
125125

@@ -166,7 +166,9 @@ struct TRIFuncObjBad5 {
166166
};
167167

168168
struct TRIFuncObjBad6 {
169-
[[intel::reqd_work_group_size(4)]] // expected-error{{all 'reqd_work_group_size' attribute arguments must be '1' when the 'max_global_work_dim' attribute argument is '0'}}
169+
[[intel::reqd_work_group_size(4)]] // expected-error{{all 'reqd_work_group_size' attribute arguments must be '1' when the 'max_global_work_dim' attribute argument is '0'}} \
170+
// expected-warning {{attribute 'intel::reqd_work_group_size' is deprecated}} \
171+
// expected-note {{did you mean to use 'sycl::reqd_work_group_size' instead?}}
170172
[[intel::max_global_work_dim(0)]] void
171173
operator()() const {}
172174
};
@@ -184,7 +186,7 @@ struct TRIFuncObjBad8 {
184186
operator()() const;
185187
};
186188

187-
[[intel::reqd_work_group_size(4, 4, 4)]] // expected-error{{all 'reqd_work_group_size' attribute arguments must be '1' when the 'max_global_work_dim' attribute argument is '0'}}
189+
[[sycl::reqd_work_group_size(4, 4, 4)]] // expected-error{{all 'reqd_work_group_size' attribute arguments must be '1' when the 'max_global_work_dim' attribute argument is '0'}}
188190
void TRIFuncObjBad8::operator()() const {}
189191

190192
struct TRIFuncObjBad9 {
@@ -201,7 +203,7 @@ void TRIFuncObjBad9::operator()() const {}
201203
struct TRIFuncObjBad10 {
202204
// expected-error@+2{{all 'reqd_work_group_size' attribute arguments must be '1' when the 'max_global_work_dim' attribute argument is '0'}}
203205
// expected-warning@+1{{implicit conversion changes signedness: 'int' to 'unsigned long long'}}
204-
[[intel::reqd_work_group_size(-4, 1)]]
206+
[[sycl::reqd_work_group_size(-4, 1)]]
205207
[[intel::max_global_work_dim(0)]] void
206208
operator()() const {}
207209
};
@@ -219,7 +221,7 @@ struct TRIFuncObjBad12 {
219221
};
220222

221223
struct TRIFuncObjBad13 {
222-
[[intel::reqd_work_group_size(4)]]
224+
[[sycl::reqd_work_group_size(4)]]
223225
[[intel::max_global_work_dim(-2)]] // expected-error{{'max_global_work_dim' attribute requires integer constant between 0 and 3 inclusive}}
224226
void operator()() const {}
225227
};

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ queue q;
1010
// expected-no-diagnostics
1111
class Functor {
1212
public:
13-
[[intel::reqd_work_group_size(4)]] void operator()() const {}
13+
[[sycl::reqd_work_group_size(4)]] void operator()() const {}
1414
};
1515

1616
void bar() {
@@ -21,15 +21,14 @@ void bar() {
2121
}
2222

2323
#else
24-
[[intel::reqd_work_group_size(4)]] void f4x1x1() {} // expected-note {{conflicting attribute is here}}
24+
[[sycl::reqd_work_group_size(4)]] void f4x1x1() {} // expected-note {{conflicting attribute is here}}
2525
// expected-note@-1 {{conflicting attribute is here}}
26-
[[intel::reqd_work_group_size(32)]] void f32x1x1() {} // expected-note {{conflicting attribute is here}}
26+
[[sycl::reqd_work_group_size(32)]] void f32x1x1() {} // expected-note {{conflicting attribute is here}}
27+
[[sycl::reqd_work_group_size(16)]] void f16x1x1() {} // expected-note {{conflicting attribute is here}}
28+
[[sycl::reqd_work_group_size(16, 16)]] void f16x16x1() {} // expected-note {{conflicting attribute is here}}
2729

28-
[[intel::reqd_work_group_size(16)]] void f16x1x1() {} // expected-note {{conflicting attribute is here}}
29-
[[intel::reqd_work_group_size(16, 16)]] void f16x16x1() {} // expected-note {{conflicting attribute is here}}
30-
31-
[[intel::reqd_work_group_size(32, 32)]] void f32x32x1() {} // expected-note {{conflicting attribute is here}}
32-
[[intel::reqd_work_group_size(32, 32, 32)]] void f32x32x32() {} // expected-note {{conflicting attribute is here}}
30+
[[sycl::reqd_work_group_size(32, 32)]] void f32x32x1() {} // expected-note {{conflicting attribute is here}}
31+
[[sycl::reqd_work_group_size(32, 32, 32)]] void f32x32x32() {} // expected-note {{conflicting attribute is here}}
3332

3433
#ifdef TRIGGER_ERROR
3534
class Functor32 {
@@ -43,33 +42,34 @@ class Functor32 {
4342
class Functor33 {
4443
public:
4544
// expected-warning@+1{{implicit conversion changes signedness: 'int' to 'unsigned long long'}}
46-
[[intel::reqd_work_group_size(32, -4)]] void operator()() const {}
45+
[[sycl::reqd_work_group_size(32, -4)]] void operator()() const {}
4746
};
4847

4948
class Functor30 {
5049
public:
5150
// expected-warning@+1 2{{implicit conversion changes signedness: 'int' to 'unsigned long long'}}
52-
[[intel::reqd_work_group_size(30, -30, -30)]] void operator()() const {}
51+
[[sycl::reqd_work_group_size(30, -30, -30)]] void operator()() const {}
5352
};
5453

5554
class Functor16 {
5655
public:
57-
[[intel::reqd_work_group_size(16)]] void operator()() const {}
56+
[[sycl::reqd_work_group_size(16)]] void operator()() const {}
5857
};
5958

6059
class Functor64 {
6160
public:
62-
[[intel::reqd_work_group_size(64, 64)]] void operator()() const {}
61+
[[sycl::reqd_work_group_size(64, 64)]] void operator()() const {}
6362
};
6463

6564
class Functor16x16x16 {
6665
public:
67-
[[intel::reqd_work_group_size(16, 16, 16)]] void operator()() const {}
66+
[[intel::reqd_work_group_size(16, 16, 16)]] void operator()() const {} // expected-warning {{attribute 'intel::reqd_work_group_size' is deprecated}} \
67+
// expected-note {{did you mean to use 'sycl::reqd_work_group_size' instead?}}
6868
};
6969

7070
class Functor8 { // expected-error {{conflicting attributes applied to a SYCL kernel}}
7171
public:
72-
[[intel::reqd_work_group_size(8)]] void operator()() const { // expected-note {{conflicting attribute is here}}
72+
[[sycl::reqd_work_group_size(8)]] void operator()() const { // expected-note {{conflicting attribute is here}}
7373
f4x1x1();
7474
}
7575
};
@@ -107,7 +107,7 @@ int main() {
107107
Functor30 f30;
108108
h.single_task<class kernel_name6>(f30);
109109

110-
h.single_task<class kernel_name7>([]() [[intel::reqd_work_group_size(32, 32, 32)]] {
110+
h.single_task<class kernel_name7>([]() [[sycl::reqd_work_group_size(32, 32, 32)]] {
111111
f32x32x32();
112112
});
113113
#ifdef TRIGGER_ERROR
@@ -130,7 +130,7 @@ int main() {
130130
});
131131

132132
// expected-error@+1 {{expected variable name or 'this' in lambda capture list}}
133-
h.single_task<class kernel_name12>([[intel::reqd_work_group_size(32, 32, 32)]][]() {
133+
h.single_task<class kernel_name12>([[sycl::reqd_work_group_size(32, 32, 32)]][]() {
134134
f32x32x32();
135135
});
136136

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// RUN: %clang_cc1 -fsycl-is-host -Wno-sycl-2017-compat -fsyntax-only -verify %s
22
// expected-no-diagnostics
33

4-
[[intel::reqd_work_group_size(4)]] void f4x1x1() {}
4+
[[sycl::reqd_work_group_size(4)]] void f4x1x1() {}
55

6-
[[intel::reqd_work_group_size(16)]] void f16x1x1() {}
6+
[[sycl::reqd_work_group_size(16)]] void f16x1x1() {}
77

8-
[[intel::reqd_work_group_size(32, 32, 32)]] void f32x32x32() {}
8+
[[sycl::reqd_work_group_size(32, 32, 32)]] void f32x32x32() {}
99

1010
class Functor64 {
1111
public:
12-
[[intel::reqd_work_group_size(64, 64, 64)]] void operator()() const {}
12+
[[sycl::reqd_work_group_size(64, 64, 64)]] void operator()() const {}
1313
};

0 commit comments

Comments
 (0)