Repository navigation
Recompiler: collapse empty trampolines and merge linear blocks in direct DXIL opt - #2194
Conversation
|
AMD run (listed as untested), paired against Head
Per-test comparison: on both cards the only differences between the two runs are the 5 new Not tested: driver compile time on AMD, a title with |
|
Independent run on NVIDIA and on an AMD GPU with native wave64 (the AMD part is listed as not tested). Exact head Hardware: Windows 11, NVIDIA GeForce RTX 5070 Ti 16 GB, and an AMD Radeon RDNA2 iGPU (gfx1036, native 64-lane waves) selected with
Not tested: cold-cache NVIDIA driver compile times, and a title run. AI use: Claude Code (Claude Opus 5.5) ran the suites, compared them with the base and wrote this comment. |
|
AMD Windows driver timing for #2194: on the RX 9070 XT, AMD's Setup
Method
26 programs (means of 2 rounds; all 104 builds succeeded, 0 refused)
ActivateRays (
Tests on this card (
Read / inference
Not tested
AI use: Claude Code (Claude Opus 5.5) ran the measurements and tests and drafted this. The account owner is away; counts and timings only, no game data. |
…ean-up simplify_cfg (xcl-dev#2194) bypasses an empty block that only jumps on, and the latch blocks single_latch makes are such blocks: a block that had back edges to two loop heads got both again, and the dxil-spirv in vkd3d-proton segfaulted again on direct programs single_latch had fixed. A block whose target comes no later in the reverse post-order is now kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ean-up simplify_cfg (xcl-dev#2194) bypasses an empty block that only jumps on, and the latch blocks single_latch makes are such blocks: a block that had back edges to two loop heads got both again, and the dxil-spirv in vkd3d-proton segfaulted again on direct programs single_latch had fixed. A block whose target comes no later in the reverse post-order is now kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings main to full parity with upstream/main (cdb0891), including: - World rendering & gameplay: xcl-dev#1991, xcl-dev#1988, xcl-dev#1984, xcl-dev#2028, xcl-dev#2078 - Memory / VRAM / PSO: xcl-dev#1985, xcl-dev#2157, xcl-dev#2178, xcl-dev#2195, xcl-dev#2176, xcl-dev#1996, xcl-dev#1914 - Direct DXIL & shaders: xcl-dev#2120, xcl-dev#2174, xcl-dev#2194, xcl-dev#2207, xcl-dev#1951, xcl-dev#1973, xcl-dev#2156, xcl-dev#2064 - Preserves local Linux/Wine customizations: docs/linux.md, scripts/linux/*, in-process Wine XAsync (xgameruntime/api.rs), loader watchdog bypass, and Wine MEM_WRITE_WATCH bypass on coherent UMA windows (gpu/uma.rs). Assisted-by: Antigravity (Gemini 4)
Part of #1269.
After DCE in
gpu::dxil::module::opt, guarded lowering helpers and dead branches leave thousands of empty trampoline blocks ([Br(target)]), single-predecessor linear chains, and degenerateCondBr(c, t, t)/Switchterminators in the emitted DXIL.What is in it
crates/xcl/src/gpu/dxil/module/opt.rs: add a fixed-pointModule::simplify_cfgpass after DCE (opt-out viaXCL_DXIL_NO_OPT=merge, orthogonal to dxil: fold constant CFG terminators after CSE #1818's constant-terminator folding):CondBr(_, t, t)toBr(t)and stripSwitchcases matchingdefault, updatingOp::Phiedge multiplicity to match.[Br(t)],b != 0,t != b) whenevert's phis allow it without creating conflicting incoming values or inflating multi-predecessor phi tables (!target_has_phi || total_edges <= 1).a -> balong unconditional branches, resolving single-input phis inb, updatingdef_block, and rewriting successor phis frombtoa(including loop backedges).CondBr/Switchcollapse, loop-latch merge with header-phi rewriting, and the multi-predecessor phi guard.Measured impact
XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1,XCL_DXIL_NO_OPT=mergevs default): 2,682 / 2,682 strictly smaller, 0 larger (775,076,910->774,508,202B).95cc13288a27a96e): basic blocks 23,619 -> 20,506 (-13.2%, -3,113 blocks), IR lines 513,461 -> 504,122 (-9,339 lines), DXIL 3,345,980 -> 3,332,628 B (-0.40%).Tested
cargo test -p xcl --lib gpu::dxil -- --skip fuzz_validate_and_gpu: 123 passed, 0 failed, 3 ignored (including all 5 newopt::tests::simplify_cfg_*tests and GPU execution tests on RTX 3060 Ti).xcl shaders <pack> --direct --validate --sample 1000 --max-bytes 0 --split 1withXCL_HEAP_WINDOWS=1: 1,000 / 1,000 (100.0%) across CS (102), GS (18), MS (350), PS (440), VS (90) — 0 validator errors, 0 panics, 0 timeouts.Not tested
Regression run
Base (
main):PR (
e64bd17):AI use