shader: draw the s_movk_i32 sign extension in pixel_aot #342

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

@⁠Its3rr0rsWRLD on GitHub · 2026-11-21 22:46 UTC · original
Its3rr0rsWRLD:shader/movk-fixture → main · +43 −0 · 2 files · 1 commits · merged 2026-11-21 22:56 UTC

Change

This adds tests only; the translator is unchanged. pixel_aot already lowers s_movk_i32 by sign-extending its 16-bit immediate and folding the result (tools/pixel_aot.py, the s_mov_b32|s_movk_i32 branch). No fixture used the instruction, so the sign extension was never checked on a GPU and SOPK had no covered form. This adds one draw that exports the extension.

Verification

Commit b860dd5 plus this change, Windows 10 Enterprise 26H2 build 26300.9974, MSVC 14.51.36231, Windows SDK 10.0.26100.0 DXC.

ctest --preset dev --no-tests=error -R '^pixel_aot_' -V
  • pixel_aot_hardware: Passed on NVIDIA GeForce RTX 4070 Ti (10de:2782), driver 32.0.16.1088.
  • pixel_aot_warp: Passed on WARP 10.0.26100.9818.
  • Each test runs 55 draws with this change and 54 on b860dd5. Every draw reports debug_errors=0 and max_absolute_error=0.
  • tests/pixel_aot_check.py binary passes with the program added to the binary fixtures: LLVM 15.0.6 llvm-mc and llvm-objcopy, disassembled through libLLVM-17.so and libLLVM-18.so on Linux. LLVM prints s_movk_i32 s48, 0x8000 and s_bfe_u32 s49, s48, 0x80018 exactly as written. The controls, tests/docs_links_check.py and tests/bidi_controls_check.py pass.

Evidence and follow-up

The program uses only instructions already on main:

  1. It moves 0x8000 and 0x7fff with s_movk_i32.
  2. s_bfe_u32 extracts bytes 1 and 3 of each result.
  3. v_cvt_f32_f16 widens each byte as a binary16 subnormal, and a multiply by 2^24 turns it into the exact integer.

With sign extension the draw exports 255, 128, 127 and 0. Two wrong references each report pixel_mismatch: zero extension, which gives 0 for byte 3 of 0x8000, and treating 0x7fff as negative, which gives 255 for its byte 3.

This branch merges cleanly with #288, #293, #324, #329, #334, #337 and #340.

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: yes. Written with Claude Opus 5.5; verified on the hardware listed above.

🤖 Generated with Claude Code

https://claude.ai/code/session_01X1EBSe6YfE2ivQChRsx1hc

**@⁠Its3rr0rsWRLD** on GitHub · 2026-11-21 22:46 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/342) `Its3rr0rsWRLD:shader/movk-fixture` → `main` · +43 −0 · 2 files · 1 commits · merged 2026-11-21 22:56 UTC ## Change This adds tests only; the translator is unchanged. `pixel_aot` already lowers `s_movk_i32` by sign-extending its 16-bit immediate and folding the result (`tools/pixel_aot.py`, the `s_mov_b32|s_movk_i32` branch). No fixture used the instruction, so the sign extension was never checked on a GPU and SOPK had no covered form. This adds one draw that exports the extension. ## Verification Commit b860dd5 plus this change, Windows 10 Enterprise 26H2 build 26300.9974, MSVC 14.51.36231, Windows SDK 10.0.26100.0 DXC. ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_' -V ``` - `pixel_aot_hardware`: Passed on NVIDIA GeForce RTX 4070 Ti (10de:2782), driver 32.0.16.1088. - `pixel_aot_warp`: Passed on WARP 10.0.26100.9818. - Each test runs 55 draws with this change and 54 on b860dd5. Every draw reports `debug_errors=0` and `max_absolute_error=0`. - `tests/pixel_aot_check.py binary` passes with the program added to the binary fixtures: LLVM 15.0.6 `llvm-mc` and `llvm-objcopy`, disassembled through `libLLVM-17.so` and `libLLVM-18.so` on Linux. LLVM prints `s_movk_i32 s48, 0x8000` and `s_bfe_u32 s49, s48, 0x80018` exactly as written. The controls, `tests/docs_links_check.py` and `tests/bidi_controls_check.py` pass. ## Evidence and follow-up The program uses only instructions already on `main`: 1. It moves 0x8000 and 0x7fff with `s_movk_i32`. 2. `s_bfe_u32` extracts bytes 1 and 3 of each result. 3. `v_cvt_f32_f16` widens each byte as a binary16 subnormal, and a multiply by 2^24 turns it into the exact integer. With sign extension the draw exports 255, 128, 127 and 0. Two wrong references each report `pixel_mismatch`: zero extension, which gives 0 for byte 3 of 0x8000, and treating 0x7fff as negative, which gives 255 for its byte 3. This branch merges cleanly with #288, #293, #324, #329, #334, #337 and #340. ## 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: yes. Written with Claude Opus 5.5; verified on the hardware listed above. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01X1EBSe6YfE2ivQChRsx1hc
Move 0x8000 and 0x7fff with s_movk_i32, extract bytes 1 and 3 with s_bfe_u32 and export them exactly, with wrong references for zero extension and for treating 0x7fff as negative. The program joins the gfx1013 binary fixtures; the translator is unchanged.

AI-assisted: yes (Claude Opus 5.5)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X1EBSe6YfE2ivQChRsx1hc
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:44:26 +00:00
github manually merged commit a8f7a9aa21 into gh-pr/342/base 2026-11-26 21:44:27 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.