Recompiler: preserve MSAA load block boundary #3159
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3159"
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 bmjask on 2026-11-28T14:08:53Z.
Commit
56237a2dput the MSAA sample-count query before the loads and emitted the loads in a new block, but CFG simplification merged that single-predecessor block back into its predecessor. The resulting DXIL again placed GetDimensions before TextureLoad in one basic block, restoring the AMD compiler crash pattern guarded by the regression test.What is in it
crates/xcl/src/gpu/dxil/module.rs: mark block boundaries that CFG simplification must retain.crates/xcl/src/gpu/dxil/module/opt.rs: keep marked targets out of linear-block merging and test the behavior.crates/xcl/src/gpu/dxil/lower_image.rs: preserve the boundary before direct MSAA texture loads.Tested
bba710e299e936089030f4640a121b0b0329b378.cargo test -p xcl --lib gpu::dxil::module::opt::tests::simplify_cfg_keeps_preserved_block_boundary -- --exact --test-threads=1: 1 passed, 0 failed, 0 ignored.cargo test -p xcl --lib gpu::dxil::msaa_tests::direct_msaa_loads_precede_get_dimensions -- --exact --test-threads=1 --nocapture: 1 passed, 0 failed, 0 ignored.scripts/test.ps1: benchmark harnesses 73 passed, 0 failed; library 2,008 passed, 0 failed, 28 ignored; integration 134 passed, 0 failed, 20 ignored.XCL_SAMPLE_RPF,XCL_SAMPLE_DLLS,XCL_SAMPLE_TTPF,XCL_SAMPLE_BCPACK,XCL_SAMPLE_BK2,XCL_SAMPLE_BVH4,XCL_SAMPLE_AWC,XCL_SAMPLE_XG, andXCL_SAMPLE_DXC.Regression run
Both runs used the same real title and
XCL_PREPARE=0,XCL_PREPARE_GRAPHICS=0so the bounded smoke did not wait for its staged 26,503-shader corpus.Not tested
AI use
Codex with GPT-5 diagnosed the optimizer merge, implemented the scoped block-boundary preservation, added its unit test, rebased the branch, and ran the tests and smoke comparisons above.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T14:37:37Z.
Independent Windows check of #3159 head
bba710e2against clean mainb937fbab. Windows 11 build 26300, RTX 3080 Ti / NVIDIA 621.35, Ryzen 7 9800X3D, Rust 1.99.1 MSVC.cargo test --offline --locked -j 4 -p xcl --lib gpu::dxil::msaa_tests::direct_msaa_loads_precede_get_dimensions -- --exact --test-threads=1on the PR head: 1 passed, 0 failed, 0 ignored. The same test failed in the clean-main full suite and main's Windows CI.cargo build --offline --locked -j 4 --release -p xcl. The PR package was forced to rebuild after switching worktrees.scripts/smoke.ps1 -Seconds 60runs used the same title, adapter andXCL_PREPARE=0setting. Head showed 1,265 frames versus 1,282 on main (98.7%), with zero crashes or device removals on both; peak commit was 15,106 MB versus 15,124 MB. The title run checks launch and presentation; it does not exercise the AMD compiler failure.AI use: Codex (GPT-6.2 Sol) ran the checks and wrote this report.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T14:49:21Z.
merge-check
base:
b937fbab29head:
bba710e299merge: clean (the base is an ancestor of this head)
build:
cargo build --offline --locked -j 4 --workspace-> oktests:
cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4-> 2,141 passed, 1 failed, 48 ignored; 25 explicit GPU skips. Failing:console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, which also fails on the clean base here.review: not yet. The new boundary flag survives the first optimizer pass, but split-piece cloning creates unmarked blocks and optimizes each piece again. An eligible split compute shader can put GetDimensions and TextureLoad back in one DXIL block. A forced-split synthetic regression on this head failed 0 passed / 1 failed; DXC 1.8.2502.11 disassembled the two calls in the same block of piece 0. Copying the marker to each mapped block made that test pass 1/0. The existing focused MSAA test covers the whole program, not this split-piece path.
performance: the proposed marker copy is per block at translation time; I did not measure a runtime frame-time or memory effect.
verdict: not yet: retain the marked boundary when dispatch pieces copy blocks, and add the forced-split regression before a new exact-head suite and required smoke.
hardware / tool and model: Windows 11 build 26300, RTX 3080 Ti / NVIDIA 621.35, Ryzen 7 9800X3D; Codex (GPT-6.2 Sol) ran the build, suite, and regression; Codex (GPT-6.2 Astra) traced the split path and prepared the tested candidate.
The earlier paired smoke report passed on this head. The synthetic test verifies emitted DXIL ordering; it does not reproduce AMD driver execution.
Candidate fix and forced-split regression tested on this head
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T14:54:48Z.
Post-merge confirmation on main
309c3ec5: the split-piece boundary gap in my earlier review and collapsed diff remains in the merged code.On that exact main, the test-only forced-split regression failed (0 passed, 1 failed): DXIL piece 0 placed
dx.op.getDimensionsbeforedx.op.textureLoad.i32in the same basic block. Applying only the marker-copy change from the linked diff made the same test pass (1 passed, 0 failed). This establishes the emitted-code ordering for an eligible split compute shader; AMD driver execution was not measured.AI use: Codex (GPT-6.2 Sol) ran the exact-main control and checked this follow-up; Codex (GPT-6.2 Astra) traced the original split path.