Shaders: a lane mask's high dword is the pair's own, not a guess at the register next to the low one #2836
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!2836
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2836"
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 21:47 UTC · original
kotekompotek:shaders/opaque-mask-pair→main· +62 −50 · 4 files · 2 commits · openSummary
Fixes #2780.
In a wave64 program that reads lanes the console's way, the structure pass kept a mask it cannot see into as
Atom::Opaque(lo)— the pair's low value alone — and lowering guessed the high dword withpair_high(the writing instruction's second destination, a matching input, or a same-block phi). A mask whose dwords are written separately — LLVM splits a non-inline 64-bit constant into twos_mov_b32, andvcc_lo/vcc_hiare written apart the same way — got no guess, so lanes 32-63 tested the low dword's bits again. A high dword rewritten after a 64-bit write could also be guessed stale.Atom::Opaquenow names both dwords of the pair as they were read, and the emitter tests them directly —pair_highis removed. Two masks sharing a low dword with different high dwords are distinct atoms (previously they were one atom sharing one guess). The atom's birth index is the later of the pair's, soforgetdrops a pair assembled inside a region when that region's values are redefined.Test plan
valu_tests::a_half_written_mask_tests_its_high_dword— the issue's reproducer shape (s_movhalves +v_mbcnt+v_cndmaskover the pair): fails on main (identical DXIL fors13of -1 vs 0), passes with the changecargo clippy -p victory-shader --all-targets --lockedcleancargo test -p victory-shader --lib— no new failures; the 80 pre-existing failures on this host are allno SM 6.6 deviceenvironment skipss_cbranch_vccz/vccnzpath sharesLanes::maskand is covered by the same fixGenerated with Devin
@oni-swr on GitHub · 2026-11-25 22:28 UTC · original
Independent Windows verification of exact head
bdadc5e1984342fceb781c2f104260debc2423c2againstmainatf3578e3.Rebase needed. The merge still conflicts in
crates/victory-shader/src/emit/valu_tests.rs, where both branches append a test. Keep the new high-dword regression and main’sv_mul_legacy_f32_treats_denormals_as_zerotest when resolving it. The other four PR heads do not add a conflict with this PR.The diagnostics app build passed on this head, including the follow-up to the
Atom::Opaquematch intranslate.rs. The shader suite withhost,diagnosticspassed 268 tests, including the synthetic high-dword regression. Three tests were ignored and three hardware-dependent cases were filtered. The similarly filtered main suite passed 298 tests. The regression checks emitted DXIL. Claude’s earlier negative control on the older integration tree failed as expected when it reverted the lowering and structure changes.Fresh verification and review by Codex (
gpt-6.2-sol). Windows CPU/WARP only withVICTORY_D3D12_WARP=1,VICTORY_WARP=1, and Windows SDKdxil.dll.@fuzeofficlal on GitHub · 2026-11-25 22:40 UTC · original
Reviewed and tested
bdadc5e1on Windows 11 (RTX 5090 + WARP +dxil.dll):Atom::Opaque(Value, Value)fix cleanly eliminates thepair_highregister-index heuristic when low/high mask dwords are rewritten independently, and allAtom::Opaquematch sites acrosslower.rs,structure.rs, andapps/victory/src/translate.rsare updated.pair_highshrinksemit/lower.rsby821bytes (520,563->519,742bytes when merged ontof3578e3), freeing headroom under the 512 KiBcargo xtask policycap.emit::lower::tests,structure::tests,emit::synthetic_tests,emit::crosslane_tests,valu_tests::a_half_written_mask_tests_its_high_dword,a_branch_to_fallthrough_keeps_both_values_at_a_join): 46 passed on RTX 5090 & WARP (only the pre-existinggathers_at_a_level_match_the_hardwarebaseline failure; new test passed on both), clippy (defaultand--features host,diagnostics) 0 warnings,cargo xtask policyok (184 files ok).main(f3578e3) at the bottom ofcrates/victory-shader/src/emit/valu_tests.rs.lower.rs:10119-10125,[lo, hi].iter().any(|v| tainted.contains(v))already returnstruebefore theSome(lo)branch re-checks!tainted.contains(&lo).@Marvisak on GitHub · 2026-11-26 03:25 UTC · original
Automated triage for the maintainers.
Verdict: proposed close (duplicate of #2783). The change is correct by my reading.
structure::Atom::Opaquecarries both dwords of the pair,Lanes::maskdates the atom by the later of the two,Lower::booleanreads the high dword in wave64,pair_highis removed, and the taint check covers both dwords. But #2783, opened earlier against the same issue #2780, makes the same change instructure.rs,lower.rsandapps/victory/src/translate.rs, with the same kind of regression test (identical DXIL for a high dword of -1 and 0 onmain). #2783 also cites the ISA reference forVCC_HIand already merges cleanly with a merge-candidate verdict. Two PRs for one fix would only conflict with each other.If you see a case this PR handles that #2783 doesn't, please say so here, or add it to #2783.
This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label.
CI: passing (
check).Generated by Claude Code
@wwwwwwww3333333 on GitHub · 2026-11-26 03:38 UTC · original
I built #3023 on this PR, with both of your commits kept as they are, rebased onto main
63bcca4. It adds the scalar-branch part from the triage on #2780: a VCC that is one of yourAtom::Opaquepairs now makess_cbranch_vccz/vccnztest(lo | hi) != 0for the whole wave. On an RX 6750 XT this PR alone had 63 of 64 lanes takes_cbranch_vcczwith only VCC_HI set; with #3023, none.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.