Skip to content

Commit e7f8cfe

Browse files
ayylolKornevNikita
authored andcommitted
[SYCL] Fix move instead of copy Coverity hits (#17982)
Move instead of copy Coverity hit fixes for `sycl/source/detail/queue_impl.hpp` and `sycl/source/detail/scheduler/commands.cpp`
1 parent b819be5 commit e7f8cfe

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

sycl/source/detail/queue_impl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -850,12 +850,12 @@ class queue_impl {
850850
auto EventRet = Handler.finalize();
851851
EventImplPtr EventRetImpl = getSyclObjImpl(EventRet);
852852
if (Type == CGType::CodeplayHostTask)
853-
Deps.UnenqueuedCmdEvents.push_back(EventRetImpl);
853+
Deps.UnenqueuedCmdEvents.push_back(std::move(EventRetImpl));
854854
else if (Type == CGType::Barrier || Type == CGType::BarrierWaitlist) {
855-
Deps.LastBarrier = EventRetImpl;
855+
Deps.LastBarrier = std::move(EventRetImpl);
856856
Deps.UnenqueuedCmdEvents.clear();
857857
} else if (!EventRetImpl->isEnqueued()) {
858-
Deps.UnenqueuedCmdEvents.push_back(EventRetImpl);
858+
Deps.UnenqueuedCmdEvents.push_back(std::move(EventRetImpl));
859859
}
860860

861861
return EventRet;

sycl/source/detail/scheduler/commands.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3085,14 +3085,15 @@ ur_result_t ExecCGCommand::enqueueImpCommandBuffer() {
30853085
"Can't get memory object due to no allocation available " +
30863086
codeToString(UR_RESULT_ERROR_INVALID_MEM_OBJECT));
30873087
};
3088-
std::for_each(std::begin(HandlerReq), std::end(HandlerReq), ReqToMemConv);
3088+
std::for_each(std::begin(HandlerReq), std::end(HandlerReq),
3089+
std::move(ReqToMemConv));
30893090

30903091
ur_exp_command_buffer_handle_t InteropCommandBuffer =
30913092
ChildCommandBuffer ? ChildCommandBuffer : MCommandBuffer;
3092-
interop_handle IH{ReqToMem, MQueue, DeviceImpl, ContextImpl,
3093+
interop_handle IH{std::move(ReqToMem), MQueue, DeviceImpl, ContextImpl,
30933094
InteropCommandBuffer};
30943095
CommandBufferNativeCommandData CustomOpData{
3095-
IH, HostTask->MHostTask->MInteropTask};
3096+
std::move(IH), HostTask->MHostTask->MInteropTask};
30963097

30973098
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
30983099
// CMPLRLLVM-66082
@@ -3423,7 +3424,8 @@ ur_result_t ExecCGCommand::enqueueImpQueue() {
34233424
"Can't get memory object due to no allocation available " +
34243425
codeToString(UR_RESULT_ERROR_INVALID_MEM_OBJECT));
34253426
};
3426-
std::for_each(std::begin(HandlerReq), std::end(HandlerReq), ReqToMemConv);
3427+
std::for_each(std::begin(HandlerReq), std::end(HandlerReq),
3428+
std::move(ReqToMemConv));
34273429
std::sort(std::begin(ReqToMem), std::end(ReqToMem));
34283430
}
34293431

@@ -3488,12 +3490,13 @@ ur_result_t ExecCGCommand::enqueueImpQueue() {
34883490
"Can't get memory object due to no allocation available " +
34893491
codeToString(UR_RESULT_ERROR_INVALID_MEM_OBJECT));
34903492
};
3491-
std::for_each(std::begin(HandlerReq), std::end(HandlerReq), ReqToMemConv);
3493+
std::for_each(std::begin(HandlerReq), std::end(HandlerReq),
3494+
std::move(ReqToMemConv));
34923495
std::sort(std::begin(ReqToMem), std::end(ReqToMem));
34933496
}
34943497

34953498
EnqueueNativeCommandData CustomOpData{
3496-
interop_handle{ReqToMem, HostTask->MQueue,
3499+
interop_handle{std::move(ReqToMem), HostTask->MQueue,
34973500
HostTask->MQueue->getDeviceImplPtr(),
34983501
HostTask->MQueue->getContextImplPtr()},
34993502
HostTask->MHostTask->MInteropTask};

0 commit comments

Comments
 (0)