Indirect batches: scratch buffers go to a pool when their list has run #1441
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1441"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by saltdam36 on 2026-11-28T20:04:46Z.
What
HostList::batch_placepushes a new scratch buffer whenever a recording needs more batches than the list has had before, andbatches_commonresets the count but never the vector. So every host list keeps the buffers of its busiest recording for the rest of the run.With
VICTORY_INDIRECT_BATCH=1on an RX 7800 XT (16 GB, Series S profile, no DLSS) that was 12,719 buffers in eight minutes of open-world play. The system counts 256 KiB for each (card use rose in steps that match "made so far: N card buffers" x 256 KiB to within 1 %), so 3.2 GB in all. Card use went from 11.1 GB to 14.3 GB against a budget of 13.3 GB, and time on the card went from about 5 ms to over 200 ms a frame (4 fps). Nothing the layer counts moved in that time (texture copies, blocks, targets and buffer copies were all flat), and the texture queue said "no room" throughout, since it sees the system's figure but cannot let these go.VICTORY_INDIRECT_BATCH=2(the launcher's value) makes fewer batches a recording, so it grows more slowly; I have not measured how much. This may be one part of #848 and #1378; I cannot say it is all of it.Change
A list gives its batch buffers back in
HostList::reset(every submission of it has run, andbatches_commonleft them in the common state), andbatch_placetakes one from that pool before it makes a new one, as scratch chunks and preludes already do. 512 are kept; more are retired withretire_resource. One file, about 40 lines.(Edited: this replaces the version first pushed here, see the last column but one.)
Measured
Same card and settings,
VICTORY_INDIRECT_BATCH=1, the same stretch of dense coast and canal:Seen by the player: with buffers made anew all the time (second column) the foliage flickered more than before; with the pool it flickered least of all four.
Not measured: sessions longer than 17 minutes with this version, an NVIDIA card, Series X,
VICTORY_INDIRECT_BATCH=2.Checks
cargo test -p victory-gpu --lib batchpasses.cargo clippy --workspace ... -D warningsfails onmainas it is now (two errors invictory-shader/src/emit/lower.rs, not touched here); clippy reports nothing in the changed lines.🤖 Generated with Claude Code
https://claude.ai/code/session_01KfgN1FfW7f4Zv2hqXUsNr2
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by amazedturnip on 2026-11-29T05:38:26Z.
Tested on 9800X3D + RTX 5070 Ti 16 GB (Series X 1440p DLSS, RT off, combined perf stack) across multiple 20+ min sessions. Indirect batch scratch pooling ran cleanly with zero visual/GPU issues and helped bring steady-state VRAM down from ~14.2 GB to ~10.6-12.7 GB.