Lowvram/evict guard #2657

Open
github-bot wants to merge 11 commits from github-bot/gh-2657 into main AGit
Owner

@⁠dejvidkou on GitHub · 2026-11-29 15:38 UTC · original
dejvidkou:lowvram/evict-guard → main · +463 −26 · 7 files · 11 commits · open

Low-RAM PCs: no crash a minute into the world (#1520): a guard, CPU mirrors out of the shared memory, a sweep fix

The problem

On a 16 GB PC (RTX 3060 Laptop 6 GB, i7-12650H, Series S, DLSS ultra performance), v2026.11.29.01 crashed about a minute after the world loaded in 2 of 3 runs, with 0x8007000E on a host command list (issue #1520). A run with FSR frame generation died after 10 minutes with the device removed.

At the crash, the PC memory the card may use (the DXGI non-local budget, about half the RAM) was 7,426 of 7,359 MB. In every run, the good one too, "host copies of title memory" grow from ~0.2 GB to 5.6-5.9 GB in the first ~75 s of world load, and their CPU sides are made in that memory (shadow::buffer_sides). The run that lived peaked at 6,838 MB.

The guards in residency.rs look at RAM and commit only. Commit counts what the pagefile may still grow by (41 GB "left" at the crash), and nothing looks at the non-local budget.

What this changes

On hosts with under 24 GiB of RAM (residency::small_host_ram(), as #1520's other defaults), unset:

  • VICTORY_CARD_CPU_HEAP is on (it was off everywhere);
  • VICTORY_SHARED_GUARD is 85 %;
  • VICTORY_CARD_SWEEP_WINS is on, with the 15 s rule (74174665).

On every host, the launcher now warns about a small page file that Windows manages (6fde7328, aa4ba51d).

An explicit value decides on any host (0 off), and bigger hosts are as before. docs/bug-journal.md has a line about it.

The parts:

  1. VICTORY_SHARED_GUARD (1 = 85 %, or a percent 50-98; 0 off). Once the non-local use passes that share:
    • new textures wait (resource::room, room_for_first_upload);
    • windows of title memory may go to CPU-mapped card memory up to the card's budget less 256 MB instead of four fifths of it (shadow::window_mapped_for), so they take none of the non-local memory;
    • it counts as host memory pressure (left 5 points under the share), so the existing spare and pool trims run;
    • a line every 5 s reports the use and what the guard did.
  2. VICTORY_CARD_SWEEP_WINS=1: a fix to let_go_idle. idle_sweep_policy (3246d252) lets the card's eviction win when both the card and the host are pressured, but the take still asked for wholly unmapped title memory whenever host pressure was on (host_idle.is_some(), 0efd23e3). A 16 GB PC is under 8 GiB free in all of play, so a full card got almost nothing back (a few MB in 10 minutes, with 7.2 GB in use of a 5.2 GB budget). Behind a switch because of its first cost here; with the 15 s rule (5) it is on by default on small hosts (below).
  3. A fix in the same guard: residency::refresh reads RAM pressure alone (PRESSURED), not pressured().
  4. VICTORY_CARD_CPU_HEAP on by default on small hosts (3634e25f's switch, unchanged otherwise). Its ignored measurement test now expects what CardCpu decides. Set, or named by VICTORY_AB, it is still read through asked_for! at each call, so A/B runs can flip it.
  5. VICTORY_CARD_SWEEP_IDLE_MS (with VICTORY_CARD_SWEEP_WINS=1; 15,000 unset, 1,500-600,000). Under host pressure, a copy whose title memory is still mapped goes only once idle this long; one wholly unmapped goes at the card's own time, as before. The card's rule is 1.5 s on a card past its line, which a 6 GB card is in all of play, so the first version of the fix freed copies that were made again soon after.

Measured (same PC, same route, frame generation off, about 10 min each)

Official 13:17 + VICTORY_CARD_CPU_HEAP=1 (existing switch), guard, sweep fix guard, sweep fix
crashed 2 of 3 runs crashed with these settings no (11 min) no (10 min)
non-local memory, most 6,838-7,446 MB 6,151 MB 6,915 MB (the guard held it)
guard engaged - never (83 % at most) 10 of 112 lines
fps median 14.4 10.8 11.3
textures uploaded 27 GB in 10 min (FG run) 48 GB in 11 min 49 GB in 10 min
  • VICTORY_CARD_CPU_HEAP=1 (3634e25f, off by default) moved 942 MiB of CPU mirrors out of the non-local memory and kept the run under the guard's line, at no fps cost we could see (10.8 fps with it, 11.3 without).
  • The sweep fix made textures visibly better here (skin, detail), but nearly doubled texture uploads (copies +7 ms a frame), about 3 fps on this PC. Hence the switch.
  • The guard alone kept the second run under the budget. The price was textures held back (more pop-in).

Hence commit c6fef4e2 turns both on by default on small hosts. The sweep fix stayed off until it was cheaper (below).

The sweep fix with the 15 s rule (4c69d44b)

One run of the diagnostics build with VICTORY_AB=30,VICTORY_CARD_SWEEP_WINS, 16 phases of 30 s, the guard and CPU mirrors on in both:

sweep fix on (15 s rule) off
ms/frame at 2.5k / 3.5k / 4.5k draws 62.8 / 74.5 / 86.3 60.9 / 72.5 / 84.1
p90 of the phases (median) 110.7 ms 98.0 ms
texture MB uploaded a frame 41.3 36.5
textures waiting 14,535 15,850
card busy 82 % 82 %

The 15 s rule cuts the fix's cost from about +80 % uploads and ~3 fps (the 1.5 s rule) to +13 % uploads and ~2 ms a frame, with 8 % fewer textures waiting. It has more hitches at p90. Played, it felt "a bit smoother", with models and textures coming in quicker at the same fps.

Then on by default on small hosts (74174665)

An 8-minute play run of the release build with it on, against the 1.5 s rule's run (15:06) and a run without it (18:17):

15 s rule 1.5 s rule without
fps median (p10 / p90) 11.8 (9.6 / 14.5) 11.0 (9.1 / 13.5) -
ms/frame at 3-4k / 4-5k draws 78 / 86.8 89.4 / 96.4 -
longest wait for new memory 270 ms 1,005 ms -
the card's memory, most 5,558 MB 5,598 MB 6,281 MB
the PC's memory shared with the card, most 5,954 MB 6,915 MB 5,779 MB
crashes 0 0 0

The player saw textures come in sooner, about a fifth less flicker and less stutter. So 74174665 turns it on by default under 24 GiB of RAM, like the guard and the CPU mirrors (0 off; bigger hosts as before). It also matters on 8 GB cards: a texture a draw, copy or transition uses is made on first use with no room test (resource::host_resource), so on a 16 GB PC only this sweep brings the card back down.

The launcher's page file warning (6fde7328, aa4ba51d)

Every run here had ~145 host pipelines "failed" with 0x8007000E (144 mesh, 5 graphics), the same ~130 in each. They are the memory guard's own refusals (memguard::refusal()): compilemem puts a driver compile off while it would leave commit under VICTORY_COMMIT_FLOOR_MB (4,096). Windows managed the page file, which stayed at 8.5 GB (a commit limit of 24.7 GB, with the title committing ~21 GB), so commit left was 0.3-2.5 GB all run. A managed page file grows only as commit reaches the limit, and the guard keeps 4 GB under it, so it never grew: 2,048+ put-offs, and none of the 149 was made later in the run. play.rs memory_warning says nothing for a managed page file.

page file managed (8.5 GB now) custom 36,864-49,152 MB
pipelines put off and never made 149 0
commit left 0.3-2.5 GB 20.7-21.8 GB
fps median (p10 / p90) 11.8 (9.6 / 14.5) 12.1 (10.3 / 16.5)
crashes 0 0

So a managed page file is now judged by the commit limit now (ram_and_page_files also returns ullTotalPageFile), and the fix the warning names is a custom size: initial 52 GB less the RAM, maximum 12 GB more (36,864 / 49,152 MB on 16 GB), not the managed one. 6fde7328 did this under 24 GiB of RAM only. aa4ba51d does it on every host, after the 32 GB PC in this thread (RTX 5080, a managed page file of 14.5 GB) had 0.4-2.3 GB left to commit in play and 35-49 pipelines refused with 0x8007000E in a 10-minute run: the same put-offs.

(The ~110 draws a frame "dropped without a host pipeline" are something else: the ray-tracing passes left out on purpose, VICTORY_LEAVE_OUT and the water light.)

Checks

  • cargo build --release --locked -p victory
  • cargo test --release --locked -p victory-gpu --lib -- --test-threads=1: 929 passed, 1 failed: shader_cache::tests::every_switch_of_the_translator_is_in_the_key, which fails the same way on main (41adb551). Two texback GPU tests fail when run in parallel with the others and pass alone (-- texback:: --test-threads=1). They were not touched here.
  • cargo clippy -p victory-gpu --all-targets: no warnings in the changed lines. Note: -D warnings stops earlier on main, in victory-shader (emit/lower/analysis.rs:6, :467, emit/lower.rs:594).
  • New tests: residency::tests::{the_shared_guard_is_on_by_itself_on_a_small_host_and_one_means_85, the_shared_guard_holds_past_its_share_of_the_budget, shared_pressure_enters_at_the_share_and_leaves_five_points_under, windows_may_fill_the_card_but_its_margin_only_when_shared_memory_is_tight}, resource::tests::{a_sweep_for_the_card_takes_mapped_copies_only_with_the_switch, the_card_sweeps_idle_time_is_15_s_unless_set, the_card_sweep_takes_mapped_copies_by_itself_on_a_small_host_only}, shadow::land_tests::cpu_mirrors_go_to_process_memory_by_default_on_a_small_host_only.
  • cargo test --release --locked -p victory: 82 passed, among them play::tests::{memory_warned_under_52_gb, a_managed_page_file_is_judged_by_its_size_now_on_a_big_host_too, a_small_managed_page_file_is_warned_about_on_a_small_host}.
  • cargo xtask policy --staged on each commit.

The sweep bug was found in a code read by Gemini and checked against the code and the logs.

🤖 Generated with Claude Code

**@⁠dejvidkou** on GitHub · 2026-11-29 15:38 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2657) `dejvidkou:lowvram/evict-guard` → `main` · +463 −26 · 7 files · 11 commits · open # Low-RAM PCs: no crash a minute into the world (#1520): a guard, CPU mirrors out of the shared memory, a sweep fix ## The problem On a 16 GB PC (RTX 3060 Laptop 6 GB, i7-12650H, Series S, DLSS ultra performance), v2026.11.29.01 crashed about a minute after the world loaded in 2 of 3 runs, with `0x8007000E` on a host command list (issue #1520). A run with FSR frame generation died after 10 minutes with the device removed. At the crash, the PC memory the card may use (the DXGI non-local budget, about half the RAM) was **7,426 of 7,359 MB**. In every run, the good one too, "host copies of title memory" grow from ~0.2 GB to **5.6-5.9 GB** in the first ~75 s of world load, and their CPU sides are made in that memory (`shadow::buffer_sides`). The run that lived peaked at 6,838 MB. The guards in `residency.rs` look at RAM and commit only. Commit counts what the pagefile may still grow by (41 GB "left" at the crash), and nothing looks at the non-local budget. ## What this changes **On hosts with under 24 GiB of RAM** (`residency::small_host_ram()`, as #1520's other defaults), unset: - `VICTORY_CARD_CPU_HEAP` is on (it was off everywhere); - `VICTORY_SHARED_GUARD` is 85 %; - `VICTORY_CARD_SWEEP_WINS` is on, with the 15 s rule (74174665). On every host, the launcher now warns about a small page file that Windows manages (6fde7328, aa4ba51d). An explicit value decides on any host (`0` off), and **bigger hosts are as before**. `docs/bug-journal.md` has a line about it. The parts: 1. **`VICTORY_SHARED_GUARD`** (`1` = 85 %, or a percent 50-98; `0` off). Once the non-local use passes that share: - new textures wait (`resource::room`, `room_for_first_upload`); - windows of title memory may go to CPU-mapped card memory up to the card's budget less 256 MB instead of four fifths of it (`shadow::window_mapped_for`), so they take none of the non-local memory; - it counts as host memory pressure (left 5 points under the share), so the existing spare and pool trims run; - a line every 5 s reports the use and what the guard did. 2. **`VICTORY_CARD_SWEEP_WINS=1`**: a fix to `let_go_idle`. `idle_sweep_policy` (3246d252) lets the card's eviction win when both the card and the host are pressured, but the take still asked for wholly unmapped title memory whenever host pressure was on (`host_idle.is_some()`, 0efd23e3). A 16 GB PC is under 8 GiB free in all of play, so a full card got almost nothing back (a few MB in 10 minutes, with 7.2 GB in use of a 5.2 GB budget). Behind a switch because of its first cost here; with the 15 s rule (5) it is on by default on small hosts (below). 3. A fix in the same guard: `residency::refresh` reads RAM pressure alone (`PRESSURED`), not `pressured()`. 4. **`VICTORY_CARD_CPU_HEAP` on by default on small hosts** (3634e25f's switch, unchanged otherwise). Its ignored measurement test now expects what `CardCpu` decides. Set, or named by `VICTORY_AB`, it is still read through `asked_for!` at each call, so A/B runs can flip it. 5. **`VICTORY_CARD_SWEEP_IDLE_MS`** (with `VICTORY_CARD_SWEEP_WINS=1`; 15,000 unset, 1,500-600,000). Under host pressure, a copy whose title memory is still mapped goes only once idle this long; one wholly unmapped goes at the card's own time, as before. The card's rule is 1.5 s on a card past its line, which a 6 GB card is in all of play, so the first version of the fix freed copies that were made again soon after. ## Measured (same PC, same route, frame generation off, about 10 min each) | | Official 13:17 | + `VICTORY_CARD_CPU_HEAP=1` (existing switch), guard, sweep fix | guard, sweep fix | |---|---|---|---| | crashed | 2 of 3 runs crashed with these settings | no (11 min) | no (10 min) | | non-local memory, most | 6,838-7,446 MB | **6,151 MB** | 6,915 MB (the guard held it) | | guard engaged | - | never (83 % at most) | 10 of 112 lines | | fps median | 14.4 | 10.8 | 11.3 | | textures uploaded | 27 GB in 10 min (FG run) | 48 GB in 11 min | 49 GB in 10 min | - **`VICTORY_CARD_CPU_HEAP=1`** (3634e25f, off by default) moved 942 MiB of CPU mirrors out of the non-local memory and kept the run under the guard's line, at no fps cost we could see (10.8 fps with it, 11.3 without). - **The sweep fix** made textures visibly better here (skin, detail), but nearly doubled texture uploads (copies +7 ms a frame), about 3 fps on this PC. Hence the switch. - The guard alone kept the second run under the budget. The price was textures held back (more pop-in). Hence commit c6fef4e2 turns both on by default on small hosts. The sweep fix stayed off until it was cheaper (below). ### The sweep fix with the 15 s rule (4c69d44b) One run of the diagnostics build with `VICTORY_AB=30,VICTORY_CARD_SWEEP_WINS`, 16 phases of 30 s, the guard and CPU mirrors on in both: | | sweep fix on (15 s rule) | off | |---|---|---| | ms/frame at 2.5k / 3.5k / 4.5k draws | 62.8 / 74.5 / 86.3 | 60.9 / 72.5 / 84.1 | | p90 of the phases (median) | 110.7 ms | 98.0 ms | | texture MB uploaded a frame | 41.3 | 36.5 | | textures waiting | 14,535 | 15,850 | | card busy | 82 % | 82 % | The 15 s rule cuts the fix's cost from about +80 % uploads and ~3 fps (the 1.5 s rule) to +13 % uploads and ~2 ms a frame, with 8 % fewer textures waiting. It has more hitches at p90. Played, it felt "a bit smoother", with models and textures coming in quicker at the same fps. ### Then on by default on small hosts (74174665) An 8-minute play run of the release build with it on, against the 1.5 s rule's run (15:06) and a run without it (18:17): | | 15 s rule | 1.5 s rule | without | |---|---|---|---| | fps median (p10 / p90) | 11.8 (9.6 / 14.5) | 11.0 (9.1 / 13.5) | - | | ms/frame at 3-4k / 4-5k draws | 78 / 86.8 | 89.4 / 96.4 | - | | longest wait for new memory | 270 ms | 1,005 ms | - | | the card's memory, most | 5,558 MB | 5,598 MB | 6,281 MB | | the PC's memory shared with the card, most | 5,954 MB | 6,915 MB | 5,779 MB | | crashes | 0 | 0 | 0 | The player saw textures come in sooner, about a fifth less flicker and less stutter. So 74174665 turns it on by default under 24 GiB of RAM, like the guard and the CPU mirrors (`0` off; bigger hosts as before). It also matters on 8 GB cards: a texture a draw, copy or transition uses is made on first use with no room test (`resource::host_resource`), so on a 16 GB PC only this sweep brings the card back down. ### The launcher's page file warning (6fde7328, aa4ba51d) Every run here had ~145 host pipelines "failed" with `0x8007000E` (144 mesh, 5 graphics), the same ~130 in each. They are the memory guard's own refusals (`memguard::refusal()`): `compilemem` puts a driver compile off while it would leave commit under `VICTORY_COMMIT_FLOOR_MB` (4,096). Windows managed the page file, which stayed at 8.5 GB (a commit limit of 24.7 GB, with the title committing ~21 GB), so commit left was 0.3-2.5 GB all run. A managed page file grows only as commit reaches the limit, and the guard keeps 4 GB under it, so it never grew: 2,048+ put-offs, and **none of the 149 was made later in the run**. `play.rs` `memory_warning` says nothing for a managed page file. | | page file managed (8.5 GB now) | custom 36,864-49,152 MB | |---|---|---| | pipelines put off and never made | 149 | **0** | | commit left | 0.3-2.5 GB | 20.7-21.8 GB | | fps median (p10 / p90) | 11.8 (9.6 / 14.5) | 12.1 (10.3 / 16.5) | | crashes | 0 | 0 | So a managed page file is now judged by the commit limit now (`ram_and_page_files` also returns `ullTotalPageFile`), and the fix the warning names is a custom size: initial 52 GB less the RAM, maximum 12 GB more (36,864 / 49,152 MB on 16 GB), not the managed one. 6fde7328 did this under 24 GiB of RAM only. aa4ba51d does it on every host, after the 32 GB PC in this thread (RTX 5080, a managed page file of 14.5 GB) had 0.4-2.3 GB left to commit in play and 35-49 pipelines refused with `0x8007000E` in a 10-minute run: the same put-offs. (The ~110 draws a frame "dropped without a host pipeline" are something else: the ray-tracing passes left out on purpose, `VICTORY_LEAVE_OUT` and the water light.) ## Checks - `cargo build --release --locked -p victory` - `cargo test --release --locked -p victory-gpu --lib -- --test-threads=1`: 929 passed, 1 failed: `shader_cache::tests::every_switch_of_the_translator_is_in_the_key`, which fails the same way on main (41adb551). Two `texback` GPU tests fail when run in parallel with the others and pass alone (`-- texback:: --test-threads=1`). They were not touched here. - `cargo clippy -p victory-gpu --all-targets`: no warnings in the changed lines. Note: `-D warnings` stops earlier on main, in `victory-shader` (`emit/lower/analysis.rs:6`, `:467`, `emit/lower.rs:594`). - New tests: `residency::tests::{the_shared_guard_is_on_by_itself_on_a_small_host_and_one_means_85, the_shared_guard_holds_past_its_share_of_the_budget, shared_pressure_enters_at_the_share_and_leaves_five_points_under, windows_may_fill_the_card_but_its_margin_only_when_shared_memory_is_tight}`, `resource::tests::{a_sweep_for_the_card_takes_mapped_copies_only_with_the_switch, the_card_sweeps_idle_time_is_15_s_unless_set, the_card_sweep_takes_mapped_copies_by_itself_on_a_small_host_only}`, `shadow::land_tests::cpu_mirrors_go_to_process_memory_by_default_on_a_small_host_only`. - `cargo test --release --locked -p victory`: 82 passed, among them `play::tests::{memory_warned_under_52_gb, a_managed_page_file_is_judged_by_its_size_now_on_a_big_host_too, a_small_managed_page_file_is_warned_about_on_a_small_host}`. - `cargo xtask policy --staged` on each commit. The sweep bug was found in a code read by Gemini and checked against the code and the logs. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Windows lets the card use about half the RAM (the non-local budget,
7,359 MB on a 16 GB PC). On an RTX 3060 Laptop the host copies of title
memory came to 5.6-5.9 GB of it in the first 75 s of world load in every
run, and two runs of three passed the budget and ended on a host command
list (0x8007000E, issue #1520). The memory guards looked at RAM and commit
only (commit counts pagefile growth: 41 GB "left" in those runs).

With VICTORY_SHARED_GUARD (off unless set; 1 is 85 %, else a percent 50-98),
once that memory passes the share:
- new textures wait (resource::room and room_for_first_upload say no
  room, under the floor too);
- windows of title memory may go to card memory mapped by the CPU up to
  the card's budget less 256 MB instead of four fifths of it, so they take
  none of that memory;
- it counts as host memory pressure (left 5 points under the share), so
  the spares and pools already trimmed under RAM pressure are trimmed.

A line every 5 s says the memory's use and what the guard did.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
idle_sweep_policy (3246d252) lets the card's eviction win when both the
card and the PC's memory are pressured (unmapped_only false), but the take
in let_go_idle still asked for title memory wholly unmapped whenever host
pressure was on (host_idle.is_some(), 0efd23e3, from before the policy).
On a 16 GB PC free RAM is under 8 GiB in all of play, so host_idle is
always Some, and a full card got almost nothing back: a few MB in a
10-minute run on an RTX 3060 Laptop with 7.2 GB in use of a 5.2 GB budget.

With VICTORY_CARD_SWEEP_WINS=1 (off by default) the wholly-unmapped test is
asked only in the unmapped-only sweep. Found by a read of the code by
Gemini; checked against the code and the logs.

texback's two GPU tests fail when run in parallel with the others and pass
alone (--test-threads=1); not touched here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
residency::refresh read pressured(), which since cb096a52 also counts the
shared guard's pressure: with the guard on, RAM pressure entered at 3-5 GB
free instead of 3, and over 5 GB free it said "host memory pressure
cleared" at every look. It reads PRESSURED alone now. Found in a review of
cb096a52 by Gemini.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 15:41:41 +00:00
On a host of under 24 GiB of RAM (residency::small_host_ram), unset:
- VICTORY_CARD_CPU_HEAP is on: the CPU sides of copies with a card side
  go to the process's own memory, not the memory Windows lets the card use
  (about half the RAM);
- VICTORY_SHARED_GUARD is 85 %.
An explicit value decides as before on any host (0 off); bigger hosts keep
both off.

On a 16 GB PC (RTX 3060 Laptop 6 GB) two runs of three died a minute into
the world at 7,426 of 7,359 MB of that memory. With the mirrors out of it,
942 MiB of them, the most came to 6,151 MB and an 11-minute run lived at
the same frame rate (10.8 fps against 11.3 without). The guard alone held a
run at 6,915 MB.

The measurement test of the mirrors expects what CardCpu decides now. A
line of docs/bug-journal.md says the above.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠NAbobo101 on GitHub · 2026-11-29 17:04 UTC · original

Tested this branch (3ebcfa5e) against its base (829188e9) on a second 16 GB machine.

Setup: RTX 5060 8 GB, Ryzen 7 5700G, 16 GB RAM, Windows 11. Series S, DLSS off, release builds, shaders preloaded, the launcher's defaults (on this branch VICTORY_CARD_CPU_HEAP and VICTORY_SHARED_GUARD=85 came on by themselves, as the startup lines say). Open world, an automated 10-minute walking route from a save in the first house.

829188e9 (3 runs) this PR (2 runs)
world loaded 1 of 3 (2 died with 0x8007000E, "a host command list did not close") 2 of 2
route finished 0 of 3: the one that loaded lost the device ~6.3 min in 1 of 2: the other lost the device ~6.6 min in
allocation failures (no upload buffer / no shared buffer) thousands once the device was gone 2 and 31
non-local memory, most 7.2 GB of 7.2 GB in the runs that died loading 80-89 % of 7,230 MB; the guard engaged on 1 of 103 status lines
card memory, most 8.4 GB of a 6.9 GB budget 9.6-9.7 GB of a ~6.85 GB budget
frame rate (full route) none lasted 5.4 fps; frame median ~156 ms, p90 ~275 ms

So here the branch fixes the load crashes, and the non-local memory stays under the line. The device loss in the middle of the route is there with and without it, at about the same point, so I don't think this PR causes it. In the PR run it surfaced first as could not snapshot 4 dirty bytes from a private CPU mirror; device removed (0x887A0005), but no upload buffer calls were already failing with the device suspended just before, so I read that as where the loss was noticed, not its cause. In every run the card's own memory went well past its budget (8.4-9.7 GB against ~6.9 GB), which may be what is left to look at on 8 GB cards.

Three more runs on 829188e9 with VICTORY_CARD_ROOM_FOR_TARGETS_MB=1536 went the same way: two died loading with the same error, one lost the device ~3 min into the route.

For reference, a build from an earlier main on the same route ran at ~6.6 fps with the card at ~5.3 GB and no allocation failures.

(Measured with an automated route; summary prepared with help from Claude Code.)

**@⁠NAbobo101** on GitHub · 2026-11-29 17:04 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2657#issuecomment-7259404248) Tested this branch (3ebcfa5e) against its base (829188e9) on a second 16 GB machine. **Setup:** RTX 5060 8 GB, Ryzen 7 5700G, 16 GB RAM, Windows 11. Series S, DLSS off, release builds, shaders preloaded, the launcher's defaults (on this branch `VICTORY_CARD_CPU_HEAP` and `VICTORY_SHARED_GUARD=85` came on by themselves, as the startup lines say). Open world, an automated 10-minute walking route from a save in the first house. | | 829188e9 (3 runs) | this PR (2 runs) | |---|---|---| | world loaded | 1 of 3 (2 died with `0x8007000E`, "a host command list did not close") | 2 of 2 | | route finished | 0 of 3: the one that loaded lost the device ~6.3 min in | 1 of 2: the other lost the device ~6.6 min in | | allocation failures (`no upload buffer` / `no shared buffer`) | thousands once the device was gone | 2 and 31 | | non-local memory, most | 7.2 GB of 7.2 GB in the runs that died loading | 80-89 % of 7,230 MB; the guard engaged on 1 of 103 status lines | | card memory, most | 8.4 GB of a 6.9 GB budget | 9.6-9.7 GB of a ~6.85 GB budget | | frame rate (full route) | none lasted | 5.4 fps; frame median ~156 ms, p90 ~275 ms | So here the branch fixes the load crashes, and the non-local memory stays under the line. The device loss in the middle of the route is there with and without it, at about the same point, so I don't think this PR causes it. In the PR run it surfaced first as `could not snapshot 4 dirty bytes from a private CPU mirror; device removed` (`0x887A0005`), but `no upload buffer` calls were already failing with the device suspended just before, so I read that as where the loss was noticed, not its cause. In every run the card's own memory went well past its budget (8.4-9.7 GB against ~6.9 GB), which may be what is left to look at on 8 GB cards. Three more runs on 829188e9 with `VICTORY_CARD_ROOM_FOR_TARGETS_MB=1536` went the same way: two died loading with the same error, one lost the device ~3 min into the route. For reference, a build from an earlier main on the same route ran at ~6.6 fps with the card at ~5.3 GB and no allocation failures. (Measured with an automated route; summary prepared with help from Claude Code.)
3ebcfa5e kept CardCpu::asked's answer in a OnceLock and read the switch
only when VICTORY_CARD_CPU_HEAP itself was set, so a diagnostics or `ab`
build's VICTORY_AB naming it alone was passed over, and set, it could not
flip mid-run. Only the host-size default is kept now; set, or named by
VICTORY_AB, the switch goes through asked_for! at each call, as before the
default. Found in a review by Gemini.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With VICTORY_CARD_SWEEP_WINS=1 the card's sweep took every copy idle its
rule's time, 1.5 s on a card past its line, as a 6 GB card is in all of
play. On an RTX 3060 Laptop that doubled the texture uploads (48 GB in 11
minutes against 27 GB in 10) and cost ~3 fps of 14: copies went and were
made again. Textures looked better (fewer waiting).

Now, under host pressure, a copy whose title memory is still mapped goes
only once idle VICTORY_CARD_SWEEP_IDLE_MS (15,000 unset, 1,500 to
600,000); one wholly unmapped goes at the card's time, as before the
switch. Without host pressure, or with the switch off, nothing changes.
VICTORY_CARD_SWEEP_WINS goes through asked_for!, so VICTORY_AB can turn it
on and off in one run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠dejvidkou on GitHub · 2026-11-29 20:14 UTC · original · reviewed

Thanks for testing on a second machine, this is very useful.

Good to see the load crashes gone and the non-local memory staying under the line on an 8 GB card too. I agree the device loss in the middle of the route is not from this PR. It happens on the base at about the same point.

The card's own memory going well past its budget matches what I see here: 7.2 GB in use of a 5.2 GB budget on a 6 GB card. The last commit (68b43cba) is for that. Could you try two things?

  1. One run with VICTORY_CARD_SWEEP_WINS=1 on the head of this branch (68b43cba). Without it, under host pressure the card's sweep only takes copies whose title memory is wholly unmapped. On a 16 GB PC that is almost nothing, so a full card gets little back. With it on, mapped copies also go once idle 15 s (VICTORY_CARD_SWEEP_IDLE_MS). Here it gave 8 % fewer textures waiting for +13 % texture uploads and about 2 ms a frame. If you use the launcher, it clears typed VICTORY_* variables, so the line has to go in %LOCALAPPDATA%\victory\victory-settings.txt.

    • Does the card's memory stay nearer its budget?
    • Does the route finish?
    • The memory now: and slot eviction since the last line lines would show it best.
  2. Which earlier main ran the route at ~6.6 fps with the card at ~5.3 GB? A commit or release name would let us find what made the card's memory grow past its budget since then. That looks like the next thing to fix for small cards.

Thanks again!

**@⁠dejvidkou** on GitHub · 2026-11-29 20:14 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2657#pullrequestreview-6104599470) · **reviewed** Thanks for testing on a second machine, this is very useful. Good to see the load crashes gone and the non-local memory staying under the line on an 8 GB card too. I agree the device loss in the middle of the route is not from this PR. It happens on the base at about the same point. The card's own memory going well past its budget matches what I see here: 7.2 GB in use of a 5.2 GB budget on a 6 GB card. The last commit (68b43cba) is for that. Could you try two things? 1. **One run with `VICTORY_CARD_SWEEP_WINS=1`** on the head of this branch (68b43cba). Without it, under host pressure the card's sweep only takes copies whose title memory is wholly unmapped. On a 16 GB PC that is almost nothing, so a full card gets little back. With it on, mapped copies also go once idle 15 s (`VICTORY_CARD_SWEEP_IDLE_MS`). Here it gave 8 % fewer textures waiting for +13 % texture uploads and about 2 ms a frame. If you use the launcher, it clears typed `VICTORY_*` variables, so the line has to go in `%LOCALAPPDATA%\victory\victory-settings.txt`. - Does the card's memory stay nearer its budget? - Does the route finish? - The `memory now:` and `slot eviction since the last line` lines would show it best. 2. **Which earlier main** ran the route at ~6.6 fps with the card at ~5.3 GB? A commit or release name would let us find what made the card's memory grow past its budget since then. That looks like the next thing to fix for small cards. Thanks again!
Unset, VICTORY_CARD_SWEEP_WINS is now on with under 24 GiB of RAM
(residency::small_host_ram), as the shared guard and the CPU mirrors; an
explicit value decides on any host, and bigger hosts are as before. Set, or
named by VICTORY_AB, it is still read through asked_for! at each call.

With the 15 s rule (68b43cba), on an RTX 3060 Laptop 6 GB with 16 GB of RAM,
an 8-minute play run against the 1.5 s rule: 11.8 fps against 11.0, the
longest wait for new memory 270 ms against 1,005, the card's memory at most
5,558 MB (6,281 MB in a run without the switch). The player saw textures
come in sooner and less flicker.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The memory warning before a start said nothing where Windows manages the
page file's size ("it grows as needed"). On a 16 GB PC (RTX 3060 Laptop,
2026-11-29) it stayed at 8.5 GB, a commit limit of 24.7 GB with the title
committing ~21 GB, and the driver compiles memguard keeps 4 GB of commit free
for were put off all run (2,048 times): 149 pipelines were never made.
With a custom page file of 36,864-49,152 MB none were, at the same frame
rate (12.1 fps against 11.8).

Under 24 GB of RAM a managed page file is now judged by the commit limit
now (streamline::ram_and_page_files gives it), and on such a host the fix
named is a custom size (initial 52 GB less the RAM, maximum 12 GB more), not
the managed one. Bigger hosts are warned about as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠NAbobo101 on GitHub · 2026-11-30 01:38 UTC · original

Thanks! Both done, and two corrections to my earlier comment first.

1. VICTORY_CARD_SWEEP_WINS=1 on 68b43cba (same PC, route and launcher defaults as before, one run):

3ebcfa5e, sweep fix off (2 runs) 68b43cba, VICTORY_CARD_SWEEP_WINS=1 (1 run)
route finished 1 of 2 (device lost ~6.6 min in) yes, no device loss
allocation failures 2 and 31 0
card memory (memory now:) 9.6-9.7 GB at most, ~6.85 GB budget 7.9 GB at most; 6.8 GB on average against a 6.9 GB budget
non-local memory, most 80-89 % 80.5 %, the guard never engaged (0 of 143 lines)
frame rate 5.4 fps; median ~156 ms, p90 ~275 ms 5.8 fps; median 154 ms, p90 257 ms

So the card stayed near its budget and the route finished. slot eviction since the last line printed only once during the route (nothing let go), so on this PC the sweep did the work. Textures picked by index ended at ~103,000 uploaded (30 GB) with ~14,900 waiting. One run only, so take the frame rate with some salt.

2. The earlier build. I described it wrongly. It was not a plain main: it was v2026.11.27 (959dcaf) plus 17 commits from another fork (CHECK6960/Victory-Nvidia-optimized, no longer on GitHub) plus a local copy change of mine. Also, "~5.3 GB" was its card memory right after the world loaded, not during play. During play it held ~6.6 GB, inside its budget, with new textures waiting at the 90 % line.

So I ran plain 959dcaf on the same route (this run with VICTORY_CARD_ROOM_FOR_TARGETS_MB=1536, as my earlier fork runs; the PR runs used the launcher's 3072):

  • route finished, no device loss, no allocation failures;
  • card memory in use ~6.5 GB on average, 6.65 GB at most, against a ~6.9-7.0 GB budget: new textures wait at the 90 % line instead of going past it;
  • memory shared with the card 3.8 GB at load;
  • 4.9 fps; median 166 ms, p90 244 ms.

So on this PC the card going past its budget appeared between 959dcaf (v2026.11.27) and 829188e9, while the frame rate on main went up in the same span (4.9 to 5.4-5.8 fps here). With your sweep fix the card is back near its budget at the better frame rate.

(Measured with an automated route; summary prepared with help from Claude Code.)

**@⁠NAbobo101** on GitHub · 2026-11-30 01:38 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2657#issuecomment-7266320021) Thanks! Both done, and two corrections to my earlier comment first. **1. `VICTORY_CARD_SWEEP_WINS=1` on 68b43cba** (same PC, route and launcher defaults as before, one run): | | 3ebcfa5e, sweep fix off (2 runs) | 68b43cba, `VICTORY_CARD_SWEEP_WINS=1` (1 run) | |---|---|---| | route finished | 1 of 2 (device lost ~6.6 min in) | yes, no device loss | | allocation failures | 2 and 31 | 0 | | card memory (`memory now:`) | 9.6-9.7 GB at most, ~6.85 GB budget | 7.9 GB at most; **6.8 GB on average against a 6.9 GB budget** | | non-local memory, most | 80-89 % | 80.5 %, the guard never engaged (0 of 143 lines) | | frame rate | 5.4 fps; median ~156 ms, p90 ~275 ms | 5.8 fps; median 154 ms, p90 257 ms | So the card stayed near its budget and the route finished. `slot eviction since the last line` printed only once during the route (nothing let go), so on this PC the sweep did the work. Textures picked by index ended at ~103,000 uploaded (30 GB) with ~14,900 waiting. One run only, so take the frame rate with some salt. **2. The earlier build.** I described it wrongly. It was not a plain main: it was v2026.11.27 (959dcaf) plus 17 commits from another fork (CHECK6960/Victory-Nvidia-optimized, no longer on GitHub) plus a local copy change of mine. Also, "~5.3 GB" was its card memory right after the world loaded, not during play. During play it held ~6.6 GB, inside its budget, with new textures waiting at the 90 % line. So I ran **plain 959dcaf** on the same route (this run with `VICTORY_CARD_ROOM_FOR_TARGETS_MB=1536`, as my earlier fork runs; the PR runs used the launcher's 3072): - route finished, no device loss, no allocation failures; - card memory in use ~6.5 GB on average, 6.65 GB at most, against a ~6.9-7.0 GB budget: new textures wait at the 90 % line instead of going past it; - memory shared with the card 3.8 GB at load; - 4.9 fps; median 166 ms, p90 244 ms. So on this PC the card going past its budget appeared between 959dcaf (v2026.11.27) and 829188e9, while the frame rate on main went up in the same span (4.9 to 5.4-5.8 fps here). With your sweep fix the card is back near its budget at the better frame rate. (Measured with an automated route; summary prepared with help from Claude Code.)
Author
Owner

@⁠dejvidkou on GitHub · 2026-11-30 07:52 UTC · original

Thanks, this is exactly what I hoped for, and thanks for correcting the earlier build. That turns the question from "which main" into "what changed since v2026.11.27".

The sweep fix. On 68b43cba with VICTORY_CARD_SWEEP_WINS=1 the route finished, with no device loss and no allocation failures, and the card sat at 6.8 GB on average against a 6.9 GB budget. It is held on average, not at every moment: the peak of 7.9 GB is still about 1 GB past the budget, so that part is not solved. One run, so I agree the frame rate says little.

Defaults. On the current head (17e52561) the sweep is on by itself under 24 GiB of RAM, with the 15 s rule, so a 16 GB PC no longer needs the line in victory-settings.txt. If you have a run to spare, the plain launcher on the head would confirm it gives the same result as your opt-in run. Not needed otherwise.

Where the card went past its budget. 959dcaf to 829188e9 is 1,764 commits, about 11 builds to bisect. The base does the same on my 6 GB card (7.2 GB in use of a 5.2 GB budget). Could you bisect it and post what you find, I'll try the same on my end.

Thanks again!

**@⁠dejvidkou** on GitHub · 2026-11-30 07:52 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2657#issuecomment-7272225636) Thanks, this is exactly what I hoped for, and thanks for correcting the earlier build. That turns the question from "which main" into "what changed since v2026.11.27". **The sweep fix.** On 68b43cba with `VICTORY_CARD_SWEEP_WINS=1` the route finished, with no device loss and no allocation failures, and the card sat at 6.8 GB on average against a 6.9 GB budget. It is held on average, not at every moment: the peak of 7.9 GB is still about 1 GB past the budget, so that part is not solved. One run, so I agree the frame rate says little. **Defaults.** On the current head (17e52561) the sweep is on by itself under 24 GiB of RAM, with the 15 s rule, so a 16 GB PC no longer needs the line in `victory-settings.txt`. If you have a run to spare, the plain launcher on the head would confirm it gives the same result as your opt-in run. Not needed otherwise. **Where the card went past its budget.** 959dcaf to 829188e9 is 1,764 commits, about 11 builds to bisect. The base does the same on my 6 GB card (7.2 GB in use of a 5.2 GB budget). Could you bisect it and post what you find, I'll try the same on my end. Thanks again!
Author
Owner

@⁠iridiumLotus on GitHub · 2026-11-30 08:25 UTC · original

A data point from a host this PR leaves as before: VICTORY_CARD_CPU_HEAP=1 on a 32 GB PC. It is the existing switch on main, not this branch, so it says nothing about the guard or the sweep fix.

Setup. RTX 5080 16 GB, Ryzen 7 5800X3D, 32 GB RAM, Windows 11 build 26300, driver 621.24. Main 41adb551 with local commits that do not touch shadow.rs or the host's memory code. Series S, DLSS Balanced, no frame generation, release build, shaders preloaded. Not the launcher's defaults: my wrapper adds switches, of which VICTORY_WINDOWS_BAR_MB=2048 matters here (windows in mapped card memory, so the non-local figures below are lower than the defaults would give), and it leaves out the two particle light-atlas programs of #2348. Every run starts from the same copy of one save.

Standing in the first house, three alternated pairs, 90 s measured each:

switch off VICTORY_CARD_CPU_HEAP=1
frames a second 21.8 / 20.8 / 20.4 20.9 / 21.0 / 20.3
draws a frame 5,895 / 7,053 / 7,011 6,458 / 6,907 / 6,906
"copying back" 15.2 / 17.0 / 16.9 ms 16.6 / 16.7 / 16.8 ms
non-local memory, mean (most) 3.7-3.8 GB (4.6-4.8) 1.6-2.0 GB (1.9-2.4)
private_mib, most - 3,046-3,220

A 10-minute scripted run on foot from that save (VICTORY_INPUT_REPLAY), one run each: non-local 5.1 GB on average and 6.0 at most without the switch, 2.1 and 2.5 with it (private_mib up to 3,529). The two runs did not take the same way, 5,645 draws a frame against 7,575, so their frame rates (19.0 and 17.6) and copy-back times (16.2 and 19.4 ms) do not compare; the pairs above do.

What it shows here. About 2 to 3 GB leave the non-local memory, as on the 16 GB PCs, and at equal draws neither the frame rate nor the copy-back time moves (#2415 asked whether the landing pays for the extra pages: not measurably on this PC). What it does not change is commit: the diagnostics build's memory line had 4,950 MB left to commit without the switch and 4,814 MB with it, and free RAM went from 4.6 to 5.7 GB. On this host the non-local budget was never the limit, so "bigger hosts are as before" costs nothing I can measure; the switch on would not have either.

Failures in these runs. No device was lost in any of the eight. Host pipelines did fail with 0x8007000E, with and without the switch: one compute pipeline in each of the six standing runs, and in the 10-minute runs 49 without it (41 mesh, 7 graphics, 1 compute) and 35 with it (34 mesh, 1 compute). That fits commit being what runs short on this PC (a page file of 14.5 GB that Windows manages; the game's panel showed 0.4 to 2.3 GB left to commit in play), which this switch does not change.

Not tested: this branch, a card of 8 GB, frame generation, ray tracing.

**@⁠iridiumLotus** on GitHub · 2026-11-30 08:25 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2657#issuecomment-7272901219) A data point from a host this PR leaves as before: `VICTORY_CARD_CPU_HEAP=1` on a **32 GB** PC. It is the existing switch on main, not this branch, so it says nothing about the guard or the sweep fix. **Setup.** RTX 5080 16 GB, Ryzen 7 5800X3D, 32 GB RAM, Windows 11 build 26300, driver 621.24. Main `41adb551` with local commits that do not touch `shadow.rs` or the host's memory code. Series S, DLSS Balanced, no frame generation, release build, shaders preloaded. Not the launcher's defaults: my wrapper adds switches, of which `VICTORY_WINDOWS_BAR_MB=2048` matters here (windows in mapped card memory, so the non-local figures below are lower than the defaults would give), and it leaves out the two particle light-atlas programs of #2348. Every run starts from the same copy of one save. **Standing in the first house, three alternated pairs, 90 s measured each:** | | switch off | `VICTORY_CARD_CPU_HEAP=1` | |---|---|---| | frames a second | 21.8 / 20.8 / 20.4 | 20.9 / 21.0 / 20.3 | | draws a frame | 5,895 / 7,053 / 7,011 | 6,458 / 6,907 / 6,906 | | "copying back" | 15.2 / 17.0 / 16.9 ms | 16.6 / 16.7 / 16.8 ms | | non-local memory, mean (most) | 3.7-3.8 GB (4.6-4.8) | 1.6-2.0 GB (1.9-2.4) | | `private_mib`, most | - | 3,046-3,220 | **A 10-minute scripted run on foot from that save** (`VICTORY_INPUT_REPLAY`), one run each: non-local 5.1 GB on average and 6.0 at most without the switch, 2.1 and 2.5 with it (`private_mib` up to 3,529). The two runs did not take the same way, 5,645 draws a frame against 7,575, so their frame rates (19.0 and 17.6) and copy-back times (16.2 and 19.4 ms) do not compare; the pairs above do. **What it shows here.** About 2 to 3 GB leave the non-local memory, as on the 16 GB PCs, and at equal draws neither the frame rate nor the copy-back time moves (#2415 asked whether the landing pays for the extra pages: not measurably on this PC). What it does not change is commit: the diagnostics build's memory line had 4,950 MB left to commit without the switch and 4,814 MB with it, and free RAM went from 4.6 to 5.7 GB. On this host the non-local budget was never the limit, so "bigger hosts are as before" costs nothing I can measure; the switch on would not have either. **Failures in these runs.** No device was lost in any of the eight. Host pipelines did fail with `0x8007000E`, with and without the switch: one compute pipeline in each of the six standing runs, and in the 10-minute runs 49 without it (41 mesh, 7 graphics, 1 compute) and 35 with it (34 mesh, 1 compute). That fits commit being what runs short on this PC (a page file of 14.5 GB that Windows manages; the game's panel showed 0.4 to 2.3 GB left to commit in play), which this switch does not change. Not tested: this branch, a card of 8 GB, frame generation, ray tracing.
Author
Owner

@⁠dejvidkou on GitHub · 2026-11-30 09:36 UTC · original

I bisected it on my side: it is #76 (05a269d8, "gpu: size the render targets' room by the peak they have held, not a flat 3 GiB").

How: git bisect --first-parent from 959dcaf (good) to 829188e9 (bad), release builds, unattended runs on my RTX 3060 Laptop 6 GB / 16 GB RAM (Series S profile, DLSS ultra performance, frame generation off, the character standing at the save, 5-10 min each). The measure is the card's memory in use from the the texture queue's room: line (it is in every build of the range) after the first 3-4 minutes. The line between good and bad was 5,190 MB, halfway between the two ends; the budget is 5,226 MB.

commit card memory in use, median verdict
959dcaf (v2026.11.27) 4,634 MB good
d583714d (#45) 4,434 MB good
39c4b995 (#61) 4,840 MB good
2ce7a3c1 (#74) 4,768 MB good
14e5deda (#76) 6,627 MB first bad
2414bfad (#92) 6,370 MB bad
829188e9 5,742 MB bad

Four builds in the range (a9567c18, 24848b85, 8e9f11d6, 5583a872) were skipped: the title crashed about 1.5 minutes in, all at the same address (0xc0000005, a write to 0). That is an old bug, fixed later, and not related to this.

Why #76 does it. Before it, targets_room_kept kept a flat 3,072 MB of the card for render targets. In a Series S world the targets peak at about 400 MB, so in practice about 2.7 GB stayed free. #76 sizes the reserve at 1.5x the targets' peak instead, about 200 MB here. That fixed a real bug, the black faces: textures that were never uploaded while the card was 41 % used. But those 2.7 GB were also the card's only margin for what is made without a room test: a texture a draw, copy or transition uses is made on first use (resource::host_resource), and so are render targets and card copies of title buffers. Now the texture queue fills the card to its line, and those go past the budget.

So I don't think the answer is to undo #76, since the black faces would come back. It needs a real margin under the budget for what is made without a room test. The sweep fix in this PR (VICTORY_CARD_SWEEP_WINS, now on by itself on small hosts) already brings the card back near its budget, which matches your 8 GB run, but it frees memory after the fact rather than keeping the margin.

One thing I can't explain yet: your runs on 829188e9 with VICTORY_CARD_ROOM_FOR_TARGETS_MB=1536 (the flat reserve again, at half the size) still lost the device. If you have a run to spare, one on the current head with VICTORY_CARD_ROOM_FOR_TARGETS_MB=3072 would show whether the flat reserve alone keeps an 8 GB card inside its budget there. I'll try the same on my card.

(Bisected with unattended test runs; summary prepared with help from Claude Code.)

**@⁠dejvidkou** on GitHub · 2026-11-30 09:36 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2657#issuecomment-7274436520) I bisected it on my side: it is **#76** (05a269d8, "gpu: size the render targets' room by the peak they have held, not a flat 3 GiB"). **How:** `git bisect --first-parent` from 959dcaf (good) to 829188e9 (bad), release builds, unattended runs on my RTX 3060 Laptop 6 GB / 16 GB RAM (Series S profile, DLSS ultra performance, frame generation off, the character standing at the save, 5-10 min each). The measure is the card's memory in use from the `the texture queue's room:` line (it is in every build of the range) after the first 3-4 minutes. The line between good and bad was 5,190 MB, halfway between the two ends; the budget is 5,226 MB. | commit | card memory in use, median | verdict | |---|---|---| | 959dcaf (v2026.11.27) | 4,634 MB | good | | d583714d (#45) | 4,434 MB | good | | 39c4b995 (#61) | 4,840 MB | good | | 2ce7a3c1 (#74) | 4,768 MB | good | | **14e5deda (#76)** | **6,627 MB** | **first bad** | | 2414bfad (#92) | 6,370 MB | bad | | 829188e9 | 5,742 MB | bad | Four builds in the range (a9567c18, 24848b85, 8e9f11d6, 5583a872) were skipped: the title crashed about 1.5 minutes in, all at the same address (`0xc0000005`, a write to 0). That is an old bug, fixed later, and not related to this. **Why #76 does it.** Before it, `targets_room_kept` kept a flat 3,072 MB of the card for render targets. In a Series S world the targets peak at about 400 MB, so in practice about 2.7 GB stayed free. #76 sizes the reserve at 1.5x the targets' peak instead, about 200 MB here. That fixed a real bug, the black faces: textures that were never uploaded while the card was 41 % used. But those 2.7 GB were also the card's only margin for what is made **without a room test**: a texture a draw, copy or transition uses is made on first use (`resource::host_resource`), and so are render targets and card copies of title buffers. Now the texture queue fills the card to its line, and those go past the budget. So I don't think the answer is to undo #76, since the black faces would come back. It needs a real margin under the budget for what is made without a room test. The sweep fix in this PR (`VICTORY_CARD_SWEEP_WINS`, now on by itself on small hosts) already brings the card back near its budget, which matches your 8 GB run, but it frees memory after the fact rather than keeping the margin. One thing I can't explain yet: your runs on 829188e9 with `VICTORY_CARD_ROOM_FOR_TARGETS_MB=1536` (the flat reserve again, at half the size) still lost the device. If you have a run to spare, one on the current head with `VICTORY_CARD_ROOM_FOR_TARGETS_MB=3072` would show whether the flat reserve alone keeps an 8 GB card inside its budget there. I'll try the same on my card. (Bisected with unattended test runs; summary prepared with help from Claude Code.)
b574347b did so under 24 GB of RAM only. A 32 GB PC (RTX 5080, a managed
page file of 14.5 GB, reported on PR #2657) had 0.4-2.3 GB left to commit in
play and 35-49 host pipelines refused with 0x8007000E in a 10-minute run:
the same memguard put-offs as on the 16 GB PC. A managed page file grows
only as commit reaches the limit, and memguard keeps 4 GB of commit free,
so it does not grow in play on any host.

So the warning judges a managed page file by the commit limit now on every
host, and the fix it names is a custom size everywhere (initial 52 GB less
the RAM, maximum 12 GB more), not "Automatically manage".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠dejvidkou on GitHub · 2026-11-30 09:47 UTC · original

Thanks, a 32 GB PC was the data point missing here. Good to see the 2-3 GB leave the non-local memory there too, at no cost at equal draws.

Your 0x8007000E pipeline failures are, I think, the same thing I found on the 16 GB laptop. They are not the driver running out: they are memguard putting compiles off (memguard::refusal() gives E_OUTOFMEMORY on purpose) while commit would fall under VICTORY_COMMIT_FLOOR_MB (4,096). A page file that Windows manages grows only as commit reaches the limit, and the guard keeps 4 GB under it, so in play it never grows. On my laptop (managed page file of 8.5 GB) 149 pipelines were put off and none of them was made later in the run. With a custom page file of 36,864-49,152 MB there were none, at the same frame rate. Your 0.4-2.3 GB left to commit and a managed 14.5 GB page file fit that.

The launcher's memory warning used to say nothing for a managed page file ("it grows as needed"). This PR now judges it by its size now on every host (d294b752; b574347b did it under 24 GB only), so your PC would get the warning, with a custom size of 20,480-32,768 MB. If you try a custom page file of about that size, I'd expect the refused pipelines to go to 0.

**@⁠dejvidkou** on GitHub · 2026-11-30 09:47 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2657#issuecomment-7274679172) Thanks, a 32 GB PC was the data point missing here. Good to see the 2-3 GB leave the non-local memory there too, at no cost at equal draws. Your `0x8007000E` pipeline failures are, I think, the same thing I found on the 16 GB laptop. They are not the driver running out: they are `memguard` putting compiles off (`memguard::refusal()` gives `E_OUTOFMEMORY` on purpose) while commit would fall under `VICTORY_COMMIT_FLOOR_MB` (4,096). A page file that Windows manages grows only as commit reaches the limit, and the guard keeps 4 GB under it, so in play it never grows. On my laptop (managed page file of 8.5 GB) 149 pipelines were put off and none of them was made later in the run. With a custom page file of 36,864-49,152 MB there were none, at the same frame rate. Your 0.4-2.3 GB left to commit and a managed 14.5 GB page file fit that. The launcher's memory warning used to say nothing for a managed page file ("it grows as needed"). This PR now judges it by its size now on every host (d294b752; b574347b did it under 24 GB only), so your PC would get the warning, with a custom size of 20,480-32,768 MB. If you try a custom page file of about that size, I'd expect the refused pipelines to go to 0.
github-bot force-pushed github-bot/gh-2657 from d294b7529e to aa4ba51d83 2026-11-30 11:24:26 +00:00 Compare
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/residency.rs
  • crates/victory-gpu/src/resource.rs
  • crates/victory-gpu/src/shadow.rs
  • crates/victory-gpu/src/streamline.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2657'
git switch 'github-bot/gh-2657'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2657'
git switch 'github-bot/gh-2657'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2657'
git switch 'main'
git merge --squash 'github-bot/gh-2657'
git switch 'main'
git merge --ff-only 'github-bot/gh-2657'
git switch 'main'
git merge 'github-bot/gh-2657'
git push origin 'main'
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!2657
No description provided.