Files
metal2vulkan/crates
Anees Iqbal 3f2be1ea4d Runtime: held work goes only by room, teardown and send-through, never because a completion round runs
The completion thread set Done::busy and then woke the submit thread (complete.rs, at each
round), and a pass that read busy held nothing: every held group and every command buffer held
for room went to the VkQueue at once. The wake that announces a completion is sent right after
busy is set, so whether room held was a race between a round's length and a thread wake: on the
3090 it mostly held, on the Iris and on the XTX's short arm the backlog flooded past room (A/B
jobs m3-max-64198, 64241: B's p90 two to three of A's command buffers).

The planner's ruling (A): busy goes. Done::busy, its two stores, the read in pass and the
parameter through next_ready, waits_for_room, hold's callers, step, Fifo::goes and unheld are
deleted; held work goes when a completion leaves room, at teardown, or on a send-through (a host
wait, send_now, a fence's updater). `completed` is still raised before the submit thread's mark
is read, so a completion is never missed. While a round runs it sees no completion, so held work
waits for the round's end: a completed handler or listener longer than the work in flight
leaves the GPU idle for the rest, where Metal would go on. The README records that known gap
beside the scheduled-handler one and drops "a slow completed handler holds no later
submission".

Test: every_device_holds_work_for_room_while_a_completed_handler_runs parks the completion
thread in a completed handler, commits three on a queue with room for two, and finds the third
held in a group, two submissions sent, once a later commit on another queue is scheduled. With
busy it went at once (3 in flight). The waits for !busy in the two_queues and behind_busy
helpers and the upload test's trace are gone with it.
2026-11-21 10:26:32 -08:00
..