@@ -172,15 +172,15 @@ __SYCL_EXPORT event make_event(ur_native_handle_t NativeHandle,
172
172
const context &Context, bool KeepOwnership,
173
173
backend Backend) {
174
174
const adapter_impl &Adapter = getAdapter (Backend);
175
- const auto &ContextImpl = getSyclObjImpl (Context);
175
+ context_impl &ContextImpl = * getSyclObjImpl (Context);
176
176
177
177
ur_event_handle_t UrEvent = nullptr ;
178
178
ur_event_native_properties_t Properties{};
179
179
Properties.stype = UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES;
180
180
Properties.isNativeHandleOwned = !KeepOwnership;
181
181
182
182
Adapter.call <UrApiKind::urEventCreateWithNativeHandle>(
183
- NativeHandle, ContextImpl-> getHandleRef (), &Properties, &UrEvent);
183
+ NativeHandle, ContextImpl. getHandleRef (), &Properties, &UrEvent);
184
184
event Event = detail::createSyclObjFromImpl<event>(
185
185
event_impl::create_from_handle (UrEvent, Context));
186
186
@@ -194,21 +194,21 @@ make_kernel_bundle(ur_native_handle_t NativeHandle,
194
194
const context &TargetContext, bool KeepOwnership,
195
195
bundle_state State, backend Backend) {
196
196
const adapter_impl &Adapter = getAdapter (Backend);
197
- const auto &ContextImpl = getSyclObjImpl (TargetContext);
197
+ context_impl &ContextImpl = * getSyclObjImpl (TargetContext);
198
198
199
199
ur_program_handle_t UrProgram = nullptr ;
200
200
ur_program_native_properties_t Properties{};
201
201
Properties.stype = UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES;
202
202
Properties.isNativeHandleOwned = !KeepOwnership;
203
203
204
204
Adapter.call <UrApiKind::urProgramCreateWithNativeHandle>(
205
- NativeHandle, ContextImpl-> getHandleRef (), &Properties, &UrProgram);
205
+ NativeHandle, ContextImpl. getHandleRef (), &Properties, &UrProgram);
206
206
if (UrProgram == nullptr )
207
207
throw sycl::exception (
208
208
sycl::make_error_code (sycl::errc::invalid),
209
209
" urProgramCreateWithNativeHandle resulted in a null program handle." );
210
210
211
- if (ContextImpl-> getBackend () == backend::opencl)
211
+ if (ContextImpl. getBackend () == backend::opencl)
212
212
__SYCL_OCL_CALL (clRetainProgram, ur::cast<cl_program>(NativeHandle));
213
213
214
214
std::vector<ur_device_handle_t > ProgramDevices;
@@ -234,7 +234,7 @@ make_kernel_bundle(ur_native_handle_t NativeHandle,
234
234
UrProgram, 1 , &Dev, nullptr );
235
235
if (Res == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
236
236
Res = Adapter.call_nocheck <UrApiKind::urProgramCompile>(
237
- ContextImpl-> getHandleRef (), UrProgram, nullptr );
237
+ ContextImpl. getHandleRef (), UrProgram, nullptr );
238
238
}
239
239
Adapter.checkUrResult <errc::build>(Res);
240
240
}
@@ -244,7 +244,7 @@ make_kernel_bundle(ur_native_handle_t NativeHandle,
244
244
UrProgram, 1 , &Dev, nullptr );
245
245
if (Res == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
246
246
Res = Adapter.call_nocheck <UrApiKind::urProgramBuild>(
247
- ContextImpl-> getHandleRef (), UrProgram, nullptr );
247
+ ContextImpl. getHandleRef (), UrProgram, nullptr );
248
248
}
249
249
Adapter.checkUrResult <errc::build>(Res);
250
250
}
@@ -260,11 +260,11 @@ make_kernel_bundle(ur_native_handle_t NativeHandle,
260
260
if (State == bundle_state::executable) {
261
261
ur_program_handle_t UrLinkedProgram = nullptr ;
262
262
auto Res = Adapter.call_nocheck <UrApiKind::urProgramLinkExp>(
263
- ContextImpl-> getHandleRef (), 1 , &Dev, 1 , &UrProgram, nullptr ,
263
+ ContextImpl. getHandleRef (), 1 , &Dev, 1 , &UrProgram, nullptr ,
264
264
&UrLinkedProgram);
265
265
if (Res == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
266
266
Res = Adapter.call_nocheck <UrApiKind::urProgramLink>(
267
- ContextImpl-> getHandleRef (), 1 , &UrProgram, nullptr ,
267
+ ContextImpl. getHandleRef (), 1 , &UrProgram, nullptr ,
268
268
&UrLinkedProgram);
269
269
}
270
270
Adapter.checkUrResult <errc::build>(Res);
@@ -322,7 +322,7 @@ kernel make_kernel(const context &TargetContext,
322
322
ur_native_handle_t NativeHandle, bool KeepOwnership,
323
323
backend Backend) {
324
324
const auto &Adapter = getAdapter (Backend);
325
- const auto &ContextImpl = getSyclObjImpl (TargetContext);
325
+ context_impl &ContextImpl = * getSyclObjImpl (TargetContext);
326
326
kernel_bundle_impl &KernelBundleImpl = *getSyclObjImpl (KernelBundle);
327
327
328
328
// For Level-Zero expect exactly one device image in the bundle. This is
@@ -342,8 +342,8 @@ kernel make_kernel(const context &TargetContext,
342
342
343
343
const device_image<bundle_state::executable> &DeviceImage =
344
344
*KernelBundle.begin ();
345
- const auto &DeviceImageImpl = getSyclObjImpl (DeviceImage);
346
- UrProgram = DeviceImageImpl-> get_ur_program_ref ();
345
+ device_image_impl &DeviceImageImpl = * getSyclObjImpl (DeviceImage);
346
+ UrProgram = DeviceImageImpl. get_ur_program_ref ();
347
347
}
348
348
349
349
// Create UR kernel first.
@@ -352,15 +352,15 @@ kernel make_kernel(const context &TargetContext,
352
352
Properties.stype = UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES;
353
353
Properties.isNativeHandleOwned = !KeepOwnership;
354
354
Adapter.call <UrApiKind::urKernelCreateWithNativeHandle>(
355
- NativeHandle, ContextImpl-> getHandleRef (), UrProgram, &Properties,
355
+ NativeHandle, ContextImpl. getHandleRef (), UrProgram, &Properties,
356
356
&UrKernel);
357
357
358
358
if (Backend == backend::opencl)
359
359
__SYCL_OCL_CALL (clRetainKernel, ur::cast<cl_kernel>(NativeHandle));
360
360
361
361
// Construct the SYCL queue from UR queue.
362
362
return detail::createSyclObjFromImpl<kernel>(
363
- std::make_shared<kernel_impl>(UrKernel, * ContextImpl, &KernelBundleImpl));
363
+ std::make_shared<kernel_impl>(UrKernel, ContextImpl, &KernelBundleImpl));
364
364
}
365
365
366
366
kernel make_kernel (ur_native_handle_t NativeHandle,
0 commit comments