Skip to content

Commit

Permalink
[UR] call urGetAdapter before creating a device from native handle (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
pbalcer authored Feb 7, 2024
1 parent 32f5191 commit 0ae3c87
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sycl/plugins/unified_runtime/pi2ur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,12 @@ piextDeviceCreateWithNativeHandle(pi_native_handle NativeHandle,
PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);

ur_adapter_handle_t adapter = nullptr;
if (auto res = PiGetAdapter(adapter); res != PI_SUCCESS) {
return res;
}
(void)adapter;

ur_native_handle_t UrNativeDevice =
reinterpret_cast<ur_native_handle_t>(NativeHandle);
ur_platform_handle_t UrPlatform =
Expand Down

0 comments on commit 0ae3c87

Please sign in to comment.