Skip to content

Commit 98b5505

Browse files
authored
[SYCL] Do not make auto& range parallel_for a future breaking change (#11897)
1 parent 96e28fe commit 98b5505

File tree

3 files changed

+3
-19
lines changed

3 files changed

+3
-19
lines changed

sycl/include/sycl/handler.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,9 +1261,10 @@ class __SYCL_EXPORT handler {
12611261
"first argument of sycl::item type, or of a type which is "
12621262
"implicitly convertible from sycl::item");
12631263

1264+
using RefLambdaArgType = std::add_lvalue_reference_t<LambdaArgType>;
12641265
static_assert(
1265-
(std::is_invocable_v<KernelType, LambdaArgType> ||
1266-
std::is_invocable_v<KernelType, LambdaArgType, kernel_handler>),
1266+
(std::is_invocable_v<KernelType, RefLambdaArgType> ||
1267+
std::is_invocable_v<KernelType, RefLambdaArgType, kernel_handler>),
12671268
"SYCL kernel lambda/functor has an unexpected signature, it should be "
12681269
"invocable with sycl::item and optionally sycl::kernel_handler");
12691270
#endif

sycl/test/basic_tests/handler/handler_generic_lambda_interface.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ int main() {
5353
test_parallel_for_work_group<class Group2Name, sycl::group<2>>(sycl::range<2>{1, 1});
5454
test_parallel_for_work_group<class Group3Name, sycl::group<3>>(sycl::range<3>{1, 1, 1});
5555

56-
#ifndef PREVIEW_BREAKING_CHANGES
57-
// For backwards compatibility, we still support some invalid variants of
58-
// kernel lambdas. These test cases should be removed once we make conformant
59-
// mode the default.
6056
sycl::queue q;
6157
q.submit([&](sycl::handler &cgh) {
6258
cgh.parallel_for(sycl::range{1}, [=](auto &) {});
@@ -67,7 +63,6 @@ int main() {
6763
q.submit([&](sycl::handler &cgh) {
6864
cgh.parallel_for(sycl::range{1, 1, 1}, [=](auto &) {});
6965
});
70-
#endif
7166

7267
return 0;
7368
}

sycl/test/basic_tests/handler/parallel_for_arg_restrictions.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,6 @@ int main() {
7171
CGH.parallel_for(sycl::nd_range{sycl::range{1, 1, 1}, sycl::range{1, 1, 1}},
7272
[=](ConvertibleFromItem<3>) {});
7373
});
74-
Q.submit([&](sycl::handler &CGH) {
75-
// expected-error@sycl/handler.hpp:* {{SYCL kernel lambda/functor has an unexpected signature, it should be invocable with sycl::item and optionally sycl::kernel_handler}}
76-
CGH.parallel_for(sycl::range{1}, [=](auto &) {});
77-
});
78-
Q.submit([&](sycl::handler &CGH) {
79-
// expected-error@sycl/handler.hpp:* {{SYCL kernel lambda/functor has an unexpected signature, it should be invocable with sycl::item and optionally sycl::kernel_handler}}
80-
CGH.parallel_for(sycl::range{1, 1}, [=](auto &) {});
81-
});
82-
Q.submit([&](sycl::handler &CGH) {
83-
// expected-error@sycl/handler.hpp:* {{SYCL kernel lambda/functor has an unexpected signature, it should be invocable with sycl::item and optionally sycl::kernel_handler}}
84-
CGH.parallel_for(sycl::range{1, 1, 1}, [=](auto &) {});
85-
});
8674

8775
Q.submit([&](sycl::handler &CGH) {
8876
// expected-error@sycl/handler.hpp:* {{sycl::parallel_for(sycl::range) kernel must have the first argument of sycl::item type, or of a type which is implicitly convertible from sycl::item}}

0 commit comments

Comments
 (0)