Skip to content

Commit 74c718b

Browse files
committed
[UR] Add UR_L0_V2_DISABLE_ZE_LAUNCH_KERNEL_WITH_ARGS debugging variable
Add UR_L0_V2_DISABLE_ZE_LAUNCH_KERNEL_WITH_ARGS debugging environment variable to disable calling ZeCommandListAppendLaunchKernelWithArguments(). Signed-off-by: Lukasz Dorau <[email protected]>
1 parent ec5d354 commit 74c718b

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

sycl/doc/EnvironmentVariables.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ older hardware or when SYCL_UR_USE_LEVEL_ZERO_V2=0 is set.</span>
272272
| Environment variable | Values | Description | Adapter Support |
273273
| -------------------- | ------ | ----------- | --------------- |
274274
| `UR_L0_V2_FORCE_DISABLE_COPY_OFFLOAD` | Integer | By default, copy operations submitted to any queue can be offloaded to dedicated copy engines. Setting this variable instructs the driver to keep all copy operations on the engine behind the original queue. The default value is 0. | V2 |
275+
| `UR_L0_V2_DISABLE_ZE_LAUNCH_KERNEL_WITH_ARGS` | Integer | By default, ZeCommandListAppendLaunchKernelWithArguments() will be called when available and possible. Setting this variable instructs the adapter to not call ZeCommandListAppendLaunchKernelWithArguments() and use the old path using ZeCommandListAppendLaunchKernel(). The default value is 0. | V2 |
275276
| `SYCL_PI_LEVEL_ZERO_SINGLE_THREAD_MODE` | Integer | A single-threaded app has an opportunity to enable this mode to avoid overhead from mutex locking in the Level Zero adapter. A value greater than 0 enables single thread mode. A value of 0 disables single thread mode. The default is 0. | Legacy |
276277
| `SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR` | [EnableBuffers][;[MaxPoolSize][;[host\|device\|shared:][MaxPoolableSize][,[Capacity][,SlabMinSize]]]...] | EnableBuffers enables pooling for SYCL buffers, default 1, set to 0 to disable. MaxPoolSize is the maximum size of the pool, by default there is no size limit. MemType is host, device, shared or read_only_shared. Other parameters are values specified as positive integers with optional K, M or G suffix. MaxPoolableSize is the maximum allocation size that may be pooled, default 0 for shared, 2MB for host, 4MB for device and read_only_shared. Capacity is the number of allocations in each size range freed by the program but retained in the pool for reallocation, default 4. Size ranges follow this pattern: 64, 96, 128, 192, and so on, i.e., powers of 2, with one range in between. SlabMinSize is the minimum allocation size, 64KB for host and device, 2MB for shared and read_only_shared. Example: SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR=1;32M;host:1M,4,64K;device:1M,4,64K;shared:0,0,2M| Legacy and V2 |
277278
| `SYCL_PI_LEVEL_ZERO_BATCH_SIZE` | Integer | Sets a preferred number of compute commands to batch into a command list before executing the command list. A value of 0 causes the batch size to be adjusted dynamically. A value greater than 0 specifies fixed size batching, with the batch size set to the specified value. The default is 0. | Legacy |

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,10 @@ ur_result_t ur_platform_handle_t_::initialize() {
538538
.DriverSupportsCooperativeKernelLaunchWithArgs =
539539
this->isDriverVersionNewerOrSimilar(1, 6, 35005);
540540

541+
ZeCommandListAppendLaunchKernelWithArgumentsExt
542+
.DisableZeLaunchKernelWithArgs =
543+
getenv_tobool("UR_L0_V2_DISABLE_ZE_LAUNCH_KERNEL_WITH_ARGS", false);
544+
541545
return UR_RESULT_SUCCESS;
542546
}
543547

unified-runtime/source/adapters/level_zero/platform.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,5 +166,6 @@ struct ur_platform_handle_t_ : ur::handle_base<ur::level_zero::ddi_getter>,
166166
struct ZeCommandListAppendLaunchKernelWithArgumentsExtension {
167167
bool Supported = false;
168168
bool DriverSupportsCooperativeKernelLaunchWithArgs = false;
169+
bool DisableZeLaunchKernelWithArgs = false;
169170
} ZeCommandListAppendLaunchKernelWithArgumentsExt;
170171
};

unified-runtime/source/adapters/level_zero/v2/command_list_manager.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,8 +1256,11 @@ ur_result_t ur_command_list_manager::appendKernelLaunchWithArgsExp(
12561256
bool CooperativeCompatible =
12571257
hPlatform->ZeCommandListAppendLaunchKernelWithArgumentsExt
12581258
.DriverSupportsCooperativeKernelLaunchWithArgs;
1259+
bool DisableZeLaunchKernelWithArgs =
1260+
hPlatform->ZeCommandListAppendLaunchKernelWithArgumentsExt
1261+
.DisableZeLaunchKernelWithArgs;
12591262
bool RunNewPath =
1260-
KernelWithArgsSupported &&
1263+
!DisableZeLaunchKernelWithArgs && KernelWithArgsSupported &&
12611264
(!cooperativeKernelLaunchRequested ||
12621265
(cooperativeKernelLaunchRequested && CooperativeCompatible));
12631266
if (RunNewPath) {

0 commit comments

Comments
 (0)