Skip to content

Commit 97d56c1

Browse files
[SYCL][NFCI] Remove single_task_lambda_impl helper (#18020)
After #18015 `wrap_kernel` is powerful enough to substitute it with just a minor tweak.
1 parent 7033592 commit 97d56c1

File tree

1 file changed

+7
-23
lines changed

1 file changed

+7
-23
lines changed

sycl/include/sycl/handler.hpp

+7-23
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,9 @@ class __SYCL_EXPORT handler {
16161616
KernelWrapper<WrapAsVal, NameT, KernelType, ElementType, PropertiesT>::wrap(
16171617
this, KernelFunc);
16181618
#ifndef __SYCL_DEVICE_ONLY__
1619+
if constexpr (WrapAsVal == WrapAs::single_task) {
1620+
throwOnKernelParameterMisuse<KernelName, KernelType>();
1621+
}
16191622
throwIfActionIsCreated();
16201623
if constexpr (std::is_same_v<MaybeKernelTy, kernel>) {
16211624
// Ignore any set kernel bundles and use the one associated with the
@@ -1653,25 +1656,6 @@ class __SYCL_EXPORT handler {
16531656
// NOTE: to support kernel_handler argument in kernel lambdas, only
16541657
// KernelWrapper<...>::wrap() must be called in this code.
16551658

1656-
/// Defines and invokes a SYCL kernel function as a function object type.
1657-
///
1658-
/// If it is a named function object and the function object type is
1659-
/// globally visible, there is no need for the developer to provide
1660-
/// a kernel name for it.
1661-
///
1662-
/// \param KernelFunc is a SYCL kernel function.
1663-
template <
1664-
typename KernelName, typename KernelType,
1665-
typename PropertiesT = ext::oneapi::experimental::empty_properties_t>
1666-
void single_task_lambda_impl(PropertiesT Props,
1667-
const KernelType &KernelFunc) {
1668-
wrap_kernel<WrapAs::single_task, KernelName>(KernelFunc, nullptr /*Kernel*/,
1669-
Props, range<1>{1});
1670-
#ifndef __SYCL_DEVICE_ONLY__
1671-
throwOnKernelParameterMisuse<KernelName, KernelType>();
1672-
#endif
1673-
}
1674-
16751659
void setStateExplicitKernelBundle();
16761660
void setStateSpecConstSet();
16771661
bool isStateExplicitKernelBundle() const;
@@ -1889,8 +1873,8 @@ class __SYCL_EXPORT handler {
18891873
/// \param KernelFunc is a SYCL kernel function.
18901874
template <typename KernelName = detail::auto_name, typename KernelType>
18911875
void single_task(const KernelType &KernelFunc) {
1892-
single_task_lambda_impl<KernelName>(
1893-
ext::oneapi::experimental::empty_properties_t{}, KernelFunc);
1876+
wrap_kernel<WrapAs::single_task, KernelName>(KernelFunc, nullptr /*Kernel*/,
1877+
{} /*Props*/, range<1>{1});
18941878
}
18951879

18961880
template <typename KernelName = detail::auto_name, typename KernelType>
@@ -2224,8 +2208,8 @@ class __SYCL_EXPORT handler {
22242208
std::enable_if_t<ext::oneapi::experimental::is_property_list<
22252209
PropertiesT>::value> single_task(PropertiesT Props,
22262210
const KernelType &KernelFunc) {
2227-
single_task_lambda_impl<KernelName, KernelType, PropertiesT>(Props,
2228-
KernelFunc);
2211+
wrap_kernel<WrapAs::single_task, KernelName>(KernelFunc, nullptr /*Kernel*/,
2212+
Props, range<1>{1});
22292213
}
22302214

22312215
template <typename KernelName = detail::auto_name, typename KernelType,

0 commit comments

Comments
 (0)