Recompiler: close four wave64-on-wave32 partition classifier soundness holes #2122
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!2122
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2122"
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:13 UTC · original
Decodere:fix-336-partition-soundness→main· +215 −23 · 1 files · 1 commits · openWhat is in it
Closes four soundness holes in the wave64-on-wave32 partition classifier (
crates/xcl/src/gpu/recomp/partition.rs) where cut-dependent shaders were misclassified asTier::Exact:SRC2handling (uses(),source_taint(),step()):u.lane_maskinstep()soV_CNDMASK_B32/V_ADD_CO_CI_U32/V_SUB_CO_CI_U32/V_SUBREV_CO_CI_U32no longer dropLANE_ID/ mask taint from their mask operand.SRC2presence inuses(): decodes valid SGPR pairs includingEXEC(126), excludesM0(124) /NULL(125) / constants instead of mis-mapping them toVCC, and falls back to[VCC, VCC + 1]only for VOP2 forms withoutSRC2.MASK_DATAinsource_taint()unlessSRC2is0/-1/null(125 | 128 | 193) or a trackedst.lanesSGPR pair (or trackedVCCfor VOP2).WREXEClane-set check (source_taint()): Includesn.contains("WREXEC")alongsideSAVEEXECin the bitwise lane-set check (and treats125nullas a zero lane set), catchingS_ANDN1_WREXEC_B64/S_ANDN2_WREXEC_B64with non-lane operands asmask-data.EXECwrites (step()): Computeslane_src/lanes_made(including checkingSDSTforS_CMOV_B*) before thewrites_execsink check, flagging any non-lane write toEXEC(e.g.S_MOV_B64 exec, s[0:1]wheres[0:1]holds a number,S_CSELECT_B64 exec, 1, 0,S_CMOV_B64 exec, 1,S_NOT_B64 exec, 1) and single-wordEXECwrites withMASK_DATA(both recording"mask-data"and taintingEXEC).SAVEEXEC& non-maskS_ANDN2*uniformity (step()): Replaces|| n.contains("SAVEEXEC")inkeeps_uniformwith an explicit allowlist of non-complement ops (excludingS_NOR/S_NAND/S_XNOR/S_ORN1/S_ORN2/S_XOR_SAVEEXEC_B64), and requiresS_ANDN2_*SSRC0to be zero (125 | 128) or a tracked mask SGPR pair (st.mask[s] && st.mask[s + 1]) rather than-1or a non-mask SGPR.gpu::recomp::partition::tests.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::recomp::partition::tests -- --nocapture): 44 passed, 4 failed — all 4 new counter-example tests (lane_mask_taint_and_non_lane_selectors_are_caught,wrexec_with_non_lane_operand_is_mask_data,non_lane_exec_writes_are_mask_data,complement_saveexec_and_andn2_with_non_mask_are_not_uniform) returned[](Tier::Exact) pre-fix.cargo test --release -p xcl --lib gpu::recomp::partition::tests -- --nocapture): 48 passed, 0 failed (pure CPU unit tests, CI WARP-safe).cargo build --release --workspaceandcargo test --release --workspace -- --test-threads=4 --nocapture): 1,158 passed, 0 failed, 46 ignored across 21 test binaries (1102inxcllib,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(f5c5bdf0) and clean PR head (ddcda018):Main (
f5c5bdf0e91035f8f1404f46f4f2f7aedc259e7f):PR (
ddcda0184c4fb347a1546f9c61be127c70795713):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::classifyis classification-only (not yet wired into runtime translation).AI use
Google Antigravity (Gemini 4 Neon) wrote the
partition.rssoundness fixes, 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.@DavidM1911 on GitHub · 2026-11-25 06:18 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). 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.