Indirect batches: scratch buffers go to a pool when their list has run #1441

Merged
saltdam36 merged 1 commit from upstream-pr/1441 into main 2026-11-29 08:16:56 +00:00
saltdam36 commented 2026-11-28 20:04:46 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by saltdam36 on 2026-11-28T20:04:46Z.


What

HostList::batch_place pushes a new scratch buffer whenever a recording needs more batches than the list has had before, and batches_common resets 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=1 on 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, and batches_common left them in the common state), and batch_place takes one from that pool before it makes a new one, as scratch chunks and preludes already do. 512 are kept; more are retired with retire_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:

Before Each list keeps those of its last recording ...of its last 128 recordings (first pushed here) Pool (this change)
Card use 11.1 -> 14.3 GB in 8 min, still rising at about the budget, 50 min of play 1.5 GB over the budget for about two minutes in the dense stretch, then back under the budget in every one of 17 min (peak 13.2 of 13.6 GB)
5 s readings slow on the card over 200 ms from minute 8 on none over 100 ms 45 to 68 ms, 10 fps, for those two minutes none over 40 ms
Card buffers made a minute about 54,000 5,000 to 10,600 about 200 (at most 552)

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 batch passes. cargo clippy --workspace ... -D warnings fails on main as it is now (two errors in victory-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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5544091810 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1441). Originally posted by [saltdam36](https://github.com/saltdam36) on 2026-11-28T20:04:46Z. --- ## What `HostList::batch_place` pushes a new scratch buffer whenever a recording needs more batches than the list has had before, and `batches_common` resets 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=1` on 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, and `batches_common` left them in the common state), and `batch_place` takes one from that pool before it makes a new one, as scratch chunks and preludes already do. 512 are kept; more are retired with `retire_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: | | Before | Each list keeps those of its last recording | ...of its last 128 recordings (first pushed here) | Pool (this change) | |---|---|---|---|---| | Card use | 11.1 -> 14.3 GB in 8 min, still rising | at about the budget, 50 min of play | 1.5 GB over the budget for about two minutes in the dense stretch, then back | under the budget in every one of 17 min (peak 13.2 of 13.6 GB) | | 5 s readings slow on the card | over 200 ms from minute 8 on | none over 100 ms | 45 to 68 ms, 10 fps, for those two minutes | none over 40 ms | | Card buffers made a minute | | about 54,000 | 5,000 to 10,600 | about 200 (at most 552) | 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 batch` passes. `cargo clippy --workspace ... -D warnings` fails on `main` as it is now (two errors in `victory-shader/src/emit/lower.rs`, not touched here); clippy reports nothing in the changed lines. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01KfgN1FfW7f4Zv2hqXUsNr2
amazedturnip commented 2026-11-29 05:38:26 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7251372889 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1441#issuecomment-7251372889). Originally posted by [amazedturnip](https://github.com/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.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!1441
No description provided.