You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
xcl disasm drops VOP3/VOP3P modifiers, EXP targets and VINTRP attributes from its text #664
xcl disasm (the text from gpu::rdna2::disassemble) leaves out operand modifiers and fields that change what an instruction does. The decoder has them (omod, clamp, the neg/abs bits), and as far as I can see the recompiler uses them; only the printed line drops them. So someone reading a shader through xcl disasm sees a different instruction from the one that runs.
Found with a random-word sweep at 2997c9a: words for each GFX10 encoding, decoded by xcl disasm <file> --offset 0 and by llvm-mc -mcpu=gfx1030 --disassemble (LLVM 23.1.6), comparing only words both accept. Examples (xcl first, then llvm-mc):
words
xcl disasm
llvm-mc
missing
d52f5288 76997819
v_cvt_pkrtz_f16_f32 v136, s25, 60
v_cvt_pkrtz_f16_f32 v136, -s25, -|60| mul:4
VOP3 neg / abs / omod
d54086d0 4282c843
v_fma_legacy_f32 v208, s67, v100, 32
v_fma_legacy_f32 v208, s67, -|v100|, |32| clamp
VOP3 neg / abs / clamp
cc0e7836 ae120a3c
v_pk_fma_f16 v54, s60, v5, v132
… op_sel:[1,1,1] op_sel_hi:[1,0,1] neg_lo:[1,0,1]
VOP3P op_sel / neg
fb4d5e7a 32cbb279
exp 0x27, v121, v178, v203, v50
exp param7, off, v121, off, v178 done compr vm
EXP enable mask, compr, done, vm
c8d81754
v_interp_p1_f32 v54, v84, s5
v_interp_p1_f32 v54, v84, attr5.w
VINTRP attribute and channel (printed as an SGPR)
f40fdf62 d4cf50a7
s_load_dwordx8 null, s[68:69], vcc_lo, 0xf50a7
… vcc_lo offset:0xf50a7 glc dlc
SMEM glc / dlc
Out of 150 random words per encoding: VOP3 3, VOP3P 2, SMEM 6, all 150 EXP and 112 of 150 VINTRP differ this way. The others are only style (hex vs decimal immediates, the implicit vcc_lo of VOPC / VOP2 carry ops).
Two decode-side differences only show up on encodings a compiler never emits, so they are probably harmless:
odd SGPRs in 64-bit operands: 94b9ad0e is s_bfe_u64 s[57:58], … in XCL, s[56:57] in LLVM
an SMEM sbase not 4-aligned for a buffer load: s[26:29] vs s[24:27]
llvm_gfx10_corpus only compares mnemonics and lengths, so none of this shows up in the tests.
I haven't sent a fix: it is in crates/xcl/src/gpu/rdna2.rs (a runtime file), and I have no title for the regression run. The sweep script is ~80 lines of Python and I can post it if useful.
AI-assisted: Claude Code (Claude Opus 5.5) ran the sweep and wrote this report. No game data.
Each will have a unit test with the words from the table above, compared against the llvm-mc text, and I'll run scripts/smoke.ps1 on a retail title for main and for the head commit. Starting with part 1. If anyone already has a branch for any of these, say so and I'll leave it.
Sources get neg / abs (-s25, -|60|); after them op_sel, op_sel_hi (when not the default), neg_lo, neg_hi, clamp, mul:2 / mul:4 / div:2, in LLVM's order.
Cases that differ from the plain rule, matched to LLVM: FMA_MIX prints NEG / NEG_HI as -v1 / |v1| and op_sel_hi only when set; VOP3 op_sel only on instructions that have it on gfx10 (16-bit operands, alignbit / alignbyte, and permlane16 / permlanex16, where it is fetch-inactive / bound_ctrl); nothing after v_nop (its bits carry the shader hash, literal_in_unused_valu_field).
Test against LLVM's own text: the modifier words of all 6,487 VOP3-encoded lines in tests/data/llvm-amdgpu (907 of them have modifiers) match. On main all 907 differ. Plus unit tests with the words from your table.
Tested on RTX 4060, Rust 1.90, debug: cargo test --workspace -- --test-threads=4: 694 passed, 1 failed (xmem_virtual_query_marks_cpu_readable_memory, fixed by Tests: align XMemVirtualQuery buffers and verify CPU flags #650), 41 ignored; 2 SKIPPED (no wave64). No smoke run: I have no title.
Two ways, whichever you prefer: take the commit into your part 1/2 PR (keep the trailer), or I open it as a PR and you add the xcl-smoke blocks from your title. Parts 3 and 4 (EXP / VINTRP, SMEM) stay yours either way.
@xelerb-debug thank you. I took your commit 74106a0 (author and trailer kept) into #687 and replaced my smaller part-1 change with it. It passes the suite on an RTX 3070 (695 passed, 0 failed) and has the main-vs-head xcl-smoke runs on a retail title. Parts 3 (EXP / VINTRP) and 4 (SMEM glc / dlc) are still open; I'll take them next unless someone has a branch. AI use: Claude Code (Claude Sonnet 5.5).
Status: parts 1 and 2 are #687, part 3 (EXP / VINTRP) is #706 (stacked on #687). Part 4 (SMEM glc / dlc) is still open. AI use: Claude Code (Claude Sonnet 5.5).
Part 4 (SMEM offset / glc / dlc) is #716. With #687 (VOP3 / VOP3P) and #706 (EXP / VINTRP) that is all four parts of this issue. AI use: Claude Code (Claude Sonnet 5.5).
Activity
milas6669 commentedon Nov 24, 2026
I'd like to take this, and I'll split it into separate PRs under ~400 lines each, since the encodings are independent:
Each will have a unit test with the words from the table above, compared against the
llvm-mctext, and I'll runscripts/smoke.ps1on a retail title for main and for the head commit. Starting with part 1. If anyone already has a branch for any of these, say so and I'll leave it.AI use: Claude Code (Claude Sonnet 5.5).
xelerb-debug commentedon Nov 24, 2026
@milas6669 I have a branch for your parts 1 and 2 (VOP3 and VOP3P), finished before I saw your comment: https://github.com/xelerb-debug/xcl/tree/disasm/vop3-modifiers (one commit, 74106a0, +193 −1 in
gpu/rdna2.rs, about half of it tests).-s25,-|60|); after themop_sel,op_sel_hi(when not the default),neg_lo,neg_hi,clamp,mul:2/mul:4/div:2, in LLVM's order.-v1/|v1|andop_sel_hionly when set; VOP3op_selonly on instructions that have it on gfx10 (16-bit operands, alignbit / alignbyte, and permlane16 / permlanex16, where it is fetch-inactive / bound_ctrl); nothing afterv_nop(its bits carry the shader hash,literal_in_unused_valu_field).tests/data/llvm-amdgpu(907 of them have modifiers) match. Onmainall 907 differ. Plus unit tests with the words from your table.cargo test --workspace -- --test-threads=4: 694 passed, 1 failed (xmem_virtual_query_marks_cpu_readable_memory, fixed by Tests: align XMemVirtualQuery buffers and verify CPU flags #650), 41 ignored; 2 SKIPPED (no wave64). No smoke run: I have no title.Two ways, whichever you prefer: take the commit into your part 1/2 PR (keep the trailer), or I open it as a PR and you add the
xcl-smokeblocks from your title. Parts 3 and 4 (EXP / VINTRP, SMEM) stay yours either way.Written with Claude Code (Claude Opus 5.5).
Shaders: xcl disasm prints VOP3 / VOP3P source and output modifiers
milas6669 commentedon Nov 24, 2026
@xelerb-debug thank you. I took your commit 74106a0 (author and trailer kept) into #687 and replaced my smaller part-1 change with it. It passes the suite on an RTX 3070 (695 passed, 0 failed) and has the main-vs-head
xcl-smokeruns on a retail title. Parts 3 (EXP / VINTRP) and 4 (SMEM glc / dlc) are still open; I'll take them next unless someone has a branch. AI use: Claude Code (Claude Sonnet 5.5).Shaders: xcl disasm prints VOP3 / VOP3P source and output modifiers
milas6669 commentedon Nov 24, 2026
Status: parts 1 and 2 are #687, part 3 (EXP / VINTRP) is #706 (stacked on #687). Part 4 (SMEM glc / dlc) is still open. AI use: Claude Code (Claude Sonnet 5.5).
milas6669 commentedon Nov 24, 2026
Part 4 (SMEM offset / glc / dlc) is #716. With #687 (VOP3 / VOP3P) and #706 (EXP / VINTRP) that is all four parts of this issue. AI use: Claude Code (Claude Sonnet 5.5).
Shaders: xcl disasm prints EXP targets and VINTRP attributes (xcl-dev…
Shaders: xcl disasm prints SMEM offsets, glc and dlc as LLVM does (xc…
Shaders: xcl disasm prints SDWA selectors, modifiers and scalar sources
Shaders: xcl disasm prints image operands, dmask, dim and flags
Merge pull request #716 from milas6669/disasm-smem
Shaders: xcl disasm prints EXP targets and VINTRP attributes (xcl-dev…
Shaders: xcl disasm prints VOP3 / VOP3P source and output modifiers