Skip to content

Commit 1d6b9f9

Browse files
committed
[SYCL] make intel::reqd_sub_group_size deprecat`ed
1 parent 3796776 commit 1d6b9f9

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

clang/lib/Sema/SemaSYCLDeclAttr.cpp

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

135+
// Additionally, diagnose deprecated [[intel::reqd_sub_group_size]] spelling
136+
if (A.getKind() == ParsedAttr::AT_IntelReqdSubGroupSize &&
137+
A.getAttrName()->isStr("reqd_sub_group_size") && A.getScopeName()->isStr("intel")) {
138+
diagnoseDeprecatedAttribute(A, "sycl", "reqd_sub_group_size");
139+
return;
140+
}
141+
135142
// Diagnose SYCL 2020 spellings in later SYCL modes.
136143
if (getLangOpts().getSYCLVersion() >= LangOptions::SYCL_2020) {
137144
// All attributes in the cl vendor namespace are deprecated in favor of a

sycl/test/warnings/warnings.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
#include <sycl/sycl.hpp>
55

66
using namespace sycl;
7+
8+
9+
class FunctorModern {
10+
public:
11+
[[sycl::reqd_sub_group_size(16)]] void operator()() const {}
12+
};
13+
14+
715
int main() {
816
vec<long, 4> newVec;
917
queue myQueue;
@@ -13,6 +21,8 @@ int main() {
1321
cgh.single_task<class kernel_name>([=]() {
1422
writeResult[0] = (vec<int, 4>{1, 2, 3, 4}).template convert<long>();
1523
});
24+
FunctorModern fModern;
25+
cgh.single_task<class kernel_name2>(fModern);
1626
});
1727
(void)event;
1828
return 0;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: %clangxx -fsycl -sycl-std=2020 -fsycl-device-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s -fsyntax-only -Wall -Wdeprecated -Wextra
2+
3+
#include <sycl/sycl.hpp>
4+
5+
6+
using namespace sycl;
7+
queue q;
8+
9+
10+
class FunctorDeprecated {
11+
public:
12+
// expected-warning@+1{{attribute 'intel::reqd_sub_group_size' is deprecated}}
13+
[[intel::reqd_sub_group_size(16)]] void operator()() const {}
14+
};
15+
16+
int main() {
17+
18+
q.submit([&](handler &h) {
19+
FunctorDeprecated fDeprecated;
20+
h.single_task<class kernel_name1>(fDeprecated);
21+
});
22+
23+
return 0;
24+
}

0 commit comments

Comments
 (0)