GPU: VICTORY_PIPELINE_WORKERS chooses how many workers make pipelines #3714

Open
rpmaster2 wants to merge 1 commit from upstream-pr/3714 into main
rpmaster2 commented 2026-11-28 10:43:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by rpmaster2 on 2026-11-28T10:43:04Z.


GPU: let VICTORY_PIPELINE_WORKERS choose how many workers make pipelines

The number of pipeline workers is fixed at build time: half the logical processors, 2 to 8. On a cold cache hundreds of pipelines are queued at once, and how many threads should make them is not the same on every machine — a 6-core part and a 32-thread part want different answers, and a user who is debugging a stall wants to try 1 and 16 without touching code. This adds an environment variable for it; the default does not change.

Provenance — this is not my code

worker_count and the variable are taken from Belobug/VIctory-Belobug-AMD, commit ffdde86 "Pipeline workers follow the CPU; one pad that never disconnects" (author local <local@localhost>, Co-Authored-By: Claude Opus 5.5 <[email protected]>), GPL-3.0-or-later, the same licence as here. That repository has since been deleted from GitHub; the hash and message above keep the origin checkable.

What I kept from it, and what I changed:

  • Kept verbatim: the body of worker_count (a value given is clamped to 1–64) and its test, with the expectations adjusted to the default below.
  • Adapted: their tree spawns the workers in a workers() function fed by a queue of their own; here the spawn happens inside queue()'s OnceLock, so the call sits there. I also added the pipeline workers log line.
  • Not ported: their default. They changed it from half of the logical processors, 2 to 8 to two thirds, 2 to 16, which changes behaviour for everyone on a cold cache. This PR keeps the existing default untouched and only adds the switch; if the maintainers want the higher default, it is a one-line change and I would send it separately, with measurements.

Behaviour

  • VICTORY_PIPELINE_WORKERS unset: exactly as today — (processors / 2).clamp(2, 8).
  • VICTORY_PIPELINE_WORKERS=1: one worker (all pipeline making on one thread, which is the interesting case when a stall is suspected).
  • Any value is clamped to 1–64; a value that is not a number is ignored, as unset.
  • The chosen number is logged once, at info, as pipeline workers.
  • Applies to pipelines only, the same threads as before, same priority (BELOW_NORMAL), same cache saving.

Numbers here, if useful

Ryzen 5 5600 (12 threads), RX 9070 XT: today's default is 6 workers; the fork runs 8 plus its 2 screen-only workers. I have not yet claimed that either is better — that is what the variable is for, and I will post a table (2 / 6 / 8 / 12 on a cold pipeline cache, same save) as a comment once it is run rather than guess.

How it was checked

  • cargo build --locked --profile diag -p victory --features diagnostics on Windows 11 26100, Rust 1.98.1;
  • cargo test --locked -p victory-gpu --lib worker_count: 1 passed, 0 failed, 232 filtered out — the test above;
  • one run with VICTORY_PIPELINE_WORKERS=1 on the RX 9070 XT, --console series-s: the log shows pipeline workers workers=1, and the effect is visible in the same run — dropped 1467/1693/1954 without a host pipeline per frame, against 100–300 at the default six workers on this 12-thread part. That is the knob doing what it says, not a claim that one is better.

Nothing changes when the variable is unset: the default is the same expression as today.

AI-assisted: written by DeepSeek (OpenCode harness) using the original commit's code and my run logs; no game files or paths.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5539291565 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3714). Originally posted by [rpmaster2](https://github.com/rpmaster2) on 2026-11-28T10:43:04Z. --- # GPU: let `VICTORY_PIPELINE_WORKERS` choose how many workers make pipelines The number of pipeline workers is fixed at build time: half the logical processors, 2 to 8. On a cold cache hundreds of pipelines are queued at once, and how many threads should make them is not the same on every machine — a 6-core part and a 32-thread part want different answers, and a user who is debugging a stall wants to try 1 and 16 without touching code. This adds an environment variable for it; the default does not change. ## Provenance — this is not my code `worker_count` and the variable are taken from `Belobug/VIctory-Belobug-AMD`, commit `ffdde86` "Pipeline workers follow the CPU; one pad that never disconnects" (author `local <local@localhost>`, `Co-Authored-By: Claude Opus 5.5 <[email protected]>`), GPL-3.0-or-later, the same licence as here. That repository has since been deleted from GitHub; the hash and message above keep the origin checkable. What I kept from it, and what I changed: - **Kept verbatim**: the body of `worker_count` (a value given is clamped to 1–64) and its test, with the expectations adjusted to the default below. - **Adapted**: their tree spawns the workers in a `workers()` function fed by a queue of their own; here the spawn happens inside `queue()`'s `OnceLock`, so the call sits there. I also added the `pipeline workers` log line. - **Not ported**: their default. They changed it from *half* of the logical processors, 2 to 8 to *two thirds*, 2 to 16, which changes behaviour for everyone on a cold cache. This PR keeps the existing default untouched and only adds the switch; if the maintainers want the higher default, it is a one-line change and I would send it separately, with measurements. ## Behaviour - `VICTORY_PIPELINE_WORKERS` unset: exactly as today — `(processors / 2).clamp(2, 8)`. - `VICTORY_PIPELINE_WORKERS=1`: one worker (all pipeline making on one thread, which is the interesting case when a stall is suspected). - Any value is clamped to 1–64; a value that is not a number is ignored, as unset. - The chosen number is logged once, at `info`, as `pipeline workers`. - Applies to pipelines only, the same threads as before, same priority (`BELOW_NORMAL`), same cache saving. ## Numbers here, if useful Ryzen 5 5600 (12 threads), RX 9070 XT: today's default is 6 workers; the fork runs 8 plus its 2 screen-only workers. I have not yet claimed that either is better — that is what the variable is for, and I will post a table (2 / 6 / 8 / 12 on a cold pipeline cache, same save) as a comment once it is run rather than guess. ## How it was checked - `cargo build --locked --profile diag -p victory --features diagnostics` on Windows 11 26100, Rust 1.98.1; - `cargo test --locked -p victory-gpu --lib worker_count`: 1 passed, 0 failed, 232 filtered out — the test above; - one run with `VICTORY_PIPELINE_WORKERS=1` on the RX 9070 XT, `--console series-s`: the log shows `pipeline workers workers=1`, and the effect is visible in the same run — `dropped 1467/1693/1954 without a host pipeline` per frame, against 100–300 at the default six workers on this 12-thread part. That is the knob doing what it says, not a claim that one is better. Nothing changes when the variable is unset: the default is the same expression as today. AI-assisted: written by DeepSeek (OpenCode harness) using the original commit's code and my run logs; no game files or paths.
cloph-dsp commented 2026-11-28 11:08:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-28T11:08:51Z.


Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):

  • PR #3714 at head 058c1abc5cb3a742857d7158eec6481c3e7fd488, base/parent 63bcca43c6a00a758510398fa43096ce7e4f7df0.
  • cargo test --locked -p victory-gpu --lib -- pipeline::make::tests::worker_count_follows_the_processors_and_the_switch --exact --test-threads=1 --quiet → 1 passed, 0 failed, 232 filtered, exit 0.
  • git grep -F for the test name on the base returned no match (test is new on this PR); git diff --check 63bcca4 HEAD clean (1 file, +27/-3).
  • Per-worktree CARGO_TARGET_DIR (never shared), CARGO_BUILD_JOBS=2. Only the named synthetic test was replayed; full workspace suite and clippy were not run locally.
  • GPU/driver: N/A (CPU-only worker-count test). No game data, assets, extracted shaders, DRM or decrypt involved.

AI-assisted (Hy4 flash).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7238357822 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3714#issuecomment-7238357822). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-28T11:08:51Z. --- Independent local verification (Windows, Rust 1.100.0/MSVC, no game data): - PR #3714 at head `058c1abc5cb3a742857d7158eec6481c3e7fd488`, base/parent `63bcca43c6a00a758510398fa43096ce7e4f7df0`. - `cargo test --locked -p victory-gpu --lib -- pipeline::make::tests::worker_count_follows_the_processors_and_the_switch --exact --test-threads=1 --quiet` → 1 passed, 0 failed, 232 filtered, exit 0. - `git grep -F` for the test name on the base returned no match (test is new on this PR); `git diff --check 63bcca4 HEAD` clean (1 file, +27/-3). - Per-worktree `CARGO_TARGET_DIR` (never shared), `CARGO_BUILD_JOBS=2`. Only the named synthetic test was replayed; full workspace suite and clippy were not run locally. - GPU/driver: N/A (CPU-only worker-count test). No game data, assets, extracted shaders, DRM or decrypt involved. AI-assisted (Hy4 flash).
rpmaster2 commented 2026-11-28 12:20:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by rpmaster2 on 2026-11-28T12:20:08Z.


Numbers from this card on the switch itself, so that nobody has to guess what it changes. RX 9070 XT, Ryzen 5 5600 (6 cores, 12 threads), --console series-s, warm pipeline library, three runs of 100 s each from the same restored save, only this variable differing:

VICTORY_PIPELINE_WORKERS first host pipelines all made mean draws dropped without a host pipeline
unset (6 here) about 1 s in 184
4 about 1 s in 325
12 about 1 s in not counted

Two honest readings of that:

  • With a warm library the count barely matters: every value reaches all made within a second, because nothing is compiled, only loaded; 4 workers is visibly worse than 6 (325 against 184 dropped draws a frame) and 12 I cannot judge, because that run sat on the loading screen at 8 draws a frame, where there is nothing to drop.
  • With a cold library or a stale early-start list it matters a lot: VICTORY_PIPELINE_WORKERS=1 gave dropped 1467/1693/1954 without a host pipeline per frame, against 100–300 at the default on this machine. That is the case the switch exists for.

So the default stays as it is; this is a knob for a cold cache, a smaller CPU, or a machine where the workers starve the title's own threads — not a free speed-up on a warm one.

AI-assisted: written by DeepSeek (OpenCode harness) from my run logs; numbers and versions only, no game files or paths.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7239155509 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3714#issuecomment-7239155509). Originally posted by [rpmaster2](https://github.com/rpmaster2) on 2026-11-28T12:20:08Z. --- Numbers from this card on the switch itself, so that nobody has to guess what it changes. RX 9070 XT, Ryzen 5 5600 (6 cores, 12 threads), `--console series-s`, warm pipeline library, three runs of 100 s each from the same restored save, only this variable differing: | `VICTORY_PIPELINE_WORKERS` | first `host pipelines all made` | mean draws dropped without a host pipeline | |---|---|---| | unset (6 here) | about 1 s in | 184 | | `4` | about 1 s in | **325** | | `12` | about 1 s in | not counted | Two honest readings of that: - With a **warm** library the count barely matters: every value reaches `all made` within a second, because nothing is compiled, only loaded; 4 workers is visibly worse than 6 (325 against 184 dropped draws a frame) and 12 I cannot judge, because that run sat on the loading screen at 8 draws a frame, where there is nothing to drop. - With a **cold** library or a stale early-start list it matters a lot: `VICTORY_PIPELINE_WORKERS=1` gave `dropped 1467/1693/1954 without a host pipeline` per frame, against 100–300 at the default on this machine. That is the case the switch exists for. So the default stays as it is; this is a knob for a cold cache, a smaller CPU, or a machine where the workers starve the title's own threads — not a free speed-up on a warm one. AI-assisted: written by DeepSeek (OpenCode harness) from my run logs; numbers and versions only, no game files or paths.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3714:upstream-pr/3714'
git switch 'upstream-pr/3714'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3714'
git switch 'upstream-pr/3714'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3714'
git switch 'upstream-pr/3714'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3714'
git switch 'main'
git merge --squash 'upstream-pr/3714'
git switch 'main'
git merge --ff-only 'upstream-pr/3714'
git switch 'main'
git merge 'upstream-pr/3714'
git push origin 'main'
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
Marvisak/VIctory!3714
No description provided.