shader: lower gfx1013 v_fmaak_f32 and v_fmamk_f32 in pixel_aot #292

Manually merged
github merged 2 commits from gh-pr/292/head into gh-pr/292/base 2026-11-26 21:40:41 +00:00
Owner

@⁠Its3rr0rsWRLD on GitHub · 2026-11-21 21:01 UTC · original
Its3rr0rsWRLD:shader/fmaak-fmamk → main · +61 −0 · 3 files · 2 commits · merged 2026-11-21 21:56 UTC

Change

pixel_aot rejected v_fmaak_f32 and v_fmamk_f32, the VOP2 multiply-adds with a 32-bit literal K: v_fmaak_f32 computes S0 × S1 + K and v_fmamk_f32 computes S0 × K + S1. Both now use the existing v_fma_f32 lowering 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 touches lower() in tools/pixel_aot.py and adds a draw to tests/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.py and docs/experiments.md. The two branches touch separate lines; I merged them in both orders onto d311159 without conflicts, and the combined controls pass. Neither depends on the other.

Verification

Commit d311159 plus this change, Windows 10 Enterprise 26H2 build 26300.9974, MSVC 14.51.36231, Windows SDK 10.0.26100.0 DXC.

ctest --preset dev --no-tests=error -R '^pixel_aot_' -V
  • 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.
  • Every draw reports debug_errors=0 and max_absolute_error=0. Each test runs 41 draws with this change and 40 on d311159; the extra draw is the new one.
  • tests/docs_links_check.py and tests/bidi_controls_check.py pass.
  • tests/pixel_aot_check.py binary passes with the program added to the binary fixtures: LLVM 15.0.6 llvm-mc and llvm-objcopy, disassembled through libLLVM-17.so and libLLVM-18.so on 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 through mad( with the literal decoded as a bit pattern, and that a register in the literal position or a missing operand is refused. The translator on d311159 rejects the program at its first v_fmaak_f32.

Whether the existing v_fma_f32 lowering is fused on every adapter is not measured by this fixture, as for the other arithmetic draws.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted: yes. Written with Claude; verified on the hardware listed above.

**@⁠Its3rr0rsWRLD** on GitHub · 2026-11-21 21:01 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/292) `Its3rr0rsWRLD:shader/fmaak-fmamk` → `main` · +61 −0 · 3 files · 2 commits · merged 2026-11-21 21:56 UTC ## Change `pixel_aot` rejected `v_fmaak_f32` and `v_fmamk_f32`, the VOP2 multiply-adds with a 32-bit literal K: `v_fmaak_f32` computes S0 × S1 + K and `v_fmamk_f32` computes S0 × K + S1. Both now use the existing `v_fma_f32` lowering 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 touches `lower()` in `tools/pixel_aot.py` and adds a draw to `tests/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.py` and `docs/experiments.md`. The two branches touch separate lines; I merged them in both orders onto d311159 without conflicts, and the combined controls pass. Neither depends on the other. ## Verification Commit d311159 plus this change, Windows 10 Enterprise 26H2 build 26300.9974, MSVC 14.51.36231, Windows SDK 10.0.26100.0 DXC. ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_' -V ``` - `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. - Every draw reports `debug_errors=0` and `max_absolute_error=0`. Each test runs 41 draws with this change and 40 on d311159; the extra draw is the new one. - `tests/docs_links_check.py` and `tests/bidi_controls_check.py` pass. - `tests/pixel_aot_check.py binary` passes with the program added to the binary fixtures: LLVM 15.0.6 `llvm-mc` and `llvm-objcopy`, disassembled through `libLLVM-17.so` and `libLLVM-18.so` on 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 through `mad(` with the literal decoded as a bit pattern, and that a register in the literal position or a missing operand is refused. The translator on d311159 rejects the program at its first `v_fmaak_f32`. Whether the existing `v_fma_f32` lowering is fused on every adapter is not measured by this fixture, as for the other arithmetic draws. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted: yes. Written with Claude; verified on the hardware listed above.
v_fmaak_f32 computes S0 * S1 + K and v_fmamk_f32 computes S0 * K + S1 with a 32-bit literal K. Lower both through the v_fma_f32 template, accept only a hexadecimal literal in the K position, and draw each twice with exact binary32 inputs. A reference that swaps the literal with S1 must mismatch in every channel.

AI-assisted: yes
Assemble it with LLVM 15, disassemble it from the native program and require the same lowering as the source text, as for the other arithmetic fixtures.

AI-assisted: yes
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:40:39 +00:00
github manually merged commit 99b69d2412 into gh-pr/292/base 2026-11-26 21:40:41 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-21 21:28 UTC · original

At 21ed15a, the merge conflicts are in tests/pixel_aot_check.py. Please retain the fmaak/fmamk literal-position cases and landed ceiling draw in the combined runner.

**@⁠R0Y00** on GitHub · 2026-11-21 21:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/292#issuecomment-7069498283) At `21ed15a`, the merge conflicts are in `tests/pixel_aot_check.py`. Please retain the fmaak/fmamk literal-position cases and landed ceiling draw in the combined runner.
Author
Owner

@⁠Its3rr0rsWRLD on GitHub · 2026-11-21 21:41 UTC · original

Rebased onto b53bfb0 after #270 and #299. The only conflict was the check_binary fixture list: it keeps the fixture loop on main and adds the fmaak/fmamk program. Nothing else changed.

ctest --preset dev --no-tests=error -R '^pixel_aot_' -V

At 99b69d2 (b53bfb0 plus 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.
  • 51 draws on each adapter against 50 on b53bfb0, every one debug_errors=0 and max_absolute_error=0.
  • tests/pixel_aot_check.py binary, the controls, docs_links_check.py and bidi_controls_check.py pass 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.

**@⁠Its3rr0rsWRLD** on GitHub · 2026-11-21 21:41 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/292#issuecomment-7069657178) Rebased onto b53bfb0 after #270 and #299. The only conflict was the `check_binary` fixture list: it keeps the fixture loop on main and adds the fmaak/fmamk program. Nothing else changed. ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_' -V ``` At 99b69d2 (b53bfb0 plus 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. - 51 draws on each adapter against 50 on b53bfb0, every one `debug_errors=0` and `max_absolute_error=0`. - `tests/pixel_aot_check.py binary`, the controls, `docs_links_check.py` and `bidi_controls_check.py` pass 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.