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!2309
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2309"
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?
@desplmfao on GitHub · 2026-11-25 10:19 UTC · original
desplmfao:fix/w64-nvidia-compile→main· +4971 −1457 · 28 files · 74 commits · openStacked on #439 (r4tedx; it contains #233 and #320). The two commits on top of it are the change. The first is powplusplus's
d48ec76from #1885, cherry-picked with its author kept; the second is ours.Problem
On NVIDIA (32-lane waves) under Wine/Proton, vkd3d-proton converts each pipeline's DXIL to SPIR-V with dxil-spirv, inside the title's process. Some of #439's console-flow programs have a block that branches back to two loop headers, e.g.
br c, 191, 126, where 191 is the inner loop's header and 126 the outer one's. Others have a loop header with three back edges.dxil-spirv's structurizer expects one back edge per block and per header ("DXIL seems to obey this",
forward_visit_resolve). It reads the extra edge as a forward edge, makes a cycle, and recurses until the stack runs out (LoopMergeTracer::trace_from_parent, about 100k frames). With a large stack it uses memory instead (40 GB before I killed it), or the pipeline thread hangs. In the title, the process ends while those pipelines are created, or no pipeline ever finishes.mainhas the same shapes in 7 programs. They convert because those programs have noWaveReadLaneAt, and dxil-spirv only walks the graph before fixing it up inflatten_subgroup_shuffles, which runs only when a shader reads other lanes. #439 adds the lane reads, and then the same shapes are fatal.How it was found
VICTORY_PIPELINE_JOURNAL=1). On #439 the title's process died during world load, with no crash log and no GPU fault. The journal's pending notes named the pipelines being created at that moment:b2ff2ef0d6c98dd7,fdd56d97a806bcca,32ed072b9f845048and others.shaders.rpfand were translated with #439. A native dxil-spirv build, capped in memory, then crashed on them the same way: it reached 40 GB uncapped and overflowed the stack when capped. gdb showed the recursion (LoopMergeTracer::trace_from_parent, about 100k frames).mainshowed the block that branches back to two loop headers.VICTORY_PIPELINE_SOFT_CRASH=1). Without this fix, the same two programs are caught as stack overflows (0xc00000fd) inside vkd3d-proton.Change
All in
crates/victory-shader/src/emit/bitcode.rs:364c1bc(powplusplus, from #1885):Module::single_latchesgives each loop header one back edge.91e3bdf: a block that branches back to two headers sends its edge to the outer header through a new block of its own, fixing that header's phis. The block stays the inner loop's exiting latch, as DXC makes them. The empty-latch fold at write time no longer folds a latch into a block that already branches back, which would undo the split.The change is generic:
lower.rsandwave.rsare untouched, so it should not conflict with #2214.Tested
fdd56d97a806bcca(InstanceCulling:CS_Prop_BatchNoCull) and32ed072b9f845048(deferred_tiled:CS_LaserLightShadowRaytracing).spirv-val, andvkCreateComputePipelinesreturnsVK_SUCCESSon native NVIDIA (RTX 5080, no Wine).*:CS_RaytracingResolveprograms, and the run goes past that point.cargo test -p victory-shader --lib: 151 passed on Linux, and 178 passed, 0 failed for the Windows build under Proton on the RTX 5080. That includes the newa_block_branching_back_to_two_headers_gets_one_back_edgeandempty_latches_to_two_headers_fold_once.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.Related
lower.rs.AI-assisted (Claude Code).
🤖 Generated with Claude Code
A console wave64 program that reads masks whole or lanes of the other half now runs on a host without 64-lane waves when its group is one console wave (64 threads or fewer, no LDS). It runs as the console does ("console flow"): - `structure::structure_console` never resolves mask joins from what the lanes arriving know (every lane arrives); `Structured::execs` gives each vector instruction's EXEC bit. - Vector instructions are guarded by EXEC. Branches are the console's s_cbranch_*: EXEC, VCC and mask-operation SCC tests are the console wave's, from both halves' ballots exchanged through group-shared memory between group barriers, which every thread reaches since both halves branch alike. - Masks read whole are the exchanged ballots. v_readlane and v_readfirstlane read the owning half; v_writelane, v_mbcnt and mask bit tests use the console lane. The per-lane form is tried first; a program that needs the console flow is lowered again from the console structure. GPU tests on an RTX 5070 are exact against the console: s_bcnt1 over both halves (64, 48 and 32 threads), v_readlane 40, an exchange inside a branch only the lower half takes, and a loop the halves leave at different iterations with a lane read in each. The last one shows that the per-lane form, which hosts with 64-lane waves get, is wrong for it (on a Radeon iGPU): noted in docs/wave64-on-wave32.md, not changed. Co-Authored-By: Claude Opus 5.5 <[email protected]>The validator's message for an operation the stage or the entry's properties do not allow ("Entry function performs some operation that is incompatible with the shader stage or other entry properties") names neither the operation nor the property, and it is the only message when the call is in the entry function itself. `victory translate --validate` now adds to each validator failure what our own module declares and calls: its thread-group size, its wave size and its dx.op operations (`emit::last_module_summary`, kept per thread when a module is finished). Nothing of the console program is in it, so a report of counts per reason is enough to see what the refused modules have in common. Prompted by a report on #233: modules that fail validation with that message and still create pipelines, 20 of them new with #320, which I cannot reproduce with hand-assembled programs. Co-Authored-By: Claude Fable 5.2 <[email protected]>1a8a3ed) 3c961b5ea0e4246fd) 1e17e572a0b623fd3) bf13a276c5cbcef55) bf0f9511c541369c9) 28aca3b718940d32f) into the host wave sizes branch 02b955ffc902b955f) into the console flow e5ffedbb8b1e247b1) into the lane reads branch 49f31ec4ff49f31ec) into the console wave LDS branch 61568ae3307147671) eb12838eefeb12838) 5a11cf48143fab5a1) 5e4ebf3fb163bcca4) into #439 f7d4feb43f63bcca4) f93574a1a1@desplmfao on GitHub · 2026-11-25 11:18 UTC · original
@catminou4 thanks. The size comes from the stacking: this PR's diff against
mainincludes all of #439 (and #320/#233 with it), and that's where the +3,763 lines, the docs and the--host-lanesCLI come from. The change itself is only the last two commits, both incrates/victory-shader/src/emit/bitcode.rs:364c1bc(powplusplus's commit from #1885) and91e3bdf. Compare against #439's head to see just those.r4tedx is taking both commits into #439 (see #439). Once they're in, I'll close this one as included.
@desplmfao on GitHub · 2026-11-25 11:32 UTC · original
Update after r4tedx's note on #439: this stays its own PR. I've merged #439's current head (
3fab5a1) into it (no conflicts, merged rather than rebased). The change is still the two commits inbitcode.rs,364c1bc(powplusplus, from #1885) and91e3bdf. On the merge,cargo test -p victory-shader --lib(Linux) gives 151 passed, and clippy is clean. To review just the change, compare against #439's head.@Marvisak on GitHub · 2026-11-25 15:22 UTC · original · edited 2026-11-26 02:18 UTC
Automated triage for the maintainers.
Needs work.
ec845d6merges cleanly and CIcheckpasses, but the diff againstmain(+4,971 / -1,457, 28 files) is almost entirely #439 (r4tedx's wave64 console flow, merged withmainonupdate/439-main), plus this PR's own rule inModule::plan(crates/victory-shader/src/emit/bitcode.rs: one back edge per block, commits364c1bc/91e3bdf) and the move oflower.rs's tests toemit/lower/tests.rs. Merging it would land #439 in a rebased form that #439's own thread has not reviewed; #439 itself still conflicts withmain(marked needs-rebase for3fab5a1).What would move this forward: #439 rebased and decided on its own (or the maintainer choosing to take it through this branch), and then this PR reduced to its own commits on top, so the back-edge rule can be reviewed by itself.
On your replies: the
planplacement and theModule::termuse for constant branches sound right, and the tests move fixes the policy failure, but they do not change the stacking problem above. Also note #2084 and #2117 add tolower.rsas well; once the tests move lands, they will need to follow it.Generated by Claude Code
@desplmfao on GitHub · 2026-11-25 15:43 UTC · original
Thanks for the triage. On the three points:
mainright now, and this PR is stacked on it, so I'll follow #439's next head. Once #439 is in, I'll mergemainhere (no rebase or force-push, to keep the review history) so the diff comes down to the twobitcode.rscommits.364c1bc(from #1885): I'm asking @powplusplus on #1885 whether it lands there or here, so it doesn't land twice. If #1885 lands first, I'll drop it from here.@desplmfao on GitHub · 2026-11-26 01:18 UTC · original
#439 has conflicted with
mainsince this morning, so this PR now sits onupdate/439-main(f7d4feb). That branch is #439's head3fab5a1withmain(63bcca4) merged in, and r4tedx's commits are unchanged.f93574amerges it here.mainmoved block layout and folding intoModule::plan, so this PR's rule now sits there. An empty latch is not folded into a block that already branches back, counted over the edgesplanwrites.successors()usesModule::term, so a branch on a constant doesn't count its dead edge.mainfails there.empty_latches_to_two_headers_fold_once.When #439 is updated upstream, this PR follows its head again.
@desplmfao on GitHub · 2026-11-26 01:30 UTC · original
The
checkfailure onf93574awas the asset policy's file size limit: with #439 merged intomain,crates/victory-shader/src/emit/lower.rsreached 559,370 bytes, past the 524,288-byte limit (xtaskrepository_passes_policy).68ba2deonupdate/439-mainmoveslower.rs's inline test module unchanged intoemit/lower/tests.rs, leavinglower.rsat 506,198 bytes.ec845d6merges it here.Anything that changes
lower.rs's tests (this PR, #439, or another PR stacked on them) now has to editemit/lower/tests.rs. A PR that still adds tests inline inlower.rswill conflict, or push the file back over the limit.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.