GPU: allow configuring pipeline worker count via VICTORY_PIPELINE_WORKERS #2752

Closed
github-bot wants to merge 1 commit from gh-pr/2752/head into gh-pr/2752/base
Owner

@⁠0xKaji on GitHub · 2026-11-25 19:40 UTC · original
0xKaji:feat/pipeline-workers → main · +26 −3 · 1 files · 1 commits · closed without merging

Adds an optional VICTORY_PIPELINE_WORKERS environment variable (clamped to 1..=16) to override the default pipeline worker thread count ((cpus / 2).clamp(2, 8)) in crates/victory-gpu/src/pipeline/make.rs.

Motivation

  • Helps #2124 (single-thread pipeline compilation workaround on AMD RDNA4).
  • Significantly reduces peak memory pressure and avoids NVIDIA shader-compiler crashes/kills (exit=137) on 16 GiB RAM systems under Linux + Wine + vkd3d-proton when entering the world.

A/B Measurements (Linux / Wine 11.22 / vkd3d-proton / RTX 3060 8 GB / 16 GiB RAM, Series S + #2112 + #2723, 4-min run)

VICTORY_PIPELINE_WORKERS Outcome Time Peak RSS
Default (8) exit=137 ~60 s 11.20 GiB
2 exit=137 ~72 s 10.14 GiB
1 exit=124 (full 4 min) 240 s 8.51 GiB (~4.9 GiB available)

Verification

  • Added unit test worker_count_respects_override_and_clamps.
  • Verified with cargo xwin check --workspace --target x86_64-pc-windows-msvc --locked and cargo xwin test -p victory-gpu --no-run --target x86_64-pc-windows-msvc --locked.
**@⁠0xKaji** on GitHub · 2026-11-25 19:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/2752) `0xKaji:feat/pipeline-workers` → `main` · +26 −3 · 1 files · 1 commits · closed without merging Adds an optional `VICTORY_PIPELINE_WORKERS` environment variable (clamped to `1..=16`) to override the default pipeline worker thread count (`(cpus / 2).clamp(2, 8)`) in `crates/victory-gpu/src/pipeline/make.rs`. ### Motivation - Helps #2124 (single-thread pipeline compilation workaround on AMD RDNA4). - Significantly reduces peak memory pressure and avoids NVIDIA shader-compiler crashes/kills (`exit=137`) on 16 GiB RAM systems under Linux + Wine + vkd3d-proton when entering the world. ### A/B Measurements (Linux / Wine 11.22 / vkd3d-proton / RTX 3060 8 GB / 16 GiB RAM, Series S + #2112 + #2723, 4-min run) | `VICTORY_PIPELINE_WORKERS` | Outcome | Time | Peak RSS | |---|---|---|---| | Default (`8`) | `exit=137` | ~60 s | 11.20 GiB | | `2` | `exit=137` | ~72 s | 10.14 GiB | | `1` | **`exit=124` (full 4 min)** | 240 s | **8.51 GiB** (~4.9 GiB available) | ### Verification - Added unit test `worker_count_respects_override_and_clamps`. - Verified with `cargo xwin check --workspace --target x86_64-pc-windows-msvc --locked` and `cargo xwin test -p victory-gpu --no-run --target x86_64-pc-windows-msvc --locked`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:13:23 +00:00
github-bot closed this pull request 2026-11-26 05:13:23 +00:00
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 20:03 UTC · original

Heads up: this overlaps #2250 (VICTORY_PIPELINE_THREADS), which the maintainer triage already marked merge-candidate. Differences: #2250 also applies the knob to worker count when --jobs isn't given, and its 0 value selects calling-thread compilation (the strongest workaround for the amdxc64 crash in #2124) - your 1..=16 clamp silently maps 0 to 1, losing that diagnostic. The A/B data here (peak RSS vs workers, exit=137 on 16 GiB under vkd3d) is genuinely useful extra motivation either PR could cite. Whichever lands, it may be worth keeping the 0=synchronous semantics.

**@⁠kotekompotek** on GitHub · 2026-11-25 20:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/2752#issuecomment-7173117517) Heads up: this overlaps #2250 (VICTORY_PIPELINE_THREADS), which the maintainer triage already marked merge-candidate. Differences: #2250 also applies the knob to worker count when --jobs isn't given, and its 0 value selects calling-thread compilation (the strongest workaround for the amdxc64 crash in #2124) - your 1..=16 clamp silently maps 0 to 1, losing that diagnostic. The A/B data here (peak RSS vs workers, exit=137 on 16 GiB under vkd3d) is genuinely useful extra motivation either PR could cite. Whichever lands, it may be worth keeping the 0=synchronous semantics.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 20:14 UTC · original

Reviewed and verified ab8d3768 on Windows 11 against main (13f91ca).

Code review & overlap note

  • worker_count preserves the default (cpus / 2).clamp(2, 8) when unset or unparseable and clamps parsed overrides into 1..=16 (avoiding thread-count explosion on huge inputs like "100000"). Minor note: invalid or out-of-range values are clamped/ignored silently without a tracing::warn!.
  • Overlap with #2250 (already triage: merge candidate, VICTORY_PIPELINE_THREADS): both configure pipeline::make::queue worker threads, with a behavioral difference on 0 (#2250 uses 0 for synchronous/calling-thread compilation, whereas #2752 clamps 0 to 1). Worth coordinating env-var naming and 0 semantics with #2250.

Verification (Windows 11, rustc 1.98.1 MSVC)

  • VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --lib --locked -- pipeline::: 17 passed, 0 failed (including worker_count_respects_override_and_clamps).
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: 0 warnings; cargo xtask policy: 184 files ok; clean git merge-tree against 13f91ca and #2746.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 20:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2752#issuecomment-7173381867) Reviewed and verified `ab8d3768` on Windows 11 against `main` (`13f91ca`). ### Code review & overlap note - `worker_count` preserves the default `(cpus / 2).clamp(2, 8)` when unset or unparseable and clamps parsed overrides into `1..=16` (avoiding thread-count explosion on huge inputs like `"100000"`). Minor note: invalid or out-of-range values are clamped/ignored silently without a `tracing::warn!`. - **Overlap with `#2250`** (already `triage: merge candidate`, `VICTORY_PIPELINE_THREADS`): both configure `pipeline::make::queue` worker threads, with a behavioral difference on `0` (`#2250` uses `0` for synchronous/calling-thread compilation, whereas `#2752` clamps `0` to `1`). Worth coordinating env-var naming and `0` semantics with `#2250`. ### Verification (Windows 11, `rustc 1.98.1` MSVC) - `VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --lib --locked -- pipeline::`: **17 passed, 0 failed** (including `worker_count_respects_override_and_clamps`). - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings`: **0 warnings**; `cargo xtask policy`: **184 files ok**; clean `git merge-tree` against `13f91ca` and `#2746`.
Author
Owner

@⁠0xKaji on GitHub · 2026-11-25 20:23 UTC · original

Thanks @⁠kotekompotek and @⁠fuzeofficlal for the review and the heads-up! Closing this PR in favor of #2250 (VICTORY_PIPELINE_THREADS), and I've posted the 16 GiB / NVIDIA A/B measurements there.

**@⁠0xKaji** on GitHub · 2026-11-25 20:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2752#issuecomment-7173602090) Thanks @⁠kotekompotek and @⁠fuzeofficlal for the review and the heads-up! Closing this PR in favor of #2250 (`VICTORY_PIPELINE_THREADS`), and I've posted the 16 GiB / NVIDIA A/B measurements there.

Pull request closed

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/Marvisak--VIctory!2752
No description provided.