Skip to content

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

Open
Revono wants to merge 1 commit into
trustno1-coder:mainfrom
Revono:fix/pipeline-wait-ends-when-compile-put-off
Open

Revono wants to merge 1 commit into
trustno1-coder:mainfrom
Revono:fix/pipeline-wait-ends-when-compile-put-off

Conversation

@Revono

@Revono Revono commented Nov 29, 2026

Copy link
Copy Markdown

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

…pile off (500 ms held in every second at the commit limit)

A pipeline whose compile the memory guard put off is paused for a second
and not waited for meanwhile. When the pause ran out, the next draw queued
it again and waited; a worker took it, was refused within the millisecond
and put it off again, which wakes the waiters. But the wait looked only 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.

Seen on an RTX 4070 Ti SUPER with the PC at its commit limit (75.1 of
75.9 GB): frame times of 38 ms median with one of about 500 ms in every
second ("p99 506.2"), and "draws dropped for pipelines not made yet" for
the same key each second. With this the same scene has no such frame.

The wait now ends as well when the compile is put off. The test waits
508 ms without the change and returns with the refusal with it.

The test of a pipeline made ready 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.
@github-actions github-actions Bot added the pr-fix Pull request: fixes a bug label Nov 29, 2026
@github-actions github-actions Bot changed the title [pr-fix] Host pipelines: a draw's wait ends when the memory guard puts the compile off (500 ms held every second at the commit limit) Host pipelines: a draw's wait ends when the memory guard puts the compile off (500 ms held every second at the commit limit) Nov 29, 2026
Alxspb added a commit to Alxspb/VIctory-NVIDIA that referenced this pull request Nov 29, 2026
Carried ahead of upstream, each behind its own switch or strictly local:
- trustno1-coder#3379 the commit floor scales to the PC's RAM, so a 16 GB PC still admits
  driver compiles (without it every PSO compile is put off, and the scene
  draws nothing);
- trustno1-coder#3398 a draw's wait ends when the memory guard puts the compile off, so a
  drawing thread does not sit 500 ms at the commit limit;
- trustno1-coder#3065 the ambient depth table is bound by the resolve only, and frame
  generation is asked again once DLSS-G allows more frames;
- trustno1-coder#3067 the ray test misses inverted boxes, as the console's does
  (VICTORY_BVH_MISS; the authors measure +57 % with ray tracing);
- trustno1-coder#3063 the BVH rehydration stops at 32 rounds and the builder's memory is
  coherent only where it asks (VICTORY_BVH_REHYDRATE_MAX,
  VICTORY_BVH_COHERENT_GLC; the authors measure +15 %);
- trustno1-coder#3406 VRAM is checked before the first streamed textures are allocated;
- trustno1-coder#3128 sampled texture eviction is on by default through 10 GB of VRAM;
- trustno1-coder#3413 the relay fence context survives a GPU device loss.

Left for a hand rebase, because they sit in the paths our parallel submit
and DLSS work rewrote: trustno1-coder#1978 (keep the DLSS frame generation inputs through
presentation) and trustno1-coder#3411 (the RTX 5060 Ti bundle).
Alxspb added a commit to Alxspb/VIctory-NVIDIA that referenced this pull request Nov 29, 2026
Carried ahead of upstream, each behind its own switch or strictly local:
- trustno1-coder#3379 the commit floor scales to the PC's RAM, so a 16 GB PC still admits
  driver compiles (without it every PSO compile is put off, and the scene
  draws nothing);
- trustno1-coder#3398 a draw's wait ends when the memory guard puts the compile off, so a
  drawing thread does not sit 500 ms at the commit limit;
- trustno1-coder#3065 the ambient depth table is bound by the resolve only, and frame
  generation is asked again once DLSS-G allows more frames;
- trustno1-coder#3067 the ray test misses inverted boxes, as the console's does
  (VICTORY_BVH_MISS; the authors measure +57 % with ray tracing);
- trustno1-coder#3063 the BVH rehydration stops at 32 rounds and the builder's memory is
  coherent only where it asks (VICTORY_BVH_REHYDRATE_MAX,
  VICTORY_BVH_COHERENT_GLC; the authors measure +15 %);
- trustno1-coder#3406 VRAM is checked before the first streamed textures are allocated;
- trustno1-coder#3128 sampled texture eviction is on by default through 10 GB of VRAM;
- trustno1-coder#3413 the relay fence context survives a GPU device loss.

Left for a hand rebase, because they sit in the paths our parallel submit
and DLSS work rewrote: trustno1-coder#1978 (keep the DLSS frame generation inputs through
presentation) and trustno1-coder#3411 (the RTX 5060 Ti bundle).
moritz-eckhard-nickel added a commit to moritz-eckhard-nickel/VIctory-NVIDIA that referenced this pull request Nov 30, 2026
…ends when the memory guard puts the compile off (500 ms held every second at the commit limit)

trustno1-coder#3398 by Revono, head a22a26d.
Conflict: tests only; kept both.
moritz-eckhard-nickel added a commit to moritz-eckhard-nickel/VIctory-NVIDIA that referenced this pull request Nov 30, 2026
…compiles

trustno1-coder#2580, head c9ffe60.
Conflicts in pipeline/make.rs: kept the memory guard's starved floor and take_out_of_memory (trustno1-coder#3398 and main) with the PR's Building guard; wait_loop and compute_left from the PR (it already ends on retry_waits and boosts the maker).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Zedwhyrex

Copy link
Copy Markdown

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 60a08ef: compiles are put off rather than refused, so wait() never saw a result.

@SergDi

SergDi commented Nov 30, 2026

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-fix Pull request: fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants