shader: lower v_dot2c_f32_f16_dpp in the pixel AOT path #3649

Open
github-bot wants to merge 9 commits from github-bot/gh-3647 into main AGit
Owner

@⁠lambirou on GitHub · 2026-11-30 20:59 UTC · original
lambirou:shader/f16-dot2c-dpp → main · +779 −40 · 7 files · 9 commits · open

Stacked on #3596 (base commit c955d9f3, which includes the origin/main a3bfd019 merge). The plain v_dot2c_f32_f16 lowering lives there; this PR adds only the two remaining DPP forms. While #3596 is open the GitHub diff includes that stack; after it lands this PR is the DPP delta.

Problem

The f16 coverage plan left exactly two lines for v_dot2c_f32_f16_dpp: DPP16 and DPP8. The pixel AOT path lowered the plain form but refused the DPP spellings, so both reference rows stayed uncovered.

Change

  • tools/pixel_aot.py: lower v_dot2c_f32_f16_dpp for quad-local DPP16 and DPP8. SRC0 is quad-swizzled with emit_quad_swizzle_u32; SRC1 and the in-place binary32 accumulator stay on the current lane. The lowering reuses f16_dot2c_result and the plain binary32 subnormal-accumulator fixup.
  • dot2c_quad_word and dot2c_quad_accumulator keep either one proven word or four words selected per quad lane by v_cndmask_b32 with a constant SGPR mask. Every lane word's two halves must be finite; every accumulator word must be a finite binary32.
  • Refusals: partial row_mask/bank_mask, bound_ctrl, fi, cross-quad or non-repeated DPP8, mixed controls, source modifiers, non-VGPR operands, a destination outside v0..v255, an outstanding sample, a non-entry EXEC mask, an unknown or non-preserved denormal profile, round-toward-zero, and non-finite words or accumulators.
  • tests/pixel_aot_check.py: six-program draw draw-f16-dot2c-dpp. Four uniform programs cover all sixteen plain dot2c rows, readers and chains. The two lane programs select four different finite words for SRC0, SRC1 and the accumulator with the constant SGPR masks s52/s53, broadcast each lane's result, and compare the per-lane reference f16_dot2c_reference(src0[perm[l]], src1[l], acc[l]); all four results are distinct and identity differs from both tested permutations.
  • Six mutations must each report pixel_mismatch: SRC1 high half, accumulator read as a binary16 lane, high product dropped, subnormal-accumulator fixup removed under -denorm ftz, the DPP16 QuadReadAcrossX swizzle deleted from the lowering, and the DPP8 [1,2,3,0] cycle replaced by its inverse [3,0,1,2].
  • tests/cmake/pixel_aot_f16_dot2c_dpp.cmake: pixel_aot_f16_dot2c_dpp_warp and pixel_aot_f16_dot2c_dpp_hardware, 90 s, capability skip 77, with FORM_COVERAGE_RECORD.
  • tests/form_coverage_check.py: check_dpp_f16_dot2c_forms pins exactly the two forms and leaves the plain dot2c and unary DPP neighbours uncovered.
  • tools/scan_unsupported_shaders.py and tests/rdna2_tools_check.py: the scanner accepts the DPP16/DPP8 dot2c shapes and the v_mov_b32_dpp broadcast; test_binary16_dpp_dot2c_scanner_translator_agreement checks agreement.
  • docs/experiments.md: experiment note.

Tests

After merging origin/main a3bfd019, head b0c18f79 was validated with python -B tests/form_coverage_check.py, python -B tests/rdna2_tools_check.py (164 tests, 19 skips), python -B tests/pixel_aot_check.py, and ctest --preset dev --no-tests=error -R '^pixel_aot_(f16_dot2c_dpp|f16_vop23|f16_dpp_unary|f16_dpp_unary_rest)_' -V (8/8 passed).

Exact commands, from the original branch:

  • python -B tests/form_coverage_check.py -> form coverage checks passed.
  • python -B tests/rdna2_tools_check.py -> Ran 164 tests ... OK (skipped=19).
  • cmake --preset dev -DINTAKE_PYTHON="<venv>/python.exe" then cmake --build --preset dev -> exit 0.
  • ctest --preset dev --no-tests=error -R '^pixel_aot_f16_dot2c_dpp_' -V -> both pixel_aot_f16_dot2c_dpp_warp and pixel_aot_f16_dot2c_dpp_hardware pass; the six mutation batches print statuses ['mismatch'].
  • Regressions: pixel_aot_f16_vop23_warp, pixel_aot_f16_dpp_unary_warp and pixel_aot_f16_dpp_unary_rest_warp pass.
  • python -B tests/pixel_aot_check.py controls (also exercised by form_coverage_check.py) pass.

Hardware: AMD Radeon RX 9060 XT, driver 32.0.32029.2010, Windows 11 build 26300.10075. WARP: d3d10warp.dll 10.0.26100.10068. The targeted runs exposed no capability skip. rdna2_tools_check.py reports 19 LLVM-dependent skips separately.

The GitHub Linux pixel-binary job runs tests/pixel_aot_check.py binary with LLVM 15. LLVM 15's llvm-mc-15 -mcpu=gfx1013 rejects v_dot2c_f32_f16_dpp as instruction not supported on this GPU, so the binary fixture round-trip excludes the two DPP forms; the pure-Python controls, form_coverage_check.py and both D3D12 draws cover them, while the plain v_dot2c_f32_f16 fixture still round-trips. No LLVM 15 llvm-mc was available locally, so this limitation was found on the CI job rather than reproduced on the host.

Coverage delta

Measured on this branch: the fixture adds exactly 2 forms in docs/coverage/gfx1013.tsv and 2 in docs/coverage/rdna2.tsv (DPP16/DPP8 v_dot2c_f32_f16_dpp). The documented stack totals move from 1627/1968 and 1581/1863 to 1629/1968 and 1583/1863.

Limits

The high half of the destination is not observed. Runtime sources beyond the four-word constant-mask select are refused; lane routing is measured for the two lane programs only, not for dynamic controls or a partial EXEC mask. The console's denormal and rounding state is not measured; NaN and infinity words are refused before lowering. No title is known to execute these forms.

AI-assisted.

**@⁠lambirou** on GitHub · 2026-11-30 20:59 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3647) `lambirou:shader/f16-dot2c-dpp` → `main` · +779 −40 · 7 files · 9 commits · open Stacked on #3596 (base commit `c955d9f3`, which includes the `origin/main` `a3bfd019` merge). The plain `v_dot2c_f32_f16` lowering lives there; this PR adds only the two remaining DPP forms. While #3596 is open the GitHub diff includes that stack; after it lands this PR is the DPP delta. ## Problem The f16 coverage plan left exactly two lines for `v_dot2c_f32_f16_dpp`: `DPP16` and `DPP8`. The pixel AOT path lowered the plain form but refused the DPP spellings, so both reference rows stayed uncovered. ## Change - `tools/pixel_aot.py`: lower `v_dot2c_f32_f16_dpp` for quad-local DPP16 and DPP8. SRC0 is quad-swizzled with `emit_quad_swizzle_u32`; SRC1 and the in-place binary32 accumulator stay on the current lane. The lowering reuses `f16_dot2c_result` and the plain binary32 subnormal-accumulator fixup. - `dot2c_quad_word` and `dot2c_quad_accumulator` keep either one proven word or four words selected per quad lane by `v_cndmask_b32` with a constant SGPR mask. Every lane word's two halves must be finite; every accumulator word must be a finite binary32. - Refusals: partial `row_mask`/`bank_mask`, `bound_ctrl`, `fi`, cross-quad or non-repeated DPP8, mixed controls, source modifiers, non-VGPR operands, a destination outside `v0`..`v255`, an outstanding sample, a non-entry `EXEC` mask, an unknown or non-preserved denormal profile, round-toward-zero, and non-finite words or accumulators. - `tests/pixel_aot_check.py`: six-program draw `draw-f16-dot2c-dpp`. Four uniform programs cover all sixteen plain dot2c rows, readers and chains. The two lane programs select four different finite words for SRC0, SRC1 and the accumulator with the constant SGPR masks `s52`/`s53`, broadcast each lane's result, and compare the per-lane reference `f16_dot2c_reference(src0[perm[l]], src1[l], acc[l])`; all four results are distinct and identity differs from both tested permutations. - Six mutations must each report `pixel_mismatch`: SRC1 high half, accumulator read as a binary16 lane, high product dropped, subnormal-accumulator fixup removed under `-denorm ftz`, the DPP16 `QuadReadAcrossX` swizzle deleted from the lowering, and the DPP8 `[1,2,3,0]` cycle replaced by its inverse `[3,0,1,2]`. - `tests/cmake/pixel_aot_f16_dot2c_dpp.cmake`: `pixel_aot_f16_dot2c_dpp_warp` and `pixel_aot_f16_dot2c_dpp_hardware`, 90 s, capability skip 77, with `FORM_COVERAGE_RECORD`. - `tests/form_coverage_check.py`: `check_dpp_f16_dot2c_forms` pins exactly the two forms and leaves the plain dot2c and unary DPP neighbours uncovered. - `tools/scan_unsupported_shaders.py` and `tests/rdna2_tools_check.py`: the scanner accepts the DPP16/DPP8 dot2c shapes and the `v_mov_b32_dpp` broadcast; `test_binary16_dpp_dot2c_scanner_translator_agreement` checks agreement. - `docs/experiments.md`: experiment note. ## Tests After merging `origin/main` `a3bfd019`, head `b0c18f79` was validated with `python -B tests/form_coverage_check.py`, `python -B tests/rdna2_tools_check.py` (164 tests, 19 skips), `python -B tests/pixel_aot_check.py`, and `ctest --preset dev --no-tests=error -R '^pixel_aot_(f16_dot2c_dpp|f16_vop23|f16_dpp_unary|f16_dpp_unary_rest)_' -V` (8/8 passed). Exact commands, from the original branch: - `python -B tests/form_coverage_check.py` -> `form coverage checks passed`. - `python -B tests/rdna2_tools_check.py` -> `Ran 164 tests ... OK (skipped=19)`. - `cmake --preset dev -DINTAKE_PYTHON="<venv>/python.exe"` then `cmake --build --preset dev` -> exit 0. - `ctest --preset dev --no-tests=error -R '^pixel_aot_f16_dot2c_dpp_' -V` -> both `pixel_aot_f16_dot2c_dpp_warp` and `pixel_aot_f16_dot2c_dpp_hardware` pass; the six mutation batches print `statuses ['mismatch']`. - Regressions: `pixel_aot_f16_vop23_warp`, `pixel_aot_f16_dpp_unary_warp` and `pixel_aot_f16_dpp_unary_rest_warp` pass. - `python -B tests/pixel_aot_check.py` controls (also exercised by `form_coverage_check.py`) pass. Hardware: AMD Radeon RX 9060 XT, driver 32.0.32029.2010, Windows 11 build 26300.10075. WARP: `d3d10warp.dll 10.0.26100.10068`. The targeted runs exposed no capability skip. `rdna2_tools_check.py` reports 19 LLVM-dependent skips separately. The GitHub Linux `pixel-binary` job runs `tests/pixel_aot_check.py binary` with LLVM 15. LLVM 15's `llvm-mc-15 -mcpu=gfx1013` rejects `v_dot2c_f32_f16_dpp` as `instruction not supported on this GPU`, so the binary fixture round-trip excludes the two DPP forms; the pure-Python controls, `form_coverage_check.py` and both D3D12 draws cover them, while the plain `v_dot2c_f32_f16` fixture still round-trips. No LLVM 15 `llvm-mc` was available locally, so this limitation was found on the CI job rather than reproduced on the host. ## Coverage delta Measured on this branch: the fixture adds exactly 2 forms in `docs/coverage/gfx1013.tsv` and 2 in `docs/coverage/rdna2.tsv` (`DPP16`/`DPP8` `v_dot2c_f32_f16_dpp`). The documented stack totals move from 1627/1968 and 1581/1863 to 1629/1968 and 1583/1863. ## Limits The high half of the destination is not observed. Runtime sources beyond the four-word constant-mask select are refused; lane routing is measured for the two lane programs only, not for dynamic controls or a partial `EXEC` mask. The console's denormal and rounding state is not measured; NaN and infinity words are refused before lowering. No title is known to execute these forms. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 21:04:12 +00:00
github-bot force-pushed github-bot/gh-3647 from 9988f10af6 to adff329207 2026-11-30 21:10:07 +00:00 Compare
Keep both sides' additions: draw-f16-vop2-vop3-arith from this branch and draw-interp-mov plus the f64 minmax/ldexp coverage from main (#3623, #3607).
Bring in origin/main a3bfd019 through the updated #3594 stack head c955d9f3. Keep draw-f16-dot2c-dpp, draw-f16-vop2-vop3-arith and main's draw-interp-mov in the draw-mode list.
Author
Owner

@⁠lukaslw-lab on GitHub · 2026-12-01 02:45 UTC · original · requested changes

Reviewed b0c18f79 by reading the diff; not built or run. Stacked on #3596, so I read this PR's own change against c955d9f3.

Verdict: changes requested. The new constant-mask v_cndmask_b32 path lowers any known SGPR mask as if it repeated every quad, which is wrong for non-periodic masks, including the ones the fixture uses.

  • MUST tools/pixel_aot.py:7918-7927: when the lane-mask SGPR holds a known integer, the select keeps scalar[...] & 0xf and picks per WaveGetLaneIndex() & 3. On the guest, bit L of the mask selects lane L of the whole wave. So s_mov_b32 s52, 0x5 selects lanes 0 and 2 only, and every other lane takes the unset operand. The lowering instead selects quad lanes 0 and 2 in every quad. This path is not limited to dot2c: any v_cndmask_b32 with a constant SGPR mask, which was refused before, now takes it. The fixture (s52 = 0x5, s53 = 0x3) and its per-quad-lane reference share the assumption, so the draw cannot catch it. Accept only quad-periodic masks (value == (value & 0xf) * 0x11111111) and refuse the rest as before. Then the fixture needs 0x55555555/0x33333333, plus a control that 0x5 is refused.
  • NIT The body notes that LLVM 15 -mcpu=gfx1013 rejects v_dot2c_f32_f16_dpp. If gfx1013 has no encoding for these forms, the "+2 gfx1013" coverage claim should say so.
  • Checked, no finding:
    • The DPP dot2c lowering itself (:8319) matches the plain #3596 model. Only SRC0 is quad-swizzled; the arithmetic and the subnormal-accumulator fixup are unchanged.
    • The static per-lane results are computed with bits0[perm[lane]], the same permutation as the emitted swizzle. The operand and profile refusals are complete.
    • The CMake fragment only registers the two draws (skip 77).

Tests: the six-program draw and its six mutations prove the dot2c arithmetic and the DPP16/DPP8 routing. Their lane programs inherit the periodic-mask assumption above. CI ran pixel_aot_check.py, form_coverage_check.py and rdna2_tools_check.py at this head. The draws are outside the pr filter.

**@⁠lukaslw-lab** on GitHub · 2026-12-01 02:45 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3647#pullrequestreview-6124250159) · **requested changes** Reviewed `b0c18f79` by reading the diff; not built or run. Stacked on #3596, so I read this PR's own change against `c955d9f3`. **Verdict: changes requested.** The new constant-mask `v_cndmask_b32` path lowers any known SGPR mask as if it repeated every quad, which is wrong for non-periodic masks, including the ones the fixture uses. - **MUST** `tools/pixel_aot.py:7918-7927`: when the lane-mask SGPR holds a known integer, the select keeps `scalar[...] & 0xf` and picks per `WaveGetLaneIndex() & 3`. On the guest, bit L of the mask selects lane L of the whole wave. So `s_mov_b32 s52, 0x5` selects lanes 0 and 2 only, and every other lane takes the unset operand. The lowering instead selects quad lanes 0 and 2 in every quad. This path is not limited to dot2c: any `v_cndmask_b32` with a constant SGPR mask, which was refused before, now takes it. The fixture (`s52 = 0x5`, `s53 = 0x3`) and its per-quad-lane reference share the assumption, so the draw cannot catch it. Accept only quad-periodic masks (`value == (value & 0xf) * 0x11111111`) and refuse the rest as before. Then the fixture needs `0x55555555`/`0x33333333`, plus a control that `0x5` is refused. - **NIT** The body notes that LLVM 15 `-mcpu=gfx1013` rejects `v_dot2c_f32_f16_dpp`. If gfx1013 has no encoding for these forms, the "+2 gfx1013" coverage claim should say so. - Checked, no finding: - The DPP dot2c lowering itself (`:8319`) matches the plain #3596 model. Only SRC0 is quad-swizzled; the arithmetic and the subnormal-accumulator fixup are unchanged. - The static per-lane results are computed with `bits0[perm[lane]]`, the same permutation as the emitted swizzle. The operand and profile refusals are complete. - The CMake fragment only registers the two draws (skip 77). Tests: the six-program draw and its six mutations prove the dot2c arithmetic and the DPP16/DPP8 routing. Their lane programs inherit the periodic-mask assumption above. CI ran `pixel_aot_check.py`, `form_coverage_check.py` and `rdna2_tools_check.py` at this head. The draws are outside the `pr` filter.
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-03 07:59 UTC · original

#3596 is in main at 0b83a346. I tested replaying only adff32920 on f9b112b9: the two conflicts were the draw selector in tests/pixel_aot_check.py and the ordinary v_cndmask branch next to main’s existing SDWA handler in tools/pixel_aot.py. Keeping the new ordinary-select lane proof, the main SDWA handler, and both draw selectors passed the Python checks and all six WARP mutations. Main already has the SDWA handler that be3c01565 adds on the old branch.

One hardware test gap reproduced both on the trial tree and on exact head f667cf75: with SDK DXC 10.0.26100, RTX 4060 Laptop (32.0.16.1656, Windows build 26300), draw-f16-dot2c-dpp reached the mutation phase with its reference and FTZ draws passing, but no_fixup on dot2c_dpp8 returned ['pass']. WARP 10.0.26100.9818 reported the expected mismatch. Please keep the mutation coverage when refreshing the branch and distinguish the backend's observed denormal behavior from a numerical mismatch in the unmodified draw.

**@⁠R0Y00** on GitHub · 2026-12-03 07:59 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3647#issuecomment-7371691112) #3596 is in `main` at `0b83a346`. I tested replaying only `adff32920` on `f9b112b9`: the two conflicts were the draw selector in `tests/pixel_aot_check.py` and the ordinary `v_cndmask` branch next to main’s existing SDWA handler in `tools/pixel_aot.py`. Keeping the new ordinary-select lane proof, the main SDWA handler, and both draw selectors passed the Python checks and all six WARP mutations. Main already has the SDWA handler that `be3c01565` adds on the old branch. One hardware test gap reproduced both on the trial tree and on exact head `f667cf75`: with SDK DXC 10.0.26100, RTX 4060 Laptop (32.0.16.1656, Windows build 26300), `draw-f16-dot2c-dpp` reached the mutation phase with its reference and FTZ draws passing, but `no_fixup` on `dot2c_dpp8` returned `['pass']`. WARP 10.0.26100.9818 reported the expected mismatch. Please keep the mutation coverage when refreshing the branch and distinguish the backend's observed denormal behavior from a numerical mismatch in the unmodified draw.
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-03 11:15 UTC · original

Re-tested cdc773dd after the clean merge from main. Windows 11 build 26300, SDK DXC 10.0.26100, inbox WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656. The RDNA2 Python suite completed (168 cases, 19 skipped). The draw-f16-dot2c-dpp fixture passed on WARP, including all six mutations. RTX passed the unmodified readback and reached the mutation checks, but removing the subnormal accumulator fixup still returns ['pass'] for dot2c_dpp8; the hardware test fails on that assertion. This is the same issue after the rebase. Please preserve the WARP mismatch check and account for the RTX result before landing. A fixture that catches the mutation on both adapters, or a separately proven FTZ capability condition, would make the hardware verdict reproducible.

**@⁠R0Y00** on GitHub · 2026-12-03 11:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3647#issuecomment-7376430119) Re-tested cdc773dd after the clean merge from main. Windows 11 build 26300, SDK DXC 10.0.26100, inbox WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656. The RDNA2 Python suite completed (168 cases, 19 skipped). The draw-f16-dot2c-dpp fixture passed on WARP, including all six mutations. RTX passed the unmodified readback and reached the mutation checks, but removing the subnormal accumulator fixup still returns ['pass'] for dot2c_dpp8; the hardware test fails on that assertion. This is the same issue after the rebase. Please preserve the WARP mismatch check and account for the RTX result before landing. A fixture that catches the mutation on both adapters, or a separately proven FTZ capability condition, would make the hardware verdict reproducible.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3649/head:github-bot/gh-3647'
git switch 'github-bot/gh-3647'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3647'
git switch 'github-bot/gh-3647'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3647'
git switch 'github-bot/gh-3647'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3647'
git switch 'main'
git merge --squash 'github-bot/gh-3647'
git switch 'main'
git merge --ff-only 'github-bot/gh-3647'
git switch 'main'
git merge 'github-bot/gh-3647'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.