Recompiler: SDWA register uses come from the extension dword #811
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!811
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-811"
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:45 UTC · original
upipibi:rdna2-sdwa-register-uses→main· +74 −4 · 2 files · 1 commits · openrdna2::sgpr_usesandrdna2::vgpr_usesread an SDWA instruction as its base dword only. A source whose S bit is set (an SGPR) is no SGPR read; the second one is reported as a VGPR read of the register with the same number; and the SGPR pair av_cmp_*_sdwawrites instead of VCC (SD) is no write. Forv_cmp_lt_f32_sdwa s5, v1, s2,maingives no SGPR at all and a read of v1 and v2.What that reaches (all on
maine50836b):constant_samplers(recomp/mod.rs, used bytranslate) keeps a constant in an SGPR the compare has overwritten, so an image instruction after it still gets static sampler words.geometry_wave32_hazardsandmesh_wave's mask state do not take the compare's result for a mask (s_bcnt1_i32_b32of it is no "whole-wave mask reduction").shaders.rs).x64_masks.rsreads the extension dword itself (x64_masks::uses) and is unchanged: it builds register bit sets per operand with its own per-lane rules, so using the shared function there would be a rewrite, not a small change.Independent of #790 / #791 (other hunks of
rdna2.rs; the three merge cleanly in any order).What is in it
crates/xcl/src/gpu/rdna2.rs:sgpr_usesadds the SDWA scalar sources (S0 / S1; an inline constant or NULL is no register) and the compare's SDST pair (not forv_cmpx, which writes EXEC);vgpr_usesdoes not count a VSRC1 whose S1 is set. Testsdwa_register_uses_come_from_the_extension_dword(7 words).crates/xcl/src/gpu/recomp/tests.rs:sdwa_compare_destination_is_a_write_to_the_analyses– the two caller-visible effects above on hand-built programs.Tested
main'srdna2.rs: both fail –(([], []), ([1, 2], []))where(([2], [5, 6]), ([1], []))is expected; no "whole-wave mask reduction"; andconstant_samplersreturns the sampler words for the image instruction after the compare too ([(16, [1, 2, 3, 4]), (32, [1, 2, 3, 4])]). With the change both pass.cargo test --workspace --no-fail-fast -- --test-threads=4on204f4b9: two runs. Run 2: 706 passed, 0 failed, 41 ignored (xcl lib: 665 passed, 0 failed, 21 ignored). Run 1: 703 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: the failure of #718, whichmainshows on this machine too.no wave64:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.Regression run
From eizispark's run (https://github.com/ivall/xcl/pull/811#issuecomment-7124196969), thanks:
main:
PR:
Not tested
XCL_SAMPLE_*data: the game-data tests passed without running. Whether a retail shader has an SDWA compare into an SGPR is not known to me.test_title_draws_with_a_root_signature_under_the_debug_layeranduploads_start_from_each_subresources_statereturn early.AI use
🤖 Generated with Claude Code
@mastrr9 on GitHub · 2026-11-24 05:57 UTC · original
Independent native Windows NVIDIA RTX 5080 (wave32) + D3D12 debug layer build/test run and code review at head
204f4b91f12204b0c386e9c1599999d76b428f51.Code Review
rdna2::{sgpr_uses, vgpr_uses}: reads SDWAS0(bit 23) andS1(bit 31) from the extension dword so SGPR operands are tracked insgpr_uses(and excluded fromvgpr_useswhenVSRC1hasS1=1), and tracksENC_VOPCSDSTpairs (ext[14:8]whenSD=1and notV_CMPX/NULL). Both unit tests cleanly verify decoder and downstream recompiler analyses. No issues found.Tested
617.42/32.0.16.1742), Windows 11 Pro 25H2 (26200.9974), D3D12 debug layer installed (d3d12SDKLayers.dll),rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC from Windows SDK10.0.26100.0, debug build.cargo build --workspace && cargo test --workspace -- --test-threads=4ok):gpu::rdna2::tests::sdwa_register_uses_come_from_the_extension_dwordgpu::recomp::tests::sdwa_compare_destination_is_a_write_to_the_analysesgpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask(no wave64)gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)Not tested
AI use: Antigravity (Gemini 4 Neon reviewed the diff; Gemini 4 Hydrogen ran the RTX 5080 workspace tests) drafted this report.
@MesshM on GitHub · 2026-11-24 06:06 UTC · original
Test run of
204f4b91f12204b0c386e9c1599999d76b428f51on AMD RDNA4. I merged it onto currentmainbeaa245locally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 715 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 674 passed, 0 failed, 21 ignoredSKIPPED;sdwa_register_uses_come_from_the_extension_dwordpasses.Review: src0 now comes from the extension dword's bits [7:0] with S0 at bit 23, src1's S1 at bit 31, and a
v_cmp_*_sdwawith SD set writes its SGPR pair instead of VCC (not forv_cmpx), with null (125) left out. That matches the SDWA layout in the RDNA2 ISA. 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.
@Anon64 on GitHub · 2026-11-24 06:37 UTC · original
Regression runs for this PR's head
204f4b9and for its basemaine50836b, 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
Report written with Claude Code (Claude Opus 5.5) from runs on this machine.
@SlopTart on GitHub · 2026-11-24 06:41 UTC · original
2|
3|AMD + release-build datapoint - the axes your row lists as not tested.
4|
5|Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Wine = Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust 1.100.0 cross
x86_64-pc-windows-gnu, release profile,XCL_NETWORK=0, native wave64. Same rig as my Linux rows in #42 / #718.6|
7|Merged state: head
204f4b9onto mainbeaa245, clean merge.8|
9|Full suite,
cargo test --workspace --release --no-fail-fast -- --test-threads=4: 705 passed, 10 failed, 41 ignored (17 suites). The 10 = this rig's 7 stable Wine-lane failures (my #42 row) + the #718 flaky trio firing that run (~2/5 rate, PR-independent). Nothing new fails. Your tests pass:gpu::rdna2::tests::sdwa_register_uses_come_from_the_extension_dwordok,sdwa_compare_destination_is_a_write_to_the_analysesok.10|
11|Not tested: retail titles (none here), Windows, RDNA4.
12|Counts only, no game data.
13|AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
@eizispark on GitHub · 2026-11-24 06:41 UTC · original
Hardware check of
204f4b91f12204b0c386e9c1599999d76b428f51(verified clean merge withmainbeaa245): pass.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profilecargo test --workspace -- --test-threads=4:706 passed, 0 failed, 41 ignored(GPU tests skipped on this adapter:none)sdwa_register_uses_come_from_the_extension_dwordandsdwa_compare_destination_is_a_write_to_the_analyses:2 passed, 0 failedRegression run
main(beaa245):PR (
204f4b9):Not tested
AI use
scripts/smoke.ps1harness on this machine and formatted this report.@DavidM1911 on GitHub · 2026-11-25 10:48 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.