Recompiler: speed up DXIL value numbering, CFG walks, and hoisting #3646
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3646"
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 Kalmarv on 2026-12-02T03:22:40Z.
Cut CPU overhead and heap allocations in the direct-DXIL optimizer and frontend without changing emitted DXIL.
What is in it
crates/xcl/src/gpu/dxil/module/opt.rs,ssa.rs: replace the scopedHashMap<(Op, Ty), Value>+ undo log inModule::optimizewith a compact open-chainingCseTablethat hashes operands a word at a time (WordHasher) and checks collisions againstModule::instsdirectly, plus unit testcse_scope_restores_the_previous_bucket_head. Pre-filterhoist_entry_readnoneby eligible function declarations before cloning operand vectors and exit early when no call repeats.crates/xcl/src/gpu/dxil/module.rs,module/opt.rs,module/split.rs: reuse a caller-provided scratchVec<Block>(successors_in) across DXIL CFG walks (idoms,branch_facts,optimize,simplify_cfg,merge_blocks, andmodule/split.rs'sdispatch_plan), keep theModule::successorshelper available in non-test builds (#[allow(dead_code)]) for callers such as #3707's inliner, and flattenblock_layout's DFS stack to a single shared edge buffer, plus unit testblock_layout_orders_shared_targets_and_back_edges_once.crates/xcl/src/gpu/dxil/kernel.rs: scanmax_vgprinLw::new_with_slotonly when relative vector indexing (V_MOVREL*/V_SWAPREL_B32) is present.(Dropped from earlier iterations so this PR stays focused, under 400 changed lines, and byte-identical in emitted DXIL: the output-changing unsigned endpoint folds, the optimizer iteration stop-rule change, and the
graphics.rs/shader.rscompute_depsrewrite.)Tested
rustc 1.99.0 (b940084d7 2026-09-28), DXC1.9.2609.5, debug tests + release build (cargo build --release -p xcl: 39 warnings, 0 new vsorigin/main078358a05baseline of 39).scripts/test.ps1(workspace build,cargo bench -p xcl --bench '*' -- --test,cargo test --workspace -- --test-threads=4): 3008 passed, 0 failed, 52 ignored across 44 targets; 24 SKIPPED GPU tests (22no wave64, 2no heap windows).912ff558e) on5ad98adbc(prior to #3652 landing inmain) +5f7f461fb: clean merge/cherry-pick,cargo check --workspacepassed with 0 errors and 39 warnings (0 new).817eb1fc9vs7204890cd, median of 15 release runs after warmup;5f7f461fbonly changes#[cfg(test)]->#[allow(dead_code)]onModule::successors):long_kernel_4001(4001 insts, split wave64 kernel):12.255 ms -> 9.327 ms(-23.9%/1.31x), DXIL byte-identical (len=45592, fnv64=83f0b01e01716edf).long_pixel_3000(3000 insts, native wave64 PS):16.022 ms -> 13.713 ms(-14.4%/1.17x), DXIL byte-identical (len=48508, fnv64=a68b9a980b615e50).branchy_cs_200blks(200-block diamond CFG, split wave64 CS):4.614 ms -> 4.365 ms(-5.4%/1.06x), DXIL byte-identical (len=2556, fnv64=5536dd441525dd7d).Regression run
main:
PR:
Not tested
22 SKIPPED), heap-window GPU tests (2 SKIPPED), Wine/Linux, in-world title gameplay beyond the 60 s smoke, and game-data sample tests (XCL_SAMPLE_*unset).AI use
GPT-6) wrote the original optimizer speed-up patches (CseTable,WordHasher,hoist_entry_readnonepre-filtering,successors_in/block_layout, andmax_vgprfast-path) and unit tests.Gemini 4 Neon) rebased ontoorigin/main(078358a05), keptModule::successorsnon-test (#[allow(dead_code)]) for #3707 compatibility, verified the combined5ad98adbc + #3707 + 5f7f461fbcheck, ranscripts/test.ps1and the paired 60 s smokes, validated withscripts/pr_check.py --local, and updated this PR description.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T08:59:35Z.
Review (head
e3defbb0, diff read, not a merge-check):crates/xcl/src/gpu/dxil/module.rs ~1201makessuccessors()#[cfg(test)]. #3655 adds a non-test callself.successors(b)inmodule/split.rs(~812 in the merged tree). Git merges the two cleanly, butcargo buildof the merged tree fails with "no methodsuccessors". Whichever PR lands second has to switch tosuccessors_in. There are also textual conflicts: with #3654 inshader.rsuses_fmad(~655, both rewrite the same lines), and with #3645 and #3654 at the test insertion point inmodule.rs.module/opt.rs ~500adds new folds (x <u 0,x <=u MAX, …) that change the emitted DXIL. They also forced an edit to an existing test (lower_geom.rs ~310, an LDS store added so the loop stays live). By reading, the folds are correct:const_u64masks constants to the operand width. Still, this is a separate logical change from the speed-ups and should be its own PR, so it can be bisected and reviewed on its own.opt.rs ~1379(iter_changed |= iter == 0 || late_phi): after the first iteration, CSE or simplify replacements alone no longer start another pass.~1471and~1488now start one for select folds and flat-read rewrites, which main did not. So output is not identical to main by construction. One example: a CSE in iteration 2 that makes the arguments of two sibling-block calls equal no longer reacheshoist_entry_readnone. The claim of byte-identical output on 329 shaders comes from an offline sweep. No test in the PR compares old and new output, for this or for the rewrittencompute_deps(graphics.rs ~757-855, which relies only on the existing dependency tests).Fine (by reading):
CseTablecompares the full(op, ty)against the stored definition on every bucket hit. That definition is not modified later in the walk, andrewindrestores bucket heads in LIFO order, so collisions cannot merge different values. The random seed only affects bucket placement, not output. The newblock_layoutDFS gives the same post-order as the old one. Thecompute_depsreachability walk covers the same data and control edges as the old fixed point. Themax_vgprscan is only read bymovrel/swaprel(lower_wide.rs ~286). The hoist eligibility precheck and theWordHashergeneralisation do not change results.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by vasanex on 2026-12-02T10:08:18Z.
merge-check
base:
1c8b551475head:
e3defbb0e7merge: clean (
git diff --checkclean)build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2913 passed, 0 failed, 51 ignored; SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 cannot disable the driver cache), the same tests as on the base (2909 passed there); failing: none. The four new tests ran and passed (
block_layout_orders_shared_targets_and_back_edges_once,unsigned_comparisons_fold_at_the_operand_width_limits,cse_scope_restores_the_previous_bucket_head,late_phi_folds_propagate_through_successive_diamonds), and so didcompute_movrel_uses_program_max_vgpr_and_masks_m0and the editedsplit_epilogue_clamps_lds_to_lds_top_and_validates.review: whole diff read (8 files, +369/-267). No correctness finding. By reading: the new
block_layoutwalk gives the same order as the old one (marking on entry with the smallest block popped first is the same depth-first walk);compute_depsfollows the same edges as before (store value and its second operand, the storing block, controlling blocks and their conditions, phi sources with their blocks, every write to a load's root), now as one reachability walk per output;CseTablecompares against the instruction as stored in the module, which is the key it was entered with, since the walk writes each op back unchanged after the lookup; the new unsigned folds are right for widths up to 32;max_vgpris read only by the relative-move lowering, so leaving it 0 without such an instruction changes nothing. Two points that are not defects of this tree, both already in the review above: the emitted DXIL is not identical to main's by construction (new folds; CSE replacements after the first iteration no longer start another optimizer pass on their own), and nothing in the PR compares old and new output; andsuccessors()becoming test-only breaks the build if #3655 lands unchanged next to it, so whichever is second needs a rebase. The wave64 paths did not run here (wave32 card).performance: compile-time only by design. Not measured here: translation time, which is the PR's claim. 60 s smoke, release, same title and settings: base 1608 frames, peak commit 19911 MB; merged tree 1699 frames, 18350 MB (92 %), presents 61 60 60, 0 device removals, 0 crashes. The frame and memory deltas are within what other merges on this base gave the same night, so I do not read them as an effect of the PR.
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 3080 10 GB (driver 621.40), AMD Ryzen 9 7950X, Windows 11 Pro 26200, rustc 1.100.0 / Claude Code with Claude Fable 5.2. Run and posted without a human check of each point.
Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T11:01:55Z.
merge-check
base:
1c8b551475head:
e3defbb0e7merge: clean (fast-forward onto base, commit
e3defbb0e7, git diff --check clean)build: cargo build --workspace ok; cargo build --release -p xcl ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture (43 targets): 2913 passed, 0 failed, 51 ignored (+4 new tests vs main baseline). Targeted new and touched tests all passed with 0 skips: gpu::dxil::module::tests::block_layout_orders_shared_targets_and_back_edges_once, gpu::dxil::module::opt::tests::unsigned_comparisons_fold_at_the_operand_width_limits, gpu::dxil::module::opt::tests::cse_scope_restores_the_previous_bucket_head, gpu::dxil::module::opt::tests::late_phi_folds_propagate_through_successive_diamonds, gpu::dxil::core_tests::compute_movrel_uses_program_max_vgpr_and_masks_m0, and gpu::dxil::lower_geom::tests::split_epilogue_clamps_lds_to_lds_top_and_validates. 28 SKIPPED lines (host environment only: 22 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 2 no heap windows, 1 cannot disable the driver cache (Windows Developer Mode required)).
review: Read the full merged diff (+369/-267 across 8 files in crates/xcl/src/gpu/dxil/). Replaces recursive multi-pass
compute_depsingraphics.rswith an iterative backward DFS per output seed (usingOpdirectly and deduplicating per-root store walks); gatesmax_vgprscan inkernel.rsonV_MOVREL*/V_SWAPREL_B32(confirmed the onlytop_vgprcallers); reuses scratch buffers viasuccessors_inand iterativeStep::Enter/LeaveRPO inmodule.rs; replacesHashMap<(Op, Ty), Value>+ undo cloning inmodule/opt.rswith a scoped open-chainedCseTableusingWordHasherandrewind; folds unsigned<= max/>= 0/< 0/> maxcomparisons for widths<= 32; tracksiter_changedaccurately acrossiter == 0 || late_phi,fold_guarded_selects, andflat_reads; and pre-filters eligibleReadNonedeclarations inhoist_entry_readnone. Non-blocking merge-order notes: wave64 paths did not run on this wave32 card, translation-time speedup was not separately benchmarked,graphics.rs::compute_depsoverlaps #1852, and makingModule::successors#[cfg(test)]conflicts with #3655 if both merge without rebase. No correctness defects, scope creep, or UB on base1c8b5514.performance: 60 s retail smoke (title: 29640639, runtime non-regression): 1627 frames (+11.3% vs
1c8b5514baseline 1462 frames), 15153 MB peak commit (-5.5% vs 16043 MB baseline), 0 device removals, 0 crashes.verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T11:44:56Z.
merge-check
base:
1c8b551475head:
e3defbb0e7merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2913 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read by one reviewer at this same head; the review is at https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7340211231 and its findings stand. Most serious: makes
successors()test-only while #3655 calls it, so the two together don't build.performance: 60 s smoke of a retail title, main
1c8b5514vs this merge (e3defbb0): 1652 -> 1461 frames shown (88 %; last presents per 2 s: 60 60 60), peak commit 18228 -> 15701 MB, 0 device removals, 0 crashes. This run is lower than most today: the PC was in use at the time (a browser and Discord running), and main's own runs on this machine today ranged from 1370 to 1652 frames, so the difference isn't clearly from this PR.verdict: safe to merge as code (no blocking finding, the suite passes, no crash), but both of its smoke runs here came in lower than main (1427 and 1461 frames vs 1652), and since it changes how fast DXIL is optimized, a startup cost isn't ruled out; a run on an idle machine would settle it
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T14:18:35Z.
Thanks @Foniass, @vasanex, and @Decodere for the reviews and merge-checks!
Rebased onto
main(5eaadb54c, including merged#3655) and updated as4dc1389b5:#3655build break: switchedmodule/split.rs's uniform-cut walk fromself.successors(b)toself.successors_in(b, &mut successors)soModule::successors()remains test-only and the rebased tree builds cleanly (39warnings, 0 new vsmain).Codex (GPT-6)+Antigravity (Gemini 4 Neon)).scripts/test.ps1passes (2978 passed, 0 failed, 52 ignored, 24 hardware skips on RTX 5070 Ti), and an idle warm-cache 60 s smoke pair againstmain5eaadb54cshows1687vs1698frames (61 60 60vs60 61 60presents per 2 s,16151vs15798MB peak commit, 0 device removals, 0 crashes). (Editinggpu/dxil/*bustsXCL_DIRECT_DXIL_SOURCE_IDon the very first cold run — 1357 frames / first present at 14 s vs 4 s — which matches the lower cold-run frames seen earlier.)AI use: Antigravity (
Gemini 4 Neon) performed the rebase, fixedmodule/split.rs, ranscripts/test.ps1and the idle smoke pair, and drafted this comment.Imported from ivall/xcl. Originally posted by vasanex on 2026-12-02T15:22:47Z.
merge-check
base:
5eaadb54c1head:
4dc1389b58merge: clean (the head is based on this base;
git diff --checkclean)build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2978 passed, 0 failed, 52 ignored; SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 cannot disable the driver cache), the same tests as on the base (2974 passed there); failing: none.
review: this replaces my check of
e3defbb0. Against that head the diff differs in one hunk: the callself.successors(b)that #3655 added inmodule/split.rsnow usessuccessors_inwith the function's scratch vector, which was the build break the first review named; the tree builds with #3655 in it. The rest is line for line what I read ate3defbb0, and what I wrote there stands: no correctness finding; the emitted DXIL is not identical to main's by construction (new unsigned folds, and CSE replacements after the first iteration no longer start another optimizer pass on their own), with no test that compares old and new output. The wave64 paths did not run here (wave32 card).performance: compile-time only by design; translation time, the PR's claim, is not measured here. 60 s smoke, release, same title and settings: base 1697 frames, peak commit 17749 MB; merged tree 1701 frames, 17860 MB (101 %), presents 61 60 60, 0 device removals, 0 crashes.
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 3080 10 GB (driver 621.40), AMD Ryzen 9 7950X, Windows 11 Pro 26200, rustc 1.100.0 / Claude Code with Claude Fable 5.2. Run and posted without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T18:01:36Z.
merge-check
base:
5eaadb54c1head:
4dc1389b58merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2978 passed, 0 failed, 52 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: follow-up on
4dc1389b(reworked and rebased frome3defbb0, my last review's head). The code is the same ase3defbb0: the range-diff shows only a reworded commit message (no longer "without changing semantics") and the rebase onto5eaadb54, which already has the merged #3655, whoseself.successors(b)call in the uniform-cut walk (module/split.rs~812) now callssuccessors_in, as do the other two sites indispatch_plan(~751, ~849). The description now says the emitted DXIL isn't byte-identical to main, marks the per-pass timings as offline background not measured on this tree, and adds a warm-cache NVIDIA smoke pair. Earlier findings: (1) build break with #3655: fixed; no non-testsuccessors(caller is left, and neither #3654 nor #3645 adds one (this PR adds one more textual conflict with #3654 inshader.rsuses_fmad, ~655). (2) output-changing unsigned endpoint folds inside a speed-up commit: partly fixed; the description and commit message say what the folds do and they have a unit test (opt.rs~503, test ~2043), but they're still in the same commit as the speed-ups, with thelower_geom.rs~310 test edit. (3) the stop rule changing in both directions: partly fixed; the description states it, the code is unchanged (opt.rs~1379, ~1471, ~1488 / ~1492), andlate_phi_folds_propagate_through_successive_diamonds(~2596) also passes on main, so it guards one case only; there's still no old-vs-new output comparison on main for the stop rule or the rewrittencompute_deps(graphics.rs~754-855). (4) timings not measured on this tree: partly fixed; the smoke-delta claim is gone and the sweep is labelled background, but the PR exists to cut compile time and has no compile-time comparison of main against this head. New: none in the code. Still one commit of +370/-268 (about 640 lines, over the ~400 target) bundling at least five changes (the CSE table, the endpoint folds, the stop rule, thecompute_depsrewrite,block_layout/max_vgpr), so a DXIL change in any title would bisect to all of them at once; the folds and the stop rule change the emitted DXIL, and with itXCL_DIRECT_DXIL_SOURCE_ID, for every title by default, checked only on one NVIDIA wave32 adapter. Fine: the newsuccessors_inuses keep the borrow local to each loop iteration and the same edge order, Switch duplicates included.performance: 60 s smoke of a retail title, main
5eaadb54vs this merge (4dc1389b): 1422 -> 1430 frames shown (100 %; last presents per 2 s: 60 60 61), peak commit 17184 -> 15630 MB, 0 device removals, 0 crashes. This run is lower than most today: the PC was in use at the time (a browser and Discord running), and main's own runs on this machine today ranged from 1370 to 1652 frames, so the difference isn't clearly from this PR.verdict: not yet: the output-changing unsigned folds and the optimizer stop-rule change are still bundled with the speed-ups in one ~640-line commit, with no output comparison against main (see the review)
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T18:08:35Z.
Review: COMMENTED
Review of
4dc1389b: 1 finding(s) (1 medium), most severe first.crates/xcl/src/gpu/dxil/graphics.rs:763: Not certain about this one:seen_valuesis sized from the largest instruction index found in a block (value_count), but it's indexed with anyValue::Instreached through operands, phi incomings, branch conditions and store operands.... (inline)These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T18:08:36Z.
Code review location:
crates/xcl/src/gpu/dxil/graphics.rs; line 763Medium: Not certain about this one:
seen_valuesis sized from the largest instruction index found in a block (value_count), but it's indexed with anyValue::Instreached through operands, phi incomings, branch conditions and store operands, so an operand naming an instruction outside every block (or above the highest in-block index) panics out of bounds during signature tracing. That can happen with IR thatoptimizereturned early on as malformed and left for the writer to report; the old recursive version handled any index through a HashMap. Sizingseen_valuesby the module's instruction count (or bounds-checking) would turn this back into a normal error path.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T18:08:37Z.
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
Imported from ivall/xcl. Originally posted by stijn-boer on 2026-12-02T18:08:37Z.
merge-check
base:
817eb1fc9fhead:
4dc1389b58verdict: not yet: all 12 focused checks passed and the workspace and smoke interruptions reproduced on main. The independent same-head suite and startup smoke passed. This optimizer change still lacked a translation-time comparison on this head.
Windows / AMD RDNA4 (native D3D12) — DXIL optimizer and shader-output checks on
4dc1389Clean merge onto
mainat817eb1f(merge commitbb460baf02c4d403d48b514388dd9516026e73af).git diff --checkwas clean.Setup
d3d12SDKLayers.dll, DXC 1.9.2609.5Tested
cargo build --workspacepassed.cargo test --workspace --no-fail-fast -- --test-threads=4 --show-outputexited 101 on both builds. The baseline table row is from a prior run of the same commit, machine, SDK, and command.SKIPPEDnoticesmainCounts are partial because two test processes aborted on each build.
main— none observed in the comparable results. Two fewer passing status lines appeared before the aborts on the merge.--test-threads=1 --show-output --nocapture. This covered the four added optimizer tests, loop dispatch, geometry records, VS/PS and mesh draws, primitive attributes, phi inputs, and signature-dependency checks against expected results.uploads_start_from_each_subresources_statepassed.Shared failures and process aborts
fuzz_validate_and_gpu_1,fuzz_validate_and_gpu_3, andtwo_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobsreported failures on both builds.gpu_compute_e2etest processes exited with0xc0000409on both builds.Retail smoke
Ran
scripts/smoke.ps1 -Game <local folder> -Seconds 60 -Xcl <debug binary>withXCL_UMA_DRIVER=mixedfor title hash2c508222.main0xc00004090xc00004090xc0000409The first run's higher startup commit did not reproduce. These exits leave frame and steady-state memory behavior unverified.
Diff review
Focused inspection covered scoped CSE and its rewind behavior, phi simplification, and unsigned boundary folds. The targeted checks verified the selected shader outputs and dependencies against test expectations.
Not tested
Remaining workspace tests after the aborts, a broad base-versus-PR shader corpus comparison, compile-time performance, and retail performance.
AI use
Codex (GPT-6) merged and built the PR, ran the tests, compared the results with
main, reviewed the diff, and drafted this report.Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T18:21:30Z.
Thanks @Foniass, @bmjask, @stijn-boer, and @vasanex for the detailed follow-up reviews and merge-checks!
Rebased onto
origin/main(817eb1fc9) and trimmed PR #3646 down to7204890cd(5 files,+183/-92= 275 lines, well under the ~400-line guideline) containing only the pure, byte-for-byte DXIL-identical compile-time speed-ups:Dropped output-changing and bundled pieces (
@Foniass,@bmjask):opt.rs+lower_geom.rstest edit) and restoredmain's exact optimizer iteration stop rule (opt.rs).graphics.rs(compute_deps) andshader.rs(uses_fmad) rewrite — this eliminates@bmjask'sgraphics.rs:763(seen_values) finding and removes the textual conflict with#3654inshader.rs(those can be proposed separately if wanted).CseTable+WordHasher,hoist_entry_readnonepre-filtering,successors_in/ flatblock_layout(including#3655'ssplit.rsuniform-cut walk), and themax_vgprfast-path.Direct A/B compile-time & byte-for-byte DXIL identity measurement on this commit (
@Foniass,@stijn-boer):origin/main(817eb1fc9) vs7204890cdin--release(median of 15 runs after warmup, RTX 5070 Ti / Ryzen 9 9950X):long_kernel_4001(4001 insts, split wave64 kernel):12.255 ms -> 9.327 ms(-23.9%/1.31x), DXIL byte-identical (len=45592, fnv64=83f0b01e01716edf).long_pixel_3000(3000 insts, native wave64 PS):16.022 ms -> 13.713 ms(-14.4%/1.17x), DXIL byte-identical (len=48508, fnv64=a68b9a980b615e50).branchy_cs_200blks(200-block diamond CFG, split wave64 CS):4.614 ms -> 4.365 ms(-5.4%/1.06x), DXIL byte-identical (len=2556, fnv64=5536dd441525dd7d).Fresh verification on
7204890cd:cargo build --release -p xcl:39warnings (0new vs817eb1fc9).scripts/test.ps1:3006 passed, 0 failed, 52 ignoredacross 44 targets;24 SKIPPED(22 no wave64,2 no heap windows).title: ea3b5e4d):817eb1fc91610frames (14895 MB) vs7204890cd1681frames (60 60 61,16461 MB),0device removals,0crashes,exit: 0x0.python scripts/pr_check.py --local:description ok.Ready for re-review! (Updated and verified with Antigravity, Gemini 4 Neon.)
Imported from ivall/xcl. Originally posted by Lum7nt on 2026-12-02T22:05:57Z.
merge-check
base:
5ad98adbc3head:
7204890cdcmerge: clean
build: cargo build --workspace -> ok (39 warnings, 0 new vs base)
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture -> 2979 passed, 15 failed, 52 ignored; SKIPPED: 31 (22 no wave64, 2 no heap windows, 3 no D3D12 debug layer, 1 no reserved cube with mips, 1 no GPU_UPLOAD heaps, 1 cannot disable driver cache without Developer Mode, 1 driver could not export every fixture PSO); failing: 11 lib (
hle::d3d12x::real::passthrough_mesh_stream_accepts_a_triangle_driver_blob,shaders::pipeline_cap_tests::{a_stale_blob_the_driver_takes_is_made_with_one_create_and_replaced,split_compute_program_prebuilds_and_caches_chain_pieces,startup_preparation_builds_a_split_programs_whole_and_no_chain},shaders::pipeline_library::tests::*(6),shaders::warm_library::tests::cold_publish_makes_an_unchanged_corpus_reusable) + 4gpu_compute_e2e(a_preparation_worker_keeps_a_split_programs_abi_whole,split_compute_prefers_the_offline_whole_pipeline,offline_compute_pipeline_is_reused_by_a_second_process,offline_split_compute_pipeline_is_reused_by_a_second_process) — all 15 confirmed failing identically onorigin/main5ad98adbcon this machine (driver581.42returns0x8000FFFFonGetCachedBlob/StorePipeline, zero new failures).gpu::dxil::: 355 passed, 0 failed, 4 ignored (1 SKIPPEDno wave64), including both new unit tests (cse_scope_restores_the_previous_bucket_head,block_layout_orders_shared_targets_and_back_edges_once).title run: not run (Tier 1 recompiler change; no retail title on this machine)
review: Read the full merged diff (5 files, +183/-92:
kernel.rs,module.rs,module/opt.rs,module/split.rs,ssa.rs). No findings.CseTablechecks collisions against finalizedm.insts[other]afterstd::mem::replacerestoration and restores bucket heads in LIFO order onrewind;hoist_entry_readnonepre-filters byFuncDecleligibility before cloning operands;block_layoutStep::Enter/Leavewithseen[b]checked onEnterpreserves the exact DFS post-order while flattening edge storage viasuccessors_in;max_vgprscan is gated onV_MOVREL*/V_SWAPREL_B32. Note: wave64 GPU paths did not execute here (native wave32 RTX 3060).performance: Release (
--release) compile-time A/B on5ad98adbcvs merged#3646(i5-10400, 3 runs on PR):long_pixel_shader_translates_fast(3000 insts, native wave64 PS):44.06 ms->36.82 ms(37.48,36.77,36.82 ms;-16.4%, identical48508 BDXIL)long_programs_translate(4001 insts, split wave64 CS):32.49 ms->24.93 ms(24.93,24.57,25.03 ms;-23.3%)verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 3060 12 GB (driver 32.0.15.8142 / 581.42), Intel Core i5-10400, Windows 11 Build 22631, rustc 1.100.0 MSVC, DXC 1.8.2502.11 / OpenCode (
google/antigravity-gemini-4-hydrogen-low)Imported from ivall/xcl. Originally posted by stijn-boer on 2026-12-02T22:13:24Z.
merge-check
base:
5ad98adbc3head:
7204890cdcverdict: not yet: the combined build fails with E0599 when #3707's inliner calls a method that #3646 makes test-only.
Windows / AMD RDNA4 — #3646 redo with #3707 and #3455
The baseline was
main+ #3707 (912ff558e932264511f386eb8b7e97cbf7cf46e2) + #3455 (1895d9e8ea3c64f7e91f4a0211f2a7aacff5c525) atcfdacf961cf9cced7aba34f4f11e6219ce55df2d. The updated #3646 head merged cleanly onto it at02ccc832ce5a491cd7deae962772c8bf5d9751e1.git diff --checkpassed.Setup
AMD Radeon RX 9060 XT (32.0.32029.2010), Ryzen 7 5700X, Windows 10 21H2 build 19044.6332, Rust 1.100.0 debug, Agility 1.620.2, DXC 1.9.2609.5.
Tested
cargo build --workspacepassed on the same combined baseline in the prior #3613 retest. With #3646 added, a fresh Cargo target failed to build atcrates/xcl/src/gpu/dxil/module.rs:823withE0599: no method named successors found for mutable reference &mut Module.#3707 adds a production call to
self.successors(tail.0 as usize). #3646 introducessuccessors_inand places the oldsuccessorswrapper behind#[cfg(test)]. The textual merge succeeds and the production call is unresolved in the combined build.Not tested
Focused optimizer checks, the workspace suite, and retail smoke on the combined tree. The build error blocked these runs.
AI use
Codex (GPT-6) prepared the local merge, ran the build, traced the compile error, and drafted this report.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T22:34:40Z.
Thanks for catching that combined-tree build issue with #3707, @stijn-boer!
Updated #3646 to
5f7f461fb(rebased ontoorigin/main078358a05, which now includes #3652):#[cfg(test)]to#[allow(dead_code)]onModule::successors(crates/xcl/src/gpu/dxil/module.rs:1421) so non-test callers like #3707's inliner resolve it cleanly without introducing any warning standalone (39release warnings vs39on078358a05).5ad98adbc + #3707 (912ff558e) + 5f7f461fb:cargo check --workspacepasses with 0 errors and 39 warnings (0 new).5f7f461fb:scripts/test.ps1: 44 targets, 3008 passed, 0 failed, 52 ignored, 24 SKIPPED (22 no wave64, 2 no heap windows).title: ea3b5e4d, RTX 5070 Ti):078358a051689frames (16405 MB,60 60 60) vs5f7f461fb1681frames (16435 MB,60 60 60),0device removals,0crashes,exit: 0x0.python scripts/pr_check.py --local:description ok.Ready for re-check! (Updated and verified with Antigravity, Gemini 4 Neon.)
Imported from ivall/xcl. Originally posted by jsalzy on 2026-12-02T23:34:19Z.
merge-check claim
head:
5f7f461fbdImported from ivall/xcl. Originally posted by jsalzy on 2026-12-02T23:44:25Z.
merge-check
base:
078358ahead:
5f7f461merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3008 passed, 0 failed, 52 ignored; SKIPPED: 25 (22 no wave64 on this GPU; 2 no heap windows (opt-in XCL_HEAP_WINDOWS=1); 1 driver cache cannot be disabled without Windows Developer Mode); failing: none
title run: not run
review: whole diff read (opt.rs +105/-46, module.rs +54/-27, ssa.rs +12/-7, kernel.rs +8/-9, split.rs +4/-3). No defect found. CseTable checks every bucket hit against the instruction itself (same op and type), and rewind restores bucket heads in reverse order, so the scoped value numbering keeps the old map-plus-undo-log behaviour; the random seed only changes bucket placement, not which earlier instruction wins. block_layout's new Enter/Leave walk visits blocks in the same order (smallest first, marked on entry) and no longer indexes seen[0] in an empty function. max_vgpr is now 0 without V_MOVREL*/V_SWAPREL_B32; its only reader is the movrel lowering (top_vgpr), and compute_movrel_uses_program_max_vgpr_and_masks_m0 still passes. hoist_entry_readnone's per-declaration filter and early exit keep the same eligibility rules. Both new tests ran and passed (cse_scope_restores_the_previous_bucket_head, block_layout_orders_shared_targets_and_back_edges_once). No new compiler warnings. Not checked here: the description's claim of byte-identical DXIL across real shaders. No duplicate: no other open or merged PR adds this table or the scratch successor walk; #3645, #3654, #3656, #3659 and #3664 also edit module/opt.rs and may conflict with it.
performance: compile time only (the optimizer's CPU work per shader); nothing changes at run time by default. Not measured.
verdict: safe to merge
hardware / tool and model: RTX 4070 SUPER 12 GB (621.24 / 32.0.16.2124), Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 25H2 26200.9974, Rust 1.100.0, debug / Claude app (Claude Opus 5.5): merge, build and suite run on this PC with git and cargo only; diff review by Claude Opus 5.5.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T04:12:51Z.
merge-check
base:
078358a058head:
5f7f461fbdmerge: clean
build: ok
tests: 3008 passed, 0 failed, 52 ignored; 28 skipped, the same as on main
review: 2 nits (below)
performance: 60 s smoke run: 1669 → 1667 frames (99 % of main), peak commit 17577 → 17775 MB, no device removal, no crash
title run: retail title on the RTX 5070 Ti (driver 621.14), into the world by scripted presses: 229 s there, 0 device removals, 0 crashes, 3.5 presents/s; run with
XCL_SKIP_CS=95cc13288a27a96e(the NVIDIA hang at the end of loading, #3541) and NVIDIA's 2048 MB shader heap (#2590)verdict: safe to merge: no blocking finding (the points below are medium or nits), the suite passes and the smoke run is clean
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
In short: Speeds up the direct-DXIL optimizer: a scoped CSE table with bucket chains instead of a HashMap plus undo log, a reused successor buffer for CFG walks, a flat-stack DFS in block_layout, a cheaper hoist pre-filter, and a max_vgpr scan only when movrel/swaprel is present. The folds that changed output, the stop-rule change and the compute_deps rewrite are gone, and by reading the remaining changes leave the emitted DXIL unchanged. Nothing blocks it.
Nit
817eb1fcagainst the PR's earlier commit7204890c; no test compares old and new DXIL. The existing disassembly tests cover much of it, so it is enough to say this in the description.Checked and fine
How this was tested
078358a0, thencargo build --workspaceandcargo test --workspace --no-fail-fast -- --test-threads=4.scripts/smoke.ps1: 60 s of a retail title on main078358a0and on this merge; presents per 2 s at the end: 60 61 60.XCL_RUN_SECONDS=300and scripted A presses counted from the first frame (XCL_PRESS_BASE=frame, #3712) into the world from an existing save; time in the world is counted from the first in-world draw call to the end of the run.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.