Pipelines: driver compiles are admitted by memory, and put off rather than refused #1625

Merged
mizzied merged 1 commit from upstream-pr/1625 into main 2026-11-29 08:16:55 +00:00
mizzied commented 2026-11-28 22:34:16 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mizzied on 2026-11-28T22:34:16Z.


What was wrong. A dozen driver pipeline compiles could run at once. Each can take hundreds of MB of commit, so on a PC with little commit left they exhausted memory and the process was killed. A compile the driver refused for memory was also recorded as refused for the whole run.

The fix.

  • A compile starts only while commit headroom allows it (VICTORY_COMMIT_FLOOR_MB).
  • Under low free physical memory (VICTORY_MEMORY_FLOOR_MB), compiles go one at a time.
  • A compile that would cross the floor is put off and retried a second later, not refused. Its draws are dropped until then.
  • This is merged with main's compute-pipeline wait: a dispatch doesn't wait on a put-off compile during the pause, so it's dropped like a draw until the retry.
  • VICTORY_COMPILE_MEMORY=0 turns it all off.

Overlap: open PR #1173 (throttle pipeline workers under commit pressure) aims at the same problem. This one admits each compile by measured memory and retries put-off compiles, rather than capping worker count. Happy to fold it into #1173 or close it, whichever you prefer.

How it was tested. RTX 5070, Windows 11. Tests cover admission at and around the floors, one-at-a-time under low memory, the put-off and retry, and recording a compile that panicked. cargo test --workspace passes apart from repository_passes_policy, which already fails on main: lower.rs is over the 640 KiB file-size limit there (#1493 raises it). Clippy reports only the 16 findings already on main, none on lines this PR changes. The victory-gpu watch:: tests are flaky on this machine in files this PR does not touch, and pass on a rerun.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5545236145 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1625). Originally posted by [mizzied](https://github.com/mizzied) on 2026-11-28T22:34:16Z. --- **What was wrong.** A dozen driver pipeline compiles could run at once. Each can take hundreds of MB of commit, so on a PC with little commit left they exhausted memory and the process was killed. A compile the driver refused for memory was also recorded as refused for the whole run. **The fix.** - A compile starts only while commit headroom allows it (`VICTORY_COMMIT_FLOOR_MB`). - Under low free physical memory (`VICTORY_MEMORY_FLOOR_MB`), compiles go one at a time. - A compile that would cross the floor is put off and retried a second later, not refused. Its draws are dropped until then. - This is merged with `main`'s compute-pipeline wait: a dispatch doesn't wait on a put-off compile during the pause, so it's dropped like a draw until the retry. - `VICTORY_COMPILE_MEMORY=0` turns it all off. **Overlap:** open PR #1173 (throttle pipeline workers under commit pressure) aims at the same problem. This one admits each compile by measured memory and retries put-off compiles, rather than capping worker count. Happy to fold it into #1173 or close it, whichever you prefer. **How it was tested.** RTX 5070, Windows 11. Tests cover admission at and around the floors, one-at-a-time under low memory, the put-off and retry, and recording a compile that panicked. `cargo test --workspace` passes apart from `repository_passes_policy`, which already fails on `main`: `lower.rs` is over the 640 KiB file-size limit there (#1493 raises it). Clippy reports only the 16 findings already on `main`, none on lines this PR changes. The `victory-gpu` `watch::` tests are flaky on this machine in files this PR does not touch, and pass on a rerun.
nick0451 commented 2026-11-29 10:05:47 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nick0451 on 2026-11-29T10:05:47Z.


Regression report: on a PC with little commit headroom at the moment, a fresh start of current main never reaches the world, and the admission added here is the cause.

Setup: RTX 3090 24 GB, i9-14900K, 32 GB RAM, Windows 11, a system-managed pagefile. Other programs left open held most of the commit: about 15 GB of a 73 GB commit limit free with the game not running. Series S, the same frozen save for every start, a new executable name and hash each time.

build fresh starts reach the world hr=0x8007000e host pipeline failures
main 568c5e5 yes (54 s) 0
main 829188e9 (default) no: stuck at the title for 5 min 3,070
main 829188e9, VICTORY_COMPILE_MEMORY=0 2 of 2 (76-78 s) 0
main 829188e9 + the change below 2 of 2 (58-64 s) 25-32 (early, then recovers)

Bisect: 4e109ff5 good, cb696070 bad. The waves in between don't build separately, so I confirmed it with the switch above.

What happens: about 3 s in, memory guard: a compile is put off … free_commit_mb=3991 reason="the commit l…. From then on every driver compile is put off and made again a second later, for good. The layer's private memory climbs from 4 to 18.6 GB while it stays at the title (compile memory: / process memory: lines).

Why: memguard::figures_now() takes free_commit from ullAvailPageFile, the limit of the moment. Everything else in the layer counts what is left to commit with residency::available_commit(), which adds what a system-managed pagefile can still grow by (VICTORY_COMMIT_GROWTH; its comment describes the same false pressure seen earlier on a 5070 Ti). The commit floor of 4096 MB is reached at once when other programs hold the commit, though Windows would grow the pagefile.

Change (2 lines, tested here, not opened as a PR yet; I can open it if wanted):

// memguard.rs, figures_now()
free_commit: crate::residency::available_commit(&m),   // was m.ullAvailPageFile
// residency.rs: `fn available_commit` → `pub(crate) fn available_commit`

With it, the admission stays on and still puts off a few compiles early (6-7 per start here), but the start goes through. The 23 memguard/compilemem/residency tests pass.

Until a fix is in: VICTORY_COMPILE_MEMORY=0 gets such a PC into the game.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7254204353 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1625#issuecomment-7254204353). Originally posted by [nick0451](https://github.com/nick0451) on 2026-11-29T10:05:47Z. --- **Regression report:** on a PC with little commit headroom at the moment, a fresh start of current main never reaches the world, and the admission added here is the cause. **Setup:** RTX 3090 24 GB, i9-14900K, 32 GB RAM, Windows 11, a system-managed pagefile. Other programs left open held most of the commit: about **15 GB of a 73 GB commit limit free with the game not running**. Series S, the same frozen save for every start, a new executable name and hash each time. | build | fresh starts reach the world | `hr=0x8007000e` host pipeline failures | |---|---|---| | main `568c5e5` | yes (54 s) | 0 | | main `829188e9` (default) | **no**: stuck at the title for 5 min | **3,070** | | main `829188e9`, `VICTORY_COMPILE_MEMORY=0` | 2 of 2 (76-78 s) | 0 | | main `829188e9` + the change below | 2 of 2 (58-64 s) | 25-32 (early, then recovers) | Bisect: `4e109ff5` good, `cb696070` bad. The waves in between don't build separately, so I confirmed it with the switch above. **What happens:** about 3 s in, `memory guard: a compile is put off … free_commit_mb=3991 reason="the commit l…`. From then on every driver compile is put off and made again a second later, for good. The layer's private memory climbs from 4 to 18.6 GB while it stays at the title (`compile memory:` / `process memory:` lines). **Why:** `memguard::figures_now()` takes `free_commit` from `ullAvailPageFile`, the **limit of the moment**. Everything else in the layer counts what is left to commit with `residency::available_commit()`, which adds what a system-managed pagefile can still grow by (`VICTORY_COMMIT_GROWTH`; its comment describes the same false pressure seen earlier on a 5070 Ti). The commit floor of 4096 MB is reached at once when other programs hold the commit, though Windows would grow the pagefile. **Change** (2 lines, tested here, not opened as a PR yet; I can open it if wanted): ```rust // memguard.rs, figures_now() free_commit: crate::residency::available_commit(&m), // was m.ullAvailPageFile // residency.rs: `fn available_commit` → `pub(crate) fn available_commit` ``` With it, the admission stays on and still puts off a few compiles early (6-7 per start here), but the start goes through. The 23 memguard/compilemem/residency tests pass. Until a fix is in: `VICTORY_COMPILE_MEMORY=0` gets such a PC into the game. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
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.

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