Skip to content

Commit edf06ba

Browse files
committed
[SYCL] A fallback path for handler-less kernel submission with kernel_handler
Add a fallback path (handler-based submission), if a kernel function uses a kernel_handler type argument. It allows for the use of specialization constants, which are not supported yet for the handler-less kernel submission path.
1 parent 3ffcfda commit edf06ba

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

sycl/include/sycl/ext/oneapi/experimental/enqueue_functions.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,15 @@ template <typename KernelName = sycl::detail::auto_name, int Dimensions,
260260
void nd_launch(queue Q, nd_range<Dimensions> Range, const KernelType &KernelObj,
261261
ReductionsT &&...Reductions) {
262262
#ifdef __DPCPP_ENABLE_UNFINISHED_NO_CGH_SUBMIT
263-
// TODO The handler-less path does not support reductions and kernel function
264-
// properties yet.
263+
// TODO The handler-less path does not support reductions, kernel
264+
// function properties and kernel functions with the kernel_handler
265+
// type argument yet.
265266
if constexpr (sizeof...(ReductionsT) == 0 &&
266267
!(ext::oneapi::experimental::detail::
267268
HasKernelPropertiesGetMethod<
268-
const KernelType &>::value)) {
269+
const KernelType &>::value) &&
270+
!(detail::KernelLambdaHasKernelHandlerArgT<
271+
KernelType, sycl::nd_item<Dimensions>>::value)) {
269272
detail::submit_kernel_direct<KernelName>(std::move(Q), empty_properties_t{},
270273
Range, KernelObj);
271274
} else

sycl/include/sycl/khr/free_function_commands.hpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,13 @@ void launch_grouped(const queue &q, range<1> r, range<1> size, KernelType &&k,
158158
const sycl::detail::code_location &codeLoc =
159159
sycl::detail::code_location::current()) {
160160
#ifdef __DPCPP_ENABLE_UNFINISHED_NO_CGH_SUBMIT
161-
// TODO The handler-less path does not support kernel function properties yet.
161+
// TODO The handler-less path does not support kernel function properties
162+
// and kernel functions with the kernel_handler type argument yet.
162163
if constexpr (!(ext::oneapi::experimental::detail::
163164
HasKernelPropertiesGetMethod<
164-
const KernelType &>::value)) {
165+
const KernelType &>::value) &&
166+
!(detail::KernelLambdaHasKernelHandlerArgT<
167+
KernelType, sycl::nd_item<1>>::value)) {
165168
detail::submit_kernel_direct(
166169
q, ext::oneapi::experimental::empty_properties_t{},
167170
nd_range<1>(r, size), std::forward<KernelType>(k));
@@ -179,10 +182,13 @@ void launch_grouped(const queue &q, range<2> r, range<2> size, KernelType &&k,
179182
const sycl::detail::code_location &codeLoc =
180183
sycl::detail::code_location::current()) {
181184
#ifdef __DPCPP_ENABLE_UNFINISHED_NO_CGH_SUBMIT
182-
// TODO The handler-less path does not support kernel function properties yet.
185+
// TODO The handler-less path does not support kernel function properties
186+
// and kernel functions with the kernel_handler type argument yet.
183187
if constexpr (!(ext::oneapi::experimental::detail::
184188
HasKernelPropertiesGetMethod<
185-
const KernelType &>::value)) {
189+
const KernelType &>::value) &&
190+
!(detail::KernelLambdaHasKernelHandlerArgT<
191+
KernelType, sycl::nd_item<2>>::value)) {
186192
detail::submit_kernel_direct(
187193
q, ext::oneapi::experimental::empty_properties_t{},
188194
nd_range<2>(r, size), std::forward<KernelType>(k));
@@ -200,10 +206,13 @@ void launch_grouped(const queue &q, range<3> r, range<3> size, KernelType &&k,
200206
const sycl::detail::code_location &codeLoc =
201207
sycl::detail::code_location::current()) {
202208
#ifdef __DPCPP_ENABLE_UNFINISHED_NO_CGH_SUBMIT
203-
// TODO The handler-less path does not support kernel function properties yet.
209+
// TODO The handler-less path does not support kernel function properties
210+
// and kernel functions with the kernel_handler type argument yet.
204211
if constexpr (!(ext::oneapi::experimental::detail::
205212
HasKernelPropertiesGetMethod<
206-
const KernelType &>::value)) {
213+
const KernelType &>::value) &&
214+
!(detail::KernelLambdaHasKernelHandlerArgT<
215+
KernelType, sycl::nd_item<3>>::value)) {
207216
detail::submit_kernel_direct(
208217
q, ext::oneapi::experimental::empty_properties_t{},
209218
nd_range<3>(r, size), std::forward<KernelType>(k));

sycl/include/sycl/queue.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3278,12 +3278,15 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
32783278
#ifdef __DPCPP_ENABLE_UNFINISHED_NO_CGH_SUBMIT
32793279
using KernelType = std::tuple_element_t<0, std::tuple<RestT...>>;
32803280

3281-
// TODO The handler-less path does not support reductions and kernel
3282-
// function properties yet.
3281+
// TODO The handler-less path does not support reductions, kernel
3282+
// function properties and kernel functions with the kernel_handler
3283+
// type argument yet.
32833284
if constexpr (sizeof...(RestT) == 1 &&
32843285
!(ext::oneapi::experimental::detail::
32853286
HasKernelPropertiesGetMethod<
3286-
const KernelType &>::value)) {
3287+
const KernelType &>::value) &&
3288+
!(detail::KernelLambdaHasKernelHandlerArgT<
3289+
KernelType, sycl::nd_item<Dims>>::value)) {
32873290
return detail::submit_kernel_direct<KernelName, true>(
32883291
*this, ext::oneapi::experimental::empty_properties_t{}, Range,
32893292
Rest...);

0 commit comments

Comments
 (0)