Recompiler: fix per-lane whole-wave predicate and SRC_SCC checks #2014
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!2014
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2014/head"
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?
@AlpPesen on GitHub · 2026-11-25 00:42 UTC · original
AlpPesen:fix/per-lane-whole-wave-predicates→main· +160 −61 · 2 files · 1 commits · merged 2026-11-25 01:21 UTCFixes #1888.
Fixes three soundness gaps in the per-lane (
XCL_PER_LANE=1) whole-wave mask predicate analysis and lowering (crates/xcl/src/gpu/recomp/lane_masks.rs,crates/xcl/src/gpu/recomp/lower.rs):What is in it
lane_masksviaSccKind(Uniform,Any,All,Unknown) souniform_overaccounts for inactive lanes (EXEC == 0) whenwave_branches == false:Any(mask != 0, e.g.S_*_SAVEEXEC,S_NOT, mask bitwise ops,S_CMP_LG_U32/U64): per-lane bit matches hardware only whenc == FALSEwave-wide orre != FALSE && re => c.All(a == b,S_CMP_EQ_U32/U64): per-lane bit matches hardware only whenc == TRUEwave-wide orre != FALSE && re => !c.SccKindacross CFG joins without folding non-uniform mask SCCs viafactalone, and checkuniform_overon the unnegated branch predicate before applyingSCC0/VCCZ/EXECZnegation.VCCwithEXECinS_CBRANCH_VCCZ/S_CBRANCH_VCCNZ(lane_masks::condandlower::condwhen!self.wave_branches), matching RDNA2 hardware which tests all bits ofVCCindependent ofEXEC.reads_scc: both implicitOPR_SSRC_SPECIAL_SCCinputs and explicitSRC_SCC(encoding253) inSSRC0,SSRC1,SRC0,SRC1,SRC2,SOFFSET.lane_masks::testscovering inactive-laneS_CMP_EQ/S_CMP_LG/S_NOTSCC checks,S_CBRANCH_VCCZ/VCCNZwith bits outsideEXEC, and explicitSRC_SCC(253) SALU/VALU reads.Tested
rustc 1.100.0, DXC1.9.2602.17.cargo test -p xcl --lib gpu::recomp::lane_masks: 13 passed, 0 failed, 0 ignored, 0 skipped.cargo test -p xcl --lib gpu::recomp::lower -- --test-threads=4: 51 passed, 0 failed, 0 ignored, 6 sub-case skips (V_MUL_F16/V_PK_MUL_F16/V_CVT_F16_F32unsupported in per-lane form).cargo test --workspace -- --test-threads=4(xcllib, prior to#1910rebase): 945 passed, 4 failed (pre-existing on RX 6800:fuzz_validate_and_gpu_1#1905 andplaced_title_textures_share_vram_and_preserve_pixels+ 2VRAM_TEST_LOCKPoisonErrorcascades #470), 25 ignored, 1 skipped (pso_measurement_compiles_an_exact_synthetic_record: Windows Developer Mode not enabled).cargo test -p xcl --test '*' -- --test-threads=4: 49 passed, 0 failed, 20 ignored, 1 skipped (heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows).Not tested
XCL_PER_LANE=1full retail title playthrough past 60 s.Regression run
AI use
lane_masks.rsandlower.rschanges and unit tests, rebased onto6567c5f(#1910), ran the local test suite and pairedscripts/smoke.ps1runs, and drafted this PR description.@JJAutoCompare on GitHub · 2026-11-25 01:04 UTC · original
Tested
1c971de6463a26fae5b438f3eada5eaf58c66050. The clean checkout matched the open PR before and after testing.32.0.101.9175. Rust/Cargo 1.100.0,x86_64-pc-windows-msvc, debug test profile.CARGO_BUILD_JOBS=2,CARGO_INCREMENTAL=0, isolated Cargo target and TEMP/TMP onL:/XclTooling.%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64. The GPU case compiled the HLSL reference with-E main -T cs_6_6 -HV 2021and usedXCL_ADAPTER=A770.cargo test -p xcl --lib gpu::recomp::lane_masks -- --nocapturecargo test -p xcl --lib gpu::recomp::lower::tests::a_whole_wave_decision_on_a_mask_some_lanes_lack_is_refused -- --exact --nocapture& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { cargo test -p xcl --lib gpu::recomp::lower_dxil::tests::a_branch_on_a_mixed_mask_matches_the_hlsl_path_on_the_gpu -- --exact --nocapture }The CPU checks include inactive-lane SCC decisions, VCC bits outside EXEC, and explicit
SRC_SCCreads. The wave32 Arc case dispatched the HLSL reference and checked the per-lane lowering for a mixed-maskS_CBRANCH_SCC0(expected refusal or matching DXIL output).Not tested
Full workspace suite, retail-title smoke, native wave64, or other GPU/driver combinations in this run. Explicit
SRC_SCCand VCC bits outside EXEC were covered by CPU tests here.AI use
Codex (
gpt-6.2-sol) selected and ran the focused tests and wrote this report.@raylitebull on GitHub · 2026-11-25 01:08 UTC · original
Diff audit passed on
1c971de(SccKind::{Uniform,Any,All,Unknown}tracking inlane_masks.rs, preserving all-laneVCCsemantics inS_CBRANCH_VCCZ/VCCNZ, andreads_sccchecking explicitSRC_SCC = 253across SALU/VALU), and CI (Build and test+PR description) is green.Remaining before merge: independent AMD and NVIDIA GPU test runs on
1c971de.@DarkPanda69 on GitHub · 2026-11-25 01:14 UTC · original
NVIDIA and native-wave64 AMD runs, which this PR lists as not tested (the report above is on an Arc A770).
Tested: pass, head
1c971deapplied onmain0be6ce8, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.cargo test -p xcl --lib -- gpu:: --test-threads=4:whole_wave_scc_accounts_for_inactive_lanes,vccz_branch_checks_bits_outside_exec,explicit_src_scc_reads_are_validatedanda_branch_on_a_mixed_mask_matches_the_hlsl_path_on_the_gpuok. The SKIPPED lines are the same as onmain.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1and_3, which fail the same way onmain0be6ce8without this PR on this card.Not tested:
XCL_PER_LANE=1title runs; Linux / Wine; the whole workspace suite.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@fromthemoonx on GitHub · 2026-11-25 01:17 UTC · original
Passes on NVIDIA (RTX 3060, wave32 only) in the whole workspace suite and with
XCL_PER_LANE=1. One gap: thelower.rshalf of the VCCZ change has no test that fails without it.This adds to the RTX 3060
gpu::run above: the whole suite, the merged tree,XCL_PER_LANE=1and two mutation checks.1c971de:cargo build --workspace+cargo test --workspace --no-fail-fast -- --test-threads=4: 1000 passed, 0 failed, 45 ignored. Merged onto main5796cc4(no conflicts): 1060 passed, 0 failed, 45 ignored. 23 SKIPPED on both, the same as on main: 19 for no wave64, 3 per-lane refusals (V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32) andheap_window_out_of_memory_falls_back_to_the_switch_form.XCL_PER_LANE=1 cargo test -p xcl --lib gpu:: -- --test-threads=1 --skip gpu_sparse_vram: merged tree 525 passed / 0 failed / 21 ignored, main5796cc4522 / 0 / 21 (the difference is the 3 new tests).gpu::recomp::lane_masks10 runs: 10 of 10 passed (13 tests each).lane_masks.rs: withS_CBRANCH_VCCZ/NZANDingVCCwithEXECagain (line 680),vccz_branch_checks_bits_outside_execfails, and it is the onlygpu::recomptest that fails.lower.rs: with the oldVCC & EXECput back only inLower::cond(line 1012), every test still passes:cargo test -p xcl --lib gpu::recomp(323 passed), andXCL_PER_LANE=1 … gpu::recomp::lower(51 passed). So that half of the fix has no test that fails without it. A GPU case throughlower_dxilthat compares the HLSL path for aVCCNZbranch whoseVCChas bits only outsideEXECwould cover it, iflane_masksaccepts such a program.Hardware: RTX 3060 12 GB, driver 610.88, Windows 11 Pro 26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug.
Not tested: native wave64, a release build,
scripts/smoke.ps1(no title on this machine).AI use: Claude Code (Claude Opus 5.5) ran the tests and the mutation checks and wrote this report.
@DavidM1911 on GitHub · 2026-11-25 04:01 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!