shader: decode SOPC scalar comparisons in disasm_rdna2 #432
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!432
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/432/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?
@Jawschamp on GitHub · 2026-11-22 02:17 UTC · original
Jawschamp:shader/decode-sopc→main· +95 −1 · 2 files · 1 commits · merged 2026-11-22 02:26 UTCChange
tools/disasm_rdna2.pydid not recognize SOPC encodings ([31:23] == 0b101111110). Those 32-bit words fell through to the SOPK prefix check and decoded as unknown SOPK ops. For example,s_cmp_eq_i32 s0, s1(000100bf) came out ass_sopk_1e s0, 0x100.This change decodes the GFX10 / RDNA 2 SOPC table used by
gfx1013:s_cmp_{eq,lg,gt,ge,lt,le}_{i32,u32}s_bitcmp{0,1}_b32ands_bitcmp{0,1}_b64s_cmp_{eq,lg}_u6464-bit operands print as SGPR pairs or the named specials (
s[0:1],exec,vcc,null). Aliteralsource consumes the following dword so the next instruction stays aligned. The SOPK prefix check now also excludes the SOPC encoding as a backstop.No issue tracks this. It follows the same
disasm_rdna2line as #263, #264 and #245, and does not touch the VOP2 table in open #251.Verification
Commit
e0081e8onshader/decode-sopc, based onorigin/mainatc2fc84cafter a rebase. Linux host, Python 3.13.5. LLVM 15 is not available on this Debian Trixie box, so the optional LLVM comparison inrdna2_tools_checkwas skipped (the same skip as on the Python-only Linux CI job). Windows C++, HLSL, WARP and hardware checks were not run locally.The skipped test is
test_llvm_comparison, which now also lists the new SOPC mnemonics. The Ubuntupixel-binaryjob should assemble those with LLVM 15 (llvm-mc -mcpu=gfx1013) and compare opcodes againstlibLLVM-15.so.1.The rest of the platform-independent Python suite also passed:
All of those commands exited 0.
git diff --checkwas clean.Evidence and follow-up
Golden encodings follow LLVM's GFX10 SOPC layout (
Inst{31-23}=0x17e, opcode in bits 22–16). Opcode numbers match LLVM'sSOPC_Real_gfx10assignments. Fixtures are source-owned hex vectors and a two-instruction stream that placess_endpgmafter an 8-byte SOPC-with-literal.A useful next step, kept out of this PR, is decoding VOPC (currently swallowed by the VOP2 catch-all) after #251 lands, and then VOP3, whose 64-bit encodings are still returned as a 4-byte unrecognized word and desynchronize the rest of a binary shader.
Checklist
AI-assisted.