diff --git a/sycl/include/sycl/handler.hpp b/sycl/include/sycl/handler.hpp index b4f3aa1245bc9..55ac98cbdebd9 100644 --- a/sycl/include/sycl/handler.hpp +++ b/sycl/include/sycl/handler.hpp @@ -1608,6 +1608,9 @@ class __SYCL_EXPORT handler { KernelWrapper::wrap( this, KernelFunc); #ifndef __SYCL_DEVICE_ONLY__ + if constexpr (WrapAsVal == WrapAs::single_task) { + throwOnKernelParameterMisuse(); + } throwIfActionIsCreated(); if constexpr (std::is_same_v) { // Ignore any set kernel bundles and use the one associated with the @@ -1645,25 +1648,6 @@ class __SYCL_EXPORT handler { // NOTE: to support kernel_handler argument in kernel lambdas, only // KernelWrapper<...>::wrap() must be called in this code. - /// Defines and invokes a SYCL kernel function as a function object type. - /// - /// If it is a named function object and the function object type is - /// globally visible, there is no need for the developer to provide - /// a kernel name for it. - /// - /// \param KernelFunc is a SYCL kernel function. - template < - typename KernelName, typename KernelType, - typename PropertiesT = ext::oneapi::experimental::empty_properties_t> - void single_task_lambda_impl(PropertiesT Props, - const KernelType &KernelFunc) { - wrap_kernel(KernelFunc, nullptr /*Kernel*/, - Props, range<1>{1}); -#ifndef __SYCL_DEVICE_ONLY__ - throwOnKernelParameterMisuse(); -#endif - } - void setStateExplicitKernelBundle(); void setStateSpecConstSet(); bool isStateExplicitKernelBundle() const; @@ -1881,8 +1865,8 @@ class __SYCL_EXPORT handler { /// \param KernelFunc is a SYCL kernel function. template void single_task(const KernelType &KernelFunc) { - single_task_lambda_impl( - ext::oneapi::experimental::empty_properties_t{}, KernelFunc); + wrap_kernel(KernelFunc, nullptr /*Kernel*/, + {} /*Props*/, range<1>{1}); } template @@ -2216,8 +2200,8 @@ class __SYCL_EXPORT handler { std::enable_if_t::value> single_task(PropertiesT Props, const KernelType &KernelFunc) { - single_task_lambda_impl(Props, - KernelFunc); + wrap_kernel(KernelFunc, nullptr /*Kernel*/, + Props, range<1>{1}); } template