From dbc0bef1a58d2f4bbd2164ecad7ea380b7646b5c Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sat, 14 Nov 2026 20:53:26 -0800 Subject: [PATCH] The held-work tests encode every command buffer before the first commit HeldWork::run encoded and committed its three long command buffers in turn. So the window between the first's commit and the unshared one's held two encodes of the fills. That was about 460 fill_buffer calls of 64 MiB each on an RX 7900 XTX, which took 2 to 4 ms to encode on a quiet host and 25 to 38 ms on a loaded one. - On the loaded host the unshared commit came 50 to 60 ms after the first long one started. - The scheduler had let the second go at the first's end, as nothing unshared was pending, so an_unshared_queue_s_command_buffer_goes_ahead_of_other_queues_held_work and a_late_pass_sends_an_unshared_queue_s_command_buffer_before_work_let_go_with_it failed. - The same job failed them at pin 94 (13bac091e1) as at pin 96: um790's load average was 12 to 17 on 16 cores, and the probe's timings put the time in the encodes (m3-max-31186). A long one's commit took 0.1 to 1 ms. The three long ones and the unshared one are now all encoded first. Then the long ones are committed back to back, as "three committed at once" means, and the unshared one once the first is scheduled. --- .../src/tests/queue_share_device.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/tests/queue_share_device.rs b/crates/metal2vulkan-runtime/src/tests/queue_share_device.rs index cfce03864..a3a9b9b92 100644 --- a/crates/metal2vulkan-runtime/src/tests/queue_share_device.rs +++ b/crates/metal2vulkan-runtime/src/tests/queue_share_device.rs @@ -1212,19 +1212,23 @@ impl HeldWork { assert_eq!(active(), compositor == Compositor::Active); let expected = self.app.serving().expected().nanos().unwrap_or(0) as f64 / 1e6; let before = self.device.work_counts(); + // Each command buffer is encoded before the first commit, so the three long ones are + // committed at once and the unshared one as soon as the first is scheduled, however fast + // the host encodes: a long one's fills (about 460 on an RX 7900 XTX) took 2 to 4 ms to + // encode on a quiet host and 25 to 38 ms on a loaded one, and encoded between the commits + // they let the second go at the first's end before the unshared one was committed. let longs: Vec = [first, self.fills, self.fills] .into_iter() - .map(|fills| { - let command_buffer = long(&self.app, &self.big, fills); - command_buffer.commit().unwrap(); - command_buffer - }) + .map(|fills| long(&self.app, &self.big, fills)) .collect(); + let short = self.small(); + for command_buffer in &longs { + command_buffer.commit().unwrap(); + } match compositor { Compositor::Active => longs[0].wait_until_scheduled().unwrap(), Compositor::Quiet => longs[1].wait_until_scheduled().unwrap(), } - let short = self.small(); let (short, committed) = match late { false => { short.commit().unwrap();