Files
metal2vulkan/crates/metal2vulkan-runtime/src
Anees Iqbal 4b37878cda RUNTIME 2265: staging queue grows its command-buffer ring to 128 rather than wait on the host past 8
A staging submission that found its queue's 8 command buffers all pending
waited on the host for the oldest, under the staging lock, on whichever
thread submitted: the scheduler's among them, inside a batch's submission
(flush_staging), which held every queue's submissions until the staging
queue ran. On a device whose staging queue is of compute work that can be
as long as the program's kernels run.

Now the staging queue makes another command buffer instead, up to 128
(MOST), and frees those past the 8 it keeps once the host saw their
submissions complete, at the next submission. Past 128 it waits as before.
The fill queue keeps its 8: its batches submit only after they found room.
The doc comment says why 128 and what it costs (ANV below Xe-HP: a 64 KiB
binding-table block per command buffer, 8 MiB at the cap).

Counted: WorkCounts::staging_buffers_grown (made past the 8) and
staging_buffer_waits (host waits for a command buffer to come free, either
queue), classified as submission work in the conformance cost table.

Tests: a unit test of the ring's choice (reuse the oldest complete, free
the other complete ones past 8, grow below the most, wait at it), and a
device test that holds 20 staging submissions on the GPU and checks every
round's command buffer is submitted meanwhile with no host wait, then that
the ring is back to 8 after one more round. The device test passes trivially
on a device without a staging queue (lavapipe).

RUNTIME_VERSION 2265: staging submissions no longer wait on the host for a
command buffer below 128 pending.

Verified (gbkern, at ffd3a51a79 on c796a88d6a): clippy x3, rustdoc, unit 29/29,
api_signatures/api_surface 15/15, lavapipe 4/4, RTX 5080 4/4 (20 staging
submissions held, 12 command buffers made past 8, 0 host waits, back to 8 after).
2026-11-14 00:22:06 -08:00
..
…
…
2026-11-12 17:38:31 -08:00
…
…
…
…
…