fix(shader): allow untracked scalar lane masks in v_cndmask_b32 #2792
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!2792
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2792"
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?
@legayclightning22 on GitHub · 2026-11-25 20:42 UTC · original
legayclightning22:fix/cndmask-b32→main· +149 −0 · 2 files · 1 commits · openSummary
Fixes the WARP wave-size regression where unrelated
st.otherconstants pinned the wave size when a shader selects on an untracked scalar lane mask inv_cndmask_b32.Instead of chaining in all of
st.other,Lower::new(crates/victory-shader/src/emit/lower.rs) now adds only the selector of eachv_cndmask_b32to the masks checked forOpaque/Constantatoms. As a result,console_lanesis enabled only when av_cndmask_b32select actually reads an untracked scalar mask, andLower::booleantests the lane's own bit (matching guards) rather than failing with"an opaque lane mask".Test Plan
emit::valu_tests::v_cndmask_b32_with_untracked_mask_selects_per_lane, which fails at lowering onmainand verifies per-lane mask selection against each lane's mask bit (with expliciteprintln!diagnostics when pipeline creation skips on WARP-only hosts that cannot run a fixed wave size of 32).cargo test -p victory-shader --libcargo clippy --locked -p victory-shader --all-targets -- -D warningscargo xtask policy@kotekompotek on GitHub · 2026-11-25 20:44 UTC · original
Chaining x.st.other into the mask set is the minimal fix: untracked scalar masks (like a pair built from root constants, exactly the translate-skip 'lane mask as data' bucket) become usable by v_cndmask instead of refusing the instruction. The test covers both native wave32 and emulated wave64-on-wave32, which is where the hi/lo dword distinction bites.
@fuzeofficlal on GitHub · 2026-11-25 21:23 UTC · original
Reviewed and tested
4d84cad9on Windows 11 (RTX 5090 + WARP + Windows SDK10.0.26100.0dxil.dll) againstmain(13f91ca).1. WARP test regression reproduced
Running
victory-shaderunder WARP (VICTORY_WARP=1) introduces a new failure that passes onmain(13f91ca):emit::synthetic_tests::a_compare_mask_joined_with_data_on_the_skip_edge_is_0_therepanics atsynthetic_tests.rs:491:17: hardware: no pipeline for a wave of 32.lower.rs:568unconditionally scans allx.st.other.values()when settingconsole_lanes. In that test,s_mov_b32 s6, 5(an intermediate constant that folds away at the join) still lives inst.otherasAtom::Constant(5), which now forcesWaveSize(32)on a shader that previously required no wave-size constraint and fails pipeline creation on WARP.console_lanes = trueforst.othermasks actually consumed byv_cndmask_b32(whose support still contains an unresolvedOpaque/Constantat the use site), rather than scanning every entry inx.st.other.values().2. Wave64 split-dword test silently skipped & depends on
#2783Probing
valu_tests.rs:1808shows that 3 of the 4(hardware/warp) × (wave64=false/true)cases—including both WARP cases and RTX 5090 Wave64—hitelse { continue; }when the adapter rejectsWaveSize(32/64)and are silently skipped (only RTX 5090 Wave32 actually executes).Because the new test initializes the 64-bit mask with two separate scalar writes (
s_add_u32 s12, s0, 0; s_add_u32 s13, s1, 0), on#2792alone without#2783(Atom::Opaque(lo, hi)),lower::pair_high(s12)returnsNone, so Wave64 lanes 32–63 would reads12instead ofs13.Verification summary
cargo clippy --locked -p victory-shader --all-targets -- -D warnings(default &--features host): 0 warnings;cargo xtask policy: 184 files ok.v_cndmask: 2/2 passed (Wave32 executes); WARP full suite: 267 passed, 1 failed (the newa_compare_mask_joined_with_data_on_the_skip_edge_is_0_thereregression).git merge-treevs13f91caand#2783.@Marvisak on GitHub · 2026-11-25 23:14 UTC · original · edited 2026-11-26 03:23 UTC
Automated triage for the maintainers.
Verdict: merge candidate. The rebased head now merges cleanly.
Lower::new(crates/victory-shader/src/emit/lower.rs) adds the selector of eachv_cndmask_b32to the masks it checks forOpaque/Constantatoms, soconsole_lanesis set only when such a select needs it. Before, a select on a mask held as a number (st.other) reachedLower::booleanwithconsole_lanesoff and was refused as "an opaque lane mask". With the flag set, it tests the lane's own bit, as guards already do. This answers fuzeofficlal's WARP regression: unrelatedst.otherconstants no longer pin the wave size. The new test fails atloweronmainand checks every lane against the mask bits.Two small points:
st.otheris chained in. Please update it to the scoped form.eprintln!on that skip would make that visible.#439 also takes "selects on masks held as numbers"; this is the smaller, separate form.
CI: passing (
check).Generated by Claude Code
@legayclightning22 on GitHub · 2026-11-26 00:59 UTC · original
Thank you both for the thorough review and testing! Updated and force-pushed (
90339e5) onto latestmainto address everything raised:@kotecompotekStructured::othertranslate-skip ("lane mask as data") bucket and the wave32 vs. emulated wave64-on-wave32 hi/lo dword distinction.@fuzeofficialThank you for catching both the WARP regression and the wave64 test behavior on
13f91ca:console_lanesregression (a_compare_mask_joined_with_data_on_the_skip_edge_is_0_there):x.st.other.values()unconditionally picked up folded scalar constants likes_mov_b32 s6, 5(Atom::Constant(5)), forcingWaveSize(32)on shaders that previously needed no wave-size constraint and causing WARP pipeline creation to fail.console_lanesso it is only enabled forst.othermasks actually consumed byv_cndmask_b32whose support still contains an unresolvedOpaque/Constantat the use site, leaving unrelatedst.otherconstants untouched.#2783interaction (valu_tests.rs):v_cndmask_b32_with_untracked_mask_selects_per_laneso it cleanly validates untracked scalar mask selection without relying on unmerged#2783(Atom::Opaque(lo, hi)/pair_high) split-dword pairing or silently passing skipped wave-size cases.Rebase & Verification @Marvisak
main(resolving thecrates/victory-shader/src/emit/valu_tests.rsconflict).cargo clippy --locked -p victory-shader --all-targets -- -D warnings(0 warnings) andcargo test -p victory-shader(including WARP regression checks).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.