@@ -570,7 +570,7 @@ class device_image_impl
570
570
ur_mem_handle_t &get_spec_const_buffer_ref () noexcept {
571
571
std::lock_guard<std::mutex> Lock{MSpecConstAccessMtx};
572
572
if (nullptr == MSpecConstsBuffer && !MSpecConstsBlob.empty ()) {
573
- const AdapterPtr &Adapter = getSyclObjImpl (MContext)->getAdapter ();
573
+ adapter_impl &Adapter = getSyclObjImpl (MContext)->getAdapter ();
574
574
// Uses UR_MEM_FLAGS_HOST_PTR_COPY instead of UR_MEM_FLAGS_HOST_PTR_USE
575
575
// since post-enqueue cleanup might trigger destruction of
576
576
// device_image_impl and, as a result, destruction of MSpecConstsBlob
@@ -602,11 +602,10 @@ class device_image_impl
602
602
ur_native_handle_t getNative () const {
603
603
assert (MProgram);
604
604
context_impl &ContextImpl = *detail::getSyclObjImpl (MContext);
605
- const AdapterPtr &Adapter = ContextImpl.getAdapter ();
605
+ adapter_impl &Adapter = ContextImpl.getAdapter ();
606
606
607
607
ur_native_handle_t NativeProgram = 0 ;
608
- Adapter->call <UrApiKind::urProgramGetNativeHandle>(MProgram,
609
- &NativeProgram);
608
+ Adapter.call <UrApiKind::urProgramGetNativeHandle>(MProgram, &NativeProgram);
610
609
if (ContextImpl.getBackend () == backend::opencl)
611
610
__SYCL_OCL_CALL (clRetainProgram, ur::cast<cl_program>(NativeProgram));
612
611
@@ -616,12 +615,12 @@ class device_image_impl
616
615
~device_image_impl () {
617
616
try {
618
617
if (MProgram) {
619
- const AdapterPtr &Adapter = getSyclObjImpl (MContext)->getAdapter ();
620
- Adapter-> call <UrApiKind::urProgramRelease>(MProgram);
618
+ adapter_impl &Adapter = getSyclObjImpl (MContext)->getAdapter ();
619
+ Adapter. call <UrApiKind::urProgramRelease>(MProgram);
621
620
}
622
621
if (MSpecConstsBuffer) {
623
622
std::lock_guard<std::mutex> Lock{MSpecConstAccessMtx};
624
- const AdapterPtr &Adapter = getSyclObjImpl (MContext)->getAdapter ();
623
+ adapter_impl &Adapter = getSyclObjImpl (MContext)->getAdapter ();
625
624
memReleaseHelper (Adapter, MSpecConstsBuffer);
626
625
}
627
626
} catch (std::exception &e) {
@@ -751,23 +750,23 @@ class device_image_impl
751
750
Devices, BuildOptions, *SourceStrPtr, UrProgram);
752
751
}
753
752
754
- const AdapterPtr &Adapter = ContextImpl.getAdapter ();
753
+ adapter_impl &Adapter = ContextImpl.getAdapter ();
755
754
756
755
if (!FetchedFromCache)
757
756
UrProgram = createProgramFromSource (Devices, BuildOptions, LogPtr);
758
757
759
758
std::string XsFlags = extractXsFlags (BuildOptions, MRTCBinInfo->MLanguage );
760
- auto Res = Adapter-> call_nocheck <UrApiKind::urProgramBuildExp>(
759
+ auto Res = Adapter. call_nocheck <UrApiKind::urProgramBuildExp>(
761
760
UrProgram, DeviceVec.size (), DeviceVec.data (), XsFlags.c_str ());
762
761
if (Res == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
763
- Res = Adapter-> call_nocheck <UrApiKind::urProgramBuild>(
762
+ Res = Adapter. call_nocheck <UrApiKind::urProgramBuild>(
764
763
ContextImpl.getHandleRef (), UrProgram, XsFlags.c_str ());
765
764
}
766
- Adapter-> checkUrResult <errc::build>(Res);
765
+ Adapter. checkUrResult <errc::build>(Res);
767
766
768
767
// Get the number of kernels in the program.
769
768
size_t NumKernels;
770
- Adapter-> call <UrApiKind::urProgramGetInfo>(
769
+ Adapter. call <UrApiKind::urProgramGetInfo>(
771
770
UrProgram, UR_PROGRAM_INFO_NUM_KERNELS, sizeof (size_t ), &NumKernels,
772
771
nullptr );
773
772
@@ -882,7 +881,7 @@ class device_image_impl
882
881
const std::vector<sycl::detail::string_view> &BuildOptions,
883
882
const std::string &SourceStr, ur_program_handle_t &UrProgram) const {
884
883
sycl::detail::context_impl &ContextImpl = *getSyclObjImpl (MContext);
885
- const AdapterPtr &Adapter = ContextImpl.getAdapter ();
884
+ adapter_impl &Adapter = ContextImpl.getAdapter ();
886
885
887
886
std::string UserArgs = syclex::detail::userArgsAsString (BuildOptions);
888
887
@@ -910,7 +909,7 @@ class device_image_impl
910
909
Properties.count = 0 ;
911
910
Properties.pMetadatas = nullptr ;
912
911
913
- Adapter-> call <UrApiKind::urProgramCreateWithBinary>(
912
+ Adapter. call <UrApiKind::urProgramCreateWithBinary>(
914
913
ContextImpl.getHandleRef (), DeviceHandles.size (), DeviceHandles.data (),
915
914
Lengths.data (), Binaries.data (), &Properties, &UrProgram);
916
915
@@ -1205,7 +1204,7 @@ class device_image_impl
1205
1204
const std::vector<sycl::detail::string_view> &Options,
1206
1205
std::string *LogPtr) const {
1207
1206
sycl::detail::context_impl &ContextImpl = *getSyclObjImpl (MContext);
1208
- const AdapterPtr &Adapter = ContextImpl.getAdapter ();
1207
+ adapter_impl &Adapter = ContextImpl.getAdapter ();
1209
1208
const auto spirv = [&]() -> std::vector<uint8_t > {
1210
1209
switch (MRTCBinInfo->MLanguage ) {
1211
1210
case syclex::source_language::opencl: {
@@ -1216,7 +1215,7 @@ class device_image_impl
1216
1215
std::transform (Devices.begin (), Devices.end (), IPVersionVec.begin (),
1217
1216
[&](const sycl::device &SyclDev) {
1218
1217
uint32_t ipVersion = 0 ;
1219
- Adapter-> call <UrApiKind::urDeviceGetInfo>(
1218
+ Adapter. call <UrApiKind::urDeviceGetInfo>(
1220
1219
getSyclObjImpl (SyclDev)->getHandleRef (),
1221
1220
UR_DEVICE_INFO_IP_VERSION, sizeof (uint32_t ),
1222
1221
&ipVersion, nullptr );
@@ -1242,9 +1241,9 @@ class device_image_impl
1242
1241
}();
1243
1242
1244
1243
ur_program_handle_t UrProgram = nullptr ;
1245
- Adapter-> call <UrApiKind::urProgramCreateWithIL>(ContextImpl.getHandleRef (),
1246
- spirv.data (), spirv.size (),
1247
- nullptr , &UrProgram);
1244
+ Adapter. call <UrApiKind::urProgramCreateWithIL>(ContextImpl.getHandleRef (),
1245
+ spirv.data (), spirv.size (),
1246
+ nullptr , &UrProgram);
1248
1247
// program created by urProgramCreateWithIL is implicitly retained.
1249
1248
if (UrProgram == nullptr )
1250
1249
throw sycl::exception (
@@ -1255,16 +1254,16 @@ class device_image_impl
1255
1254
}
1256
1255
1257
1256
static std::vector<std::string>
1258
- getKernelNamesFromURProgram (const AdapterPtr &Adapter,
1257
+ getKernelNamesFromURProgram (adapter_impl &Adapter,
1259
1258
ur_program_handle_t UrProgram) {
1260
1259
// Get the kernel names.
1261
1260
size_t KernelNamesSize;
1262
- Adapter-> call <UrApiKind::urProgramGetInfo>(
1261
+ Adapter. call <UrApiKind::urProgramGetInfo>(
1263
1262
UrProgram, UR_PROGRAM_INFO_KERNEL_NAMES, 0 , nullptr , &KernelNamesSize);
1264
1263
1265
1264
// semi-colon delimited list of kernel names.
1266
1265
std::string KernelNamesStr (KernelNamesSize, ' ' );
1267
- Adapter-> call <UrApiKind::urProgramGetInfo>(
1266
+ Adapter. call <UrApiKind::urProgramGetInfo>(
1268
1267
UrProgram, UR_PROGRAM_INFO_KERNEL_NAMES, KernelNamesStr.size (),
1269
1268
&KernelNamesStr[0 ], nullptr );
1270
1269
return detail::split_string (KernelNamesStr, ' ;' );
0 commit comments