Shaders: lower v_pk_fmac_f16 (VOP2 0x3c and VOP3 0x13c) #1136
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1136"
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?
Imported from Marvisak/VIctory. Originally posted by ESAT586 on 2026-11-24T16:07:08Z.
What's wrong
v_pk_fmac_f16(VOP20x3c/ VOP30x13c) is already decoded ingfx10/opcodes.rs, andvalu_opdispatches anyv_pk_*instruction intopacked16. Becausepacked16only matches VOP3Pv_pk_*ops,v_pk_fmac_f16fails lowering withUnsupported { what: "a packed 16-bit operation" }.Additionally, unlike VOP3P instructions (which use
op_sel/op_sel_hito select halves per lane),v_pk_fmac_f16uses VOP2/VOP3 encoding where the low half always comes from bits[15:0]and the high half from bits[31:16], accumulates intovdst, and applies VOP3abs/neg/omod/clampto both packed f16 halves.Fix
Lower::pk_fmac_f16incrates/victory-shader/src/emit/lower.rs(dispatched beforepacked16invalu_op):d.lo = s0.lo * s1.lo + d.loandd.hi = s0.hi * s1.hi + d.hiin f32 (matchingvalu16/packed16) vialegacyF16ToF32,fmad, andlegacyF32ToF16.self.src0for DPP, GFX10 inline constant expansion (f16_operandplaces inline constants in the low half and 0 in the high half), and VOP3abs,neg,omod,clamp.Err("SDWA on v_pk_fmac_f16")).emit::valu_tests::v_pk_fmac_f16_matches_rdna2incrates/victory-shader/src/emit/valu_tests.rstesting:v_pk_fmac_f16on two packed f16 pairs with independent accumulators,v_pk_fmac_f16with inline constant1.0(0xF2, verifying low-half1.0and high-half0.0pass-through),v_pk_fmac_f16(0x13c) withabs[0],neg[1], andclamp.Verification (Real GPU + WARP + CI Gates)
Tested on Windows 11, NVIDIA GeForce RTX 3060 Ti (driver
32.0.16.1656), Rust1.98.1:cargo test -p victory-shader --lib v_pk_fmac_f16_matches_rdna2: ok (dxil.dllvalidator + RTX 3060 Ti hardware + Microsoft WARP)cargo test -p victory-shader --locked: 121 passed, 0 failed, 1 ignoredcargo clippy --workspace --all-targets --locked -- -D warnings: pass (0 warnings)cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: pass (0 warnings)cargo xtask policy:asset policy: 154 files okScope & Non-Overlap
v_pk_fmac_f16.Imported from Marvisak/VIctory. Originally posted by nullmarsh on 2026-11-24T16:35:06Z.
Ran on RDNA2 hardware through vkd3d-proton on a Steam Deck (not native Windows): AMD Van Gogh, RADV 26.1.99, SteamOS 3.8.28, Proton 11.0-3 (wine-11.0) with its vkd3d-proton 212991fc. Windows MSVC test binary (rustc 1.100.0) built from head
0dcf6d0on mainffe310e. Your report lists NVIDIA and WARP, so this adds AMD hardware.v_pk_fmac_f16_matches_rdna2passes: VOP2, the VOP2 inline 1.0 case (hi half kept), and the VOP3 abs/neg/clamp case.stub_pipeline_is_created, fails on main too (likely vkd3d-proton accepting the zero DXIL digest the test expects refused; environment, not this PR).Not tested: native Windows AMD drivers; WARP (this setup has none, so the WARP leg ran on RADV too); whether the new test fails without the fix on this host.
AI-assisted (Claude Code, Claude Opus 5.5); no game data.
Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T18:01:27Z.
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
0dcf6d0:cargo test -p victory-shaderpasses, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:32:46Z.
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.Lowers v_pk_fmac_f16. In main since today (lower.rs:6389-6400, tests packed_fmac_accumulates_each_half and the semantics probe).
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