Repository navigation
Recompiler: invalidate block-local DXIL CSE wave/quad cache across dx.op.discard - #1930
Merged
raylitebull merged 1 commit intoNov 24, 2026
Conversation
….op.discard In dxil::module::opt, cse_kind() caches dx.op.wave* and dx.op.quad* calls in a block-local map (local). Because dx.op.discard demotes lanes to helper lanes mid-block without terminating the block, subsequent wave/quad intrinsics in the same block observe a different active lane set and must not reuse pre-discard values. Clear local when visiting dx.op.discard and add a unit test verifying that identical dx.op.waveActiveBallot and dx.op.quadReadLaneAt calls on opposite sides of dx.op.discard are kept while non-discard calls in the same block still CSE. Fixes xcl-dev#1891. Assisted-by: Antigravity (Gemini 4 Neon)
Contributor
|
NVIDIA counterpart to the RX 6800 run: RTX 3070 8 GB (32-lane waves), driver 616.56, Windows 11, debug,
AI-assisted (Claude Code). Synthetic tests only. |
anoyarou
added a commit
to anoyarou/xcl
that referenced
this pull request
Nov 25, 2026
, xcl-dev#1869, xcl-dev#1898) Brings main to full parity with upstream/main (8e87fc7): - xcl-dev#1930: invalidate block-local DXIL CSE wave/quad cache across dx.op.discard (fixes xcl-dev#1891) - xcl-dev#1864: allow inline-constant and NULL mask operands in the per-lane form - xcl-dev#1869: avoid 2 - off underflow in s_setreg_b32 targeting HW_REG_MODE bit 3 - xcl-dev#1898: truncate s instead of returning native on special values in round_exact Conflict in crates/xcl/src/gpu/dxil/core_tests.rs resolved by keeping both tests (opt_folds_i64_bitcast_selects_and_commutative_cse and s_setreg_b32_mode_bit3_does_not_underflow). Assisted-by: Antigravity (Gemini 4)
gustavsi
added a commit
to gustavsi/xcl
that referenced
this pull request
Nov 25, 2026
Pulls in xcl-dev#1836 (graphics and two-pass PSO disk cache + lazy MS/GS + shader build coalescing), xcl-dev#1930 (DXIL CSE across discard), xcl-dev#1900, xcl-dev#1005, xcl-dev#1053, xcl-dev#1864, xcl-dev#1866, xcl-dev#1869, xcl-dev#1876, and xcl-dev#1898 while keeping our RDNA4 MSAA clamp (xcl-dev#1908), wave64 graphics Direct DXIL guard (xcl-dev#1913), atomic writable-range tracking, static-sampler cache keys, and 4M-group indirect dispatch clamp.
Contributor
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes block-local CSE in
dxil::module::optsodx.op.wave*anddx.op.quad*intrinsics cached in the per-blocklocalmap are invalidated when visitingdx.op.discard.In DXIL pixel shaders,
dx.op.discard(cond)demotes lanes mid-block without terminating the block, changing the wave's active lane set for all subsequent wave/quad intrinsics in the same basic block. Previouslylocalwas never cleared atdx.op.discard, allowing post-discard wave/quad calls with identical operands to reuse pre-discard results.Fixes #1891.
What is in it
crates/xcl/src/gpu/dxil/module/opt.rs:localwhen visitingOp::Call(f, _)whereself.funcs[*f as usize].name == "dx.op.discard".block_cse_invalidates_wave_and_quad_calls_across_discardverifying that identicaldx.op.waveActiveBallotanddx.op.quadReadLaneAtcalls on opposite sides ofdx.op.discardare preserved (2 calls remain), while identical calls withoutdx.op.discardin the same block still CSE to 1 call. Verified to fail on unmodifiedmain(20cf130) before the fix (left: 1, right: 2) and pass with the fix.Regression run
Baseline (immediate parent
main20cf130, warm shader/PSO cache):This PR (
fix/dxil-cse-invalidate-across-discard, warm shader/PSO cache):Tested
Hardware: Windows 11 Pro for Workstations (Build 26300), Intel Core i9-9900K, 32 GB RAM, AMD Radeon RX 6800 (16337 MiB VRAM, Driver
32.0.21045.29003),rustc 1.100.0 (0ef1bc386 2026-11-09).cargo test -p xcl --lib block_cse_invalidates_wave_and_quad_calls_across_discard:1 passed; 0 failed; 0 ignored; 0 skipped.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4:973 passed; 4 failed; 45 ignored; 8 skipped(3 pre-existing RDNA2placed_title_textures_share_vram_and_preserve_pixels+VRAM_TEST_LOCKcascades tracked in D3D12.X: map a one-slice title texture's packed mips where D3D12 addresses them #470, plusgpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1— unrelated pre-existing fuzz failure tracked in DXIL GPU fuzz tests reproducibly fail with E_OUTOFMEMORY on RTX 5060 #1905; the 8 skips are 6 per-lane f16/f32 refusals,pso_measurement_compiles_an_exact_synthetic_recordneeding Developer Mode, andheap_window_out_of_memory_falls_back_to_the_switch_formneedingXCL_HEAP_WINDOWS=1)..\scripts\smoke.ps1on20cf13022f764208384c610c2ae6a3f4eed201a2and50228bb747077d302888cb2c5693dc798a22e154(see Regression run above).Not tested
AI use
Antigravity (Gemini 4 Neon) implemented the
dx.op.discardinvalidation and unit test incrates/xcl/src/gpu/dxil/module/opt.rs, and ran the full test suite and paired smoke runs.