xcl disasm drops VOP3/VOP3P modifiers, EXP targets and VINTRP attributes from its text #664
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#664
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@hmodymac8-droid on GitHub · 2026-11-24 03:07 UTC · original
xcl disasm(the text fromgpu::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 throughxcl disasmsees a different instruction from the one that runs.Found with a random-word sweep at
2997c9a: words for each GFX10 encoding, decoded byxcl disasm <file> --offset 0and byllvm-mc -mcpu=gfx1030 --disassemble(LLVM 23.1.6), comparing only words both accept. Examples (xclfirst, thenllvm-mc):xcl disasmllvm-mcd52f5288 76997819v_cvt_pkrtz_f16_f32 v136, s25, 60v_cvt_pkrtz_f16_f32 v136, -s25, -|60| mul:4d54086d0 4282c843v_fma_legacy_f32 v208, s67, v100, 32v_fma_legacy_f32 v208, s67, -|v100|, |32| clampcc0e7836 ae120a3cv_pk_fma_f16 v54, s60, v5, v132… op_sel:[1,1,1] op_sel_hi:[1,0,1] neg_lo:[1,0,1]fb4d5e7a 32cbb279exp 0x27, v121, v178, v203, v50exp param7, off, v121, off, v178 done compr vmc8d81754v_interp_p1_f32 v54, v84, s5v_interp_p1_f32 v54, v84, attr5.wf40fdf62 d4cf50a7s_load_dwordx8 null, s[68:69], vcc_lo, 0xf50a7… vcc_lo offset:0xf50a7 glc dlcOut 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_loof VOPC / VOP2 carry ops).Two decode-side differences only show up on encodings a compiler never emits, so they are probably harmless:
94b9ad0eiss_bfe_u64 s[57:58], …in XCL,s[56:57]in LLVMsbasenot 4-aligned for a buffer load:s[26:29]vss[24:27]llvm_gfx10_corpusonly 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.
@milas6669 on GitHub · 2026-11-24 03:22 UTC · original
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 on GitHub · 2026-11-24 03:28 UTC · original
@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 #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).
@milas6669 on GitHub · 2026-11-24 03:36 UTC · original
@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).@milas6669 on GitHub · 2026-11-24 03:57 UTC · original
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 on GitHub · 2026-11-24 04:02 UTC · original
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).