Bound preload library workers by the number of eligible pipelines #1084

Manually merged
github merged 1 commit from github-bot/gh-1084 into main 2026-11-29 08:22:00 +00:00 AGit
Owner

@⁠ghptc on GitHub · 2026-11-28 13:00 UTC · original
ghptc:fix/preload-library-worker-count → main · +19 −1 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC

The final stage of victory preload spawns a worker for every requested job. When empty partitions enter known::make, each worker first indexes the recorded shaders. An empty early/slow list therefore creates workers with no work. A three-pipeline list with 64 requested jobs assigns an empty partition to 61 workers.

Cap the worker count at the eligible pipeline count after applying the existing default and minimum. This preserves the current partition order and job selection. An empty list runs the loop zero times. The regression exercises 64 jobs with zero or three eligible pipelines, two jobs with nine, and a zero request with work available.

Reproduction and results

Use a new empty scratch directory outside the repo, with an empty input directory and fresh cache and data directories. Set VICTORY_GAME_DIR to the empty directory, and set VICTORY_CACHE_DIR and VICTORY_DATA_DIR to separate scratch directories. With Windows builds from before and after this change, run:

victory.exe preload --jobs 8 empty

The pre-change executable reported 0 shaders, 0 eligible pipelines, 8 library threads and successful completion. The patched executable reported 0 shaders, 0 eligible pipelines, 0 library threads and successful completion. The isolated branch's Windows-target unit test passed under Proton.

cargo test --release --locked -p victory --bin victory warm::tests::library_workers_each_have_a_pipeline -- --exact

The measured result is the number of workers for the empty list. RSS savings for populated preload caches and gameplay performance were not measured. The existing preload job-selection work in #382 changes the CLI setting. This patch is confined to the final library worker count.

**@⁠ghptc** on GitHub · 2026-11-28 13:00 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1084) `ghptc:fix/preload-library-worker-count` → `main` · +19 −1 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC The final stage of `victory preload` spawns a worker for every requested job. When empty partitions enter `known::make`, each worker first indexes the recorded shaders. An empty early/slow list therefore creates workers with no work. A three-pipeline list with 64 requested jobs assigns an empty partition to 61 workers. Cap the worker count at the eligible pipeline count after applying the existing default and minimum. This preserves the current partition order and job selection. An empty list runs the loop zero times. The regression exercises 64 jobs with zero or three eligible pipelines, two jobs with nine, and a zero request with work available. ### Reproduction and results Use a new empty scratch directory outside the repo, with an empty input directory and fresh cache and data directories. Set VICTORY_GAME_DIR to the empty directory, and set VICTORY_CACHE_DIR and VICTORY_DATA_DIR to separate scratch directories. With Windows builds from before and after this change, run: ```text victory.exe preload --jobs 8 empty ``` The pre-change executable reported 0 shaders, 0 eligible pipelines, 8 library threads and successful completion. The patched executable reported 0 shaders, 0 eligible pipelines, 0 library threads and successful completion. The isolated branch's Windows-target unit test passed under Proton. ```text cargo test --release --locked -p victory --bin victory warm::tests::library_workers_each_have_a_pipeline -- --exact ``` The measured result is the number of workers for the empty list. RSS savings for populated preload caches and gameplay performance were not measured. The existing preload job-selection work in #382 changes the CLI setting. This patch is confined to the final library worker count.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:32:43 +00:00
Author
Owner

@⁠ghptc on GitHub · 2026-11-28 13:22 UTC · original

Windows Clippy reported the same two diagnostics on this PR and its exact upstream base, 63b902f: let_and_return in shader emission and manual_is_multiple_of in the shadow worker. With #957 applied locally to 59bded6, both locked workspace Clippy checks passed for Windows MSVC on Rust 1.98.1, including --all-features, with -D warnings. Upstream CI log

**@⁠ghptc** on GitHub · 2026-11-28 13:22 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1084#issuecomment-7239895839) Windows Clippy reported the same two diagnostics on this PR and its exact upstream base, `63b902f`: `let_and_return` in shader emission and `manual_is_multiple_of` in the shadow worker. With #957 applied locally to `59bded6`, both locked workspace Clippy checks passed for Windows MSVC on Rust 1.98.1, including `--all-features`, with `-D warnings`. [Upstream CI log](https://github.com/trustno1-coder/VIctory-NVIDIA/actions/runs/46104876336/job/140855261577)
Author
Owner

@⁠Exopus-0x65f7ad0 on GitHub · 2026-11-28 15:13 UTC · original

Native Windows run of the regression (the PR ran it under Proton): native Windows 11 26300 (MSVC toolchain, Rust 1.98.1), RTX 5060 Ti; 63b902f + this PR.

cargo test --release --locked -p victory --bin victory warm::tests::library_workers_each_have_a_pipeline -- --exact → passed.

**@⁠Exopus-0x65f7ad0** on GitHub · 2026-11-28 15:13 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1084#issuecomment-7241295478) Native Windows run of the regression (the PR ran it under Proton): native Windows 11 26300 (MSVC toolchain, Rust 1.98.1), RTX 5060 Ti; `63b902f` + this PR. `cargo test --release --locked -p victory --bin victory warm::tests::library_workers_each_have_a_pipeline -- --exact` → **passed**.
github manually merged commit daec943a4d into main 2026-11-29 08:22:00 +00:00
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!1084
No description provided.