Skip to content

Pipelines: VICTORY_PIPELINE_WORKERS sets the worker count - #1728

Closed
npanu420 wants to merge 1 commit into
Marvisak:mainfrom
npanu420:pipeline/worker-count
Closed

npanu420 wants to merge 1 commit into
Marvisak:mainfrom
npanu420:pipeline/worker-count

Conversation

@npanu420

Copy link
Copy Markdown
Contributor

What

VICTORY_PIPELINE_WORKERS=n sets the number of host pipeline workers (1 to 64). Without it nothing changes: half the logical processors, 2 to 8. The count is logged (host pipeline workers).

Why

On a first run with an empty pipeline library, the world's pipelines are compiled by the driver on these workers, and draws whose pipeline is not made yet are dropped. On NVIDIA the largest world programs take seconds each. Same machine, same scene (i9-9900X with 20 threads, RTX 3070, Windows 11):

Workers Pipelines made per minute while the queue drained
8 (default) 542 → 106 → 42 → 22 over four minutes (the queue grew to 1,228)
16 109 → 150 per minute; the queue (2,175 at launch, half loaded from the library) emptied before the world started

The two runs did not start from the same library state, so the rates are an indication, not a clean A/B. The CPU stayed below 80 % with 16 workers. CPUs with more threads than 16 may want more, and CPUs with fewer may want less while the title loads.

Changes

  • worker_count(asked, processors) reads the switch, clamped to 1-64, else keeps the default.
  • Test worker_count_takes_the_switch_within_bounds.

Verification

cargo test -p victory-gpu --lib worker_count
cargo clippy -p victory-gpu --all-targets --locked -- -D warnings
cargo xtask policy

No game data is used or committed. AI-assisted (Claude Code).

🤖 Generated with Claude Code

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review only: this crate is Windows-only (D3D12/windows_sys/Win32) — nothing compiles or runs on macOS; source review of the diff.

VICTORY_PIPELINE_WORKERS: default half the logical processors clamped to 2-8, env override clamped 1-64, parse failures fall back to default. worker_count has a unit test (worker_count_takes_the_switch_within_bounds) but victory-gpu is Windows-only so it only runs there. Rationale (driver compile of the world's largest programs bounds first run with empty library) is documented. Fine.

With an empty pipeline library the driver's compile of the world's largest
programs bounds the first run. On a 20-thread CPU (i9-9900X, RTX 3070),
16 workers emptied the queue about four times as fast as the default 8.
The default is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@npanu420
npanu420 force-pushed the pipeline/worker-count branch from ba04947 to 463e835 Compare November 24, 2026 22:05
nazmi added a commit to nazmi/VIctory that referenced this pull request Nov 24, 2026
…arvisak#1728)

Re-applying 16a5924: the merge kept upstream's hardcoded 'half the
processors, 2 to 8', so the world's first run could not be given more
workers on a big CPU. The count is now overridable (1 to 64, clamped and
logged), with the bounds test.
nazmi added a commit to nazmi/VIctory that referenced this pull request Nov 24, 2026
Three review workers over ~30 PRs against the freshly merged upstream tree,
plus three of our features the merge had discarded, re-applied with their
tests: f32_to_half NaN/nearest-even (Marvisak#843), unique-temp atomic library
writes (Marvisak#1660), VICTORY_PIPELINE_WORKERS (Marvisak#1728).

Integrated: Marvisak#1146, Marvisak#1161, Marvisak#1474, Marvisak#1592, Marvisak#1058, Marvisak#1505, Marvisak#1177, Marvisak#1507, Marvisak#1236,
Marvisak#1180 (with a new regression test for the cached opcode name).
Duplicates confirmed against upstream's own code: Marvisak#957, Marvisak#1103, Marvisak#1057, Marvisak#299.
Obsolete: Marvisak#513 (title_args no longer exists), Marvisak#1507's sibling Marvisak#334 covers it.
Refused: Marvisak#1030 (zip dump of game data), Marvisak#962 (deletes .gitignore).

Verified before this merge: fmt 0 differing, both Clippy gates exit 0,
xtask policy 220 files ok, workspace 662 passed / 0 failed (10 GPU tests
skipped that fail identically on upstream/main itself on this host).
nazmi added a commit to nazmi/VIctory that referenced this pull request Nov 24, 2026
Review workers over ~45 more PRs against the merged upstream tree.

Integrated: Marvisak#1394 (antisymmetric XUserCompare), Marvisak#1390 (A8_UNORM is not in
the R8 typeless family), Marvisak#1499 (deep 3D mips stay out of the thick tail,
plus a regression test the PR lacked), Marvisak#1366 (mesh stage I/O does not parse
VS inputs), Marvisak#1594 (the title's exit status reaches the shell), Marvisak#1299 (docs:
validator prerequisite), Marvisak#1515 (dialog commands before init), Marvisak#1424 (empty
submissions skip the lock), Marvisak#1144 (shader differential skips are reported),
Marvisak#1129 (64 MB pipeline-worker stacks), Marvisak#1564/Marvisak#1565/Marvisak#1566 (MakeResident,
Evict and SetStablePowerState succeed as the console's do), Marvisak#1250 (a zero
element count reads to the end of the buffer), Marvisak#1628 (texture-creation
failure logs its states).

Re-applied after the upstream merge dropped them: f32_to_half NaN and
ties-to-even (Marvisak#843), unique-temp library writes (Marvisak#1660),
VICTORY_PIPELINE_WORKERS (Marvisak#1728), VICTORY_MODE (Marvisak#1701).

Removed: the orphaned depth-bounds test file, whose implementation
(9a6d9e6) the merge dropped and which no module compiled.

Refused: Marvisak#1099 (writing 0 for an unpaired p1 interpolation computes wrong
values; two reviewers upstream and one here reached the same conclusion).
Duplicates: Marvisak#1217, Marvisak#529, Marvisak#531, Marvisak#590, Marvisak#1102, Marvisak#398, Marvisak#1150, Marvisak#1220.

Gate at efda2c5: fmt 0 differing, both Clippy gates 0 errors, policy 219
files, workspace 674 passed / 0 failed with the 10 documented pre-existing
GPU skips.
devin-ai-integration Bot referenced this pull request in Personed/Bored Nov 24, 2026
Port upstream #1505 and #1728: workers no longer run below the title's priority, where busy world threads starved them, and VICTORY_PIPELINE_WORKERS can raise the worker count on many-core Linux/Windows hosts.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Personed referenced this pull request in Personed/Bored Nov 25, 2026
…ty-wave

* GPU: copy shader writes into write-watched pages under Wine

Port upstream #1831: when WriteProcessMemory/NtWriteVirtualMemory refuses an untouched MEM_WRITE_WATCH page under Wine, use the kernel read path into that destination so copy-back still lands.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* GPU: load cached pipelines outside the library lock

Port the Wine part of upstream #1722. vkd3d-proton treats a library load as a full compile, so holding the global library lock serialised all workers. Loads of different names can now overlap; same-name loads remain serialised as D3D12 requires.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* GPU: drop unready indirect calls before the argument clamp

Port upstream #1635: a call whose host pipeline is not ready cannot run, so do not refresh and clamp records that nothing will read.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* GPU: run indirect mesh dispatches as one-record ExecuteIndirect

Port upstream #1749: DispatchMeshX with group counts in GPU memory now uses the host indirect mesh path instead of being dropped.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Shaders: leave runaway translated loops after 2^14 iterations

Port upstream #1819. The previous 2^20 limit could outlast a driver reset; 2^14 bounds runaway loops to milliseconds per wave while VICTORY_SHADER_LOOP_LIMIT remains an override.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Input: keep the keyboard stand-in while XInput pads are idle

Port upstream #1430: virtual or untouched controllers no longer disable keyboard controls; real input outside the XInput deadzones takes over, and fallback keys regain control once host pads are idle.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* GPU: keep pipeline workers competitive and configurable

Port upstream #1505 and #1728: workers no longer run below the title's priority, where busy world threads starved them, and VICTORY_PIPELINE_WORKERS can raise the worker count on many-core Linux/Windows hosts.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: stoltembergg <stoltembergg@gmail.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. worker_count in pipeline/make.rs keeps the old default (half the logical processors, 2 to 8, and 2 when the count is unknown); VICTORY_PIPELINE_WORKERS overrides it, clamped to 1-64, and the count is logged once. The test covers the default, the clamps and an unparsable value. It only reads an environment variable and changes the thread count. Suggestion: add a row to the README switch table. #1861 also adds this switch, so only one should land. CI has not run (it needs approval).


Generated by Claude Code

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
@Marvisak

Copy link
Copy Markdown
Owner

Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing as the narrower of two duplicates. #2250 adds the same switch for the runtime workers and for victory translate's worker pool, with a README row, and the two conflict in make.rs. Whether such a switch goes in will be decided on #2250.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

@Marvisak Marvisak closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants