Skip to content

Commit 8441d94

Browse files
author
Georgi Mirazchiyski
authored
Merge branch 'main' into georgi/hip-max-version-for-usmmemcpy2d-workaround
2 parents 1afb85b + d0af98f commit 8441d94

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1085
-611
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ if(UR_ENABLE_TRACING)
137137

138138
if (UR_BUILD_XPTI_LIBS)
139139
# fetch xpti proxy library for the tracing layer
140-
FetchContentSparse_Declare(xpti https://github.com/intel/llvm.git "sycl-nightly/20230703" "xpti")
140+
FetchContentSparse_Declare(xpti https://github.com/intel/llvm.git "nightly-2024-10-22" "xpti")
141141
FetchContent_MakeAvailable(xpti)
142142

143143
# set -fPIC for xpti since we are linking it with a shared library
@@ -149,7 +149,7 @@ if(UR_ENABLE_TRACING)
149149
set(XPTI_DIR ${xpti_SOURCE_DIR})
150150
set(XPTI_ENABLE_TESTS OFF CACHE INTERNAL "Turn off xptifw tests")
151151

152-
FetchContentSparse_Declare(xptifw https://github.com/intel/llvm.git "sycl-nightly/20230703" "xptifw")
152+
FetchContentSparse_Declare(xptifw https://github.com/intel/llvm.git "nightly-2024-10-22" "xptifw")
153153

154154
FetchContent_MakeAvailable(xptifw)
155155

examples/collector/collector.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version,
125125
return;
126126
}
127127
if (std::string_view(stream_name) != UR_STREAM_NAME) {
128-
std::cout << "Invalid stream name: " << stream_name << ". Expected "
129-
<< UR_STREAM_NAME << ". Aborting." << std::endl;
128+
// we expect ur.call, but this can also be xpti.framework.
130129
return;
131130
}
132131

include/ur_api.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,9 @@ typedef enum ur_device_info_t {
16391639
UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT = 118, ///< [::ur_bool_t] return true if the device supports the
16401640
///< `EnqueueDeviceGlobalVariableWrite` and
16411641
///< `EnqueueDeviceGlobalVariableRead` entry points.
1642+
UR_DEVICE_INFO_USM_POOL_SUPPORT = 119, ///< [::ur_bool_t] return true if the device supports USM pooling. Pertains
1643+
///< to the `USMPool` entry points and usage of the `pool` parameter of the
1644+
///< USM alloc entry points.
16421645
UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP = 0x1000, ///< [::ur_bool_t] Returns true if the device supports the use of
16431646
///< command-buffers.
16441647
UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_CAPABILITIES_EXP = 0x1001, ///< [::ur_device_command_buffer_update_capability_flags_t] Command-buffer
@@ -3503,7 +3506,6 @@ typedef struct ur_usm_pool_limits_desc_t {
35033506
/// @brief USM allocate host memory
35043507
///
35053508
/// @details
3506-
/// - This function must support memory pooling.
35073509
/// - If pUSMDesc is not NULL and pUSMDesc->pool is not NULL the allocation
35083510
/// will be served from a specified memory pool.
35093511
/// - Otherwise, the behavior is implementation-defined.
@@ -3536,6 +3538,8 @@ typedef struct ur_usm_pool_limits_desc_t {
35363538
/// + `size` is greater than ::UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE.
35373539
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
35383540
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
3541+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
3542+
/// + If any device associated with `hContext` reports `false` for ::UR_DEVICE_INFO_USM_POOL_SUPPORT
35393543
UR_APIEXPORT ur_result_t UR_APICALL
35403544
urUSMHostAlloc(
35413545
ur_context_handle_t hContext, ///< [in] handle of the context object
@@ -3549,7 +3553,6 @@ urUSMHostAlloc(
35493553
/// @brief USM allocate device memory
35503554
///
35513555
/// @details
3552-
/// - This function must support memory pooling.
35533556
/// - If pUSMDesc is not NULL and pUSMDesc->pool is not NULL the allocation
35543557
/// will be served from a specified memory pool.
35553558
/// - Otherwise, the behavior is implementation-defined.
@@ -3583,6 +3586,8 @@ urUSMHostAlloc(
35833586
/// + `size` is greater than ::UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE.
35843587
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
35853588
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
3589+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
3590+
/// + If any device associated with `hContext` reports `false` for ::UR_DEVICE_INFO_USM_POOL_SUPPORT
35863591
UR_APIEXPORT ur_result_t UR_APICALL
35873592
urUSMDeviceAlloc(
35883593
ur_context_handle_t hContext, ///< [in] handle of the context object
@@ -3597,7 +3602,6 @@ urUSMDeviceAlloc(
35973602
/// @brief USM allocate shared memory
35983603
///
35993604
/// @details
3600-
/// - This function must support memory pooling.
36013605
/// - If pUSMDesc is not NULL and pUSMDesc->pool is not NULL the allocation
36023606
/// will be served from a specified memory pool.
36033607
/// - Otherwise, the behavior is implementation-defined.
@@ -3632,6 +3636,8 @@ urUSMDeviceAlloc(
36323636
/// + If `UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT` and `UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT` are both false.
36333637
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
36343638
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
3639+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
3640+
/// + If any device associated with `hContext` reports `false` for ::UR_DEVICE_INFO_USM_POOL_SUPPORT
36353641
UR_APIEXPORT ur_result_t UR_APICALL
36363642
urUSMSharedAlloc(
36373643
ur_context_handle_t hContext, ///< [in] handle of the context object
@@ -3713,6 +3719,8 @@ urUSMGetMemAllocInfo(
37133719
/// + `::UR_USM_POOL_FLAGS_MASK & pPoolDesc->flags`
37143720
/// - ::UR_RESULT_ERROR_INVALID_VALUE
37153721
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
3722+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
3723+
/// + If any device associated with `hContext` reports `false` for ::UR_DEVICE_INFO_USM_POOL_SUPPORT
37163724
UR_APIEXPORT ur_result_t UR_APICALL
37173725
urUSMPoolCreate(
37183726
ur_context_handle_t hContext, ///< [in] handle of the context object
@@ -3731,6 +3739,7 @@ urUSMPoolCreate(
37313739
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
37323740
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
37333741
/// + `NULL == pPool`
3742+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
37343743
UR_APIEXPORT ur_result_t UR_APICALL
37353744
urUSMPoolRetain(
37363745
ur_usm_pool_handle_t pPool ///< [in][retain] pointer to USM memory pool
@@ -3753,6 +3762,7 @@ urUSMPoolRetain(
37533762
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
37543763
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
37553764
/// + `NULL == pPool`
3765+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
37563766
UR_APIEXPORT ur_result_t UR_APICALL
37573767
urUSMPoolRelease(
37583768
ur_usm_pool_handle_t pPool ///< [in][release] pointer to USM memory pool
@@ -3794,6 +3804,7 @@ typedef enum ur_usm_pool_info_t {
37943804
/// + `pPropValue == NULL && pPropSizeRet == NULL`
37953805
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
37963806
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
3807+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
37973808
UR_APIEXPORT ur_result_t UR_APICALL
37983809
urUSMPoolGetInfo(
37993810
ur_usm_pool_handle_t hPool, ///< [in] handle of the USM memory pool

include/ur_print.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2550,6 +2550,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) {
25502550
case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT:
25512551
os << "UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT";
25522552
break;
2553+
case UR_DEVICE_INFO_USM_POOL_SUPPORT:
2554+
os << "UR_DEVICE_INFO_USM_POOL_SUPPORT";
2555+
break;
25532556
case UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP:
25542557
os << "UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP";
25552558
break;
@@ -4052,6 +4055,18 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info
40524055

40534056
os << ")";
40544057
} break;
4058+
case UR_DEVICE_INFO_USM_POOL_SUPPORT: {
4059+
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
4060+
if (sizeof(ur_bool_t) > size) {
4061+
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")";
4062+
return UR_RESULT_ERROR_INVALID_SIZE;
4063+
}
4064+
os << (const void *)(tptr) << " (";
4065+
4066+
os << *tptr;
4067+
4068+
os << ")";
4069+
} break;
40554070
case UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP: {
40564071
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
40574072
if (sizeof(ur_bool_t) > size) {

scripts/core/device.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@ etors:
441441
desc: "[$x_device_handle_t] The composite device containing this component device."
442442
- name: GLOBAL_VARIABLE_SUPPORT
443443
desc: "[$x_bool_t] return true if the device supports the `EnqueueDeviceGlobalVariableWrite` and `EnqueueDeviceGlobalVariableRead` entry points."
444+
- name: USM_POOL_SUPPORT
445+
desc: "[$x_bool_t] return true if the device supports USM pooling. Pertains to the `USMPool` entry points and usage of the `pool` parameter of the USM alloc entry points."
444446
--- #--------------------------------------------------------------------------
445447
type: function
446448
desc: "Retrieves various information about device"

scripts/core/usm.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ class: $xUSM
229229
name: HostAlloc
230230
ordinal: "0"
231231
details:
232-
- "This function must support memory pooling."
233232
- "If pUSMDesc is not NULL and pUSMDesc->pool is not NULL the allocation will be served from a specified memory pool."
234233
- "Otherwise, the behavior is implementation-defined."
235234
- "Allocations served from different memory pools must be isolated and must not reside on the same page."
@@ -264,14 +263,15 @@ returns:
264263
- "`size` is greater than $X_DEVICE_INFO_MAX_MEM_ALLOC_SIZE."
265264
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
266265
- $X_RESULT_ERROR_OUT_OF_RESOURCES
266+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
267+
- "If any device associated with `hContext` reports `false` for $X_DEVICE_INFO_USM_POOL_SUPPORT"
267268
--- #--------------------------------------------------------------------------
268269
type: function
269270
desc: "USM allocate device memory"
270271
class: $xUSM
271272
name: DeviceAlloc
272273
ordinal: "0"
273274
details:
274-
- "This function must support memory pooling."
275275
- "If pUSMDesc is not NULL and pUSMDesc->pool is not NULL the allocation will be served from a specified memory pool."
276276
- "Otherwise, the behavior is implementation-defined."
277277
- "Allocations served from different memory pools must be isolated and must not reside on the same page."
@@ -309,14 +309,15 @@ returns:
309309
- "`size` is greater than $X_DEVICE_INFO_MAX_MEM_ALLOC_SIZE."
310310
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
311311
- $X_RESULT_ERROR_OUT_OF_RESOURCES
312+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
313+
- "If any device associated with `hContext` reports `false` for $X_DEVICE_INFO_USM_POOL_SUPPORT"
312314
--- #--------------------------------------------------------------------------
313315
type: function
314316
desc: "USM allocate shared memory"
315317
class: $xUSM
316318
name: SharedAlloc
317319
ordinal: "0"
318320
details:
319-
- "This function must support memory pooling."
320321
- "If pUSMDesc is not NULL and pUSMDesc->pool is not NULL the allocation will be served from a specified memory pool."
321322
- "Otherwise, the behavior is implementation-defined."
322323
- "Allocations served from different memory pools must be isolated and must not reside on the same page."
@@ -355,6 +356,8 @@ returns:
355356
- "If `UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT` and `UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT` are both false."
356357
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
357358
- $X_RESULT_ERROR_OUT_OF_RESOURCES
359+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
360+
- "If any device associated with `hContext` reports `false` for $X_DEVICE_INFO_USM_POOL_SUPPORT"
358361
--- #--------------------------------------------------------------------------
359362
type: function
360363
desc: "Free the USM memory object"
@@ -424,6 +427,8 @@ returns:
424427
- $X_RESULT_ERROR_INVALID_NULL_HANDLE
425428
- $X_RESULT_ERROR_INVALID_VALUE
426429
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
430+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
431+
- "If any device associated with `hContext` reports `false` for $X_DEVICE_INFO_USM_POOL_SUPPORT"
427432
--- #--------------------------------------------------------------------------
428433
type: function
429434
desc: "Get a reference to the pool handle. Increment its reference count"
@@ -436,6 +441,7 @@ params:
436441
desc: "[in][retain] pointer to USM memory pool"
437442
returns:
438443
- $X_RESULT_ERROR_INVALID_NULL_HANDLE
444+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE
439445
--- #--------------------------------------------------------------------------
440446
type: function
441447
desc: "Decrement the pool's reference count and delete the pool if the reference count becomes zero."
@@ -452,6 +458,7 @@ params:
452458
desc: "[in][release] pointer to USM memory pool"
453459
returns:
454460
- $X_RESULT_ERROR_INVALID_NULL_HANDLE
461+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE
455462
--- #--------------------------------------------------------------------------
456463
type: enum
457464
desc: "Get USM memory pool information"
@@ -499,3 +506,4 @@ returns:
499506
- "`pPropValue == NULL && pPropSizeRet == NULL`"
500507
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
501508
- $X_RESULT_ERROR_OUT_OF_RESOURCES
509+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE

source/adapters/cuda/device.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
10761076
return ReturnValue(static_cast<ur_bool_t>(false));
10771077
case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT:
10781078
return ReturnValue(static_cast<ur_bool_t>(true));
1079+
case UR_DEVICE_INFO_USM_POOL_SUPPORT:
1080+
return ReturnValue(static_cast<ur_bool_t>(true));
10791081
case UR_DEVICE_INFO_COMPONENT_DEVICES:
10801082
case UR_DEVICE_INFO_COMPOSITE_DEVICE:
10811083
case UR_DEVICE_INFO_MAX_READ_WRITE_IMAGE_ARGS:

source/adapters/hip/device.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
889889

890890
case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT:
891891
return ReturnValue(ur_bool_t{false});
892+
case UR_DEVICE_INFO_USM_POOL_SUPPORT:
893+
return ReturnValue(ur_bool_t{true});
892894
// TODO: Investigate if this information is available on HIP.
893895
case UR_DEVICE_INFO_COMPONENT_DEVICES:
894896
case UR_DEVICE_INFO_COMPOSITE_DEVICE:

source/adapters/level_zero/command_buffer.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -784,19 +784,10 @@ ur_result_t urCommandBufferAppendUSMMemcpyExp(
784784
std::ignore = Event;
785785
std::ignore = Command;
786786

787-
bool PreferCopyEngine = !IsDevicePointer(CommandBuffer->Context, Src) ||
788-
!IsDevicePointer(CommandBuffer->Context, Dst);
789-
// For better performance, Copy Engines are not preferred given Shared
790-
// pointers on DG2.
791-
if (CommandBuffer->Device->isDG2() &&
792-
(IsSharedPointer(CommandBuffer->Context, Src) ||
793-
IsSharedPointer(CommandBuffer->Context, Dst))) {
794-
PreferCopyEngine = false;
795-
}
796-
PreferCopyEngine |= UseCopyEngineForD2DCopy;
797-
798787
return enqueueCommandBufferMemCopyHelper(
799-
UR_COMMAND_USM_MEMCPY, CommandBuffer, Dst, Src, Size, PreferCopyEngine,
788+
UR_COMMAND_USM_MEMCPY, CommandBuffer, Dst, Src, Size,
789+
PreferCopyEngineUsage(CommandBuffer->Device, CommandBuffer->Context, Src,
790+
Dst),
800791
NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint);
801792
}
802793

source/adapters/level_zero/device.cpp

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,9 +1053,7 @@ ur_result_t urDeviceGetInfo(
10531053
case UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP:
10541054
return ReturnValue(false);
10551055
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() &&
10591057
Device->ZeDeviceImageProperties->maxImageDims1D > 0 &&
10601058
Device->ZeDeviceImageProperties->maxImageDims2D > 0 &&
10611059
Device->ZeDeviceImageProperties->maxImageDims3D > 0);
@@ -1065,15 +1063,11 @@ ur_result_t urDeviceGetInfo(
10651063
return ReturnValue(false);
10661064
}
10671065
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() &&
10711067
Device->ZeDeviceImageProperties->maxImageDims1D > 0);
10721068
}
10731069
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() &&
10771071
Device->ZeDeviceImageProperties->maxImageDims2D > 0);
10781072
}
10791073
case UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP:
@@ -1155,6 +1149,8 @@ ur_result_t urDeviceGetInfo(
11551149
return ReturnValue(false);
11561150
case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT:
11571151
return ReturnValue(true);
1152+
case UR_DEVICE_INFO_USM_POOL_SUPPORT:
1153+
return ReturnValue(true);
11581154
default:
11591155
logger::error("Unsupported ParamName in urGetDeviceInfo");
11601156
logger::error("ParamNameParamName={}(0x{})", ParamName,
@@ -1409,13 +1405,35 @@ ur_result_t urDeviceRelease(ur_device_handle_t Device) {
14091405
}
14101406
} // namespace ur::level_zero
14111407

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
1408+
/**
1409+
* @brief Determines the mode of immediate command lists to be used.
1410+
*
1411+
* This function checks environment variables and device properties to decide
1412+
* the mode of immediate command lists. The mode can be influenced by the
1413+
* following environment variables:
1414+
* - `UR_L0_USE_IMMEDIATE_COMMANDLISTS`
1415+
* - `SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS`
1416+
*
1417+
* If neither environment variable is set, the function defaults to using the
1418+
* device's properties to determine the mode.
1419+
*
1420+
* @return The mode of immediate command lists, which can be one of the
1421+
* following:
1422+
* - `NotUsed`: Immediate command lists are not used.
1423+
* - `PerQueue`: Immediate command lists are used per queue.
1424+
* - `PerThreadPerQueue`: Immediate command lists are used per thread per queue.
1425+
*
1426+
* The decision process is as follows:
1427+
* 1. If the environment variables are not set, the function checks if the
1428+
* device is Intel DG2 or newer and if the driver version is supported. If both
1429+
* conditions are met, or if the device is PVC, it returns `PerQueue`.
1430+
* Otherwise, it returns `NotUsed`.
1431+
* 2. If the environment variable is set, it returns the corresponding mode:
1432+
* - `0`: `NotUsed`
1433+
* - `1`: `PerQueue`
1434+
* - `2`: `PerThreadPerQueue`
1435+
* - Any other value: `NotUsed`
1436+
*/
14191437
ur_device_handle_t_::ImmCmdlistMode
14201438
ur_device_handle_t_::useImmediateCommandLists() {
14211439
// If immediate commandlist setting is not explicitly set, then use the device
@@ -1433,9 +1451,10 @@ ur_device_handle_t_::useImmediateCommandLists() {
14331451
}();
14341452

14351453
if (ImmediateCommandlistsSetting == -1) {
1454+
bool isDG2OrNewer = this->isIntelDG2OrNewer();
14361455
bool isDG2SupportedDriver =
14371456
this->Platform->isDriverVersionNewerOrSimilar(1, 5, 30820);
1438-
if ((isDG2SupportedDriver && isDG2()) || isPVC()) {
1457+
if ((isDG2SupportedDriver && isDG2OrNewer) || isPVC()) {
14391458
return PerQueue;
14401459
} else {
14411460
return NotUsed;

0 commit comments

Comments
 (0)