shader: lower gfx1013 v_cvt_off_f32_i4 in pixel_aot #350

Merged
denn0x merged 6 commits from upstream-pr/356 into main 2026-11-22 09:22:29 +00:00
denn0x commented 2026-11-21 23:11:12 +00:00 (Migrated from github.com)

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


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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6535631037 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/356). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-21T23:11:12Z. --- ## 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)._
upstream-sync closed this pull request 2026-11-24 06:42:36 +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:48Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7073096471 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/356#issuecomment-7073096471). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T02:44:48Z. --- 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.
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!350
No description provided.