shader: decode 9-bit VOP SRC0 operands correctly in disasm_rdna2 #245
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!245
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/245/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?
@Vonsek on GitHub · 2026-11-21 19:09 UTC · original
Vonsek:ag/rdna2-disasm-vop-src0→main· +25 −4 · 2 files · 1 commits · merged 2026-11-21 19:14 UTCChange
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
@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 19:12 UTC · original · edited 2026-11-21 19:15 UTC
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.
@ -121,0 +127,4 @@# VOP2 9-bit SRC0 (VGPR vs SGPR vs inline constant)("01050602", "v_add_f32_e32", "v_add_f32_e32 v3, v1, v2"),("01040602", "v_add_f32_e32", "v_add_f32_e32 v3, s1, v2"),("f0040602", "v_add_f32_e32", "v_add_f32_e32 v3, 0.5, v2"),@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 19:15 UTC · original
For 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 👍 / 👎.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 19:15 UTC · original · reviewed
💡 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".