Queue sharing: a command buffer whose VkQueue waits on the GPU for another's work counts that wait in its long mark

The Adaptive long mark read a command buffer's own GPU timestamps alone. A batch that waits on the
GPU for another VkQueue's work (an MTLEvent's signal pending there, the tracker's wait for another
VkQueue's writes, new resources' first work there) writes its start timestamp only once that wait
is met, so a queue of short command buffers, each waiting for another queue's 30 ms one, never went
long: it kept sharing its VkQueue, and every command buffer the queues sharing it committed behind
each wait waited for the other queue's whole long command buffer.

Now submit_batch notes, at the first batch whose VkQueue it hands such a wait (an event wait whose
signal is pending on another VkQueue or is the caller's, EventTimeline::waits_across; a tracker or
first-work wait on another VkQueue), the host time its submission was called (Times::waited_across).
place_gpu_times marks the queue long also where more than LONG_HEAD ran from then to the command
buffer's GPU end, placed in the host's time. A command buffer with no such wait is timed as before,
by its own timestamps, so the host-view false marks the module docs describe stay out.

The device test a_compositor_beside_a_queue_waiting_on_the_gpu_for_long_work_keeps_its_latency now
also asserts that the waiting queue goes long (WorkCounts::queues_gone_long >= 2). The QueueSharing
notice's cost, docs/API.md's catalogue entry and the FAST-PATHS row name the wait.

Verified: cargo fmt; unit test a_wait_crosses_queues_where_its_signal_is_pending_on_another; the
build, clippy and the 5080 device run are dispatched.

(cherry picked from commit 6391625634472fb158b6477dfad36340956ae2dd)
This commit is contained in:
Anees Iqbal committed 2026-11-10 05:16:05 -08:00
1 parent 36ecd59256
commit f0b1976e58
11 files changed
+114 -14

No files matched your search

+3 -3
View File
@@ -3064,9 +3064,9 @@ bound.
`Device::new_command_queue_unshared`, which never move and which no queue joins. Cost: its
command buffers run in one `VkQueue`'s order with those of the command queues that share it,
where Metal's queues wait for each other only inside one command: the first command buffer of
each such queue whose GPU work runs over 2 ms holds the command buffers the others committed
behind it for its whole length, and its later ones while its queue holds work,
until that queue moves at its next idle point; a command buffer's GPU start time includes the
each such queue whose GPU work, or whose wait on the GPU for another `VkQueue`'s work, runs
over 2 ms holds the command buffers the others committed behind it for its whole length, and
its later ones while its queue holds work, until that queue moves at its next idle point; a command buffer's GPU start time includes the
other queues' work before it; QueueSharingPolicy::PerQueue keeps each command queue on the
`VkQueue` it took at its creation.
- `metal2vulkan-degrade-heap-texture-larger-than-metal` (precision). `HeapTextureLargerThanMetal`: A