What. A pass that ends with batches held for one kernel submission keeps them held while their
VkQueue runs two or more earlier submissions (Group::keeps). It now sends them instead where a
submission handler the thread runs once its passes end (scheduler::round) is of a command
buffer of another logical queue (Metal command queue) than a batch held:
scheduler::holds_back_another_queue, over the round's handler list and the batches held with
their logical queues. The handlers of the held batches' own queue still keep the group held.
CommandBufferShared::logical_queue reads a command buffer's queue identity for it.
Why. A submission handler runs on the scheduler thread, and a held batch's handlers run as it
is held, before its group goes to the driver. Where two command queues share one VkQueue on a
driver that merges, a batch of one queue held and kept behind running work, and a batch of the
other queue with a handler that waits for the first one's completion joined the group: the
group stayed held until the handler returned, so the handler waited for work its own return let
go (the deallocator lane test on the Iris Xe hit it once, its handler waiting 60 s). Metal does
not do that: on an M3 Max under macOS 27.0.1 (probe cross_queue_handler_waits), a command
buffer's completed handler reached another queue's scheduled or completed handler that waited for
it in each of 30 runs, 7.6 to 9.3 ms after the wait began, b committed before a included. On one
queue it never did (the 5 s bound in each of 10 runs): Metal runs one queue's handlers one at a
time, so the runtime keeps the group there and promises nothing more than Metal.
Cost: a group mixing two queues' batches is no longer kept past a pass in which a submission
handler of one of them runs; it goes then, the batch that joined last included, in one
submission. Measured on a lane (frame_costs_over_imports, the guest's shape) in the runs that
verify this commit.
Docs: group.rs ("Kept while its queue runs earlier work", Group::keeps),
CommandBuffer::add_submission_handler ("Keep it short"), the runtime README's handler entry,
and FAST-PATHS.md's grouped-submission row.
Verified: cargo fmt. Build, clippy and runs (the previous commit's test, without and with this
change; the deallocator lane test as it was) are potluck jobs on the Iris Xe and the XTX.
(cherry picked from commit 8d04b2d15d3cb745363428fdc9acbbb9ca2eb868)
(cherry picked from commit 2cbd8a970905d931b7be39c92fbdd18d6024f62a)