Pipelines: draws don't wait for a pipeline the memory guard put off (stalls on low-memory PCs) #4755

Closed
github-bot wants to merge 1 commit from github-bot/gh-4754 into main AGit
Owner

@⁠Trillazill on GitHub · 2026-12-01 05:21 UTC · original
Trillazill:fix/no-wait-for-put-off-pipelines → main · +37 −3 · 1 files · 1 commits · closed without merging

What this changes

When the memory guard puts a pipeline's compile off (Pending::defer: commit under VICTORY_COMMIT_FLOOR_MB), the pipeline pauses for RETRY_AFTER_MS (1 s) and is queued again by the next ask. ready() already skips the wait during the pause. Once the pause is over, though, every draw that asks for it waits again, up to the frame's budget (VICTORY_PIPELINE_WAIT_MS, 500 ms; 10 s for screen passes). On a PC that stays short of commit, the guard puts it off again, so frame after frame waited out its budget for a pipeline that wasn't going to be made. The draw was dropped after the wait anyway.

Now Pending::put_off_before() (the compile was put off at least once and isn't made yet) makes ready() skip the wait, just as during the pause. The pipeline is still queued again after each pause, and a worker makes it once the guard lets it. Only the frame-blocking wait goes. VICTORY_PUT_OFF_WAIT=1 brings the wait back. It is an asked_for! switch, so VICTORY_AB can flip it.

This sits beside #3347, which turns the guard off by default. If the guard stays on, frames no longer stall on what it puts off.

Measured (RTX 4080 16 GB, 32 GB RAM, Series X, diagnostics build of 41adb551, the prison cell, input from VICTORY_KEYS_FILE)

  • Without the change, as it happens on its own (run 3, about 6 minutes in the cell):
    • The guard put compiles off 2,048 times, with free_commit_mb at 0.4–2.4 GB against its 4 GB floor.
    • For several minutes the recording threads reported 80–501 ms a frame "waiting for pipelines". The frame line read 1.8–15 fps, with the card idle (0.0–7 ms on the GPU) and preparing at ~26 ms.
    • About 11 draws a frame were dropped as "being made", while the queue reported 0 being made.
  • A/B within one run (run 5, VICTORY_AB=20,VICTORY_PUT_OFF_WAIT, with VICTORY_COMMIT_FLOOR_MB=60000 so that the guard puts every new compile off, as it did above), 9 phases each:
readings waiting for pipelines, mean a frame worst
this change 34 1.3 ms 22.0 ms
VICTORY_PUT_OFF_WAIT=1 (as before) 36 4.4 ms 44.2 ms

Both non-zero readings under this change (21.8 and 22.0 ms) are the first reading after a switch from an old phase. Frame times in that run: mean 42.5 vs 45.5 ms, p90 54 vs 56 ms. The cell needs few new pipelines, so the difference is small there. In run 3's stretch it was the whole frame.

Tests

  • pipeline::make::tests::a_pipeline_whose_compile_was_put_off_for_memory_is_made_later now also checks that after the pause a draw doesn't spend its budget on the pipeline, and that it is queued again for a worker.
  • cargo test -p victory-gpu --lib -- pipeline::make::: 30 pass.
  • cargo test -p victory-gpu --no-fail-fast: 919 pass, 3 fail:
    • shader_cache::tests::every_switch_of_the_translator_is_in_the_key and host::menu::tests::a_change_is_saved_at_once_however_the_game_was_started fail the same way on 41adb551;
    • host::card_steps::tests::places_written_after_sending_are_learned passes alone.
  • Clippy (-p victory-gpu --lib --tests, with diagnostics): nothing in the lines this change adds or touches (make.rs:1337 is flagged on main too).
  • cargo xtask policy --staged: ok (1 file).

No game data, logs or other files from the title are in this change.

🤖 Generated with Claude Code

**@⁠Trillazill** on GitHub · 2026-12-01 05:21 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4754) `Trillazill:fix/no-wait-for-put-off-pipelines` → `main` · +37 −3 · 1 files · 1 commits · closed without merging ## What this changes When the memory guard puts a pipeline's compile off (`Pending::defer`: commit under `VICTORY_COMMIT_FLOOR_MB`), the pipeline pauses for `RETRY_AFTER_MS` (1 s) and is queued again by the next ask. `ready()` already skips the wait during the pause. Once the pause is over, though, every draw that asks for it waits again, up to the frame's budget (`VICTORY_PIPELINE_WAIT_MS`, 500 ms; 10 s for screen passes). On a PC that stays short of commit, the guard puts it off again, so frame after frame waited out its budget for a pipeline that wasn't going to be made. The draw was dropped after the wait anyway. Now `Pending::put_off_before()` (the compile was put off at least once and isn't made yet) makes `ready()` skip the wait, just as during the pause. The pipeline is still queued again after each pause, and a worker makes it once the guard lets it. Only the frame-blocking wait goes. `VICTORY_PUT_OFF_WAIT=1` brings the wait back. It is an `asked_for!` switch, so `VICTORY_AB` can flip it. This sits beside #3347, which turns the guard off by default. If the guard stays on, frames no longer stall on what it puts off. ## Measured (RTX 4080 16 GB, 32 GB RAM, Series X, diagnostics build of 41adb551, the prison cell, input from `VICTORY_KEYS_FILE`) - **Without the change, as it happens on its own** (run 3, about 6 minutes in the cell): - The guard put compiles off 2,048 times, with `free_commit_mb` at 0.4–2.4 GB against its 4 GB floor. - For several minutes the recording threads reported **80–501 ms a frame "waiting for pipelines"**. The frame line read 1.8–15 fps, with the card idle (0.0–7 ms on the GPU) and preparing at ~26 ms. - About 11 draws a frame were dropped as "being made", while the queue reported 0 being made. - **A/B within one run** (run 5, `VICTORY_AB=20,VICTORY_PUT_OFF_WAIT`, with `VICTORY_COMMIT_FLOOR_MB=60000` so that the guard puts every new compile off, as it did above), 9 phases each: | | readings | waiting for pipelines, mean a frame | worst | |---|---|---|---| | this change | 34 | 1.3 ms | 22.0 ms | | `VICTORY_PUT_OFF_WAIT=1` (as before) | 36 | 4.4 ms | 44.2 ms | Both non-zero readings under this change (21.8 and 22.0 ms) are the first reading after a switch from an old phase. Frame times in that run: mean 42.5 vs 45.5 ms, p90 54 vs 56 ms. The cell needs few new pipelines, so the difference is small there. In run 3's stretch it was the whole frame. ## Tests - `pipeline::make::tests::a_pipeline_whose_compile_was_put_off_for_memory_is_made_later` now also checks that after the pause a draw doesn't spend its budget on the pipeline, and that it is queued again for a worker. - `cargo test -p victory-gpu --lib -- pipeline::make::`: 30 pass. - `cargo test -p victory-gpu --no-fail-fast`: 919 pass, 3 fail: - `shader_cache::tests::every_switch_of_the_translator_is_in_the_key` and `host::menu::tests::a_change_is_saved_at_once_however_the_game_was_started` fail the same way on 41adb551; - `host::card_steps::tests::places_written_after_sending_are_learned` passes alone. - Clippy (`-p victory-gpu --lib --tests`, with diagnostics): nothing in the lines this change adds or touches (`make.rs:1337` is flagged on main too). - `cargo xtask policy --staged`: ok (1 file). No game data, logs or other files from the title are in this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
After the guard's pause a pipeline whose compile it put off was waited for
again by every draw that asked for it, up to the frame's budget, while the
guard, the PC still short of commit, put it off again. In a run on an RTX
4080 with 32 GB the guard put compiles off 2,048 times and the recording
threads waited 80 to 500 ms a frame for pipelines, at 1.8 to 15 fps with
the card idle; the draws were dropped after the wait anyway.

Pending::put_off_before() makes ready() skip that wait as it does during
the pause; the pipeline is still queued again and made by a worker once the
guard lets it. VICTORY_PUT_OFF_WAIT=1: waited for as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 05:22:59 +00:00
Author
Owner

@⁠Trillazill on GitHub · 2026-12-01 06:20 UTC · original

Closing: on main 5fabb46e this no longer happens. With #2392 (pagefile growth counts as commit left), the memory guard put off 0 compiles in a 6-minute run on the same PC and route, where it had put off 2,048 at 41adb551. wait_for_pipeline also stops waiting as soon as a build is put off now. Frames waited 0.8 ms a frame for pipelines on average (worst 72 ms), where at 41adb551 it was 80–500 ms.

**@⁠Trillazill** on GitHub · 2026-12-01 06:20 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4754#issuecomment-7302762952) Closing: on main 5fabb46e this no longer happens. With #2392 (pagefile growth counts as commit left), the memory guard put off 0 compiles in a 6-minute run on the same PC and route, where it had put off 2,048 at 41adb551. `wait_for_pipeline` also stops waiting as soon as a build is put off now. Frames waited 0.8 ms a frame for pipelines on average (worst 72 ms), where at 41adb551 it was 80–500 ms.
github-bot closed this pull request 2026-12-01 06:26:08 +00:00

Pull request closed

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!4755
No description provided.