Shaders/bitcode: prevent folding twin empty latches from the same predecessor #678
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!678
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-678"
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?
@AscilCH on GitHub · 2026-11-25 04:20 UTC · original
AscilCH:fix/shader-bitcode-duplicate-empty-latch-fold→main· +84 −22 · 1 files · 1 commits · openSummary
Fixes an invalid LLVM/DXIL bitcode emission bug in
crates/victory-shader/src/emit/bitcode.rsduring empty-latch folding:Module::write()folds emptyBr(h)backedge blocks with a single predecessorpintop, previously checking only!succs(*p).contains(&h)against the original CFG.pends inCondBr(c, b1, b2)where bothb1andb2are emptyBr(h)blocks supplying distinct values to a PHI node inh, bothb1andb2folded intoSome((p, h)). Both PHI incoming edges then mapped tofrom(b1) == pos[p] == from(b2), producing invalid LLVM 3.7 / DXIL IR (PHI node has multiple entries for the same basic block with different incoming values).Module::empty_latch_folds()and guarded folding with&& !fold.contains(&Some((*p, h))), ensuring at most one empty latch folds per(p, h)pair while leaving single-latch bitcode output byte-identical (verified bywritten_bytes_unchanged).Verification
cargo test -p victory-shader --lib --locked emit::bitcode::tests— 6 passed, 0 failed, 1 ignored (including existingwritten_bytes_unchangedand newtwin_empty_latches_from_one_predecessor_do_not_both_fold)cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings— clean (0 warnings)cargo xtask policy— asset policy: 169 files ok(AI-assisted; synthetic unit tests only, no game data.)
@JRamos1993 on GitHub · 2026-11-25 05:27 UTC · original
Offline check on the retail shader pack: no program of the title reaches this path. The change is neutral for it.
victory translate --validate --listover the title's full shader pack (26,084 programs) on an RTX 5090,main310c6ebagainst this head merged onto it:mainfails on twin empty latches from one predecessor.So this fix doesn't change anything for this title's shaders as the batch tool translates them. It may still matter for other programs or titles.
AI use: Claude Code with Claude Opus 5.5 ran the pack and wrote this. Nothing from the title is in it.
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.