Skip to content

Commit c15763f

Browse files
[SYCL] Avoid copying of NormalizedKernelFunc temporary (#11368)
Coverity analysis of [IntelPython/dpctl.git](https://github.com/IntelPython/dpctl) SYCL-based projects shows 6721 hits of COPY_INSTEAD_OF_MOVE type issues in ResetHostKernelHelper with the suggestion to use std::move(NormalizedKernelFunc) instead. ![image](https://github.com/intel/llvm/assets/21087696/aa8d7c21-05f7-4c11-82ba-27c2bd32d38e) This PR applies that suggestion.
1 parent 54bb098 commit c15763f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sycl/include/sycl/handler.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -729,9 +729,9 @@ class __SYCL_EXPORT handler {
729729
NormalizedKernelType NormalizedKernel(KernelFunc);
730730
auto NormalizedKernelFunc =
731731
std::function<void(const sycl::nd_item<Dims> &)>(NormalizedKernel);
732-
auto HostKernelPtr =
733-
new detail::HostKernel<decltype(NormalizedKernelFunc),
734-
sycl::nd_item<Dims>, Dims>(NormalizedKernelFunc);
732+
auto HostKernelPtr = new detail::HostKernel<decltype(NormalizedKernelFunc),
733+
sycl::nd_item<Dims>, Dims>(
734+
std::move(NormalizedKernelFunc));
735735
MHostKernel.reset(HostKernelPtr);
736736
return &HostKernelPtr->MKernel.template target<NormalizedKernelType>()
737737
->MKernelFunc;

0 commit comments

Comments
 (0)