Shaders/own_bits: fix STALE taint propagation for control-dependent and loop-carried mask phis #441
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!441
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-441"
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 00:52 UTC · original
AscilCH:fix/shader-own-bits-loop-carried-mask-stale→main· +181 −10 · 1 files · 1 commits · openProblem
In
crates/victory-shader/src/emit/own_bits.rs,Ctx::siteenforces that no lane mask depending on the own-bit test outlives its round (STALE), because host waves of 32 lanes may execute a different set of rounds than a 64-lane console wave. Three gaps let tainted masks escape that check:deppropagation:st.phi_masksstores each incoming mask simplified under its edge condition (b.given(m, edge)). When a mask is assigned inside the own-bit body (e.g.,s_mov_b64 s[14:15], execors_mov_b64 s[14:15], -1),given(m, edge)folds toBool::TRUE, leaving no test atom in the edge value's support even though which edge is taken depends on the own-bit test.tb == h: The block check skipped every blockbinlpwithself.dominates(tb, b). When the own-bit test lives in the loop header (tb == h), that skips every block inlp— including guards beforetiintband loop-header mask phis carrying a previous round's mask.st.masksuser loop only flaggedUser::Phi(b2, k2)when!lp[b2], allowing tainted masks to flow into live loop-header phis atb2 == h.Fix
st.phi_maskswhen a phi's incoming edge masks are not all equal and any predecessor'sst.reach[q]orst.exits[q]branch condition is tainted.Err((head, STALE))) if any loop-header phi athhasAtom::Phi(phi.value)indep.st.guards[b][i]) andst.masksinstruction users against instruction-level dominance after(tb, ti)(b == tb && i > ti || b != tb && self.dominates(tb, b)).User::Phi(b2, k2)users of tainted masks when!lp[b2] || b2 == h.a_test_dependent_mask_carried_across_rounds_is_stalecovering control-dependent loop-carried, control-dependent post-loop, and direct data-dependent loop-carried tainted masks.Verification
cargo test -p victory-shader --locked own_bits: 7 passed, 0 failedcargo xtask policy: 169 files okcargo clippy -p victory-shader --all-targets --locked -- -D warnings: cleancargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings: clean(AI-assisted; synthetic unit tests only, no game data.)
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.