Shaders: lower v_cndmask_b32 selects on uniform scalar masks #1270
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!1270
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1270/head"
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?
@fuzeofficlal on GitHub · 2026-11-24 16:58 UTC · original
fuzeofficlal:fix/shader-uniform-select-mask-1115→main· +311 −19 · 3 files · 1 commits · closed without mergingFixes #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.@pablogonz12 on GitHub · 2026-11-24 17:16 UTC · original
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
ffe310eplus #1017 (main's host build fails without it:E0425 host_resource), then the four-stage offline check over 768 programs (751-program world dump + 52-program BVH capture, 35 duplicate containers skipped).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.
@sinan-cmyk on GitHub · 2026-11-24 19:50 UTC · original
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head
77eafaaontomainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 onmain, 21,724 with this PR.No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on
main. The count shows that the change rejects nothing. It does not show whether the output is right.Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 123, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@Marvisak on GitHub · 2026-11-25 00:36 UTC · original
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.v_cndmask_b32 on masks built by uniform s_cselect or constants: main's structure.rs tracks these (
0b35b7fe,8af04727; 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.
Pull request closed