Memory guard: a pipeline put off again and again is made on a lower commit floor #2886

Open
gabrielecabrini wants to merge 11 commits from upstream-pr/2886 into main
gabrielecabrini commented 2026-11-29 18:33:47 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by gabrielecabrini on 2026-11-29T18:33:47Z.


What

The memory guard puts off a driver compile while it would leave commit under 4096 MB (VICTORY_COMMIT_FLOOR_MB), and the pipeline is tried again a second later. When free commit stays under that floor for minutes, every new pipeline is put off for good: its draws are dropped at every frame, with no end.

Evidence

Linux run, Proton Experimental, i5-14600KF, 31 GB RAM + 8 GB swap, RTX 4070 SUPER, Series S, 2026-11-29:

  • Free commit sat at 3.2 to 3.4 GB for minutes.
  • Entering the title's highlight view (both sticks) asked for shaders not seen before:
    • every one of them was put off at each retry;
    • a pass over the screen waited 10 s a frame for one;
    • 60 draws a frame were dropped;
    • the picture broke into blocks and the title ended.
  • Reproduced twice at the same place.

Fix

  • pipeline/make.rs: Pending counts how many times its compile was put off (put_off). From the third put-off on, its build runs inside memguard::starved_compile. That is about three seconds of draws still asking for it.
  • memguard.rs:
    • floors_now() gives this thread's floors: the run's floors, with the commit floor lowered for a starved build to VICTORY_STARVED_COMMIT_FLOOR_MB (default 1024).
    • The lower floor is never above the ordinary one, and a check turned off (0) stays off.
    • The flag is a thread-local put back on drop, so a build that panics under catch_unwind leaves the worker on the ordinary floor.
  • compilemem::begin takes floors_now() instead of floors().
  • Under the lower floor a starved compile is still put off, as before. The soft physical floor still lets compiles start one at a time.
  • A pipeline made this way is said once in the log.
  • Ordinary compiles keep the 4096 MB floor.

Tests

  • New memguard::a_starved_compile_has_the_lower_commit_floor:
    • checks the floor is lowered, never raised, and not where the check is off;
    • uses the run's figures (3.3 GB of commit left): refused ordinarily, not refused when starved.
  • New pipeline::make::a_pipeline_put_off_again_and_again_is_made_on_the_starved_floor: the lower floor holds for the starved build only.
  • New memguard::a_starved_build_that_panics_gives_the_floor_back.
  • Under Proton (cross-built with cargo xwin):
    • memguard:: 8 pass;
    • pipeline::make:: 30 pass;
    • a_waiting_draw_raises_the_worker_making_its_pipeline fails with and without this change, on main too.
  • clippy -p victory-gpu --all-targets reports nothing in the changed files.
  • Not yet confirmed in a play session at the highlight view.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5553798524 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2886). Originally posted by [gabrielecabrini](https://github.com/gabrielecabrini) on 2026-11-29T18:33:47Z. --- ## What The memory guard puts off a driver compile while it would leave commit under 4096 MB (`VICTORY_COMMIT_FLOOR_MB`), and the pipeline is tried again a second later. When free commit stays under that floor for minutes, every new pipeline is put off for good: its draws are dropped at every frame, with no end. ## Evidence Linux run, Proton Experimental, i5-14600KF, 31 GB RAM + 8 GB swap, RTX 4070 SUPER, Series S, 2026-11-29: - Free commit sat at 3.2 to 3.4 GB for minutes. - Entering the title's highlight view (both sticks) asked for shaders not seen before: - every one of them was put off at each retry; - a pass over the screen waited 10 s a frame for one; - 60 draws a frame were dropped; - the picture broke into blocks and the title ended. - Reproduced twice at the same place. ## Fix - `pipeline/make.rs`: `Pending` counts how many times its compile was put off (`put_off`). From the third put-off on, its build runs inside `memguard::starved_compile`. That is about three seconds of draws still asking for it. - `memguard.rs`: - `floors_now()` gives this thread's floors: the run's floors, with the commit floor lowered for a starved build to `VICTORY_STARVED_COMMIT_FLOOR_MB` (default 1024). - The lower floor is never above the ordinary one, and a check turned off (0) stays off. - The flag is a thread-local put back on drop, so a build that panics under `catch_unwind` leaves the worker on the ordinary floor. - `compilemem::begin` takes `floors_now()` instead of `floors()`. - Under the lower floor a starved compile is still put off, as before. The soft physical floor still lets compiles start one at a time. - A pipeline made this way is said once in the log. - Ordinary compiles keep the 4096 MB floor. ## Tests - New `memguard::a_starved_compile_has_the_lower_commit_floor`: - checks the floor is lowered, never raised, and not where the check is off; - uses the run's figures (3.3 GB of commit left): refused ordinarily, not refused when starved. - New `pipeline::make::a_pipeline_put_off_again_and_again_is_made_on_the_starved_floor`: the lower floor holds for the starved build only. - New `memguard::a_starved_build_that_panics_gives_the_floor_back`. - Under Proton (cross-built with `cargo xwin`): - `memguard::` 8 pass; - `pipeline::make::` 30 pass; - `a_waiting_draw_raises_the_worker_making_its_pipeline` fails with and without this change, on `main` too. - `clippy -p victory-gpu --all-targets` reports nothing in the changed files. - Not yet confirmed in a play session at the highlight view.
Lyrnc commented 2026-11-29 23:20:14 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-29T23:20:14Z.


Tested on an RTX 5080 + 9800X3D with 32 GB RAM and a system-managed page file. Series S, DLSS Quality, FG and RT off, standing still in the world, 300 s per run, all on 829188e9. Cold means the driver pipeline cache was deleted first. The columns are fps, compiles put off, and pipelines failed with 0x8007000E.

Build Cold Warm
829188e9 0.1–0.2 / 1,337 / 1,272 (never leaves loading) 23.5
this PR alone 0.4 / 172 / 70 25.9, but 636 put off and 276 refused, so draws are dropped
#2392 alone 0.2 / 332 / 138 23.0
this PR + #2392 (merge cleanly) 22.4 / 0 / 0 25.4 / 0 / 0

On this PC, free commit sits at 0.3–2 GB in the world, and #2392 is what lifts it over the commit floor. Even with #2392, free physical memory stays under the 1 GB soft floor. The lower floor here for pipelines put off again and again is what gets those through. Together they fix the cold-start stall; alone, neither does. The default-off alternative and its numbers are in #3347.

AI use: Claude Code (Claude Opus 5.5) ran these runs and wrote this comment.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7264382623 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2886#issuecomment-7264382623). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-11-29T23:20:14Z. --- Tested on an RTX 5080 + 9800X3D with 32 GB RAM and a system-managed page file. Series S, DLSS Quality, FG and RT off, standing still in the world, 300 s per run, all on 829188e9. Cold means the driver pipeline cache was deleted first. The columns are fps, compiles put off, and pipelines failed with `0x8007000E`. | Build | Cold | Warm | |---|---|---| | 829188e9 | 0.1–0.2 / 1,337 / 1,272 (never leaves loading) | 23.5 | | this PR alone | 0.4 / 172 / 70 | 25.9, but 636 put off and 276 refused, so draws are dropped | | #2392 alone | 0.2 / 332 / 138 | 23.0 | | **this PR + #2392** (merge cleanly) | **22.4 / 0 / 0** | **25.4 / 0 / 0** | On this PC, free commit sits at 0.3–2 GB in the world, and #2392 is what lifts it over the commit floor. Even with #2392, free physical memory stays under the 1 GB soft floor. The lower floor here for pipelines put off again and again is what gets those through. Together they fix the cold-start stall; alone, neither does. The default-off alternative and its numbers are in #3347. AI use: Claude Code (Claude Opus 5.5) ran these runs and wrote this comment.
Lyrnc commented 2026-11-29 23:26:15 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-29T23:26:15Z.


A note on the method above: the builds shared one cargo target dir, and that turned out to leave out a branch's victory-shader changes when the checkout's files were older than the last build. Every change that matters here (memguard.rs, compilemem.rs) is in victory-gpu and was compiled into these builds, so the guard numbers stand. #2886's own victory-shader commits were not in its build. They don't affect the compile admission.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7264459450 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2886#issuecomment-7264459450). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-11-29T23:26:15Z. --- A note on the method above: the builds shared one cargo target dir, and that turned out to leave out a branch's victory-shader changes when the checkout's files were older than the last build. Every change that matters here (`memguard.rs`, `compilemem.rs`) is in victory-gpu and was compiled into these builds, so the guard numbers stand. #2886's own victory-shader commits were not in its build. They don't affect the compile admission.
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/2886:upstream-pr/2886'
git switch 'upstream-pr/2886'

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