Every compute encoder logs now, and a group of folded encoders holds its
logs until the commit (encoder_fold.rs), which gave each back alone to
spares that kept 16: a 2300-encoder command buffer allocated about 2280
logs and freed them at its commit. dispatch_chain --host 20 --only encoders
--dispatches 2300 on the RTX 5080 node, no buffer over host pages: the
commit's share per dispatch went from 113-126 ns to 221-223 ns.
SpareLogs::give_held clears the held logs outside the lock and keeps them
under one lock, and each kind's spares keep as many as the last commit that
held logs gave back (at least 16), all of a kind together within 1 MiB of
room (SPARE_ROOM_BYTES, what 16 logs of SPARE_LOG_BYTES took before), so a
next command buffer's encoders reuse them rather than allocate.
Giving them back under one lock at the commit did not bring the commit's
share back: dispatch_chain --host 20 --only encoders --dispatches 2300 on
the RTX 5080 node, no buffer over host pages, ns a dispatch (two runs each):
commit 137/127 before every compute encoder logged, 225/238 with the logs
given back one by one, 235/217 under one lock; bind 50/50, 97/97, 60/59, the
spares' reuse taking the first pushes' allocations off the bind. Each held
log's clearing (its calls' handles let go of) and move stayed on the
committing thread.
split_failure now leaves the logs no split takes held, and the release gives
them back (State::unsplit_logs, SpareLogs::give_held) beside the logs the
encoders kept, on the queue's handler thread, before the waiters return. A
2300-encoder command buffer's held logs (about 0.7 MiB) live until it
completes rather than until its commit.
RUNTIME_VERSION 2273: fold logs are spared across command buffers and given back on the handler thread.
Verified (dchain, at 3c895e7444 = this tree but the pin file): lavapipe full runtime suite 2583/2584 (the other: host_ram_copy_device private-bit, roip's); clippy x3 and rustdoc 0 (28705, 28706). ABAB on the 5080 node CPU, dispatch_chain --host 20 --runs 9 --only encoders --dispatches 2300, ns a dispatch: commit base 127/128, RV2272 214/219, this 130/139; bind 50/50, 98/97, 59/61; committing thread 3424/3467, 3545/3568, 3463/3500 (+35 over base); the clearing (~79) runs on the queue's handler thread (208/209 vs 129/129).
Squashed from steelbrain/dchain3 8554aa06cc..0053613e6c.