shader: lower RDNA2 vector reverse subtract v_subrev_nc_u32 in pixel_aot #570

Manually merged
github merged 2 commits from gh-pr/570/head into gh-pr/570/base 2026-11-26 22:02:42 +00:00
Owner

@⁠stan495 on GitHub · 2026-11-22 12:57 UTC · original
stan495:shader/lower-v-subrev-nc-u32 → main · +47 −8 · 6 files · 2 commits · merged 2026-11-22 13:39 UTC

Change

Lower the RDNA2 VOP2 vector reverse subtract instruction v_subrev_nc_u32 (_e32 opcode 0x27) in tools/pixel_aot.py, evaluating b - a with modulo-32 integer wrapping through asfloat. This completes the non-carry vector addition/subtraction trio in VOP2 alongside v_add_nc_u32 and v_sub_nc_u32.

  • Extends SUPPORTED_INSTRUCTIONS_REGEX in tools/scan_unsupported_shaders.py so the scanner recognizes v_subrev_nc_u32_e32 as supported.
  • Adds synthetic VOP2 opcode table decoding for 0x27 and scanner recognition assertions in tests/rdna2_tools_check.py.
  • Records ("VOP2", "v_subrev_nc_u32") in tests/form_coverage_check.py.
  • Extends VOP2_INT_OPS and vop2_integer_group in tests/pixel_aot_check.py, asserting reverse operand order (asuint(alu20) - asuint(params[0].w)).
  • Adds negative controls in tests/pixel_aot_check.py verifying that unsupported _e64 encoding and float modifiers (abs) on v_subrev_nc_u32 are rejected.
  • Documents the 9 supported VOP2 integer vector arithmetic instructions in docs/experiments.md.

Verification

Tested commit 9f95f16 on Windows 11 Build 26200.9711, AMD Ryzen 7 7800X3D + AMD Radeon RX 7900 XTX (driver 32.0.32029.2010), Visual Studio 2022 17.14, and Microsoft Basic Render Driver (WARP).

Commands and results:

python -B tests/script_state_check.py
# Ran 13 tests in 0.045s: OK

python -B tests/form_coverage_check.py
# form coverage checks passed

python -B tests/rdna2_tools_check.py
# Ran 41 tests in 0.742s: OK (skipped=1)

python -B tests/docs_links_check.py
# Self-test passed. Checked 10 Markdown files and 119 links.

python -B tests/bidi_controls_check.py
# Self-test passed. Checked 546 tracked source, script and build/CI files: no bidirectional controls.

ctest --preset dev --no-tests=error -R 'desktop_root_signature|era_heap_allocation|offscreen_warp'
# 100% tests passed, 0 tests failed out of 3, Total Test time = 0.15 sec

ctest --preset dev --no-tests=error -R '^pixel_aot_u32_from_f32_warp$|^pixel_aot_warp$'
# 100% tests passed, 0 tests failed out of 2, Total Test time = 8.26 sec

Negative controls:
In tests/pixel_aot_check.py, must_reject verifies that v_subrev_nc_u32_e64 (unsupported encoding) and v_subrev_nc_u32_e32 v12, abs(v18), v18 (illegal float modifier on integer operand) are both refused.

Evidence and follow-up

The lowering completes the non-carry integer vector addition and subtraction group in pixel_aot.py. The operand ordering follows the AMD RDNA 2 ISA definition for V_SUBREV_NC_U32 (D.u = S1.u - S0.u), and docs/experiments.md has been updated to document the 9 VOP2 integer instructions.

Reproduction command:

ctest --preset dev --no-tests=error -R '^pixel_aot_'

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.

**@⁠stan495** on GitHub · 2026-11-22 12:57 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/570) `stan495:shader/lower-v-subrev-nc-u32` → `main` · +47 −8 · 6 files · 2 commits · merged 2026-11-22 13:39 UTC ## Change Lower the RDNA2 VOP2 vector reverse subtract instruction `v_subrev_nc_u32` (`_e32` opcode `0x27`) in `tools/pixel_aot.py`, evaluating `b - a` with modulo-32 integer wrapping through `asfloat`. This completes the non-carry vector addition/subtraction trio in VOP2 alongside `v_add_nc_u32` and `v_sub_nc_u32`. - Extends `SUPPORTED_INSTRUCTIONS_REGEX` in `tools/scan_unsupported_shaders.py` so the scanner recognizes `v_subrev_nc_u32_e32` as supported. - Adds synthetic VOP2 opcode table decoding for `0x27` and scanner recognition assertions in `tests/rdna2_tools_check.py`. - Records `("VOP2", "v_subrev_nc_u32")` in `tests/form_coverage_check.py`. - Extends `VOP2_INT_OPS` and `vop2_integer_group` in `tests/pixel_aot_check.py`, asserting reverse operand order `(asuint(alu20) - asuint(params[0].w))`. - Adds negative controls in `tests/pixel_aot_check.py` verifying that unsupported `_e64` encoding and float modifiers (`abs`) on `v_subrev_nc_u32` are rejected. - Documents the 9 supported VOP2 integer vector arithmetic instructions in `docs/experiments.md`. ## Verification Tested commit `9f95f16` on Windows 11 Build 26200.9711, AMD Ryzen 7 7800X3D + AMD Radeon RX 7900 XTX (driver 32.0.32029.2010), Visual Studio 2022 17.14, and Microsoft Basic Render Driver (WARP). Commands and results: ```powershell python -B tests/script_state_check.py # Ran 13 tests in 0.045s: OK python -B tests/form_coverage_check.py # form coverage checks passed python -B tests/rdna2_tools_check.py # Ran 41 tests in 0.742s: OK (skipped=1) python -B tests/docs_links_check.py # Self-test passed. Checked 10 Markdown files and 119 links. python -B tests/bidi_controls_check.py # Self-test passed. Checked 546 tracked source, script and build/CI files: no bidirectional controls. ctest --preset dev --no-tests=error -R 'desktop_root_signature|era_heap_allocation|offscreen_warp' # 100% tests passed, 0 tests failed out of 3, Total Test time = 0.15 sec ctest --preset dev --no-tests=error -R '^pixel_aot_u32_from_f32_warp$|^pixel_aot_warp$' # 100% tests passed, 0 tests failed out of 2, Total Test time = 8.26 sec ``` Negative controls: In `tests/pixel_aot_check.py`, `must_reject` verifies that `v_subrev_nc_u32_e64` (unsupported encoding) and `v_subrev_nc_u32_e32 v12, abs(v18), v18` (illegal float modifier on integer operand) are both refused. ## Evidence and follow-up The lowering completes the non-carry integer vector addition and subtraction group in `pixel_aot.py`. The operand ordering follows the AMD RDNA 2 ISA definition for `V_SUBREV_NC_U32` (`D.u = S1.u - S0.u`), and `docs/experiments.md` has been updated to document the 9 VOP2 integer instructions. Reproduction command: ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_' ``` ## 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.
Translate RDNA2 32-bit vector reverse subtract instruction v_subrev_nc_u32
in tools/pixel_aot.py as (src1 - src0) wrapping modulo 32 bits without
generating a carry bit, complementing existing v_add_nc_u32 and v_sub_nc_u32.

Update scanner recognition in tools/scan_unsupported_shaders.py and
tests/rdna2_tools_check.py. Add draw fixture steps, opcode table checks,
and negative controls in tests/pixel_aot_check.py.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:02:40 +00:00
github manually merged commit da685d6e08 into gh-pr/570/base 2026-11-26 22:02:42 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.