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

Open
HailLucifer666 wants to merge 2 commits from upstream-pr/2717 into main
HailLucifer666 commented 2026-11-29 16:32:56 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by HailLucifer666 on 2026-11-29T16:32:56Z.


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).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5552750650 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2717). Originally posted by [HailLucifer666](https://github.com/HailLucifer666) on 2026-11-29T16:32:56Z. --- 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).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2717:upstream-pr/2717'
git switch 'upstream-pr/2717'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2717'
git switch 'upstream-pr/2717'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2717'
git switch 'upstream-pr/2717'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2717'
git switch 'main'
git merge --squash 'upstream-pr/2717'
git switch 'main'
git merge --ff-only 'upstream-pr/2717'
git switch 'main'
git merge 'upstream-pr/2717'
git push origin 'main'
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!2717
No description provided.