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
github-bot wants to merge 2 commits from github-bot/gh-474 into main AGit
Owner

@⁠simbaui4life on GitHub · 2026-11-27 16:17 UTC · original
simbaui4life:fix/scratch-at-landing → main · +896 −4 · 5 files · 2 commits · open

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

**@⁠simbaui4life** on GitHub · 2026-11-27 16:17 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/474) `simbaui4life:fix/scratch-at-landing` → `main` · +896 −4 · 5 files · 2 commits · open **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)
Ignored tests memory_bench_steady_state and memory_bench_pressure_lets_idle_go: lists, copies,
submissions, fences and windows through the title-facing methods, with title memory from a
write-watched VirtualAlloc allocator; per-class bytes from the existing counters and private
bytes, flat over 240 frames; idle memory let go when little RAM is said to be free.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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). In the relay mode the launcher 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.

At landing, after its read-backs and next to release_tables(), a list now hands its chunks to
the spare pool (HostList::release_scratch). The card has read them for the last time. Chunks
the pool does not take stay with the list and are freed at its reset as before, so nothing is
freed earlier than it was. Only with shared chunks (VICTORY_SCRATCH_POOL); off with
VICTORY_SCRATCH_AT_LANDING=0.

Memory bench, RTX 4070 Ti, same build, switch off/on, VICTORY_RELAY=2:
- private bytes 1058.7 -> 523.9 MB
- scratch of landed lists 546.5 -> 0 MB
- upload bytes made 588.0 -> 54.8 MB
- without the relay unchanged (355 MB)

The steady-state test now asserts that landed lists keep no scratch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 16:22:43 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/474/head:github-bot/gh-474'
git switch 'github-bot/gh-474'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-474'
git switch 'github-bot/gh-474'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-474'
git switch 'github-bot/gh-474'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-474'
git switch 'main'
git merge --squash 'github-bot/gh-474'
git switch 'main'
git merge --ff-only 'github-bot/gh-474'
git switch 'main'
git merge 'github-bot/gh-474'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.