shader: align VOP2 opcode table with GFX10/RDNA 2 in disasm_rdna2 #251

Manually merged
github merged 4 commits from gh-pr/251/head into gh-pr/251/base 2026-11-26 21:37:38 +00:00
Owner

@⁠Vonsek on GitHub · 2026-11-21 19:18 UTC · original
Vonsek:ag/rdna2-disasm-vop2-opcodes → main · +59 −26 · 2 files · 4 commits · merged 2026-11-22 06:33 UTC

Change

Align VOP2_OPS in tools/disasm_rdna2.py with the GFX10 / RDNA 2 (gfx1013) ISA opcode table, following up on #245.

Previously, VOP2_OPS mapped pre-GFX10 opcode numbers (for example 0x01 to v_add_f32_e32 instead of v_cndmask_b32_e32, 0x03 to v_subrev_f32_e32 instead of v_add_f32_e32, 0x10 to v_and_b32_e32 instead of v_max_f32_e32, and 0x1b to v_fmac_f32_e32 instead of v_and_b32_e32). It now maps all 22 VOP2 opcodes to their GFX10/RDNA 2 numbers, formats v_cndmask_b32_e32 with its implicit vcc_lo operand, and removes the non-VOP2 v_cvt_pkrtz_f16_f32_e32 entry at 0x2f.

tests/rdna2_tools_check.py:

  • updates the VOP2 golden vectors to GFX10/RDNA 2 encodings (v_cndmask_b32_e32, v_add_f32_e32, v_mul_f32_e32, v_and_b32_e32, v_add_nc_u32_e32, v_fmac_f32_e32);
  • adds all 22 VOP2 instructions to test_llvm_comparison so the Ubuntu Assemble and translate gfx1013 fixtures CI job verifies every opcode and operand against LLVM 15 (llvm-mc -mcpu=gfx1013 / libLLVM).

Verification

Tested on Windows 11 x64, Python 3.12.10, at commit 5c48879:

  • Before updating tools/disasm_rdna2.py, rdna2_tools_check fails on the GFX10 VOP2 vectors:
    ctest --preset dev --no-tests=error -R '^rdna2_tools_check$' -V
    AssertionError: 'v_add_f32_e32' != 'v_cndmask_b32_e32' : Mismatched opcode for 01050602
    1/1 Test #97: rdna2_tools_check ................***Failed    0.82 sec
    
  • After updating tools/disasm_rdna2.py:
    ctest --preset dev --no-tests=error -R '^rdna2_tools_check$' -V
    Ran 19 tests in 0.502s
    OK (skipped=1)
    1/1 Test #97: rdna2_tools_check ................   Passed    0.66 sec
    
    (test_llvm_comparison is skipped locally without LLVM_LIB and runs in the Ubuntu Assemble and translate gfx1013 fixtures CI job.)

Evidence and follow-up

All test vectors are original synthetic encodings and llvm-mc source instructions.

Other opcode tables in tools/disasm_rdna2.py (VOP1_OPS, SOP1_OPS, SOP2_OPS, SOPK_OPS) are left for separate focused follow-ups verified against LLVM 15.

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.
**@⁠Vonsek** on GitHub · 2026-11-21 19:18 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/251) `Vonsek:ag/rdna2-disasm-vop2-opcodes` → `main` · +59 −26 · 2 files · 4 commits · merged 2026-11-22 06:33 UTC ## Change Align `VOP2_OPS` in `tools/disasm_rdna2.py` with the GFX10 / RDNA 2 (`gfx1013`) ISA opcode table, following up on #245. Previously, `VOP2_OPS` mapped pre-GFX10 opcode numbers (for example `0x01` to `v_add_f32_e32` instead of `v_cndmask_b32_e32`, `0x03` to `v_subrev_f32_e32` instead of `v_add_f32_e32`, `0x10` to `v_and_b32_e32` instead of `v_max_f32_e32`, and `0x1b` to `v_fmac_f32_e32` instead of `v_and_b32_e32`). It now maps all 22 VOP2 opcodes to their GFX10/RDNA 2 numbers, formats `v_cndmask_b32_e32` with its implicit `vcc_lo` operand, and removes the non-VOP2 `v_cvt_pkrtz_f16_f32_e32` entry at `0x2f`. `tests/rdna2_tools_check.py`: - updates the VOP2 golden vectors to GFX10/RDNA 2 encodings (`v_cndmask_b32_e32`, `v_add_f32_e32`, `v_mul_f32_e32`, `v_and_b32_e32`, `v_add_nc_u32_e32`, `v_fmac_f32_e32`); - adds all 22 VOP2 instructions to `test_llvm_comparison` so the Ubuntu `Assemble and translate gfx1013 fixtures` CI job verifies every opcode and operand against LLVM 15 (`llvm-mc -mcpu=gfx1013` / `libLLVM`). ## Verification Tested on Windows 11 x64, Python 3.12.10, at commit `5c48879`: - Before updating `tools/disasm_rdna2.py`, `rdna2_tools_check` fails on the GFX10 VOP2 vectors: ```text ctest --preset dev --no-tests=error -R '^rdna2_tools_check$' -V AssertionError: 'v_add_f32_e32' != 'v_cndmask_b32_e32' : Mismatched opcode for 01050602 1/1 Test #97: rdna2_tools_check ................***Failed 0.82 sec ``` - After updating `tools/disasm_rdna2.py`: ```text ctest --preset dev --no-tests=error -R '^rdna2_tools_check$' -V Ran 19 tests in 0.502s OK (skipped=1) 1/1 Test #97: rdna2_tools_check ................ Passed 0.66 sec ``` (`test_llvm_comparison` is skipped locally without `LLVM_LIB` and runs in the Ubuntu `Assemble and translate gfx1013 fixtures` CI job.) ## Evidence and follow-up All test vectors are original synthetic encodings and `llvm-mc` source instructions. Other opcode tables in `tools/disasm_rdna2.py` (`VOP1_OPS`, `SOP1_OPS`, `SOP2_OPS`, `SOPK_OPS`) are left for separate focused follow-ups verified against LLVM 15. ## 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.
VOP2_OPS in tools/disasm_rdna2.py used pre-GFX10 opcode numbers (for example mapping 0x01 to v_add_f32_e32 instead of v_cndmask_b32_e32 and 0x03 to v_subrev_f32_e32 instead of v_add_f32_e32). Update VOP2_OPS to the GFX10/RDNA 2 encodings, include the implicit vcc_lo operand for v_cndmask_b32_e32, update the golden vectors in tests/rdna2_tools_check.py, and verify every VOP2 entry against LLVM 15 gfx1013 in test_llvm_comparison.
# Conflicts:
#	tests/rdna2_tools_check.py
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:37:36 +00:00
github manually merged commit cbfc7ce783 into gh-pr/251/base 2026-11-26 21:37:38 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 19:25 UTC · original · edited 2026-11-21 19:28 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T19:28:20.008746Z 79bb63d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-21 19:25 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/251#issuecomment-7068009131) · edited 2026-11-21 19:28 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"79bb63d25c630f5b5a3eba1cb94e469b9d3744fb","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-21T19:28:20.008746Z">2026-11-21T19:28:20.008746Z</relative-time> | `79bb63d` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
@ -232,0 +229,4 @@
0x25: ("v_add_nc_u32_e32", "Vector add uint32 without carry"),
0x26: ("v_sub_nc_u32_e32", "Vector sub uint32 without carry"),
0x27: ("v_subrev_nc_u32_e32", "Vector reverse sub uint32 without carry"),
0x2b: ("v_fmac_f32_e32", "Vector fused multiply-accumulate float32"),
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 19:28 UTC · original

P2 Badge Restore the valid GFX10 packed-conversion opcode

For gfx1013 bytes 0105065e, LLVM 20 and the parent commit both decode v_cvt_pkrtz_f16_f32_e32 v3, v1, v2, but the updated disassembler instead emits v_vop2_2f v3, v1, v2. Opcode 0x2f remains a valid GFX10 VOP2 instruction, also classified as such in docs/coverage/gfx1013.tsv:1281, so removing its mapping regresses disassembly of half-float packing instructions used before color exports. Retain the mapping and include this instruction in the LLVM comparison fixture.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-21 19:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/251#discussion_r4654581703) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Restore the valid GFX10 packed-conversion opcode** For gfx1013 bytes `0105065e`, LLVM 20 and the parent commit both decode `v_cvt_pkrtz_f16_f32_e32 v3, v1, v2`, but the updated disassembler instead emits `v_vop2_2f v3, v1, v2`. Opcode `0x2f` remains a valid GFX10 VOP2 instruction, also classified as such in `docs/coverage/gfx1013.tsv:1281`, so removing its mapping regresses disassembly of half-float packing instructions used before color exports. Retain the mapping and include this instruction in the LLVM comparison fixture. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠Vonsek on GitHub · 2026-11-21 19:31 UTC · original

Restored 0x2f: v_cvt_pkrtz_f16_f32_e32 in VOP2_OPS and added v_cvt_pkrtz_f16_f32_e32 v3, v1, v2 to the LLVM comparison fixture in tests/rdna2_tools_check.py.

**@⁠Vonsek** on GitHub · 2026-11-21 19:31 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/251#issuecomment-7068083148) Restored `0x2f: v_cvt_pkrtz_f16_f32_e32` in `VOP2_OPS` and added `v_cvt_pkrtz_f16_f32_e32 v3, v1, v2` to the LLVM comparison fixture in `tests/rdna2_tools_check.py`.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 19:28 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 79bb63d25c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-21 19:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/251#pullrequestreview-6007680884) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `79bb63d25c` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
This discussion has been locked. Commenting is limited to contributors.
No description provided.