From 3db60efc330dc08045a315ee60f2ec0b97d0bfee Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sat, 14 Nov 2026 19:17:16 -0800 Subject: [PATCH] Tests that make command queues on three or more threads at once take the queue plan scheduler_wakes::commits_with_idle_gaps_lose_no_wake makes a command queue on each of four threads, so three can be live at once; whether they are depends on timing. The runtime tests' default queue limits (two round-robin VkQueues) panic there. A lavapipe run of another lane hit that panic, though this lane's 2740/2740 run at 06b5fe355e did not. A scan of every spawned thread in the runtime's tests that makes a command queue found two more of that class, both opt-in benchmarks compiled only under m2v_gpu: host_ram_contended_fill_bench (CLIPS = 3 threads) and host_ram_block_release_bench (its first queue, the compositor's and the releases' queue). The others keep at most two live at once: command_counts, deferred_calls, freed_memory, heap_set_unlocked, managed_copy_device, fill_waits_bench, managed_copies_bench, memory_block_bench and memory_make_hold_bench. They now take the plan (`queue_limits: None`). scheduler_wakes gains plan_device over a device_of, as the other modules' helpers do. --- .../src/tests/host_ram_first_fill_bench.rs | 6 +++++ .../src/tests/scheduler_wakes.rs | 23 ++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/tests/host_ram_first_fill_bench.rs b/crates/metal2vulkan-runtime/src/tests/host_ram_first_fill_bench.rs index 4d10b3b30..66bde0bb6 100644 --- a/crates/metal2vulkan-runtime/src/tests/host_ram_first_fill_bench.rs +++ b/crates/metal2vulkan-runtime/src/tests/host_ram_first_fill_bench.rs @@ -504,6 +504,9 @@ fn host_ram_contended_fill_bench() { DeviceKind::Integrated, DeviceKind::Virtual, ], + // Its [`CLIPS`] threads each keep a command queue live at once: the queue plan, not the + // runtime tests' default queue limits (`device/create.rs`). + queue_limits: None, ..DeviceOptions::default() }; let device = Device::system_default_with(&options).unwrap(); @@ -694,6 +697,9 @@ fn host_ram_block_release_bench() { DeviceKind::Integrated, DeviceKind::Virtual, ], + // Its first queue, the compositor's and the releases' are live at once: the queue plan, + // not the runtime tests' default queue limits (`device/create.rs`). + queue_limits: None, ..DeviceOptions::default() }; let device = Device::system_default_with(&options).unwrap(); diff --git a/crates/metal2vulkan-runtime/src/tests/scheduler_wakes.rs b/crates/metal2vulkan-runtime/src/tests/scheduler_wakes.rs index 26cf83d40..c0e94fb6e 100644 --- a/crates/metal2vulkan-runtime/src/tests/scheduler_wakes.rs +++ b/crates/metal2vulkan-runtime/src/tests/scheduler_wakes.rs @@ -55,8 +55,25 @@ fn device() -> Device { /// [`device`] of `policy`. fn device_with(policy: DevicePolicy) -> Device { - let options = DeviceOptions { + device_of(DeviceOptions { policy, + ..DeviceOptions::default() + }) +} + +/// As [`device`], with the queue plan (`queue_limits: None`) in place of the runtime tests' +/// default queue limits (`device/create.rs`): for a test that keeps more than two of its +/// command queues live at once. +fn plan_device() -> Device { + device_of(DeviceOptions { + queue_limits: None, + ..DeviceOptions::default() + }) +} + +/// [`device`], its other options `base`'s. +fn device_of(base: DeviceOptions) -> Device { + let options = DeviceOptions { kinds: match cfg!(m2v_cpu_icd) { true => vec![DeviceKind::Cpu], false => vec![ @@ -65,7 +82,7 @@ fn device_with(policy: DevicePolicy) -> Device { DeviceKind::Virtual, ], }, - ..DeviceOptions::default() + ..base }; Device::system_default_with(&options).unwrap() } @@ -177,7 +194,7 @@ fn a_burst_of_commits_wakes_the_sleeping_thread_once() { /// most once a sleep. #[test] fn commits_with_idle_gaps_lose_no_wake() { - let device = device(); + let device = plan_device(); let before = device.work_counts(); std::thread::scope(|scope| { for thread in 0..4u64 {