Recompiler: mask bridged V_CMP_* results with EXEC in per-lane lowering #2493
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2503"
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 ChalanaGimhanaX on 2026-11-25T20:55:13Z.
Mask bridged non-
CMPXV_CMP_*results withEXECin per-lane direct DXIL lowering (Lower::bridge), matching RDNA2 hardware, nativeLower::valu_op, and the HLSL path.lane_masks::is_vectorexcludes allV_CMP*instructions so their PCs are never inself.guarded, andLower::valu_oponly lowers plainU32/I32compares natively. Every float (F32/F16/F64), 64-bit, 16-bit,V_CMP_CLASS_*, and VOP3-modified/SDWA compare falls through toLower::bridge, which previously only capturedold_execforV_CMPX*and passedguard = truetoIr::foreign. Inactive lanes outsideEXECtherefore left1inVCC/SDSTinstead of0, corrupting subsequent mask ops andS_CBRANCH_VCCZ/VCCNZbranches.Part of #2458, #1269, and #1833. (Issue #2458 item 2 —
NULL/SDST = 125writes — is already covered by open PR #2117 and intentionally left out to stay single-purpose and avoid conflicts.)What is in it
crates/xcl/src/gpu/recomp/lower.rs: inLower::bridge, captureold_execfor allV_CMP*instructions (when!in_guarded_run), not onlyV_CMPX*, so inactive lanes are ANDed out beforewrite_bit.crates/xcl/src/gpu/recomp/lower_dxil.rs: addeda_bridged_v_cmp_clears_inactive_lanes_outside_execcovering bridged VOPC (VCC) and VOP3 (s4)V_CMP_LT_F32under narrowedEXEC(exact register checks + HLSL GPU parity) and computeS_CBRANCH_VCCZunder both wave32 and split wave64 (with DXIL validation on CPU).Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), DXC1.8.2502.11, release build.lower.rsfix:cargo test --release -p xcl --lib gpu::recomp::lower_dxil::tests::a_bridged_v_cmp_clears_inactive_lanes_outside_exec -- --exact --nocapturefailed withassertion left == right failed: vcc must clear inactive lanes 16..31 (left: 4294901760 [0xFFFF_0000], right: 0).1051482):cargo test --release -p xcl --lib gpu::recomp::lower_dxil::tests:: -- --test-threads=4 --nocapture: 22 passed, 0 failed.XCL_ADAPTER=warp):a_bridged_v_cmp_clears_inactive_lanes_outside_execpassed (all 3 DXIL containers compiled and validated on CPU; GPU execution skipped cleanly withno GPU with 32-lane waves).1051482):cargo build --release --workspace+cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1424 passed, 0 failed, 46 ignored across 37 test binaries.SKIPPEDGPU/adapter tests (26): 21no wave64, 3 refused per-lane f16/f32 forms (#1426), 1no heap windows, 1pso_measurement_compiles_an_exact_synthetic_record(Windows Developer Mode required for driver cache disable).cargo test --release -p xcl --test e2e -- --test-threads=1(1051482): 4 passed, 0 failed.Regression run
main (
6d051da):this PR (
1051482):Not tested
split = falseGPU execution path), AMD / Intel GPUs, Linux / Wine, and retail gameplay beyond the 60-second smoke run.AI use
Lower::bridgeEXEC-masking fix and GPU/DXIL-validation regression test, ran the test suite and regression smoke run, and drafted this description.Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T21:07:47Z.
Ran on an AMD RX 9070 XT (RDNA4) and an RTX 3060: the new test passes on both cards, and nothing else changes.
Diff applied on
main6d12f58, debug, Windows 11 Pro 26200,cargo test -p xcl --lib -- gpu:: --test-threads=4onmainand with the PR, card chosen withXCL_ADAPTER, run twice: once withXCL_PER_LANE=1alone, once withXCL_PER_LANE=1 XCL_DIRECT_DXIL=1. Both gave the same results:a_bridged_v_cmp_clears_inactive_lanes_outside_execok. 699 passed, 2 failed; the 2 failures are the AMD fuzz seeds tracked in #2115, the same onmain.No other test changes result on either card.
On the "native wave64" gap: the test's wave64 case goes through
compute_split, so on the RX 9070 XT it runs the split form too. This run doesn't cover the native (split = false) path either.Not tested: retail shaders, Intel, Linux / Wine.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T21:08:19Z.
gpu_suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.Targeted run of
a_bridged_v_cmp_clears_inactive_lanes_outside_exec: passed.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T21:14:08Z.
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 emirduran707 on 2026-11-25T21:14:55Z.
Independent AMD RDNA4 (native wave64) test report on exact head
10514822001f2302cd102b9431a9d8613e45cf3a(clean detached checkout, no local changes).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1422 passed, 2 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused by per-lane form;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.gpu::recomp::lower_dxil::tests::a_bridged_v_cmp_clears_inactive_lanes_outside_exec.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1seed 722 andfuzz_validate_and_gpu_3seed 1599) are pre-existing on unmodifiedmainon this GPU.Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
Imported from ivall/xcl. Originally posted by xpatfussy69x on 2026-11-25T21:34:02Z.
Test run on exact head
1051482(10514822001f2302cd102b9431a9d8613e45cf3a, on base6d12f58), clean tree.Tested
cargo test --workspace -- --test-threads=4: 1424 passed, 0 failed, 46 ignoredV_MUL_F16/V_PK_MUL_F16/V_CVT_F16_F32(onmaintoo; #2182 removes them)cargo test -p xcl --lib a_bridged_v_cmp: 2 passed (a_bridged_v_cmp_clears_inactive_lanes_outside_execand the existinga_bridged_v_cmpx_keeps_the_lanes_outside_exec_out), not skippedmain, a program with EXEC = lanes 0–15, a bridgedv_cmp_le_f32true in every lane, EXEC restored andv_cndmaskon VCC gives 7 in lane 16 instead of 0; this PR's change gives 0Regression run (60 s, default settings)
main:
this PR:
No crash or device removal; frames 102 % of
main's, peak commit 100 %.Not tested
v_cmpunder a narrowed EXEC (not run withXCL_PER_LANE=1): a regression check onlyAI use
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T03:15:42Z.
Independent desktop NVIDIA (Wave32-only Ada) verification of PR #2503 at head
10514822001f2302cd102b9431a9d8613e45cf3a(1commit; exact parent & merge-base:6d12f58a229bc73889878a448c64dc3af25eeba0, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
10514822)cargo test --release -p xcl --lib a_bridged_v_cmp_clears_inactive_lanes_outside_exec -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1324 filtered out× 3 (0.25s,0.21s,0.21s,0skipped — live execution on RTX 4060)cargo test --release -p xcl --lib gpu::recomp:: -- --test-threads=4(3 consecutive runs)393 passed; 0 failed; 19 ignored; 913 filtered out× 3 (5.83s,5.93s,6.00s;370executed on RTX 4060 +23expected Wave32-only/env skips)cargo build --release -p xcl1m 09s, exit0,0new warnings)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
6d12f58a229bc73889878a448c64dc3af25eeba0, cached baseline on the same machine):PR #2503 (
10514822001f2302cd102b9431a9d8613e45cf3a):Runtime log observations (
xcl.log)9222log lines,0[ERROR]/ device-removal / panic lines.19639 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample13986 MB committed by the process; video memory 6115 MB local, 4651 MB non-local.Limits of coverage
V_CMP_*results withEXECin per-lane lowering was directly executed on desktop Wave32-only RTX 4060 viaa_bridged_v_cmp_clears_inactive_lanes_outside_exec(3/3,0skipped) andgpu::recomp::(370executed +23expected Wave32-only/env skips × 3).title: 29640639confirms zero runtime regression rather than recompiling a cold shader set (frame-count delta vs. cached parent reflects single-run startup variance, not this PR).AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T10:19:06Z.
merge-check
base:
e429936c10head:
1051482200merge: clean
build:
cargo build --offline --locked -j 4 --workspace-> oktests:
cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4-> 2,126 passed, 10 failed, 48 ignored; 25 GPUSKIPPEDnotices. The ten failure names match the current-main baseline:dispatch_chain_oversized_loop_matches_whole,dispatch_chain_wave32_live_loops,dispatch_chain_wave64_live_loops_and_exchange,gpu_heap_flat_reads_match_guarded_and_root_output,console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk,gpu_compute_mode_dispatch_abi,gpu_float_cas_uses_ieee_equality,test_title_runs_and_game_folder_is_untouched,test_title_runs_under_the_debug_layer_with_dred, andtest_title_draws_with_a_root_signature_under_the_debug_layer. Focuseda_bridged_v_cmp_clears_inactive_lanes_outside_exec: 1 passed, 0 failed on the RTX 3080 Ti.review: No blocker found in the full merged diff.
Lower::bridgecaptures the incoming EXEC bit for bridgedV_CMP*outside an already guarded run and masks the compare result before writing VCC or an explicit SGPR destination. The regression checks both destinations and branch behavior for wave32 and split wave64. Native unsplit wave64 GPU execution remains untested here. The author's clean-head paired smoke blocks and independent test reports are in the PR.performance: One additional EXEC read and bitwise AND when lowering a bridged compare outside a guarded run; this is confined to translation and its emitted compare path. No runtime benchmark was run in this check.
verdict: safe to merge
hardware / tool and model: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), DXC 1.8.2502.11; Codex (GPT-6.2 Sol) ran the build and tests and reviewed the merged diff; Codex (GPT-6.2 Astra) independently reviewed compare semantics and regression coverage.
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T13:22:44Z.
merge-check claim
head:
1051482200Imported from ivall/xcl. Originally posted by throny on 2026-11-28T13:38:27Z.
merge-check
base:
e429936chead:
1051482200merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2127 passed, 9 failed, 48 ignored (26 SKIPPED lines). The 9 failures are main's own at
e429936con this GPU (#3093), the same set with and without this PR; base alone: 2126 passed, 9 failed, 48 ignored.review: no blocker. The old EXEC is now read for every bridged compare, and inactive lanes get bit AND EXEC = 0, which is what the HLSL path produces (the test compares the two). The condition on guarded runs never matters for compares, because every compare writes VCC or a scalar register and is therefore kept out of coalesced runs, so the cmpx forms behave as before. Open from the thread: the native (unsplit) wave64 path is not exercised by the test.
performance: one extra EXEC read and AND per bridged compare, in the per-lane form only (XCL_PER_LANE=1, opt-in); only per-lane cache entries are re-translated.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).