@@ -233,7 +233,7 @@ ProgramManager::createURProgram(const RTDeviceBinaryImage &Img,
233
233
const auto &ProgMetadata = Img.getProgramMetadataUR ();
234
234
235
235
// Load the image
236
- const ContextImplPtr Ctx = getSyclObjImpl (Context);
236
+ const ContextImplPtr & Ctx = getSyclObjImpl (Context);
237
237
std::vector<const uint8_t *> Binaries (
238
238
Devices.size (), const_cast <uint8_t *>(RawImg.BinaryStart ));
239
239
std::vector<size_t > Lengths (Devices.size (), ImgSize);
@@ -2673,7 +2673,8 @@ void ProgramManager::bringSYCLDeviceImagesToState(
2673
2673
2674
2674
for (DevImgPlainWithDeps &ImgWithDeps : DeviceImages) {
2675
2675
device_image_plain &MainImg = ImgWithDeps.getMain ();
2676
- const bundle_state DevImageState = getSyclObjImpl (MainImg)->get_state ();
2676
+ const DeviceImageImplPtr &MainImgImpl = getSyclObjImpl (MainImg);
2677
+ const bundle_state DevImageState = MainImgImpl->get_state ();
2677
2678
// At this time, there is no circumstance where a device image should ever
2678
2679
// be in the source state. That not good.
2679
2680
assert (DevImageState != bundle_state::ext_oneapi_source);
@@ -2689,9 +2690,8 @@ void ProgramManager::bringSYCLDeviceImagesToState(
2689
2690
break ;
2690
2691
case bundle_state::object:
2691
2692
if (DevImageState == bundle_state::input) {
2692
- ImgWithDeps =
2693
- compile (ImgWithDeps, getSyclObjImpl (MainImg)->get_devices (),
2694
- /* PropList=*/ {});
2693
+ ImgWithDeps = compile (ImgWithDeps, MainImgImpl->get_devices (),
2694
+ /* PropList=*/ {});
2695
2695
break ;
2696
2696
}
2697
2697
// Device image is expected to be object state then.
@@ -2705,7 +2705,7 @@ void ProgramManager::bringSYCLDeviceImagesToState(
2705
2705
assert (DevImageState != bundle_state::ext_oneapi_source);
2706
2706
break ;
2707
2707
case bundle_state::input:
2708
- ImgWithDeps = build (ImgWithDeps, getSyclObjImpl (MainImg) ->get_devices (),
2708
+ ImgWithDeps = build (ImgWithDeps, MainImgImpl ->get_devices (),
2709
2709
/* PropList=*/ {});
2710
2710
break ;
2711
2711
case bundle_state::object: {
@@ -2719,7 +2719,7 @@ void ProgramManager::bringSYCLDeviceImagesToState(
2719
2719
break ;
2720
2720
}
2721
2721
case bundle_state::executable:
2722
- ImgWithDeps = build (ImgWithDeps, getSyclObjImpl (MainImg) ->get_devices (),
2722
+ ImgWithDeps = build (ImgWithDeps, MainImgImpl ->get_devices (),
2723
2723
/* PropList=*/ {});
2724
2724
break ;
2725
2725
}
@@ -2861,7 +2861,8 @@ static void mergeImageData(const std::vector<device_image_plain> &Imgs,
2861
2861
std::vector<unsigned char > &NewSpecConstBlob,
2862
2862
device_image_impl::SpecConstMapT &NewSpecConstMap) {
2863
2863
for (const device_image_plain &Img : Imgs) {
2864
- std::shared_ptr<device_image_impl> DeviceImageImpl = getSyclObjImpl (Img);
2864
+ const std::shared_ptr<device_image_impl> &DeviceImageImpl =
2865
+ getSyclObjImpl (Img);
2865
2866
// Duplicates are not expected here, otherwise urProgramLink should fail
2866
2867
KernelIDs.insert (KernelIDs.end (),
2867
2868
DeviceImageImpl->get_kernel_ids_ptr ()->begin (),
@@ -2922,16 +2923,15 @@ ProgramManager::link(const DevImgPlainWithDeps &ImgWithDeps,
2922
2923
std::string LinkOptionsStr;
2923
2924
applyLinkOptionsFromEnvironment (LinkOptionsStr);
2924
2925
const device_image_plain &MainImg = ImgWithDeps.getMain ();
2926
+ const std::shared_ptr<device_image_impl> &InputImpl = getSyclObjImpl (MainImg);
2925
2927
if (LinkOptionsStr.empty ()) {
2926
- const std::shared_ptr<device_image_impl> &InputImpl =
2927
- getSyclObjImpl (MainImg);
2928
2928
appendLinkOptionsFromImage (LinkOptionsStr,
2929
2929
*(InputImpl->get_bin_image_ref ()));
2930
2930
}
2931
2931
// Should always come last!
2932
2932
appendLinkEnvironmentVariablesThatAppend (LinkOptionsStr);
2933
- const context &Context = getSyclObjImpl (MainImg) ->get_context ();
2934
- const ContextImplPtr ContextImpl = getSyclObjImpl (Context);
2933
+ const context &Context = InputImpl ->get_context ();
2934
+ const ContextImplPtr & ContextImpl = getSyclObjImpl (Context);
2935
2935
const AdapterPtr &Adapter = ContextImpl->getAdapter ();
2936
2936
2937
2937
ur_program_handle_t LinkedProg = nullptr ;
@@ -2957,8 +2957,7 @@ ProgramManager::link(const DevImgPlainWithDeps &ImgWithDeps,
2957
2957
2958
2958
if (Error != UR_RESULT_SUCCESS) {
2959
2959
if (LinkedProg) {
2960
- const std::string ErrorMsg =
2961
- getProgramBuildLog (LinkedProg, std::move (ContextImpl));
2960
+ const std::string ErrorMsg = getProgramBuildLog (LinkedProg, ContextImpl);
2962
2961
throw sycl::exception (make_error_code (errc::build), ErrorMsg);
2963
2962
}
2964
2963
throw set_ur_error (exception (make_error_code (errc::build), " link() failed" ),
@@ -2984,7 +2983,7 @@ ProgramManager::link(const DevImgPlainWithDeps &ImgWithDeps,
2984
2983
}
2985
2984
}
2986
2985
2987
- auto BinImg = getSyclObjImpl (MainImg) ->get_bin_image_ref ();
2986
+ auto BinImg = InputImpl ->get_bin_image_ref ();
2988
2987
DeviceImageImplPtr ExecutableImpl =
2989
2988
std::make_shared<detail::device_image_impl>(
2990
2989
BinImg, Context, Devs, bundle_state::executable, std::move (KernelIDs),
@@ -3013,7 +3012,6 @@ ProgramManager::build(const DevImgPlainWithDeps &DevImgWithDeps,
3013
3012
getSyclObjImpl (DevImgWithDeps.getMain ());
3014
3013
3015
3014
const context Context = MainInputImpl->get_context ();
3016
- const ContextImplPtr ContextImpl = getSyclObjImpl (Context);
3017
3015
3018
3016
std::vector<const RTDeviceBinaryImage *> BinImgs;
3019
3017
BinImgs.reserve (DevImgWithDeps.size ());
@@ -3065,7 +3063,7 @@ ProgramManager::getOrCreateKernel(const context &Context,
3065
3063
PropList, NoAllowedPropertiesCheck, NoAllowedPropertiesCheck);
3066
3064
}
3067
3065
3068
- const ContextImplPtr Ctx = getSyclObjImpl (Context);
3066
+ const ContextImplPtr & Ctx = getSyclObjImpl (Context);
3069
3067
3070
3068
KernelProgramCache &Cache = Ctx->getKernelProgramCache ();
3071
3069
0 commit comments