GPU: a list gives its scratch chunks back when its submission lands, not after the bury lag (546 -> 0 MB in the memory bench) #474

Open
simbaui4life wants to merge 2 commits from upstream-pr/474 into main
simbaui4life commented 2026-11-27 16:17:42 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by simbaui4life on 2026-11-27T16:17:42Z.


Builds on #473 (the memory bench): its commit is included, and only the last commit is new.

Cause: a host list kept every scratch chunk it took until its reset, and a list that has run is reset only after the bury lag (64 submissions; host.rs land()/bury_lag()). In the relay mode scripts/play.ps1 sets (VICTORY_RELAY=2), the memory bench, at only 8 lists a frame, had 170 landed lists holding 546.5 MB of 4 MiB chunks. In a game run with about a hundred host lists a frame this is likely much more; that is not measured here. It may be part of the "uploads" share in docs/findings.md, also unverified.

What this does

  • At landing, after the flight's read-backs and next to release_tables(), a list hands its chunks to the spare pool (HostList::release_scratch). The card has read them for the last time, and a landed host list is never run again, only reset later. This is the same reasoning as for the early release of descriptor slots.
  • Nothing is freed earlier than before: chunks the spare pool does not take (SPARE_KEPT/SPARE_MOST) stay with the list and are freed at its reset after the bury lag, as before (spare_what_fits).
  • Scope and switch: it applies only with shared chunks (VICTORY_SCRATCH_POOL, on by default). VICTORY_SCRATCH_AT_LANDING=0 turns it off.
  • memory_bench_steady_state now asserts that landed lists keep no scratch.

Tested (RTX 4070 Ti, driver 621.01, debug build; the same build with the switch off and on)

VICTORY_RELAY=2 switch off switch on
private bytes 1058.8 MB 524.0 MB (−51 %)
scratch of landed lists 546.5 MB 0 MB
upload bytes made 588.0 MB 54.8 MB
without the relay 353.6 MB 353.6 MB (unchanged)
  • The steady state stays flat in both modes, and the pressure test passes.
  • cargo test -p victory-gpu: 394 passed, 0 failed (37 ignored).
  • Clippy adds nothing (main's existing failures are listed in #473).

Not tested: in the game (no game data here). That covers the real saving and whether anything reads scratch after landing that the bench does not exercise (read-backs run before the release). AMD and other GPUs are not tested either.

No game data in the commits.

🤖 Generated with Claude Code

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:5529781450 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/474). Originally posted by [simbaui4life](https://github.com/simbaui4life) on 2026-11-27T16:17:42Z. --- **Builds on #473** (the memory bench): its commit is included, and only the last commit is new. **Cause:** a host list kept every scratch chunk it took until its reset, and a list that has run is reset only after the bury lag (64 submissions; `host.rs` `land()`/`bury_lag()`). In the relay mode `scripts/play.ps1` sets (`VICTORY_RELAY=2`), the memory bench, at only 8 lists a frame, had 170 landed lists holding 546.5 MB of 4 MiB chunks. In a game run with about a hundred host lists a frame this is likely much more; that is not measured here. It may be part of the "uploads" share in `docs/findings.md`, also unverified. **What this does** - At landing, after the flight's read-backs and next to `release_tables()`, a list hands its chunks to the spare pool (`HostList::release_scratch`). The card has read them for the last time, and a landed host list is never run again, only reset later. This is the same reasoning as for the early release of descriptor slots. - **Nothing is freed earlier than before:** chunks the spare pool does not take (`SPARE_KEPT`/`SPARE_MOST`) stay with the list and are freed at its reset after the bury lag, as before (`spare_what_fits`). - **Scope and switch:** it applies only with shared chunks (`VICTORY_SCRATCH_POOL`, on by default). `VICTORY_SCRATCH_AT_LANDING=0` turns it off. - `memory_bench_steady_state` now asserts that landed lists keep no scratch. **Tested** (RTX 4070 Ti, driver 621.01, debug build; the same build with the switch off and on) | `VICTORY_RELAY=2` | switch off | switch on | |---|---|---| | private bytes | 1058.8 MB | 524.0 MB (−51 %) | | scratch of landed lists | 546.5 MB | 0 MB | | upload bytes made | 588.0 MB | 54.8 MB | | without the relay | 353.6 MB | 353.6 MB (unchanged) | - The steady state stays flat in both modes, and the pressure test passes. - `cargo test -p victory-gpu`: 394 passed, 0 failed (37 ignored). - Clippy adds nothing (main's existing failures are listed in #473). **Not tested:** in the game (no game data here). That covers the real saving and whether anything reads scratch after landing that the bench does not exercise (read-backs run before the release). AMD and other GPUs are not tested either. No game data in the commits. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/474:upstream-pr/474'
git switch 'upstream-pr/474'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/474'
git switch 'upstream-pr/474'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/474'
git switch 'upstream-pr/474'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/474'
git switch 'main'
git merge --squash 'upstream-pr/474'
git switch 'main'
git merge --ff-only 'upstream-pr/474'
git switch 'main'
git merge 'upstream-pr/474'
git push origin 'main'
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
avatarmanz/VIctory-7900XTX!474
No description provided.