shader: lower RDNA2 integer VOP2 operations #495

Manually merged
github merged 2 commits from gh-pr/495/head into gh-pr/495/base 2026-11-26 21:56:35 +00:00
Owner

@⁠agilesh08 on GitHub · 2026-11-22 07:40 UTC · original
agilesh08:feat/shader-vop2-integer → main · +77 −0 · 5 files · 2 commits · merged 2026-11-22 08:18 UTC

## Change

Lowers 8 uncovered RDNA2 integer VOP2 e32 instructions in tools/pixel_aot.py across gfx1013 and gfx1030:

  • Shifts: v_lshrrev_b32, v_ashrrev_i32, v_lshlrev_b32 (preserving reverse operand ordering src1 >> (src0 & 31u) and signed arithmetic right shift with asint on v_ashrrev_i32).
  • Bitwise ALU: v_and_b32, v_or_b32, v_xor_b32.
  • Integer Arithmetic: v_add_nc_u32, v_sub_nc_u32 (wrapping modulo 32 bits without carry output).

Preserves 32-bit bit patterns in destination vector registers via asfloat(...), enforces mask == "entry", prevents writes to pending sample destinations, and rejects float modifiers (-, abs) and uninitialized VGPRs.

Verification

  • python -B tests/rdna2_tools_check.py: 28 passed on Windows (including test_vop2_integer_opcode_table_synthetic_forms across opcodes 0x16, 0x18, 0x1a, 0x1b, 0x1c, 0x1d, 0x25, 0x26 and truncated data handling).
  • python -B tests/pixel_aot_check.py: passed on Windows (asserts all 8 forms in ACCEPTED, verifies reverse-shift direction and asint, rejects float modifiers and v106).
  • python -B tests/form_coverage_check.py: passed on Windows (asserts all 8 VOP2 forms map into both docs/coverage/gfx1013.tsv and docs/coverage/rdna2.tsv).
  • All 21 platform-independent Python checks: 21 passed (0 failures).
  • git -c core.whitespace=cr-at-eol diff --check: 0 errors.
  • Note: Local host lacks dxc.exe; DXBC compilation and D3D12/WARP offscreen readback run in GitHub Actions CI (windows.yml).

Evidence and follow-up

Adds unit test vop2_integer_group() in tests/pixel_aot_check.py and test_vop2_integer_opcode_table_synthetic_forms in tests/rdna2_tools_check.py. No copyrighted assets or external shader binaries are included.

Assisted by AI.

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.
**@⁠agilesh08** on GitHub · 2026-11-22 07:40 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/495) `agilesh08:feat/shader-vop2-integer` → `main` · +77 −0 · 5 files · 2 commits · merged 2026-11-22 08:18 UTC ## Change Lowers 8 uncovered RDNA2 integer VOP2 e32 instructions in `tools/pixel_aot.py` across `gfx1013` and `gfx1030`: - Shifts: `v_lshrrev_b32`, `v_ashrrev_i32`, `v_lshlrev_b32` (preserving reverse operand ordering `src1 >> (src0 & 31u)` and signed arithmetic right shift with `asint` on `v_ashrrev_i32`). - Bitwise ALU: `v_and_b32`, `v_or_b32`, `v_xor_b32`. - Integer Arithmetic: `v_add_nc_u32`, `v_sub_nc_u32` (wrapping modulo 32 bits without carry output). Preserves 32-bit bit patterns in destination vector registers via `asfloat(...)`, enforces `mask == "entry"`, prevents writes to pending sample destinations, and rejects float modifiers (`-`, `abs`) and uninitialized VGPRs. ## Verification - `python -B tests/rdna2_tools_check.py`: 28 passed on Windows (including `test_vop2_integer_opcode_table_synthetic_forms` across opcodes `0x16`, `0x18`, `0x1a`, `0x1b`, `0x1c`, `0x1d`, `0x25`, `0x26` and truncated data handling). - `python -B tests/pixel_aot_check.py`: passed on Windows (asserts all 8 forms in `ACCEPTED`, verifies reverse-shift direction and `asint`, rejects float modifiers and `v106`). - `python -B tests/form_coverage_check.py`: passed on Windows (asserts all 8 VOP2 forms map into both `docs/coverage/gfx1013.tsv` and `docs/coverage/rdna2.tsv`). - All 21 platform-independent Python checks: 21 passed (0 failures). - `git -c core.whitespace=cr-at-eol diff --check`: 0 errors. - *Note:* Local host lacks `dxc.exe`; DXBC compilation and D3D12/WARP offscreen readback run in GitHub Actions CI (`windows.yml`). ## Evidence and follow-up Adds unit test `vop2_integer_group()` in `tests/pixel_aot_check.py` and `test_vop2_integer_opcode_table_synthetic_forms` in `tests/rdna2_tools_check.py`. No copyrighted assets or external shader binaries are included. Assisted by AI. ## 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:56:34 +00:00
github manually merged commit e0206910b5 into gh-pr/495/base 2026-11-26 21:56:35 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-22 08:13 UTC · original · approved these changes

Integrated main at e020691. The shared integer handler already implements six of the eight operations, so the new lowering only adds e32 add/sub without carry. Both coverage sets, malformed-input controls and decoder tests are retained. On Windows I tested the merged translator using DXC and D3D12 WARP: four draws for each of the eight VOP2 operations checked the 32-bit result against a CPU reference and its one-bit mutation, and all 72 separate SCC comparison draws from #494 still matched. The local pixel controls and form coverage passed. The disassembler suite ran 31 tests with one skip.

**@⁠R0Y00** on GitHub · 2026-11-22 08:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/495#pullrequestreview-6011181537) · **approved these changes** Integrated main at e020691. The shared integer handler already implements six of the eight operations, so the new lowering only adds e32 add/sub without carry. Both coverage sets, malformed-input controls and decoder tests are retained. On Windows I tested the merged translator using DXC and D3D12 WARP: four draws for each of the eight VOP2 operations checked the 32-bit result against a CPU reference and its one-bit mutation, and all 72 separate SCC comparison draws from #494 still matched. The local pixel controls and form coverage passed. The disassembler suite ran 31 tests with one skip.
This discussion has been locked. Commenting is limited to contributors.
No description provided.