Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions sycl/include/sycl/handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1457,8 +1457,8 @@ class __SYCL_EXPORT handler {
template <typename SharedPtrT>
void setHandlerKernelBundle(SharedPtrT &&NewKernelBundleImpPtr);

void SetHostTask(std::function<void()> &&Func);
void SetHostTask(std::function<void(interop_handle)> &&Func);
void SetHostTask(std::function<void()> Func);
void SetHostTask(std::function<void(interop_handle)> Func);
Comment on lines +1460 to +1461
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::function is used for type-erasure, so "by value" semantics looks correct to me.


template <typename FuncT>
std::enable_if_t<detail::check_fn_signature<std::remove_reference_t<FuncT>,
Expand All @@ -1472,7 +1472,7 @@ class __SYCL_EXPORT handler {
// accessors during finalize
setArgsToAssociatedAccessors();

SetHostTask(std::move(Func));
SetHostTask(std::forward<FuncT>(Func));
}

template <typename FuncT>
Expand All @@ -1485,7 +1485,7 @@ class __SYCL_EXPORT handler {
// accessors during finalize
setArgsToAssociatedAccessors();

SetHostTask(std::move(Func));
SetHostTask(std::forward<FuncT>(Func));
setType(detail::CGType::EnqueueNativeCommand);
}

Expand Down Expand Up @@ -1707,7 +1707,7 @@ class __SYCL_EXPORT handler {
detail::check_fn_signature<std::remove_reference_t<FuncT>,
void(interop_handle)>::value>
host_task(FuncT &&Func) {
host_task_impl(Func);
host_task_impl(std::forward<FuncT>(Func));
}

/// Enqueues a command to the SYCL runtime to invoke \p Func immediately.
Expand All @@ -1716,7 +1716,7 @@ class __SYCL_EXPORT handler {
void(interop_handle)>::value>
ext_codeplay_enqueue_native_command([[maybe_unused]] FuncT &&Func) {
#ifndef __SYCL_DEVICE_ONLY__
ext_codeplay_enqueue_native_command_impl(Func);
ext_codeplay_enqueue_native_command_impl(std::forward<FuncT>(Func));
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions sycl/source/handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2045,13 +2045,13 @@ void *handler::storeRawArg(const void *Ptr, size_t Size) {
return Storage;
}

void handler::SetHostTask(std::function<void()> &&Func) {
void handler::SetHostTask(std::function<void()> Func) {
setNDRangeDescriptor(range<1>(1));
impl->MHostTask.reset(new detail::HostTask(std::move(Func)));
setType(detail::CGType::CodeplayHostTask);
}

void handler::SetHostTask(std::function<void(interop_handle)> &&Func) {
void handler::SetHostTask(std::function<void(interop_handle)> Func) {
setNDRangeDescriptor(range<1>(1));
impl->MHostTask.reset(new detail::HostTask(std::move(Func)));
setType(detail::CGType::CodeplayHostTask);
Expand Down
4 changes: 2 additions & 2 deletions sycl/test/abi/sycl_symbols_linux.dump
Original file line number Diff line number Diff line change
Expand Up @@ -3544,8 +3544,8 @@ _ZN4sycl3_V17handler10depends_onERKSt6vectorINS0_5eventESaIS3_EE
_ZN4sycl3_V17handler10depends_onERKSt6vectorISt10shared_ptrINS0_6detail10event_implEESaIS6_EE
_ZN4sycl3_V17handler10mem_adviseEPKvmi
_ZN4sycl3_V17handler10processArgEPvRKNS0_6detail19kernel_param_kind_tEimRmbb
_ZN4sycl3_V17handler11SetHostTaskEOSt8functionIFvNS0_14interop_handleEEE
_ZN4sycl3_V17handler11SetHostTaskEOSt8functionIFvvEE
_ZN4sycl3_V17handler11SetHostTaskESt8functionIFvNS0_14interop_handleEEE
_ZN4sycl3_V17handler11SetHostTaskESt8functionIFvvEE
_ZN4sycl3_V17handler11copyCodeLocERKS1_
_ZN4sycl3_V17handler11saveCodeLocENS0_6detail13code_locationE
_ZN4sycl3_V17handler11saveCodeLocENS0_6detail13code_locationEb
Expand Down
4 changes: 2 additions & 2 deletions sycl/test/abi/sycl_symbols_windows.dump
Original file line number Diff line number Diff line change
Expand Up @@ -730,8 +730,8 @@
?SecondaryQueue@SubmissionInfo@detail@_V1@sycl@@QEBAAEBV?$shared_ptr@Vqueue_impl@detail@_V1@sycl@@@std@@XZ
?SecondaryQueue@SubmissionInfo@v1@detail@_V1@sycl@@QEAAAEAV?$shared_ptr@Vqueue_impl@detail@_V1@sycl@@@std@@XZ
?SecondaryQueue@SubmissionInfo@v1@detail@_V1@sycl@@QEBAAEBV?$shared_ptr@Vqueue_impl@detail@_V1@sycl@@@std@@XZ
?SetHostTask@handler@_V1@sycl@@AEAAX$$QEAV?$function@$$A6AXVinterop_handle@_V1@sycl@@@Z@std@@@Z
?SetHostTask@handler@_V1@sycl@@AEAAX$$QEAV?$function@$$A6AXXZ@std@@@Z
?SetHostTask@handler@_V1@sycl@@AEAAXV?$function@$$A6AXVinterop_handle@_V1@sycl@@@Z@std@@@Z
?SetHostTask@handler@_V1@sycl@@AEAAXV?$function@$$A6AXXZ@std@@@Z
?SetKernelLaunchpropertiesIfNotEmpty@handler@_V1@sycl@@AEAAXAEBU?$PropsHolder@Uwork_group_scratch_size@experimental@oneapi@ext@_V1@sycl@@Ucache_config@2intel@456@Uuse_root_sync_key@23456@Uwork_group_progress_key@23456@Usub_group_progress_key@23456@Uwork_item_progress_key@23456@U?$cluster_size@$00@cuda@23456@U?$cluster_size@$01@cuda@23456@U?$cluster_size@$02@cuda@23456@@kernel_launch_properties_v1@detail@23@@Z
?__abs_diff_impl@_V1@sycl@@YA?AV?$vec@C$00@12@V312@0@Z
?__abs_diff_impl@_V1@sycl@@YA?AV?$vec@C$01@12@V312@0@Z
Expand Down