Shaders: lower scalar quadmask instructions #1443
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!1443
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1443/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?
@Luizbc2 on GitHub · 2026-11-24 18:02 UTC · original
Luizbc2:fix/rdna2-quadmask→main· +74 −0 · 2 files · 2 commits · merged 2026-11-25 00:22 UTCSummary
Implement
s_quadmask_b32ands_quadmask_b64. The decoder recognizes both opcodes, but currently rejects shaders that use their result. Each instruction packs one bit for every nonzero four-bit group and sets SCC when the result is nonzero. The 64-bit form clears the high destination word. Both forms lower with 32-bit DXIL operations.Semantics follow the AMD RDNA 2 ISA reference.
Reproduction and testing
cargo test --workspace --lib --locked --offline scalar_quad_masks_pack_nibbles_and_set_sccOn base
ffe310e, the added test fails withUnsupported { offset: 48, what: "s_quadmask_b32" }. With the change, it passes DXIL validation and runs on Intel Iris Xe and WARP. The generated shaders check the zero case, sparse and full masks, input bits in the high word only, SCC, and a cleared high destination word.The inputs are synthetic. AI-assisted with Codex.
@marquezinii on GitHub · 2026-11-24 18:10 UTC · original
Ran on an RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1 at
e3fe5bf.cargo test -p victory-shader --lib -- --test-threads=1gives 121 passed, 0 failed, 1 ignored.scalar_quad_masks_pack_nibbles_and_set_sccpasses on the hardware adapter and WARP.I also went through
quad_maskby hand:x | x >> 1, then>> 2masked with0x1111_1111, leaves each nibble's OR in its bottom bit.>> 3,>> 6and>> 12steps move bit4kto bitk.The expected values follow from this:
0x8000_0420gives0x86, and with0x0100_0001in the high dword the pair gives0x4186.@sinan-cmyk on GitHub · 2026-11-24 20:43 UTC · original
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head
e3fe5bfontomainffe310e(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 121, 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).