Repository navigation
Shaders: xcl disasm prints image operands, dmask, dim and flags - #812
Conversation
An image (MIMG) instruction was printed with the widest registers its opcode can take and nothing else: `image_load v[16:19], v[8:11], s[96:103]` for every DMASK, dimension and flag, and an NSA form's address registers were not listed at all. Now, as LLVM writes it: the data registers DMASK selects (four for a gather, halved by D16, one more with TFE), the address registers the opcode and the dimension take (a list when NSA dwords name them), then dmask, dim and unorm / glc / slc / dlc / r128 / a16 / tfe / lwe / d16. The recompiler reads all of these; only the printed line dropped them (the gap of xcl-dev#664, in an encoding that issue does not list). All 265 image lines of LLVM's gfx10 tests in tests/data/llvm-amdgpu now read the same (2 did). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Test run of Tested
Review: Disassembler text only. I found nothing to change. Not tested: no retail title or regression run (I have no unpacked game), no Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
|
Regression runs for this PR's head main: this PR: Tested
Not tested
Report written with Claude Code (Claude Opus 5.5) from runs on this machine. |
|
Linux / AMD RDNA3 datapoint. Merged state: head Full suite, Not tested: retail titles (none here), Windows, RDNA4. Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting. |
xcl disasmprints an image (MIMG) instruction with the widest registers its opcode can take and nothing else:image_load v[16:19], v[8:11], s[96:103]whatever DMASK, the dimension and the flags are, and the address registers of an NSA form are not listed. So a 1D load of one component and a 2D-array load of four read the same. The recompiler has all of this; only the printed line drops it. Same kind of gap as #664 and #790 / #791, in an encoding none of them covers;gh pr list --searchfor "mimg disasm", "dmask" and "MIMG" finds no PR for it.Independent of #790 / #791 (other hunks of
rdna2.rs; they merge cleanly in any order).What is in it
crates/xcl/src/gpu/rdna2.rs:mimg_text, called first informat– the data registers DMASK selects (four for a gather, two at least for a compare-and-swap, halved by D16, one more with TFE), the address registers (a range, or the[v8, v9, …]list of an NSA form), resource, sampler,dmask:(when not 0),dim:SQ_RSRC_IMG_*andunorm glc slc dlc r128 a16 tfe lwe d16in LLVM's order; a ray query printsa16alone.mimg_address_dwordscounts the address dwords as LLVM'sgetAddrSizeMIMGOpdoes, from the mnemonic's parts (_o/_b/_c,_cl/_l/mip,_d/_cd,_g16), the dimension and A16.llvm_gfx10_image_textcompares the whole line with LLVM's for all 265 image lines oftests/data/llvm-amdgpu(gfx10_mimg.txt, and theimage_msaa_load/image_bvh*lines ofgfx1030_new.txt; 105 instructions, 206 lines in NSA form);image_operands_and_modifiershas 7 words checked againstllvm-mc21.1.8 (-mcpu=gfx1030) for what the corpus lacks (slc,r128, all the flags at once) and a few more.The text also goes into the
// pc: …comment lines of the translated HLSL, so the HLSL of a program with image instructions changes in its comments (no code line changes).Tested
cargo test -p xcl --lib gpu::rdna2::tests::: 11 passed, 0 failed. With the tests onmain'sformat(e50836b): 2 failed –llvm_gfx10_image_text"263 of 265 image lines differ from LLVM's",image_operands_and_modifiers.cargo test --workspace --no-fail-fast -- --test-threads=4on 2239a06: 706 passed, 0 failed, 41 ignored (xcl lib: 665 passed, 0 failed, 21 ignored).no wave64:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.Regression run
From Anon64's run (#812 (comment)), thanks:
main:
PR:
Not tested
XCL_SAMPLE_*data: the game-data tests passed without running.test_title_draws_with_a_root_signature_under_the_debug_layeranduploads_start_from_each_subresources_statereturn early.image_load_by2,image_store_pck4, …) follow the same rules by their names; LLVM does not know them, so nothing was compared.llvm-mcshows: an atomic with more than two DMASK bits (llvm-mc: one register), an NSA form with more or fewer dwords than its addresses need.AI use
xcl disasmwith the LLVM test lines in the repository, wrote the code, the tests and this description, and ran the tests.🤖 Generated with Claude Code