pixel_aot: lower 12 integer SDWA forms (bitscan, sat_pk, mul24, co_ci) #2550

Manually merged
github merged 3 commits from gh-pr/2550/head into gh-pr/2550/base 2026-11-27 01:01:24 +00:00
Owner

@⁠KomaGuy on GitHub · 2026-11-25 20:31 UTC · original
KomaGuy:shader/sdwa-int-bit-mul24-coci → main · +386 −7 · 5 files · 3 commits · merged 2026-11-25 20:55 UTC

Summary

Lowers 12 extended 32-bit integer SDWA forms in tools/pixel_aot.py (counted in both docs/coverage/gfx1013.tsv and docs/coverage/rdna2.tsv), with static refusal controls, pixel_aot_sdwa_int_extra_{warp,hardware} draw tests, LLVM 15 check_binary fixtures, and form_coverage_check coverage assertions:

  • Bit-scan & reverse (4): v_bfrev_b32_sdwa, v_ffbl_b32_sdwa, v_ffbh_u32_sdwa, v_ffbh_i32_sdwa
  • Saturate-pack (1): v_sat_pk_u8_i16_sdwa
  • 24-bit integer multiply (4): v_mul_u32_u24_sdwa, v_mul_i32_i24_sdwa, v_mul_hi_u32_u24_sdwa, v_mul_hi_i32_i24_sdwa
  • Carry-in add/sub/subrev (3): v_add_co_ci_u32_sdwa, v_sub_co_ci_u32_sdwa, v_subrev_co_ci_u32_sdwa

Contracts & Semantics

  • Sources: Accepts VGPR or SGPR sources with BYTE_0..3, WORD_0..1, or DWORD selection and optional sext(), refusing float modifiers (-/|.|/abs()), inline constants, literals, unbalanced sext(), wrong arity, low16/half16 tags, pending scalar loads, and outstanding samples.
  • Destination placement: Places results via dst_sel + UNUSED_PAD/UNUSED_PRESERVE, refusing UNUSED_SEXT, UNUSED_PRESERVE on untracked/non-numeric destinations, clamp, and omod.
  • Carry-in forms (v_{add,sub,subrev}_co_ci_u32_sdwa): Require matching vcc/vcc_lo carry-out and carry-in backed by a tracked condition, compute the full 32-bit carry/borrow-out into vcc before SDWA destination placement, and chain cleanly into subsequent carry-in ops and v_cndmask_b32.
  • SDWA_INT preserved: New table SDWA_INT_EXTRA keeps existing 15-op SDWA_INT scanner/test assertions intact while updating the pre-SDWA refusal entries in tests/pixel_aot_check.py and tests/form_coverage_check.py.

Verification

  • Ran locally on Linux:
    • python3 tests/pixel_aot_check.py (including new check_sdwa_int_extra_controls)
    • form_coverage_check: check_sdwa_int_extra_forms (+12 forms in gfx1013.tsv and rdna2.tsv, unlowered neighbours excluded, single-opcode removal control), check_shader_records, check_plain_bitscan_forms, check_sdwa_f16_forms, check_sdwa_cmp_coverage
    • Independent Python simulation across all 3 draw fixtures (9 runtime rows) and all 13 mutations (every mutation kills 2/3 or 3/3 rows) + inspection of generated HLSL
    • python3 tests/docs_links_check.py, python3 tests/bidi_controls_check.py, python3 tests/rdna2_tools_check.py (156 tests OK)
    • git merge-tree --write-tree --name-only origin/main HEAD and git diff --check origin/main
  • Runs in CI:
    • LLVM 15 pixel_aot_binary assembly/disassembly round-trips for all 3 SDWA_INT_EXTRA_PROGRAMS fixtures
    • Windows D3D12 pixel_aot_sdwa_int_extra_warp / pixel_aot_sdwa_int_extra_hardware draws and all 13 mutations
**@⁠KomaGuy** on GitHub · 2026-11-25 20:31 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2550) `KomaGuy:shader/sdwa-int-bit-mul24-coci` → `main` · +386 −7 · 5 files · 3 commits · merged 2026-11-25 20:55 UTC ## Summary Lowers **12 extended 32-bit integer `SDWA` forms** in `tools/pixel_aot.py` (counted in both `docs/coverage/gfx1013.tsv` and `docs/coverage/rdna2.tsv`), with static refusal controls, `pixel_aot_sdwa_int_extra_{warp,hardware}` draw tests, LLVM 15 `check_binary` fixtures, and `form_coverage_check` coverage assertions: - **Bit-scan & reverse (4):** `v_bfrev_b32_sdwa`, `v_ffbl_b32_sdwa`, `v_ffbh_u32_sdwa`, `v_ffbh_i32_sdwa` - **Saturate-pack (1):** `v_sat_pk_u8_i16_sdwa` - **24-bit integer multiply (4):** `v_mul_u32_u24_sdwa`, `v_mul_i32_i24_sdwa`, `v_mul_hi_u32_u24_sdwa`, `v_mul_hi_i32_i24_sdwa` - **Carry-in add/sub/subrev (3):** `v_add_co_ci_u32_sdwa`, `v_sub_co_ci_u32_sdwa`, `v_subrev_co_ci_u32_sdwa` ## Contracts & Semantics - **Sources:** Accepts VGPR or SGPR sources with `BYTE_0..3`, `WORD_0..1`, or `DWORD` selection and optional `sext()`, refusing float modifiers (`-`/`|.|`/`abs()`), inline constants, literals, unbalanced `sext()`, wrong arity, `low16`/`half16` tags, pending scalar loads, and outstanding samples. - **Destination placement:** Places results via `dst_sel` + `UNUSED_PAD`/`UNUSED_PRESERVE`, refusing `UNUSED_SEXT`, `UNUSED_PRESERVE` on untracked/non-numeric destinations, `clamp`, and `omod`. - **Carry-in forms (`v_{add,sub,subrev}_co_ci_u32_sdwa`):** Require matching `vcc`/`vcc_lo` carry-out and carry-in backed by a tracked condition, compute the full 32-bit carry/borrow-out into `vcc` before SDWA destination placement, and chain cleanly into subsequent carry-in ops and `v_cndmask_b32`. - **`SDWA_INT` preserved:** New table `SDWA_INT_EXTRA` keeps existing 15-op `SDWA_INT` scanner/test assertions intact while updating the pre-SDWA refusal entries in `tests/pixel_aot_check.py` and `tests/form_coverage_check.py`. ## Verification - **Ran locally on Linux:** - `python3 tests/pixel_aot_check.py` (including new `check_sdwa_int_extra_controls`) - `form_coverage_check`: `check_sdwa_int_extra_forms` (+12 forms in `gfx1013.tsv` and `rdna2.tsv`, unlowered neighbours excluded, single-opcode removal control), `check_shader_records`, `check_plain_bitscan_forms`, `check_sdwa_f16_forms`, `check_sdwa_cmp_coverage` - Independent Python simulation across all 3 draw fixtures (9 runtime rows) and all 13 mutations (every mutation kills 2/3 or 3/3 rows) + inspection of generated HLSL - `python3 tests/docs_links_check.py`, `python3 tests/bidi_controls_check.py`, `python3 tests/rdna2_tools_check.py` (156 tests OK) - `git merge-tree --write-tree --name-only origin/main HEAD` and `git diff --check origin/main` - **Runs in CI:** - LLVM 15 `pixel_aot_binary` assembly/disassembly round-trips for all 3 `SDWA_INT_EXTRA_PROGRAMS` fixtures - Windows D3D12 `pixel_aot_sdwa_int_extra_warp` / `pixel_aot_sdwa_int_extra_hardware` draws and all 13 mutations
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:01:21 +00:00
github manually merged commit 650e0a32ef into gh-pr/2550/base 2026-11-27 01:01:24 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 20:47 UTC · original · reviewed

Review of head a711f7f4 (comment only, no approval).

Checked:

  • tools/pixel_aot.py: the 9 unary/binary SDWA forms reuse the existing INTEGER table and sdwa_source/sdwa_dest. Arity, unbalanced sext(), UNUSED_SEXT, entry-mask, sample overlap and pending-load refusals are in place. The 3 carry-in forms compute the full 32-bit carry/borrow into vcc before destination placement and require a tracked condition and matching vcc/vcc_lo.
  • Sibling tables: SDWA_INT is left unchanged, form_coverage_check.py replaces the old rejected v_mul_i32_i24_sdwa entry with a still-unsupported neighbour, and asserts that the 12 forms are covered in both gfx1013.tsv and rdna2.tsv while the neighbours stay uncovered.
  • Tests: static refusal controls plus pixel_aot_sdwa_int_extra_{warp,hardware} draws with per-op mutations that must report a mismatch. No other open or merged PR covers this slice.

Commands run locally:

  • git diff --check origin/main...HEAD: clean
  • python3 tests/docs_links_check.py: pass
  • python3 tests/bidi_controls_check.py: pass
  • check_sdwa_int_extra_controls() (imported from tests/pixel_aot_check.py): pass
  • Mutation: dropping the carry_out_tok != carry_in_tok refusal makes the controls fail with "Expected rejection: Invalid carry-in operation". Reverted afterwards.

Not run here: the D3D12 WARP draw test and form_coverage_check.py (needs iced_x86). The Windows run comes next after updating the branch with main.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 20:47 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2550#pullrequestreview-6064766236) · **reviewed** Review of head a711f7f4 (comment only, no approval). Checked: - `tools/pixel_aot.py`: the 9 unary/binary SDWA forms reuse the existing `INTEGER` table and `sdwa_source`/`sdwa_dest`. Arity, unbalanced `sext()`, `UNUSED_SEXT`, entry-mask, sample overlap and pending-load refusals are in place. The 3 carry-in forms compute the full 32-bit carry/borrow into `vcc` before destination placement and require a tracked condition and matching `vcc`/`vcc_lo`. - Sibling tables: `SDWA_INT` is left unchanged, `form_coverage_check.py` replaces the old rejected `v_mul_i32_i24_sdwa` entry with a still-unsupported neighbour, and asserts that the 12 forms are covered in both `gfx1013.tsv` and `rdna2.tsv` while the neighbours stay uncovered. - Tests: static refusal controls plus `pixel_aot_sdwa_int_extra_{warp,hardware}` draws with per-op mutations that must report a mismatch. No other open or merged PR covers this slice. Commands run locally: - `git diff --check origin/main...HEAD`: clean - `python3 tests/docs_links_check.py`: pass - `python3 tests/bidi_controls_check.py`: pass - `check_sdwa_int_extra_controls()` (imported from `tests/pixel_aot_check.py`): pass - Mutation: dropping the `carry_out_tok != carry_in_tok` refusal makes the controls fail with "Expected rejection: Invalid carry-in operation". Reverted afterwards. Not run here: the D3D12 WARP draw test and `form_coverage_check.py` (needs `iced_x86`). The Windows run comes next after updating the branch with main. AI-assisted; commands listed were executed locally.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 20:54 UTC · original

Win2025 WARP receipt for head 650e0a32 after updating with main.

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 650e0a32ef6b46f6547a8c7a574ec2731d8e7942:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev -- -j 2): 34.27s (configure 2.00s)
    • Test (ctest --preset dev -R 'pixel_aot_sdwa_int_extra_warp|pixel_aot_check|form_coverage' --parallel 2 --no-tests=error --output-on-failure): 2/2 passed (13.24s: pixel_aot_sdwa_int_extra_warp 6.95s, form_coverage 13.11s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release -- -j 2): 37.66s (configure 2.10s)
    • Test (ctest --preset release -R 'pixel_aot_sdwa_int_extra_warp|pixel_aot_check|form_coverage' --parallel 2 --no-tests=error --output-on-failure): 2/2 passed (16.59s: pixel_aot_sdwa_int_extra_warp 7.82s, form_coverage 16.47s)
  • Windows Python checks: tests/form_coverage_check.py ok (11.4s), tests/mesh_clip_cull_check.py ok (4.2s), tests/mesh_dynamic_geometry_check.py ok (0.2s), tests/mesh_heap_sampler_check.py ok (0.6s), tests/pso_readiness_check.py ok (0.8s), tests/rdna2_tools_check.py ok (2.5s), tests/startup_gfx2hlsl_cmp16_check.py ok (0.2s), tests/startup_gfx2hlsl_f32_lg_check.py ok (1.1s), tests/startup_gfx2hlsl_f32_nan_check.py ok (4.2s), tests/startup_gfx2hlsl_sop2_complement_check.py ok (5.0s), tests/startup_gfx2hlsl_vopc_sdwa_check.py ok (4.0s), tests/startup_image_load_d16_check.py ok (0.8s), tests/startup_image_sample_a16_check.py ok (0.1s), tests/vk_offscreen.py ok (1.2s)
  • sccache: 191/-11 hits; wall 138.6s

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 20:54 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2550#issuecomment-7174349113) Win2025 WARP receipt for head 650e0a32 after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `650e0a32ef6b46f6547a8c7a574ec2731d8e7942`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev -- -j 2`): `34.27s` (configure `2.00s`) - Test (`ctest --preset dev -R 'pixel_aot_sdwa_int_extra_warp|pixel_aot_check|form_coverage' --parallel 2 --no-tests=error --output-on-failure`): **2/2 passed** (`13.24s`: `pixel_aot_sdwa_int_extra_warp` `6.95s`, `form_coverage` `13.11s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release -- -j 2`): `37.66s` (configure `2.10s`) - Test (`ctest --preset release -R 'pixel_aot_sdwa_int_extra_warp|pixel_aot_check|form_coverage' --parallel 2 --no-tests=error --output-on-failure`): **2/2 passed** (`16.59s`: `pixel_aot_sdwa_int_extra_warp` `7.82s`, `form_coverage` `16.47s`) - **Windows Python checks**: `tests/form_coverage_check.py` ok (`11.4s`), `tests/mesh_clip_cull_check.py` ok (`4.2s`), `tests/mesh_dynamic_geometry_check.py` ok (`0.2s`), `tests/mesh_heap_sampler_check.py` ok (`0.6s`), `tests/pso_readiness_check.py` ok (`0.8s`), `tests/rdna2_tools_check.py` ok (`2.5s`), `tests/startup_gfx2hlsl_cmp16_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_f32_lg_check.py` ok (`1.1s`), `tests/startup_gfx2hlsl_f32_nan_check.py` ok (`4.2s`), `tests/startup_gfx2hlsl_sop2_complement_check.py` ok (`5.0s`), `tests/startup_gfx2hlsl_vopc_sdwa_check.py` ok (`4.0s`), `tests/startup_image_load_d16_check.py` ok (`0.8s`), `tests/startup_image_sample_a16_check.py` ok (`0.1s`), `tests/vk_offscreen.py` ok (`1.2s`) - `sccache`: 191/-11 hits; wall `138.6s` AI-assisted; commands listed were executed locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.