@@ -1053,9 +1053,7 @@ ur_result_t urDeviceGetInfo(
1053
1053
case UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP:
1054
1054
return ReturnValue (false );
1055
1055
case UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP: {
1056
- bool DeviceIsDG2OrNewer =
1057
- Device->ZeDeviceIpVersionExt ->ipVersion >= 0x030dc000 ;
1058
- return ReturnValue (DeviceIsDG2OrNewer &&
1056
+ return ReturnValue (Device->isIntelDG2OrNewer () &&
1059
1057
Device->ZeDeviceImageProperties ->maxImageDims1D > 0 &&
1060
1058
Device->ZeDeviceImageProperties ->maxImageDims2D > 0 &&
1061
1059
Device->ZeDeviceImageProperties ->maxImageDims3D > 0 );
@@ -1065,15 +1063,11 @@ ur_result_t urDeviceGetInfo(
1065
1063
return ReturnValue (false );
1066
1064
}
1067
1065
case UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP: {
1068
- bool DeviceIsDG2OrNewer =
1069
- Device->ZeDeviceIpVersionExt ->ipVersion >= 0x030dc000 ;
1070
- return ReturnValue (DeviceIsDG2OrNewer &&
1066
+ return ReturnValue (Device->isIntelDG2OrNewer () &&
1071
1067
Device->ZeDeviceImageProperties ->maxImageDims1D > 0 );
1072
1068
}
1073
1069
case UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP: {
1074
- bool DeviceIsDG2OrNewer =
1075
- Device->ZeDeviceIpVersionExt ->ipVersion >= 0x030dc000 ;
1076
- return ReturnValue (DeviceIsDG2OrNewer &&
1070
+ return ReturnValue (Device->isIntelDG2OrNewer () &&
1077
1071
Device->ZeDeviceImageProperties ->maxImageDims2D > 0 );
1078
1072
}
1079
1073
case UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP:
@@ -1409,13 +1403,35 @@ ur_result_t urDeviceRelease(ur_device_handle_t Device) {
1409
1403
}
1410
1404
} // namespace ur::level_zero
1411
1405
1412
- // Whether immediate commandlists will be used for kernel launches and copies.
1413
- // The default is standard commandlists. Setting 1 or 2 specifies use of
1414
- // immediate commandlists. Note: when immediate commandlists are used then
1415
- // device-only events must be either AllHostVisible or OnDemandHostVisibleProxy.
1416
- // (See env var UR_L0_DEVICE_SCOPE_EVENTS).
1417
-
1418
- // Get value of immediate commandlists env var setting or -1 if unset
1406
+ /* *
1407
+ * @brief Determines the mode of immediate command lists to be used.
1408
+ *
1409
+ * This function checks environment variables and device properties to decide
1410
+ * the mode of immediate command lists. The mode can be influenced by the
1411
+ * following environment variables:
1412
+ * - `UR_L0_USE_IMMEDIATE_COMMANDLISTS`
1413
+ * - `SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS`
1414
+ *
1415
+ * If neither environment variable is set, the function defaults to using the
1416
+ * device's properties to determine the mode.
1417
+ *
1418
+ * @return The mode of immediate command lists, which can be one of the
1419
+ * following:
1420
+ * - `NotUsed`: Immediate command lists are not used.
1421
+ * - `PerQueue`: Immediate command lists are used per queue.
1422
+ * - `PerThreadPerQueue`: Immediate command lists are used per thread per queue.
1423
+ *
1424
+ * The decision process is as follows:
1425
+ * 1. If the environment variables are not set, the function checks if the
1426
+ * device is Intel DG2 or newer and if the driver version is supported. If both
1427
+ * conditions are met, or if the device is PVC, it returns `PerQueue`.
1428
+ * Otherwise, it returns `NotUsed`.
1429
+ * 2. If the environment variable is set, it returns the corresponding mode:
1430
+ * - `0`: `NotUsed`
1431
+ * - `1`: `PerQueue`
1432
+ * - `2`: `PerThreadPerQueue`
1433
+ * - Any other value: `NotUsed`
1434
+ */
1419
1435
ur_device_handle_t_::ImmCmdlistMode
1420
1436
ur_device_handle_t_::useImmediateCommandLists () {
1421
1437
// If immediate commandlist setting is not explicitly set, then use the device
@@ -1433,9 +1449,10 @@ ur_device_handle_t_::useImmediateCommandLists() {
1433
1449
}();
1434
1450
1435
1451
if (ImmediateCommandlistsSetting == -1 ) {
1452
+ bool isDG2OrNewer = this ->isIntelDG2OrNewer ();
1436
1453
bool isDG2SupportedDriver =
1437
1454
this ->Platform ->isDriverVersionNewerOrSimilar (1 , 5 , 30820 );
1438
- if ((isDG2SupportedDriver && isDG2 () ) || isPVC ()) {
1455
+ if ((isDG2SupportedDriver && isDG2OrNewer ) || isPVC ()) {
1439
1456
return PerQueue;
1440
1457
} else {
1441
1458
return NotUsed;
0 commit comments