Shaders: validate active masks against block reachability and respect wide branches in resource tracking #713
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!713
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-713"
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 05:20 UTC · original
AscilCH:fix/shader-structure-active-mask-and-resource-wide-edge→main· +145 −12 · 2 files · 1 commits · openSummary
Fixes two lane-mask soundness bugs in
crates/victory-shader:Structured::activeunsound for widenedEXECinside divergent blocks (crates/victory-shader/src/structure.rs):mask_dword()(emit/lower.rs) emitswaveActiveBallotat a mask's defining block wheneverst.active.contains(&lo), which is only sound if every lane where the mask can be set actually executes that defining block (m => cond[def_block]).step()andv_cmp_*previously insertedr.exec, masks implying mutablenow, and VALU compares under widenedEXECintoself.activeeven inside a divergent block wherecond[def_block]is strictly narrower thanm, causingwaveActiveBallotto silently zero inactive lanes.finish()now filtersself.activeaftercondconverges, retaining a mask only whenself.b.implies(m, cond[def_block])(keeping entryEXECinputs unconditionally).only_edge()andlane_phi()ignoredlanes.wide(crates/victory-shader/src/resource.rs):structure.rs::edge(),only_edge()andlane_phi()pushed(when, taken == block)ontoknownfor everyLaneExit::Brancheven whenlanes.wide.contains(&q).whenbit. Adding!lanes.wide.contains(&q)prevents falsely collapsing a descriptor join onto one predecessor or dropping a liveLanePhiincoming edge asNone(which lowers as heap index0).Verification
cargo test -p victory-shader --locked -- structure::tests resource::tests emit::lower::tests emit::waterfall_tests emit::wave64_tests: 70 passed, 0 failed, 1 ignored (including new testswidened_exec_inside_divergent_branch_is_not_activeandwide_branch_does_not_drop_predecessor_edges_in_only_edge_or_lane_phi)cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings: clean (0 warnings)cargo xtask policy:169 files ok(AI-assisted; synthetic unit tests only, no game data.)
@JRamos1993 on GitHub · 2026-11-25 05:54 UTC · original
Offline check on the retail shader pack: this PR loses 1,289 programs that validate on
main. All of them now stop with "a lane mask holding lanes elsewhere read as data".Setup: RTX 5090, Windows 11.
victory translate --validate --listover the title's full shader pack (26,084 programs),main310c6ebagainst this head merged onto it, default settings.main310c6ebWhere the 1,289 now stop:
emit: a lane mask holding lanes elsewhere read as dataThe programs that still validate emit byte-identical DXIL to
main.My reading, not checked line by line: the narrower
Structured::activeset leaves those masks out.Lower::mask_dwordthen no longer takes them as a ballot of the running lanes, and refuses the read. If the narrower set is right in general, these 1,289 programs would need another way to read their masks before this can land.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.