shader: lower gfx1013 v_cvt_off_f32_i4 in pixel_aot #356

Manually merged
github merged 6 commits from gh-pr/356/head into gh-pr/356/base 2026-11-26 21:45:37 +00:00
Owner

@⁠denn0x on GitHub · 2026-11-21 23:11 UTC · original
denn0x:shader/cvt-off-i4 → main · +71 −0 · 3 files · 6 commits · merged 2026-11-22 09:22 UTC

Change

Advances an independent problem: gfx1013 instruction coverage in pixel_aot. It adds one lowering branch in tools/pixel_aot.py and a draw check in tests/pixel_aot_check.py. No open PR claims v_cvt_off_f32_i4, and no prerequisite PR is needed.

v_cvt_off_f32_i4 converts bits 3:0 of the source, as a signed nibble, to binary32 in units of 1/16. Per the RDNA 2 ISA table, 0x0 to 0x7 map to 0.0 to 0.4375 and 0x8 to 0xF map to -0.5 to -0.0625. The source is read as bits, and the lowering is float(asint(word << 28) >> 28) * 0.0625f, which is exact. Float abs/neg modifiers do not apply to an integer source, so the translator does not accept them.

Fixture offset_nibbles(). Four forms in e32 and e64, and the last lane uses clamp.

Draw check check_offset_nibble_draws.

  • All 16 nibbles appear across four draws.
  • They share the same set upper bits, so a result that read more than bits 3:0 would change. The word is a normal binary32 value, so its bits survive the constant buffer.
  • Each draw is compared bit for bit over the 64×64 target on the selected backend.
  • The fixture is also added to check_binary.

Negative control: reading the nibble as unsigned must produce pixel_mismatch on negative nibbles.

Verification

Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0, DXC 1.8.2502.11, D3D12 debug layer enabled.

  • 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.96 sec
2/2 Test #132: pixel_aot_warp ...................   Passed    4.64 sec
100% tests passed, 0 tests failed out of 2
  • Mutation check (local, reverted): lowering as float(word & 0xf) * 0.0625f makes pixel_aot_warp fail with pixel_mismatch x=0 y=0 in the new draw.
  • Full suite: ctest --preset dev --no-tests=error gives 146 passed, 0 failed, with the bvh_wave64_warp and wave_shuffle_warp capability skips.

Not run locally: tests/pixel_aot_check.py binary, because this machine has no LLVM with gfx1013. Ubuntu CI covers it.

This is independent of #350 and #353. All three add a fixture next to the ceiling fixture, so later merges need a trivial rebase.

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).

**@⁠denn0x** on GitHub · 2026-11-21 23:11 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/356) `denn0x:shader/cvt-off-i4` → `main` · +71 −0 · 3 files · 6 commits · merged 2026-11-22 09:22 UTC ## Change Advances an independent problem: gfx1013 instruction coverage in `pixel_aot`. It adds one lowering branch in `tools/pixel_aot.py` and a draw check in `tests/pixel_aot_check.py`. No open PR claims `v_cvt_off_f32_i4`, and no prerequisite PR is needed. `v_cvt_off_f32_i4` converts bits 3:0 of the source, as a signed nibble, to binary32 in units of 1/16. Per the RDNA 2 ISA table, 0x0 to 0x7 map to 0.0 to 0.4375 and 0x8 to 0xF map to -0.5 to -0.0625. The source is read as bits, and the lowering is `float(asint(word << 28) >> 28) * 0.0625f`, which is exact. Float `abs`/`neg` modifiers do not apply to an integer source, so the translator does not accept them. **Fixture `offset_nibbles()`.** Four forms in e32 and e64, and the last lane uses `clamp`. **Draw check `check_offset_nibble_draws`.** - All 16 nibbles appear across four draws. - They share the same set upper bits, so a result that read more than bits 3:0 would change. The word is a normal binary32 value, so its bits survive the constant buffer. - Each draw is compared bit for bit over the 64×64 target on the selected backend. - The fixture is also added to `check_binary`. **Negative control:** reading the nibble as unsigned must produce `pixel_mismatch` on negative nibbles. ## Verification Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0, DXC 1.8.2502.11, D3D12 debug layer enabled. - 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.96 sec 2/2 Test #132: pixel_aot_warp ................... Passed 4.64 sec 100% tests passed, 0 tests failed out of 2 ``` - **Mutation check (local, reverted):** lowering as `float(word & 0xf) * 0.0625f` makes `pixel_aot_warp` fail with `pixel_mismatch x=0 y=0` in the new draw. - **Full suite:** `ctest --preset dev --no-tests=error` gives 146 passed, 0 failed, with the `bvh_wave64_warp` and `wave_shuffle_warp` capability skips. Not run locally: `tests/pixel_aot_check.py binary`, because this machine has no LLVM with gfx1013. Ubuntu CI covers it. This is independent of #350 and #353. All three add a fixture next to the ceiling fixture, so later merges need a trivial rebase. ## 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)._
Convert bits 3:0 of the source word, as a signed nibble, to binary32 in
units of 1/16. A draw fixture presents all 16 nibbles under the same
upper bits in e32 and e64 forms with clamp. Reading the nibble as
unsigned is the negative control.

AI-assisted (Claude Code).
The draw fixture was not yet in check_binary, so the LLVM assemble and
disassemble check did not cover it.

AI-assisted (Claude Code).
# Conflicts:
#	docs/experiments.md
#	tests/pixel_aot_check.py
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:45:35 +00:00
github manually merged commit 3a784932ea into gh-pr/356/base 2026-11-26 21:45:37 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-22 02:44 UTC · original

A three-way merge against main at 1606f7b conflicts in tests/pixel_aot_check.py. The lowering hunk merges cleanly. Please retain the main draw registrations and the offset_nibbles/check_offset_nibble_draws coverage, including the negative half of the signed nibble range. Run the binary fixture and pixel_aot_warp on the reconciled head.

**@⁠R0Y00** on GitHub · 2026-11-22 02:44 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/356#issuecomment-7073096471) A three-way merge against main at 1606f7b conflicts in tests/pixel_aot_check.py. The lowering hunk merges cleanly. Please retain the main draw registrations and the offset_nibbles/check_offset_nibble_draws coverage, including the negative half of the signed nibble range. Run the binary fixture and pixel_aot_warp on the reconciled head.
This discussion has been locked. Commenting is limited to contributors.
No description provided.