Files
metal2vulkan/docs
Anees Iqbal 37db40177b Command queues take the VkQueue the fewest live queues hold; unshared ones an empty one under every verdict
A new command queue took the round robin's VkQueue by a creation counter (made modulo the
round robin), which never reuses a slot: a guest makes about 340 queues past NVIDIA's 14 in a
250 s walk, so live queues landed together while other VkQueues stood empty. An unshared
queue (a compositor's) got a VkQueue of its own only where the device shares (an Adaptive
verdict of Idles); under PerQueue, on MoltenVK, and on a device that answers GPU times from
the host (reims-vgpu's, Unchecked) it took the round robin's next, so app queues made later
landed on it every 14th make. Guest walks (reims's logs, read in place): unshared command
buffers behind another queue's batch 1062 in one 3090 walk (39 over 16 ms, longest 33.8 ms),
5 in the next on the same build; 511 on a 2080; 2048 on the M3 (437 over 16 ms).

Now, under every policy and verdict, a command queue takes, as it is made, the round robin's
VkQueue the fewest live command queues hold of those no unshared queue holds, the first in
turn from the counter among equals (queue_share.rs fewest_held, Device::take_round_robin):
one pass over the round robin's VkQueues' counts, atomics alone, at creation only; nothing
scans the command queues. Its claim is made before it reads the unshared count, as an
unshared queue's is made before it reads the live count, both sequentially consistent, so the
two never both succeed. An unshared queue takes one no command queue holds where one is free
(the existing unshared_order, now ungated), else the one the fewest hold.

Counts: WorkCounts::command_queues_live_most (the most command queues the program held at
once: what a walk needs to size the plan by) and unshared_queues_sharing_a_vk_queue (an
unshared queue that found no VkQueue free of other queues). queues_sharing_a_vk_queue keeps
its meaning, the queues made past the round robin's VkQueues; unshared queues now count among
them under every verdict, as they did where the device did not share. QueueLimits notes keep
theirs, an unshared queue's included.

Tests: tests::queue_share's pure churn shaped like a walk (354 made over 14 VkQueues, at most
12 live, an unshared one kept): no queue placed beside a live one while one stood empty and
the unshared one never shared, against a positive count by the old rule; device test
over_a_churn_queues_take_the_least_held_vk_queue_and_unshared_ones_an_empty_one under
Adaptive, PerQueue and untimed Adaptive. The helpers that share a VkQueue on purpose (beside,
the lane's queue_where) keep the queues they make until one lands there.

Docs: QueueSharingPolicy, new_command_queue_unshared, new_command_queue_for_presenting,
queue.rs and queue_share.rs module docs, docs/API.md, the runtime README, FAST-PATHS's queue
sharing row and its known gaps.

Not yet built or run: potluck jobs follow.
2026-11-11 21:51:22 -08:00
..