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

Closed
nidea1 wants to merge 2 commits from upstream-pr/4410 into main
nidea1 commented 2026-11-30 19:57:29 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-11-30T19:57:29Z.


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).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5572719762 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4410). Originally posted by [nidea1](https://github.com/nidea1) on 2026-11-30T19:57:29Z. --- 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).
andrewpozdnakov7-jpg commented 2026-12-01 10:27:50 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-12-01T10:27:50Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7308226684 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4410#issuecomment-7308226684). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-12-01T10:27:50Z. --- 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.
nidea1 commented 2026-12-01 10:56:18 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-12-01T10:56:18Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7308939230 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4410#issuecomment-7308939230). Originally posted by [nidea1](https://github.com/nidea1) on 2026-12-01T10:56:18Z. --- 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`.
trustno1-coder commented 2026-12-01 18:41:53 +00:00 (Migrated from github.com)

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


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