From 333adf36cf5a31caeba882f626dbd26355aa9176 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sun, 22 Nov 2026 15:33:15 -0800 Subject: [PATCH] Runtime: a head held behind an idle queue's sharer is staged into a group of its own, held What: next_ready skips a head that sends_past holds only where it would join a group held whose first command buffer sends_past does not hold. Otherwise it stages the head as before: into a group of its own, or into a held group whose first is held too. Such a group waits in its queue. It has no room and wants none, and no host wait sends it through (has_room, wants, goes), until the earlier commit is submitted. Why: 530842c0bc skipped every such head, so it stayed committed and unscheduled until that commit was submitted. every_device_submits_a_write_on_an_idle_queue_before_another_queues_later_read waits for its reader to be scheduled, held in a group for the device's room. It timed out at the reader's status on lavapipe (m3-max-68984, 674 of 675) and on the Iris Xe (m3-max-68985, 676 of 677). A held group goes only by those three gates, so staging the head into one changes no order. Skipping it is needed only where it would join a group that goes before the earlier commit. Verified: not run when committed; its jobs follow. --- crates/metal2vulkan-runtime/src/submit.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/submit.rs b/crates/metal2vulkan-runtime/src/submit.rs index 0fd48a4d8..474e83b12 100644 --- a/crates/metal2vulkan-runtime/src/submit.rs +++ b/crates/metal2vulkan-runtime/src/submit.rs @@ -1650,15 +1650,17 @@ impl WorkState { if fifo.blocked && !waits { continue; } - // A head that would go before an earlier commit of another queue Metal submitted, or - // join a group that would, is not staged until that one is submitted - // ([`sends_past`](Self::sends_past)). + // A head that would go before an earlier commit of another queue Metal submitted + // ([`sends_past`](Self::sends_past)) does not join a group held that would not: it + // waits for that group to go, and then leads one of its own, held until that commit + // is submitted, as a group whose first would go before it is. let past = |pending: &Pending| self.sends_past(index, pending); - let past = (fifo.group.is_some() && fifo.sends().is_some_and(past)) - || (fifo.entries.front()).is_some_and(|head| { + let joins = (fifo.group.as_ref()).is_some_and(|group| !group.partial) + && !fifo.sends().is_some_and(past) + && (fifo.entries.front()).is_some_and(|head| { head.error.is_none() && head.pending.as_ref().is_some_and(past) }); - if past && !waits { + if joins && !waits { continue; } if let (false, Some(at)) = (waits, fifo.entries.front().and_then(|head| head.held)) {