Files
metal2vulkan/docs
Anees Iqbal be47523f80 State queue sharing's residual stall and the unshared form for queues that must never wait
What: docs/FAST-PATHS.md's queue sharing row, docs/API.md's policy bullet and the runtime
README's new_command_queue_unshared entry now state the residual stall exactly: once per logical
queue that goes long, for a queue that joined its VkQueue during its short phase, about one long
command buffer's length. They also say a queue that must never wait (a compositor's) is made
with Device::new_command_queue_unshared. The row's cost column carries the measured rates.
The queue_share example's rates mode takes --threads, --in-flight and --one-vk-queue for one
shape. It prints each command buffer's GPU end and commit to its completed handler, the
submission, scheduler and wake counts per command buffer, and the busiest threads' CPU from
/proc (Linux).

Why: on the RTX 5080 Laptop GPU (NVIDIA 615.71.09, release, 3 runs a side), the trap and
slow-alternating shapes cost a shared compositor 64 completions over 10 ms, at most 29.4 to
30.6 ms, in every run, with one join each. That is the first long command buffer of the
application it joined during the application's short phase. PerQueue had none in 5 of those
6 runs and 4 in the sixth (at most 3.7 to 10.7 ms). An unshared compositor had none over 10 ms
in any run. No join rule built on what a queue has shown can avoid the first one: the long
command buffer gives no sign before it runs. A re-pick at submission would not either: the
compositor holds about 4 uncompleted command buffers at each commit (p50 commit to handler
0.78 to 0.87 ms at a 208 us period), and the stall is all or nothing in a queue's own order.
So the docs name the unshared form as the answer for such a queue.

The probe settled the 2 threads x 3 in flight drop (15.4k against 26.0k a second in one run):
it was the lock hold's warm-up. In the hold's first runs both policies ran slow (11.1k and
10.4k), and later runs gave Adaptive 46.5k and 39.7k against PerQueue's 25.2k and 26.5k. Two
queues on one forced VkQueue ran 38.1k to 46.6k under PerQueue and 41.4k to 49.9k pinned under
Adaptive, so one VkQueue is not slow in the runtime's path. No runtime thread was busy in the
slow runs (scheduler 10%, handler threads 5%, waiters 3%), and every shape made one
vkQueueSubmit per command buffer.

Verified: tests::fast_paths, degradation_catalogue and degradation_sites (25 passed); clippy of
the example with all features.

(cherry picked from commit b1dbea95dad3a5a156191df01084db0f86cb67a0)
(cherry picked from commit 24af60dbf8175da8e60ea24f38f9103c20c23e8b)
2026-11-03 02:49:35 -08:00
..