Skip to content

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

Merged
tedin7 merged 1 commit into
R0Y00:mainfrom
KomaGuy:shader/dpp-quad-cvt-flr-rpi-pkrtz
Nov 24, 2026
Merged

tedin7 merged 1 commit into
R0Y00:mainfrom
KomaGuy:shader/dpp-quad-cvt-flr-rpi-pkrtz

Conversation

@KomaGuy

@KomaGuy KomaGuy commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

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 shader: define v_cvt_rpi/flr_i32_f32 for NaN, infinity and overflow in pixel_aot #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.

…tz in pixel_aot

Extend the quad-local conversion DPP16/DPP8 slice (R0Y00#421) with the three
remaining full-32-bit/export conversion opcodes (6 forms total across
DPP16 and DPP8 on gfx1013 and rdna2):

- v_cvt_flr_i32_f32_dpp and v_cvt_rpi_i32_f32_dpp added to DPP_CVT,
  reusing the shared cvt_flr_i32_f32 and cvt_rpi_i32_f32 helpers (handling
  fractional rounding, saturation, infinity, and signed NaNs as in R0Y00#1885)
  with DPP16 abs/neg bit modifiers and DPP8 modifier refusal.
- v_cvt_pkrtz_f16_f32_dpp lowered as a compressed-export pair matching
  v_cvt_pkrtz_f16_f32_e32: src0 is quad-swizzled via emit_quad_swizzle_u32,
  src1 stays on the current lane, DPP16 accepts abs/neg on either source,
  and non-export reads of the packed destination remain refused.

Extend pixel_aot_dpp_cvt_{warp,hardware} with raw-word flr_rpi rows
(including fractional half-integers, overflow, infinities, signed NaNs,
and 5 mutations) and a compressed-export pkrtz draw (with RTZ-vs-RNE
mismatch control and 4 routing/modifier mutations), add both fixtures to
check_binary, and update form_coverage_check and docs/experiments.md.

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@tedin7
tedin7 merged commit ff76a55 into R0Y00:main Nov 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants