Skip to content

Commit 75e5a26

Browse files
authored
[SYCL] Add SYCL-2020 method handler::host_task() (#3837)
The method handler::codeplay_host_task() is marked as deprecated. The corresponding changes in LIT tests: intel/llvm-test-suite#299 Signed-off-by: Vyacheslav N Klochkov <[email protected]>
1 parent 00460f7 commit 75e5a26

File tree

1 file changed

+36
-24
lines changed

1 file changed

+36
-24
lines changed

sycl/include/CL/sycl/handler.hpp

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,23 @@ class __SYCL_EXPORT handler {
10381038
void setHandlerKernelBundle(
10391039
const std::shared_ptr<detail::kernel_bundle_impl> &NewKernelBundleImpPtr);
10401040

1041+
template <typename FuncT>
1042+
detail::enable_if_t<
1043+
detail::check_fn_signature<detail::remove_reference_t<FuncT>,
1044+
void()>::value ||
1045+
detail::check_fn_signature<detail::remove_reference_t<FuncT>,
1046+
void(interop_handle)>::value>
1047+
host_task_impl(FuncT &&Func) {
1048+
throwIfActionIsCreated();
1049+
1050+
MNDRDesc.set(range<1>(1));
1051+
MArgs = std::move(MAssociatedAccesors);
1052+
1053+
MHostTask.reset(new detail::HostTask(std::move(Func)));
1054+
1055+
setType(detail::CG::CODEPLAY_HOST_TASK);
1056+
}
1057+
10411058
public:
10421059
handler(const handler &) = delete;
10431060
handler(handler &&) = delete;
@@ -1231,31 +1248,26 @@ class __SYCL_EXPORT handler {
12311248
}
12321249

12331250
template <typename FuncT>
1234-
detail::enable_if_t<detail::check_fn_signature<
1235-
detail::remove_reference_t<FuncT>, void()>::value>
1236-
codeplay_host_task(FuncT Func) {
1237-
throwIfActionIsCreated();
1238-
1239-
MNDRDesc.set(range<1>(1));
1240-
MArgs = std::move(MAssociatedAccesors);
1241-
1242-
MHostTask.reset(new detail::HostTask(std::move(Func)));
1243-
1244-
setType(detail::CG::CODEPLAY_HOST_TASK);
1245-
}
1246-
1251+
__SYCL2020_DEPRECATED(
1252+
"codeplay_host_task() is deprecated, use host_task() instead")
1253+
detail::enable_if_t<
1254+
detail::check_fn_signature<detail::remove_reference_t<FuncT>,
1255+
void()>::value ||
1256+
detail::check_fn_signature<
1257+
detail::remove_reference_t<FuncT>,
1258+
void(interop_handle)>::value> codeplay_host_task(FuncT Func) {
1259+
host_task_impl(Func);
1260+
}
1261+
1262+
/// Enqueues a command to the SYCL runtime to invoke \p Func once.
12471263
template <typename FuncT>
1248-
detail::enable_if_t<detail::check_fn_signature<
1249-
detail::remove_reference_t<FuncT>, void(interop_handle)>::value>
1250-
codeplay_host_task(FuncT Func) {
1251-
throwIfActionIsCreated();
1252-
1253-
MNDRDesc.set(range<1>(1));
1254-
MArgs = std::move(MAssociatedAccesors);
1255-
1256-
MHostTask.reset(new detail::HostTask(std::move(Func)));
1257-
1258-
setType(detail::CG::CODEPLAY_HOST_TASK);
1264+
detail::enable_if_t<
1265+
detail::check_fn_signature<detail::remove_reference_t<FuncT>,
1266+
void()>::value ||
1267+
detail::check_fn_signature<detail::remove_reference_t<FuncT>,
1268+
void(interop_handle)>::value>
1269+
host_task(FuncT &&Func) {
1270+
host_task_impl(Func);
12591271
}
12601272

12611273
// replace _KERNELFUNCPARAM(KernelFunc) with KernelType KernelFunc

0 commit comments

Comments
 (0)