Shaders: lower v_{fmaak,fmamk}_f16 and v_cvt_pk_{i16_i32,u16_u32} #1314
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!1314
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1314"
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?
@ESAT586 on GitHub · 2026-11-24 17:21 UTC · original
ESAT586:shader/valu-fma-k-f16-cvt-pk-lerp→main· +112 −1 · 2 files · 1 commits · openSummary
Lowers 5 missing GFX10/RDNA2 VALU instructions in
victory-shader:v_fmamk_f16(VOP20x037) &v_fmaak_f16(VOP20x038): wired intovalu16/valu16_op, using the literal f16 operand already placed bygfx10::fieldsand preserving the untouched high half ofvdst.v_cvt_pk_i16_i32(VOP30x36b) &v_cvt_pk_u16_u32(VOP30x36a): saturates two 32-bit integers to[-32768, 32767](signed) or[0, 65535](unsigned) and packs them into the low and high 16-bit halves ofvdst.v_lerp_u8(VOP30x14d): computes per-byte(src0.byte[i] + src1.byte[i] + (src2.byte[i] & 1)) >> 1across all 4 bytes.Verification
Tested locally on Windows 11 with NVIDIA GeForce RTX 3060 Ti (
Driver 32.0.16.1656) + Microsoft WARP +dxil.dllvalidator, Rust1.98.1MSVC:cargo clippy --workspace --all-targets --locked -- -D warnings— 0 warningscargo clippy --workspace --all-targets --all-features --locked -- -D warnings— 0 warningscargo test -p victory-shader --locked— 121 passed, 0 failed, 1 ignored (includingfma_k_f16_cvt_pk_16_and_lerp_u8_match_rdna2verifying all 5 opcodes, high-half preservation, signed/unsigned saturation, and per-byte rounding on RTX 3060 Ti and WARP)cargo xtask policy— 154 files ok@fuzeofficlal on GitHub · 2026-11-24 17:54 UTC · original
Verified
v_lerp_u8across NVIDIA GeForce RTX 5090, AMD Radeon(TM) Graphics, D3D12 WARP, anddxil.dll(including exhaustive 131,072-input single-byte equivalence checking).Small codegen note if helpful:
v_lerp_u8can also be lowered in 8 SWAR instructions without unpacking all 4 bytes (x = a ^ b;(a & b) + ((x >> 1) & 0x7F7F_7F7F) + (x & d & 0x0101_0101)— max per-byte sum is255, so carries never cross byte boundaries; seefuzeofficlal/VIctory@dec3499). Also note that routingv_lerp_u8throughLower::integer(write_i) automatically rejects invalidv.clamp/v.omodmodifiers, whereasint(self, acc)invalu_oponly checksomod != 0and silently ignoresv.clamp.@muhammed-aksoy on GitHub · 2026-11-24 17:55 UTC · original
I checked this PR at
f574bf2together with #1285 ate34f8c3. Git reports one conflict inemit/valu_tests.rsbecause both PRs add tests at the same location. I kept both sets of tests in local mergee679ad12. The Windows shader suite passed 124 tests, with zero failures and one ignored, including the new FMA, packed conversion, and lerp regression. The production changes merged automatically. AI-assisted.@Marvisak on GitHub · 2026-11-25 01:22 UTC · original · edited 2026-11-25 22:27 UTC
Automated triage for the maintainers.
Needs rebase. This PR no longer merges cleanly into
main:mainhas moved since the last triage, and the branch now conflicts incrates/victory-shader/src/emit/lower.rsandcrates/victory-shader/src/emit/valu_tests.rs. It will be reviewed again once it is rebased onto currentmain.Previous verdict for this head: merge candidate.
Generated by Claude Code
@ESAT586 on GitHub · 2026-11-25 11:17 UTC · original
Rebased onto \main\ (\
940d32f) at $sha. Verified on RTX 3060 Ti + WARP: \ma_k_f16_cvt_pk_16_and_lerp_u8_match_rdna2\ passed, strict Clippy (--all-targets\ and --all-features) clean, \cargo xtask policy\ ok.@ESAT586 on GitHub · 2026-11-25 12:57 UTC · original
Addressed triage review at $sha: dropped \_lerp_u8\ (covered by #1688) and added a regression test confirming \CLAMP=1\ on \cvt_pk{i16_i32,u16_u32}\ is refused by \write_i\ (\integer output modifiers). Verified on RTX 3060 Ti + WARP: \ma_k_f16_and_cvt_pk_16_match_rdna2\ passed, strict Clippy (--all-targets\ and --all-features) clean, \cargo xtask policy\ ok.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.