@@ -79,7 +79,8 @@ ur_result_t getZesDeviceHandle(ur_adapter_handle_t_ *adapter,
79
79
return UR_RESULT_ERROR_INVALID_ARGUMENT;
80
80
}
81
81
82
- ur_result_t checkDeviceIntelGPUIpVersionOrNewer (uint32_t ipVersion) {
82
+ ur_result_t
83
+ checkDeviceIntelGPU (std::function<bool (ze_device_properties_t &)> predicate) {
83
84
uint32_t ZeDriverCount = 0 ;
84
85
ZE2UR_CALL (zeDriverGet, (&ZeDriverCount, nullptr ));
85
86
if (ZeDriverCount == 0 ) {
@@ -106,12 +107,9 @@ ur_result_t checkDeviceIntelGPUIpVersionOrNewer(uint32_t ipVersion) {
106
107
for (uint32_t D = 0 ; D < ZeDeviceCount; ++D) {
107
108
ZE2UR_CALL (zeDeviceGetProperties, (ZeDevices[D], &device_properties));
108
109
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;
115
113
}
116
114
}
117
115
}
@@ -261,11 +259,23 @@ ur_result_t adapterStateInit() {
261
259
return UR_RESULT_SUCCESS;
262
260
}
263
261
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
+ return excludeIntegrated
271
+ ? !isIntegrated && ipVersionExt->ipVersion >= 0x05004000
272
+ : ipVersionExt->ipVersion >= 0x05004000 ;
273
+ };
274
+
275
+ auto urResult = checkDeviceIntelGPU (checkBMGorNewer);
266
276
if (urResult != UR_RESULT_SUCCESS &&
267
277
urResult != UR_RESULT_ERROR_UNSUPPORTED_VERSION) {
268
- UR_LOG (ERR, " Intel GPU IP Version check failed: {}\n " , urResult);
278
+ UR_LOG (ERR, " Intel GPU device property check failed: {}\n " , urResult);
269
279
throw urResult;
270
280
}
271
281
@@ -297,8 +307,8 @@ static std::pair<bool, std::string> shouldUseV1Adapter() {
297
307
return {true , reason};
298
308
}
299
309
300
- // default: only enable for devices older than BMG
301
- return {!isBMGorNewer (), reason};
310
+ // default: enable for devices older than BMG and integrated devices
311
+ return {!isBMGorNewer (/* excludeIntegrated */ true ), reason};
302
312
}
303
313
304
314
[[maybe_unused]] static std::pair<bool , std::string> shouldUseV2Adapter () {
@@ -532,8 +542,7 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
532
542
bool ZesInitNeeded = UrSysmanZesinitEnable && !UrSysManEnvInitEnabled;
533
543
// Unless the user has forced the SysMan init, we will check the device
534
544
// version to see if the zesInit is needed.
535
- if (UserForcedSysManInit == 0 &&
536
- checkDeviceIntelGPUIpVersionOrNewer (0x05004000 ) == UR_RESULT_SUCCESS) {
545
+ if (UserForcedSysManInit == 0 && isBMGorNewer () == UR_RESULT_SUCCESS) {
537
546
if (UrSysManEnvInitEnabled) {
538
547
setEnvVar (" ZES_ENABLE_SYSMAN" , " 0" );
539
548
}
0 commit comments