From 808c191f7c70654bb862ccbfb5e5bb2ffb68a6b9 Mon Sep 17 00:00:00 2001 From: Vyacheslav N Klochkov Date: Tue, 25 May 2021 15:58:16 -0700 Subject: [PATCH] [SYCL] Add SYCL-2020 method handler::host_task() The method handler::codeplay_host_task() is marked as deprecated. Signed-off-by: Vyacheslav N Klochkov --- sycl/include/CL/sycl/handler.hpp | 60 +++++++++++++++++++------------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/sycl/include/CL/sycl/handler.hpp b/sycl/include/CL/sycl/handler.hpp index 4804d63c0123f..059a8fb4344e0 100644 --- a/sycl/include/CL/sycl/handler.hpp +++ b/sycl/include/CL/sycl/handler.hpp @@ -1038,6 +1038,23 @@ class __SYCL_EXPORT handler { void setHandlerKernelBundle( const std::shared_ptr &NewKernelBundleImpPtr); + template + detail::enable_if_t< + detail::check_fn_signature, + void()>::value || + detail::check_fn_signature, + void(interop_handle)>::value> + host_task_impl(FuncT &&Func) { + throwIfActionIsCreated(); + + MNDRDesc.set(range<1>(1)); + MArgs = std::move(MAssociatedAccesors); + + MHostTask.reset(new detail::HostTask(std::move(Func))); + + setType(detail::CG::CODEPLAY_HOST_TASK); + } + public: handler(const handler &) = delete; handler(handler &&) = delete; @@ -1231,31 +1248,26 @@ class __SYCL_EXPORT handler { } template - detail::enable_if_t, void()>::value> - codeplay_host_task(FuncT Func) { - throwIfActionIsCreated(); - - MNDRDesc.set(range<1>(1)); - MArgs = std::move(MAssociatedAccesors); - - MHostTask.reset(new detail::HostTask(std::move(Func))); - - setType(detail::CG::CODEPLAY_HOST_TASK); - } - + __SYCL2020_DEPRECATED( + "codeplay_host_task() is deprecated, use host_task() instead") + detail::enable_if_t< + detail::check_fn_signature, + void()>::value || + detail::check_fn_signature< + detail::remove_reference_t, + void(interop_handle)>::value> codeplay_host_task(FuncT Func) { + host_task_impl(Func); + } + + /// Enqueues a command to the SYCL runtime to invoke \p Func once. template - detail::enable_if_t, void(interop_handle)>::value> - codeplay_host_task(FuncT Func) { - throwIfActionIsCreated(); - - MNDRDesc.set(range<1>(1)); - MArgs = std::move(MAssociatedAccesors); - - MHostTask.reset(new detail::HostTask(std::move(Func))); - - setType(detail::CG::CODEPLAY_HOST_TASK); + detail::enable_if_t< + detail::check_fn_signature, + void()>::value || + detail::check_fn_signature, + void(interop_handle)>::value> + host_task(FuncT &&Func) { + host_task_impl(Func); } // replace _KERNELFUNCPARAM(KernelFunc) with KernelType KernelFunc