Repository navigation
Shaders: xcl disasm prints SDWA selectors, modifiers and scalar sources - #790
Conversation
An SDWA instruction's text stopped at its registers: which byte or word each source is read from and the result written to, sext / neg / abs on the sources, clamp and the output modifier were left out, a second source with its S bit set was printed as a VGPR, and a compare that writes an SGPR instead of VCC did not show it. The decoder and the recompiler have all of these; only the printed line dropped them (the same gap as xcl-dev#664, in the encodings that issue does not list). The text follows LLVM's: all 2816 lines of its gfx10 SDWA tests in tests/data/llvm-amdgpu now read the same (none did), apart from the implicit vcc operands that the plain forms leave out too. 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. |
|
Hardware check of Tested
Regression run PR ( Not tested
AI use
|
|
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. |
|
Thanks @Anon64: both blocks are now in Regression run, credited. |
xcl disasm(and every listing made withgpu::rdna2::format) prints an SDWA instruction as its registers only:v_add_f32_sdwa v5, v1, v2, whatever the extension dword says. Left out: the byte / word each source is read from and the result is written to (src0_sel,src1_sel,dst_sel,dst_unused),sext()/ neg / abs on the sources,clampand the output modifier; a second source with its S bit set is printed as a VGPR (v2fors2); and a compare that writes an SGPR instead of VCC (SD) does not show it. The decoder and the recompiler have all of these (emit.rsreads the same fields); only the printed line drops them, so the listing shows another instruction than the one that runs. This is the gap of #664 in an encoding that issue and its PRs (#687, #706, #716) do not cover; I found no issue or PR for it.What is in it
crates/xcl/src/gpu/rdna2.rs:sdwa_source(VGPR or scalar operand withsext(),-,|…|),sdwa_modifiers(clamp,mul:2/mul:4/div:2,dst_sel,dst_unused,src0_sel,src1_sel, in LLVM's words and order),sdwa_compare_destination(the SDST of av_cmp_*_sdwawith SD set), called fromoperand_text/format.llvm_gfx10_sdwa_textcompares the whole line with LLVM's for all 2816 SDWA lines oftests/data/llvm-amdgpu(gfx10_vop1_sdwa.txt,gfx10_vop2_sdwa.txt);sdwa_modifiers_and_scalar_sourceshas 12 words checked againstllvm-mc21.1.8 (-mcpu=gfx1030), among them the compare forms, which the corpus does not have.sdwa_and_dpp_src0gets the two new tails.vcc/vcc_looperands stay out, as in the plain forms (v_add_co_ci_u32,v_cndmask_b32, a compare without SDST); a selector value without a name (7;dst_unused3) is printed as its number.The text also goes into the
// pc: …comment lines of the translated HLSL, so the HLSL of a program with SDWA instructions changes in its comments (no code line changes).Tested
cargo test -p xcl --lib gpu::rdna2: 11 passed, 0 failed. With the tests onmain'sformat(f4ce27c): 3 failed –llvm_gfx10_sdwa_text"2816 of 2816 SDWA lines differ from LLVM's",sdwa_modifiers_and_scalar_sources,sdwa_and_dpp_src0.cargo test --workspace --no-fail-fast -- --test-threads=4on 5a60d0d: two runs, each from a clean build of the workspace crates. Run 2: 703 passed, 0 failed, 41 ignored (xcl lib: 662 passed, 0 failed, 21 ignored). Run 1: 700 passed, 3 failed, 41 ignored –placed_title_textures_share_vram_and_preserve_pixels("cubemap extra_pages must be reused at same va") and the two tests its poisoned lock takes with it (transitions_apply_when_their_list_is_submitted,d32s8_targets_take_their_own_size_of_video_memory): the failure of Tests: placed_title_textures_share_vram_and_preserve_pixels fails now and then at its cubemap reuse check (main 9ce2070) #718, whichmainf4ce27c shows on this machine too (657 passed, 3 failed in the lib).no wave64:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.Regression run
Run by @Anon64 on an NVIDIA GeForce RTX 3060 (posted in this PR's comments; we have no retail title here).
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.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