shader: lower quad-local DPP16 and DPP8 cvt_flr, cvt_rpi, and cvt_pkrtz in pixel_aot #1934

Merged
KomaGuy merged 1 commit from upstream-pr/1941 into main 2026-11-24 22:06:44 +00:00
KomaGuy commented 2026-11-24 21:57:17 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-24T21:57:17Z.


Summary

Follow-up to #421 lowering the remaining 3 non-scalar-f16 conversion DPP opcodes (6 forms total across DPP16 and DPP8 on gfx1013 and rdna2):

  • v_cvt_flr_i32_f32_dpp & v_cvt_rpi_i32_f32_dpp (4 forms): Added to DPP_CVT in tools/pixel_aot.py, reusing the shared cvt_flr_i32_f32 and cvt_rpi_i32_f32 helpers (including NaN/inf/saturation from #1885), with DPP16 abs/neg bit modifiers and DPP8 modifier refusal.
  • v_cvt_pkrtz_f16_f32_dpp (2 forms): Swizzles src0 across the quad via emit_quad_swizzle_u32, keeps src1 on the current lane, supports DPP16 abs/neg on either source (refused on DPP8), respects HALF_ROUNDING_EXEMPT, and writes the same compressed-export pair tuple as v_cvt_pkrtz_f16_f32_e32 (keeping non-export ALU reads refused).
  • Tests & coverage:
    • Extended check_dpp_cvt_draw (pixel_aot_dpp_cvt_{warp,hardware}) with DPP_CVT_FLR_RPI (6 rows + 5 mutations) and dpp_pkrtz_program() (2 compressed-export rows + RTZ-vs-RNE wrong-reference mismatch + 4 routing/modifier mutations).
    • Extended check_dpp_cvt_refusals, check_binary (LLVM binary round-trip for both new fixtures), tests/form_coverage_check.py (all 6 forms counted on gfx1013.tsv and rdna2.tsv, _sdwa kept excluded), and docs/experiments.md.

Verification

  • Tested locally on Linux:
    • python3 -B tests/pixel_aot_check.py — passed
    • python3 -B tests/rdna2_tools_check.py — 149 tests OK
    • form_coverage_check.check_shader_records() — passed (+6 DPP16/DPP8 forms on gfx1013 and rdna2)
    • Assembled both new programs with llvm-mc-19 -triple=amdgcn--amdpal -mcpu=gfx1013 and verified round-trip translation via both disasm_rdna2 and libLLVM-19.so
    • docs_links_check.py, bidi_controls_check.py, git diff --check — passed
  • Windows DXC / WARP draw execution (pixel_aot_dpp_cvt_warp) and LLVM 15 fixture assembly are pending CI.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6592215805 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1941). Originally posted by [KomaGuy](https://github.com/KomaGuy) on 2026-11-24T21:57:17Z. --- ### Summary Follow-up to #421 lowering the remaining 3 non-scalar-f16 conversion DPP opcodes (**6 forms total** across `DPP16` and `DPP8` on `gfx1013` and `rdna2`): - **`v_cvt_flr_i32_f32_dpp` & `v_cvt_rpi_i32_f32_dpp`** (4 forms): Added to `DPP_CVT` in `tools/pixel_aot.py`, reusing the shared `cvt_flr_i32_f32` and `cvt_rpi_i32_f32` helpers (including NaN/inf/saturation from #1885), with DPP16 `abs`/`neg` bit modifiers and DPP8 modifier refusal. - **`v_cvt_pkrtz_f16_f32_dpp`** (2 forms): Swizzles `src0` across the quad via `emit_quad_swizzle_u32`, keeps `src1` on the current lane, supports DPP16 `abs`/`neg` on either source (refused on DPP8), respects `HALF_ROUNDING_EXEMPT`, and writes the same compressed-export pair tuple as `v_cvt_pkrtz_f16_f32_e32` (keeping non-export ALU reads refused). - **Tests & coverage**: - Extended `check_dpp_cvt_draw` (`pixel_aot_dpp_cvt_{warp,hardware}`) with `DPP_CVT_FLR_RPI` (6 rows + 5 mutations) and `dpp_pkrtz_program()` (2 compressed-export rows + RTZ-vs-RNE wrong-reference mismatch + 4 routing/modifier mutations). - Extended `check_dpp_cvt_refusals`, `check_binary` (LLVM binary round-trip for both new fixtures), `tests/form_coverage_check.py` (all 6 forms counted on `gfx1013.tsv` and `rdna2.tsv`, `_sdwa` kept excluded), and `docs/experiments.md`. ### Verification - Tested locally on Linux: - `python3 -B tests/pixel_aot_check.py` — passed - `python3 -B tests/rdna2_tools_check.py` — 149 tests OK - `form_coverage_check.check_shader_records()` — passed (+6 DPP16/DPP8 forms on `gfx1013` and `rdna2`) - Assembled both new programs with `llvm-mc-19 -triple=amdgcn--amdpal -mcpu=gfx1013` and verified round-trip translation via both `disasm_rdna2` and `libLLVM-19.so` - `docs_links_check.py`, `bidi_controls_check.py`, `git diff --check` — passed - Windows DXC / WARP draw execution (`pixel_aot_dpp_cvt_warp`) and LLVM 15 fixture assembly are pending CI.
upstream-sync closed this pull request 2026-11-24 23:03:09 +00:00
tedin7 commented 2026-11-24 23:03:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T22:06:01Z.

Review: COMMENTED


Review of head f6c377b90f0701e7906e89730f40bcd774903590.

Result: 0 P1, 0 P2. No blocking findings.

Read the full diff (tools/pixel_aot.py, tests/pixel_aot_check.py, tests/form_coverage_check.py, docs/experiments.md). No CMakeLists.txt change. Clean-room: no external code or vendor material, only the lowering and its tests.

Commands run:

  • python3 tests/pixel_aot_check.py on Linux: PASS
  • python3 tests/docs_links_check.py: PASS
  • python3 tests/bidi_controls_check.py: PASS
  • git diff --check origin/main...HEAD: PASS
  • git merge-tree --write-tree --name-only origin/main HEAD: no conflicts
  • tests/form_coverage_check.py locally needs iced_x86 (not installed here); it ran and passed inside the Windows run and the Linux CI job passed.
  • Win2025 (Build 26100, MSVC 14.44, D3D12 WARP), Debug and Release /O2, ctest -R '^pixel_aot_dpp_cvt_': 2/2 passed in each, plus tests/pixel_aot_check.py ok.
  • CI at this head: Windows build and test, Linux Python checks, gfx1013 fixtures all pass.

Mutations (each restored with git checkout -- .):

  1. In the v_cvt_pkrtz_f16_f32_dpp lowering, swap the (lo, hi) pair: Linux check does not see it, but both Win2025 draw tests pixel_aot_dpp_cvt_warp and pixel_aot_dpp_cvt_hardware FAIL with a pixel mismatch. Killed.
  2. Map cvt_rpi_i32_f32 to the floor helper in DPP_CVT: tests/pixel_aot_check.py fails (check_dpp_cvt_refusals). Killed.

Notes (non-blocking): the new pkrtz result is a tuple that is only valid for compressed export; the docs state that non-export reads are refused.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6048154849 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1941#pullrequestreview-6048154849). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T22:06:01Z. **Review:** COMMENTED --- Review of head `f6c377b90f0701e7906e89730f40bcd774903590`. Result: 0 P1, 0 P2. No blocking findings. Read the full diff (tools/pixel_aot.py, tests/pixel_aot_check.py, tests/form_coverage_check.py, docs/experiments.md). No CMakeLists.txt change. Clean-room: no external code or vendor material, only the lowering and its tests. Commands run: - `python3 tests/pixel_aot_check.py` on Linux: PASS - `python3 tests/docs_links_check.py`: PASS - `python3 tests/bidi_controls_check.py`: PASS - `git diff --check origin/main...HEAD`: PASS - `git merge-tree --write-tree --name-only origin/main HEAD`: no conflicts - `tests/form_coverage_check.py` locally needs `iced_x86` (not installed here); it ran and passed inside the Windows run and the Linux CI job passed. - Win2025 (Build 26100, MSVC 14.44, D3D12 WARP), Debug and Release /O2, `ctest -R '^pixel_aot_dpp_cvt_'`: 2/2 passed in each, plus `tests/pixel_aot_check.py` ok. - CI at this head: Windows build and test, Linux Python checks, gfx1013 fixtures all pass. Mutations (each restored with `git checkout -- .`): 1. In the `v_cvt_pkrtz_f16_f32_dpp` lowering, swap the (lo, hi) pair: Linux check does not see it, but both Win2025 draw tests `pixel_aot_dpp_cvt_warp` and `pixel_aot_dpp_cvt_hardware` FAIL with a pixel mismatch. Killed. 2. Map `cvt_rpi_i32_f32` to the floor helper in `DPP_CVT`: `tests/pixel_aot_check.py` fails (`check_dpp_cvt_refusals`). Killed. Notes (non-blocking): the new pkrtz result is a tuple that is only valid for compressed export; the docs state that non-export reads are refused. AI-assisted; commands listed were executed locally.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1934
No description provided.