warm: name pipeline library worker threads so preload does not drop pipelines under soft RAM throttle #4411

Closed
github-bot wants to merge 2 commits from github-bot/gh-4410 into main AGit
Owner

@⁠nidea1 on GitHub · 2026-11-30 19:57 UTC · original
nidea1:fix/warm-library-worker-threads → main · +51 −6 · 1 files · 2 commits · closed without merging

Related: #3648

What it changes

warm::into_library (the final step of victory preload) and warm::fill_library (VICTORY_WARM_SHARED=1) spawned unnamed scoped worker threads (s.spawn(...)) to compile early and slow pipelines into host-pipelines.bin.

Inside victory_gpu::compilemem::begin, pipeline worker threads are recognized by the "victory-pipelines-" thread-name prefix. Because warm's scoped worker threads were unnamed:

  • compilemem::begin treated them as foreground title threads (!worker, WAIT_OTHER = 1 s, impatient = true).
  • Whenever free physical RAM dipped near the soft physical floor (Verdict::Throttle, even with ~80 GB of commit remaining), compiles serialized one at a time and any waiting worker that waited longer than 1 s was refused with E_OUTOFMEMORY (0x8007000E).
  • Unlike in-game pipeline::make (which retries deferred pipelines after RETRY_AFTER_MS), offline warm::into_library / fill_library tries each pipeline once — so every deferred compile was permanently omitted from host-pipelines.bin and had to be rebuilt on the next game launch.

Fix (apps/victory/src/warm.rs):

  • Add library_worker_name and spawn_library_worker naming scoped worker threads "victory-pipelines-warm-{index}" in both fill_library and into_library, matching compilemem::begin's "victory-pipelines-" prefix so offline workers pace patiently under Verdict::Throttle while still respecting the hard commit floor (Verdict::Refuse).
  • Add unit test warm::tests::library_workers_use_the_pipeline_worker_thread_name_prefix.

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): Windows 11 x64, RTX 3060 Ti 8 GB, 32 GB RAM, Series S profile defaults (victory preload --used in an isolated temporary VICTORY_CACHE_DIR).
  • Before: victory preload --used stored 4,095 of 4,212 pipelines in host-pipelines.bin, with 117 put off after waiting under Verdict::Throttle (free_physical_mb ~1,127–1,208 MB, ~80 GB commit free) and 117 memguard refusal warnings.
  • After: victory preload --used stored 4,211 of 4,212 pipelines in host-pipelines.bin, with 0 put off after waiting (1,101 waited to start, 0 memguard warnings; the single remaining pipeline returned a direct driver E_OUTOFMEMORY after ~5.5 s).
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A.
  • cargo test passed for the crates it touches: yes (cargo test -j 4 -p victory --locked: 92/92 unit + 3/3 integration tests passed; cargo clippy -j 4 -p victory --all-targets --locked --no-deps -- -D warnings: 0 warnings; cargo run -p xtask -- policy --staged: 1 files ok).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #3648 (keeps compilemem deferrals local to each PSO creation attempt in victory-gpu; does not touch apps/victory/src/warm.rs or worker thread naming).
**@⁠nidea1** on GitHub · 2026-11-30 19:57 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4410) `nidea1:fix/warm-library-worker-threads` → `main` · +51 −6 · 1 files · 2 commits · closed without merging Related: #3648 ## What it changes `warm::into_library` (the final step of `victory preload`) and `warm::fill_library` (`VICTORY_WARM_SHARED=1`) spawned unnamed scoped worker threads (`s.spawn(...)`) to compile early and slow pipelines into `host-pipelines.bin`. Inside `victory_gpu::compilemem::begin`, pipeline worker threads are recognized by the `"victory-pipelines-"` thread-name prefix. Because `warm`'s scoped worker threads were unnamed: - `compilemem::begin` treated them as foreground title threads (`!worker`, `WAIT_OTHER = 1 s`, `impatient = true`). - Whenever free physical RAM dipped near the soft physical floor (`Verdict::Throttle`, even with ~80 GB of commit remaining), compiles serialized one at a time and any waiting worker that waited longer than 1 s was refused with `E_OUTOFMEMORY` (`0x8007000E`). - Unlike in-game `pipeline::make` (which retries deferred pipelines after `RETRY_AFTER_MS`), offline `warm::into_library` / `fill_library` tries each pipeline once — so every deferred compile was permanently omitted from `host-pipelines.bin` and had to be rebuilt on the next game launch. Fix (`apps/victory/src/warm.rs`): - Add `library_worker_name` and `spawn_library_worker` naming scoped worker threads `"victory-pipelines-warm-{index}"` in both `fill_library` and `into_library`, matching `compilemem::begin`'s `"victory-pipelines-"` prefix so offline workers pace patiently under `Verdict::Throttle` while still respecting the hard commit floor (`Verdict::Refuse`). - Add unit test `warm::tests::library_workers_use_the_pipeline_worker_thread_name_prefix`. ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): Windows 11 x64, RTX 3060 Ti 8 GB, 32 GB RAM, Series S profile defaults (`victory preload --used` in an isolated temporary `VICTORY_CACHE_DIR`). - Before: `victory preload --used` stored **4,095 of 4,212** pipelines in `host-pipelines.bin`, with **117 put off after waiting** under `Verdict::Throttle` (`free_physical_mb` ~1,127–1,208 MB, ~80 GB commit free) and 117 `memguard` refusal warnings. - After: `victory preload --used` stored **4,211 of 4,212** pipelines in `host-pipelines.bin`, with **0 put off after waiting** (`1,101 waited to start`, 0 `memguard` warnings; the single remaining pipeline returned a direct driver `E_OUTOFMEMORY` after ~5.5 s). - For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A. - `cargo test` passed for the crates it touches: yes (`cargo test -j 4 -p victory --locked`: 92/92 unit + 3/3 integration tests passed; `cargo clippy -j 4 -p victory --all-targets --locked --no-deps -- -D warnings`: 0 warnings; `cargo run -p xtask -- policy --staged`: 1 files ok). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #3648 (keeps compilemem deferrals local to each PSO creation attempt in `victory-gpu`; does not touch `apps/victory/src/warm.rs` or worker thread naming).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 20:02:34 +00:00
github-bot force-pushed github-bot/gh-4410 from 36e67edecd to 2dc298e45a 2026-12-01 03:10:32 +00:00 Compare
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-12-01 10:27 UTC · original

On 2dc298e4, a later named worker can fail to start after an earlier worker has already completed pipelines. The scoped workers are joined, then the error is returned before the final library save or the remaining shared-mode marks.

c02051614c38c8a76f9b97efc8a9521f9a1e5ba1 moves the error check after the existing save in both into_library and fill_library. It still returns the original worker error without printing a successful completion. Review commit

I ran the exact author and follow-up functions with a fake two-worker setup in which only the second spawn fails. The first worker completed one pipeline in each mode. The author head saved zero; the follow-up saved one and still returned the worker failure. Shared mode also wrote the first worker's mark. This exercise stubbed out D3D12, and the one-file staged policy passed.

Please keep the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change in.

AI-assisted with OpenAI Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-12-01 10:27 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4410#issuecomment-7308226684) On `2dc298e4`, a later named worker can fail to start after an earlier worker has already completed pipelines. The scoped workers are joined, then the error is returned before the final library save or the remaining shared-mode marks. c02051614c38c8a76f9b97efc8a9521f9a1e5ba1 moves the error check after the existing save in both `into_library` and `fill_library`. It still returns the original worker error without printing a successful completion. [Review commit](https://github.com/andrewpozdnakov7-jpg/VIctory-NVIDIA/commit/c02051614c38c8a76f9b97efc8a9521f9a1e5ba1) I ran the exact author and follow-up functions with a fake two-worker setup in which only the second spawn fails. The first worker completed one pipeline in each mode. The author head saved zero; the follow-up saved one and still returned the worker failure. Shared mode also wrote the first worker's mark. This exercise stubbed out D3D12, and the one-file staged policy passed. Please keep the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change in. AI-assisted with OpenAI Codex.
Author
Owner

@⁠nidea1 on GitHub · 2026-12-01 10:56 UTC · original

Thanks @⁠andrewpozdnakov7-jpg! Cherry-picked onto this branch as 60028f8a90 (from c02051614c) with your original Git author preserved. Verified flush() and known::keep_library() handle partial/empty worker progress safely before propagating workers? without printing the completion summary, along with cargo test --locked -p victory, cargo clippy --locked -p victory --all-targets -- -D warnings, and cargo xtask policy.

**@⁠nidea1** on GitHub · 2026-12-01 10:56 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4410#issuecomment-7308939230) Thanks @⁠andrewpozdnakov7-jpg! Cherry-picked onto this branch as 60028f8a90abd0250a66aff7d224507741aeda8e (from `c02051614c`) with your original Git author preserved. Verified `flush()` and `known::keep_library()` handle partial/empty worker progress safely before propagating `workers?` without printing the completion summary, along with `cargo test --locked -p victory`, `cargo clippy --locked -p victory --all-targets -- -D warnings`, and `cargo xtask policy`.
github-bot closed this pull request 2026-12-01 18:43:42 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:41 UTC · original

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.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:41 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4410#issuecomment-7321367058) 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

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