xshader: check RDNA2 opcode tables against gfx1013 references (17 decoder names, 5 GFX7 lowerings corrected) #49
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!49
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/49/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@QuentinDanblon on GitHub · 2026-11-21 20:30 UTC · original
QuentinDanblon:test/isa-table-audit→main· +3085 −16 · 7 files · 104 commits · closed without mergingLibrary / area: tombox-xshader (RDNA2 decoder tables, GCN to RDNA2 lowering)
Exports changed (exports.txt rows): none
Source of the behaviour: LLVM MC test vectors (llvm-project 963ab285f26c, Apache-2.0 WITH LLVM-exception) for gfx1010/1013/1030 and gfx7; AMD machine-readable ISA XML for RDNA1/RDNA2 (2026-02-20, MIT). Where both list an opcode, the names agree.
Rebased on
51f5319One commit. Dropped since the first version, because main has them now or because they are your data:
v_fmac_f16/v_fmamk_f16/v_fmaak_f16); only 4 exec cases where fused and unfused results differ remain;mnem_groups.json,mnemonics.txt): not touched;What is left
A test that checks the opcode tables against committed references, and the fixes it asks for on main.
tests/isa_table.rswithtests/isa_table/gfx1013.txtandgfx7.txt(licence notices and source commit in each header):rdna2_names_match_gfx1013decodes every opcode of every encoding throughrdna2::disassemble, including the generated MIMG names. It fails on a wrong name, or on a named opcode that does not exist in gfx1013, and says when the name is a gfx1030-only instruction.gcn_lowering_keeps_instruction: every GFX7 opcodegcn::to_rdna2accepts must lower to the same instruction or a listed equivalent.51f5319the test reports 17 decoder names and 5 lowerings. Fixed here:v_swap_b320x1e5 (the VOP1 form is kept), VINTRP op 3, the generatedimage_gather4*_d*names at MIMG 0x42-0x5b;s_dcache_inv_volands_memtimeswapped);buffer_wbinvl1_vol/buffer_wbinvl1) passed through to an undefined or partial GFX10 opcode; they now lower tobuffer_gl0_inv+buffer_gl1_inv, as LLVM does for a GFX10 acquire;image_atomic_rsub, absent on GFX10) is refused.mnem.rs/rdna2.rssay GFX10.1 (gfx1013).Not changed: the gfx1013 opcodes the decoder leaves unnamed (they print with
--nocapture). Naming them would change your progress denominator. Theflat_*naming for all segments is kept, because the translator relies on it.Tests
cargo test -p tombox-xshader --release --lib --test opcodes --test synthetic --test isa_table --test mixed_table: 60 / 22 / 11 / 3 / 3 pass.--test execon WARP: 73 pass, 0 fail (same count as main; the new cases are inside existing tests).Not run against a title.
cargo test -p tombox-xshaderpassesNo game or console files and no binaries included
No fake success; anything not possible is left
missingwith a note🤖 Generated with Claude Code
@QuentinDanblon on GitHub · 2026-11-21 22:02 UTC · original
Rebased onto
0fc7295, with the targeted tests re-run on the new base. #49 keeps the fused f16 FMA at VOP2 0x36-0x38 (gfx1013 v_fmac/fmamk/fmaak_f16) and updates the upstream ISA-sweep cases to the fused model. #36 adapts to upstream's TB_CEN_Q centroid qualifier. #48 now also includes the 4 regression scenarios from #28, credited.@QuentinDanblon on GitHub · 2026-11-22 00:07 UTC · original
Hardware evidence for the fused reading of VOP2 0x36 / 0x37 / 0x38, which was the open point of this PR against the ISA sweep on main.
@SchmashinPrunes ran the probe kernels of #72 on an RDNA2 GPU (gfx1036 iGPU of a Ryzen 5 9600X, ROCm/HIP 5.7.1): #41
v_fma_f16on all 254,891 inputs that separate "fused" from "multiply then add" (three K values), and matchv_mul_f16+v_add_f16on none of them.v_fma_f16matches the exact single-rounding model, 0 mismatches.So the names and semantics here (
v_fmac_f16,v_fmamk_f16,v_fmaak_f16) are what RDNA2 does. Caveat: gfx1036, not the console's gfx1013. LLVM gives both the same GFX10 encodings, and the kernels disassemble identically for the two targets.The branch is unchanged and still merges cleanly with main (
f6b979d).@omonkeyz on GitHub · 2026-11-22 13:12 UTC · original
Main's history was rewritten, which auto-closed this PR (sorry for the noise). Real fixes. Please rebase on the current main, drop the tools/progress changes and strip comment lines. To resubmit:
git fetchthis repo, branch from the currentmain, cherry-pick only your own commits (the old branch is based on the previous history and cannot be merged), and open a new PR.Pull request closed