Skip to content

Commit a1355e8

Browse files
[SYCL] Fix Coverity issues after #16228 (#16313)
All of these Coverity issues are related to using `std::move()` instead of variable copy.
1 parent 2f63969 commit a1355e8

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

sycl/source/detail/kernel_bundle_impl.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class kernel_bundle_impl {
164164
detail::ProgramManager::getInstance().build(DevImgWithDeps,
165165
MDevices, PropList);
166166
MDeviceImages.emplace_back(BuiltImg);
167-
MUniqueDeviceImages.push_back(BuiltImg);
167+
MUniqueDeviceImages.emplace_back(BuiltImg);
168168
break;
169169
}
170170
case bundle_state::input:

sycl/source/detail/program_manager/program_manager.cpp

+9-7
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ ur_program_handle_t ProgramManager::getBuiltURProgram(
822822
std::copy(DeviceImagesToLink.begin(), DeviceImagesToLink.end(),
823823
std::back_inserter(AllImages));
824824

825-
return getBuiltURProgram(AllImages, Context, {Device});
825+
return getBuiltURProgram(std::move(AllImages), Context, {Device});
826826
}
827827

828828
ur_program_handle_t ProgramManager::getBuiltURProgram(
@@ -2400,7 +2400,8 @@ ProgramManager::getSYCLDeviceImagesWithCompatibleState(
24002400
std::vector<device_image_plain> Images;
24012401
const std::set<RTDeviceBinaryImage *> &Deps = ImgInfoPair.second.Deps;
24022402
Images.reserve(Deps.size() + 1);
2403-
Images.push_back(createSyclObjFromImpl<device_image_plain>(MainImpl));
2403+
Images.push_back(
2404+
createSyclObjFromImpl<device_image_plain>(std::move(MainImpl)));
24042405
for (RTDeviceBinaryImage *Dep : Deps) {
24052406
std::shared_ptr<std::vector<sycl::kernel_id>> DepKernelIDs;
24062407
{
@@ -2414,7 +2415,8 @@ ProgramManager::getSYCLDeviceImagesWithCompatibleState(
24142415
Dep, Ctx, Devs, ImgInfoPair.second.State, DepKernelIDs,
24152416
/*PIProgram=*/nullptr);
24162417

2417-
Images.push_back(createSyclObjFromImpl<device_image_plain>(DepImpl));
2418+
Images.push_back(
2419+
createSyclObjFromImpl<device_image_plain>(std::move(DepImpl)));
24182420
}
24192421
SYCLDeviceImages.push_back(std::move(Images));
24202422
}
@@ -2600,7 +2602,7 @@ ProgramManager::compile(const DevImgPlainWithDeps &ImgWithDeps,
26002602
getSyclObjImpl(ObjectImpl->get_context())));
26012603

26022604
CompiledImages.push_back(
2603-
createSyclObjFromImpl<device_image_plain>(ObjectImpl));
2605+
createSyclObjFromImpl<device_image_plain>(std::move(ObjectImpl)));
26042606
}
26052607
return CompiledImages;
26062608
}
@@ -2775,14 +2777,14 @@ ProgramManager::build(const DevImgPlainWithDeps &DevImgWithDeps,
27752777
SpecConstMap = MainInputImpl->get_spec_const_data_ref();
27762778
}
27772779

2778-
ur_program_handle_t ResProgram =
2779-
getBuiltURProgram(BinImgs, Context, Devs, &DevImgWithDeps, SpecConstBlob);
2780+
ur_program_handle_t ResProgram = getBuiltURProgram(
2781+
std::move(BinImgs), Context, Devs, &DevImgWithDeps, SpecConstBlob);
27802782

27812783
DeviceImageImplPtr ExecImpl = std::make_shared<detail::device_image_impl>(
27822784
MainInputImpl->get_bin_image_ref(), Context, Devs,
27832785
bundle_state::executable, std::move(KernelIDs), ResProgram,
27842786
std::move(SpecConstMap), std::move(SpecConstBlob));
2785-
return createSyclObjFromImpl<device_image_plain>(ExecImpl);
2787+
return createSyclObjFromImpl<device_image_plain>(std::move(ExecImpl));
27862788
}
27872789

27882790
// When caching is enabled, the returned UrKernel will already have

0 commit comments

Comments
 (0)