Repository navigation
Shaders: lower v_cndmask_b32 selects on uniform scalar masks - #1270
fuzeofficlal wants to merge 1 commit into
Conversation
Export non-derived v_cndmask_b32 masks whose support only references uniform SCC atoms (or all-zero/all-ones constants) in Structured::uniform_selects keyed by the select result, keeping them out of lane-mask tables so scalar data uses of the same SGPR remain valid while selects lower without wave operations in every stage (Marvisak#1115).
catminou4
left a comment
There was a problem hiding this comment.
v_cndmask_b32 selects on wave-uniform scalar masks (s_cmp/s_cselect/s_mov of uniform values) no longer need lane_index/wave ops: structure.rs tracks uniform_selects and lower.rs consults them by destination value. The five wave32 cases + wave64 cases pin no-WAVE_OPS, and the s_xor_b32 case pins that later scalar ALU use of the mask does not re-trigger reads_mask_as_data. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main ffe310e, cargo test -p victory-shader --locked. Shader execution tests (valu_tests/host) are #[cfg(all(test, windows))], so macOS covers lowering/decode/unit tests only. 98 passed, 0 failed. Note: touches the same v_cndmask arm as #1084 (approved earlier) — whichever lands second will need a rebase; the two are complementary (uniform-select tracking vs untracked-mask lane-bit fallback).
|
Setup: Linux, RX 9070 XT, RADV (Mesa 26.3.1), dxil-spirv master, spirv-val 1.3. Your head folded onto a base of origin/main
No program gained or lost and the failure table is identical to the base — the uniform-mask selects in this capture were not refused before, so this is a no-regression result only. Not tested: in-game. |
Offline measurement on a retail dump, and the shader tests on AdaResult: no count change against Offline. I merged head 77eafaa onto No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on Tests: with the same merge, No shader names or data are included, per the asset policy. AI-assisted (Claude Code). |
|
Automated triage for the maintainers. Closing because this change is already in v_cndmask_b32 on masks built by uniform s_cselect or constants: main's structure.rs tracks these (0b35b7f, 8af0472; world programs on 'a select on an untracked mask' 288 to 0). If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
Fixes #1115.
Summary
v_cndmask_b32driven by a uniform scalar condition (s_cselect_b32/s_cselect_b64choosing between-1and0, or all-zero / all-ones scalar constants) is currently refused as"a select on an untracked mask"becauseLanesonly exports per-lane masks inStructured::masks.v_cndmask_b32masks whose ROBDD support references onlyAtom::Uniform(_)(including constantBool::FALSE/Bool::TRUEandNULL) inStructured::uniform_selects, keyed by the destination SSA value of the select.Structured::masks/highsso subsequent scalar ALU uses of the same SGPR (e.g.s_xor_b32) do not tripreads_mask_as_data, and reject Wave64 pairs whose upper half was overwritten or arbitrary non-mask bit patterns (e.g.s_lshl_b32).i1condition in every shader stage without requiringwaveGetLaneIndexorWAVE_OPS.Verification
structure.rsandemit/lower.rscovering Wave32/Wave64s_cselect -1, 0/0, -1, constants0/-1, scalar reuse of the mask SGPR withwave_ops == false, and continued refusal of shifted / half-clobbered masks.uniform_select_masks_match_rdna2) validated withdxil.dlland executed on NVIDIA GeForce RTX 5090 and D3D12 WARP.cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warningsandcargo xtask policypass.