From fe3f09f569d26b5dbe97163cc335037ed2ba971a Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Mon, 16 Nov 2026 23:14:15 -0800 Subject: [PATCH] grouped_submissions: the grouping scenarios' queues take no turns What: event_scenario (a_command_buffer_that_waits_leads_its_group, a_wait_on_the_same_queue_for_a_held_signal_goes_after_its_group, a_wait_on_another_queue_for_a_held_signal_goes_after_its_group, a_middle_value_waited_for_from_another_queue_is_met_by_the_group_s_end) and a_queue_s_batches_group_within_their_run make their devices with QueueTurnPolicy::CommitOrder, as completions_wake_the_scheduler_only_once_a_head_may_go (b9f584ffc1) and RUNTIME 2490's queue-sharing tests do. Why: since RUNTIME 2490 (QueueTurnPolicy::Fair, the default) these failed under parallel GPU load on RADV, alone in the module and in the XTX lane: every failing scenario grouped nothing ("0 vkQueueSubmit calls held 0 batches together"). Their two command queues share one VkQueue there, and under Fair a queue's command buffers after its first are held for its turn wherever its expected run prices its work in flight past the turns' budget (2 ms or 16 ms); beside the module's other GPU tests the warm fills took 10 to 450 ms from commit to completion, so the steps reached the scheduler one at a time and nothing grouped. Alone the runs are short and they group. That is the turns' pricing as designed, which tests::queue_turns covers; these tests are about grouping. Verified before (grouped_submissions module alone, nextest's default parallelism, 3 rounds, carried --cfg m2v_gpu archives): development 68c456e5ba on the RX 7900 XTX 3, 2 and 3 of 15 failed (m3-max-39448), on the 780M PHOENIX 2, 1 and 4 (m3-max-39421); the same tree with at_plan's devices on CommitOrder (probe 45561e17b7) 15/15 three times on the XTX (m3-max-39446). This commit's runs follow in its tip report. --- .../src/runtime_lane/grouped_submissions.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/crates/metal2vulkan-validation/src/runtime_lane/grouped_submissions.rs b/crates/metal2vulkan-validation/src/runtime_lane/grouped_submissions.rs index 4058c8045..7c05796ce 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/grouped_submissions.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/grouped_submissions.rs @@ -456,13 +456,21 @@ struct Scenario { /// are read, waiting for `E` at `last`, completes: no host call reads a plain event's value), and /// the layer reports nothing. /// Its devices take their queue plan (`at_plan`): the work of the tests that call it -/// changes placements under the lane's queue limits. +/// changes placements under the lane's queue limits. Its queues take no turns on a `VkQueue` they +/// share ([`QueueTurnPolicy::CommitOrder`]), so the steps found ready together go as the grouping +/// sends them: under `Fair`, where the two queues share one (lavapipe, RADV, ANV), a queue's +/// steps after the first are held for its turn wherever its expected run prices its work in +/// flight past the turns' budget, which a GPU shared with other work lengthens (the warm fills +/// took 10 to 450 ms from commit to completion beside the module's other tests on the Radeon +/// 780M and the RX 7900 XTX), and held so they reach the scheduler one at a time and group +/// nothing. The turns are `tests::queue_turns`' to test. fn event_scenario(completion: CompletionPolicy, steps: &[Step], last: u64) -> Scenario { let messages = Messages::default(); let cache = ScratchCache::new().unwrap(); let counted = { let device = validated_device_with(TEST_DEVICE, &messages, cache.path(), |options| { options.policy.completion = completion; + options.policy.queue_turns = QueueTurnPolicy::CommitOrder; at_plan(options) }) .unwrap(); @@ -988,6 +996,10 @@ const GROUP_RUN: std::time::Duration = std::time::Duration::from_millis(16); /// running work; after a command buffer of the queue's own ran [`PAST_GROUP_RUN`], alone again. /// Every command buffer completes with its own fill, and the layer reports nothing. Where the device /// groups nothing, or the two queues submit to different `VkQueue`s, no round's count is checked. +/// The queues take no turns on the `VkQueue` they share ([`QueueTurnPolicy::CommitOrder`]), as in +/// [`event_scenario`]: under `Fair` the small fills' queue is held for its turn wherever its +/// expected run prices its work in flight past the turns' budget, and its fills then reach the +/// scheduler one at a time. #[test] fn a_queue_s_batches_group_within_their_run() { let messages = Messages::default(); @@ -995,6 +1007,7 @@ fn a_queue_s_batches_group_within_their_run() { let (grouping, shared, rounds, past) = { let device = validated_device_with(TEST_DEVICE, &messages, cache.path(), |options| { options.policy.completion = CompletionPolicy::Grouped; + options.policy.queue_turns = QueueTurnPolicy::CommitOrder; at_plan(options) }) .unwrap();