Skip to content

Commit ac9a1bc

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

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(
@@ -2419,7 +2419,8 @@ ProgramManager::getSYCLDeviceImagesWithCompatibleState(
24192419
std::vector<device_image_plain> Images;
24202420
const std::set<RTDeviceBinaryImage *> &Deps = ImgInfoPair.second.Deps;
24212421
Images.reserve(Deps.size() + 1);
2422-
Images.push_back(createSyclObjFromImpl<device_image_plain>(MainImpl));
2422+
Images.push_back(
2423+
createSyclObjFromImpl<device_image_plain>(std::move(MainImpl)));
24232424
for (RTDeviceBinaryImage *Dep : Deps) {
24242425
std::shared_ptr<std::vector<sycl::kernel_id>> DepKernelIDs;
24252426
{
@@ -2433,7 +2434,8 @@ ProgramManager::getSYCLDeviceImagesWithCompatibleState(
24332434
Dep, Ctx, Devs, ImgInfoPair.second.State, DepKernelIDs,
24342435
/*PIProgram=*/nullptr);
24352436

2436-
Images.push_back(createSyclObjFromImpl<device_image_plain>(DepImpl));
2437+
Images.push_back(
2438+
createSyclObjFromImpl<device_image_plain>(std::move(DepImpl)));
24372439
}
24382440
SYCLDeviceImages.push_back(std::move(Images));
24392441
}
@@ -2619,7 +2621,7 @@ ProgramManager::compile(const DevImgPlainWithDeps &ImgWithDeps,
26192621
getSyclObjImpl(ObjectImpl->get_context())));
26202622

26212623
CompiledImages.push_back(
2622-
createSyclObjFromImpl<device_image_plain>(ObjectImpl));
2624+
createSyclObjFromImpl<device_image_plain>(std::move(ObjectImpl)));
26232625
}
26242626
return CompiledImages;
26252627
}
@@ -2794,14 +2796,14 @@ ProgramManager::build(const DevImgPlainWithDeps &DevImgWithDeps,
27942796
SpecConstMap = MainInputImpl->get_spec_const_data_ref();
27952797
}
27962798

2797-
ur_program_handle_t ResProgram =
2798-
getBuiltURProgram(BinImgs, Context, Devs, &DevImgWithDeps, SpecConstBlob);
2799+
ur_program_handle_t ResProgram = getBuiltURProgram(
2800+
std::move(BinImgs), Context, Devs, &DevImgWithDeps, SpecConstBlob);
27992801

28002802
DeviceImageImplPtr ExecImpl = std::make_shared<detail::device_image_impl>(
28012803
MainInputImpl->get_bin_image_ref(), Context, Devs,
28022804
bundle_state::executable, std::move(KernelIDs), ResProgram,
28032805
std::move(SpecConstMap), std::move(SpecConstBlob));
2804-
return createSyclObjFromImpl<device_image_plain>(ExecImpl);
2806+
return createSyclObjFromImpl<device_image_plain>(std::move(ExecImpl));
28052807
}
28062808

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

0 commit comments

Comments
 (0)