Recompiler: eliminate BTree/Vec allocations and skip dominator pass on acyclic CFGs in direct DXIL cfg #2632
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2642"
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 Decodere on 2026-11-26T04:49:10Z.
What is in it
Eliminates redundant
BTreeMap/BTreeSet/Vecheap allocations and skips the dominator pass on acyclic CFGs during direct DXIL CFG construction (crates/xcl/src/gpu/dxil/cfg.rs):BTreeMap/BTreeSettables inCfg::build_with: Replacedindex: BTreeMap<u64, usize>withinsts.binary_search_by_key(&pc, |d| d.pc)over monotonically decoded instruction PCs, replacedleaders: BTreeSet<usize>andblock_of: BTreeMap<usize, usize>with flatis_leader: Vec<bool>,starts: Vec<usize>, andblock_of: Vec<usize>(with empty-input andi + 1 < is_leader.len()bounds guards), removed the unusedreach: BTreeSet<usize>, and pre-sizedblocks, per-blocklist,post, andorder's DFSstack.Succs): Replacedsucc_of(&CfgBlock) -> Vec<usize>with aCopystack-allocatedSuccs { buf: [usize; 2], len: usize }(as_slice()+IntoIterator) and borrowed&preds[x]instead ofpreds[x].clone()inmake_reducible_inner'sreachclosure.make_reducible_innerreturning(post, headers, dom_passes)and short-circuitedif headers.is_empty() { return Ok((post, headers, dom_passes)); }before callingirreducible_edge, avoidingpos/preds/idomallocation and Cooper–Harvey–Kennedy dominator iteration on DAG shaders where DFS found no back edges.Part of #2508
Part of #1833
Tested
make_reducible_innersemantics (cargo test --release -p xcl --lib "gpu::dxil::cfg::tests::" -- --test-threads=1 --nocapture):1 passed; 1 failed; 0 ignored—acyclic_cfg_skips_dominator_pass_and_matches_rpo_and_predsfailed withleft: 1, right: 0(irreducible_edgeran on an acyclic diamond DAG).XCL_ADAPTER=warp,XCL_WARP=1,cargo test --release -p xcl --lib "gpu::dxil::cfg::tests::" -- --test-threads=1 --nocapture):4 passed; 0 failed; 0 ignored; 0 skipped(0.00s; zero warnings incfg.rs).cargo test --release -p xcl --lib "gpu::dxil::" -- --test-threads=1 --nocapture):187 passed; 0 failed; 3 ignored(9.05s,gpu::dxil::cfg::tests::4/0/0,0skipped;1pre-existingSKIPPED:gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole: no wave64).Regression run
Full release workspace on RTX 4060 (
cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture):37test binaries,1438 passed; 0 failed; 47 ignored,29pre-existing environment-gatedSKIPPEDlines:21skipped:no wave64(RTX 4060 is wave32)3skipped: wave32per-lane form: refusedby driver (f16 arithmetic,f16 packed,f32 conversions)3skipped: no D3D12 debug layer (d3d12SDKLayers.dllunavailable on host: debug-layerdred: false/trueanduploads_start_from_each_subresources_state)1skipped:pso_measurement_compiles_an_exact_synthetic_record(cannot disable driver cache on Windows)1skipped:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)Paired 60 s RTX 4060 smoke capture (
scripts/smoke.ps1):Base (
origin/mainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7):PR (
742116a9338ffd6c53819dabc636710576a0f74e):Not tested
29host-gated workspace tests skipped on this RTX 4060 machine (wave64 hardware, wave32 per-lane driver support, D3D12 SDK debug layer, driver cache disable, and heap windows).AI use
Google Antigravity (Gemini 4 Neon) wrote the patch, unit tests, and PR description; all commands, test runs, and paired 60 s GPU smoke captures were executed directly in this workspace.
Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-26T05:07:31Z.
Native wave64 run (the wave64 tests skipped on the RTX 4060) on an AMD RX 9070 XT, plus an RTX 3060: the 3 new tests pass, and nothing else changes in the direct-DXIL GPU suite.
Head
742116aapplied onmainb49be18, debug, Windows 11 Pro 26200,XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu:: --test-threads=4onmainand with the PR, card chosen withXCL_ADAPTER:mainOn both cards, the only result changes against
mainare the newacyclic_cfg_skips_dominator_pass_and_matches_rpo_and_preds,empty_reducible_loop_irreducible_and_geometry_cfgs_matchandsucc_of_is_copy_and_covers_all_terminators, all ok, with no new skips. The wave64 GPU tests that skip on a 32-lane card ran with this PR's CFG code on the RX 9070 XT and still pass. The 2 RX 9070 XT failures are the AMD fuzz seeds tracked in #2115, the same onmain.Not tested: translation timings, the D3D12 debug-layer tests (no
d3d12SDKLayers.dllhere either), a title.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 sage-sage on 2026-11-26T05:18:05Z.
Test report: passes on NVIDIA. Exact head
742116a9(its base is currentmainb49be18, so head = merged).Tested
cargo test --workspace -- --test-threads=4: 1438 passed, 0 failed, 47 ignored; the three newcfgtests pass, and so do the GPU recompiler tests that run on wave32mainon this machine): 21 wave64 tests (NVIDIA is wave32 only), 3 per-lane wave32 f16/f32 forms (refused), 3 D3D12 debug layer (d3d12SDKLayers.dllnot installed), 1no heap windows, 1pso_measurement_compiles_an_exact_synthetic_record(Developer Mode off)Not tested
Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T05:28:09Z.
I ran the exact head
742116a9on this RX 6800M setup withXCL_ADAPTER=6800M,XCL_REQUIRE_GPU=wave64, and direct DXIL enabled. The four CFG unit tests and two focused compact-form GPU tests passed with no explicit skips. The full commands, hardware details, counts, and limits are in issue #42.Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T06:54:04Z.
merge-check
base:
e429936c10head:
742116a933merge: clean, but empty: the merged tree is identical to the current base
build: not run; the merge introduces no code
tests: not run; the merge introduces no code
review: The PR changes only
crates/xcl/src/gpu/dxil/cfg.rs. Currentmainalready has that exact file (blob4f114cb15ea9f92ea15880ae6cd2d939286f977f) from commit2ab6f24f, which has the same change and title. I verified the file blob at both this PR head and currentmain, then made a no-commit merge into the base;git diff origin/mainwas empty.performance: no new cost or saving from merging this PR; its implementation is already on
main.verdict: not yet: this is a fully integrated duplicate and should leave the merge queue rather than be merged or retested.
hardware / tool and model: Windows 11; Codex (GPT-6.2 Sol) inspected the exact Git trees and merge. No GPU test was run for this empty merge.
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T07:07:16Z.
merge-check claim
head:
742116a933Imported from ivall/xcl. Originally posted by throny on 2026-11-28T07:18:12Z.
merge-check
base:
e429936chead:
742116a933merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2126 passed, 9 failed, 48 ignored: exactly the base's result, because the merge changes nothing (26 SKIPPED lines). The 9 failures are main's own at
e429936con this GPU (reported on #3041: they arrive with the merge of #2959); base alone: 2126 passed, 9 failed, 48 ignored.review: the whole change is already on main: commit
2ab6f24f(an ancestor ofe429936c, with nearly the same subject) contains it, tests included, and this PR's diff reverses cleanly on main's files. Nothing left to merge.performance: nothing to add on main.
verdict: not yet: nothing to merge; already in main through
2ab6f24f, so this PR can be closed.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).
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:32:30Z.
Triage (#1607) – head
742116aThe same change is already on main: commit
2ab6f24f(same title, "Recompiler: eliminate BTree/Vec allocations and skip dominator pass on acyclic CFGs in direct DXIL cfg") has a diff ofgpu/dxil/cfg.rsidentical to this PR's commit742116a.Nothing in this PR is left to merge.
Recommendation: close (superseded by main commit
2ab6f24f).AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:56:32Z.
Closing as superseded: this change is already on
main(2ab6f24f).2ab6f24fdiff of gpu/dxil/cfg.rs has the identical 165 added/removed lines as the PR (sorted line sets equal)Two independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed