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

Merged
ghptc merged 1 commit from upstream-pr/1084 into main 2026-11-29 08:16:57 +00:00
ghptc commented 2026-11-28 13:00:13 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ghptc on 2026-11-28T13:00:13Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5540366044 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1084). Originally posted by [ghptc](https://github.com/ghptc) on 2026-11-28T13:00:13Z. --- 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.
ghptc commented 2026-11-28 13:22:58 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ghptc on 2026-11-28T13:22:58Z.


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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7239895839 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1084#issuecomment-7239895839). Originally posted by [ghptc](https://github.com/ghptc) on 2026-11-28T13:22:58Z. --- 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)
Exopus-0x65f7ad0 commented 2026-11-28 15:13:08 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Exopus-0x65f7ad0 on 2026-11-28T15:13:08Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7241295478 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1084#issuecomment-7241295478). Originally posted by [Exopus-0x65f7ad0](https://github.com/Exopus-0x65f7ad0) on 2026-11-28T15:13:08Z. --- 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**.
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!1084
No description provided.