Small hosts of RAM: the L0 caches of ours sized down, the windows cap back by itself (#1520) #1640

Manually merged
github merged 1 commit from github-bot/gh-1640 into main 2026-11-29 08:20:52 +00:00 AGit
Owner

@⁠unueberlegt on GitHub · 2026-11-28 22:48 UTC · original
unueberlegt:fix/small-host-ram → main · +184 −27 · 7 files · 1 commits · merged 2026-11-29 08:16 UTC

Fixes #1520

What it changes

A 16 GB PC reached Windows' 8 GiB shared-memory cap in ~95 s of world load (0x8007000E on a host command list): the launcher's under-24-GB auto of 85a529b was lost when play-nvidia.ps1 became a shim (22c6be2), and the L0 caches added since only know the 32 GiB line (residency::limited_host_ram). This adds residency::small_host_ram() (< 24 GiB, the threshold 85a529b used; RAM that cannot be read is not small) and sizes the L0 defaults by it — every one still overridable by its switch, an explicit value deciding as before:

Default large host small host (< 24 GiB)
buffer pool (VICTORY_BUFFER_POOL) on off — a 64 MiB L0 block sits there until it is empty whole
VICTORY_UPLOAD_POOL_MB 1024 128
VICTORY_EXACT_POOL_MB 256 / 320 64
VICTORY_BUFFERS_AHEAD 4096 512, and the refill pauses while the memory is pressured or commit critical
submission send spares 768 MiB 128 MiB, trimmed by the sweep with the copy sources' spares (they never were trimmed)
VICTORY_WINDOWS_BAR_MB 0 (off) 3072, by itself — at the window reader (shadow.rs) rather than the launcher, so every start path gets it (the launcher set it as an environment value, so this is the same cap)

While the PC's memory is short, the spares keep a 16 MiB hot floor and all go only when commit is critical: on a 16 GB PC the memory pressure never clears (recovering needs 5 GiB free), and wiping the spares whole at 1 Hz made each second's first copies wait for fresh allocations.

How it was tested

  • GPU and profile: GeForce RTX 5070 12 GB, 31 GB RAM, Windows 11 26300 — on this machine small_host_ram() is false, so the large-host defaults are unchanged (the game loads and plays as before).
  • victory-gpu lib suite: 552 passed, 0 failed, 43 ignored (three new tests: scaled_default's table, exact_pool_limit_from's small-host step, and spares_are_trimmed_to_a_hot_floor_while_memory_is_short; exact_pool_limit_adapts_to_ram_and_override reshaped).
  • Not tested on a 16 GB machine yet — the reproduction needs one. @⁠GreekNinja30 your A/B/C table in #1520 names the exact switches this automates; with this branch, the "Run C" switch set should be the unset default. A run of your 95 s reproduction against this branch would be the missing data point.

🤖 Generated with Claude Code

**@⁠unueberlegt** on GitHub · 2026-11-28 22:48 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1640) `unueberlegt:fix/small-host-ram` → `main` · +184 −27 · 7 files · 1 commits · merged 2026-11-29 08:16 UTC Fixes #1520 ## What it changes A 16 GB PC reached Windows' 8 GiB shared-memory cap in ~95 s of world load (`0x8007000E` on a host command list): the launcher's under-24-GB auto of 85a529b was lost when `play-nvidia.ps1` became a shim (22c6be2), and the L0 caches added since only know the 32 GiB line (`residency::limited_host_ram`). This adds `residency::small_host_ram()` (< 24 GiB, the threshold 85a529b used; RAM that cannot be read is not small) and sizes the L0 defaults by it — every one still overridable by its switch, an explicit value deciding as before: | Default | large host | small host (< 24 GiB) | |---|---|---| | buffer pool (`VICTORY_BUFFER_POOL`) | on | **off** — a 64 MiB L0 block sits there until it is empty whole | | `VICTORY_UPLOAD_POOL_MB` | 1024 | **128** | | `VICTORY_EXACT_POOL_MB` | 256 / 320 | **64** | | `VICTORY_BUFFERS_AHEAD` | 4096 | **512**, and the refill pauses while the memory is pressured or commit critical | | submission send spares | 768 MiB | **128 MiB**, trimmed by the sweep with the copy sources' spares (they never were trimmed) | | `VICTORY_WINDOWS_BAR_MB` | 0 (off) | **3072, by itself** — at the window reader (`shadow.rs`) rather than the launcher, so every start path gets it (the launcher set it as an environment value, so this is the same cap) | While the PC's memory is short, the spares keep a **16 MiB hot floor** and all go only when commit is critical: on a 16 GB PC the memory pressure never clears (recovering needs 5 GiB free), and wiping the spares whole at 1 Hz made each second's first copies wait for fresh allocations. ## How it was tested - GPU and profile: GeForce RTX 5070 12 GB, 31 GB RAM, Windows 11 26300 — on this machine `small_host_ram()` is false, so the large-host defaults are unchanged (the game loads and plays as before). - `victory-gpu` lib suite: **552 passed, 0 failed, 43 ignored** (three new tests: `scaled_default`'s table, `exact_pool_limit_from`'s small-host step, and `spares_are_trimmed_to_a_hot_floor_while_memory_is_short`; `exact_pool_limit_adapts_to_ram_and_override` reshaped). - **Not tested on a 16 GB machine yet** — the reproduction needs one. @⁠GreekNinja30 your A/B/C table in #1520 names the exact switches this automates; with this branch, the "Run C" switch set should be the *unset* default. A run of your 95 s reproduction against this branch would be the missing data point. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A 16 GB PC reached Windows' 8 GiB shared-memory cap in ~95 s of world
load (0x8007000E on a host command list, #1520): the launcher's
under-24-GB auto of 85a529b was lost when the script became a shim
(22c6be2), and the L0 caches added since only know the 32 GiB line.
residency::small_host_ram() is the new line; every default it sizes
keeps its switch:

- the buffer pool off (a 64 MiB L0 block sits there until it is empty
  whole), VICTORY_UPLOAD_POOL_MB 128 was 1024, VICTORY_EXACT_POOL_MB 64
  was 256, VICTORY_BUFFERS_AHEAD 512 was 4096 with the refill paused
  while the memory is pressured or commit critical, the submission send
  spares 128 MiB was 768, trimmed by the sweep with the others

The windows cap (VICTORY_WINDOWS_BAR_MB) is 3072 on a small host by
itself again, at the window reader in shadow.rs, so every start path
gets it; an explicit value decides as before. While the memory is
short the spares keep a 16 MiB hot floor, all gone only when commit is
critical: on a 16 GB PC the pressure never clears, and wiping whole at
1 Hz made each second's first copies wait for fresh allocations.

victory-gpu lib suite 552 passed, 0 failed, 43 ignored (three new
tests, one reshaped for the small host).

Co-Authored-By: Claude Code <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 22:52:06 +00:00
Author
Owner

@⁠eleboucher on GitHub · 2026-11-29 00:07 UTC · original

Tested on a 16 GB PC: it fixes the 2-minute crash here.

Setup. RTX 4070 Ti SUPER 16 GB, Ryzen 7 9800X3D, 16 GB RAM, Windows 11 build 26300. Native 1440p full screen, DLSS off, VICTORY_BVH_BUILDER=1 VICTORY_ACTIVATE_RAYS=1, diagnostics build. Windows' shared-memory cap on this PC is 7224 MB.

Before: main 77df871e.

  • Every start died at about 120 s with a host command list did not close (0x8007000E), then device removed. That was 7 starts, with and without ray tracing, DRED and the debug layer. The debug layer did not name a command.
  • One start froze instead, with shared memory at 7481 MB of 7224.
  • With VICTORY_WINDOWS_BAR_MB=3072 set by hand, the same build ran and reached 25.6 fps at 300 s.

After: main + this PR (plus #315's compute-wait cap rebased on main, which never fired in these runs). Two cold starts, 10 minutes each, both alive at the end:

start 120 s 180 s 300 s 420 s 600 s shared at 600 s
1 11.8 fps 23.5 23.5 25.0 24.9 5118 MB
2 16.7 fps 22.6 26.2 24.6 24.6 5076 MB
  • 0 unhandled exceptions, 0 device removals, no did not close lines.
  • The frame is about 42 ms, with about 28 ms preparing (copies 13.7 ms / 43 MB).
  • The cargo tests of main + this PR were not run separately. On main and on main + #315, 1302 and 1303 passed, with the same 2 failures as plain main (crash::tests::memory_at_names_what_an_access_hit, policy::tests::repository_passes_policy).
**@⁠eleboucher** on GitHub · 2026-11-29 00:07 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1640#issuecomment-7247891405) Tested on a 16 GB PC: it fixes the 2-minute crash here. **Setup.** RTX 4070 Ti SUPER 16 GB, Ryzen 7 9800X3D, 16 GB RAM, Windows 11 build 26300. Native 1440p full screen, DLSS off, `VICTORY_BVH_BUILDER=1 VICTORY_ACTIVATE_RAYS=1`, diagnostics build. Windows' shared-memory cap on this PC is 7224 MB. **Before: main 77df871e.** - Every start died at about 120 s with `a host command list did not close (0x8007000E)`, then device removed. That was 7 starts, with and without ray tracing, DRED and the debug layer. The debug layer did not name a command. - One start froze instead, with shared memory at 7481 MB of 7224. - With `VICTORY_WINDOWS_BAR_MB=3072` set by hand, the same build ran and reached 25.6 fps at 300 s. **After: main + this PR** (plus #315's compute-wait cap rebased on main, which never fired in these runs). Two cold starts, 10 minutes each, both alive at the end: | start | 120 s | 180 s | 300 s | 420 s | 600 s | shared at 600 s | |---|---|---|---|---|---|---| | 1 | 11.8 fps | 23.5 | 23.5 | 25.0 | 24.9 | 5118 MB | | 2 | 16.7 fps | 22.6 | 26.2 | 24.6 | 24.6 | 5076 MB | - 0 unhandled exceptions, 0 device removals, no `did not close` lines. - The frame is about 42 ms, with about 28 ms preparing (copies 13.7 ms / 43 MB). - The cargo tests of main + this PR were not run separately. On main and on main + #315, 1302 and 1303 passed, with the same 2 failures as plain main (`crash::tests::memory_at_names_what_an_access_hit`, `policy::tests::repository_passes_policy`).
Author
Owner

@⁠domx4q on GitHub · 2026-11-29 00:47 UTC · original

A complementary approach, in case it is useful: domx4q/VIctory-NVIDIA@feat/shared-gpu-memory-pressure (one commit on current main, not opened as a PR so as not to compete with this one).

This PR sizes the L0 defaults by the RAM line (< 24 GiB). That branch instead reacts to the budget Windows reports for the shared segment:

  • Pressure. A second memory pressure starts at 85 % NON_LOCAL use and clears below 75 %, read in the existing sweeps. residency::pressured() includes it, so everything that already reacts to short memory reacts to it too.
  • Send spares. They are trimmed under that pressure. That part overlaps with yours.
  • Allocators. Without VICTORY_ALLOCATOR_TRIM set, an allocator is renewed after 30 s, but only under pressure.
  • Release log line. the PC's memory shared with the card grew to X MB in use of a budget of Y MB (Z %); the layer keeps …, every 512 MiB of growth, listing scratch, copy sources, send memory, staging and blocks. A failed Close says it ran out of memory instead of "a command recorded into it was invalid".

The pressure would also catch hosts above 24 GiB whose shared use still climbs, and the log line would show which pool grows if a 16 GB report still fails with your defaults.

Testing: on a 62 GB PC (RTX 4090, Linux/Proton) it costs nothing (22.7 fps against 21.6 on main, within noise), and the line peaks at 14.6 GB of a 48 GB budget. I could not reproduce a 16 GB PC. Feel free to take any part of it into this PR.

**@⁠domx4q** on GitHub · 2026-11-29 00:47 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1640#issuecomment-7248353477) A complementary approach, in case it is useful: domx4q/VIctory-NVIDIA@feat/shared-gpu-memory-pressure (one commit on current main, not opened as a PR so as not to compete with this one). This PR sizes the L0 defaults by the RAM line (< 24 GiB). That branch instead reacts to the budget Windows reports for the shared segment: - **Pressure.** A second memory pressure starts at 85 % NON_LOCAL use and clears below 75 %, read in the existing sweeps. `residency::pressured()` includes it, so everything that already reacts to short memory reacts to it too. - **Send spares.** They are trimmed under that pressure. That part overlaps with yours. - **Allocators.** Without `VICTORY_ALLOCATOR_TRIM` set, an allocator is renewed after 30 s, but only under pressure. - **Release log line.** `the PC's memory shared with the card grew to X MB in use of a budget of Y MB (Z %); the layer keeps …`, every 512 MiB of growth, listing scratch, copy sources, send memory, staging and blocks. A failed `Close` says it ran out of memory instead of "a command recorded into it was invalid". The pressure would also catch hosts above 24 GiB whose shared use still climbs, and the log line would show which pool grows if a 16 GB report still fails with your defaults. Testing: on a 62 GB PC (RTX 4090, Linux/Proton) it costs nothing (22.7 fps against 21.6 on main, within noise), and the line peaks at 14.6 GB of a 48 GB budget. I could not reproduce a 16 GB PC. Feel free to take any part of it into this PR.
Author
Owner

@⁠unueberlegt on GitHub · 2026-11-29 01:42 UTC · original

Thank you — and the split in pool.rs is exactly the detail a shared-segment pressure would otherwise get wrong: the card's texture blocks answer the card's memory, so they must not go when only the shared part is short.

This PR is its own change and yours is another one: this one sizes defaults once by the RAM line, yours reacts to the live budget Windows reports. Nothing here competes — please open it as its own PR. It covers what this one cannot see: hosts above 24 GiB of RAM whose shared use still climbs, and your log line names the pool that grows if a 16 GB run still fails with these defaults. (eleboucher's run above confirms the sizing itself: two 10-minute runs alive at 600 s where every start died at 120 s before.)

One real overlap to settle when you open it: both PRs add send::trim() — this one calls it from the sweep with a 16 MiB floor, sized for small hosts; yours keeps 128 MiB because one submission's sends are some 8 to 64 MiB. Your floor is the better fit for a pressure-triggered trim: keep it. Whichever of the two lands second rebases and reconciles.

**@⁠unueberlegt** on GitHub · 2026-11-29 01:42 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1640#issuecomment-7248964908) Thank you — and the split in pool.rs is exactly the detail a shared-segment pressure would otherwise get wrong: the card's texture blocks answer the card's memory, so they must not go when only the shared part is short. This PR is its own change and yours is another one: this one sizes defaults once by the RAM line, yours reacts to the live budget Windows reports. Nothing here competes — please open it as its own PR. It covers what this one cannot see: hosts above 24 GiB of RAM whose shared use still climbs, and your log line names the pool that grows if a 16 GB run still fails with these defaults. (eleboucher's run above confirms the sizing itself: two 10-minute runs alive at 600 s where every start died at 120 s before.) One real overlap to settle when you open it: both PRs add `send::trim()` — this one calls it from the sweep with a 16 MiB floor, sized for small hosts; yours keeps 128 MiB because one submission's sends are some 8 to 64 MiB. Your floor is the better fit for a pressure-triggered trim: keep it. Whichever of the two lands second rebases and reconciles.
github manually merged commit d99c17f1ba into main 2026-11-29 08:20:52 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

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