shader: decode 9-bit VOP SRC0 operands correctly in disasm_rdna2 #242
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/245"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T19:09:46Z.
Change
Fix 9-bit VOP
SRC0operand decoding intools/disasm_rdna2.py(decode_v_reg).Per the AMD RDNA 2 / GFX10 ISA, a 9-bit VOP1/VOP2
SRC0field encodes:0..255: SGPRs, special scalar registers (vcc_lo,exec_lo,m0,null), inline constants (0..64,-1..-16,0.5..-4.0), and255(32-bit literal);256..511: VGPRsv0..v255(reg_id - 256).Previously,
decode_v_reghad these two halves swapped (<= 255decoded asv{reg_id}and>= 256passed todecode_s_reg(reg_id - 256)), causing e.g.v_mov_b32_e32 v0, v1(0103007e) to disassemble asv_mov_b32_e32 v0, s1andv_mov_b32_e32 v2, 1.0(f202047e) to disassemble asv_mov_b32_e32 v2, v242.tests/rdna2_tools_check.pyadds:v_mov_b32_e32) and VOP2 (v_add_f32_e32) golden vectors covering VGPR (v1), SGPR (s1), and inline constants (1.0,0.5,0);v_mov_b32_e32VGPR/SGPR/inline-constant instructions totest_llvm_comparisonwith full assembly operand checks against LLVM 15 (llvm-mc -mcpu=gfx1013/libLLVM) in CI.Verification
Tested on Windows 11 x64, Python 3.12.10, at commit
644aa51:tools/disasm_rdna2.py,rdna2_tools_checkfails on the first VOP1 golden vector:test_llvm_comparisonis skipped locally becauseLLVM_LIBis not installed on this Windows host; it runs in the UbuntuAssemble and translate gfx1013 fixturesCI job.)Evidence and follow-up
All test vectors are original synthetic encodings and
llvm-mcsource instructions.This PR fixes only 9-bit
SRC0decoding (decode_v_reg). Separate follow-up: several opcodes inVOP2_OPSintools/disasm_rdna2.pyalso need to be aligned with GFX10/RDNA 2 opcode numbers and verified against LLVM 15.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T19:15:17Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
644aa51ccaℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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".
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T19:12:02Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
644aa51ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T19:15:17Z.
Code review location:
tests/rdna2_tools_check.py; line 130For the repository’s
gfx1013target, these three vectors encodev_cndmask_b32_e32, notv_add_f32_e32. Local LLVM 20 decodes01050602asv_cndmask_b32_e32 v3, v1, v2, vcc_lo, while the stated addition assembles to01050606. Although the opcode-table defect predates this patch, these new full-assembly assertions make that defect a required test result and reject ISA-correct output. The LLVM comparison still passes because its new cases cover only VOP1. Isolate the SRC0 assertions from the deferred opcode-table defect, or use independently verified VOP2 expectations.AGENTS.md reference: AGENTS.md:L41-L41
Useful? React with 👍 / 👎.