GPU tests: a memory bench that drives the layer through the title's interface (no game) #473

Open
github-bot wants to merge 1 commit from github-bot/gh-473 into main AGit
Owner

@⁠simbaui4life on GitHub · 2026-11-27 16:17 UTC · original
simbaui4life:test/memory-bench → main · +840 −4 · 5 files · 1 commits · open

A memory bench for victory-gpu. It drives the layer through the title-facing interface with synthetic frames, without the game, and reads what each memory class holds. One commit on 014d52d. Test-only: the production changes are test hooks.

Why: memory changes are hard to judge without the game, and docs/findings.md reports 40–46 GB private with no single leak (#234). This gives a game-less, repeatable footprint check, so a memory change can be measured before and after on any PC with a GPU.

What it drives (crates/victory-gpu/src/host/membench.rs)

  • Setup: queue::create, fence::create, list::create_allocator/create_list, and resource::test_buffer buffers. Title memory comes from a write-watched VirtualAlloc allocator installed with resource::use_allocator.
  • Recording: list Close/Reset/CopyBufferRegion through the objects' method tables, as the title calls them. The copies go through place_copy, so scratch, host copies and card copies are used.
  • Submission: queue execute/signal/wait. Lists are held, run, landed and recycled.
  • Windows: list::with_state + shadow::find/refresh create and read 4 MiB windows.
  • Present: only its queue side (settle, release_held, frame::test_advance).
  • Not reached: draws and dispatches, which need translated pipelines, so descriptor heaps, textures, staging, indirect arguments and the thin path are out of reach.

Tests (ignored; each in a process of its own, because the bench installs the title allocator process-wide)

  • memory_bench_steady_state: 60 warm-up frames and 240 measured. It prints a table per class (host lists, scratch, host copies, windows, snapshots, fetch buffers, staging, blocks, made buffers, private bytes) and asserts that nothing grows.
  • memory_bench_pressure_lets_idle_go: a spike, then idle with 18 GB free (kept), then "1 GiB free" injected (let go). It lists what pressure does not reach. VICTORY_MEMBENCH_STRICT=1 asserts that too.
  • To run: cargo test -p victory-gpu --lib memory_bench_steady_state -- --ignored --nocapture. Add VICTORY_RELAY=2 VICTORY_RELAY_COPY=1 for the relay paths scripts/play.ps1 uses.

Test hooks (all cfg(test))

  • list::idle() reports the pool's count and bytes.
  • host::FREE_RAM_SAID overrides available_physical_ram().
  • The relay's fetch-buffer size is stored for the bench.
  • shadow::memory/windows and texture::memory/let_go are now cfg(any(test, feature = "diagnostics")).

Numbers (RTX 4070 Ti, driver 621.01, debug build)

no relay relay (VICTORY_RELAY=2)
private bytes 354 MB, +0.2 MB over 240 frames 1059 MB, +0.6 MB
host lists alive (idle) 10 (2) 184 (6)
landed lists waiting for the bury lag 0 170, holding 546.5 MB of scratch
list scratch 26 MB 572 MB

Does it catch faults? Each of these was put in on purpose, and the steady-state test failed every time:

  • pool off: 2 host lists made per frame;
  • spare scratch never reused: 14 upload buffers per frame;
  • scratch chunks leaked at reset: private bytes 1.9 to 8.2 GB.

What it shows (none of these grows across frames; they are plateaus that never come down)

  1. Landed lists hold their scratch for the whole bury lag. The fix is the companion PR from simbaui4life:fix/scratch-at-landing.
  2. Scratch is coarse: any list needing more than 256 KiB takes a whole 4 MiB chunk.
  3. The list pool's byte limit (IDLE_MOST.1) never applies, because pooled lists hand back their scratch. Their allocator memory, about 2 MB per pooled list here, is unbounded up to 512 lists. On NVIDIA a separate probe measured 0.4–0.5 MiB per idle allocator.
  4. Low free RAM lets windows go, but not spare scratch (only under VICTORY_RESIDENCY), the list pool or the fetch buffers.
  5. A window over a placed buffer copies the buffer's bytes again.

Tested (RTX 4070 Ti)

  • cargo test -p victory-gpu: 394 passed, 0 failed (37 ignored, the two bench tests among them).
  • Clippy -D warnings adds nothing. main already fails clippy in list.rs, watch.rs, host/panel.rs and host/place.rs, and in the diagnostics build texture.rs Staging::size (#362).

Not tested: other GPUs; anything the bench cannot reach (see above).

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/473) `simbaui4life:test/memory-bench` → `main` · +840 −4 · 5 files · 1 commits · open A memory bench for `victory-gpu`. It drives the layer through the title-facing interface with synthetic frames, without the game, and reads what each memory class holds. One commit on `014d52d`. Test-only: the production changes are test hooks. **Why:** memory changes are hard to judge without the game, and `docs/findings.md` reports 40–46 GB private with no single leak (#234). This gives a game-less, repeatable footprint check, so a memory change can be measured before and after on any PC with a GPU. **What it drives** (`crates/victory-gpu/src/host/membench.rs`) - **Setup:** `queue::create`, `fence::create`, `list::create_allocator`/`create_list`, and `resource::test_buffer` buffers. Title memory comes from a write-watched `VirtualAlloc` allocator installed with `resource::use_allocator`. - **Recording:** list Close/Reset/CopyBufferRegion through the objects' method tables, as the title calls them. The copies go through `place_copy`, so scratch, host copies and card copies are used. - **Submission:** queue execute/signal/wait. Lists are held, run, landed and recycled. - **Windows:** `list::with_state` + `shadow::find`/`refresh` create and read 4 MiB windows. - **Present:** only its queue side (settle, `release_held`, `frame::test_advance`). - **Not reached:** draws and dispatches, which need translated pipelines, so descriptor heaps, textures, staging, indirect arguments and the thin path are out of reach. **Tests** (ignored; each in a process of its own, because the bench installs the title allocator process-wide) - `memory_bench_steady_state`: 60 warm-up frames and 240 measured. It prints a table per class (host lists, scratch, host copies, windows, snapshots, fetch buffers, staging, blocks, made buffers, private bytes) and asserts that nothing grows. - `memory_bench_pressure_lets_idle_go`: a spike, then idle with 18 GB free (kept), then "1 GiB free" injected (let go). It lists what pressure does not reach. `VICTORY_MEMBENCH_STRICT=1` asserts that too. - To run: `cargo test -p victory-gpu --lib memory_bench_steady_state -- --ignored --nocapture`. Add `VICTORY_RELAY=2 VICTORY_RELAY_COPY=1` for the relay paths `scripts/play.ps1` uses. **Test hooks** (all `cfg(test)`) - `list::idle()` reports the pool's count and bytes. - `host::FREE_RAM_SAID` overrides `available_physical_ram()`. - The relay's fetch-buffer size is stored for the bench. - `shadow::memory`/`windows` and `texture::memory`/`let_go` are now `cfg(any(test, feature = "diagnostics"))`. **Numbers** (RTX 4070 Ti, driver 621.01, debug build) | | no relay | relay (`VICTORY_RELAY=2`) | |---|---|---| | private bytes | 354 MB, +0.2 MB over 240 frames | 1059 MB, +0.6 MB | | host lists alive (idle) | 10 (2) | 184 (6) | | landed lists waiting for the bury lag | 0 | 170, holding 546.5 MB of scratch | | list scratch | 26 MB | 572 MB | **Does it catch faults?** Each of these was put in on purpose, and the steady-state test failed every time: - pool off: 2 host lists made per frame; - spare scratch never reused: 14 upload buffers per frame; - scratch chunks leaked at reset: private bytes 1.9 to 8.2 GB. **What it shows** (none of these grows across frames; they are plateaus that never come down) 1. Landed lists hold their scratch for the whole bury lag. The fix is the companion PR from `simbaui4life:fix/scratch-at-landing`. 2. Scratch is coarse: any list needing more than 256 KiB takes a whole 4 MiB chunk. 3. The list pool's byte limit (`IDLE_MOST.1`) never applies, because pooled lists hand back their scratch. Their allocator memory, about 2 MB per pooled list here, is unbounded up to 512 lists. On NVIDIA a separate probe measured 0.4–0.5 MiB per idle allocator. 4. Low free RAM lets windows go, but not spare scratch (only under `VICTORY_RESIDENCY`), the list pool or the fetch buffers. 5. A window over a placed buffer copies the buffer's bytes again. **Tested** (RTX 4070 Ti) - `cargo test -p victory-gpu`: 394 passed, 0 failed (37 ignored, the two bench tests among them). - Clippy `-D warnings` adds nothing. main already fails clippy in `list.rs`, `watch.rs`, `host/panel.rs` and `host/place.rs`, and in the diagnostics build `texture.rs` `Staging::size` (#362). **Not tested:** other GPUs; anything the bench cannot reach (see above). 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]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 16:22:42 +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/473/head:github-bot/gh-473'
git switch 'github-bot/gh-473'

Merge

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