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

Closed
Trillazill wants to merge 1 commit from upstream-pr/4754 into main
Trillazill commented 2026-12-01 05:21:46 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Trillazill on 2026-12-01T05:21:46Z.


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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5579606862 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4754). Originally posted by [Trillazill](https://github.com/Trillazill) on 2026-12-01T05:21:46Z. --- ## 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)
Trillazill commented 2026-12-01 06:20:34 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Trillazill on 2026-12-01T06:20:34Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7302762952 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4754#issuecomment-7302762952). Originally posted by [Trillazill](https://github.com/Trillazill) on 2026-12-01T06:20:34Z. --- 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.

Pull request closed

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