Skip to content

Commit bdd5063

Browse files
authored
[UR] Call PiGetAdapter in piextContextCreateWithNativeHandle (#12515)
This ensures that global setup has completed and interop objects will function correctly even if an application bootstraps directly in at the context level.
1 parent 478373f commit bdd5063

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
@@ -1514,6 +1514,12 @@ inline pi_result piextContextCreateWithNativeHandle(
15141514
PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
15151515
PI_ASSERT(RetContext, PI_ERROR_INVALID_VALUE);
15161516

1517+
ur_adapter_handle_t adapter = nullptr;
1518+
if (auto res = PiGetAdapter(adapter); res != PI_SUCCESS) {
1519+
return res;
1520+
}
1521+
(void)adapter;
1522+
15171523
ur_native_handle_t NativeContext =
15181524
reinterpret_cast<ur_native_handle_t>(NativeHandle);
15191525
const ur_device_handle_t *UrDevices =

0 commit comments

Comments
 (0)