diff --git a/sycl/include/syclcompat/launch.hpp b/sycl/include/syclcompat/launch.hpp index eb5d774bc12d3..47e17b899f924 100644 --- a/sycl/include/syclcompat/launch.hpp +++ b/sycl/include/syclcompat/launch.hpp @@ -118,6 +118,22 @@ launch(const dim3 &grid, const dim3 &threads, Args... args) { return launch(grid, threads, get_default_queue(), args...); } +// Overload taking zero-argument function object +template +std::enable_if_t, sycl::event> +launch(const F &f, const sycl::nd_range &range, + sycl::queue q = get_default_queue()) { + return q.parallel_for(detail::transform_nd_range(range), + [=](sycl::nd_item) { f(); }); +} +// Alternative launch through dim3 objects +template +std::enable_if_t, sycl::event> +launch(const F &f, const dim3 &grid, const dim3 &threads, + sycl::queue q = get_default_queue()) { + return launch(f, sycl::nd_range<3>{grid * threads, threads}, q); +} + } // namespace syclcompat namespace syclcompat::experimental {