xshader: check RDNA2 opcode tables against gfx1013 references (was #49) #201

Closed
QuentinDanblon wants to merge 1 commit from upstream-pr/201 into main
QuentinDanblon commented 2026-11-23 01:02:38 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by QuentinDanblon on 2026-11-23T01:02:38Z.


Library / area: tombox-xshader (RDNA2 decoder tables, GCN lowering)

Exports changed (exports.txt rows): none

Source of the behaviour: LLVM AMDGPU MC test vectors for gfx1013 and gfx7 (llvm-project 963ab285f26c, Apache-2.0 WITH LLVM-exception) and AMD's machine-readable RDNA1 / RDNA2 ISA specification (MIT). Both get their THIRD_PARTY/CREDITS line in this PR.

Part of the split of #152 (was #49). Based on c2a3522. 8 files, +3,055 / -12, of which 2,817 lines are the two reference tables (tests/isa_table/gfx1013.txt and gfx7.txt: mnemonic lists, no code) that you said could come with the first PR that uses them. The code and test part is 238 lines.

tests/isa_table.rs checks two things:

  • every opcode the decoder names exists in gfx1013 (GFX10.1 + BVH) under that name;
  • every GFX7 instruction the GCN lowering accepts lands on the same GFX10 instruction, or on a listed equivalent.

Fixes found by the check:

  • VOP2 0x36 / 0x37 / 0x38 (VOP3 0x136) are v_fmac_f16 / v_fmamk_f16 / v_fmaak_f16 on GFX10. The decoder named them v_mac_f16 / v_madmk_f16 / v_madak_f16.
  • VOP3 no longer names opcodes that exist only as VOP2 or VOP1 (madmk, madak, fmamk, fmaak, v_pk_fmac_f16, v_swap_b32). VINTRP op 3 is undefined. MIMG gather4 has no _d / _d_cl forms.
  • GCN SMRD: s_memtime is 0x1e and s_dcache_inv 0x1f on GFX7 (0x1d, the volatile invalidate, maps to s_dcache_inv). buffer_wbinvl1(_vol) lowers to buffer_gl0_inv + buffer_gl1_inv. image_atomic_rsub is refused, next to the R128 / TFE / LWE refusals.

The CI failure of #152 after #140 and #141 is fixed here: v_min_legacy_f32, v_max_legacy_f32 and v_cvt_pkaccum_u8_f32 are listed as equivalents of their lowerings. MiguelMatMar found the mismatch and proposed these lines in #152, and is named in the commit message.

Results

WARP, --release, this branch alone on c2a3522:

  • cargo test -p tombox-xshader --lib --test isa_table --test mixed_table --test opcodes: lib 90 passed (2 ignored), isa_table 3, mixed_table 3, opcodes 24, 0 failed.
  • The xshader branches of this split (mesh, opcode tables, f16 constants, v_med3_f32, SMEM) merged together on c2a3522, cargo test -p tombox-xshader, all targets: 0 failed. exec 115 passed (2 ignored), lib 90, mesh 26, opcodes 24, synthetic 24, isa_table 3, linkage 3, mixed_table 3, gcn_dims 3. isa_sweep: 541 mnemonics, 530 pass, 0 fail, 11 known WARP deviations.
  • The branch merges into 2eda8b0 without conflict (git merge-tree); it was not rerun there.

No comment lines added (PR gate: 8 files checked, 0 problems). The table check needs no GPU. Not run against a title.

  • cargo test -p tombox-xshader passes on WARP
  • No game or console files and no binaries included
  • No fake success; anything not possible is left missing with a note

🤖 Generated with Claude Code

<!-- greyfinch-sync:omonkeyz/xbox-emulator:issue:6550141717 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/201). Originally posted by [QuentinDanblon](https://github.com/QuentinDanblon) on 2026-11-23T01:02:38Z. --- **Library / area:** tombox-xshader (RDNA2 decoder tables, GCN lowering) **Exports changed (exports.txt rows):** none **Source of the behaviour:** LLVM AMDGPU MC test vectors for `gfx1013` and `gfx7` (llvm-project `963ab285f26c`, Apache-2.0 WITH LLVM-exception) and AMD's machine-readable RDNA1 / RDNA2 ISA specification (MIT). Both get their `THIRD_PARTY/CREDITS` line in this PR. Part of the split of #152 (was #49). Based on `c2a3522`. 8 files, +3,055 / -12, of which 2,817 lines are the two reference tables (`tests/isa_table/gfx1013.txt` and `gfx7.txt`: mnemonic lists, no code) that you said could come with the first PR that uses them. The code and test part is 238 lines. `tests/isa_table.rs` checks two things: - every opcode the decoder names exists in gfx1013 (GFX10.1 + BVH) under that name; - every GFX7 instruction the GCN lowering accepts lands on the same GFX10 instruction, or on a listed equivalent. Fixes found by the check: - VOP2 `0x36` / `0x37` / `0x38` (VOP3 `0x136`) are `v_fmac_f16` / `v_fmamk_f16` / `v_fmaak_f16` on GFX10. The decoder named them `v_mac_f16` / `v_madmk_f16` / `v_madak_f16`. - VOP3 no longer names opcodes that exist only as VOP2 or VOP1 (`madmk`, `madak`, `fmamk`, `fmaak`, `v_pk_fmac_f16`, `v_swap_b32`). VINTRP op 3 is undefined. MIMG gather4 has no `_d` / `_d_cl` forms. - GCN SMRD: `s_memtime` is `0x1e` and `s_dcache_inv` `0x1f` on GFX7 (`0x1d`, the volatile invalidate, maps to `s_dcache_inv`). `buffer_wbinvl1(_vol)` lowers to `buffer_gl0_inv` + `buffer_gl1_inv`. `image_atomic_rsub` is refused, next to the R128 / TFE / LWE refusals. The CI failure of #152 after #140 and #141 is fixed here: `v_min_legacy_f32`, `v_max_legacy_f32` and `v_cvt_pkaccum_u8_f32` are listed as equivalents of their lowerings. MiguelMatMar found the mismatch and proposed these lines in #152, and is named in the commit message. ### Results WARP, `--release`, this branch alone on `c2a3522`: - `cargo test -p tombox-xshader --lib --test isa_table --test mixed_table --test opcodes`: lib 90 passed (2 ignored), isa_table 3, mixed_table 3, opcodes 24, 0 failed. - The xshader branches of this split (mesh, opcode tables, f16 constants, `v_med3_f32`, SMEM) merged together on `c2a3522`, `cargo test -p tombox-xshader`, all targets: 0 failed. exec 115 passed (2 ignored), lib 90, mesh 26, opcodes 24, synthetic 24, isa_table 3, linkage 3, mixed_table 3, gcn_dims 3. `isa_sweep`: 541 mnemonics, 530 pass, 0 fail, 11 known WARP deviations. - The branch merges into `2eda8b0` without conflict (`git merge-tree`); it was not rerun there. No comment lines added (PR gate: 8 files checked, 0 problems). The table check needs no GPU. Not run against a title. - [x] `cargo test -p tombox-xshader` passes on WARP - [x] No game or console files and no binaries included - [x] No fake success; anything not possible is left `missing` with a note 🤖 Generated with [Claude Code](https://claude.com/claude-code)
omonkeyz commented 2026-11-23 01:38:39 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-23T01:38:39Z.


Applied in 2820575 (merged in 24e6c10) with your authorship kept, thanks. The full tombox-xshader suite passes on WARP with #198, #202 and #203.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7089304580 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/201#issuecomment-7089304580). Originally posted by [omonkeyz](https://github.com/omonkeyz) on 2026-11-23T01:38:39Z. --- Applied in 2820575 (merged in 24e6c10) with your authorship kept, thanks. The full tombox-xshader suite passes on WARP with #198, #202 and #203.

Pull request closed

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
omonkeyz/xbox-emulator!201
No description provided.