Shaders: xcl disasm prints SDWA selectors, modifiers and scalar sources #790
No reviewers
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!790
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/790/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?
@upipibi on GitHub · 2026-11-24 05:31 UTC · original
upipibi:disasm-sdwa-modifiers→main· +119 −5 · 1 files · 1 commits · merged 2026-11-25 01:06 UTCxcl 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=4on5a60d0d: 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 #718, whichmainf4ce27cshows 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
@MesshM on GitHub · 2026-11-24 05:46 UTC · original
Test run of
5a60d0dad6be82337d8a41fcafdd3f73c9f8be95on AMD RDNA4. I merged it onto currentmaine50836blocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 706 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 665 passed, 0 failed, 21 ignoredSKIPPED;llvm_gfx10_sdwa_textandsdwa_modifiers_and_scalar_sourcespass.Review: Disassembler text only. I found nothing to change.
Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@eizispark on GitHub · 2026-11-24 06:53 UTC · original
Hardware check of
5a60d0dad6be82337d8a41fcafdd3f73c9f8be95(verified clean merge withmainbeaa245): pass.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profilecargo test --workspace -- --test-threads=4:703 passed, 0 failed, 41 ignored(GPU tests skipped on this adapter:none)cargo test -p xcl --lib gpu::rdna2:11 passed, 0 failed(includingllvm_gfx10_sdwa_text,sdwa_modifiers_and_scalar_sources,sdwa_and_dpp_src0)Regression run
main(beaa245):PR (
5a60d0d):Not tested
AI use
scripts/smoke.ps1harness on this machine and formatted this report.@Anon64 on GitHub · 2026-11-24 06:55 UTC · original
Regression runs for this PR's head
5a60d0dand for its basemainf4ce27c, on a retail title (same title, 60 s each), made withscripts/smoke.ps1(release, clean tree at each commit) and pasted unedited, for Regression run.main:
this PR:
Tested
Not tested
xcl disasmoutput itself: a title run does not use it, so this is a regression check onlyReport written with Claude Code (Claude Opus 5.5) from runs on this machine.
@upipibi on GitHub · 2026-11-24 10:07 UTC · original
Thanks @Anon64: both blocks are now in Regression run, credited.