Files
metal2vulkan/crates
Anees Iqbal 2818c1fcd0 RUNTIME 2303: a committing or waiting thread's pass leaves other queues' batches behind an unshared head it cannot send
A thread about to block (Scheduler::submit_before_waiting) or one that just committed with
commit_and_submit (Scheduler::submit_at_commit) takes the inbox in and submits only the batches
that need nothing of the scheduler's thread (submit_plain_ready, plain_ready). take_in counts
the unshared commit taken, so RUNTIME 2300's gate in plain() lets other queues' batches through;
Order::next puts the unshared queue's head first but skips any head `ready` refuses and goes on
to the next. So where that head is ready for the scheduler's own look but not plain for this
pass (a submission or scheduled handler for a waiting thread, a host step already recorded, a
switch of storage forms riding on it), another queue's batch on its VkQueue whose room had come
was submitted ahead of it, where the scheduler's pass sends the unshared one first
("Heads put first").

The rule: such a pass notes the VkQueue of an unshared head it leaves that the scheduler's look
would find ready (first_for_the_thread: nothing of submit_ready's holds, every event value
reached), and leaves the other queues' batches held back there to the scheduler's thread too
(left_behind_unshared), which its caller already wakes for what it left: that thread's next pass
sends the unshared one first and them next. Bound: one wake and one pass of that thread. An
unshared head not ready for that thread either holds nothing, as its own pass lets the batch go
then. submit_ready's five holds move into holds_back(), shared by both, with the same order and
the same counts; CommandBufferShared::held_back_on() factors what held_for_unshared and
unshared_commits both tested. No switch, no counter, no public item, no Degradation kind.

Not covered, a known limit now written in unshared_hold.rs ("Deferred commits"): a commit left
to the lowering thread under RenderLoweringPolicy::Worker; counting it posted at the call would
hold other queues' batches through the lowering backlog, leaving the GPU idle.

Tests (queue_share_device, lavapipe): a waiting thread's pass with the scheduler's thread held in
a submission handler (waiter_submits::Held, now shared) takes in an application's fill and an
unshared fill with a scheduled handler; a committing thread's pass (commit_and_submit, default
Grouped completion: the fill goes alone where the device groups) takes in an application's fill
while the unshared queue's dispatch waits with its host step recorded (the pool's making held,
the steps' thread held at new trace points Step and Stepped while the scheduler's thread is held
in a submission handler). Each asserts that the pass ran and that the unshared one began first.
Docs: unshared_hold.rs ("Passes of other threads", "Deferred commits"), FAST-PATHS unshared
isolation row, submit_plain_ready.

Verified (msi lavapipe, m3-max-29578 at 258953844d): clippy plain and --cfg m2v_cpu_icd 0;
91/91 of unshared_hold, queue_share, queue_share_device, scheduler, scheduler_held_wakes,
scheduler_wakes, inbox, waiter_submits, commit_and_submit, hold_sites, dispatch_pending.
Both new tests: passes 1, batches the pass submitted 0, the other queue's buffer began
0.100/0.108 ms after the unshared one. Negative control m3-max-29586 (rule off): both fail,
the pass submitted 1 and the other buffer began 0.35/0.34 ms before the unshared one.
2026-11-14 09:01:26 -08:00
..