Host pipelines: a draw's wait ends when the memory guard puts the compile off (500 ms held every second at the commit limit) #3398

Closed
Revono wants to merge 1 commit from upstream-pr/3398 into main
Revono commented 2026-11-29 22:47:43 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Revono on 2026-11-29T22:47:43Z.


No issue filed for this; found while tracing a half-second hitch on a PC at its commit limit.

What it changes

A pipeline whose compile the memory guard puts off is paused for a second and not waited for meanwhile. When the pause ran out, the next draw queued it again and waited for it. A worker took it, was refused within the millisecond and put it off again, which wakes the waiters, but wait only looked at whether the pipeline was made. So the draw stood there for the rest of its 500 ms budget, once a second, for as long as memory stayed short.

  • pipeline/make.rs wait: the loop also ends when the compile was put off (Pending::retry_waits). defer already sets the pause before the waiters are woken, so nothing is missed.
  • New test a_wait_ends_when_the_compile_is_put_off_for_memory: a worker thread refuses the compile 30 ms into a wait. It waits 508 ms without the change and returns with the refusal with it.
  • a_pipeline_made_ready_is_the_one_the_title_gets takes a key of its own. It shared the process's list of used keys with the tests that ask for a pipeline of no shaders, on other threads, and passed or failed by their order (it began to fail once the new test changed the timing).

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): RTX 4070 Ti SUPER 16 GB, 64 GB RAM with a 4 GB page file, Series X, 2560x1440, DLSS performance, DLSS frame generation 2x, ray tracing off. The PC was at its commit limit (75.1 of 75.9 GB), so the memory guard was putting compiles off.
  • Before: frame times: 13 frames, median 40.0 ms, p95 51.2, p99 506.2, the same in every one-second window, with draws dropped for pipelines not made yet ... keys=33f518084a3194a8b5ef1c17ab96ab87 once a second and host pipeline not made: the PC is short of memory (memory guard).
  • After: the same save and place, memory still short (77.2 of 78.0 GB): median 49.3 ms, p95 52.0, no frame near 500 ms in any window.
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): no shader change.
  • cargo test passed for the crates it touches: yes for cargo test -p victory-gpu --locked --lib pipeline::make (31 passed, run six times in a row). cargo xtask policy --staged: asset policy: 1 files ok.
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings stops in victory-shader on main as it is (two unused imports and a while_immutable_condition in emit/lower), before it reaches this crate; without -D warnings this change adds no warning.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #2743, #2886, #2616 and #2578 work on the memory guard (what is put off, on which floor, and what is recorded); none of them changes wait's loop, and this does not touch memguard or compilemem.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5555981092 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3398). Originally posted by [Revono](https://github.com/Revono) on 2026-11-29T22:47:43Z. --- No issue filed for this; found while tracing a half-second hitch on a PC at its commit limit. ## What it changes A pipeline whose compile the memory guard puts off is paused for a second and not waited for meanwhile. When the pause ran out, the next draw queued it again and waited for it. A worker took it, was refused within the millisecond and put it off again, which wakes the waiters, but `wait` only looked at whether the pipeline was made. So the draw stood there for the rest of its 500 ms budget, once a second, for as long as memory stayed short. - `pipeline/make.rs` `wait`: the loop also ends when the compile was put off (`Pending::retry_waits`). `defer` already sets the pause before the waiters are woken, so nothing is missed. - New test `a_wait_ends_when_the_compile_is_put_off_for_memory`: a worker thread refuses the compile 30 ms into a wait. It waits 508 ms without the change and returns with the refusal with it. - `a_pipeline_made_ready_is_the_one_the_title_gets` takes a key of its own. It shared the process's list of used keys with the tests that ask for a pipeline of no shaders, on other threads, and passed or failed by their order (it began to fail once the new test changed the timing). ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): RTX 4070 Ti SUPER 16 GB, 64 GB RAM with a 4 GB page file, Series X, 2560x1440, DLSS performance, DLSS frame generation 2x, ray tracing off. The PC was at its commit limit (75.1 of 75.9 GB), so the memory guard was putting compiles off. - Before: `frame times: 13 frames, median 40.0 ms, p95 51.2, p99 506.2`, the same in every one-second window, with `draws dropped for pipelines not made yet ... keys=33f518084a3194a8b5ef1c17ab96ab87` once a second and `host pipeline not made: the PC is short of memory (memory guard)`. - After: the same save and place, memory still short (77.2 of 78.0 GB): `median 49.3 ms, p95 52.0`, no frame near 500 ms in any window. - For shader changes, the wave sizes tested (32 and/or 64 lanes): no shader change. - `cargo test` passed for the crates it touches: yes for `cargo test -p victory-gpu --locked --lib pipeline::make` (31 passed, run six times in a row). `cargo xtask policy --staged`: `asset policy: 1 files ok`. - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` stops in `victory-shader` on `main` as it is (two unused imports and a `while_immutable_condition` in `emit/lower`), before it reaches this crate; without `-D warnings` this change adds no warning. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #2743, #2886, #2616 and #2578 work on the memory guard (what is put off, on which floor, and what is recorded); none of them changes `wait`'s loop, and this does not touch `memguard` or `compilemem`.
SackDipo commented 2026-11-30 01:34:44 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by SackDipo on 2026-11-30T01:34:44Z.


Confirmed in game: this fixes the 0.1 fps freeze when going into water. The PC is an RTX 4060 8 GB with a Ryzen 5 7600 and 32 GB RAM. Settings: Series X, DLSS Balanced, frame generation 2x; the system-managed pagefile gives a commit limit of 36,969 MiB.

Plain v2026.11.29.05. Going into water binds a new pass over the screen (vertex 8f5d582e91672612, pixel b2df6d3e752b4000, DXGI_FORMAT(87)). The memory guard puts its compile off: "host pipeline failed ... hr=0x8007000e", 12 ms into the wait. The draw then waits the whole screen budget, every frame:

a pass over the screen was waited for ... ms=10000 made=false frame=34250 formats=[DXGI_FORMAT(87)] shaders=[vertex 8f5d582e91672612, pixel b2df6d3e752b4000]
0.1 fps, 10057.6 ms/frame (... 2.7 on the GPU ...)
frame times: 2 frames, median 20041.5 ms

This happened 14 times, 10.0 s apart: two keys, 860c083c... and a6d3d14f..., so 20 s frames. The card was about 2 % busy.

v2026.11.29.05 with this PR (merged locally on top of #3500). The same place, the same pipeline, the same deferral:

01:32:50 host pipeline failed ... key="8f5d582e91672612+b2df6d3e752b4000" stage="graphics" hr=0x8007000e
01:32:56 draws dropped for pipelines not made yet ... keys=... a6d3d14fe71eae87bd70a363c8c79692 860c083c452e76d06f0063ae9d750323

There was no "a pass over the screen was waited for" line in the whole session, and no frame over 2 s. The frames around it ran at 79-94 ms, the normal rate for that scene. The water pass is dropped until it can be made instead of freezing the game.

The same signature appears in #2303, #2319, #2385 and #3467. The regression came in with 60a08ef2: compiles are put off rather than refused, so wait() never saw a result.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7266256813 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3398#issuecomment-7266256813). Originally posted by [SackDipo](https://github.com/SackDipo) on 2026-11-30T01:34:44Z. --- Confirmed in game: this fixes the 0.1 fps freeze when going into water. The PC is an RTX 4060 8 GB with a Ryzen 5 7600 and 32 GB RAM. Settings: Series X, DLSS Balanced, frame generation 2x; the system-managed pagefile gives a commit limit of 36,969 MiB. **Plain v2026.11.29.05.** Going into water binds a new pass over the screen (vertex `8f5d582e91672612`, pixel `b2df6d3e752b4000`, `DXGI_FORMAT(87)`). The memory guard puts its compile off: "host pipeline failed ... hr=0x8007000e", 12 ms into the wait. The draw then waits the whole screen budget, every frame: ``` a pass over the screen was waited for ... ms=10000 made=false frame=34250 formats=[DXGI_FORMAT(87)] shaders=[vertex 8f5d582e91672612, pixel b2df6d3e752b4000] 0.1 fps, 10057.6 ms/frame (... 2.7 on the GPU ...) frame times: 2 frames, median 20041.5 ms ``` This happened 14 times, 10.0 s apart: two keys, `860c083c...` and `a6d3d14f...`, so 20 s frames. The card was about 2 % busy. **v2026.11.29.05 with this PR** (merged locally on top of #3500). The same place, the same pipeline, the same deferral: ``` 01:32:50 host pipeline failed ... key="8f5d582e91672612+b2df6d3e752b4000" stage="graphics" hr=0x8007000e 01:32:56 draws dropped for pipelines not made yet ... keys=... a6d3d14fe71eae87bd70a363c8c79692 860c083c452e76d06f0063ae9d750323 ``` There was no "a pass over the screen was waited for" line in the whole session, and no frame over 2 s. The frames around it ran at 79-94 ms, the normal rate for that scene. The water pass is dropped until it can be made instead of freezing the game. The same signature appears in #2303, #2319, #2385 and #3467. The regression came in with 60a08ef2: compiles are put off rather than refused, so `wait()` never saw a result.
SergDi commented 2026-11-30 09:32:22 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by SergDi on 2026-11-30T09:32:22Z.


Independent Windows check on RTX 4080 16 GB / Ryzen 5 7600 / 32 GB RAM / driver 610.88, base 41adb55167fa778fcaa5dc36fa18a1fa8dacd657 versus that base plus this PR at a22a26d7ff687b5a37f8c5fdcad30f96f4db5ba0.

Focused test: tests-only on base fails with waited 502.3235ms for the 500 ms budget. With the full patch, the focused test passed three times and pipeline::make passed 31/31 twice (cargo test --locked --release -p victory-gpu --lib pipeline::make -- --test-threads=1 --nocapture).

Runtime mechanism check, deliberately induced: the signature was absent in my ordinary logs, so I set process-local VICTORY_COMMIT_FLOOR_MB=7168 identically on both arms. No pagefile/global setting change. Release builds, separate cold cache per leg, copied save, 1440p DLAA, FG/RT off, THIN0; order A B B A. The observation window was 120 s after the third prelude key.

Leg Unmade screen-pass waits in that window
Base A1 3 x ms=10000 made=false
Patched B1 None; one wait finished made=true at 2357 ms
Patched B2 None
Base A2 10 x ms=10000 made=false

On base, the same screen pipeline was put off by the guard, then consecutive frames exhausted the entire 10 s screen-wait budget. With the patch, no unmade wait exhausted that budget. This independently exercises the screen-pass case already reported above, in addition to the ordinary 500 ms unit test.

Limits: scenes were not matched and both arms were heavily degraded by the artificial floor. This is mechanism evidence, not a performance ABBA or a claim of higher normal FPS; other long loading frames remained. All runs closed normally. No raw title logs/dumps are attached.

AI assistance: Claude ran the isolated tests and collected the hardware evidence; Codex reviewed the report and publication wording.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7274345110 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3398#issuecomment-7274345110). Originally posted by [SergDi](https://github.com/SergDi) on 2026-11-30T09:32:22Z. --- Independent Windows check on RTX 4080 16 GB / Ryzen 5 7600 / 32 GB RAM / driver 610.88, base `41adb55167fa778fcaa5dc36fa18a1fa8dacd657` versus that base plus this PR at `a22a26d7ff687b5a37f8c5fdcad30f96f4db5ba0`. **Focused test:** tests-only on base fails with `waited 502.3235ms` for the 500 ms budget. With the full patch, the focused test passed three times and `pipeline::make` passed **31/31 twice** (`cargo test --locked --release -p victory-gpu --lib pipeline::make -- --test-threads=1 --nocapture`). **Runtime mechanism check, deliberately induced:** the signature was absent in my ordinary logs, so I set process-local `VICTORY_COMMIT_FLOOR_MB=7168` identically on both arms. No pagefile/global setting change. Release builds, separate cold cache per leg, copied save, 1440p DLAA, FG/RT off, THIN0; order A B B A. The observation window was 120 s after the third prelude key. | Leg | Unmade screen-pass waits in that window | |---|---| | Base A1 | 3 x `ms=10000 made=false` | | Patched B1 | None; one wait finished `made=true` at 2357 ms | | Patched B2 | None | | Base A2 | 10 x `ms=10000 made=false` | On base, the same screen pipeline was put off by the guard, then consecutive frames exhausted the entire 10 s screen-wait budget. With the patch, no unmade wait exhausted that budget. This independently exercises the screen-pass case already reported above, in addition to the ordinary 500 ms unit test. **Limits:** scenes were not matched and both arms were heavily degraded by the artificial floor. This is mechanism evidence, not a performance ABBA or a claim of higher normal FPS; other long loading frames remained. All runs closed normally. No raw title logs/dumps are attached. AI assistance: Claude ran the isolated tests and collected the hardware evidence; Codex reviewed the report and publication wording.
trustno1-coder commented 2026-12-01 18:52:38 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:52:38Z.


Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321724595 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3398#issuecomment-7321724595). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:52:38Z. --- Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

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