Record that a commit can wait for the driver's submission

What: a known-gap row in docs/FAST-PATHS.md. Where the scheduler is free,
commit() runs the submission pass, vkQueueSubmit included, on the
committing thread, so a submission the driver holds holds commit(), where
Metal's commit returns at once.

Why: tests::completion::a_completion_on_one_queue_is_seen_while_other_queues_are_waited_for
fails on the RTX 5080 Laptop GPU (NVIDIA 615.71.09) when it runs beside the
runtime_lane scheduler tests, about 20 processes opening devices at once.
It failed in 4 of 4 such runs, at fd22785008, 365aef412c and the round's first composed tree, and
passed 4 of 4 alone. Scratch timestamps (not committed) showed what happens.
In the slow round, the second commit took 116.6 to 177.5 ms. It was handed
off 0 times. The thread spent 3.5 to 3.8 ms on the CPU and 0 ms waiting
runnable, with 29 to 45 voluntary context switches: asleep in the driver.
The GPU ran that command buffer at 0.0 to 0.1 ms, and its vkQueueSubmit
returned 116 to 177 ms later. The first command buffer's completed handler
ran 0.1 ms after its commit, so the completion path is prompt. The test
only sees the delay because its own thread began waiting after its commits
returned. In one round the third commit took 58.8 ms (7.6 ms on CPU), and
its GPU work started only as the call returned. Across the runs the
stalls took 58 to 226 ms, in 1 or 2 of the 1,800 commits of a run.

The test split (judge completion from the completed handler, check
commit()'s own wall time apart) and the product choice (hand each commit
to the scheduler thread, or do so after a stall) are deferred: the user
ruled that known failures are recorded now and fixed after this push; the
product choice is the owner's.

Verified: docs only; tests::fast_paths run on msi-laptop (see the LAND
message for the result).

Versions: unchanged.
This commit is contained in:
Anees Iqbal committed 2026-10-14 20:17:37 +03:00
1 parent c5da2920fd
commit f25dfd8ea2
1 file changed
+12
+12
View File
@@ -117,6 +117,18 @@ driver's. Each is open work.
each timed command buffer writes: on an M4 a bare barrier took 14.7 µs alone and 167.8 µs with
them. `DeviceOptions::gpu_times_from_host` (off by default, announced) answers GPU times from the
host clock and spares them.
- **A commit can wait for the driver's submission.** Where the device's scheduler is free (no host
step or submission check pending), `commit` submits the command buffer's ready batches itself,
on the committing thread, so that no thread wake lies on their path (`scheduler/mod.rs`). A
`vkQueueSubmit` the driver holds then holds `commit`, where Metal's `commit` returns at once. On
the RTX 5080 Laptop GPU (NVIDIA 615.71.09), beside about 20 other processes opening devices and
running work on it, 1 or 2 of the 1,800 commits of a run of the runtime's completion test took 58
to 226 ms, none handed to another thread. The committing thread slept in the driver meanwhile
(3.5 to 7.6 ms on the CPU, none of it waiting to run). Mostly the GPU ran the command buffer's
work within 0.1 ms of the call's start, and the one committed before it was seen complete 0.1 ms
after its own commit (its completed handler ran then); once, the work started only as the call
returned. Handing each commit's submission to the scheduler thread, or doing so once a device's
submission has stalled, would return at once; it is not built.
- **A view of another format without `PixelFormatView` usage** is a shadow image whose texels are
copied at each use (`shadowed-texture-view`): about 50 to 95 µs a command buffer for a 64x64
texture, measured on the M3 Max and M4 (MoltenVK) and the Radeon 780M. Making the texture with