GPU: pipeline workers take their count from VICTORY_PIPELINE_THREADS #2250
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2250
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2250"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@kotekompotek on GitHub · 2026-11-25 08:51 UTC · original
kotekompotek:gpu/pipeline-threads-env→main· +52 −7 · 4 files · 3 commits · openSummary
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
@rpmaster2 on GitHub · 2026-11-25 08:54 UTC · original
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:
VICTORY_PIPELINE_THREADS=1,main@940d32f, diag build,--console series-x: 420 s with no exception (2,608 draws/frame) - which looked like a fix;0xc0000005 at amdxc64.dll+0x861b9f, at 1,710 draws/frame.So serialising the workers shifts when it happens, not whether it happens. The bisect then found the actual trigger:
c75fdba("GPU: views the shaders pick from the heap, and one change journal for title memory") - its parent4f57f46runs clean, andc75fdbadies at 14 draws/frame. Full details in #2124.The env var itself is still useful (it is what made the offline
translate --pipelinesreproducer think it had passed once, and people will want to try it), but the description claiming "avoids the crash" should say "delays it" at most, or the workaround gets credited with a fix it does not provide.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.
@Dathinel on GitHub · 2026-11-25 08:55 UTC · original
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.
@dcastell1 on GitHub · 2026-11-25 08:56 UTC · original
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.
940d32f6is your base and it is what this box has.Both failures are the pre-existing ones on
940d32f6on this box, not this PR:descriptor::host::tests::dynamic_slots_are_held_until_released(host.rs:1486,NumDescriptors >= HEAP_VIEWS) andmemory::tests::lists_share_a_table_and_copies_keep_their_views(memory.rs:673, "past the dynamic slots"). Both are the 1,000,000-descriptor cap reported in #1760; the baseline gives the same two. Nothing else moves: taking the worker count fromVICTORY_PIPELINE_WORKERSchanges no verdict here.Tree restored afterwards; no game data.
@rpmaster2 on GitHub · 2026-11-25 08:57 UTC · original · edited 2026-11-25 08:59 UTC
@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:
VICTORY_PIPELINE_THREADS=1does reachpipeline/make.rs::queue. I ranmain@940d32fwith it,--console series-x: 420 s with no exception, then the 900 s cap run died with the same0xc0000005 at amdxc64.dll+0x861b9fat 1,710 draws/frame. That is the "delays, does not remove" claim, and it is about the runtime only.--jobs(as you say), soVICTORY_PIPELINE_THREADSnever applied to my bisect signal. The bisect is still valid as a signal (good commits reach 100%, bad ones die at ~86%), but I cannot attribute it to the runtime knob.translate --pipelines --jobs 1on940d32f. If the CLI crash disappears at one worker, then the offline failure is CLI-side concurrency and the runtime story is separate; if it still dies, the driver is choking on some DXIL regardless of concurrency. It is slow (the no-pipeline pass alone takes ~10 minutes here with the default jobs), so I will report it when I have a result rather than guess now.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.
@MamaLeVrai on GitHub · 2026-11-25 09:13 UTC · original
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
38e352c1intomain940d32fin a throwaway tree (no conflict).cargo clippy --workspace --all-targets --locked -- -D warnings: clean; the same with--all-features: clean.cargo test --workspace --locked: 701 passed, 0 failed, 10 ignored, two runs (mainalone on the same machine: 701 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data.AI-assisted (Claude Code); no game data.
@kotekompotek on GitHub · 2026-11-25 09:39 UTC · original
Good catch — confirmed in the code:
translatesizes its scoped workers by--jobs/available_parallelism, so the env only reached the runtimequeue(). Updated the PR so an unset--jobsfalls toVICTORY_PIPELINE_THREADS(0maps to one worker, since translate cannot run with none); that should makeVICTORY_PIPELINE_THREADS=1cover yourtranslate --pipelinesreproducer too, while an explicit--jobs 1still works as before. Also corrected the description — and noted that on the runtime path it serialises compilation rather than promising the crash is gone for good.@Marvisak on GitHub · 2026-11-25 13:30 UTC · original · edited 2026-11-25 14:47 UTC
Automated triage for the maintainers.
Merge candidate (small diagnostic knob). This adds
VICTORY_PIPELINE_THREADS. It sets the runtime pipeline worker count (pipeline/make.rsworkers/env_workers;0makes pipelines on the calling thread, as when no worker can be spawned) and thetranslateworker count when--jobsis not given (translate.rsthread_count,0maps to one). Unset or unparseable values keep today's defaults.The earlier needs-work points are fixed in
ddcb784. The description now says "Refs #2124" instead of closing it. Theenv_workersdoc comment says one worker delays the amdxc64 crash and does not remove it. The README row describes the variable as a diagnostic. CIcheckpasses on this head, and the branch merges cleanly.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
@kotekompotek on GitHub · 2026-11-25 13:39 UTC · original
Done in
ddcb784: "Closes #2124" → "Refs", the doc comment now says the knob delays rather than removes the crash and points at #2124 for the real fix, and the README row describes it as a diagnostic for driver compilers that misbehave under parallel calls.@0xKaji on GitHub · 2026-11-25 20:23 UTC · original · edited 2026-11-25 20:26 UTC
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
VICTORY_IN_PLACE=1+ #2723, 4-min run):8)exit=1372exit=1371exit=124(full 4 min)Limiting pipeline compilation to 1 worker avoids the memory/compiler spikes under
vkd3d-proton+ NVIDIA on 16 GiB systems when entering the world.@DenRakEiw on GitHub · 2026-11-25 09:02 UTC · original · approved these changes
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_THREADSenv override for pipeline worker thread count with safe fallback. Looks good.AI-assisted (Gemini 4 Neon).
@catminou4 on GitHub · 2026-11-25 09:35 UTC · original · reviewed
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.
@fuzeofficlal on GitHub · 2026-11-26 16:52 UTC · original · approved these changes
Verified
ddcb7846c407fb751357ede8da93149aee8fe383merged cleanly onto63bcca43on 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.VICTORY_D3D12_DEBUG=1:pipeline::23 passed, 0 failed;cargo test --locked -p victory -- --test-threads=118 passed, 0 failed (includingtranslate_rejects_zero_workers).--features diagnostics+VICTORY_D3D12_DEBUG=1:pipeline::26 passed, 0 failed.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.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.