Skip to content

Commit 0ae3c87

Browse files
authored
[UR] call urGetAdapter before creating a device from native handle (#12619)
This solves the same issues as #12432, but for `urDeviceCreateWithNativeHandle`. I considered a more generalized solution (e.g., calling `urGetAdapter` in `piPluginInit`), but I'm not sure that's worth it considering PI is going away. All the other `CreateWithNativeHandle` functions require either platform or a device to already exist.
1 parent 32f5191 commit 0ae3c87

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sycl/plugins/unified_runtime/pi2ur.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,12 @@ piextDeviceCreateWithNativeHandle(pi_native_handle NativeHandle,
13131313
PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
13141314
PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
13151315

1316+
ur_adapter_handle_t adapter = nullptr;
1317+
if (auto res = PiGetAdapter(adapter); res != PI_SUCCESS) {
1318+
return res;
1319+
}
1320+
(void)adapter;
1321+
13161322
ur_native_handle_t UrNativeDevice =
13171323
reinterpret_cast<ur_native_handle_t>(NativeHandle);
13181324
ur_platform_handle_t UrPlatform =

0 commit comments

Comments
 (0)