From 994f7249e1521bcf1dbdaf3d99f9c599551c82e0 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Tue, 25 Aug 2026 14:51:52 +0200 Subject: [PATCH 01/27] [SYCL][L0v2] Enable queue_priority, usm_residency, queue_submit_mode tests --- sycl/test-e2e/Adapters/level_zero/queue_priority.cpp | 2 -- sycl/test-e2e/Adapters/level_zero/usm_residency.cpp | 2 -- sycl/test-e2e/Adapters/queue_submit_mode.cpp | 2 -- 3 files changed, 6 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp b/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp index 0419603d192d4..14d83cc64bd3b 100644 --- a/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp +++ b/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp @@ -1,6 +1,4 @@ // REQUIRES: gpu, level_zero, level_zero_dev_kit -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: v2 adapter does not support regular cmd lists // RUN: %{build} %level_zero_options -o %t.out // RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{run} %t.out 2>&1 | FileCheck %s --check-prefixes=CHECK-STD // RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{run} %t.out 2>&1 | FileCheck %s --check-prefixes=CHECK-IMM diff --git a/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp b/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp index 10090142e0470..3716809c8b499 100644 --- a/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp +++ b/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp @@ -1,6 +1,4 @@ // REQUIRES: gpu, level_zero -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: v2 adapter does not support changing residency. // RUN: %{build} %level_zero_options -o %t.out // RUN: env SYCL_UR_TRACE=2 UR_L0_DEBUG=-1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=DEVICE %s diff --git a/sycl/test-e2e/Adapters/queue_submit_mode.cpp b/sycl/test-e2e/Adapters/queue_submit_mode.cpp index f6a66981a8dd3..52f26c6fd734a 100644 --- a/sycl/test-e2e/Adapters/queue_submit_mode.cpp +++ b/sycl/test-e2e/Adapters/queue_submit_mode.cpp @@ -1,6 +1,4 @@ // REQUIRES: gpu, level_zero -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: v2 adapter does support regular cmd lists // RUN: %{build} %level_zero_options -o %t.out // RUN: env %{l0_leak_check} SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{run} %t.out 0 2>&1 | FileCheck %s --check-prefixes=CHECK-STD // RUN: env %{l0_leak_check} SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{run} %t.out 1 2>&1 | FileCheck %s --check-prefixes=CHECK-IMM From 1e47a4b262b7945ab4e734b39197a2332f186f6e Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Tue, 25 Aug 2026 15:34:39 +0200 Subject: [PATCH 02/27] [SYCL][L0v2] Enable v2 adapter tests --- sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp | 2 -- sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp | 3 --- sycl/test-e2e/Adapters/level_zero/batch_test.cpp | 3 --- .../Adapters/level_zero/batch_test_copy_with_compute.cpp | 3 --- sycl/test-e2e/Adapters/level_zero/device_scope_events.cpp | 2 -- sycl/test-e2e/Adapters/level_zero/dynamic_batch_test.cpp | 2 +- sycl/test-e2e/Adapters/level_zero/eager_init.cpp | 4 ---- sycl/test-e2e/Adapters/level_zero/events_caching.cpp | 2 -- sycl/test-e2e/Adapters/level_zero/imm_cmdlist_per_thread.cpp | 3 --- sycl/test-e2e/Adapters/level_zero/interop-direct.cpp | 3 --- sycl/test-e2e/Adapters/level_zero/memory_fill.cpp | 2 -- sycl/test-e2e/Adapters/level_zero/queue_create.cpp | 2 -- sycl/test-e2e/Graph/NativeCommand/level-zero_usm.cpp | 2 -- sycl/test-e2e/Graph/NativeCommand/level-zero_usm_D2H_copy.cpp | 2 -- sycl/test-e2e/USM/usm_pooling.cpp | 4 ---- 15 files changed, 1 insertion(+), 38 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp b/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp index b48de4c405eff..44ccc56d4a356 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp @@ -1,6 +1,4 @@ // REQUIRES: gpu, level_zero, level_zero_dev_kit -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: v2 adapter does not support regular cmd lists // UNSUPPORTED: windows && gpu-intel-gen12 // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp b/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp index 2bd180eef9b34..2e075beea2547 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp @@ -4,9 +4,6 @@ // UNSUPPORTED: windows && gpu-intel-gen12 // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: v2 adapter does not support regular cmd lists - // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 diff --git a/sycl/test-e2e/Adapters/level_zero/batch_test.cpp b/sycl/test-e2e/Adapters/level_zero/batch_test.cpp index bf0644c36939a..d4921e389f41f 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_test.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_test.cpp @@ -4,9 +4,6 @@ // RUN: %{build} -DUSING_INORDER -o %t.ino.out // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: V1-only; V2 does not preserve zeCommandListClose/ -// zeCommandQueueExecuteCommandLists flush points. // UNSUPPORTED: windows && gpu-intel-gen12 // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp b/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp index d4c076046535a..725d8e5982b1c 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp @@ -1,9 +1,6 @@ // REQUIRES: gpu, level_zero // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: V1-only; V2 does not preserve zeCommandListClose/ -// zeCommandQueueExecuteCommandLists flush points. // UNSUPPORTED: windows && (gpu-intel-gen12 || gpu-intel-dg2) // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/device_scope_events.cpp b/sycl/test-e2e/Adapters/level_zero/device_scope_events.cpp index e7d4950265cad..6e5768f245d3c 100644 --- a/sycl/test-e2e/Adapters/level_zero/device_scope_events.cpp +++ b/sycl/test-e2e/Adapters/level_zero/device_scope_events.cpp @@ -1,8 +1,6 @@ // REQUIRES: gpu, level_zero // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: V1-only // UNSUPPORTED: windows && (gpu-intel-gen12 || gpu-intel-dg2) // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21766 diff --git a/sycl/test-e2e/Adapters/level_zero/dynamic_batch_test.cpp b/sycl/test-e2e/Adapters/level_zero/dynamic_batch_test.cpp index a7051278499f5..a1158ef2f4afa 100644 --- a/sycl/test-e2e/Adapters/level_zero/dynamic_batch_test.cpp +++ b/sycl/test-e2e/Adapters/level_zero/dynamic_batch_test.cpp @@ -1,5 +1,5 @@ // REQUIRES: gpu, level_zero -// UNSUPPORTED: ze_debug, level_zero_v2_adapter +// UNSUPPORTED: ze_debug // UNSUPPORTED-INTENDED: regular-command-list autotuning trace // ("Raising/Lowering QueueBatchSize") is V1-only diff --git a/sycl/test-e2e/Adapters/level_zero/eager_init.cpp b/sycl/test-e2e/Adapters/level_zero/eager_init.cpp index 72044e75ebb19..803907ec2df24 100644 --- a/sycl/test-e2e/Adapters/level_zero/eager_init.cpp +++ b/sycl/test-e2e/Adapters/level_zero/eager_init.cpp @@ -3,10 +3,6 @@ // UNSUPPORTED-INTENDED: ze_debug UR emits summary of leaks that contains // function names that we match in the test. -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: Level Zero v2 adapter performs lazy initialization -// and does not support SYCL_EAGER_INIT=1, which this test requires. - // UNSUPPORTED: windows && gpu-intel-gen12 // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp index 55db76734730a..40e0349f5d356 100644 --- a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp +++ b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp @@ -1,6 +1,4 @@ // REQUIRES: gpu, level_zero -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: v2 adapter does not allow disabling caching // RUN: %{build} -o %t.out diff --git a/sycl/test-e2e/Adapters/level_zero/imm_cmdlist_per_thread.cpp b/sycl/test-e2e/Adapters/level_zero/imm_cmdlist_per_thread.cpp index 6705e0cd71205..d099d53091bdd 100644 --- a/sycl/test-e2e/Adapters/level_zero/imm_cmdlist_per_thread.cpp +++ b/sycl/test-e2e/Adapters/level_zero/imm_cmdlist_per_thread.cpp @@ -1,8 +1,5 @@ // REQUIRES: gpu, level_zero -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: V1-only UR_L0_USE_IMMEDIATE_COMMANDLISTS=1 vs =2 mode - // RUN: %{build} %level_zero_options %threads_lib -o %t.out // RUN: env UR_L0_USE_IMMEDIATE_COMMANDLISTS=1 UR_L0_USE_COPY_ENGINE=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=CHECK-ONE-CMDLIST %s // RUN: env UR_L0_USE_IMMEDIATE_COMMANDLISTS=2 UR_L0_USE_COPY_ENGINE=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=CHECK-PER-THREAD-CMDLIST %s diff --git a/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp b/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp index 88f48457319ef..ffad1d505105b 100644 --- a/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp +++ b/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp @@ -1,9 +1,6 @@ // REQUIRES: level_zero, level_zero_dev_kit // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: V1-only behavior for -// UR_L0_USE_IMMEDIATE_COMMANDLISTS=0/1 // RUN: %{build} %level_zero_options -o %t.out // RUN: env UR_L0_USE_IMMEDIATE_COMMANDLISTS=0 %{run} %t.out diff --git a/sycl/test-e2e/Adapters/level_zero/memory_fill.cpp b/sycl/test-e2e/Adapters/level_zero/memory_fill.cpp index f866cfe10f3ab..55550b000fddb 100644 --- a/sycl/test-e2e/Adapters/level_zero/memory_fill.cpp +++ b/sycl/test-e2e/Adapters/level_zero/memory_fill.cpp @@ -1,6 +1,4 @@ // REQUIRES: gpu, level_zero, level_zero_dev_kit -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: v2 adapter does not allow specifying command queue. // UNSUPPORTED: windows && (gpu-intel-gen12 || gpu-intel-dg2) // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/queue_create.cpp b/sycl/test-e2e/Adapters/level_zero/queue_create.cpp index 141afdeec1218..46158277fd620 100644 --- a/sycl/test-e2e/Adapters/level_zero/queue_create.cpp +++ b/sycl/test-e2e/Adapters/level_zero/queue_create.cpp @@ -1,6 +1,4 @@ // REQUIRES: level_zero, level_zero_dev_kit -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: v2 adapter does not support regular cmd lists // RUN: %{build} %level_zero_options -o %t.out // RUN: env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s // diff --git a/sycl/test-e2e/Graph/NativeCommand/level-zero_usm.cpp b/sycl/test-e2e/Graph/NativeCommand/level-zero_usm.cpp index 71e302de64987..be00c0868287e 100644 --- a/sycl/test-e2e/Graph/NativeCommand/level-zero_usm.cpp +++ b/sycl/test-e2e/Graph/NativeCommand/level-zero_usm.cpp @@ -2,8 +2,6 @@ // RUN: %{run} %t.out // REQUIRES: level_zero, level_zero_dev_kit -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/17847 #include #include diff --git a/sycl/test-e2e/Graph/NativeCommand/level-zero_usm_D2H_copy.cpp b/sycl/test-e2e/Graph/NativeCommand/level-zero_usm_D2H_copy.cpp index 3be277f308ae2..2dc16f3effe85 100644 --- a/sycl/test-e2e/Graph/NativeCommand/level-zero_usm_D2H_copy.cpp +++ b/sycl/test-e2e/Graph/NativeCommand/level-zero_usm_D2H_copy.cpp @@ -7,8 +7,6 @@ // // REQUIRES: aspect-usm_host_allocations -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/17847 #include #include diff --git a/sycl/test-e2e/USM/usm_pooling.cpp b/sycl/test-e2e/USM/usm_pooling.cpp index 8c9582e3808ab..e0e10366ec8fb 100644 --- a/sycl/test-e2e/USM/usm_pooling.cpp +++ b/sycl/test-e2e/USM/usm_pooling.cpp @@ -1,10 +1,6 @@ // REQUIRES: level_zero // RUN: %{build} -o %t.out -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: memory allocation logs are not emitted in -// level_zero_v2_adapter - // UNSUPPORTED: windows // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 From a833509f0fab1de2de2913e028ec1f2322dfcee3 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Tue, 8 Sep 2026 15:20:57 +0200 Subject: [PATCH 03/27] [SYCL][L0v2] Fix low-effort v2 test mismatches - v2/usm.cpp: recognize legacy SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR(_TRACE) env vars as fallback for UR_L0_USM_ALLOCATOR(_TRACE), matching the v1 adapter's existing dual-name precedent. Fixes usm_pooling.cpp which only sets the legacy env var name. - queue_submit_mode.cpp: v2 out-of-order immediate queues create a fixed numCommandLists=4 immediate command lists (see queue_immediate_out_of_order.hpp), not 2. Add v2-specific CHECK. - queue_create.cpp: default (out-of-order) queue on v2 never calls zeCommandQueueCreate directly; it creates 4 immediate command lists once via the command list cache. Add v2-specific CHECK verifying a single set of command lists is created/destroyed for the whole run. --- sycl/test-e2e/Adapters/level_zero/queue_create.cpp | 7 ++++++- sycl/test-e2e/Adapters/queue_submit_mode.cpp | 5 ++++- .../source/adapters/level_zero/v2/usm.cpp | 13 +++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/queue_create.cpp b/sycl/test-e2e/Adapters/level_zero/queue_create.cpp index 46158277fd620..39dc03b5f79a2 100644 --- a/sycl/test-e2e/Adapters/level_zero/queue_create.cpp +++ b/sycl/test-e2e/Adapters/level_zero/queue_create.cpp @@ -1,8 +1,13 @@ // REQUIRES: level_zero, level_zero_dev_kit // RUN: %{build} %level_zero_options -o %t.out -// RUN: env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s +// RUN: env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --check-prefixes=%if level_zero_v2_adapter %{CHECK-V2%} %else %{CHECK%} // // CHECK: zeCommandQueueCreate = 1 \---> zeCommandQueueDestroy = 1 +// v2 has no regular command queue/list for a default (out-of-order, +// immediate) queue; it creates a fixed number (numCommandLists = 4) of +// immediate command lists once, reused for all 1000 submissions. +// CHECK-V2: zeCommandListCreateImmediate = 4 +// CHECK-V2: zeCommandListCreate = 0 \---> zeCommandListDestroy = 4 // The test is to check that there is only a single level zero queue created // with the embedded UR_L0_LEAKS_DEBUG=1 testing capability. // diff --git a/sycl/test-e2e/Adapters/queue_submit_mode.cpp b/sycl/test-e2e/Adapters/queue_submit_mode.cpp index 52f26c6fd734a..ddd7f8d0f17a8 100644 --- a/sycl/test-e2e/Adapters/queue_submit_mode.cpp +++ b/sycl/test-e2e/Adapters/queue_submit_mode.cpp @@ -1,7 +1,7 @@ // REQUIRES: gpu, level_zero // RUN: %{build} %level_zero_options -o %t.out // RUN: env %{l0_leak_check} SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{run} %t.out 0 2>&1 | FileCheck %s --check-prefixes=CHECK-STD -// RUN: env %{l0_leak_check} SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{run} %t.out 1 2>&1 | FileCheck %s --check-prefixes=CHECK-IMM +// RUN: env %{l0_leak_check} SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{run} %t.out 1 2>&1 | FileCheck %s --check-prefixes=%if level_zero_v2_adapter %{CHECK-IMM-V2%} %else %{CHECK-IMM%} // // UNSUPPORTED: target-native_cpu // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/20142 @@ -36,6 +36,9 @@ int main(int argc, char *argv[]) { // CHECK-STD: zeCommandListCreateImmediate = 1 // CHECK-IMM: zeCommandListCreateImmediate = 2 + // v2 out-of-order immediate queues always create a fixed number + // (numCommandLists = 4) of immediate command lists. + // CHECK-IMM-V2: zeCommandListCreateImmediate = 4 queue Q1{P}; queue_submit(Q1); diff --git a/unified-runtime/source/adapters/level_zero/v2/usm.cpp b/unified-runtime/source/adapters/level_zero/v2/usm.cpp index 770d2488f6220..78f53a2a6835f 100644 --- a/unified-runtime/source/adapters/level_zero/v2/usm.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/usm.cpp @@ -36,11 +36,20 @@ initializeDisjointPoolConfig() { } int PoolTrace = 0; - if (auto PoolUrTraceVal = std::getenv("UR_L0_USM_ALLOCATOR_TRACE")) { - PoolTrace = std::atoi(PoolUrTraceVal); + const char *PoolTraceVal = std::getenv("UR_L0_USM_ALLOCATOR_TRACE"); + if (!PoolTraceVal) { + PoolTraceVal = std::getenv("SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR_TRACE"); + } + if (PoolTraceVal) { + PoolTrace = std::atoi(PoolTraceVal); } const char *PoolUrConfigVal = std::getenv("UR_L0_USM_ALLOCATOR"); + if (!PoolUrConfigVal) { + // Fall back to the legacy PI env var name for compatibility with + // existing tests/tools that predate the UR naming. + PoolUrConfigVal = std::getenv("SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR"); + } if (PoolUrConfigVal == nullptr) { return usm::DisjointPoolAllConfigs(PoolTrace); } From f41d40ca5c52e0443b3684ebc4ba37bcd252c78d Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Fri, 11 Sep 2026 10:07:19 +0200 Subject: [PATCH 04/27] [SYCL][L0v2] Fix imm_cmdlist_per_thread.cpp v2 CHECK v2 always creates numCommandLists=4 immediate command lists for an out-of-order queue (queue_immediate_out_of_order.hpp), ignoring the legacy UR_L0_USE_IMMEDIATE_COMMANDLISTS=1 vs =2 mode distinction. CI confirmed: zeCommandListCreateImmediate = 4 for the mode=1 case where v1/the test expected 2. --- .../test-e2e/Adapters/level_zero/imm_cmdlist_per_thread.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sycl/test-e2e/Adapters/level_zero/imm_cmdlist_per_thread.cpp b/sycl/test-e2e/Adapters/level_zero/imm_cmdlist_per_thread.cpp index d099d53091bdd..6717377d01cc3 100644 --- a/sycl/test-e2e/Adapters/level_zero/imm_cmdlist_per_thread.cpp +++ b/sycl/test-e2e/Adapters/level_zero/imm_cmdlist_per_thread.cpp @@ -1,13 +1,17 @@ // REQUIRES: gpu, level_zero // RUN: %{build} %level_zero_options %threads_lib -o %t.out -// RUN: env UR_L0_USE_IMMEDIATE_COMMANDLISTS=1 UR_L0_USE_COPY_ENGINE=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=CHECK-ONE-CMDLIST %s +// RUN: env UR_L0_USE_IMMEDIATE_COMMANDLISTS=1 UR_L0_USE_COPY_ENGINE=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=%if level_zero_v2_adapter %{CHECK-ONE-CMDLIST-V2%} %else %{CHECK-ONE-CMDLIST%} %s // RUN: env UR_L0_USE_IMMEDIATE_COMMANDLISTS=2 UR_L0_USE_COPY_ENGINE=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=CHECK-PER-THREAD-CMDLIST %s // The test checks that immediate commandlists are created per-thread. // One immediate commandlist is created for device init, the rest for the queue. // CHECK-ONE-CMDLIST: zeCommandListCreateImmediate = 2 +// v2 always creates a fixed number (numCommandLists = 4) of immediate +// command lists for an out-of-order queue, ignoring the legacy per-thread +// command list mode selector. +// CHECK-ONE-CMDLIST-V2: zeCommandListCreateImmediate = 4 // CHECK-PER-THREAD-CMDLIST: zeCommandListCreateImmediate = 4 #include #include From b2f498816e753bd6a572c603a6a0382fa0d46778 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Fri, 11 Sep 2026 11:59:20 +0200 Subject: [PATCH 05/27] Revert: [SYCL][L0v2] Fix imm_cmdlist_per_thread.cpp v2 CHECK --- .../Adapters/level_zero/imm_cmdlist_per_thread.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/imm_cmdlist_per_thread.cpp b/sycl/test-e2e/Adapters/level_zero/imm_cmdlist_per_thread.cpp index 6717377d01cc3..6705e0cd71205 100644 --- a/sycl/test-e2e/Adapters/level_zero/imm_cmdlist_per_thread.cpp +++ b/sycl/test-e2e/Adapters/level_zero/imm_cmdlist_per_thread.cpp @@ -1,17 +1,16 @@ // REQUIRES: gpu, level_zero +// UNSUPPORTED: level_zero_v2_adapter +// UNSUPPORTED-INTENDED: V1-only UR_L0_USE_IMMEDIATE_COMMANDLISTS=1 vs =2 mode + // RUN: %{build} %level_zero_options %threads_lib -o %t.out -// RUN: env UR_L0_USE_IMMEDIATE_COMMANDLISTS=1 UR_L0_USE_COPY_ENGINE=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=%if level_zero_v2_adapter %{CHECK-ONE-CMDLIST-V2%} %else %{CHECK-ONE-CMDLIST%} %s +// RUN: env UR_L0_USE_IMMEDIATE_COMMANDLISTS=1 UR_L0_USE_COPY_ENGINE=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=CHECK-ONE-CMDLIST %s // RUN: env UR_L0_USE_IMMEDIATE_COMMANDLISTS=2 UR_L0_USE_COPY_ENGINE=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=CHECK-PER-THREAD-CMDLIST %s // The test checks that immediate commandlists are created per-thread. // One immediate commandlist is created for device init, the rest for the queue. // CHECK-ONE-CMDLIST: zeCommandListCreateImmediate = 2 -// v2 always creates a fixed number (numCommandLists = 4) of immediate -// command lists for an out-of-order queue, ignoring the legacy per-thread -// command list mode selector. -// CHECK-ONE-CMDLIST-V2: zeCommandListCreateImmediate = 4 // CHECK-PER-THREAD-CMDLIST: zeCommandListCreateImmediate = 4 #include #include From 294ffe834567048adca5417a8e90a00c0e6a8f92 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Fri, 11 Sep 2026 12:51:31 +0200 Subject: [PATCH 06/27] [SYCL][L0v2] Enable 4 verified L0v2 tests, revert the rest to UNSUPPORTED Keep enabled (CI-confirmed working on BMG/PVC/Arc Linux + BMG Windows, with v2-specific CHECK/adapter-log additions where needed): - Adapters/level_zero/queue_create.cpp - Adapters/queue_submit_mode.cpp - Adapters/level_zero/queue_priority.cpp (+ small v2 adapter log addition in command_list_cache.cpp so the resolved priority is observable) - Adapters/level_zero/interop-direct.cpp (+ new v2-only build variant exercising the make_queue() model v2 actually supports) Revert to UNSUPPORTED: level_zero_v2_adapter (confirmed still failing/ timing out on v2, or false-positive passes not indicating real support): - Adapters/level_zero/batch_barrier.cpp - Adapters/level_zero/batch_event_status.cpp - Adapters/level_zero/batch_test.cpp - Adapters/level_zero/batch_test_copy_with_compute.cpp - Adapters/level_zero/device_scope_events.cpp - Adapters/level_zero/dynamic_batch_test.cpp - Adapters/level_zero/eager_init.cpp (passes only because v2 always eagerly creates its immediate command lists, not because it honors SYCL_EAGER_INIT) - Adapters/level_zero/events_caching.cpp - Adapters/level_zero/imm_cmdlist_per_thread.cpp (relies on v2's hardcoded numCommandLists=4, an internal detail not a stable contract) - Adapters/level_zero/memory_fill.cpp - Adapters/level_zero/usm_residency.cpp - Graph/NativeCommand/level-zero_usm.cpp - Graph/NativeCommand/level-zero_usm_D2H_copy.cpp - USM/usm_pooling.cpp --- .../Adapters/level_zero/batch_barrier.cpp | 2 + .../level_zero/batch_event_status.cpp | 3 ++ .../Adapters/level_zero/batch_test.cpp | 3 ++ .../batch_test_copy_with_compute.cpp | 3 ++ .../level_zero/device_scope_events.cpp | 2 + .../level_zero/dynamic_batch_test.cpp | 2 +- .../Adapters/level_zero/eager_init.cpp | 4 ++ .../Adapters/level_zero/events_caching.cpp | 2 + .../Adapters/level_zero/interop-direct.cpp | 38 ++++++++++++++++--- .../Adapters/level_zero/memory_fill.cpp | 2 + .../Adapters/level_zero/queue_create.cpp | 16 ++++++-- .../Adapters/level_zero/queue_priority.cpp | 16 +++++++- .../Adapters/level_zero/usm_residency.cpp | 2 + .../Graph/NativeCommand/level-zero_usm.cpp | 2 + .../NativeCommand/level-zero_usm_D2H_copy.cpp | 2 + sycl/test-e2e/USM/usm_pooling.cpp | 4 ++ .../level_zero/v2/command_list_cache.cpp | 16 +++++++- 17 files changed, 104 insertions(+), 15 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp b/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp index 44ccc56d4a356..b48de4c405eff 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp @@ -1,4 +1,6 @@ // REQUIRES: gpu, level_zero, level_zero_dev_kit +// UNSUPPORTED: level_zero_v2_adapter +// UNSUPPORTED-INTENDED: v2 adapter does not support regular cmd lists // UNSUPPORTED: windows && gpu-intel-gen12 // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp b/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp index 2e075beea2547..2bd180eef9b34 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp @@ -4,6 +4,9 @@ // UNSUPPORTED: windows && gpu-intel-gen12 // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 +// UNSUPPORTED: level_zero_v2_adapter +// UNSUPPORTED-INTENDED: v2 adapter does not support regular cmd lists + // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 diff --git a/sycl/test-e2e/Adapters/level_zero/batch_test.cpp b/sycl/test-e2e/Adapters/level_zero/batch_test.cpp index d4921e389f41f..bf0644c36939a 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_test.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_test.cpp @@ -4,6 +4,9 @@ // RUN: %{build} -DUSING_INORDER -o %t.ino.out // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 +// UNSUPPORTED: level_zero_v2_adapter +// UNSUPPORTED-INTENDED: V1-only; V2 does not preserve zeCommandListClose/ +// zeCommandQueueExecuteCommandLists flush points. // UNSUPPORTED: windows && gpu-intel-gen12 // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp b/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp index 725d8e5982b1c..d4c076046535a 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp @@ -1,6 +1,9 @@ // REQUIRES: gpu, level_zero // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 +// UNSUPPORTED: level_zero_v2_adapter +// UNSUPPORTED-INTENDED: V1-only; V2 does not preserve zeCommandListClose/ +// zeCommandQueueExecuteCommandLists flush points. // UNSUPPORTED: windows && (gpu-intel-gen12 || gpu-intel-dg2) // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/device_scope_events.cpp b/sycl/test-e2e/Adapters/level_zero/device_scope_events.cpp index 6e5768f245d3c..e7d4950265cad 100644 --- a/sycl/test-e2e/Adapters/level_zero/device_scope_events.cpp +++ b/sycl/test-e2e/Adapters/level_zero/device_scope_events.cpp @@ -1,6 +1,8 @@ // REQUIRES: gpu, level_zero // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 +// UNSUPPORTED: level_zero_v2_adapter +// UNSUPPORTED-INTENDED: V1-only // UNSUPPORTED: windows && (gpu-intel-gen12 || gpu-intel-dg2) // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21766 diff --git a/sycl/test-e2e/Adapters/level_zero/dynamic_batch_test.cpp b/sycl/test-e2e/Adapters/level_zero/dynamic_batch_test.cpp index a1158ef2f4afa..a7051278499f5 100644 --- a/sycl/test-e2e/Adapters/level_zero/dynamic_batch_test.cpp +++ b/sycl/test-e2e/Adapters/level_zero/dynamic_batch_test.cpp @@ -1,5 +1,5 @@ // REQUIRES: gpu, level_zero -// UNSUPPORTED: ze_debug +// UNSUPPORTED: ze_debug, level_zero_v2_adapter // UNSUPPORTED-INTENDED: regular-command-list autotuning trace // ("Raising/Lowering QueueBatchSize") is V1-only diff --git a/sycl/test-e2e/Adapters/level_zero/eager_init.cpp b/sycl/test-e2e/Adapters/level_zero/eager_init.cpp index 803907ec2df24..692c262837ba8 100644 --- a/sycl/test-e2e/Adapters/level_zero/eager_init.cpp +++ b/sycl/test-e2e/Adapters/level_zero/eager_init.cpp @@ -3,6 +3,10 @@ // UNSUPPORTED-INTENDED: ze_debug UR emits summary of leaks that contains // function names that we match in the test. +// UNSUPPORTED: level_zero_v2_adapter +// UNSUPPORTED-INTENDED: L0v2 does not consume SYCL_EAGER_INIT/UR_L0_EAGER_INIT; +// queue execution resources are initialized eagerly by design. + // UNSUPPORTED: windows && gpu-intel-gen12 // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp index 40e0349f5d356..55db76734730a 100644 --- a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp +++ b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp @@ -1,4 +1,6 @@ // REQUIRES: gpu, level_zero +// UNSUPPORTED: level_zero_v2_adapter +// UNSUPPORTED-INTENDED: v2 adapter does not allow disabling caching // RUN: %{build} -o %t.out diff --git a/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp b/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp index ffad1d505105b..ade795218ed24 100644 --- a/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp +++ b/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp @@ -3,8 +3,18 @@ // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 // RUN: %{build} %level_zero_options -o %t.out -// RUN: env UR_L0_USE_IMMEDIATE_COMMANDLISTS=0 %{run} %t.out -// RUN: env UR_L0_USE_IMMEDIATE_COMMANDLISTS=1 %{run} %t.out +// RUN: %if !level_zero_v2_adapter %{env UR_L0_USE_IMMEDIATE_COMMANDLISTS=0 %{run} %t.out%} +// RUN: %if !level_zero_v2_adapter %{env UR_L0_USE_IMMEDIATE_COMMANDLISTS=1 %{run} %t.out%} +// +// Per sycl_ext_oneapi_backend_level_zero.md, when using the L0v2 adapter +// make_queue() only accepts an in-order ze_command_list_handle_t (wrapping a +// bare ze_command_queue_handle_t is not supported and is explicitly rejected +// with UR_RESULT_ERROR_UNSUPPORTED_FEATURE, see +// urQueueCreateWithNativeHandle in v2/queue_create.cpp). So v2 gets its own +// build/run exercising only the interop model it actually supports, instead +// of reusing the v1 command-queue-wrapping variants above. +// RUN: %if level_zero_v2_adapter %{%{build} %level_zero_options -DTEST_LEVEL_ZERO_V2_NATIVE_INTEROP -o %t_v2.out%} +// RUN: %if level_zero_v2_adapter %{%{run} %t_v2.out%} #include #include @@ -79,7 +89,12 @@ int main() { Qdescriptor.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS; Qdescriptor.ordinal = 0; Qdescriptor.index = 0; +#ifdef TEST_LEVEL_ZERO_V2_NATIVE_INTEROP + // L0v2 only supports wrapping an in-order immediate command list. + Qdescriptor.flags = ZE_COMMAND_QUEUE_FLAG_IN_ORDER; +#endif +#ifndef TEST_LEVEL_ZERO_V2_NATIVE_INTEROP ze_command_queue_handle_t ZeCommand_queue = nullptr; result = zeCommandQueueCreate(ZeContext, ZeDevices[0], &Qdescriptor, &ZeCommand_queue); @@ -88,6 +103,7 @@ int main() { return 1; } std::cout << "Commandqueue created: " << ZeCommand_queue << std::endl; +#endif // Create Command List ze_command_list_handle_t ZeCommand_list = nullptr; @@ -122,6 +138,7 @@ int main() { make_context(InteropContextInput); std::cout << "Made context\n"; +#ifndef TEST_LEVEL_ZERO_V2_NATIVE_INTEROP backend_input_t InteropQueueInputCQ{ ZeCommand_queue, InteropDevice, ext::oneapi::level_zero::ownership::keep}; queue InteropQueueCQ = make_queue( @@ -146,6 +163,7 @@ int main() { return 1; } } +#endif backend_input_t InteropQueueInputCL{ ZeCommand_list, InteropDevice, ext::oneapi::level_zero::ownership::keep}; @@ -171,6 +189,14 @@ int main() { return 1; } + // On v2 there is no interop queue wrapping a bare command queue, so the + // command-list-backed interop queue is used for both loop sections below. +#ifdef TEST_LEVEL_ZERO_V2_NATIVE_INTEROP + queue &InteropQueueForOps = InteropQueueCL; +#else + queue &InteropQueueForOps = InteropQueueCQ; +#endif + int data[3] = {7, 8, 0}; buffer bufData{data, 3}; buffer bufDataCQ{data, 3}; @@ -200,8 +226,8 @@ int main() { << hostOut[1] << ", " << hostOut[2] << "}" << std::endl; // Try interop queue with standard commandlist - InteropQueueCQ.copy(addend, deviceData, 2).wait(); - InteropQueueCQ.submit([&](handler &cgh) { + InteropQueueForOps.copy(addend, deviceData, 2).wait(); + InteropQueueForOps.submit([&](handler &cgh) { accessor numbers{bufDataCQ, cgh, read_write}; cgh.parallel_for(dataCount, [=](id<1> Id) { numbers[Id] += deviceData[0]; }); @@ -211,8 +237,8 @@ int main() { << hostOut[1] << ", " << hostOut[2] << "}" << std::endl; // Try interop queue with immediate commandlist - InteropQueueCQ.copy(addend, deviceData, 2).wait(); - InteropQueueCQ.submit([&](handler &cgh) { + InteropQueueForOps.copy(addend, deviceData, 2).wait(); + InteropQueueForOps.submit([&](handler &cgh) { accessor numbers{bufDataCL, cgh, read_write}; cgh.single_task( [=]() { numbers[2] += numbers[0] + numbers[1] + deviceData[1]; }); diff --git a/sycl/test-e2e/Adapters/level_zero/memory_fill.cpp b/sycl/test-e2e/Adapters/level_zero/memory_fill.cpp index 55550b000fddb..f866cfe10f3ab 100644 --- a/sycl/test-e2e/Adapters/level_zero/memory_fill.cpp +++ b/sycl/test-e2e/Adapters/level_zero/memory_fill.cpp @@ -1,4 +1,6 @@ // REQUIRES: gpu, level_zero, level_zero_dev_kit +// UNSUPPORTED: level_zero_v2_adapter +// UNSUPPORTED-INTENDED: v2 adapter does not allow specifying command queue. // UNSUPPORTED: windows && (gpu-intel-gen12 || gpu-intel-dg2) // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/queue_create.cpp b/sycl/test-e2e/Adapters/level_zero/queue_create.cpp index 39dc03b5f79a2..142511f18f613 100644 --- a/sycl/test-e2e/Adapters/level_zero/queue_create.cpp +++ b/sycl/test-e2e/Adapters/level_zero/queue_create.cpp @@ -2,14 +2,22 @@ // RUN: %{build} %level_zero_options -o %t.out // RUN: env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --check-prefixes=%if level_zero_v2_adapter %{CHECK-V2%} %else %{CHECK%} // +// The test checks that the Level Zero execution resources associated with a +// SYCL queue are created once and reused across all 1000 submissions, +// rather than being recreated per-submission, using the embedded +// UR_L0_LEAKS_DEBUG=1 testing capability. +// +// v1 creates a single regular command queue for the whole run: // CHECK: zeCommandQueueCreate = 1 \---> zeCommandQueueDestroy = 1 +// // v2 has no regular command queue/list for a default (out-of-order, -// immediate) queue; it creates a fixed number (numCommandLists = 4) of -// immediate command lists once, reused for all 1000 submissions. +// immediate) queue. Instead it creates a fixed-size pool of immediate +// command lists (numCommandLists = 4, see +// queue_immediate_out_of_order.hpp) once, reused for all submissions. +// This exact count is an adapter implementation detail, not a public +// API contract; this is a white-box check of v2's current behavior. // CHECK-V2: zeCommandListCreateImmediate = 4 // CHECK-V2: zeCommandListCreate = 0 \---> zeCommandListDestroy = 4 -// The test is to check that there is only a single level zero queue created -// with the embedded UR_L0_LEAKS_DEBUG=1 testing capability. // #include diff --git a/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp b/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp index 14d83cc64bd3b..03e3a20297642 100644 --- a/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp +++ b/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp @@ -1,13 +1,21 @@ // REQUIRES: gpu, level_zero, level_zero_dev_kit // RUN: %{build} %level_zero_options -o %t.out -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{run} %t.out 2>&1 | FileCheck %s --check-prefixes=CHECK-STD -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{run} %t.out 2>&1 | FileCheck %s --check-prefixes=CHECK-IMM +// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{run} %t.out 2>&1 | FileCheck %s --check-prefixes=%if level_zero_v2_adapter %{CHECK-V2%} %else %{CHECK-STD%} +// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{run} %t.out 2>&1 | FileCheck %s --check-prefixes=%if level_zero_v2_adapter %{CHECK-V2%} %else %{CHECK-IMM%} // // Check that queue priority is passed to Level Zero runtime // This is the last value in the ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC // // With immediate command lists the command lists are recycled between queues in // a context. +// +// SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS is a v1-only selector between +// regular (CHECK-STD) and immediate (CHECK-IMM) command lists; v2 always uses +// immediate command lists and does not read this variable, so both RUN lines +// exercise the same v2 code path (CHECK-V2). v2 propagates priority to the +// L0 command queue descriptor the same way v1 does (see getZePriority() in +// queue_create.cpp), but logs it as part of command list creation instead of +// a "[getZeQueue]" line. #include #include #include @@ -26,6 +34,7 @@ int main(int Argc, const char *Argv[]) { // CHECK-STD: [getZeQueue]: create queue {{.*}} priority = Normal // CHECK-IMM: [getZeQueue]: create queue {{.*}} priority = Normal + // CHECK-V2: create command list ordinal: {{.*}} priority: Normal test(C, D, sycl::property_list{}); // CHECK-STD: [getZeQueue]: create queue {{.*}} priority = Normal @@ -35,14 +44,17 @@ int main(int Argc, const char *Argv[]) { // CHECK-STD: [getZeQueue]: create queue {{.*}} priority = Low // CHECK-IMM: [getZeQueue]: create queue {{.*}} priority = Low + // CHECK-V2: create command list ordinal: {{.*}} priority: Low test(C, D, {sycl::ext::oneapi::property::queue::priority_low{}}); // CHECK-STD: [getZeQueue]: create queue {{.*}} priority = High // CHECK-IMM: [getZeQueue]: create queue {{.*}} priority = High + // CHECK-V2: create command list ordinal: {{.*}} priority: High test(C, D, {sycl::ext::oneapi::property::queue::priority_high{}}); // CHECK-STD: Queue cannot be constructed with different priorities. // CHECK-IMM: Queue cannot be constructed with different priorities. + // CHECK-V2: Queue cannot be constructed with different priorities. try { test(C, D, {sycl::ext::oneapi::property::queue::priority_low{}, diff --git a/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp b/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp index 3716809c8b499..10090142e0470 100644 --- a/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp +++ b/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp @@ -1,4 +1,6 @@ // REQUIRES: gpu, level_zero +// UNSUPPORTED: level_zero_v2_adapter +// UNSUPPORTED-INTENDED: v2 adapter does not support changing residency. // RUN: %{build} %level_zero_options -o %t.out // RUN: env SYCL_UR_TRACE=2 UR_L0_DEBUG=-1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=DEVICE %s diff --git a/sycl/test-e2e/Graph/NativeCommand/level-zero_usm.cpp b/sycl/test-e2e/Graph/NativeCommand/level-zero_usm.cpp index be00c0868287e..71e302de64987 100644 --- a/sycl/test-e2e/Graph/NativeCommand/level-zero_usm.cpp +++ b/sycl/test-e2e/Graph/NativeCommand/level-zero_usm.cpp @@ -2,6 +2,8 @@ // RUN: %{run} %t.out // REQUIRES: level_zero, level_zero_dev_kit +// UNSUPPORTED: level_zero_v2_adapter +// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/17847 #include #include diff --git a/sycl/test-e2e/Graph/NativeCommand/level-zero_usm_D2H_copy.cpp b/sycl/test-e2e/Graph/NativeCommand/level-zero_usm_D2H_copy.cpp index 2dc16f3effe85..3be277f308ae2 100644 --- a/sycl/test-e2e/Graph/NativeCommand/level-zero_usm_D2H_copy.cpp +++ b/sycl/test-e2e/Graph/NativeCommand/level-zero_usm_D2H_copy.cpp @@ -7,6 +7,8 @@ // // REQUIRES: aspect-usm_host_allocations +// UNSUPPORTED: level_zero_v2_adapter +// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/17847 #include #include diff --git a/sycl/test-e2e/USM/usm_pooling.cpp b/sycl/test-e2e/USM/usm_pooling.cpp index e0e10366ec8fb..8c9582e3808ab 100644 --- a/sycl/test-e2e/USM/usm_pooling.cpp +++ b/sycl/test-e2e/USM/usm_pooling.cpp @@ -1,6 +1,10 @@ // REQUIRES: level_zero // RUN: %{build} -o %t.out +// UNSUPPORTED: level_zero_v2_adapter +// UNSUPPORTED-INTENDED: memory allocation logs are not emitted in +// level_zero_v2_adapter + // UNSUPPORTED: windows // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/unified-runtime/source/adapters/level_zero/v2/command_list_cache.cpp b/unified-runtime/source/adapters/level_zero/v2/command_list_cache.cpp index 913eb02e7a6fc..41ac34787cf72 100644 --- a/unified-runtime/source/adapters/level_zero/v2/command_list_cache.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/command_list_cache.cpp @@ -98,6 +98,17 @@ static bool ForceDisableCopyOffload = [] { return getenv_tobool("UR_L0_V2_FORCE_DISABLE_COPY_OFFLOAD"); }(); +static const char *priorityToString(ze_command_queue_priority_t Priority) { + switch (Priority) { + case ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW: + return "Low"; + case ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH: + return "High"; + default: + return "Normal"; + } +} + raii::ze_command_list_handle_t command_list_cache_t::createCommandList(const command_list_descriptor_t &desc) { ZexStruct @@ -142,8 +153,9 @@ command_list_cache_t::createCommandList(const command_list_descriptor_t &desc) { UR_LOG(DEBUG, "create command list ordinal: {}, type: immediate, " - "device: {}, inOrder: {}", - ImmCmdDesc->Ordinal, ImmCmdDesc->ZeDevice, ImmCmdDesc->IsInOrder); + "device: {}, inOrder: {}, priority: {}", + ImmCmdDesc->Ordinal, ImmCmdDesc->ZeDevice, ImmCmdDesc->IsInOrder, + priorityToString(ImmCmdDesc->Priority)); ZE2UR_CALL_THROWS( zeCommandListCreateImmediate, From 4775f0d2c79adec17064df78c04cca7ced8826a9 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Fri, 11 Sep 2026 13:25:12 +0200 Subject: [PATCH 07/27] [SYCL][L0v2] Comment cleanup: precise and unify UNSUPPORTED-INTENDED wording --- .../Adapters/level_zero/batch_barrier.cpp | 2 +- .../Adapters/level_zero/batch_event_status.cpp | 2 +- sycl/test-e2e/Adapters/level_zero/batch_test.cpp | 3 +-- .../level_zero/batch_test_copy_with_compute.cpp | 3 +-- .../Adapters/level_zero/device_scope_events.cpp | 2 +- .../Adapters/level_zero/events_caching.cpp | 3 ++- .../Adapters/level_zero/interop-direct.cpp | 16 ++++------------ .../test-e2e/Adapters/level_zero/memory_fill.cpp | 3 ++- .../Adapters/level_zero/queue_create.cpp | 7 +------ sycl/test-e2e/Adapters/queue_submit_mode.cpp | 3 +-- 10 files changed, 15 insertions(+), 29 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp b/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp index b48de4c405eff..cd0ce57638253 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp @@ -1,6 +1,6 @@ // REQUIRES: gpu, level_zero, level_zero_dev_kit // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: v2 adapter does not support regular cmd lists +// UNSUPPORTED-INTENDED: regular command-list batching is V1-only. // UNSUPPORTED: windows && gpu-intel-gen12 // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp b/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp index 2bd180eef9b34..0613162992bae 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp @@ -5,7 +5,7 @@ // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: v2 adapter does not support regular cmd lists +// UNSUPPORTED-INTENDED: regular command-list batching is V1-only. // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 diff --git a/sycl/test-e2e/Adapters/level_zero/batch_test.cpp b/sycl/test-e2e/Adapters/level_zero/batch_test.cpp index bf0644c36939a..9a33dc5eb44b8 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_test.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_test.cpp @@ -5,8 +5,7 @@ // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: V1-only; V2 does not preserve zeCommandListClose/ -// zeCommandQueueExecuteCommandLists flush points. +// UNSUPPORTED-INTENDED: regular command-list batching is V1-only. // UNSUPPORTED: windows && gpu-intel-gen12 // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp b/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp index d4c076046535a..1e590e6ac587e 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp @@ -2,8 +2,7 @@ // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: V1-only; V2 does not preserve zeCommandListClose/ -// zeCommandQueueExecuteCommandLists flush points. +// UNSUPPORTED-INTENDED: regular command-list batching is V1-only. // UNSUPPORTED: windows && (gpu-intel-gen12 || gpu-intel-dg2) // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/device_scope_events.cpp b/sycl/test-e2e/Adapters/level_zero/device_scope_events.cpp index e7d4950265cad..b31de3e961122 100644 --- a/sycl/test-e2e/Adapters/level_zero/device_scope_events.cpp +++ b/sycl/test-e2e/Adapters/level_zero/device_scope_events.cpp @@ -2,7 +2,7 @@ // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: V1-only +// UNSUPPORTED-INTENDED: UR_L0_DEVICE_SCOPE_EVENTS is V1-only. // UNSUPPORTED: windows && (gpu-intel-gen12 || gpu-intel-dg2) // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21766 diff --git a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp index 55db76734730a..92d2264ebc41f 100644 --- a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp +++ b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp @@ -1,6 +1,7 @@ // REQUIRES: gpu, level_zero // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: v2 adapter does not allow disabling caching +// UNSUPPORTED-INTENDED: the event-caching control used by this test is +// V1-only. // RUN: %{build} -o %t.out diff --git a/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp b/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp index ade795218ed24..28545e3621ff6 100644 --- a/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp +++ b/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp @@ -6,13 +6,8 @@ // RUN: %if !level_zero_v2_adapter %{env UR_L0_USE_IMMEDIATE_COMMANDLISTS=0 %{run} %t.out%} // RUN: %if !level_zero_v2_adapter %{env UR_L0_USE_IMMEDIATE_COMMANDLISTS=1 %{run} %t.out%} // -// Per sycl_ext_oneapi_backend_level_zero.md, when using the L0v2 adapter -// make_queue() only accepts an in-order ze_command_list_handle_t (wrapping a -// bare ze_command_queue_handle_t is not supported and is explicitly rejected -// with UR_RESULT_ERROR_UNSUPPORTED_FEATURE, see -// urQueueCreateWithNativeHandle in v2/queue_create.cpp). So v2 gets its own -// build/run exercising only the interop model it actually supports, instead -// of reusing the v1 command-queue-wrapping variants above. +// L0v2 make_queue() supports wrapping an in-order immediate command list, +// but not a bare command queue. // RUN: %if level_zero_v2_adapter %{%{build} %level_zero_options -DTEST_LEVEL_ZERO_V2_NATIVE_INTEROP -o %t_v2.out%} // RUN: %if level_zero_v2_adapter %{%{run} %t_v2.out%} @@ -90,7 +85,6 @@ int main() { Qdescriptor.ordinal = 0; Qdescriptor.index = 0; #ifdef TEST_LEVEL_ZERO_V2_NATIVE_INTEROP - // L0v2 only supports wrapping an in-order immediate command list. Qdescriptor.flags = ZE_COMMAND_QUEUE_FLAG_IN_ORDER; #endif @@ -189,8 +183,6 @@ int main() { return 1; } - // On v2 there is no interop queue wrapping a bare command queue, so the - // command-list-backed interop queue is used for both loop sections below. #ifdef TEST_LEVEL_ZERO_V2_NATIVE_INTEROP queue &InteropQueueForOps = InteropQueueCL; #else @@ -225,7 +217,7 @@ int main() { std::cout << "GPU Result from SYCL Q = {" << hostOut[0] << ", " << hostOut[1] << ", " << hostOut[2] << "}" << std::endl; - // Try interop queue with standard commandlist + // Try interop queue (command queue on v1, immediate command list on v2) InteropQueueForOps.copy(addend, deviceData, 2).wait(); InteropQueueForOps.submit([&](handler &cgh) { accessor numbers{bufDataCQ, cgh, read_write}; @@ -236,7 +228,7 @@ int main() { std::cout << "GPU Result from Standard Q = {" << hostOut[0] << ", " << hostOut[1] << ", " << hostOut[2] << "}" << std::endl; - // Try interop queue with immediate commandlist + // Try interop queue again, writing to a separate buffer InteropQueueForOps.copy(addend, deviceData, 2).wait(); InteropQueueForOps.submit([&](handler &cgh) { accessor numbers{bufDataCL, cgh, read_write}; diff --git a/sycl/test-e2e/Adapters/level_zero/memory_fill.cpp b/sycl/test-e2e/Adapters/level_zero/memory_fill.cpp index f866cfe10f3ab..0c5a737879420 100644 --- a/sycl/test-e2e/Adapters/level_zero/memory_fill.cpp +++ b/sycl/test-e2e/Adapters/level_zero/memory_fill.cpp @@ -1,6 +1,7 @@ // REQUIRES: gpu, level_zero, level_zero_dev_kit // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: v2 adapter does not allow specifying command queue. +// UNSUPPORTED-INTENDED: the engine-selection control used by this test is +// V1-only. // UNSUPPORTED: windows && (gpu-intel-gen12 || gpu-intel-dg2) // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/queue_create.cpp b/sycl/test-e2e/Adapters/level_zero/queue_create.cpp index 142511f18f613..085d919c6de70 100644 --- a/sycl/test-e2e/Adapters/level_zero/queue_create.cpp +++ b/sycl/test-e2e/Adapters/level_zero/queue_create.cpp @@ -10,12 +10,7 @@ // v1 creates a single regular command queue for the whole run: // CHECK: zeCommandQueueCreate = 1 \---> zeCommandQueueDestroy = 1 // -// v2 has no regular command queue/list for a default (out-of-order, -// immediate) queue. Instead it creates a fixed-size pool of immediate -// command lists (numCommandLists = 4, see -// queue_immediate_out_of_order.hpp) once, reused for all submissions. -// This exact count is an adapter implementation detail, not a public -// API contract; this is a white-box check of v2's current behavior. +// L0v2 reuses a fixed pool of 4 immediate command lists. // CHECK-V2: zeCommandListCreateImmediate = 4 // CHECK-V2: zeCommandListCreate = 0 \---> zeCommandListDestroy = 4 // diff --git a/sycl/test-e2e/Adapters/queue_submit_mode.cpp b/sycl/test-e2e/Adapters/queue_submit_mode.cpp index ddd7f8d0f17a8..b68f7d6460f7e 100644 --- a/sycl/test-e2e/Adapters/queue_submit_mode.cpp +++ b/sycl/test-e2e/Adapters/queue_submit_mode.cpp @@ -36,8 +36,7 @@ int main(int argc, char *argv[]) { // CHECK-STD: zeCommandListCreateImmediate = 1 // CHECK-IMM: zeCommandListCreateImmediate = 2 - // v2 out-of-order immediate queues always create a fixed number - // (numCommandLists = 4) of immediate command lists. + // L0v2 out-of-order queues use a fixed pool of 4 immediate command lists. // CHECK-IMM-V2: zeCommandListCreateImmediate = 4 queue Q1{P}; queue_submit(Q1); From 78c1bc64561435e7bf44e4d145e8fd9f1797957a Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Fri, 11 Sep 2026 13:34:01 +0200 Subject: [PATCH 08/27] [SYCL][L0v2] Fix interop-direct.cpp: merge v2 build+run into one RUN line --- sycl/test-e2e/Adapters/level_zero/interop-direct.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp b/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp index 28545e3621ff6..9e8c2b2bf8297 100644 --- a/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp +++ b/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp @@ -8,8 +8,7 @@ // // L0v2 make_queue() supports wrapping an in-order immediate command list, // but not a bare command queue. -// RUN: %if level_zero_v2_adapter %{%{build} %level_zero_options -DTEST_LEVEL_ZERO_V2_NATIVE_INTEROP -o %t_v2.out%} -// RUN: %if level_zero_v2_adapter %{%{run} %t_v2.out%} +// RUN: %if level_zero_v2_adapter %{%{build} %level_zero_options -DTEST_LEVEL_ZERO_V2_NATIVE_INTEROP -o %t_v2.out && %{run} %t_v2.out%} #include #include From 7f38e225dbcf07c2ec5aff63f6775b6a4cd6dc45 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Tue, 15 Sep 2026 13:11:04 +0200 Subject: [PATCH 09/27] [SYCL][L0v2] Enable events_caching.cpp for v2 adapter --- .../test-e2e/Adapters/level_zero/events_caching.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp index 92d2264ebc41f..9df6a2da31873 100644 --- a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp +++ b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp @@ -1,20 +1,21 @@ // REQUIRES: gpu, level_zero -// UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: the event-caching control used by this test is -// V1-only. // RUN: %{build} -o %t.out -// RUN: %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=CACHING-ENABLED %s -// RUN: env SYCL_PI_LEVEL_ZERO_DISABLE_EVENTS_CACHING=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=CACHING-ENABLED %s -// RUN: env SYCL_PI_LEVEL_ZERO_DISABLE_EVENTS_CACHING=1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=CACHING-DISABLED %s +// RUN: %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=%if level_zero_v2_adapter %{CHECK-V2%} %else %{CACHING-ENABLED%} %s +// RUN: %if !level_zero_v2_adapter %{env SYCL_PI_LEVEL_ZERO_DISABLE_EVENTS_CACHING=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=CACHING-ENABLED %s%} +// RUN: %if !level_zero_v2_adapter %{env SYCL_PI_LEVEL_ZERO_DISABLE_EVENTS_CACHING=1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=CACHING-DISABLED %s%} // // With events caching we should be reusing them and 9 should be enough. // Might require more than one if previous one hasn't been released by the time // we need a new one. +// +// L0v2 has no on/off switch for event caching, but reuses events via +// zexCounterBasedEventCreate2, so far fewer than 256 creations are expected. // CACHING-ENABLED: zeEventCreate = {{[1-9]}} // CACHING-DISABLED: zeEventCreate = 256 +// CHECK-V2: zexCounterBasedEventCreate2 = {{[1-9][0-9]?}} // Check event caching modes in the L0 adapter. From c21cf332046943425bebc90628ab5904f2588b50 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Tue, 15 Sep 2026 13:11:30 +0200 Subject: [PATCH 10/27] [SYCL][L0v2] Fix interop-direct.cpp: select device via SYCL, not raw index 0 --- .../Adapters/level_zero/interop-direct.cpp | 50 ++++--------------- 1 file changed, 11 insertions(+), 39 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp b/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp index 9e8c2b2bf8297..5bad28acd77d7 100644 --- a/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp +++ b/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp @@ -32,26 +32,14 @@ int main() { return 1; } - // Create Driver - uint32_t driver_handle_count = 0; - result = zeDriverGet(&driver_handle_count, nullptr); - if (result != ZE_RESULT_SUCCESS) { - std::cout << "zeDriverGet failed\n"; - return 1; - } - std::cout << "Found " << driver_handle_count << " driver(s)\n"; - if (driver_handle_count == 0) - return 1; - - std::vector driver_handles(driver_handle_count); - result = zeDriverGet(&driver_handle_count, driver_handles.data()); - if (result != ZE_RESULT_SUCCESS) { - std::cout << "zeDriverGet failed\n"; - return 1; - } - - ze_driver_handle_t ZeDriver = driver_handles[0]; - std::cout << "Using default driver, index 0\n"; + // Respects ONEAPI_DEVICE_SELECTOR, unlike raw zeDriverGet/zeDeviceGet. + device SyclSelectedDevice; + platform SyclSelectedPlatform = SyclSelectedDevice.get_platform(); + ze_driver_handle_t ZeDriver = + get_native(SyclSelectedPlatform); + ze_device_handle_t ZeDevice0 = + get_native(SyclSelectedDevice); + std::cout << "Using SYCL-selected driver and device\n"; // Create Context ze_context_handle_t ZeContext; @@ -61,22 +49,6 @@ int main() { return 1; } - // Create Devices - uint32_t device_count = 0; - result = zeDeviceGet(ZeDriver, &device_count, nullptr); - if (result != ZE_RESULT_SUCCESS) { - std::cout << "zeDeviceGet failed to get count of devices\n"; - return 1; - } - - std::vector ZeDevices(device_count); - result = zeDeviceGet(ZeDriver, &device_count, ZeDevices.data()); - if (result != ZE_RESULT_SUCCESS) { - std::cout << "zeDeviceGet failed to get device handles\n"; - return 1; - } - std::cout << "Using default device, index 0\n"; - // Create Command Queue ze_command_queue_desc_t Qdescriptor = {}; Qdescriptor.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC; @@ -89,7 +61,7 @@ int main() { #ifndef TEST_LEVEL_ZERO_V2_NATIVE_INTEROP ze_command_queue_handle_t ZeCommand_queue = nullptr; - result = zeCommandQueueCreate(ZeContext, ZeDevices[0], &Qdescriptor, + result = zeCommandQueueCreate(ZeContext, ZeDevice0, &Qdescriptor, &ZeCommand_queue); if (result != ZE_RESULT_SUCCESS) { std::cout << "zeCommandQueueCreate failed\n"; @@ -100,7 +72,7 @@ int main() { // Create Command List ze_command_list_handle_t ZeCommand_list = nullptr; - result = zeCommandListCreateImmediate(ZeContext, ZeDevices[0], &Qdescriptor, + result = zeCommandListCreateImmediate(ZeContext, ZeDevice0, &Qdescriptor, &ZeCommand_list); if (result != ZE_RESULT_SUCCESS) { std::cout << "zeCommandListCreate failed\n"; @@ -110,7 +82,7 @@ int main() { // Interop object creation backend_traits::return_type ZeDevice; - ZeDevice = ZeDevices[0]; + ZeDevice = ZeDevice0; backend_input_t InteropPlatformInput{ZeDriver}; From 2e086df78e1a253735f9d46563345c8a7a90f4f0 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Mon, 28 Sep 2026 18:27:44 +0200 Subject: [PATCH 11/27] [SYCL][L0v2] Port merged buffer-aliasing UB fix from #23217 --- .../Adapters/level_zero/interop-direct.cpp | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp b/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp index 5bad28acd77d7..e8c6fc53d7266 100644 --- a/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp +++ b/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp @@ -160,10 +160,12 @@ int main() { queue &InteropQueueForOps = InteropQueueCQ; #endif - int data[3] = {7, 8, 0}; - buffer bufData{data, 3}; - buffer bufDataCQ{data, 3}; - buffer bufDataCL{data, 3}; + int dataSycl[3] = {7, 8, 0}; + int dataCQ[3] = {7, 8, 0}; + int dataCL[3] = {7, 8, 0}; + buffer bufData{dataSycl, 3}; + buffer bufDataCQ{dataCQ, 3}; + buffer bufDataCL{dataCL, 3}; range<1> dataCount{3}; queue SyclQueue; @@ -196,29 +198,35 @@ int main() { [=](id<1> Id) { numbers[Id] += deviceData[0]; }); }); host_accessor hostOutCQ{bufDataCQ, read_only}; - std::cout << "GPU Result from Standard Q = {" << hostOut[0] << ", " - << hostOut[1] << ", " << hostOut[2] << "}" << std::endl; + std::cout << "GPU Result from Standard Q = {" << hostOutCQ[0] << ", " + << hostOutCQ[1] << ", " << hostOutCQ[2] << "}" << std::endl; - // Try interop queue again, writing to a separate buffer - InteropQueueForOps.copy(addend, deviceData, 2).wait(); - InteropQueueForOps.submit([&](handler &cgh) { + // Try interop queue with immediate commandlist + InteropQueueCL.copy(addend, deviceData, 2).wait(); + InteropQueueCL.submit([&](handler &cgh) { accessor numbers{bufDataCL, cgh, read_write}; cgh.single_task( [=]() { numbers[2] += numbers[0] + numbers[1] + deviceData[1]; }); }); host_accessor hostOutCL{bufDataCL, read_only}; - std::cout << "GPU Result from Immediate Q = {" << hostOut[0] << ", " - << hostOut[1] << ", " << hostOut[2] << "}" << std::endl; + std::cout << "GPU Result from Immediate Q = {" << hostOutCL[0] << ", " + << hostOutCL[1] << ", " << hostOutCL[2] << "}" << std::endl; } free(deviceData, InteropContext); // Check results - buffer bufDataResult{data, 3}; - host_accessor hostResult{bufDataResult, read_only}; - if (hostResult[0] != 13 || hostResult[1] != 14 || hostResult[2] != 73) { - std::cout << "Test failed, expected final result to be {" << hostResult[0] - << ", " << hostResult[1] << ", " << hostResult[2] << "}" + host_accessor hostResult{bufData, read_only}; + host_accessor hostResultCQ{bufDataCQ, read_only}; + host_accessor hostResultCL{bufDataCL, read_only}; + if (hostResult[0] != 10 || hostResult[1] != 11 || hostResult[2] != 3 || + hostResultCQ[0] != 10 || hostResultCQ[1] != 11 || hostResultCQ[2] != 3 || + hostResultCL[0] != 7 || hostResultCL[1] != 8 || hostResultCL[2] != 51) { + std::cout << "Test failed. Results: SYCL Q = {" << hostResult[0] << ", " + << hostResult[1] << ", " << hostResult[2] << "}, Standard Q = {" + << hostResultCQ[0] << ", " << hostResultCQ[1] << ", " + << hostResultCQ[2] << "}, Immediate Q = {" << hostResultCL[0] + << ", " << hostResultCL[1] << ", " << hostResultCL[2] << "}" << std::endl; return 1; } From aebca305782b0ab66c2307bbf8dfd59571e6b988 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Tue, 29 Sep 2026 14:57:25 +0200 Subject: [PATCH 12/27] [SYCL][L0v2] Update commnets for unduported L0v2 test cases --- sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp | 3 ++- sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp | 3 ++- sycl/test-e2e/Adapters/level_zero/batch_test.cpp | 3 ++- .../Adapters/level_zero/batch_test_copy_with_compute.cpp | 3 ++- sycl/test-e2e/Adapters/level_zero/usm_residency.cpp | 3 ++- sycl/test-e2e/USM/usm_pooling.cpp | 6 ++++-- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp b/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp index cd0ce57638253..843f6b0e9abca 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp @@ -1,6 +1,7 @@ // REQUIRES: gpu, level_zero, level_zero_dev_kit // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: regular command-list batching is V1-only. +// UNSUPPORTED-INTENDED: this test validates the Legacy regular-command-list +// batching implementation and is not directly applicable to L0v2. // UNSUPPORTED: windows && gpu-intel-gen12 // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp b/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp index 92800dd5da57d..51528a56f80d7 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp @@ -5,7 +5,8 @@ // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: regular command-list batching is V1-only. +// UNSUPPORTED-INTENDED: this test validates the Legacy regular-command-list +// batching implementation and is not directly applicable to L0v2. // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 diff --git a/sycl/test-e2e/Adapters/level_zero/batch_test.cpp b/sycl/test-e2e/Adapters/level_zero/batch_test.cpp index 9a33dc5eb44b8..8865dbca15d96 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_test.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_test.cpp @@ -5,7 +5,8 @@ // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: regular command-list batching is V1-only. +// UNSUPPORTED-INTENDED: this test validates the Legacy regular-command-list +// batching implementation and is not directly applicable to L0v2. // UNSUPPORTED: windows && gpu-intel-gen12 // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp b/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp index 1e590e6ac587e..36cb7ced617c8 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp @@ -2,7 +2,8 @@ // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: regular command-list batching is V1-only. +// UNSUPPORTED-INTENDED: this test validates the Legacy regular-command-list +// batching implementation and is not directly applicable to L0v2. // UNSUPPORTED: windows && (gpu-intel-gen12 || gpu-intel-dg2) // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp b/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp index 10090142e0470..c8f576cdef463 100644 --- a/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp +++ b/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp @@ -1,6 +1,7 @@ // REQUIRES: gpu, level_zero // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: v2 adapter does not support changing residency. +// This test uses the Legacy SYCL_PI_LEVEL_ZERO_USM_RESIDENT control. What the +// L0v2 testable residency contract should be is not yet decided. // RUN: %{build} %level_zero_options -o %t.out // RUN: env SYCL_UR_TRACE=2 UR_L0_DEBUG=-1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=DEVICE %s diff --git a/sycl/test-e2e/USM/usm_pooling.cpp b/sycl/test-e2e/USM/usm_pooling.cpp index 8c9582e3808ab..fe007a80a9bf2 100644 --- a/sycl/test-e2e/USM/usm_pooling.cpp +++ b/sycl/test-e2e/USM/usm_pooling.cpp @@ -2,8 +2,10 @@ // RUN: %{build} -o %t.out // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: memory allocation logs are not emitted in -// level_zero_v2_adapter +// This test uses a Legacy allocator-configuration variable name, and checks +// a residency call sequence that L0v2 does not reproduce. Whether L0v2 +// should honor the Legacy configuration name, and how residency should be +// covered for L0v2, are open questions. // UNSUPPORTED: windows // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 From 93032057757f76d4e7a3a613f2e40a51494f18dc Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Fri, 9 Oct 2026 10:21:23 +0200 Subject: [PATCH 13/27] [SYCL][L0v2] Restore UNSUPPORTED-INTENDED tag required by e2e lint check --- sycl/test-e2e/Adapters/level_zero/usm_residency.cpp | 5 +++-- sycl/test-e2e/USM/usm_pooling.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp b/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp index c8f576cdef463..cc94a768d476c 100644 --- a/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp +++ b/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp @@ -1,7 +1,8 @@ // REQUIRES: gpu, level_zero // UNSUPPORTED: level_zero_v2_adapter -// This test uses the Legacy SYCL_PI_LEVEL_ZERO_USM_RESIDENT control. What the -// L0v2 testable residency contract should be is not yet decided. +// UNSUPPORTED-INTENDED: this test uses the Legacy +// SYCL_PI_LEVEL_ZERO_USM_RESIDENT control; what the L0v2 testable residency +// contract should be is not yet decided. // RUN: %{build} %level_zero_options -o %t.out // RUN: env SYCL_UR_TRACE=2 UR_L0_DEBUG=-1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=DEVICE %s diff --git a/sycl/test-e2e/USM/usm_pooling.cpp b/sycl/test-e2e/USM/usm_pooling.cpp index fe007a80a9bf2..ca06d3974c499 100644 --- a/sycl/test-e2e/USM/usm_pooling.cpp +++ b/sycl/test-e2e/USM/usm_pooling.cpp @@ -2,10 +2,10 @@ // RUN: %{build} -o %t.out // UNSUPPORTED: level_zero_v2_adapter -// This test uses a Legacy allocator-configuration variable name, and checks -// a residency call sequence that L0v2 does not reproduce. Whether L0v2 -// should honor the Legacy configuration name, and how residency should be -// covered for L0v2, are open questions. +// UNSUPPORTED-INTENDED: this test uses a Legacy allocator-configuration +// variable name, and checks a residency call sequence that L0v2 does not +// reproduce. Whether L0v2 should honor the Legacy configuration name, and +// how residency should be covered for L0v2, are open questions. // UNSUPPORTED: windows // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 From d9355c75cbe56f98aa4c2f658ce87c57b81749bd Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Thu, 15 Oct 2026 12:19:36 +0200 Subject: [PATCH 14/27] [SYCL][L0v2] Accept both counter-based event API names in events_caching.cpp --- sycl/test-e2e/Adapters/level_zero/events_caching.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp index 9df6a2da31873..fbb87760d1440 100644 --- a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp +++ b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp @@ -10,12 +10,15 @@ // Might require more than one if previous one hasn't been released by the time // we need a new one. // -// L0v2 has no on/off switch for event caching, but reuses events via -// zexCounterBasedEventCreate2, so far fewer than 256 creations are expected. +// L0v2 has no on/off switch for event caching, but reuses events via a +// counter-based event API. The driver may expose it under the experimental +// name (zexCounterBasedEventCreate2) or its promoted stable name +// (zeEventCounterBasedCreate), depending on driver version; either way, far +// fewer than 256 creations are expected. // CACHING-ENABLED: zeEventCreate = {{[1-9]}} // CACHING-DISABLED: zeEventCreate = 256 -// CHECK-V2: zexCounterBasedEventCreate2 = {{[1-9][0-9]?}} +// CHECK-V2: {{zexCounterBasedEventCreate2|zeEventCounterBasedCreate}} = {{[1-9][0-9]?}} // Check event caching modes in the L0 adapter. From cced82be3d3555ed4b7397f657a3ae623591e33a Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Fri, 16 Oct 2026 13:42:34 +0200 Subject: [PATCH 15/27] [SYCL][L0v2] Check zeEventDestroy instead of the create-side name --- sycl/test-e2e/Adapters/level_zero/events_caching.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp index fbb87760d1440..eb0a22f99289e 100644 --- a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp +++ b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp @@ -11,14 +11,15 @@ // we need a new one. // // L0v2 has no on/off switch for event caching, but reuses events via a -// counter-based event API. The driver may expose it under the experimental -// name (zexCounterBasedEventCreate2) or its promoted stable name -// (zeEventCounterBasedCreate), depending on driver version; either way, far -// fewer than 256 creations are expected. +// counter-based event API. Which name and whether the create side is even +// traced varies by driver/OS, so check the destroy side instead: zeEventCreate +// stays 0 (no legacy events), and far fewer than 256 counter-based events +// should be destroyed. // CACHING-ENABLED: zeEventCreate = {{[1-9]}} // CACHING-DISABLED: zeEventCreate = 256 -// CHECK-V2: {{zexCounterBasedEventCreate2|zeEventCounterBasedCreate}} = {{[1-9][0-9]?}} +// CHECK-V2: zeEventCreate = 0 +// CHECK-V2: zeEventDestroy = {{[1-9][0-9]?}} // Check event caching modes in the L0 adapter. From d02c21f4128cdf47d0aa0a249f7f6ae9f4444b3c Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Fri, 16 Oct 2026 14:45:34 +0200 Subject: [PATCH 16/27] [SYCL][L0v2] Test event reuse via distinct native handle count, not traces --- .../Adapters/level_zero/events_caching.cpp | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp index eb0a22f99289e..c45794caa1f04 100644 --- a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp +++ b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp @@ -10,29 +10,36 @@ // Might require more than one if previous one hasn't been released by the time // we need a new one. // -// L0v2 has no on/off switch for event caching, but reuses events via a -// counter-based event API. Which name and whether the create side is even -// traced varies by driver/OS, so check the destroy side instead: zeEventCreate -// stays 0 (no legacy events), and far fewer than 256 counter-based events -// should be destroyed. +// L0v2 has no on/off switch for event caching. Which internal API creates +// the event, and whether it's traced by UR_L0_LEAKS_DEBUG at all, varies by +// driver/OS, so check the property directly instead: count distinct native +// event handles returned across 256 operations. Reuse means far fewer than +// 256 distinct handles. // CACHING-ENABLED: zeEventCreate = {{[1-9]}} // CACHING-DISABLED: zeEventCreate = 256 -// CHECK-V2: zeEventCreate = 0 -// CHECK-V2: zeEventDestroy = {{[1-9][0-9]?}} +// CHECK-V2: Distinct native event handles: {{[1-9][0-9]?}} // Check event caching modes in the L0 adapter. +#include +#include #include +#include int main() { sycl::queue deviceQueue; + std::set distinctEvents; for (int i = 0; i < 256; i++) { auto Event = deviceQueue.submit([&](sycl::handler &cgh) { cgh.single_task([=]() {}); }); Event.wait(); + distinctEvents.insert( + sycl::get_native(Event)); } + std::cout << "Distinct native event handles: " << distinctEvents.size() + << "\n"; return 0; } From 6729e395fd38a4d9a39447de5058468d7bb08da1 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Mon, 19 Oct 2026 15:33:06 +0200 Subject: [PATCH 17/27] [SYCL][L0v2] Combine distinct-handle and destroy-count signals --- sycl/test-e2e/Adapters/level_zero/events_caching.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp index c45794caa1f04..210bb1f47dd06 100644 --- a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp +++ b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp @@ -12,13 +12,19 @@ // // L0v2 has no on/off switch for event caching. Which internal API creates // the event, and whether it's traced by UR_L0_LEAKS_DEBUG at all, varies by -// driver/OS, so check the property directly instead: count distinct native -// event handles returned across 256 operations. Reuse means far fewer than -// 256 distinct handles. +// driver/OS, so a single signal isn't enough: a small distinct-handle count +// alone wouldn't rule out the driver happening to reallocate a freed +// handle's address, rather than the adapter genuinely keeping it alive. +// zeEventDestroy is only called when the adapter's event cache itself is +// torn down (not per-operation), so combining a small distinct-handle count +// with a small zeEventDestroy count only holds if the events are actually +// being kept alive and reused, not destroyed and recreated by coincidence +// at the same address. // CACHING-ENABLED: zeEventCreate = {{[1-9]}} // CACHING-DISABLED: zeEventCreate = 256 // CHECK-V2: Distinct native event handles: {{[1-9][0-9]?}} +// CHECK-V2: zeEventDestroy = {{[1-9][0-9]?}} // Check event caching modes in the L0 adapter. From 690a6b9bbca58d540dc9b0bafb16278bd0137d0a Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Mon, 19 Oct 2026 15:45:33 +0200 Subject: [PATCH 18/27] [SYCL][L0v2] Trim events_caching.cpp comment --- .../test-e2e/Adapters/level_zero/events_caching.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp index 210bb1f47dd06..104dfc63baabe 100644 --- a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp +++ b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp @@ -10,16 +10,9 @@ // Might require more than one if previous one hasn't been released by the time // we need a new one. // -// L0v2 has no on/off switch for event caching. Which internal API creates -// the event, and whether it's traced by UR_L0_LEAKS_DEBUG at all, varies by -// driver/OS, so a single signal isn't enough: a small distinct-handle count -// alone wouldn't rule out the driver happening to reallocate a freed -// handle's address, rather than the adapter genuinely keeping it alive. -// zeEventDestroy is only called when the adapter's event cache itself is -// torn down (not per-operation), so combining a small distinct-handle count -// with a small zeEventDestroy count only holds if the events are actually -// being kept alive and reused, not destroyed and recreated by coincidence -// at the same address. +// L0v2 has no on/off switch for event caching, so check reuse directly. +// Handle reuse alone may result from driver address recycling. +// A low destroy count confirms resource reuse. // CACHING-ENABLED: zeEventCreate = {{[1-9]}} // CACHING-DISABLED: zeEventCreate = 256 From 5532d1e76f5b8f22dd5d23a10d9b15d4a3854a21 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Mon, 19 Oct 2026 17:36:18 +0200 Subject: [PATCH 19/27] [SYCL][L0v2] Fix event caching checks ordering and count boundaries --- sycl/test-e2e/Adapters/level_zero/events_caching.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp index 104dfc63baabe..5c7c0508c2d8b 100644 --- a/sycl/test-e2e/Adapters/level_zero/events_caching.cpp +++ b/sycl/test-e2e/Adapters/level_zero/events_caching.cpp @@ -16,8 +16,8 @@ // CACHING-ENABLED: zeEventCreate = {{[1-9]}} // CACHING-DISABLED: zeEventCreate = 256 -// CHECK-V2: Distinct native event handles: {{[1-9][0-9]?}} -// CHECK-V2: zeEventDestroy = {{[1-9][0-9]?}} +// CHECK-V2-DAG: Distinct native event handles: {{[1-9][0-9]?[[:space:]]*$}} +// CHECK-V2-DAG: zeEventDestroy = {{[1-9][0-9]?([[:space:]]|$)}} // Check event caching modes in the L0 adapter. From dc2f8a4ffbcbd732c424113b43fe763090a6def1 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Fri, 23 Oct 2026 10:12:37 +0200 Subject: [PATCH 20/27] [SYCL][L0v2] Use UR configuration variables in USM pooling test --- sycl/test-e2e/USM/usm_pooling.cpp | 37 +++++++++---------- .../source/adapters/level_zero/v2/usm.cpp | 13 +------ 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/sycl/test-e2e/USM/usm_pooling.cpp b/sycl/test-e2e/USM/usm_pooling.cpp index ca06d3974c499..a1fb1f624a850 100644 --- a/sycl/test-e2e/USM/usm_pooling.cpp +++ b/sycl/test-e2e/USM/usm_pooling.cpp @@ -2,10 +2,9 @@ // RUN: %{build} -o %t.out // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: this test uses a Legacy allocator-configuration -// variable name, and checks a residency call sequence that L0v2 does not -// reproduce. Whether L0v2 should honor the Legacy configuration name, and -// how residency should be covered for L0v2, are open questions. +// UNSUPPORTED-INTENDED: this test checks a residency call sequence that L0v2 +// does not reproduce. How residency should be covered for L0v2 is an open +// question. // UNSUPPORTED: windows // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 @@ -13,29 +12,29 @@ // Allocate 2 items of 2MB. Free 2. Allocate 3 more of 2MB. // With no pooling: 1,2,3,4,5 allocs lead to ZE call. -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USM_RESIDENT=0 SYCL_PI_LEVEL_ZERO_DISABLE_USM_ALLOCATOR=1 %{run} %t.out h 2>&1 | FileCheck %s --check-prefix CHECK-NOPOOL -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USM_RESIDENT=0 SYCL_PI_LEVEL_ZERO_DISABLE_USM_ALLOCATOR=1 %{run} %t.out d 2>&1 | FileCheck %s --check-prefix CHECK-NOPOOL -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USM_RESIDENT=0 SYCL_PI_LEVEL_ZERO_DISABLE_USM_ALLOCATOR=1 %{run} %t.out s 2>&1 | FileCheck %s --check-prefix CHECK-NOPOOL +// RUN: env UR_L0_DEBUG=1 UR_L0_USM_RESIDENT=0 UR_L0_DISABLE_USM_ALLOCATOR=1 %{run} %t.out h 2>&1 | FileCheck %s --check-prefix CHECK-NOPOOL +// RUN: env UR_L0_DEBUG=1 UR_L0_USM_RESIDENT=0 UR_L0_DISABLE_USM_ALLOCATOR=1 %{run} %t.out d 2>&1 | FileCheck %s --check-prefix CHECK-NOPOOL +// RUN: env UR_L0_DEBUG=1 UR_L0_USM_RESIDENT=0 UR_L0_DISABLE_USM_ALLOCATOR=1 %{run} %t.out s 2>&1 | FileCheck %s --check-prefix CHECK-NOPOOL // With pooling enabled and MaxPooolable=1MB: 1,2,3,4,5 allocs lead to ZE call. -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USM_RESIDENT=0 SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR=";;1M,4,64K" %{run} %t.out h 2>&1 | FileCheck %s --check-prefix CHECK-12345 -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USM_RESIDENT=0 SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR=";;1M,4,64K" %{run} %t.out d 2>&1 | FileCheck %s --check-prefix CHECK-12345 -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USM_RESIDENT=0 SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR=";;1M,4,64K" %{run} %t.out s 2>&1 | FileCheck %s --check-prefix CHECK-12345 +// RUN: env UR_L0_DEBUG=1 UR_L0_USM_RESIDENT=0 UR_L0_USM_ALLOCATOR=";;1M,4,64K" %{run} %t.out h 2>&1 | FileCheck %s --check-prefix CHECK-12345 +// RUN: env UR_L0_DEBUG=1 UR_L0_USM_RESIDENT=0 UR_L0_USM_ALLOCATOR=";;1M,4,64K" %{run} %t.out d 2>&1 | FileCheck %s --check-prefix CHECK-12345 +// RUN: env UR_L0_DEBUG=1 UR_L0_USM_RESIDENT=0 UR_L0_USM_ALLOCATOR=";;1M,4,64K" %{run} %t.out s 2>&1 | FileCheck %s --check-prefix CHECK-12345 // With pooling enabled and capacity=1: 1,2,4,5 allocs lead to ZE call. -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USM_RESIDENT=0 SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR=";;2M,1,64K" %{run} %t.out h 2>&1 | FileCheck %s --check-prefix CHECK-1245 -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USM_RESIDENT=0 SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR=";;2M,1,64K" %{run} %t.out d 2>&1 | FileCheck %s --check-prefix CHECK-1245 -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USM_RESIDENT=0 SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR=";;2M,1,64K" %{run} %t.out s 2>&1 | FileCheck %s --check-prefix CHECK-1245 +// RUN: env UR_L0_DEBUG=1 UR_L0_USM_RESIDENT=0 UR_L0_USM_ALLOCATOR=";;2M,1,64K" %{run} %t.out h 2>&1 | FileCheck %s --check-prefix CHECK-1245 +// RUN: env UR_L0_DEBUG=1 UR_L0_USM_RESIDENT=0 UR_L0_USM_ALLOCATOR=";;2M,1,64K" %{run} %t.out d 2>&1 | FileCheck %s --check-prefix CHECK-1245 +// RUN: env UR_L0_DEBUG=1 UR_L0_USM_RESIDENT=0 UR_L0_USM_ALLOCATOR=";;2M,1,64K" %{run} %t.out s 2>&1 | FileCheck %s --check-prefix CHECK-1245 // With pooling enabled and MaxPoolSize=2MB: 1,2,4,5 allocs lead to ZE call. -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USM_RESIDENT=0 SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR=";2M;2M,4,64K" %{run} %t.out h 2>&1 | FileCheck %s --check-prefix CHECK-1245 -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USM_RESIDENT=0 SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR=";2M;2M,4,64K" %{run} %t.out d 2>&1 | FileCheck %s --check-prefix CHECK-1245 -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USM_RESIDENT=0 SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR=";2M;2M,4,64K" %{run} %t.out s 2>&1 | FileCheck %s --check-prefix CHECK-1245 +// RUN: env UR_L0_DEBUG=1 UR_L0_USM_RESIDENT=0 UR_L0_USM_ALLOCATOR=";2M;2M,4,64K" %{run} %t.out h 2>&1 | FileCheck %s --check-prefix CHECK-1245 +// RUN: env UR_L0_DEBUG=1 UR_L0_USM_RESIDENT=0 UR_L0_USM_ALLOCATOR=";2M;2M,4,64K" %{run} %t.out d 2>&1 | FileCheck %s --check-prefix CHECK-1245 +// RUN: env UR_L0_DEBUG=1 UR_L0_USM_RESIDENT=0 UR_L0_USM_ALLOCATOR=";2M;2M,4,64K" %{run} %t.out s 2>&1 | FileCheck %s --check-prefix CHECK-1245 // With pooling enabled and SlabMinSize of 4 MB: 1,5 allocs lead to ZE call. -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USM_RESIDENT=0 SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR=";;2M,4,4M" %{run} %t.out h 2>&1 | FileCheck %s --check-prefix CHECK-15 -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USM_RESIDENT=0 SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR=";;2M,4,4M" %{run} %t.out d 2>&1 | FileCheck %s --check-prefix CHECK-15 -// RUN: env UR_L0_DEBUG=1 SYCL_PI_LEVEL_ZERO_USM_RESIDENT=0 SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR=";;2M,4,4M" %{run} %t.out s 2>&1 | FileCheck %s --check-prefix CHECK-15 +// RUN: env UR_L0_DEBUG=1 UR_L0_USM_RESIDENT=0 UR_L0_USM_ALLOCATOR=";;2M,4,4M" %{run} %t.out h 2>&1 | FileCheck %s --check-prefix CHECK-15 +// RUN: env UR_L0_DEBUG=1 UR_L0_USM_RESIDENT=0 UR_L0_USM_ALLOCATOR=";;2M,4,4M" %{run} %t.out d 2>&1 | FileCheck %s --check-prefix CHECK-15 +// RUN: env UR_L0_DEBUG=1 UR_L0_USM_RESIDENT=0 UR_L0_USM_ALLOCATOR=";;2M,4,4M" %{run} %t.out s 2>&1 | FileCheck %s --check-prefix CHECK-15 #include "sycl/detail/core.hpp" diff --git a/unified-runtime/source/adapters/level_zero/v2/usm.cpp b/unified-runtime/source/adapters/level_zero/v2/usm.cpp index 5983a00886767..ff00971ad3dba 100644 --- a/unified-runtime/source/adapters/level_zero/v2/usm.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/usm.cpp @@ -36,20 +36,11 @@ initializeDisjointPoolConfig() { } int PoolTrace = 0; - const char *PoolTraceVal = std::getenv("UR_L0_USM_ALLOCATOR_TRACE"); - if (!PoolTraceVal) { - PoolTraceVal = std::getenv("SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR_TRACE"); - } - if (PoolTraceVal) { - PoolTrace = std::atoi(PoolTraceVal); + if (auto PoolUrTraceVal = std::getenv("UR_L0_USM_ALLOCATOR_TRACE")) { + PoolTrace = std::atoi(PoolUrTraceVal); } const char *PoolUrConfigVal = std::getenv("UR_L0_USM_ALLOCATOR"); - if (!PoolUrConfigVal) { - // Fall back to the legacy PI env var name for compatibility with - // existing tests/tools that predate the UR naming. - PoolUrConfigVal = std::getenv("SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR"); - } if (PoolUrConfigVal == nullptr) { return usm::DisjointPoolAllConfigs(PoolTrace); } From d286a4113b8dfdb8c6fcb7bae78a2c302574dae6 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Fri, 23 Oct 2026 10:41:57 +0200 Subject: [PATCH 21/27] [SYCL][L0v2] Describe only current reasons in UNSUPPORTED-INTENDED comments --- sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp | 4 ++-- sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp | 4 ++-- sycl/test-e2e/Adapters/level_zero/batch_test.cpp | 4 ++-- .../Adapters/level_zero/batch_test_copy_with_compute.cpp | 4 ++-- sycl/test-e2e/Adapters/level_zero/usm_residency.cpp | 5 ++--- sycl/test-e2e/USM/usm_pooling.cpp | 3 +-- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp b/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp index 843f6b0e9abca..31cf19446f973 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_barrier.cpp @@ -1,7 +1,7 @@ // REQUIRES: gpu, level_zero, level_zero_dev_kit // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: this test validates the Legacy regular-command-list -// batching implementation and is not directly applicable to L0v2. +// UNSUPPORTED-INTENDED: this test relies on L0v1 regular-command-list +// batching behavior. // UNSUPPORTED: windows && gpu-intel-gen12 // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp b/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp index 51528a56f80d7..a1c7d80970f54 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_event_status.cpp @@ -5,8 +5,8 @@ // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: this test validates the Legacy regular-command-list -// batching implementation and is not directly applicable to L0v2. +// UNSUPPORTED-INTENDED: this test relies on L0v1 regular-command-list +// batching behavior. // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 diff --git a/sycl/test-e2e/Adapters/level_zero/batch_test.cpp b/sycl/test-e2e/Adapters/level_zero/batch_test.cpp index 8865dbca15d96..afbdfcc597cc5 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_test.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_test.cpp @@ -5,8 +5,8 @@ // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: this test validates the Legacy regular-command-list -// batching implementation and is not directly applicable to L0v2. +// UNSUPPORTED-INTENDED: this test relies on L0v1 regular-command-list +// batching behavior. // UNSUPPORTED: windows && gpu-intel-gen12 // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp b/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp index 36cb7ced617c8..5dc8cd5d1a96b 100644 --- a/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp +++ b/sycl/test-e2e/Adapters/level_zero/batch_test_copy_with_compute.cpp @@ -2,8 +2,8 @@ // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: this test validates the Legacy regular-command-list -// batching implementation and is not directly applicable to L0v2. +// UNSUPPORTED-INTENDED: this test relies on L0v1 regular-command-list +// batching behavior. // UNSUPPORTED: windows && (gpu-intel-gen12 || gpu-intel-dg2) // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 diff --git a/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp b/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp index cc94a768d476c..36ee23abcbe83 100644 --- a/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp +++ b/sycl/test-e2e/Adapters/level_zero/usm_residency.cpp @@ -1,8 +1,7 @@ // REQUIRES: gpu, level_zero // UNSUPPORTED: level_zero_v2_adapter -// UNSUPPORTED-INTENDED: this test uses the Legacy -// SYCL_PI_LEVEL_ZERO_USM_RESIDENT control; what the L0v2 testable residency -// contract should be is not yet decided. +// UNSUPPORTED-INTENDED: this test relies on the L0v1-specific +// SYCL_PI_LEVEL_ZERO_USM_RESIDENT configuration. // RUN: %{build} %level_zero_options -o %t.out // RUN: env SYCL_UR_TRACE=2 UR_L0_DEBUG=-1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck --check-prefixes=DEVICE %s diff --git a/sycl/test-e2e/USM/usm_pooling.cpp b/sycl/test-e2e/USM/usm_pooling.cpp index a1fb1f624a850..c207106a39bc7 100644 --- a/sycl/test-e2e/USM/usm_pooling.cpp +++ b/sycl/test-e2e/USM/usm_pooling.cpp @@ -3,8 +3,7 @@ // UNSUPPORTED: level_zero_v2_adapter // UNSUPPORTED-INTENDED: this test checks a residency call sequence that L0v2 -// does not reproduce. How residency should be covered for L0v2 is an open -// question. +// does not reproduce. // UNSUPPORTED: windows // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/21556 From 331bd701052d4deb1de8076f2b092672aaf44c3b Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Fri, 23 Oct 2026 12:27:15 +0200 Subject: [PATCH 22/27] [SYCL][L0v2] Accept high-priority levels in queue_priority test --- sycl/test-e2e/Adapters/level_zero/queue_priority.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp b/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp index 03e3a20297642..8963bc75d0db2 100644 --- a/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp +++ b/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp @@ -12,10 +12,10 @@ // SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS is a v1-only selector between // regular (CHECK-STD) and immediate (CHECK-IMM) command lists; v2 always uses // immediate command lists and does not read this variable, so both RUN lines -// exercise the same v2 code path (CHECK-V2). v2 propagates priority to the -// L0 command queue descriptor the same way v1 does (see getZePriority() in -// queue_create.cpp), but logs it as part of command list creation instead of -// a "[getZeQueue]" line. +// exercise the same v2 code path (CHECK-V2). v2 logs priority as part of +// command list creation instead of a "[getZeQueue]" line. For priority_high it +// uses either the high priority class or, on devices that report priority +// levels, the highest level with the normal class. #include #include #include @@ -49,7 +49,7 @@ int main(int Argc, const char *Argv[]) { // CHECK-STD: [getZeQueue]: create queue {{.*}} priority = High // CHECK-IMM: [getZeQueue]: create queue {{.*}} priority = High - // CHECK-V2: create command list ordinal: {{.*}} priority: High + // CHECK-V2: create command list ordinal: {{.*}} {{priority: High, priorityLevel: none|priority: Normal, priorityLevel: -?[0-9]+}} test(C, D, {sycl::ext::oneapi::property::queue::priority_high{}}); // CHECK-STD: Queue cannot be constructed with different priorities. From 735c4b4adbb51f415770e7f1da37abc8fa3e8a73 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Mon, 26 Oct 2026 15:46:35 +0100 Subject: [PATCH 23/27] [SYCL][L0v2] Test only the public contract in queue_priority --- .../Adapters/level_zero/queue_priority.cpp | 11 ++++------- .../adapters/level_zero/v2/command_list_cache.cpp | 14 +------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp b/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp index 8963bc75d0db2..2f606896f6d5d 100644 --- a/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp +++ b/sycl/test-e2e/Adapters/level_zero/queue_priority.cpp @@ -12,10 +12,9 @@ // SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS is a v1-only selector between // regular (CHECK-STD) and immediate (CHECK-IMM) command lists; v2 always uses // immediate command lists and does not read this variable, so both RUN lines -// exercise the same v2 code path (CHECK-V2). v2 logs priority as part of -// command list creation instead of a "[getZeQueue]" line. For priority_high it -// uses either the high priority class or, on devices that report priority -// levels, the highest level with the normal class. +// exercise the same v2 code path (CHECK-V2). The v2 checks cover only the +// public contract; how priorities map to Level Zero is covered by the adapter +// tests. #include #include #include @@ -34,7 +33,6 @@ int main(int Argc, const char *Argv[]) { // CHECK-STD: [getZeQueue]: create queue {{.*}} priority = Normal // CHECK-IMM: [getZeQueue]: create queue {{.*}} priority = Normal - // CHECK-V2: create command list ordinal: {{.*}} priority: Normal test(C, D, sycl::property_list{}); // CHECK-STD: [getZeQueue]: create queue {{.*}} priority = Normal @@ -44,12 +42,10 @@ int main(int Argc, const char *Argv[]) { // CHECK-STD: [getZeQueue]: create queue {{.*}} priority = Low // CHECK-IMM: [getZeQueue]: create queue {{.*}} priority = Low - // CHECK-V2: create command list ordinal: {{.*}} priority: Low test(C, D, {sycl::ext::oneapi::property::queue::priority_low{}}); // CHECK-STD: [getZeQueue]: create queue {{.*}} priority = High // CHECK-IMM: [getZeQueue]: create queue {{.*}} priority = High - // CHECK-V2: create command list ordinal: {{.*}} {{priority: High, priorityLevel: none|priority: Normal, priorityLevel: -?[0-9]+}} test(C, D, {sycl::ext::oneapi::property::queue::priority_high{}}); // CHECK-STD: Queue cannot be constructed with different priorities. @@ -63,6 +59,7 @@ int main(int Argc, const char *Argv[]) { std::cerr << E.what() << std::endl; } + // CHECK-V2: The test passed. std::cout << "The test passed." << std::endl; return 0; } diff --git a/unified-runtime/source/adapters/level_zero/v2/command_list_cache.cpp b/unified-runtime/source/adapters/level_zero/v2/command_list_cache.cpp index 9e73a31ae9b75..25409797b5108 100644 --- a/unified-runtime/source/adapters/level_zero/v2/command_list_cache.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/command_list_cache.cpp @@ -57,17 +57,6 @@ static bool ForceDisableCopyOffload = [] { return getenv_tobool("UR_L0_V2_FORCE_DISABLE_COPY_OFFLOAD"); }(); -static const char *priorityToString(ze_command_queue_priority_t Priority) { - switch (Priority) { - case ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW: - return "Low"; - case ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH: - return "High"; - default: - return "Normal"; - } -} - raii::ze_command_list_handle_t command_list_cache_t::createCommandList(const command_list_descriptor_t &desc) { ZexStruct @@ -128,9 +117,8 @@ command_list_cache_t::createCommandList(const command_list_descriptor_t &desc) { UR_LOG(DEBUG, "create command list ordinal: {}, type: immediate, " - "device: {}, inOrder: {}, priority: {}, priorityLevel: {}", + "device: {}, inOrder: {}, priorityLevel: {}", ImmCmdDesc->Ordinal, ImmCmdDesc->ZeDevice, ImmCmdDesc->IsInOrder, - priorityToString(ImmCmdDesc->Priority), ImmCmdDesc->PriorityLevel ? std::to_string(ImmCmdDesc->PriorityLevel.value()) : std::string("none")); From 2c171962c4ef28bd33641529134549bc6aab010d Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Mon, 26 Oct 2026 15:46:35 +0100 Subject: [PATCH 24/27] [SYCL][L0v2] Bound pool size instead of exact count in queue_create --- sycl/test-e2e/Adapters/level_zero/queue_create.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/queue_create.cpp b/sycl/test-e2e/Adapters/level_zero/queue_create.cpp index 085d919c6de70..b2a9037ac8a8c 100644 --- a/sycl/test-e2e/Adapters/level_zero/queue_create.cpp +++ b/sycl/test-e2e/Adapters/level_zero/queue_create.cpp @@ -10,9 +10,11 @@ // v1 creates a single regular command queue for the whole run: // CHECK: zeCommandQueueCreate = 1 \---> zeCommandQueueDestroy = 1 // -// L0v2 reuses a fixed pool of 4 immediate command lists. -// CHECK-V2: zeCommandListCreateImmediate = 4 -// CHECK-V2: zeCommandListCreate = 0 \---> zeCommandListDestroy = 4 +// L0v2 reuses a small pool of immediate command lists. Creating one per +// submission would give about 1000, so 1-99 is a loose bound on the pool size. +// Every list that was created must be destroyed. +// CHECK-V2: zeCommandListCreateImmediate = [[N:[1-9][0-9]?]]{{([[:space:]]|$)}} +// CHECK-V2: zeCommandListCreate = 0 \---> zeCommandListDestroy = [[N]]{{([[:space:]]|$)}} // #include From 0055e172b6a31474f1c26ec881775a4cd71d5324 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Mon, 26 Oct 2026 16:09:34 +0100 Subject: [PATCH 25/27] [SYCL][L0v2] Tighten command list bound in queue_create --- sycl/test-e2e/Adapters/level_zero/queue_create.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sycl/test-e2e/Adapters/level_zero/queue_create.cpp b/sycl/test-e2e/Adapters/level_zero/queue_create.cpp index b2a9037ac8a8c..c3594b660bd30 100644 --- a/sycl/test-e2e/Adapters/level_zero/queue_create.cpp +++ b/sycl/test-e2e/Adapters/level_zero/queue_create.cpp @@ -10,10 +10,10 @@ // v1 creates a single regular command queue for the whole run: // CHECK: zeCommandQueueCreate = 1 \---> zeCommandQueueDestroy = 1 // -// L0v2 reuses a small pool of immediate command lists. Creating one per -// submission would give about 1000, so 1-99 is a loose bound on the pool size. -// Every list that was created must be destroyed. -// CHECK-V2: zeCommandListCreateImmediate = [[N:[1-9][0-9]?]]{{([[:space:]]|$)}} +// L0v2 creates a queue's immediate command lists once, in its constructor (a +// pool of 4 today), so the count must not grow with the 1000 submissions; 1-16 +// leaves headroom. Every list that was created must be destroyed. +// CHECK-V2: zeCommandListCreateImmediate = [[N:[1-9]|1[0-6]]]{{([[:space:]]|$)}} // CHECK-V2: zeCommandListCreate = 0 \---> zeCommandListDestroy = [[N]]{{([[:space:]]|$)}} // From f285de295be57649a6fa25cccbba8ee56a214e48 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Tue, 27 Oct 2026 14:32:45 +0100 Subject: [PATCH 26/27] [SYCL][L0v2] Match exact counts in queue_submit_mode --- sycl/test-e2e/Adapters/queue_submit_mode.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sycl/test-e2e/Adapters/queue_submit_mode.cpp b/sycl/test-e2e/Adapters/queue_submit_mode.cpp index b68f7d6460f7e..3eb42af4a89f6 100644 --- a/sycl/test-e2e/Adapters/queue_submit_mode.cpp +++ b/sycl/test-e2e/Adapters/queue_submit_mode.cpp @@ -34,10 +34,10 @@ int main(int argc, char *argv[]) { else P = ext::intel::property::queue::no_immediate_command_list(); - // CHECK-STD: zeCommandListCreateImmediate = 1 - // CHECK-IMM: zeCommandListCreateImmediate = 2 + // CHECK-STD: zeCommandListCreateImmediate = 1{{([[:space:]]|$)}} + // CHECK-IMM: zeCommandListCreateImmediate = 2{{([[:space:]]|$)}} // L0v2 out-of-order queues use a fixed pool of 4 immediate command lists. - // CHECK-IMM-V2: zeCommandListCreateImmediate = 4 + // CHECK-IMM-V2: zeCommandListCreateImmediate = 4{{([[:space:]]|$)}} queue Q1{P}; queue_submit(Q1); From 68542c45a75cd7cbe61095124e4d344facd8fbbd Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Tue, 27 Oct 2026 14:32:45 +0100 Subject: [PATCH 27/27] [SYCL][L0v2] Build the V1 interop-direct binary only on V1 --- sycl/test-e2e/Adapters/level_zero/interop-direct.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp b/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp index a1cd59146e5fe..25e6bae003a50 100644 --- a/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp +++ b/sycl/test-e2e/Adapters/level_zero/interop-direct.cpp @@ -2,7 +2,7 @@ // UNSUPPORTED: ze_debug // UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/22347 -// RUN: %{build} %level_zero_options -o %t.out +// RUN: %if !level_zero_v2_adapter %{%{build} %level_zero_options -o %t.out%} // RUN: %if !level_zero_v2_adapter %{env UR_L0_USE_IMMEDIATE_COMMANDLISTS=0 %{run} %t.out%} // RUN: %if !level_zero_v2_adapter %{env UR_L0_USE_IMMEDIATE_COMMANDLISTS=1 %{run} %t.out%} //