Lower gfx1013 add, mul, sqrt, rsq, floor and fract in pixel shader translation #121

Manually merged
github merged 1 commit from gh-pr/121/head into gh-pr/121/base 2026-11-26 21:28:27 +00:00
Owner

@⁠PrivacyOnion on GitHub · 2026-11-21 16:36 UTC · original
PrivacyOnion:pixel-aot-alu-ops → main · +58 −15 · 2 files · 1 commits · merged 2026-11-21 17:57 UTC

Change

Extends tools/pixel_aot.py to lower v_add_f32, v_mul_f32, v_sqrt_f32, v_rsq_f32, v_floor_f32 and v_fract_f32 (_e32 and _e64, including optional clamp) into precise float HLSL expressions (+, *, sqrt, rsqrt, floor, frac).

tests/pixel_aot_check.py adds a shaping() program and shaping_case() CPU reference that exercise all six new instructions with bound constant buffer parameters across the 8x8 UNORM ramp, checks LLVM 15 exp mrt0 comma formatting and arity rejection controls, includes shaping() in the gfx1013 binary round-trip check, and verifies D3D12 readback and constant corruption rejection on both hardware and WARP.

Verification

Built and verified at 734d09b on Windows 11 with VS Build Tools 2022 17.14 (MSVC 19.44.35228.0), Windows SDK 10.0.26100.0, Python 3.12, on NVIDIA GeForce RTX 5070 (vendor=10de device=2f04, driver 32.0.16.1664, debug_layer=enabled) and Microsoft Basic Render Driver (WARP, vendor=1414 device=008c, driver 10.0.26100.9818, debug_layer=enabled):

ctest --preset dev -R '^pixel_aot_' --no-tests=error -V
  • pixel_aot_hardware: passed (pixels=4096 channels=16384 max_absolute_error=0 across all 6 draws, debug_errors=0 debug_warnings=0, negative controls rejected).
  • pixel_aot_warp: passed (pixels=4096 channels=16384 max_absolute_error=0 across all 6 draws, debug_errors=0 debug_warnings=0, negative controls rejected).

Evidence and follow-up

All test inputs are synthetic gfx1013 assembly programs and CPU-computed binary16 round-toward-zero reference cases generated at test time.

**@⁠PrivacyOnion** on GitHub · 2026-11-21 16:36 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/121) `PrivacyOnion:pixel-aot-alu-ops` → `main` · +58 −15 · 2 files · 1 commits · merged 2026-11-21 17:57 UTC ## Change Extends `tools/pixel_aot.py` to lower `v_add_f32`, `v_mul_f32`, `v_sqrt_f32`, `v_rsq_f32`, `v_floor_f32` and `v_fract_f32` (`_e32` and `_e64`, including optional `clamp`) into `precise float` HLSL expressions (`+`, `*`, `sqrt`, `rsqrt`, `floor`, `frac`). `tests/pixel_aot_check.py` adds a `shaping()` program and `shaping_case()` CPU reference that exercise all six new instructions with bound constant buffer parameters across the 8x8 UNORM ramp, checks LLVM 15 `exp mrt0` comma formatting and arity rejection controls, includes `shaping()` in the `gfx1013` binary round-trip check, and verifies D3D12 readback and constant corruption rejection on both hardware and WARP. ## Verification Built and verified at `734d09b` on Windows 11 with VS Build Tools 2022 17.14 (`MSVC 19.44.35228.0`), Windows SDK `10.0.26100.0`, Python `3.12`, on `NVIDIA GeForce RTX 5070` (`vendor=10de device=2f04`, driver `32.0.16.1664`, `debug_layer=enabled`) and `Microsoft Basic Render Driver` (`WARP`, `vendor=1414 device=008c`, driver `10.0.26100.9818`, `debug_layer=enabled`): ```powershell ctest --preset dev -R '^pixel_aot_' --no-tests=error -V ``` - `pixel_aot_hardware`: passed (`pixels=4096 channels=16384 max_absolute_error=0` across all 6 draws, `debug_errors=0 debug_warnings=0`, negative controls rejected). - `pixel_aot_warp`: passed (`pixels=4096 channels=16384 max_absolute_error=0` across all 6 draws, `debug_errors=0 debug_warnings=0`, negative controls rejected). ## Evidence and follow-up All test inputs are synthetic `gfx1013` assembly programs and CPU-computed binary16 round-toward-zero reference cases generated at test time.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:28:25 +00:00
github manually merged commit 314c507e0f into gh-pr/121/base 2026-11-26 21:28:27 +00:00
Author
Owner

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

The six-instruction fixture looks good. GitHub now reports conflicts with main. Please keep the current select, absolute and dual-texture controls when reconciling pixel_aot_check.py and run the assembled and rendered fixtures. #144 can follow this PR.

**@⁠R0Y00** on GitHub · 2026-11-21 17:18 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/121#issuecomment-7066376367) The six-instruction fixture looks good. GitHub now reports conflicts with main. Please keep the current select, absolute and dual-texture controls when reconciling pixel_aot_check.py and run the assembled and rendered fixtures. #144 can follow this PR.
Author
Owner

@⁠PrivacyOnion on GitHub · 2026-11-21 17:39 UTC · original

Rebased onto main, keeping the select, absolute_value, and dual_program (forward, reverse, reuse, swapped bindings, and swapped weights) controls alongside shaping and shaping_case. Verified pixel_aot_hardware and pixel_aot_warp:

1/2 Test #72: pixel_aot_hardware ...............   Passed    8.64 sec
2/2 Test #74: pixel_aot_warp ...................   Passed    1.31 sec
**@⁠PrivacyOnion** on GitHub · 2026-11-21 17:39 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/121#issuecomment-7066651145) Rebased onto `main`, keeping the `select`, `absolute_value`, and `dual_program` (`forward`, `reverse`, `reuse`, swapped bindings, and swapped weights) controls alongside `shaping` and `shaping_case`. Verified `pixel_aot_hardware` and `pixel_aot_warp`: ```text 1/2 Test #72: pixel_aot_hardware ............... Passed 8.64 sec 2/2 Test #74: pixel_aot_warp ................... Passed 1.31 sec ```
This discussion has been locked. Commenting is limited to contributors.
No description provided.