Skip to content

Commit db649e6

Browse files
authored
[SYCL] Change KernelType definition to use std::decay_t (#20756)
Change the way KernelType is defined, so the const and reference declarations are removed. Also, use std::decay_t and/or detail::nth_type_t where applicable.
1 parent 29dfd03 commit db649e6

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

sycl/include/sycl/queue.hpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ auto submit_kernel_direct(
138138
const detail::code_location &CodeLoc = detail::code_location::current()) {
139139
detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc);
140140

141-
using KernelType =
142-
std::remove_const_t<std::remove_reference_t<KernelTypeUniversalRef>>;
141+
using KernelType = std::decay_t<KernelTypeUniversalRef>;
143142

144143
using NameT =
145144
typename detail::get_kernel_name_t<KernelName, KernelType>::name;
@@ -217,8 +216,7 @@ auto submit_kernel_direct_parallel_for(
217216
const PropertiesT &Props = ext::oneapi::experimental::empty_properties_t{},
218217
const detail::code_location &CodeLoc = detail::code_location::current()) {
219218

220-
using KernelType =
221-
std::remove_const_t<std::remove_reference_t<KernelTypeUniversalRef>>;
219+
using KernelType = std::decay_t<KernelTypeUniversalRef>;
222220

223221
using LambdaArgType =
224222
sycl::detail::lambda_arg_type<KernelType, nd_item<Dims>>;
@@ -3313,7 +3311,7 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
33133311
RestT &&...Rest) {
33143312
constexpr detail::code_location CodeLoc = getCodeLocation<KernelName>();
33153313
detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc);
3316-
using KernelType = std::tuple_element_t<0, std::tuple<RestT...>>;
3314+
using KernelType = std::decay_t<detail::nth_type_t<0, RestT...>>;
33173315

33183316
// TODO The handler-less path does not support reductions, and
33193317
// kernel functions with the kernel_handler type argument yet.
@@ -3343,7 +3341,7 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
33433341
parallel_for(nd_range<Dims> Range, RestT &&...Rest) {
33443342
constexpr detail::code_location CodeLoc = getCodeLocation<KernelName>();
33453343
detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc);
3346-
using KernelType = std::tuple_element_t<0, std::tuple<RestT...>>;
3344+
using KernelType = std::decay_t<detail::nth_type_t<0, RestT...>>;
33473345

33483346
// TODO The handler-less path does not support reductions, and
33493347
// kernel functions with the kernel_handler type argument yet.
@@ -3405,7 +3403,7 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
34053403
parallel_for(nd_range<Dims> Range, event DepEvent, RestT &&...Rest) {
34063404
constexpr detail::code_location CodeLoc = getCodeLocation<KernelName>();
34073405
detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc);
3408-
using KernelType = std::tuple_element_t<0, std::tuple<RestT...>>;
3406+
using KernelType = std::decay_t<detail::nth_type_t<0, RestT...>>;
34093407

34103408
// TODO The handler-less path does not support reductions, and
34113409
// kernel functions with the kernel_handler type argument yet.
@@ -3472,7 +3470,7 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
34723470
RestT &&...Rest) {
34733471
constexpr detail::code_location CodeLoc = getCodeLocation<KernelName>();
34743472
detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc);
3475-
using KernelType = std::tuple_element_t<0, std::tuple<RestT...>>;
3473+
using KernelType = std::decay_t<detail::nth_type_t<0, RestT...>>;
34763474

34773475
// TODO The handler-less path does not support reductions, and
34783476
// kernel functions with the kernel_handler type argument yet.

0 commit comments

Comments
 (0)