Recompiler: include RMW destination reads in rdna2::vgpr_uses and sgpr_uses #2124
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2134"
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 Decodere on 2026-11-25T05:42:47Z.
What is in it
Tracks implicit read-modify-write (RMW) destination reads in
rdna2::vgpr_uses()andrdna2::sgpr_uses()(crates/xcl/src/gpu/rdna2.rs) for RDNA2 instructions whose ISA table marksVDST/SDSTasinput: false, output: true:vgpr_uses(): extends the RMW accumulator list (V_FMAC_F32/V_MAC_F32/V_FMAC_LEGACY_F32) to includeV_FMAC_F16,V_PK_FMAC_F16,V_DOT2C_F32_F16, andV_DOT4C_I32_I8. Previously,recomp::partition::classifywipedLANE_IDtaint accumulated intoVDSTby those four instructions and falsely classified wave-cut-dependent shaders asTier::Exact. (V_WRITELANE_B32is intentionally not added, preservingmesh_wave.rs'svgpr_reads.first() == Noneexpectation.)sgpr_uses(): appendswtorforS_CMOV*(S_CMOV_B32,S_CMOV_B64,S_CMOVK_I32),S_ADDK_I32,S_MULK_I32,S_BITSET0_B32,S_BITSET0_B64,S_BITSET1_B32, andS_BITSET1_B64(matchingx64_masks::keeps_destination, withNULL125already excluded fromw). Previously,recomp::mesh_wave::analyzewiped mask taint onSDSTacross those scalar RMW ops and dropped mask-derivedS_CBRANCH_SCC*branches frommask_scc_branches.gpu::rdna2::testscovering directvgpr_uses(all 4 vector accumulators + negative controls includingV_DOT2_F32_F16,V_ADD_NC_U32,V_WRITELANE_B32), directsgpr_uses(all 9 scalar RMW ops,NULL125, and plain overwrites), and end-to-end taint propagation throughrecomp::partition::classifyandrecomp::mesh_wave::analyze.Part of #336
Tested
Environment: Windows 11 Home 26200, Intel Core i5-11400F, 32 GB RAM, NVIDIA GeForce RTX 4060 8 GB (driver 621.14, wave32), Rust 1.100.0, DXC
1.9.2609.5(01b62ad4).cargo test -j 4 -p xcl --lib gpu::rdna2::tests::rmw_ -- --nocapture): 0 passed, 3 failed (V_FMAC_F16omittedVDSTfromvgpr_usesreads,S_ADDK_I32omittedSDSTfromsgpr_usesreads, andpartition::classifyreturnedTier::ExactonV_MBCNT_LO_U32_B32->V_FMAC_F16->EXP).gpu::rdna2::tests20 passed / 0 failed (debug &--release),gpu::recomp::partition::tests44 passed / 0 failed,gpu::recomp::mesh_wave::tests13 passed / 0 failed (pure CPU tests, CI WARP-safe).cargo build --release --workspaceandcargo test --release --workspace -- --test-threads=4 --nocapture): 1,157 passed, 0 failed, 46 ignored across 21 test binaries (1101inxcllib,56across the remaining 20 binaries), with 27SKIPPEDlines on this RTX 4060:no wave64(RTX 4060 is wave32-only)per-lane form: refused(wave32 f16 arithmetic, f16 packed, f32 conversions)no d3d12SDKLayers.dll/no D3D12 debug layercannot disable the driver cache(Windows Developer Mode not enabled)no heap windowsRegression run
Paired 60 s runs via
scripts/smoke.ps1on cleanorigin/main(6020a33b) and clean PR head (5ea738c9):Main (
6020a33b16ba2de25b3aef5947552f2dc1831f09):PR (
5ea738c9377b677733621fa33e85f11f386b962c):Not tested
no wave64skips on RTX 4060), D3D12 debug layer tests (2 skips withoutd3d12SDKLayers.dll), driver cache disable toggle (1 skip without Windows Developer Mode), and heap-window OOM fallback (1 skip withoutXCL_HEAP_WINDOWS).title: 29640639(andpartition::classify/mesh_wave::analyzeare analysis passes not yet wired into runtime translation).AI use
Google Antigravity (Gemini 4 Neon) wrote the
rdna2::vgpr_uses/sgpr_usesfixes, unit tests, and this PR description. All pre-fix/post-fix unit tests, full release workspace tests, paired 60 s smoke runs, andscripts/pr_check.py --localvalidation were run locally on this machine.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T06:32:40Z.
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!
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T20:18:49Z.
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 Foniass on 2026-12-01T07:27:12Z.
Triage (#1607) – head
5ea738cNo open PR changes
rdna2::sgpr_uses/vgpr_usesthis way, and main does not have it: only the three FMAC/MAC accumulators read VDST there. The commit "DXIL: fix compact SGPR liveness for RMW/CMOV SALU" (carried by #2604 and the amd-dev merge #3547) treats the same S_CMOV/S_ADDK/S_MULK/S_BITSET ops as read-modify-write, but indxil/compact.rs's own use/def table. It is a different function, so it is not a duplicate.No problems found in the diff.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by BBareth on 2026-12-01T09:38:54Z.
merge-check claim
head:
5ea738c937Imported from ivall/xcl. Originally posted by BBareth on 2026-12-01T10:00:00Z.
merge-check
base:
493dbd3dd0head:
5ea738c937merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2903 passed, 0 failed, 51 ignored; 28 SKIPPED lines, as on the base; failing: none. The base alone, same machine, same commit: 2900 passed, 0 failed, 51 ignored, 28 SKIPPED lines (22 no wave64, 2 no heap windows, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 cannot disable the driver cache). The three new tests ran and passed:
rmw_vector_accumulators_read_vdst,rmw_scalar_ops_read_sdst,rmw_uses_propagate_taint_in_partition_and_mesh_wave.review: no blocking finding; one file (+124/-1), every line read.
rdna2::sgpr_usesnow lists SDST among the reads of the conditional moves (S_CMOV*) and ofS_ADDK_I32,S_MULK_I32andS_BITSET0/1_B32/B64, andvgpr_useslists VDST among the reads ofV_FMAC_F16,V_PK_FMAC_F16,V_DOT2C_F32_F16andV_DOT4C_I32_I8; these instructions keep or accumulate into their destination. The analyses that use these lists (the new test covers partition and mesh_wave) see more reads, which should only make them more conservative.mainalready has tests for the scalar cases in two analyses (cmov_and_rmw_salu_read_sdst_...,scc_reading_and_rmw_scalar_ops_preserve_mask_taint); they still pass on the merge. Not tested here: a retail shader whose classification changes with this; no GPU test is involved.performance: none at run time; a program that was classified too optimistically may now take the more conservative form (not measured).
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.
Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T07:47:13Z.
Keeping open: still fixes RMW destination reads in
rdna2::vgpr_usesandrdna2::sgpr_uses(crates/xcl/src/gpu/rdna2.rs);MERGEABLE/CLEANwith green CI and 1/2safe to mergefrom @BBareth, waiting for a 2nd / AMD check. (AI note: checked with Antigravity, Gemini 4 Neon.)Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-12-02T17:13:05Z.
Linux / AMD RDNA4 (RADV, Wine + vkd3d-proton): full test suite on
5ea738cMerged onto
main5eaadb54(clean merge) and compared withmainrun twice on the same machine.Setup
v3.1-83-gcae8353edand DXVKdxgi.dllfrom GE-Proton11-16, DXC 1.9.2609.5x86_64-pc-windows-msvcwithcargo-xwin; test binaries run under WineTested:
cargo xwin test --workspace --target x86_64-pc-windows-msvc --no-fail-fast -- --test-threads=4 --skip <31 tests>main5eaadb54main:hle::d3d12x::vram::tests::spares_stay_out_of_dump_tracking_until_handed_out.hle::d3d12x::vram::tests, 4 threads). The PR only touchesgpu/rdna2.rs.rmw_vector_accumulators_read_vdst,rmw_scalar_ops_read_sdst,rmw_uses_propagate_taint_in_partition_and_mesh_wave).main:gpu::recomp::tests::gpu_qsad_and_mqsad,gpu::recomp::tests::gpu_split_wave64_cross_half_operations(flaky onmainunder Wine).About the failures on
mainand the 31 skipped tests (same for every PR in this batch)main's 177 failures under Wine come from #175: once a test has set up the real device, vkd3d-proton refuses the command allocators XCL adopts (d3d12_command_list_Reset: Invalid command allocator), and later tests getE_INVALIDARG(0x80070057). Running vkd3d-proton master with its vtable check taken out,hle::d3d12x::sparse::testsgoes from 106 passed / 38 failed to 144 / 0.std::terminate()(Cannot reliably convert LLVM pointer type, we cannot differentiate between Function and Private), which kills the whole test binary. They are the split-wave64, dispatch-chain and bridged-mask GPU tests,gpu_compute_mode_dispatch_abi,gpu_compute_thread_limits_leave_the_lanes_past_them_out, the twogpu_mesh_mode_*tests, andconsole_wave64_compute_through_the_pso_hook_dispatch_and_read_back, plusserialize_root_signature_strips_console_flags_and_preserves_pc_flags, whose null descriptor vkd3d-proton dereferences. The dxil-spirv ones crash the same way with vkd3d-proton master (f8c1cae8, dxil-spirv93ab44c5).mainwas run twice: same counts, same failure set.SKIPPEDlines (same asmain): no heap windows (2), no D3D12 debug layer (2-3), driver cache control not implemented in vkd3d-proton (1).Not tested: Windows, NVIDIA, a retail title /
scripts/smoke.ps1, a review of the diff. This is a test report, not amerge-check.AI use: omp (Claude Opus 5.5) merged, built and ran the suites on this machine, compared the results with
main, and drafted this report. The user asked for it to be posted.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.