Skip to content

Commit 32a09bd

Browse files
committed
[UR][L0v2] Disable by default on integrated devices
L0v2 adapter needs more work on integrated buffer implementation.
1 parent 9283d86 commit 32a09bd

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

unified-runtime/source/adapters/level_zero/adapter.cpp

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ ur_result_t getZesDeviceHandle(ur_adapter_handle_t_ *adapter,
7979
return UR_RESULT_ERROR_INVALID_ARGUMENT;
8080
}
8181

82-
ur_result_t checkDeviceIntelGPUIpVersionOrNewer(uint32_t ipVersion) {
82+
ur_result_t checkDeviceAnyIntelGPUPropertyMatch(
83+
std::function<bool(ze_device_properties_t &)> predicate) {
8384
uint32_t ZeDriverCount = 0;
8485
ZE2UR_CALL(zeDriverGet, (&ZeDriverCount, nullptr));
8586
if (ZeDriverCount == 0) {
@@ -106,12 +107,9 @@ ur_result_t checkDeviceIntelGPUIpVersionOrNewer(uint32_t ipVersion) {
106107
for (uint32_t D = 0; D < ZeDeviceCount; ++D) {
107108
ZE2UR_CALL(zeDeviceGetProperties, (ZeDevices[D], &device_properties));
108109
if (device_properties.type == ZE_DEVICE_TYPE_GPU &&
109-
device_properties.vendorId == 0x8086) {
110-
ze_device_ip_version_ext_t *ipVersionExt =
111-
(ze_device_ip_version_ext_t *)device_properties.pNext;
112-
if (ipVersionExt->ipVersion >= ipVersion) {
113-
return UR_RESULT_SUCCESS;
114-
}
110+
device_properties.vendorId == 0x8086 &&
111+
predicate(device_properties)) {
112+
return UR_RESULT_SUCCESS;
115113
}
116114
}
117115
}
@@ -261,11 +259,25 @@ ur_result_t adapterStateInit() {
261259
return UR_RESULT_SUCCESS;
262260
}
263261

264-
static bool isBMGorNewer() {
265-
auto urResult = checkDeviceIntelGPUIpVersionOrNewer(0x05004000);
262+
static bool isBMGorNewer(bool excludeIntegrated = false) {
263+
auto checkBMGorNewer =
264+
[&excludeIntegrated](ze_device_properties_t &device_properties) {
265+
ze_device_ip_version_ext_t *ipVersionExt =
266+
(ze_device_ip_version_ext_t *)device_properties.pNext;
267+
268+
auto isIntegrated =
269+
device_properties.flags && ZE_DEVICE_PROPERTY_FLAG_INTEGRATED;
270+
if (excludeIntegrated && isIntegrated) {
271+
return false;
272+
}
273+
274+
return ipVersionExt->ipVersion >= 0x05004000;
275+
};
276+
277+
auto urResult = checkDeviceAnyIntelGPUPropertyMatch(checkBMGorNewer);
266278
if (urResult != UR_RESULT_SUCCESS &&
267279
urResult != UR_RESULT_ERROR_UNSUPPORTED_VERSION) {
268-
UR_LOG(ERR, "Intel GPU IP Version check failed: {}\n", urResult);
280+
UR_LOG(ERR, "Intel GPU device property check failed: {}\n", urResult);
269281
throw urResult;
270282
}
271283

@@ -297,8 +309,8 @@ static std::pair<bool, std::string> shouldUseV1Adapter() {
297309
return {true, reason};
298310
}
299311

300-
// default: only enable for devices older than BMG
301-
return {!isBMGorNewer(), reason};
312+
// default: enable for devices older than BMG and integrated devices
313+
return {!isBMGorNewer(/* excludeIntegrated */ true), reason};
302314
}
303315

304316
[[maybe_unused]] static std::pair<bool, std::string> shouldUseV2Adapter() {
@@ -532,8 +544,7 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
532544
bool ZesInitNeeded = UrSysmanZesinitEnable && !UrSysManEnvInitEnabled;
533545
// Unless the user has forced the SysMan init, we will check the device
534546
// version to see if the zesInit is needed.
535-
if (UserForcedSysManInit == 0 &&
536-
checkDeviceIntelGPUIpVersionOrNewer(0x05004000) == UR_RESULT_SUCCESS) {
547+
if (UserForcedSysManInit == 0 && isBMGorNewer()) {
537548
if (UrSysManEnvInitEnabled) {
538549
setEnvVar("ZES_ENABLE_SYSMAN", "0");
539550
}

0 commit comments

Comments
 (0)