Repository navigation
GPU: pipeline workers take their count from VICTORY_PIPELINE_THREADS - #2250
kotekompotek wants to merge 3 commits into
Conversation
On some host/driver pairs the driver's compiler is not safe to call from several threads at once: on AMD RDNA4 the amdxc64 compiler crashes while pipelines compile in parallel, and one worker avoids it. The variable sets the worker count (0 makes pipelines on the calling thread); unset, half the logical processors, 2 to 8, as before. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
A warning from the reporter side: one worker delays this crash but does not remove it, so please do not land this as the fix for #2124. I added the same knob locally while triaging #2124 and tested it before the bisect:
So serialising the workers shifts when it happens, not whether it happens. The bisect then found the actual trigger: The env var itself is still useful (it is what made the offline Also worth noting for the triage: a user on the fxceless fork with an RX 7900 XT (RDNA3) is reaching the prologue boat chase (#2248), while on RDNA4 the same fork dies in amdxc64 at startup - so this may be RDNA4-specific rather than "AMD". AI-assisted: written by DeepSeek (OpenCode harness) from my run logs; the hardware and the dump are mine. |
|
The offline command in #2124 has a separate worker pool. At 38e352c, the new environment variable is read by pipeline/make.rs::queue. The ordinary translate --pipelines path instead sizes its scoped workers in apps/victory/src/translate.rs from --jobs or available_parallelism; those workers call the shader host's pipeline methods directly. I added one trace at CLI worker entry and ran the Windows diagnostics binary twice against the same file containing four synthetic DXBC headers. With VICTORY_PIPELINE_THREADS=1, plain translate --pipelines started 4 distinct CLI workers. Adding --jobs 1 started 1. Both runs counted four containers; the fixtures had no programs, so this measures worker selection only. Please distinguish the runtime setting from the offline reproducer in the description. For a controlled single-CLI-worker comparison on this head, use victory translate --pipelines --jobs 1. This test makes no claim about the AMD driver outcome. AI-assisted validation. |
|
Verified on native Windows (no Wine): NVIDIA GeForce RTX 5090 (driver 621.24), Windows 11 10.0.26300, Rust 1.98.1, MSVC 14.44.35207, debug build. Both failures are the pre-existing ones on Tree restored afterwards; no game data. |
|
@Dathinel You are right, and thank you - the offline and runtime paths are different pools, and my earlier comment blurred them. To separate them explicitly:
I have edited nothing in the PR, but if the description still says the env "avoids the crash" for the offline reproducer, it should say "runtime only, and it delays rather than avoids" - which matches what I see. AI-assisted: written by DeepSeek (OpenCode harness) from my run logs; the hardware and the dump are mine. |
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):
cargo test -p victory-gpu --lib pipeline::make::— 2 passed, 0 failedcargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)
Clean VICTORY_PIPELINE_THREADS env override for pipeline worker thread count with safe fallback. Looks good.
AI-assisted (Gemini 4 Neon).
|
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head AI-assisted (Claude Code); no game data. |
catminou4
left a comment
There was a problem hiding this comment.
Pipeline workers take their count from VICTORY_PIPELINE_THREADS (0 = caller thread), default half the logical processors clamped 2-8. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Motivated by an AMD RDNA4 amdxc64 driver crash with parallel compiles — a real-world workaround worth documenting in the README too.
The issue's reproducer is offline: `translate --pipelines` crashed in amdxc64 on RDNA4, and translate sizes its own scoped workers by --jobs, so the env never reached it. An unset --jobs now falls to the same VICTORY_PIPELINE_THREADS the pipeline workers read (0 means one worker there, since translate cannot run without any), covering both paths with one setting. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Good catch — confirmed in the code: |
|
Automated triage for the maintainers. Merge candidate (small diagnostic knob). This adds The earlier needs-work points are fixed in Reply to @kotekompotek: thanks, I checked the rewording in the code and the README, and the description no longer closes #2124. Generated by Claude Code |
One worker serialises amdxc64 calls but the RDNA4 reporter's run still died with the same fault — the wording promised more than the knob does. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Additional motivation / A/B measurements for limiting pipeline worker threads (from #2752, closed in favor of this PR): Tested on Linux + Wine 11.22 + vkd3d-proton + NVIDIA RTX 3060 (8 GB VRAM, 16 GiB system RAM) in Series S mode (with #2112
Limiting pipeline compilation to 1 worker avoids the memory/compiler spikes under |
pipeline::make::queue previously spawned (cores / 2).clamp(2, 8) workers regardless of installed RAM. On 16 GiB systems with 8-16 logical threads, 4-8 concurrent shader translations and driver PSO compiles can exhaust Windows commit memory and trigger E_OUTOFMEMORY. Query GlobalMemoryStatusEx (Win32_System_SystemInformation is already enabled in victory-gpu) to cap the automatic default at 2 workers for <=18 GiB RAM and 4 workers for <=26 GiB RAM, leaving 32+ GiB hosts and failed queries unchanged at (cores / 2).clamp(2, 8). Complements Marvisak#2250 (manual VICTORY_PIPELINE_THREADS override).
fuzeofficlal
left a comment
There was a problem hiding this comment.
Verified ddcb7846c407fb751357ede8da93149aee8fe383 merged cleanly onto 63bcca43 on Windows 11 (Ryzen 9 9950X, 32 logical threads) with both an RTX 5090 (VICTORY_D3D12_DEBUG=1) and WARP (--features diagnostics, VICTORY_D3D12_DEBUG=1).
Code review
env_workers()/workers()(crates/victory-gpu/src/pipeline/make.rs:284-305, re-exported atcrates/victory-gpu/src/pipeline.rs:573) cleanly parseVICTORY_PIPELINE_THREADS, warn and fall back to(available_parallelism / 2).clamp(2, 8)on unparseable values, and let0fall into the existing synchronousworkers == 0fallback inqueue()(make.rs:247-270) with intactp.taken/WAITING/DONEsynchronization.thread_count()(apps/victory/src/translate.rs:159-162, wired at lines195and339) preserves--jobsprecedence overVICTORY_PIPELINE_THREADS, maps0to1so offline translation always has at least one worker, and falls back toavailable_parallelism()otherwise.README.md:190accurately documents the variable as a diagnostic knob covering both runtime pipeline workers and offlinetranslatewhen--jobsis unset.
Verification
cargo xtask policy:191 files ok.cargo clippy --locked -p victory-gpu -p victory --all-targets -- -D warnings(default and--all-features): clean.- RTX 5090 +
VICTORY_D3D12_DEBUG=1:pipeline::23 passed, 0 failed;cargo test --locked -p victory -- --test-threads=118 passed, 0 failed (includingtranslate_rejects_zero_workers). - WARP +
--features diagnostics+VICTORY_D3D12_DEBUG=1:pipeline::26 passed, 0 failed. - Live env runs on
pipeline::make::withVICTORY_PIPELINE_THREADS=0andVICTORY_PIPELINE_THREADS=1, plus additional unit probes exercisingenv_workers(),workers(), andthread_count()across unset,0,1,16, empty/whitespace, negative, non-numeric,usize-overflowing strings, and--jobsoverrides: all passed.
…nt from VICTORY_PIPELINE_THREADS
Summary
Diagnostic knob for #2124 (kept open — the real fix is deeper): AMD's shader compiler (
amdxc64.dll) crashes when several threads compile pipelines concurrently on RDNA4. The reporter found one worker delays rather than removes the crash, and bisected the trigger toc75fdba.VICTORY_PIPELINE_THREADSbounds that concurrency everywhere pipelines are made, useful for narrowing the trigger and for hosts that need serial compilation now:Runtime: the number of pipeline workers (
pipeline::make::queue).1serialises compilation;0makes pipelines on the calling thread, as when no worker can be spawned.Offline:
victory translatesizes its scoped workers by--jobs; when--jobsis unset it now falls to the same env value (0maps to one worker — translate cannot run with none), then toavailable_parallelism. An explicit--jobs Nstill wins.Unset: unchanged — runtime workers stay half the logical processors clamped to 2–8, translate stays
available_parallelism.Unparseable: warning, unchanged defaults.
Documented in the README env table as a diagnostic, not a workaround.
Test plan
cargo clippy -p victory-gpu -p victory --all-targets --locked -- -D warnings— cleancargo test -p victory-gpu --locked --lib pipeline— 16 passed--all-featuresclean,cargo test --workspace --locked701 passed / 0 failed / 10 ignoredRefs #2124