Repository navigation
rdna2spirv: v_fmamk_f16 and v_fmaak_f16 - #1989
Conversation
|
Independently tested One integration caveat worth recording in the contract row: LLVM #237158 reports that affected AI-assisted verification and review. |
|
Overlap note: @IAmNotSiob's #1976 (opened 15:20, three minutes before this one) also adds |
Both were rejected while the f32 forms are translated. In print order both are a[1] * a[2] + a[3] (fmamk S0 * K + S1, fmaak S0 * S1 + K), with K the literal's low 16 bits (a float literal converted to f16), one rounding to f16 as v_fmac_f16, and the high half kept (GFX10 f16 VOP2). tests/semantic/test_valu_fmamk_fmaak_f16.py compares both with v_fma_f16 with K in a VGPR. docs/design.md row added.
483f1e9 to
d586d05
Compare
|
Tested
gfx1151 is RDNA 3.5, not RDNA2: this shows the translated SPIR-V gives the modelled words on a real driver, not that RDNA2 hardware does. AI-assisted (Claude Code). |
|
Tested d586d05 on Steam Deck LCD (Jupiter), AMD Custom GPU 0405 "Van Gogh", RADV Mesa 26.2.0-devel (git-5c65d4fc31), Vulkan 1.4.350, SteamOS 3.9.5 (holo), kernel 7.2.7-valve2-2-neptune-72-g31504582a073: pass. Semantic tests:
Full GPU suite:
AI-assisted (OpenCode). |
|
Native hardware check of the two encodings on RDNA2: pass. AI-assisted, synthetic only, no game files. The PR's tests compare the translated
So on hardware both ops are exactly |
v_fmamk_f16andv_fmaak_f16raisedUnsupported, whilev_fmamk_f32/v_fmaak_f32andv_fmac_f16are translated. RDNA2 ISA, VOP2 with a literal K:v_fmamk_f16:D = S0 * K + S1, printedvdst, src0, K, vsrc1v_fmaak_f16:D = S0 * S1 + K, printedvdst, src0, vsrc1, KImplementation: in print order both are
a[1] * a[2] + a[3], as the f32 forms already handle them (their fmamk operand order was fixed on 2026-11-21, per the comment there).0.5is converted to f16, throughsrc_h.fma_f16_odd, the same asv_fmac_f16(SHADER-55).f16_out).Tests:
tests/semantic/test_valu_fmamk_fmaak_f16.py. Each case must give exactly the bits ofv_fma_f16with K in a VGPR, whose rounding is tested elsewhere:fmamkon a 6×12×4 grid andfmaakon a 6×4×12 grid of f16 values: ±1, 0.5, large values, subnormals, ±0 and infHalves are exported separately, so no NaN pattern can be quieted. Without the change the file fails (602 errors); with it, 4/4 pass.
python -I -m unittest discover -s tests/semantic: 1648 tests OK (2 skipped).docs/design.md: new row after "f16 inline constants".Tested on CPU only; no GPU run. No game files. I searched for an open PR or claim first and found none.
AI-assisted (Claude Code): I reviewed and ran the change and the tests.