What: submit_path gains a `cross` mode. Command buffer A on one queue signals an event at its end
and command buffer B on a second queue waits for it on the GPU. The mode prints A's commit to
A's handler and to B's handler (p50, p90, p99), and how many of 2000 rounds ran B's handler
before A's. It covers shared and plain events, completed or completion-seen handlers
(`--seen`), and gaps of 0 and 2000 us between rounds.
Why: it measures the completion order the previous commit fixes, and its cost, on any device
the example runs on.
Verified on the M3 under MoltenVK 1.4.2: it ran before and after the fix, two pairs each.
Before, 3/2000 rounds ran B's handler first (plain events, 2 ms gap); after, 0. The latencies
are in the previous commit's message.
(cherry picked from commit 521479bb0bf6324131f4fcf0fe9519b84d011160)
(cherry picked from commit 85c5343c65375ef437ff17bb5328bda381cc1438)
What: the bench's latency, cpu and threads rows can give each fill a
submission check that answers None, as a consumer's detach check does.
Why: to measure commit to completed-handler latency for checked command
buffers before and after the committing thread runs their checks
(commit_and_submit), on the RTX 5080.
Verified: clippy -D warnings on the runtime's examples (all features).
(cherry picked from commit 1677e2c42bf862411799073c34f6e8f35552eb3b)
(cherry picked from commit bb4b6681a74eaad43cb8dd3d96d7386162d890fc)
The threads mode's committing threads ended before the process-wide
reading after the run, and their per-thread CPU went with them, so the CPU
that commit_and_submit moves onto them was not counted. Each thread now reads
its own CPU (CLOCK_THREAD_CPUTIME_ID) before it ends, and the mode prints
their sum per command buffer. The main thread is grouped by the name's prefix
too, since a copied binary runs under another name.
Verified: clippy -D warnings on the example; run on the 5080 for the M1 and
wake numbers.
(cherry picked from commit 7822ca3293633c6da2fa4a1a734e137dc792ddbc)
(cherry picked from commit 951eb7841e4274bce6b276d36ae89245ad554ba4)
(cherry picked from commit 9e2d82e104f88da4f98cc14073a48f3eaaff97d8)
--at-commit makes the latency, cpu and threads modes commit with
CommandBuffer::commit_and_submit instead of commit. The new threads mode
runs the cpu shape (a 16-byte fill with a scheduled and a completed
handler, never waited for) on 1 and on 8 threads at once, each with its
own queue, and prints command buffers a second in all and the CPU per
command buffer. These measure the committing thread's own submission.
Verified: builds in release; run on the M3 Max and the RTX 5080 Laptop
GPU for the M1 numbers.
(cherry picked from commit b100c3aa5c52d7d071223f7b6e500902afba5ccf)
(cherry picked from commit a3d3d6ca16bd783b23298ac4d14b9fbe127dfe84)
(cherry picked from commit dca3e8460fb5dfdb5d0bef3131af99776aebaeb3)
The bench example gains what the numbers for the completion path need:
- latency rows also time the command buffer's GPUEndTime to the handler's
start, both on the runtime's host clock (host_time), next to commit to
the handler's start;
- --bare adds the same rows with no scheduled handler: a lone 16-byte fill
and its one callback;
- an idle mode: after one fill, wakes a second over 3 s with nothing
committed, as voluntary context switches by thread group on Linux
(/proc/self/task/*/status) and, everywhere, the scheduler's sleeps and
sleeps ended at its slice from the work counts. macOS's per-process
switch counts read back inconsistently, so none is printed there.
Verified: built in release on the M3 Max and run against 17a1c34c1c
(completion-seen calls mapped to completed handlers) and c87df4e91a.
(cherry picked from commit 32643c1ccb4ff129a5c799aeca0f2fa85a7ee844)
(cherry picked from commit 793f74e38f19a26cdf1c510489daae307fa62219)
(cherry picked from commit 85547774368e2efc0d2d29aa2fba7c1075448d88)
What: crates/metal2vulkan-runtime/examples/submit_path.rs, registered in the crate's manifest
(autoexamples is off). Modes: latency (one thread commits a 16-byte fill with a scheduled and a
completed handler, or with --seen a completion-seen handler instead, and blocks on a condition
variable the handler signals: commit to handler start at idle gaps of 0, 100 us, 300 us and 2
ms, p50/p90/p99 over 2000), cpu (the same command buffers as fast as the slots allow, never
waited for: command buffers a second and CPU per command buffer by thread group, from
/proc/self/task/*/schedstat on Linux, else the process's CPU less the committer's), empty
(commit and wait of a command buffer with nothing encoded, back to back and at a 300 us gap;
then never waited for, with the queue submissions made).
Why: the consumer's per-command-buffer path (record, add handlers, commit, never wait) had no
measurement in the tree that runs on both the M3 Max and Linux; host_ab is being changed
elsewhere.
Verified: built in release on the M3 Max and run there (the numbers are in the change reports,
not here); clippy clean with all targets.
(cherry picked from commit 067b6a7792210909bbf4f1e66bf2eb9b39334c0d)