Recompiler: eliminate BTree/Vec allocations and skip dominator pass on acyclic CFGs in direct DXIL cfg #2642
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2642
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@Decodere on GitHub · 2026-11-26 04:49 UTC · original
Decodere:fix-dxil-cfg-zero-alloc-and-dag-fastpath→main· +147 −31 · 1 files · 1 commits · openWhat 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.
@DarkPanda69 on GitHub · 2026-11-26 05:07 UTC · original
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.
@sage-sage on GitHub · 2026-11-26 05:18 UTC · original
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.
@luckyteagirl on GitHub · 2026-11-26 05:28 UTC · original
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.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.