gpu: 3-tier memguard commit admission, pagefile-growth headroom, and non-blocking reclaim (#2319, #2308) #2717

Open
github-bot wants to merge 2 commits from github-bot/gh-2717 into main AGit
Owner

@⁠HailLucifer666 on GitHub · 2026-11-29 16:32 UTC · original
HailLucifer666:fix/memguard-commit-tiers → main · +396 −62 · 4 files · 2 commits · open

Partially addresses #2319 and #2308 (fixes the memguard binary-cliff livelock; does not claim to fix the separate +9 GB commit growth or warm submit-thread regression in #2319).

What it changes

On 16–24 GB hosts under v2026.11.29.01, memguard::decide() treated VICTORY_COMMIT_FLOOR_MB (4096 MiB) as a binary hard refuse (Verdict::Commit) and memguard::figures_now() read raw ullAvailPageFile instead of residency::available_commit() (#339). When free commit sat around ~2.1 GiB (#2319), every compile was refused indefinitely (0.1–0.2 FPS) even with 0 compiles running, severing Windows' managed-pagefile growth feedback loop.

Built directly on existing memguard.rs + compilemem.rs (Mutex<State> + Condvar + Estimator):

  • 3-tier commit admission: parallel Allow (>= 4096 MiB soft floor), 1-at-a-time Throttle ([1024 MiB critical, 4096 MiB soft)), and hard Commit refuse (< 1024 MiB critical floor) to prevent unrecoverable ptxas OOM.
  • Managed-pagefile growth headroom: memguard::figures_now() now uses residency::available_commit(&m) (still honoring VICTORY_COMMIT_GROWTH=0).
  • Two-key critical-floor disable & kill switch: VICTORY_COMMIT_FLOOR_MB=0 disables only the soft floor; disabling the critical floor requires setting both VICTORY_COMMIT_FLOOR_MB=0 and VICTORY_COMMIT_CRITICAL_MB=0 (with tracing::warn!). VICTORY_MEMGUARD_TIERS=0 restores legacy binary 4096 MiB behavior. Invalid values log tracing::warn!.
  • Non-blocking async reclaim: solo critical refusals set a rate-limited (1/s) RECLAIM_REQUESTED atomic consumed by host::sweep() on the sweep owner thread (zero lock-order inversion).

How it was tested

  • Not verified here: Live title gameplay / RTX 3060 24 GB rig run (no game dump in this environment).
  • Red-first [Confirmed]: memguard::tests::issue_2319_soft_commit_band_throttles_instead_of_hard_refusing failed on untouched 829188e9 (left: Commit, right: Throttle).
  • cargo test -p victory-gpu --lib memguard:: -- --test-threads=1 → 10 passed, 0 failed.
  • cargo test -p victory-gpu --lib compilemem:: → 13 passed, 0 failed (includes 4-thread soft-band 1-at-a-time serialization, Permit::drop panic-unwind, and bounded solo refusal).
  • cargo clippy -p victory-gpu --lib --tests → exit 0, 0 warnings in touched files. (Note: --all-features / diagnostics has pre-existing upstream compile errors on 829188e9 at copystat.rs:1349 and host.rs:9127, untouched.)
  • Mutation probes (2026-11-29): (a) soft band → Commit, (b) removing solo-progress upgrade in compilemem, (c) removing Permit::drop finish() all verified red (exit 101) before restore.
  • cargo test passed for the crates it touches: yes

Checked for overlap

  • Searched open PRs on trustno1-coder/VIctory-NVIDIA at 829188e9 for memguard / compilemem / #2319 / #2308. Related: #2334 (touches memguard.rs, different scope).
**@⁠HailLucifer666** on GitHub · 2026-11-29 16:32 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2717) `HailLucifer666:fix/memguard-commit-tiers` → `main` · +396 −62 · 4 files · 2 commits · open Partially addresses #2319 and #2308 (fixes the `memguard` binary-cliff livelock; does not claim to fix the separate `+9 GB` commit growth or warm submit-thread regression in #2319). ## What it changes On 16–24 GB hosts under `v2026.11.29.01`, `memguard::decide()` treated `VICTORY_COMMIT_FLOOR_MB` (4096 MiB) as a binary hard refuse (`Verdict::Commit`) and `memguard::figures_now()` read raw `ullAvailPageFile` instead of `residency::available_commit()` (#339). When free commit sat around ~2.1 GiB (`#2319`), every compile was refused indefinitely (0.1–0.2 FPS) even with 0 compiles running, severing Windows' managed-pagefile growth feedback loop. Built directly on existing `memguard.rs` + `compilemem.rs` (`Mutex<State>` + `Condvar` + `Estimator`): - **3-tier commit admission:** parallel `Allow` (`>= 4096 MiB` soft floor), 1-at-a-time `Throttle` (`[1024 MiB critical, 4096 MiB soft)`), and hard `Commit` refuse (`< 1024 MiB` critical floor) to prevent unrecoverable `ptxas` OOM. - **Managed-pagefile growth headroom:** `memguard::figures_now()` now uses `residency::available_commit(&m)` (still honoring `VICTORY_COMMIT_GROWTH=0`). - **Two-key critical-floor disable & kill switch:** `VICTORY_COMMIT_FLOOR_MB=0` disables only the soft floor; disabling the critical floor requires setting both `VICTORY_COMMIT_FLOOR_MB=0` and `VICTORY_COMMIT_CRITICAL_MB=0` (with `tracing::warn!`). `VICTORY_MEMGUARD_TIERS=0` restores legacy binary 4096 MiB behavior. Invalid values log `tracing::warn!`. - **Non-blocking async reclaim:** solo critical refusals set a rate-limited (1/s) `RECLAIM_REQUESTED` atomic consumed by `host::sweep()` on the sweep owner thread (zero lock-order inversion). ## How it was tested - **Not verified here:** Live title gameplay / RTX 3060 24 GB rig run (no game dump in this environment). - **Red-first `[Confirmed]`:** `memguard::tests::issue_2319_soft_commit_band_throttles_instead_of_hard_refusing` failed on untouched `829188e9` (`left: Commit, right: Throttle`). - `cargo test -p victory-gpu --lib memguard:: -- --test-threads=1` → **10 passed, 0 failed**. - `cargo test -p victory-gpu --lib compilemem::` → **13 passed, 0 failed** (includes 4-thread soft-band 1-at-a-time serialization, `Permit::drop` panic-unwind, and bounded solo refusal). - `cargo clippy -p victory-gpu --lib --tests` → exit 0, **0 warnings** in touched files. *(Note: `--all-features` / `diagnostics` has pre-existing upstream compile errors on `829188e9` at `copystat.rs:1349` and `host.rs:9127`, untouched.)* - **Mutation probes (2026-11-29):** (a) soft band → `Commit`, (b) removing solo-progress upgrade in `compilemem`, (c) removing `Permit::drop` `finish()` all verified red (`exit 101`) before restore. - `cargo test` passed for the crates it touches: **yes** ## Checked for overlap - [x] Searched open PRs on `trustno1-coder/VIctory-NVIDIA` at `829188e9` for `memguard` / `compilemem` / `#2319` / `#2308`. Related: #2334 (touches `memguard.rs`, different scope).
On 16-24 GB hosts under v2026.11.29.01, memguard::decide() treated the
4096 MiB VICTORY_COMMIT_FLOOR_MB as a binary hard refuse (Verdict::Commit),
stalling all shader compiles indefinitely at 0.1-0.2 FPS even with zero
compiles active when free commit sat around ~2.1 GiB (#2319, #2308).

Build directly on existing memguard.rs + compilemem.rs:
- Add a 3-tier commit admission policy: parallel Allow (>= 4096 MiB soft
  floor), 1-at-a-time Throttle ([1024 MiB critical, 4096 MiB soft)), and
  hard Commit refuse (< 1024 MiB critical floor) to prevent ptxas OOM.
- Preserve VICTORY_COMMIT_FLOOR_MB=0 disabling both commit floors, clamp
  VICTORY_COMMIT_CRITICAL_MB <= soft floor, reject non-numeric values
  loudly with tracing::warn!, and add VICTORY_MEMGUARD_TIERS=0 kill switch.
- Post a rate-limited (1/s) non-blocking RECLAIM_REQUESTED atomic signal on
  solo critical refusals, consumed by host::sweep() on the sweep owner
  thread (zero lock-order inversion).

Verified:
- Red-first: issue_2319 test failed on 829188e9 (Commit vs Throttle).
- cargo test -p victory-gpu --lib memguard:: -> 10 passed, 0 failed.
- cargo test -p victory-gpu --lib compilemem:: -> 13 passed, 0 failed.
- cargo clippy -p victory-gpu --lib --tests -> exit 0, 0 warnings in touched files.
- Mutation probes (a) soft band -> Commit, (b) remove solo-progress upgrade,
  and (c) remove Permit::drop finish() all verified red (exit 101) before restore.
Two surgical follow-ups verified against live 829188e9:
1. memguard::figures_now() previously read raw ullAvailPageFile and bypassed
   residency::available_commit() (#339), severing Windows' managed-pagefile
   growth feedback loop on 16-24 GB hosts (#2319). Export and use
   residency::available_commit() so managed-pagefile growth headroom is
   counted (still honoring VICTORY_COMMIT_GROWTH=0).
2. Under 3-tier admission, VICTORY_COMMIT_FLOOR_MB=0 now disables only the
   soft throttle floor; disabling the critical hard floor requires a two-key
   override (VICTORY_COMMIT_FLOOR_MB=0 AND VICTORY_COMMIT_CRITICAL_MB=0, with
   a loud tracing::warn!). VICTORY_MEMGUARD_TIERS=0 still restores legacy
   binary behavior.

Verified:
- cargo test -p victory-gpu --lib memguard:: -> 10 passed, 0 failed.
- cargo test -p victory-gpu --lib compilemem:: -> 13 passed, 0 failed.
- cargo clippy -p victory-gpu --lib --tests -> exit 0, 0 warnings in touched files.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 16:37:51 +00:00
github-bot force-pushed github-bot/gh-2717 from b43b8771a2 to f50927f486 2026-11-29 18:34:45 +00:00 Compare
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/host.rs
  • crates/victory-gpu/src/memguard.rs
  • crates/victory-gpu/src/residency.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/2717/head:github-bot/gh-2717'
git switch 'github-bot/gh-2717'

Merge

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