pipeline/make: stop holding draws on compilemem gate waits #4471

Closed
nidea1 wants to merge 3 commits from upstream-pr/4471 into main
nidea1 commented 2026-11-30 20:46:51 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-11-30T20:46:51Z.


Related: #4176

What it changes

With VICTORY_PIPELINE_WAIT_ALL enabled (on by default), missing graphics pipelines wait up to the 10 s screen_budget per frame. When system commit drops below the 4 GB hard floor (Verdict::Commit) or free physical memory drops below the 1 GB soft floor (Verdict::Throttle), three defects in victory-gpu caused multi-second draw-wait stalls (down to ~0.5 FPS while shaders were compiling or deferred):

  1. Draws waited up to 10 s while workers were parked in compilemem::begin():

    • Pipeline workers wait up to WAIT_WORKER (10 s) under Verdict::Commit when another compile is running, and unboundedly under Verdict::Throttle. While parked in compilemem::begin(), Pending::defer() has not run yet (retry_at == 0, queue_state == MAKING), so wait_for_pipeline() held the recording thread until timeout. When eligible workers saturated on Verdict::Commit or Verdict::Throttle, additional REQUESTED draws also stalled up to 10 s (or 500 ms for Queue::requested).
    • Tracks per-Pending gate-wait state (MEM_NONE / MEM_THROTTLED / MEM_COMMIT_BLOCKED) via a thread-local RAII guard (MemWaitGuard) inside Pending::make_with() (clearing mem_wait only after defer() stores retry_at and NOT_QUEUED, leaving zero window), and tracks active Verdict::Commit / Verdict::Throttle waiters in compilemem::GATE_WAITERS paired with WorkerCounters (all_busy and requested_busy, unwind-safe via WorkerBusyGuard) via SeqCst ordering.
    • Tracks non-screen workers (!screens_only: general + asked-only) separately alongside total workers in WorkerCounters (enter_and_notify): because SCREEN_WORKERS only pop Queue::screen and never Queue::requested, compute and VICTORY_PIPELINE_WAIT_ALL=0 graphics draws are treated as worker-saturated (and woken via notify_waiters()) as soon as all non-screen workers are busy, even when SCREEN_WORKERS are idle.
    • Wakes waiting draws immediately: all draws exit on MEM_COMMIT_BLOCKED or when all eligible workers are busy with a commit-blocked compile; ordinary VICTORY_PIPELINE_WAIT_ALL graphics draws (and non-screen compute) also exit immediately on MEM_THROTTLED or soft-throttle worker saturation, while true screen || character passes keep waiting under soft RAM throttle so one-shot lighting/bake passes are not dropped, and free eligible workers continue serving warm library hits.
    • WAIT_WORKER and worker admission floors in compilemem/memguard/residency are unchanged.
  2. Inline compute under commit/throttle pressure and post-deferral recovery (3534ce31, 62b6e987):

    • First-time or retried compute dispatches previously entered inline p.make() even while compilemem was commit-blocked, soft-throttled, or the pipeline's worker was parked in compilemem::begin(), stalling 1,000 ms (WAIT_OTHER) in compilemem::begin() or blocking unboundedly on p.building.lock().
    • ready() now checks mem_gate_allows_inline_compute(mem_wait, p.screen || p.character, commit_blocked, throttle_blocked) and falls back from inline compute p.make() to wait() whenever p.mem_wait != MEM_NONE, compilemem::commit_blocked() is active, or compilemem::throttle_blocked() is active for non-screen/non-character compute (preserving screen || character anti-flash behavior when no worker is parked on that pipeline).
    • Removed the sticky deferred_before = retry_at != 0 bypass in ready() while preserving retry_at for driver_oom rate-limiting and wait_for_pipeline()'s idle-exit guard. During the retry cooldown start() still returns false so draws do not block; once the cooldown expires and memory recovers, previously deferred pipelines (including screen || character passes and inline compute) wait/build normally again, while mem_gate_stops(), mem_gate_allows_inline_compute(), and wait_for_pipeline() still exit immediately if the compile-memory gate blocks or the retry defers again.
  3. start() -> ready() TOCTOU and idle memguard-deferred wait race:

    • start() previously returned () when skipping a retry_waits() pipeline; if the cooldown expired before ready()'s !p.retry_waits() check, ready() entered wait() while queue_state == NOT_QUEUED, and wait_for_pipeline() only exited idle NOT_QUEUED deferrals when driver_oom was set.
    • start() now returns bool (whether the pipeline is queued/making), retry_at and queue_state handoffs use Acquire/Release ordering, and wait_for_pipeline() exits on any idle NOT_QUEUED pipeline with retry_at != 0 (covering both memguard and driver_oom deferrals).

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): Unit and regression tests on 62b6e987 (rebased onto origin/main 5fabb46eaf), plus earlier 12-minute (720.7 s in-world) live soak on RTX 3060 Ti 8 GB / 32 GB RAM (Series S, DLSS Quality, FSR 3 frame generation, ray tracing off, VICTORY_SAMPLED_EVICT=1, VICTORY_WINDOW_GROW=1, VICTORY_POOL_SMALL=0, VICTORY_RIPE_BLOCKS=12).
  • Before: Draws stalled up to the full wait_for_pipeline / screen_budget (10 s) when a worker parked in compilemem::begin(), when an idle memguard-deferred pipeline's cooldown had expired, when Queue::requested waited behind saturated non-screen workers while SCREEN_WORKERS were idle, or when inline compute entered p.make() under commit/throttle pressure.
  • After: wait_for_pipeline() and ready() exit immediately without timeout on compilemem gate waits (MEM_COMMIT_BLOCKED, soft-throttle for ordinary wait-all draws and non-screen compute, eligible-worker saturation) and idle memguard-deferred pipelines, while previously deferred screen || character passes and inline compute resume normal waits/builds once the cooldown expires and memory recovers.
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A (no shader changes)
  • cargo test passed for the crates it touches: yes (on 62b6e987, base 5fabb46eaf)
    • cargo test --locked -p victory-gpu --lib -- pipeline::make compilemem --test-threads=1: 61 passed, 0 failed (plus 5/5 consecutive parallel runs passed, 61/61 each, including new requested_queue_saturation_ignores_idle_screen_workers and expanded inline_compute_skips_build_when_gate_blocks tests).
    • cargo test --locked -p victory-gpu --lib (full parallel): 1105 passed, 0 failed, 66 ignored.
    • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings and --all-features: 0 warnings/errors in touched files (origin/main 5fabb46e currently has 5 pre-existing clippy errors in host/{font,menu,panel}.rs from #4634, tracked in #4679 / #4707).
    • cargo xtask policy: 464 files ok (--staged: 1 files ok).

Checked for overlap

  • I searched the open and recently closed pull requests for the same issue and for the files this touches. Related: #4176, #4754, #2392, #2188, #3398, #2886, #3426, #3347, #3788, #4255
    • #4754 (closed on 5fabb46e citing #2392 + #2188): #2392 reduces hard-commit deferrals by counting pagefile growth as available commit and #2188 exits wait_for_pipeline() once Pending::defer() has run, but neither covers: (1) unbounded worker waits under Verdict::Throttle (soft physical-RAM floor / upload_refused, which never defers on workers), (2) the up-to-10 s WAIT_WORKER wait in compilemem::begin() before Pending::defer() runs under Verdict::Commit, (3) inline compute blocking on compilemem::begin() (WAIT_OTHER = 1 s) or p.building.lock() under commit/throttle pressure, or (4) the start() -> ready() TOCTOU and idle memguard-deferred (!driver_oom) wait races.
    • #3398 is conflicting/dirty and superseded by #2188/#2469; it does not cover compilemem gate waits or the non-driver_oom unqueued race.
    • #2886 lowers the commit floor after 3 put-offs (starved_compile) without fixing draw waits while workers are parked in compilemem::begin() or the ready()/wait_for_pipeline() races.
    • #3426 caps waits to 100 ms only on 1 Hz residency::pressured() and alters residency.rs commit-growth accounting.
    • #3347 changes policy by disabling compilemem in gameplay rather than fixing the pipeline/make draw-wait interaction.
    • #3788 caps total waits_as_screen() wait per pipeline across frames (orthogonal/complementary).
    • #4255 reorders waited-on screen passes ahead of FIFO in Queue::screen (orthogonal/complementary).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5573465407 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4471). Originally posted by [nidea1](https://github.com/nidea1) on 2026-11-30T20:46:51Z. --- Related: #4176 ## What it changes With `VICTORY_PIPELINE_WAIT_ALL` enabled (on by default), missing graphics pipelines wait up to the 10 s `screen_budget` per frame. When system commit drops below the 4 GB hard floor (`Verdict::Commit`) or free physical memory drops below the 1 GB soft floor (`Verdict::Throttle`), three defects in `victory-gpu` caused multi-second draw-wait stalls (down to ~0.5 FPS while shaders were compiling or deferred): 1. **Draws waited up to 10 s while workers were parked in `compilemem::begin()`:** - Pipeline workers wait up to `WAIT_WORKER` (10 s) under `Verdict::Commit` when another compile is running, and unboundedly under `Verdict::Throttle`. While parked in `compilemem::begin()`, `Pending::defer()` has not run yet (`retry_at == 0`, `queue_state == MAKING`), so `wait_for_pipeline()` held the recording thread until timeout. When eligible workers saturated on `Verdict::Commit` or `Verdict::Throttle`, additional `REQUESTED` draws also stalled up to 10 s (or 500 ms for `Queue::requested`). - Tracks per-`Pending` gate-wait state (`MEM_NONE` / `MEM_THROTTLED` / `MEM_COMMIT_BLOCKED`) via a thread-local RAII guard (`MemWaitGuard`) inside `Pending::make_with()` (clearing `mem_wait` only *after* `defer()` stores `retry_at` and `NOT_QUEUED`, leaving zero window), and tracks active `Verdict::Commit` / `Verdict::Throttle` waiters in `compilemem::GATE_WAITERS` paired with `WorkerCounters` (`all_busy` and `requested_busy`, unwind-safe via `WorkerBusyGuard`) via `SeqCst` ordering. - Tracks non-screen workers (`!screens_only`: general + asked-only) separately alongside total workers in `WorkerCounters` (`enter_and_notify`): because `SCREEN_WORKERS` only pop `Queue::screen` and never `Queue::requested`, compute and `VICTORY_PIPELINE_WAIT_ALL=0` graphics draws are treated as worker-saturated (and woken via `notify_waiters()`) as soon as all non-screen workers are busy, even when `SCREEN_WORKERS` are idle. - Wakes waiting draws immediately: all draws exit on `MEM_COMMIT_BLOCKED` or when all eligible workers are busy with a commit-blocked compile; ordinary `VICTORY_PIPELINE_WAIT_ALL` graphics draws (and non-screen compute) also exit immediately on `MEM_THROTTLED` or soft-throttle worker saturation, while true `screen || character` passes keep waiting under soft RAM throttle so one-shot lighting/bake passes are not dropped, and free eligible workers continue serving warm library hits. - `WAIT_WORKER` and worker admission floors in `compilemem`/`memguard`/`residency` are unchanged. 2. **Inline compute under commit/throttle pressure and post-deferral recovery (`3534ce31`, `62b6e987`):** - First-time or retried compute dispatches previously entered inline `p.make()` even while `compilemem` was commit-blocked, soft-throttled, or the pipeline's worker was parked in `compilemem::begin()`, stalling 1,000 ms (`WAIT_OTHER`) in `compilemem::begin()` or blocking unboundedly on `p.building.lock()`. - `ready()` now checks `mem_gate_allows_inline_compute(mem_wait, p.screen || p.character, commit_blocked, throttle_blocked)` and falls back from inline compute `p.make()` to `wait()` whenever `p.mem_wait != MEM_NONE`, `compilemem::commit_blocked()` is active, or `compilemem::throttle_blocked()` is active for non-screen/non-character compute (preserving `screen || character` anti-flash behavior when no worker is parked on that pipeline). - Removed the sticky `deferred_before = retry_at != 0` bypass in `ready()` while preserving `retry_at` for `driver_oom` rate-limiting and `wait_for_pipeline()`'s idle-exit guard. During the retry cooldown `start()` still returns `false` so draws do not block; once the cooldown expires and memory recovers, previously deferred pipelines (including `screen || character` passes and inline compute) wait/build normally again, while `mem_gate_stops()`, `mem_gate_allows_inline_compute()`, and `wait_for_pipeline()` still exit immediately if the compile-memory gate blocks or the retry defers again. 3. **`start()` -> `ready()` TOCTOU and idle `memguard`-deferred wait race:** - `start()` previously returned `()` when skipping a `retry_waits()` pipeline; if the cooldown expired before `ready()`'s `!p.retry_waits()` check, `ready()` entered `wait()` while `queue_state == NOT_QUEUED`, and `wait_for_pipeline()` only exited idle `NOT_QUEUED` deferrals when `driver_oom` was set. - `start()` now returns `bool` (whether the pipeline is queued/making), `retry_at` and `queue_state` handoffs use `Acquire`/`Release` ordering, and `wait_for_pipeline()` exits on any idle `NOT_QUEUED` pipeline with `retry_at != 0` (covering both `memguard` and `driver_oom` deferrals). ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): Unit and regression tests on `62b6e987` (rebased onto `origin/main` `5fabb46eaf`), plus earlier 12-minute (720.7 s in-world) live soak on RTX 3060 Ti 8 GB / 32 GB RAM (Series S, DLSS Quality, FSR 3 frame generation, ray tracing off, `VICTORY_SAMPLED_EVICT=1`, `VICTORY_WINDOW_GROW=1`, `VICTORY_POOL_SMALL=0`, `VICTORY_RIPE_BLOCKS=12`). - Before: Draws stalled up to the full `wait_for_pipeline` / `screen_budget` (10 s) when a worker parked in `compilemem::begin()`, when an idle `memguard`-deferred pipeline's cooldown had expired, when `Queue::requested` waited behind saturated non-screen workers while `SCREEN_WORKERS` were idle, or when inline compute entered `p.make()` under commit/throttle pressure. - After: `wait_for_pipeline()` and `ready()` exit immediately without timeout on `compilemem` gate waits (`MEM_COMMIT_BLOCKED`, soft-throttle for ordinary wait-all draws and non-screen compute, eligible-worker saturation) and idle `memguard`-deferred pipelines, while previously deferred `screen || character` passes and inline compute resume normal waits/builds once the cooldown expires and memory recovers. - For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A (no shader changes) - `cargo test` passed for the crates it touches: yes (on `62b6e987`, base `5fabb46eaf`) - `cargo test --locked -p victory-gpu --lib -- pipeline::make compilemem --test-threads=1`: 61 passed, 0 failed (plus 5/5 consecutive parallel runs passed, 61/61 each, including new `requested_queue_saturation_ignores_idle_screen_workers` and expanded `inline_compute_skips_build_when_gate_blocks` tests). - `cargo test --locked -p victory-gpu --lib` (full parallel): 1105 passed, 0 failed, 66 ignored. - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` and `--all-features`: 0 warnings/errors in touched files (`origin/main` `5fabb46e` currently has 5 pre-existing clippy errors in `host/{font,menu,panel}.rs` from `#4634`, tracked in `#4679` / `#4707`). - `cargo xtask policy`: 464 files ok (`--staged`: 1 files ok). ## Checked for overlap - [x] I searched the open and recently closed pull requests for the same issue and for the files this touches. Related: #4176, #4754, #2392, #2188, #3398, #2886, #3426, #3347, #3788, #4255 - `#4754` (closed on `5fabb46e` citing `#2392` + `#2188`): `#2392` reduces hard-commit deferrals by counting pagefile growth as available commit and `#2188` exits `wait_for_pipeline()` once `Pending::defer()` has run, but neither covers: (1) unbounded worker waits under `Verdict::Throttle` (soft physical-RAM floor / `upload_refused`, which never defers on workers), (2) the up-to-10 s `WAIT_WORKER` wait in `compilemem::begin()` *before* `Pending::defer()` runs under `Verdict::Commit`, (3) inline compute blocking on `compilemem::begin()` (`WAIT_OTHER` = 1 s) or `p.building.lock()` under commit/throttle pressure, or (4) the `start()` -> `ready()` TOCTOU and idle `memguard`-deferred (`!driver_oom`) wait races. - `#3398` is conflicting/dirty and superseded by `#2188`/`#2469`; it does not cover `compilemem` gate waits or the non-`driver_oom` unqueued race. - `#2886` lowers the commit floor after 3 put-offs (`starved_compile`) without fixing draw waits while workers are parked in `compilemem::begin()` or the `ready()`/`wait_for_pipeline()` races. - `#3426` caps waits to 100 ms only on 1 Hz `residency::pressured()` and alters `residency.rs` commit-growth accounting. - `#3347` changes policy by disabling `compilemem` in gameplay rather than fixing the `pipeline/make` draw-wait interaction. - `#3788` caps total `waits_as_screen()` wait per pipeline across frames (orthogonal/complementary). - `#4255` reorders waited-on screen passes ahead of FIFO in `Queue::screen` (orthogonal/complementary).
IRennie74 commented 2026-11-30 22:38:43 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by IRennie74 on 2026-11-30T22:38:43Z.


One behaviour change in ready() that I think goes further than the description says (crates/victory-gpu/src/pipeline/make.rs:713):

let deferred_before = p.retry_at.load(Ordering::Acquire) != 0;
let queued = start(p, REQUESTED);
if queued && !deferred_before && !p.retry_waits() {

retry_at is set in defer() and never cleared again outside tests, so deferred_before stays true for the rest of that pipeline's life. After the first memory deferral, no later ready() waits for it or makes a compute pipeline inline. Its draws are dropped until a worker finishes it, and that includes screen || character passes, which the description says keep waiting under soft throttle. A full-screen pass dropped for a few frames shows up as a flash, which is the kind of A-B-A flicker we count.

If the aim is only to stop draws stalling on the retry cycle, a narrower fix would be to skip the wait only while p.mem_wait != MEM_NONE or the gate is commit-blocked (which mem_gate_stops already handles), or to clear retry_at once the retry has been queued. Then a pipeline that was deferred once is treated like any other after memory recovers.

(The CI failure is main's clippy errors that #4484 fixes; the new tests have not run in CI yet.)

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7294118194 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4471#issuecomment-7294118194). Originally posted by [IRennie74](https://github.com/IRennie74) on 2026-11-30T22:38:43Z. --- One behaviour change in `ready()` that I think goes further than the description says (`crates/victory-gpu/src/pipeline/make.rs:713`): ```rust let deferred_before = p.retry_at.load(Ordering::Acquire) != 0; let queued = start(p, REQUESTED); if queued && !deferred_before && !p.retry_waits() { ``` `retry_at` is set in `defer()` and never cleared again outside tests, so `deferred_before` stays true for the rest of that pipeline's life. After the first memory deferral, no later `ready()` waits for it or makes a compute pipeline inline. Its draws are dropped until a worker finishes it, and that includes `screen || character` passes, which the description says keep waiting under soft throttle. A full-screen pass dropped for a few frames shows up as a flash, which is the kind of A-B-A flicker we count. If the aim is only to stop draws stalling on the retry cycle, a narrower fix would be to skip the wait only while `p.mem_wait != MEM_NONE` or the gate is commit-blocked (which `mem_gate_stops` already handles), or to clear `retry_at` once the retry has been queued. Then a pipeline that was deferred once is treated like any other after memory recovers. (The CI failure is main's clippy errors that #4484 fixes; the new tests have not run in CI yet.)
nidea1 commented 2026-12-01 03:09:20 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-12-01T03:09:20Z.


@IRennie74 Thanks for catching that sticky retry_at / deferred_before bug in ready()!

Rebased onto 7d93ee0759 and pushed 5adb194c to address it:

  • Removed the sticky deferred_before = p.retry_at.load(Ordering::Acquire) != 0 gate from ready(), while keeping retry_at intact for driver_oom rate-limiting (retry_blocked() / NEXT_DRIVER_RETRY) and wait_for_pipeline()'s idle-exit guard.
  • During the retry cooldown start(p, REQUESTED) still returns false (preserving the TOCTOU fix); once the cooldown expires and memory recovers, screen || character passes wait normally (including under soft throttle) and compute pipelines resume inline builds instead of dropping frames, while mem_gate_stops(), mem_gate_allows_inline_compute(), and wait_for_pipeline() still exit immediately if the compile-memory gate is blocked or the retry defers again.
  • Added/updated 3 regression tests (screen_and_character_passes_wait_normally_after_memory_deferral_recovers, compute_pipeline_builds_inline_again_after_memory_deferral_recovers, and ready_does_not_block_on_retry_of_memguard_deferred_pipeline_when_gate_blocks) — cargo test -j 2 -p victory-gpu --locked --lib -- pipeline::make compilemem --test-threads=1 passes 60/60, and clippy passes with 0 warnings on 7d93ee0759.

One live cold-compile soak note: under soft physical-RAM throttle, true full-screen passes can still hit multi-second waits when queued behind ordinary wait_all draws in Queue::screen FIFO or across repeated per-frame screen budgets. Those two pieces are already tracked in #4255 (FIFO priority for waited-on passes) and #3788 (cross-frame screen wait cap), so I intentionally kept them out of #4471 to avoid conflicts and preserve the screen || character anti-flash guarantee. Updated bullet 2 of the PR description to match 5adb194c.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7299385709 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4471#issuecomment-7299385709). Originally posted by [nidea1](https://github.com/nidea1) on 2026-12-01T03:09:20Z. --- @IRennie74 Thanks for catching that sticky `retry_at` / `deferred_before` bug in `ready()`! Rebased onto `7d93ee0759` and pushed `5adb194c` to address it: - Removed the sticky `deferred_before = p.retry_at.load(Ordering::Acquire) != 0` gate from `ready()`, while keeping `retry_at` intact for `driver_oom` rate-limiting (`retry_blocked()` / `NEXT_DRIVER_RETRY`) and `wait_for_pipeline()`'s idle-exit guard. - During the retry cooldown `start(p, REQUESTED)` still returns `false` (preserving the TOCTOU fix); once the cooldown expires and memory recovers, `screen || character` passes wait normally (including under soft throttle) and compute pipelines resume inline builds instead of dropping frames, while `mem_gate_stops()`, `mem_gate_allows_inline_compute()`, and `wait_for_pipeline()` still exit immediately if the compile-memory gate is blocked or the retry defers again. - Added/updated 3 regression tests (`screen_and_character_passes_wait_normally_after_memory_deferral_recovers`, `compute_pipeline_builds_inline_again_after_memory_deferral_recovers`, and `ready_does_not_block_on_retry_of_memguard_deferred_pipeline_when_gate_blocks`) — `cargo test -j 2 -p victory-gpu --locked --lib -- pipeline::make compilemem --test-threads=1` passes 60/60, and clippy passes with 0 warnings on `7d93ee0759`. One live cold-compile soak note: under soft physical-RAM throttle, true full-screen passes can still hit multi-second waits when queued behind ordinary `wait_all` draws in `Queue::screen` FIFO or across repeated per-frame screen budgets. Those two pieces are already tracked in #4255 (FIFO priority for waited-on passes) and #3788 (cross-frame screen wait cap), so I intentionally kept them out of #4471 to avoid conflicts and preserve the `screen || character` anti-flash guarantee. Updated bullet 2 of the PR description to match `5adb194c`.
nidea1 commented 2026-12-01 11:00:22 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-12-01T11:00:22Z.


Rebased onto origin/main (5fabb46eaf) and pushed 62b6e987 to close two remaining edge cases in crates/victory-gpu/src/pipeline/make.rs:

  1. Queue::requested worker saturation with idle SCREEN_WORKERS: Tracked non-screen workers (!screens_only: general + asked-only) separately alongside total workers via WorkerCounters and an unwind-safe RAII WorkerBusyGuard (enter_and_notify), waking waiting draws via notify_waiters() after the SeqCst increments when either Queue::requested or Queue::screen saturates under a commit or throttle block. Because SCREEN_WORKERS only pop Queue::screen, compute and VICTORY_PIPELINE_WAIT_ALL=0 graphics draws no longer burn the 500 ms wait_budget() per frame when all non-screen workers are busy while SCREEN_WORKERS sit idle.
  2. Inline compute under soft RAM throttle (Verdict::Throttle): Tightened mem_gate_allows_inline_compute() to also reject inline compute builds when compilemem::throttle_blocked() is active for non-screen/non-character compute passes, preventing recording-thread stalls in compilemem::begin() (WAIT_OTHER = 1 s) or unbounded blocking on p.building.lock() while preserving screen || character anti-flash behavior when no worker is already parked on that pipeline.
  3. Tests: Added live multi-threaded WorkerCounters::enter_and_notify + wait_for_pipeline_with() saturation wakeup and unwind-safety tests, plus live ready_with_gate() soft-throttle MEM_NONE inline compute fallback vs screen compute anti-flash tests.

Also updated the PR title (removing the stale "and memory-deferred retries" suffix) and added an overlap note in the PR body explaining the remaining gaps after #4754 / #2392 + #2188.

Verification on 62b6e987:

  • cargo test --locked -p victory-gpu --lib -- pipeline::make compilemem --test-threads=1: 61 passed, 0 failed (plus VICTORY_PIPELINE_COMPUTE_WAIT=0, VICTORY_PIPELINE_WAIT_ALL=0, VICTORY_PIPELINE_WAIT_FREE=1, VICTORY_PIPELINE_ASKED_WORKERS=2, VICTORY_CHARACTER_WAIT=1, VICTORY_PIPELINE_WAIT_MS=0, and --features diagnostics: 61/61 passed).
  • cargo test --locked -p victory-gpu --lib (full parallel): 1105 passed, 0 failed, 66 ignored.
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings and --all-features: 0 warnings/errors in touched files (pipeline/make.rs, pipeline.rs, compilemem.rs; only the 5 pre-existing main #4634 errors in host/{font,menu,panel}.rs).
  • cargo xtask policy: 464 files ok (--staged: 1 files ok).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7309033281 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4471#issuecomment-7309033281). Originally posted by [nidea1](https://github.com/nidea1) on 2026-12-01T11:00:22Z. --- Rebased onto `origin/main` (`5fabb46eaf`) and pushed `62b6e987` to close two remaining edge cases in `crates/victory-gpu/src/pipeline/make.rs`: 1. **`Queue::requested` worker saturation with idle `SCREEN_WORKERS`:** Tracked non-screen workers (`!screens_only`: general + asked-only) separately alongside total workers via `WorkerCounters` and an unwind-safe RAII `WorkerBusyGuard` (`enter_and_notify`), waking waiting draws via `notify_waiters()` after the `SeqCst` increments when either `Queue::requested` or `Queue::screen` saturates under a commit or throttle block. Because `SCREEN_WORKERS` only pop `Queue::screen`, compute and `VICTORY_PIPELINE_WAIT_ALL=0` graphics draws no longer burn the 500 ms `wait_budget()` per frame when all non-screen workers are busy while `SCREEN_WORKERS` sit idle. 2. **Inline compute under soft RAM throttle (`Verdict::Throttle`):** Tightened `mem_gate_allows_inline_compute()` to also reject inline compute builds when `compilemem::throttle_blocked()` is active for non-screen/non-character compute passes, preventing recording-thread stalls in `compilemem::begin()` (`WAIT_OTHER` = 1 s) or unbounded blocking on `p.building.lock()` while preserving `screen || character` anti-flash behavior when no worker is already parked on that pipeline. 3. **Tests:** Added live multi-threaded `WorkerCounters::enter_and_notify` + `wait_for_pipeline_with()` saturation wakeup and unwind-safety tests, plus live `ready_with_gate()` soft-throttle `MEM_NONE` inline compute fallback vs `screen` compute anti-flash tests. Also updated the PR title (removing the stale "and memory-deferred retries" suffix) and added an overlap note in the PR body explaining the remaining gaps after `#4754` / `#2392` + `#2188`. **Verification on `62b6e987`:** - `cargo test --locked -p victory-gpu --lib -- pipeline::make compilemem --test-threads=1`: `61 passed, 0 failed` (plus `VICTORY_PIPELINE_COMPUTE_WAIT=0`, `VICTORY_PIPELINE_WAIT_ALL=0`, `VICTORY_PIPELINE_WAIT_FREE=1`, `VICTORY_PIPELINE_ASKED_WORKERS=2`, `VICTORY_CHARACTER_WAIT=1`, `VICTORY_PIPELINE_WAIT_MS=0`, and `--features diagnostics`: `61/61` passed). - `cargo test --locked -p victory-gpu --lib` (full parallel): `1105 passed, 0 failed, 66 ignored`. - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` and `--all-features`: `0` warnings/errors in touched files (`pipeline/make.rs`, `pipeline.rs`, `compilemem.rs`; only the 5 pre-existing `main` `#4634` errors in `host/{font,menu,panel}.rs`). - `cargo xtask policy`: `464 files ok` (`--staged`: `1 files ok`).
nidea1 commented 2026-12-01 12:33:51 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-12-01T12:33:51Z.


Live runtime verification on updated WorkerBusyGuard head 62b6e987 (RTX 3060 Ti 8 GB (ReBAR off, driver 621.40), 32 GB RAM, Windows 11, Series S, DLSS Quality, FSR 3 FG, RT off, VICTORY_SAMPLED_EVICT=1, VICTORY_WINDOW_GROW=1, VICTORY_POOL_SMALL=0, VICTORY_RIPE_BLOCKS=12 — 5-minute (300 s in-world, 357 s total) live validation on a combined 15-PR release build over origin/main (5fabb46eaf).):

  • Completed full 300 s in-world (357 s total) with 0 crashes, 0 nvlddmkm events, and 0 Victory errors.
  • Despite real host RAM pressure during world entry (Free RAM 373–482 MB, residency: host memory pressure active) alongside +3,054 newly translated shaders (12,262 -> 15,316), 0 a pass over the screen was waited stalls were logged; steady-state held 20.61 FPS (47.80 ms median, 70.15 ms p99).
  • 3 captured frames (+31 s, +151 s, +285 s) verified clean (no dropped full-screen pass flashes).

Caveat: combined 15-PR release build over a 5-minute opening/cell sequence; FreeCommit stayed above 6.4 GB, so hard Verdict::Commit saturation was not triggered during this run (covered by the 61 unit tests in pipeline::make / compilemem).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7311321170 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4471#issuecomment-7311321170). Originally posted by [nidea1](https://github.com/nidea1) on 2026-12-01T12:33:51Z. --- Live runtime verification on updated `WorkerBusyGuard` head `62b6e987` (RTX 3060 Ti 8 GB (ReBAR off, driver `621.40`), 32 GB RAM, Windows 11, Series S, DLSS Quality, FSR 3 FG, RT off, `VICTORY_SAMPLED_EVICT=1`, `VICTORY_WINDOW_GROW=1`, `VICTORY_POOL_SMALL=0`, `VICTORY_RIPE_BLOCKS=12` — 5-minute (`300 s` in-world, `357 s` total) live validation on a combined 15-PR release build over `origin/main` (`5fabb46eaf`).): - Completed full `300 s` in-world (`357 s` total) with **`0` crashes**, **`0` `nvlddmkm` events**, and **`0` Victory errors**. - Despite real host RAM pressure during world entry (`Free RAM 373–482 MB`, `residency: host memory pressure` active) alongside `+3,054` newly translated shaders (`12,262 -> 15,316`), **`0` `a pass over the screen was waited` stalls** were logged; steady-state held `20.61 FPS` (`47.80 ms` median, `70.15 ms` p99). - 3 captured frames (`+31 s`, `+151 s`, `+285 s`) verified clean (no dropped full-screen pass flashes). *Caveat:* combined 15-PR release build over a 5-minute opening/cell sequence; `FreeCommit` stayed above `6.4 GB`, so hard `Verdict::Commit` saturation was not triggered during this run (covered by the 61 unit tests in `pipeline::make` / `compilemem`).
trustno1-coder commented 2026-12-01 18:41:06 +00:00 (Migrated from github.com)

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


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:7321339714 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4471#issuecomment-7321339714). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:41:06Z. --- 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!4471
No description provided.