Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 7 additions & 23 deletions sycl/include/sycl/handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,9 @@ class __SYCL_EXPORT handler {
KernelWrapper<WrapAsVal, NameT, KernelType, ElementType, PropertiesT>::wrap(
this, KernelFunc);
#ifndef __SYCL_DEVICE_ONLY__
if constexpr (WrapAsVal == WrapAs::single_task) {
throwOnKernelParameterMisuse<KernelName, KernelType>();
}
throwIfActionIsCreated();
if constexpr (std::is_same_v<MaybeKernelTy, kernel>) {
// Ignore any set kernel bundles and use the one associated with the
Expand Down Expand Up @@ -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<WrapAs::single_task, KernelName>(KernelFunc, nullptr /*Kernel*/,
Props, range<1>{1});
#ifndef __SYCL_DEVICE_ONLY__
throwOnKernelParameterMisuse<KernelName, KernelType>();
#endif
}

void setStateExplicitKernelBundle();
void setStateSpecConstSet();
bool isStateExplicitKernelBundle() const;
Expand Down Expand Up @@ -1881,8 +1865,8 @@ class __SYCL_EXPORT handler {
/// \param KernelFunc is a SYCL kernel function.
template <typename KernelName = detail::auto_name, typename KernelType>
void single_task(const KernelType &KernelFunc) {
single_task_lambda_impl<KernelName>(
ext::oneapi::experimental::empty_properties_t{}, KernelFunc);
wrap_kernel<WrapAs::single_task, KernelName>(KernelFunc, nullptr /*Kernel*/,
{} /*Props*/, range<1>{1});
}

template <typename KernelName = detail::auto_name, typename KernelType>
Expand Down Expand Up @@ -2216,8 +2200,8 @@ class __SYCL_EXPORT handler {
std::enable_if_t<ext::oneapi::experimental::is_property_list<
PropertiesT>::value> single_task(PropertiesT Props,
const KernelType &KernelFunc) {
single_task_lambda_impl<KernelName, KernelType, PropertiesT>(Props,
KernelFunc);
wrap_kernel<WrapAs::single_task, KernelName>(KernelFunc, nullptr /*Kernel*/,
Props, range<1>{1});
}

template <typename KernelName = detail::auto_name, typename KernelType,
Expand Down