shader: lower gfx1013 v_rcp_iflag_f32 in pixel_aot #345

Merged
denn0x merged 5 commits from upstream-pr/350 into main 2026-11-22 09:08:34 +00:00
denn0x commented 2026-11-21 23:03:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-21T23:03:02Z.


Change

Advances an independent problem: gfx1013 instruction coverage in pixel_aot. It touches the ALU table and the unary/binary regex in tools/pixel_aot.py, plus a new draw check in tests/pixel_aot_check.py. No open PR claims v_rcp_iflag_f32, and no prerequisite PR is needed.

v_rcp_iflag_f32 computes the same reciprocal as v_rcp_f32 and additionally raises the integer-divide flag. Compilers emit it in integer-division sequences. The flag has no desktop equivalent and nothing in the fixture reads it, so the lowering is 1.0f / x, like v_rcp_f32.

Fixture reciprocal_iflag(). Four forms run through the shared with_constants program:

  • the e32 form;
  • e64 with -|s|;
  • e64 with |s|;
  • e64 with |s| and clamp.

Draw check check_reciprocal_iflag_draws. Three constant sets run on the selected backend:

  • power-of-two inputs of both signs, which keep every reciprocal exact;
  • zero and negative zero, which give signed infinities, with clamp turning +inf into 1.

Each set is compared bit for bit over the 64×64 target. The fixture is also added to check_binary for the LLVM assemble/disassemble round trip.

Negative control: replacing the reciprocal with v_sqrt_f32 must produce pixel_mismatch.

Verification

Head 4427510 on main bc24dfd. Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0, DXC 1.8.2502.11, D3D12 debug layer enabled on both backends.

  • AMD Radeon RX 9070 XT (vendor 1002, device 7550), driver 32.0.32015.7029
  • WARP: Microsoft Basic Render Driver 10.0.26100.9818
ctest --preset dev --no-tests=error -R '^pixel_aot_' -V
1/2 Test #129: pixel_aot_hardware ...............   Passed   10.41 sec
2/2 Test #132: pixel_aot_warp ...................   Passed    4.33 sec
100% tests passed, 0 tests failed out of 2
  • Every draw reported max_absolute_error=0 and debug_errors=0 debug_warnings=0.
  • Mutation check (local, reverted): changing the lowering to -1.0f / x makes pixel_aot_warp fail with pixel_mismatch x=0 y=0 in the new draw.
  • Coverage: v_rcp_iflag_f32_e32 and _e64 now appear in the FORM_COVERAGE_RECORD file of both pixel tests.
  • Full suite: ctest --preset dev --no-tests=error gives 146 passed, 0 failed, on the pre-rebase base b860dd5. bvh_wave64_warp and wave_shuffle_warp reported capability skips. After the rebase onto bc24dfd, the two pixel tests above were rerun.

Not run locally: tests/pixel_aot_check.py binary, because this machine has no LLVM with gfx1013. The new fixture is in check_binary, so the Ubuntu CI job covers the round trip.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6535557418 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/350). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-21T23:03:02Z. --- ## Change Advances an independent problem: gfx1013 instruction coverage in `pixel_aot`. It touches the `ALU` table and the unary/binary regex in `tools/pixel_aot.py`, plus a new draw check in `tests/pixel_aot_check.py`. No open PR claims `v_rcp_iflag_f32`, and no prerequisite PR is needed. `v_rcp_iflag_f32` computes the same reciprocal as `v_rcp_f32` and additionally raises the integer-divide flag. Compilers emit it in integer-division sequences. The flag has no desktop equivalent and nothing in the fixture reads it, so the lowering is `1.0f / x`, like `v_rcp_f32`. **Fixture `reciprocal_iflag()`.** Four forms run through the shared `with_constants` program: - the e32 form; - e64 with `-|s|`; - e64 with `|s|`; - e64 with `|s|` and `clamp`. **Draw check `check_reciprocal_iflag_draws`.** Three constant sets run on the selected backend: - power-of-two inputs of both signs, which keep every reciprocal exact; - zero and negative zero, which give signed infinities, with `clamp` turning +inf into 1. Each set is compared bit for bit over the 64×64 target. The fixture is also added to `check_binary` for the LLVM assemble/disassemble round trip. **Negative control:** replacing the reciprocal with `v_sqrt_f32` must produce `pixel_mismatch`. ## Verification Head `4427510` on `main` `bc24dfd`. Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0, DXC 1.8.2502.11, D3D12 debug layer enabled on both backends. - AMD Radeon RX 9070 XT (vendor 1002, device 7550), driver 32.0.32015.7029 - WARP: Microsoft Basic Render Driver 10.0.26100.9818 ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_' -V ``` ```text 1/2 Test #129: pixel_aot_hardware ............... Passed 10.41 sec 2/2 Test #132: pixel_aot_warp ................... Passed 4.33 sec 100% tests passed, 0 tests failed out of 2 ``` - Every draw reported `max_absolute_error=0` and `debug_errors=0 debug_warnings=0`. - **Mutation check (local, reverted):** changing the lowering to `-1.0f / x` makes `pixel_aot_warp` fail with `pixel_mismatch x=0 y=0` in the new draw. - **Coverage:** `v_rcp_iflag_f32_e32` and `_e64` now appear in the `FORM_COVERAGE_RECORD` file of both pixel tests. - **Full suite:** `ctest --preset dev --no-tests=error` gives 146 passed, 0 failed, on the pre-rebase base `b860dd5`. `bvh_wave64_warp` and `wave_shuffle_warp` reported capability skips. After the rebase onto `bc24dfd`, the two pixel tests above were rerun. Not run locally: `tests/pixel_aot_check.py binary`, because this machine has no LLVM with gfx1013. The new fixture is in `check_binary`, so the Ubuntu CI job covers the round trip. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. _AI-assisted (Claude Code)._
upstream-sync closed this pull request 2026-11-24 06:42:35 +00:00
R0Y00 commented 2026-11-24 06:48:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T02:44:42Z.


The three-way merge against main at 1606f7b conflicts in both tools/pixel_aot.py and tests/pixel_aot_check.py. Please reconcile the shared ALU matcher against current main so the other accepted operations retain their dispatch, and keep check_reciprocal_iflag_draws registered alongside the existing draws, after the adapter availability check. Please rerun the binary fixture and pixel_aot_warp on the reconciled head.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7073095368 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/350#issuecomment-7073095368). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T02:44:42Z. --- The three-way merge against main at 1606f7b conflicts in both tools/pixel_aot.py and tests/pixel_aot_check.py. Please reconcile the shared ALU matcher against current main so the other accepted operations retain their dispatch, and keep check_reciprocal_iflag_draws registered alongside the existing draws, after the adapter availability check. Please rerun the binary fixture and pixel_aot_warp on the reconciled head.
R0Y00 commented 2026-11-24 06:48:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T03:07:55Z.


Let’s take your overlapping pixel changes one at a time, starting with #350. Please refresh this branch first and hold #353, #356, #357 and #358 until it lands. We’ll check the next branch against the resulting translator and draw tests.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7073345354 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/350#issuecomment-7073345354). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T03:07:55Z. --- Let’s take your overlapping pixel changes one at a time, starting with #350. Please refresh this branch first and hold #353, #356, #357 and #358 until it lands. We’ll check the next branch against the resulting translator and draw tests.
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!345
No description provided.