File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
source/adapters/level_zero Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet(
88
88
if (!isCombinedMode) {
89
89
ze_device_handle_t RootDev = nullptr ;
90
90
// Query Root Device
91
- ZE2UR_CALL (zeDeviceGetRootDevice, (D->ZeDevice , &RootDev));
91
+ // We cannot use ZE2UR_CALL because under some circumstances this call may
92
+ // return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, and ZE2UR_CALL will abort
93
+ // because it's not UR_RESULT_SUCCESS. Instead, we use ZE_CALL_NOCHECK and
94
+ // we check manually that the result is either ZE_RESULT_SUCCESS or
95
+ // ZE_RESULT_ERROR_UNSUPPORTED_FEATURE.
96
+ auto errc =
97
+ ZE_CALL_NOCHECK (zeDeviceGetRootDevice, (D->ZeDevice , &RootDev));
98
+ if (errc != ZE_RESULT_SUCCESS &&
99
+ errc != ZE_RESULT_ERROR_UNSUPPORTED_FEATURE)
100
+ return ze2urResult (errc);
92
101
// For COMPOSITE and FLAT modes, RootDev will always be nullptr. Thus a
93
102
// single device returning RootDev != nullptr means we are in COMBINED
94
103
// mode.
Original file line number Diff line number Diff line change @@ -423,8 +423,18 @@ ur_result_t ur_platform_handle_t_::populateDeviceCacheIfNeeded() {
423
423
// through zeDeviceGetRootDevice. We need to cache the card device
424
424
// handle too, such that it is readily visible to the
425
425
// urDeviceCreateWithNativeHandle.
426
- ze_device_handle_t RootDevice;
427
- ZE2UR_CALL (zeDeviceGetRootDevice, (Device->ZeDevice , &RootDevice));
426
+ ze_device_handle_t RootDevice = nullptr ;
427
+ // We cannot use ZE2UR_CALL because under some circumstances this call may
428
+ // return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, and ZE2UR_CALL will abort
429
+ // because it's not UR_RESULT_SUCCESS. Instead, we use ZE_CALL_NOCHECK and
430
+ // we check manually that the result is either ZE_RESULT_SUCCESS or
431
+ // ZE_RESULT_ERROR_UNSUPPORTED_FEATURE.
432
+ auto errc = ZE_CALL_NOCHECK (zeDeviceGetRootDevice,
433
+ (Device->ZeDevice , &RootDevice));
434
+ if (errc != ZE_RESULT_SUCCESS &&
435
+ errc != ZE_RESULT_ERROR_UNSUPPORTED_FEATURE)
436
+ return ze2urResult (errc);
437
+
428
438
if (RootDevice) {
429
439
if (std::find_if (URDevicesCache.begin (), URDevicesCache.end (),
430
440
[&](auto &Dev) {
You can’t perform that action at this time.
0 commit comments