Files
reims-vgpu/docs
Anees Iqbal f67dcb7800 🐎 Deal a long command buffer's chunks to two threads
A buffer walked in two ranges at once reached the GPU in two steps: the first
range's parts as they were cut, the later range's whole work only at the join,
since queue order puts it after the first range's last part. On um870's 3090
(26.7.2, Launchpad) that left 3.7 ms of GPU work after the walk's end
(m3-max-31226), and a split into any number of contiguous ranges keeps such a
tail.

The walk now cuts such a buffer at encoder ends into chunks of 4 KiB of ops or
more (about 31 for WindowServer's 125 KiB Launchpad frame, near the 36 parts
its walk on one thread cut) and deals them in turn: the lane's thread walks the
even ones and one helper the odd ones, handed over at once. Each chunk goes
into a command buffer of its own, made from an empty one on the same thread
(CommandBuffer::part). After each of its own chunks the lane commits every
chunk walked, in their order, as a part, waiting for the helper only for the
chunk it commits next, so the GPU is fed throughout the walk. A part goes
where the whole buffer could be committed then, as a cut does; at the walk's
end, once every wait of its commit is met. The last chunk's command buffer
carries the buffer's handlers, records and present, as before.

The chunks' command buffers are made before any chunk is walked, each only
while its queue holds room, as a cut's make is: a make waits while the queue
holds 64 uncompleted command buffers, and a dealt walk holds walked chunks
uncommitted while its commit's gate is closed, so a make inside the walk, or
one look at the room for every chunk while the lane's own walks and begins
make command buffers on the queue, could wait for room only its own commits
free, and the walk would never end. Where the room runs out first, or the
platform makes no command buffer for a chunk, the buffer is walked whole.

What wslat kept stays: the prescan's op set and its pin to KeptWhole; a part
that fails from an encoder on takes in every later chunk in their order
(fold); Whole fails the buffer, counted as two-ranges-kept-whole; a fault
answers the first faulting chunk in their order, nothing at or after it
committed; what each chunk saw written of laid-out caches goes to the buffer
in their order; chunks no helper started by the end of the lane's first are
taken back and walked as a whole walk goes on. The cbpar trace event gives
each buffer's chunks, and a new cbdeal event each chunk's walk, wait and
commit. The platform is unchanged; its doc comments name the deal.

Measured on um870's RTX 3090, 26.7.2 cold boots walking Launchpad (wlb7
m3-max-31913 before, wla7 m3-max-31914 after, same harness, fatal 0 each),
the two Launchpad samples: GPU work left at the walk's end 3.42/3.56 ms ->
1.61/1.74 ms p50, present take to shown 10.95/10.84 -> 8.69/8.82 ms p50
(p90 12.09/12.09 -> 9.19/9.55), refresh to shown 14.55/14.41 -> 12.47/12.56
ms, frames answered two refreshes late 9/3 -> 0/1.
2026-11-15 06:22:03 -08:00
..