Recompiler: SDWA register uses come from the extension dword #805
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-24T05:45:52Z.
rdna2::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
Imported from ivall/xcl. Originally posted by ethandepstein-del on 2026-11-24T05:57:39Z.
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.
Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T06:06:50Z.
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.
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-24T06:37:31Z.
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.
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-24T06:41:28Z.
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.
Imported from ivall/xcl. Originally posted by eizispark on 2026-11-24T06:41:45Z.
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.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T10:48:21Z.
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!
upstream-sync referenced this pull request2026-11-25 16:10:51 +00:00
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:41:17Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by relativespace2K on 2026-11-30T03:10:00Z.
merge-check
base:
53e85fb1head:
204f4b91f1merge: clean
build: cargo build --workspace -> failed
tests: not run, the build fails first:
error[E0061]: this function takes 3 arguments but 2 arguments were suppliedatcrates/xcl/src/gpu/recomp/tests.rs:174, where the PR callssuper::constant_samplers(&insts, &Default::default())and main'sconstant_samplers(crates/xcl/src/gpu/recomp/mod.rs:1804) now takes(insts, leaders, follow: bool).review: no finding on the change itself on its own base; the problem is that the base moved.
git merge --no-ffis clean because the signature change landed elsewhere in the tree, so the merge looks fine and the compile is what catches it. The PR needs a rebase onto currentmain(the third argument is thefollowflag that was added toconstant_samplers), after which this should be re-checked on the new head.performance: not applicable, it does not build.
verdict: not yet: does not build against current main;
crates/xcl/src/gpu/recomp/tests.rs:174callsconstant_samplerswith 2 arguments where main now takes 3 (thefollowflag). Rebase onto main and it can be checked again.hardware / tool and model: AMD Radeon RX 6800 XT 16 GB (RDNA2, wave64), driver 32.0.21045.29003; Ryzen 5 5600, 32 GB RAM; Windows 10 IoT Enterprise LTSC 2024, 10.0.26100 build 26100.9974; Rust 1.100.0; DXC 1.9.2602.17; debug build. DeepSeek Harness coding agent, model DeepSeek V4.1 Flash.
Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-30T03:33:59Z.
merge-check
base:
cfb9753a8chead:
204f4b91f1merge: clean (no textual conflict)
build: cargo build --workspace -> ok, but the lib test target does not compile on this base
tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 -> not run:
error[E0061]: this function takes 3 arguments but 2 arguments were suppliedatcrates/xcl/src/gpu/recomp/tests.rs:174, where the new test callssuper::constant_samplers(&insts, &Default::default()). On currentmainconstant_samplerstakes a third argument,follow: bool(gpu/recomp/mod.rs:1804). Base alone on this PC: 2834 passed, 0 failed, 51 ignored.review: whole diff read (+74/-4,
gpu/rdna2.rsand the test). The decoder change itself raised no finding in the read: with an SDWA extension dword, a source marked as scalar is reported as an SGPR use and no longer as a VGPR use, and a compare with the SD bit reports its SDST as the mask destination. It could not be confirmed by its tests here because of the build error above. The fix is one argument in the test's call; after a rebase this needs a fresh check.performance: decoder metadata only.
scripts/smoke.ps1on the merged release build (which does compile), 60 s of a retail title: 1684 frames and 15574 MB peak commit against 1678 and 1677 frames on the base. No device removal, no crash.verdict: not yet: the test target does not compile on current main (one missing argument at tests.rs:174); needs a rebase
hardware / tool and model: RTX 5070 Ti 16 GB (617.42, wave32), Ryzen 7 9800X3D, 32 GB, Windows 11 26300, rustc 1.100.0 / Claude Code (Claude Fable 5.2 ran the build and wrote this; Claude Opus 5.5 read the diff first)
Imported from ivall/xcl. Originally posted by upipibi on 2026-12-01T00:15:10Z.
Rebased onto
maind0832e61(c9ef0b8d). The only change is in the test:constant_samplerstakesfollownow, and it passesfalse, since the test's code is one straight block.It still fixes the same thing: on
main,rdna2::sgpr_uses/vgpr_usesstill read an SDWA instruction as its base dword. Sov_cmp_lt_f32_sdwa s5, v1, s2reports no SGPR write and a read of v2, which reachesconstant_samplersandgeometry_wave32_hazards.Windows, Ryzen 9 5950X:
cargo build --workspaceok;cargo test -p xcl --lib2744 passed, 0 failed, 31 ignored. The PR's two tests pass. Withrdna2.rsas onmain,sdwa_compare_destination_is_a_write_to_the_analysesfails (whole-wave mask reductionnot found), so the test still catches it.For merging it still needs the two
xcl-smokeblocks (CONTRIBUTING.md, "Regression run"). I can't make those here, so anyone who can runscripts/smoke.ps1on a title frommainand fromc9ef0b8dis welcome to post them.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:11:08Z.
Triage (#1607) – head
c9ef0b8No open or merged PR makes the same change. On main,
rdna2::sgpr_usesignores an SDWA instruction's S0/S1 bits and the VOPC SD destination, andvgpr_usescounts an S1-selected VSRC1 as a VGPR. #2068 touches SDWA VSRC1 only in the direct-DXIL lowering (lower_valu.rs), and #2479 (merged) coversreload::changes, not these helpers. The bit positions (S0 bit 23, SDST 14:8, SD bit 15, S1 bit 31) and the encoded test words check out.The failing check is
PR description;Build and testpasses.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.