Recompiler: fix NULL dest, B32 SAVEEXEC, and MIMG TFE/LWE in upper_lanes #2136
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!2136
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2136"
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?
@Decodere on GitHub · 2026-11-25 05:48 UTC · original
Decodere:fix-336-upper-lanes-soundness→main· +124 −10 · 1 files · 1 commits · openWhat is in it
Fixes three soundness bugs in wave64-on-wave32 upper-lane analysis (
crates/xcl/src/gpu/recomp/upper_lanes.rs):SDST == 125(NULL) on 64-bit / multi-dword SGPR writes clobberedEXEC_LO(s126) andEXEC_HI(s127):step(), 64-bitSAVEEXEC/WREXECwrites and 64-bitENC_SOP1/ENC_SOP2writes calledst.set(dst + 1, ...)even whendst == 125(NULL), overwritingst.s[126](EXEC_LO) — for example,S_OR_SAVEEXEC_B64 null, -1overwroteEXEC_LOwith savedEXEC_HI(Word::Zero). Guarded both paths withdst != 125and avoided readingdst + 1inCMOVwhendst == 125.sgpr_outputs(), generic SGPR outputs (v < 128) and SDWAV_CMP_*outputs (SD == 1) pushedNULL(125) with multi-dword sizes, causing VOP3/SDWAV_CMP_* null, ...to clobbers126(EXEC_LO) andS_LOAD_DWORDX4 null, ...to clobber boths126ands127(EXEC_HI). Skipped125in both output paths.SAVEEXEC/WREXECreadSSRC0viast.src64()instead ofst.src32():st.src64()maps124(M0) and127(EXEC_HI) toWord::Any, losing trackedWordstate on instructions such asS_AND_SAVEEXEC_B32 s0, exec_hiandS_OR_SAVEEXEC_B32 s0, m0. Now usesst.src32(d, fv("SSRC0"))when!b64, matching theENC_SOP1/ENC_SOP2path below it.vgpr_writes()missed the 5th VGPR (vdata + 4) onMIMGloads/samples/gathers withTFE = 1orLWE = 1:VDATA, so whenDMASK = 0xF(orIMAGE_GATHER4) withD16 = 0andTFE = 1orLWE = 1gaven = 5,w.truncate(5)still returned only 4 registers and leftvdata + 4untracked (allowing stale constants invdata + 4to survive an image load underWWM). Rebuildswas(base..(base + n).min(256)).collect().Adds three deterministic CPU unit tests in
gpu::recomp::upper_lanes::testscovering all three bugs.Part of #336
Tested
Hardware/toolchain: Windows 11 (26200), NVIDIA GeForce RTX 4060 (32-lane waves, driver 621.14), DXC
1.9.2609.5 (01b62ad4), Rust1.100.0.null_dst_multi_dword_writes_preserve_exec:Const(0)instead ofConst(u32::MAX);saveexec_b32_reads_32bit_special_sources:Unknowninstead ofConst(0);mimg_tfe_and_lwe_write_fifth_vgpr:[4, 5, 6, 7]instead of[4, 5, 6, 7, 8]).cargo test --release -p xcl --lib gpu::recomp::upper_lanes::tests::: 12 passed, 0 failed, 0 ignored (pure CPU, CI WARP-safe).cargo test --release -p xcl --lib gpu::recomp::partition::tests::: 44 passed, 0 failed, 0 ignored (pure CPU).cargo build --release --workspace: exit 0.cargo test --release --workspace -- --test-threads=4: 1157 passed, 0 failed, 46 ignored across 21 test suites, with 25 pre-existing runtimeSKIPPEDlines (23 native wave64 / unsupported per-lane lowering skips on 32-lane RTX 4060, 1 Windows driver-cache skip, 1 heap-window skip; 0 new skips).Regression run
Paired 60-second
scripts/smoke.ps1runs on the same retail title build (29640639) from cleanorigin/main(6e1e2be) and this branch (f1e281b):Base (
origin/main):PR (
fix-336-upper-lanes-soundness):Not tested
upper_lanesis specifically the wave64-on-wave32 forward analysis and all new tests are deterministic CPU unit tests).AI use
Drafted with Google Antigravity (Gemini 4 Neon) and verified locally by reproducing all three failures before the fix, verifying
upper_lanes::testsandpartition::tests, running the full release workspace test suite, and completing the paired 60-second smoke run above.@DavidM1911 on GitHub · 2026-11-25 06:49 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.