shader: align scalar and VOP1 opcode tables with GFX10/RDNA 2 in disasm_rdna2 #260

Merged
LooperSalty merged 1 commit from upstream-pr/263 into main 2026-11-21 20:27:39 +00:00
LooperSalty commented 2026-11-21 19:41:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by LooperSalty on 2026-11-21T19:41:20Z.


Change

tools/disasm_rdna2.py used pre-GFX10 opcode numbers in five tables, so common GFX10 instructions decoded as unknown or as the wrong instruction. For example, 0xbe820300 (s_mov_b32 s2, s0) printed s_sop1_03, and 0x7e025502 (v_rcp_f32_e32 v1, v2) printed v_vop1_2a.

  • SOP1, SOP2, SOPK, SOPP and VOP1 now use the GFX10 / RDNA 2 opcode numbers. Mnemonics and descriptions are unchanged.
  • s_waitcnt_vscnt/vmcnt/expcnt/lgkmcnt move from SOPP to SOPK (opcodes 0x17-0x1A), where GFX10 encodes them.
  • SMEM was already correct.
  • VOP2 is left to #251; this PR touches different tables. Both PRs edit the golden-vector list in tests/rdna2_tools_check.py, so whichever lands second needs a trivial rebase.

Each opcode number comes from the encodings in LLVM's public gfx10 MC tests (llvm/test/MC/AMDGPU/gfx10_asm_*.s).

Verification

  • python -B -m unittest tests.rdna2_tools_check on Windows 11 26300, Python 3.12:
    • before: OK (skipped=1);
    • after: Ran 19 tests … OK (skipped=1). The skip is test_llvm_comparison, which needs LLVM_LIB.
  • Golden vectors updated: s_mov_b32 (000382be) and s_mov_b64 (000482be). The old bytes 000082be encoded SOP1 opcode 0, which GFX10 does not assign to s_mov_b32.
  • New vectors, each encoding taken from LLVM's gfx10 MC tests:
    • s_min_i32;
    • s_mul_i32;
    • s_cmpk_eq_i32;
    • s_waitcnt_vscnt;
    • s_inst_prefetch;
    • v_rcp_f32_e32;
    • v_cvt_f32_u32_e32.
  • The duplicate-name extraction fixture now uses 000382be, so its # s_mov_b32 comment matches the bytes. That test only compares extracted bytes.

Evidence and follow-up

The table numbers were cross-checked against an independent decoder built from LLVM's gfx10 and gfx1030 MC tests (29,527 encodings, no length mismatch): PrototypeScarlett/emu/rdna2_ops.py in LooperSalty/AnyXboxX.

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: the old 000082be vector no longer decodes as s_mov_b32.
  • I updated README/docs when a capability or build requirement changed (no change needed).
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code). I reviewed the change and ran the checks above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6533527455 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/263). Originally posted by [LooperSalty](https://github.com/LooperSalty) on 2026-11-21T19:41:20Z. --- ## Change `tools/disasm_rdna2.py` used pre-GFX10 opcode numbers in five tables, so common GFX10 instructions decoded as unknown or as the wrong instruction. For example, `0xbe820300` (`s_mov_b32 s2, s0`) printed `s_sop1_03`, and `0x7e025502` (`v_rcp_f32_e32 v1, v2`) printed `v_vop1_2a`. - SOP1, SOP2, SOPK, SOPP and VOP1 now use the GFX10 / RDNA 2 opcode numbers. Mnemonics and descriptions are unchanged. - `s_waitcnt_vscnt/vmcnt/expcnt/lgkmcnt` move from SOPP to SOPK (opcodes 0x17-0x1A), where GFX10 encodes them. - SMEM was already correct. - VOP2 is left to #251; this PR touches different tables. Both PRs edit the golden-vector list in `tests/rdna2_tools_check.py`, so whichever lands second needs a trivial rebase. Each opcode number comes from the encodings in LLVM's public gfx10 MC tests (`llvm/test/MC/AMDGPU/gfx10_asm_*.s`). ## Verification - `python -B -m unittest tests.rdna2_tools_check` on Windows 11 26300, Python 3.12: - **before:** OK (skipped=1); - **after:** `Ran 19 tests … OK (skipped=1)`. The skip is `test_llvm_comparison`, which needs `LLVM_LIB`. - **Golden vectors updated:** `s_mov_b32` (`000382be`) and `s_mov_b64` (`000482be`). The old bytes `000082be` encoded SOP1 opcode 0, which GFX10 does not assign to `s_mov_b32`. - **New vectors**, each encoding taken from LLVM's gfx10 MC tests: - `s_min_i32`; - `s_mul_i32`; - `s_cmpk_eq_i32`; - `s_waitcnt_vscnt`; - `s_inst_prefetch`; - `v_rcp_f32_e32`; - `v_cvt_f32_u32_e32`. - The duplicate-name extraction fixture now uses `000382be`, so its `# s_mov_b32` comment matches the bytes. That test only compares extracted bytes. ## Evidence and follow-up The table numbers were cross-checked against an independent decoder built from LLVM's gfx10 and gfx1030 MC tests (29,527 encodings, no length mismatch): `PrototypeScarlett/emu/rdna2_ops.py` in [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX). ## 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: the old `000082be` vector no longer decodes as `s_mov_b32`. - [x] I updated README/docs when a capability or build requirement changed (no change needed). - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code). I reviewed the change and ran the checks above.
upstream-sync closed this pull request 2026-11-24 06:42:07 +00:00
R0Y00 commented 2026-11-24 06:47:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T19:59:16Z.


The remaining conflict at f84407a is in tests/rdna2_tools_check.py. Please retain #264's null/ttmp scalar-operand vectors alongside the corrected GFX10 opcode vectors and rerun the golden-vector suite.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7068420999 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/263#issuecomment-7068420999). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T19:59:16Z. --- The remaining conflict at `f84407a` is in `tests/rdna2_tools_check.py`. Please retain #264's null/ttmp scalar-operand vectors alongside the corrected GFX10 opcode vectors and rerun the golden-vector suite.
LooperSalty commented 2026-11-24 06:47:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by LooperSalty on 2026-11-21T20:07:41Z.


Rebased on current main (now at 3996e1e). The conflict in tests/rdna2_tools_check.py is resolved by keeping both blocks: the #264 null/ttmp scalar-operand vectors, followed by the corrected GFX10 opcode vectors.

python -B -m unittest tests.rdna2_tools_check → Ran 21 tests … OK (skipped=1). The skip is test_llvm_comparison, which needs LLVM_LIB.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7068524602 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/263#issuecomment-7068524602). Originally posted by [LooperSalty](https://github.com/LooperSalty) on 2026-11-21T20:07:41Z. --- Rebased on current `main` (now at `3996e1e`). The conflict in `tests/rdna2_tools_check.py` is resolved by keeping both blocks: the #264 null/ttmp scalar-operand vectors, followed by the corrected GFX10 opcode vectors. `python -B -m unittest tests.rdna2_tools_check` → `Ran 21 tests … OK (skipped=1)`. The skip is `test_llvm_comparison`, which needs `LLVM_LIB`.
LooperSalty commented 2026-11-24 06:47:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by LooperSalty on 2026-11-21T20:11:39Z.


The only failing check is dxr_facing_warp in Build and test on Windows (run 44944584887): dxr_facing rays=96 hits=72 front_hits=36 culled=24 mismatches=8, debug_errors=0. This PR only changes tools/disasm_rdna2.py and tests/rdna2_tools_check.py, which that C++ WARP test does not use, and the other 100 ctest tests pass. Other recent runs failed in the same way on a different WARP test (gpu_alias_warp, run 44943010678), so it looks intermittent. I can't re-run jobs on this repository: could you re-run the failed job?

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7068573030 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/263#issuecomment-7068573030). Originally posted by [LooperSalty](https://github.com/LooperSalty) on 2026-11-21T20:11:39Z. --- The only failing check is `dxr_facing_warp` in *Build and test on Windows* (run 44944584887): `dxr_facing rays=96 hits=72 front_hits=36 culled=24 mismatches=8`, `debug_errors=0`. This PR only changes `tools/disasm_rdna2.py` and `tests/rdna2_tools_check.py`, which that C++ WARP test does not use, and the other 100 ctest tests pass. Other recent runs failed in the same way on a different WARP test (`gpu_alias_warp`, run 44943010678), so it looks intermittent. I can't re-run jobs on this repository: could you re-run the failed job?
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!260
No description provided.