Skip to content

Commit b9cdbc0

Browse files
[SYCL] Fix Coverity hits (#16491)
All hits are related to using `std::move` instead of variable copy. Fixes: CMPLRLLVM-64297, CMPLRLLVM-64456 and CMPLRLLVM-64457
1 parent d5b969d commit b9cdbc0

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

sycl/include/sycl/queue.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2859,7 +2859,7 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
28592859
}
28602860
};
28612861
#endif // __SYCL_USE_FALLBACK_ASSERT
2862-
return submit_with_event_impl(CGF, SI, TlsCodeLocCapture.query(),
2862+
return submit_with_event_impl(std::move(CGF), SI, TlsCodeLocCapture.query(),
28632863
TlsCodeLocCapture.isToplevel());
28642864
}
28652865

sycl/source/detail/graph_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1765,7 +1765,7 @@ void modifiable_command_graph::print_graph(sycl::detail::string_view pathstr,
17651765
std::string path{pathstr.data()};
17661766
graph_impl::ReadLock Lock(impl->MMutex);
17671767
if (path.substr(path.find_last_of(".") + 1) == "dot") {
1768-
impl->printGraphAsDot(path, verbose);
1768+
impl->printGraphAsDot(std::move(path), verbose);
17691769
} else {
17701770
throw sycl::exception(
17711771
sycl::make_error_code(errc::invalid),

sycl/source/detail/memory_manager.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,8 @@ getOrBuildProgramForDeviceGlobal(QueueImplPtr Queue,
12271227
PM.getDeviceImage(DeviceGlobalEntry->MImages, Context, Device);
12281228
device_image_plain DeviceImage =
12291229
PM.getDeviceImageFromBinaryImage(&Img, Context, Device);
1230-
device_image_plain BuiltImage = PM.build(DeviceImage, {Device}, {});
1230+
device_image_plain BuiltImage =
1231+
PM.build(std::move(DeviceImage), {Device}, {});
12311232
return getSyclObjImpl(BuiltImage)->get_ur_program_ref();
12321233
}
12331234

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2723,7 +2723,8 @@ ProgramManager::link(const DevImgPlainWithDeps &ImgWithDeps,
27232723

27242724
if (Error != UR_RESULT_SUCCESS) {
27252725
if (LinkedProg) {
2726-
const std::string ErrorMsg = getProgramBuildLog(LinkedProg, ContextImpl);
2726+
const std::string ErrorMsg =
2727+
getProgramBuildLog(LinkedProg, std::move(ContextImpl));
27272728
throw sycl::exception(make_error_code(errc::build), ErrorMsg);
27282729
}
27292730
throw set_ur_error(exception(make_error_code(errc::build), "link() failed"),
@@ -2751,7 +2752,7 @@ ProgramManager::link(const DevImgPlainWithDeps &ImgWithDeps,
27512752

27522753
// TODO: Make multiple sets of device images organized by devices they are
27532754
// compiled for.
2754-
return {createSyclObjFromImpl<device_image_plain>(ExecutableImpl)};
2755+
return {createSyclObjFromImpl<device_image_plain>(std::move(ExecutableImpl))};
27552756
}
27562757

27572758
// The function duplicates most of the code from existing getBuiltPIProgram.

sycl/source/detail/scheduler/commands.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,8 +2849,8 @@ ur_result_t enqueueReadWriteHostPipe(const QueueImplPtr &Queue,
28492849
ProgramManager::getInstance().getDeviceImageFromBinaryImage(
28502850
hostPipeEntry->getDevBinImage(), Queue->get_context(),
28512851
Queue->get_device());
2852-
device_image_plain BuiltImage =
2853-
ProgramManager::getInstance().build(devImgPlain, {Device}, {});
2852+
device_image_plain BuiltImage = ProgramManager::getInstance().build(
2853+
std::move(devImgPlain), {std::move(Device)}, {});
28542854
Program = getSyclObjImpl(BuiltImage)->get_ur_program_ref();
28552855
}
28562856
assert(Program && "Program for this hostpipe is not compiled.");

0 commit comments

Comments
 (0)