shader: lower gfx1013 v_fmaak_f32 and v_fmamk_f32 in pixel_aot #288
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/292"
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 R0Y00/Xbox2Windows. Originally posted by Its3rr0rsWRLD on 2026-11-21T21:01:56Z.
Change
pixel_aotrejectedv_fmaak_f32andv_fmamk_f32, the VOP2 multiply-adds with a 32-bit literal K:v_fmaak_f32computes S0 × S1 + K andv_fmamk_f32computes S0 × K + S1. Both now use the existingv_fma_f32lowering with their operands in source order. The translator accepts only a hexadecimal literal in the K position, which is how LLVM prints it, and refuses a register there or a missing operand. Independent problem: it widens the arithmetic the pixel translator accepts. It toucheslower()intools/pixel_aot.pyand adds a draw totests/pixel_aot_check.py; I found no open PR that lowers either instruction.Overlap: #288 also edits
tools/pixel_aot.py,tests/pixel_aot_check.pyanddocs/experiments.md. The two branches touch separate lines; I merged them in both orders ontod311159without conflicts, and the combined controls pass. Neither depends on the other.Verification
Commit
d311159plus this change, Windows 10 Enterprise 26H2 build 26300.9974, MSVC 14.51.36231, Windows SDK 10.0.26100.0 DXC.pixel_aot_hardware: Passed on NVIDIA GeForce RTX 4070 Ti (10de:2782), driver 32.0.16.1088.pixel_aot_warp: Passed on WARP 10.0.26100.9818.debug_errors=0andmax_absolute_error=0. Each test runs 41 draws with this change and 40 ond311159; the extra draw is the new one.tests/docs_links_check.pyandtests/bidi_controls_check.pypass.tests/pixel_aot_check.py binarypasses with the program added to the binary fixtures: LLVM 15.0.6llvm-mcandllvm-objcopy, disassembled throughlibLLVM-17.soandlibLLVM-18.soon Linux (no shared LLVM 15 library was available). Unchanged main passes the same check with both libraries. The Ubuntu CI job runs it with LLVM 15.Evidence and follow-up
The fixture is synthetic: inputs 1.5, 2.5, -3.0 and 0.75, literals 0.25, 3.0, -0.5 and 0.5, each instruction drawn twice. Every product and sum is exact in binary32 and in the half export, so the reference does not depend on fusion, following the existing arithmetic fixtures. Negative controls: for each channel, a reference that swaps the literal with S1 must report
pixel_mismatch, and all four do. The controls also check that the four results lower throughmad(with the literal decoded as a bit pattern, and that a register in the literal position or a missing operand is refused. The translator ond311159rejects the program at its firstv_fmaak_f32.Whether the existing
v_fma_f32lowering is fused on every adapter is not measured by this fixture, as for the other arithmetic draws.Checklist
AI-assisted: yes. Written with Claude; verified on the hardware listed above.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T21:28:25Z.
At
21ed15a, the merge conflicts are intests/pixel_aot_check.py. Please retain the fmaak/fmamk literal-position cases and landed ceiling draw in the combined runner.Imported from R0Y00/Xbox2Windows. Originally posted by Its3rr0rsWRLD on 2026-11-21T21:41:59Z.
Rebased onto
b53bfb0after #270 and #299. The only conflict was thecheck_binaryfixture list: it keeps the fixture loop on main and adds the fmaak/fmamk program. Nothing else changed.At
99b69d2(b53bfb0plus this change), Windows 10 Enterprise 26H2 build 26300.9974, MSVC 14.51.36231, Windows SDK 10.0.26100.0 DXC:pixel_aot_hardware: Passed, NVIDIA GeForce RTX 4070 Ti (10de:2782), driver 32.0.16.1088.pixel_aot_warp: Passed, WARP 10.0.26100.9818.b53bfb0, every onedebug_errors=0andmax_absolute_error=0.tests/pixel_aot_check.py binary, the controls,docs_links_check.pyandbidi_controls_check.pypass on Linux with LLVM 15.0.6 tools and libLLVM 17 and 18.This branch merges cleanly with each of my other open pixel_aot pull requests.