GPU tests: a memory bench that drives the layer through the title's interface, without the game #111

Closed
github-bot wants to merge 1 commit from github-bot/gh-111 into main AGit
Owner

@⁠simbaui4life on GitHub · 2026-11-27 18:18 UTC · original
test/memory-bench → main · +878 −7 · 7 files · 1 commits · closed without merging

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 29d8dbf. Test-only: the production changes are test hooks.

This is a port of work originally made for avatarmanz/VIctory-7900XTX (that repository is no longer reachable). The numbers below were measured on this fork.

Why: memory changes are hard to judge without the game. This gives a repeatable footprint check that needs no game data, 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 (VICTORY_THIN=1) 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 the PC's own free RAM (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 that scripts/play-foxhound.ps1 (and play-nvidia.ps1, Play-VIctory.cmd) set.

Test hooks (all cfg(test))

  • list::idle() reports the pool's count and bytes.
  • host::FREE_RAM_SAID overrides available_physical_ram(). Unlike the original, it also reaches residency::memory_status(), because on this fork residency::pressured() is on by default and is what the sweep uses to sense low RAM.
  • The relay's fetch-buffer size is stored for the bench.
  • shadow::memory/windows, texture::memory/let_go and pool::memory are now cfg(any(test, feature = "diagnostics")).
  • list::with_state is now pub(crate). The bench reads the process's memory itself, because copystat is diagnostics-only here.

Numbers (RTX 4070 Ti, driver 621.01, Windows 11 26200, debug build, 32 GB RAM)

no relay relay (VICTORY_RELAY=2 VICTORY_RELAY_COPY=1)
private bytes 387 MB, +0.5 MB over 240 frames 587 MB, +2.1 MB
host lists alive (idle) 10 (2) 56 (6)
landed lists waiting for the bury lag 0 42, holding 130.5 MB of scratch
list scratch 26 MB 160 MB

The bury lag is 16 submissions on this PC, not 64, because residency::limited_host_ram() counts 32 GB or less as limited. On a bigger PC the landed lists and their scratch would be about four times as many.

The launcher's full settings (every switch play-foxhound.ps1 sets by default, VICTORY_THIN=1 among them; VICTORY_PIPELINE_BOOK left out because it writes files): private bytes 714–911 MB after the warm-up, 110–159 host lists alive, 42–53 landed lists holding 130–169 MB. In 2 of 4 runs the steady-state check failed. Each time there was a single step of about +64 MB of shared memory, from 2 or 3 upload buffers made after the warm-up, and the other runs were flat. The thin path is outside what the bench drives (windows stay at 0 there), so I take these numbers as indicative only. I did not find what makes those buffers.

Does it catch faults? I put in a scratch-chunk leak at reset on purpose. The steady-state test failed: private bytes went from 1.93 to 8.20 GB, with and without the relay. The injection was reverted.

What it shows on this fork (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 allocators are kept for up to 512 lists.
  4. Low free RAM lets windows and spare scratch go (residency::pressured(), on by default here), but not the list pool or the fetch buffers. Pressure test, relay: windows 8 → 1, spare scratch 128 → 26 MB, pooled lists 68 → 68, relay fetch buffer 32 MB kept.
  5. A window over a placed buffer copies the buffer's bytes again (1 MB here).

Tested (RTX 4070 Ti)

  • cargo test -p victory-gpu: 418 passed, 2 failed, 37 ignored (the two bench tests among them). On origin/main (29d8dbf): 418 passed, 2 failed, 35 ignored.
    • The 2 failures are already on main and fail alone too: indirect::tests::host_list_budget_starts_empty_at_each_submission and indirect::tests::warp_batch_charges_every_execution.
    • watch::tests::what_is_put_in_beside_the_guards_is_told_at_every_view failed once in a full run on main and passed alone.
  • Clippy -p victory-gpu --all-targets -D warnings adds nothing. main already fails it (26 errors in the lib, 28 in the lib tests: host/indirects.rs, host/send.rs, land.rs, shadow.rs and others).
  • rustfmt: the new file is clean, and the touched files have no new differences.

Not tested: other GPUs and AMD; a PC with more than 32 GB of RAM (bury lag 64); anything the bench cannot reach (see above).

No game data in the commits.

🤖 Generated with Claude Code

**@⁠simbaui4life** on GitHub · 2026-11-27 18:18 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/111) `test/memory-bench` → `main` · +878 −7 · 7 files · 1 commits · closed without merging 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 `29d8dbf`. Test-only: the production changes are test hooks. This is a port of work originally made for avatarmanz/VIctory-7900XTX (that repository is no longer reachable). The numbers below were measured on this fork. **Why:** memory changes are hard to judge without the game. This gives a repeatable footprint check that needs no game data, 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 (`VICTORY_THIN=1`) 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 the PC's own free RAM (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 that `scripts/play-foxhound.ps1` (and `play-nvidia.ps1`, `Play-VIctory.cmd`) set. **Test hooks** (all `cfg(test)`) - `list::idle()` reports the pool's count and bytes. - `host::FREE_RAM_SAID` overrides `available_physical_ram()`. Unlike the original, it also reaches `residency::memory_status()`, because on this fork `residency::pressured()` is on by default and is what the sweep uses to sense low RAM. - The relay's fetch-buffer size is stored for the bench. - `shadow::memory`/`windows`, `texture::memory`/`let_go` and `pool::memory` are now `cfg(any(test, feature = "diagnostics"))`. - `list::with_state` is now `pub(crate)`. The bench reads the process's memory itself, because `copystat` is diagnostics-only here. **Numbers** (RTX 4070 Ti, driver 621.01, Windows 11 26200, debug build, 32 GB RAM) | | no relay | relay (`VICTORY_RELAY=2 VICTORY_RELAY_COPY=1`) | |---|---|---| | private bytes | 387 MB, +0.5 MB over 240 frames | 587 MB, +2.1 MB | | host lists alive (idle) | 10 (2) | 56 (6) | | landed lists waiting for the bury lag | 0 | 42, holding 130.5 MB of scratch | | list scratch | 26 MB | 160 MB | The bury lag is 16 submissions on this PC, not 64, because `residency::limited_host_ram()` counts 32 GB or less as limited. On a bigger PC the landed lists and their scratch would be about four times as many. **The launcher's full settings** (every switch `play-foxhound.ps1` sets by default, `VICTORY_THIN=1` among them; `VICTORY_PIPELINE_BOOK` left out because it writes files): private bytes 714–911 MB after the warm-up, 110–159 host lists alive, 42–53 landed lists holding 130–169 MB. In 2 of 4 runs the steady-state check failed. Each time there was a single step of about +64 MB of shared memory, from 2 or 3 upload buffers made after the warm-up, and the other runs were flat. The thin path is outside what the bench drives (windows stay at 0 there), so I take these numbers as indicative only. I did not find what makes those buffers. **Does it catch faults?** I put in a scratch-chunk leak at reset on purpose. The steady-state test failed: private bytes went from 1.93 to 8.20 GB, with and without the relay. The injection was reverted. **What it shows on this fork** (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 allocators are kept for up to 512 lists. 4. Low free RAM lets windows and spare scratch go (`residency::pressured()`, on by default here), but not the list pool or the fetch buffers. Pressure test, relay: windows 8 → 1, spare scratch 128 → 26 MB, pooled lists 68 → 68, relay fetch buffer 32 MB kept. 5. A window over a placed buffer copies the buffer's bytes again (1 MB here). **Tested** (RTX 4070 Ti) - `cargo test -p victory-gpu`: 418 passed, 2 failed, 37 ignored (the two bench tests among them). On `origin/main` (`29d8dbf`): 418 passed, 2 failed, 35 ignored. - The 2 failures are already on main and fail alone too: `indirect::tests::host_list_budget_starts_empty_at_each_submission` and `indirect::tests::warp_batch_charges_every_execution`. - `watch::tests::what_is_put_in_beside_the_guards_is_told_at_every_view` failed once in a full run on main and passed alone. - Clippy `-p victory-gpu --all-targets -D warnings` adds nothing. main already fails it (26 errors in the lib, 28 in the lib tests: `host/indirects.rs`, `host/send.rs`, `land.rs`, `shadow.rs` and others). - rustfmt: the new file is clean, and the touched files have no new differences. **Not tested:** other GPUs and AMD; a PC with more than 32 GB of RAM (bury lag 64); 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.

A port of the bench made for avatarmanz/VIctory-7900XTX. Here the free RAM said for the test
(host::FREE_RAM_SAID) also reaches crate::residency, whose pressure is on by default on this
fork; the bench reads the process's memory itself (copystat is diagnostics-only here);
pool::memory joins shadow::memory/windows and texture::memory/let_go under
cfg(any(test, feature = "diagnostics")); list::with_state is pub(crate).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 18:22:45 +00:00
github-bot closed this pull request 2026-11-27 21:47:09 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.