Recompiler: speed up DXIL value numbering, CFG walks, and hoisting #3646

Open
Kalmarv wants to merge 1 commit from upstream-pr/3646 into main
Kalmarv commented 2026-12-02 03:22:40 +00:00 (Migrated from github.com)

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 scoped HashMap<(Op, Ty), Value> + undo log in Module::optimize with a compact open-chaining CseTable that hashes operands a word at a time (WordHasher) and checks collisions against Module::insts directly, plus unit test cse_scope_restores_the_previous_bucket_head. Pre-filter hoist_entry_readnone by 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 scratch Vec<Block> (successors_in) across DXIL CFG walks (idoms, branch_facts, optimize, simplify_cfg, merge_blocks, and module/split.rs's dispatch_plan), keep the Module::successors helper available in non-test builds (#[allow(dead_code)]) for callers such as #3707's inliner, and flatten block_layout's DFS stack to a single shared edge buffer, plus unit test block_layout_orders_shared_targets_and_back_edges_once.
  • crates/xcl/src/gpu/dxil/kernel.rs: scan max_vgpr in Lw::new_with_slot only 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.rs compute_deps rewrite.)

Tested

  • hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce RTX 5070 Ti (driver 610.74), AMD Ryzen 9 9950X, Windows 11 Pro 26200, rustc 1.99.0 (b940084d7 2026-09-28), DXC 1.9.2609.5, debug tests + release build (cargo build --release -p xcl: 39 warnings, 0 new vs origin/main 078358a05 baseline 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 (22 no wave64, 2 no heap windows).
  • Combined compatibility check with #3707 (912ff558e) on 5ad98adbc (prior to #3652 landing in main) + 5f7f461fb: clean merge/cherry-pick, cargo check --workspace passed with 0 errors and 39 warnings (0 new).
  • Release A/B compile-time and DXIL byte-identity check (measured on 817eb1fc9 vs 7204890cd, median of 15 release runs after warmup; 5f7f461fb only changes #[cfg(test)] -> #[allow(dead_code)] on Module::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:

xcl-smoke v1
commit: 078358a058f7ba5d16690dba8dc4e55d2c88ae0a
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1689 (PresentX 1689)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16405 MB

PR:

xcl-smoke v1
commit: 5f7f461fbd2eb0428dff962c0417a37c47ca3b1e
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1681 (PresentX 1681)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16435 MB

Not tested

  • AMD / Intel GPUs, native wave64 GPU tests (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

  • Codex (GPT-6) wrote the original optimizer speed-up patches (CseTable, WordHasher, hoist_entry_readnone pre-filtering, successors_in / block_layout, and max_vgpr fast-path) and unit tests.
  • Antigravity (Gemini 4 Neon) rebased onto origin/main (078358a05), kept Module::successors non-test (#[allow(dead_code)]) for #3707 compatibility, verified the combined 5ad98adbc + #3707 + 5f7f461fb check, ran scripts/test.ps1 and the paired 60 s smokes, validated with scripts/pr_check.py --local, and updated this PR description.
<!-- greyfinch-sync:ivall/xcl:issue:5599183699 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646). Originally posted by [Kalmarv](https://github.com/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 scoped `HashMap<(Op, Ty), Value>` + undo log in `Module::optimize` with a compact open-chaining `CseTable` that hashes operands a word at a time (`WordHasher`) and checks collisions against `Module::insts` directly, plus unit test `cse_scope_restores_the_previous_bucket_head`. Pre-filter `hoist_entry_readnone` by 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 scratch `Vec<Block>` (`successors_in`) across DXIL CFG walks (`idoms`, `branch_facts`, `optimize`, `simplify_cfg`, `merge_blocks`, and `module/split.rs`'s `dispatch_plan`), keep the `Module::successors` helper available in non-test builds (`#[allow(dead_code)]`) for callers such as #3707's inliner, and flatten `block_layout`'s DFS stack to a single shared edge buffer, plus unit test `block_layout_orders_shared_targets_and_back_edges_once`. - `crates/xcl/src/gpu/dxil/kernel.rs`: scan `max_vgpr` in `Lw::new_with_slot` only 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.rs` `compute_deps` rewrite.) **Tested** - hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce RTX 5070 Ti (driver 610.74), AMD Ryzen 9 9950X, Windows 11 Pro 26200, `rustc 1.99.0 (b940084d7 2026-09-28)`, DXC `1.9.2609.5`, debug tests + release build (`cargo build --release -p xcl`: 39 warnings, 0 new vs `origin/main` `078358a05` baseline 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 (22 `no wave64`, 2 `no heap windows`). - Combined compatibility check with #3707 (`912ff558e`) on `5ad98adbc` (prior to #3652 landing in `main`) + `5f7f461fb`: clean merge/cherry-pick, `cargo check --workspace` passed with 0 errors and 39 warnings (0 new). - Release A/B compile-time and DXIL byte-identity check (measured on `817eb1fc9` vs `7204890cd`, median of 15 release runs after warmup; `5f7f461fb` only changes `#[cfg(test)]` -> `#[allow(dead_code)]` on `Module::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: ``` xcl-smoke v1 commit: 078358a058f7ba5d16690dba8dc4e55d2c88ae0a gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1689 (PresentX 1689) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16405 MB ``` PR: ``` xcl-smoke v1 commit: 5f7f461fbd2eb0428dff962c0417a37c47ca3b1e gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1681 (PresentX 1681) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16435 MB ``` **Not tested** - AMD / Intel GPUs, native wave64 GPU tests (`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** - Codex (`GPT-6`) wrote the original optimizer speed-up patches (`CseTable`, `WordHasher`, `hoist_entry_readnone` pre-filtering, `successors_in` / `block_layout`, and `max_vgpr` fast-path) and unit tests. - Antigravity (`Gemini 4 Neon`) rebased onto `origin/main` (`078358a05`), kept `Module::successors` non-test (`#[allow(dead_code)]`) for #3707 compatibility, verified the combined `5ad98adbc + #3707 + 5f7f461fb` check, ran `scripts/test.ps1` and the paired 60 s smokes, validated with `scripts/pr_check.py --local`, and updated this PR description.
Foniass commented 2026-12-02 08:59:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T08:59:35Z.


Review (head e3defbb0, diff read, not a merge-check):

  • Breaks the build together with #3655. crates/xcl/src/gpu/dxil/module.rs ~1201 makes successors() #[cfg(test)]. #3655 adds a non-test call self.successors(b) in module/split.rs (~812 in the merged tree). Git merges the two cleanly, but cargo build of the merged tree fails with "no method successors". Whichever PR lands second has to switch to successors_in. There are also textual conflicts: with #3654 in shader.rs uses_fmad (~655, both rewrite the same lines), and with #3645 and #3654 at the test insertion point in module.rs.
  • A change in output inside a "no semantics change" commit. The commit says "without changing semantics", but module/opt.rs ~500 adds 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_u64 masks 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.
  • The stop rule changes in both directions. opt.rs ~1379 (iter_changed |= iter == 0 || late_phi): after the first iteration, CSE or simplify replacements alone no longer start another pass. ~1471 and ~1488 now 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 reaches hoist_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 rewritten compute_deps (graphics.rs ~757-855, which relies only on the existing dependency tests).
  • The timings were not measured on this tree. The description says the per-pass timings were taken "during the offline optimization sweep before cherry-picking", and "Not tested" lists no A/B on main plus this PR. The steps don't chain into one sequence: "Single-pass signature input trace" ends at p50 25.62 ms but "Borrow operands" starts at 22.77 ms, and "Skip redundant optimizer iterations" ends at a 0.77 s wall time but the next step starts at 1.02 s. Nothing shows that the smoke deltas (+4.3 % frames, −2110 MB peak commit) come from CPU-side optimizer speed-ups and not from run-to-run variance.

Fine (by reading): CseTable compares the full (op, ty) against the stored definition on every bucket hit. That definition is not modified later in the walk, and rewind restores bucket heads in LIFO order, so collisions cannot merge different values. The random seed only affects bucket placement, not output. The new block_layout DFS gives the same post-order as the old one. The compute_deps reachability walk covers the same data and control edges as the old fixed point. The max_vgpr scan is only read by movrel / swaprel (lower_wide.rs ~286). The hoist eligibility precheck and the WordHasher generalisation do not change results.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7340211231 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7340211231). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T08:59:35Z. --- Review (head e3defbb0, diff read, not a merge-check): - **Breaks the build together with #3655.** `crates/xcl/src/gpu/dxil/module.rs ~1201` makes `successors()` `#[cfg(test)]`. #3655 adds a non-test call `self.successors(b)` in `module/split.rs` (~812 in the merged tree). Git merges the two cleanly, but `cargo build` of the merged tree fails with "no method `successors`". Whichever PR lands second has to switch to `successors_in`. There are also textual conflicts: with #3654 in `shader.rs` `uses_fmad` (~655, both rewrite the same lines), and with #3645 and #3654 at the test insertion point in `module.rs`. - **A change in output inside a "no semantics change" commit.** The commit says "without changing semantics", but `module/opt.rs ~500` adds 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_u64` masks 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. - **The stop rule changes in both directions.** `opt.rs ~1379` (`iter_changed |= iter == 0 || late_phi`): after the first iteration, CSE or simplify replacements alone no longer start another pass. `~1471` and `~1488` now 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 reaches `hoist_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 rewritten `compute_deps` (`graphics.rs ~757-855`, which relies only on the existing dependency tests). - **The timings were not measured on this tree.** The description says the per-pass timings were taken "during the offline optimization sweep before cherry-picking", and "Not tested" lists no A/B on main plus this PR. The steps don't chain into one sequence: "Single-pass signature input trace" ends at p50 25.62 ms but "Borrow operands" starts at 22.77 ms, and "Skip redundant optimizer iterations" ends at a 0.77 s wall time but the next step starts at 1.02 s. Nothing shows that the smoke deltas (+4.3 % frames, −2110 MB peak commit) come from CPU-side optimizer speed-ups and not from run-to-run variance. Fine (by reading): `CseTable` compares the full `(op, ty)` against the stored definition on every bucket hit. That definition is not modified later in the walk, and `rewind` restores bucket heads in LIFO order, so collisions cannot merge different values. The random seed only affects bucket placement, not output. The new `block_layout` DFS gives the same post-order as the old one. The `compute_deps` reachability walk covers the same data and control edges as the old fixed point. The `max_vgpr` scan is only read by `movrel` / `swaprel` (`lower_wide.rs ~286`). The hoist eligibility precheck and the `WordHasher` generalisation do not change results. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
vasanex commented 2026-12-02 10:08:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by vasanex on 2026-12-02T10:08:18Z.


merge-check
base: 1c8b551475
head: e3defbb0e7
merge: clean (git diff --check clean)
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 did compute_movrel_uses_program_max_vgpr_and_masks_m0 and the edited split_epilogue_clamps_lds_to_lds_top_and_validates.
review: whole diff read (8 files, +369/-267). No correctness finding. By reading: the new block_layout walk gives the same order as the old one (marking on entry with the smallest block popped first is the same depth-first walk); compute_deps follows 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; CseTable compares 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_vgpr is 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; and successors() 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.

<!-- greyfinch-sync:ivall/xcl:comment:7342019660 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7342019660). Originally posted by [vasanex](https://github.com/vasanex) on 2026-12-02T10:08:18Z. --- merge-check base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: e3defbb0e755c713627ad54a1673b572db225b4c merge: clean (`git diff --check` clean) 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 did `compute_movrel_uses_program_max_vgpr_and_masks_m0` and the edited `split_epilogue_clamps_lds_to_lds_top_and_validates`. review: whole diff read (8 files, +369/-267). No correctness finding. By reading: the new `block_layout` walk gives the same order as the old one (marking on entry with the smallest block popped first is the same depth-first walk); `compute_deps` follows 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; `CseTable` compares 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_vgpr` is 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; and `successors()` 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.
Decodere commented 2026-12-02 11:01:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T11:01:55Z.


merge-check
base: 1c8b551475
head: e3defbb0e7
merge: 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_deps in graphics.rs with an iterative backward DFS per output seed (using Op directly and deduplicating per-root store walks); gates max_vgpr scan in kernel.rs on V_MOVREL*/V_SWAPREL_B32 (confirmed the only top_vgpr callers); reuses scratch buffers via successors_in and iterative Step::Enter/Leave RPO in module.rs; replaces HashMap<(Op, Ty), Value> + undo cloning in module/opt.rs with a scoped open-chained CseTable using WordHasher and rewind; folds unsigned <= max / >= 0 / < 0 / > max comparisons for widths <= 32; tracks iter_changed accurately across iter == 0 || late_phi, fold_guarded_selects, and flat_reads; and pre-filters eligible ReadNone declarations in hoist_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_deps overlaps #1852, and making Module::successors #[cfg(test)] conflicts with #3655 if both merge without rebase. No correctness defects, scope creep, or UB on base 1c8b5514.
performance: 60 s retail smoke (title: 29640639, runtime non-regression): 1627 frames (+11.3% vs 1c8b5514 baseline 1462 frames), 15153 MB peak commit (-5.5% vs 16043 MB baseline), 0 device removals, 0 crashes.

xcl-smoke v1
commit: e3defbb0e755c713627ad54a1673b572db225b4c
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1627 (PresentX 1627)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 15153 MB

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)

<!-- greyfinch-sync:ivall/xcl:comment:7343325454 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7343325454). Originally posted by [Decodere](https://github.com/Decodere) on 2026-12-02T11:01:55Z. --- merge-check base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: e3defbb0e755c713627ad54a1673b572db225b4c merge: clean (fast-forward onto base, commit e3defbb0e755c713627ad54a1673b572db225b4c, 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_deps` in `graphics.rs` with an iterative backward DFS per output seed (using `Op` directly and deduplicating per-root store walks); gates `max_vgpr` scan in `kernel.rs` on `V_MOVREL*`/`V_SWAPREL_B32` (confirmed the only `top_vgpr` callers); reuses scratch buffers via `successors_in` and iterative `Step::Enter`/`Leave` RPO in `module.rs`; replaces `HashMap<(Op, Ty), Value>` + undo cloning in `module/opt.rs` with a scoped open-chained `CseTable` using `WordHasher` and `rewind`; folds unsigned `<= max` / `>= 0` / `< 0` / `> max` comparisons for widths `<= 32`; tracks `iter_changed` accurately across `iter == 0 || late_phi`, `fold_guarded_selects`, and `flat_reads`; and pre-filters eligible `ReadNone` declarations in `hoist_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_deps` overlaps #1852, and making `Module::successors` `#[cfg(test)]` conflicts with #3655 if both merge without rebase. No correctness defects, scope creep, or UB on base 1c8b5514. performance: 60 s retail smoke (title: 29640639, runtime non-regression): 1627 frames (+11.3% vs 1c8b5514 baseline 1462 frames), 15153 MB peak commit (-5.5% vs 16043 MB baseline), 0 device removals, 0 crashes. ``` xcl-smoke v1 commit: e3defbb0e755c713627ad54a1673b572db225b4c gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1627 (PresentX 1627) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 15153 MB ``` 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)
Foniass commented 2026-12-02 11:44:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T11:44:56Z.


merge-check
base: 1c8b551475
head: e3defbb0e7
merge: 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 1c8b5514 vs 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.

<!-- greyfinch-sync:ivall/xcl:comment:7344351192 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7344351192). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T11:44:56Z. --- merge-check base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: e3defbb0e755c713627ad54a1673b572db225b4c merge: 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 1c8b5514 vs 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.
Kalmarv commented 2026-12-02 14:18:35 +00:00 (Migrated from github.com)

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 as 4dc1389b5:

  • Fixed the #3655 build break: switched module/split.rs's uniform-cut walk from self.successors(b) to self.successors_in(b, &mut successors) so Module::successors() remains test-only and the rebased tree builds cleanly (39 warnings, 0 new vs main).
  • Updated commit message and PR description: removed the "without changing semantics" / byte-identical framing — clearly noted that the unsigned endpoint folds and updated iteration stop rule can change emitted DXIL while preserving program semantics, clarified that the offline 329-shader timings came from separate checkpoints on the offline sweep branch (not re-measured standalone here), and aligned commit trailers with AI use (Codex (GPT-6) + Antigravity (Gemini 4 Neon)).
  • Fresh verification: scripts/test.ps1 passes (2978 passed, 0 failed, 52 ignored, 24 hardware skips on RTX 5070 Ti), and an idle warm-cache 60 s smoke pair against main 5eaadb54c shows 1687 vs 1698 frames (61 60 60 vs 60 61 60 presents per 2 s, 16151 vs 15798 MB peak commit, 0 device removals, 0 crashes). (Editing gpu/dxil/* busts XCL_DIRECT_DXIL_SOURCE_ID on 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, fixed module/split.rs, ran scripts/test.ps1 and the idle smoke pair, and drafted this comment.

<!-- greyfinch-sync:ivall/xcl:comment:7348330105 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7348330105). Originally posted by [Kalmarv](https://github.com/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 as `4dc1389b5`: - **Fixed the `#3655` build break:** switched `module/split.rs`'s uniform-cut walk from `self.successors(b)` to `self.successors_in(b, &mut successors)` so `Module::successors()` remains test-only and the rebased tree builds cleanly (`39` warnings, 0 new vs `main`). - **Updated commit message and PR description:** removed the "without changing semantics" / byte-identical framing — clearly noted that the unsigned endpoint folds and updated iteration stop rule can change emitted DXIL while preserving program semantics, clarified that the offline 329-shader timings came from separate checkpoints on the offline sweep branch (not re-measured standalone here), and aligned commit trailers with **AI use** (`Codex (GPT-6)` + `Antigravity (Gemini 4 Neon)`). - **Fresh verification:** `scripts/test.ps1` passes (`2978 passed, 0 failed, 52 ignored`, 24 hardware skips on RTX 5070 Ti), and an idle warm-cache 60 s smoke pair against `main` `5eaadb54c` shows `1687` vs `1698` frames (`61 60 60` vs `60 61 60` presents per 2 s, `16151` vs `15798` MB peak commit, 0 device removals, 0 crashes). (Editing `gpu/dxil/*` busts `XCL_DIRECT_DXIL_SOURCE_ID` on 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, fixed `module/split.rs`, ran `scripts/test.ps1` and the idle smoke pair, and drafted this comment.
vasanex commented 2026-12-02 15:22:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by vasanex on 2026-12-02T15:22:47Z.


merge-check
base: 5eaadb54c1
head: 4dc1389b58
merge: clean (the head is based on this base; git diff --check clean)
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 call self.successors(b) that #3655 added in module/split.rs now uses successors_in with 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 at e3defbb0, 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.

<!-- greyfinch-sync:ivall/xcl:comment:7350223314 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7350223314). Originally posted by [vasanex](https://github.com/vasanex) on 2026-12-02T15:22:47Z. --- merge-check base: 5eaadb54c14e0fc29597b2a1689d7dbd83491303 head: 4dc1389b58fac2e1e07bdbb440168089c139f4f6 merge: clean (the head is based on this base; `git diff --check` clean) 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 call `self.successors(b)` that #3655 added in `module/split.rs` now uses `successors_in` with 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 at e3defbb0, 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.
Foniass commented 2026-12-02 18:01:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T18:01:36Z.


merge-check
base: 5eaadb54c1
head: 4dc1389b58
merge: 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 from e3defbb0, my last review's head). The code is the same as e3defbb0: the range-diff shows only a reworded commit message (no longer "without changing semantics") and the rebase onto 5eaadb54, which already has the merged #3655, whose self.successors(b) call in the uniform-cut walk (module/split.rs ~812) now calls successors_in, as do the other two sites in dispatch_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-test successors( caller is left, and neither #3654 nor #3645 adds one (this PR adds one more textual conflict with #3654 in shader.rs uses_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 the lower_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), and late_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 rewritten compute_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, the compute_deps rewrite, 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 it XCL_DIRECT_DXIL_SOURCE_ID, for every title by default, checked only on one NVIDIA wave32 adapter. Fine: the new successors_in uses 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 5eaadb54 vs 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.

<!-- greyfinch-sync:ivall/xcl:comment:7353872310 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7353872310). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T18:01:36Z. --- merge-check base: 5eaadb54c14e0fc29597b2a1689d7dbd83491303 head: 4dc1389b58fac2e1e07bdbb440168089c139f4f6 merge: 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 from e3defbb0, my last review's head). The code is the same as e3defbb0: the range-diff shows only a reworded commit message (no longer "without changing semantics") and the rebase onto 5eaadb54, which already has the merged #3655, whose `self.successors(b)` call in the uniform-cut walk (`module/split.rs` ~812) now calls `successors_in`, as do the other two sites in `dispatch_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-test `successors(` caller is left, and neither #3654 nor #3645 adds one (this PR adds one more textual conflict with #3654 in `shader.rs` `uses_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 the `lower_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), and `late_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 rewritten `compute_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, the `compute_deps` rewrite, `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 it `XCL_DIRECT_DXIL_SOURCE_ID`, for every title by default, checked only on one NVIDIA wave32 adapter. Fine: the new `successors_in` uses 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 5eaadb54 vs 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.
bmjask commented 2026-12-02 18:08:35 +00:00 (Migrated from github.com)

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.

  1. Medium crates/xcl/src/gpu/dxil/graphics.rs:763: Not certain about this one: seen_values is sized from the largest instruction index found in a block (value_count), but it's indexed with any Value::Inst reached 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.

<!-- greyfinch-sync:ivall/xcl:review:6156168229 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#pullrequestreview-6156168229). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T18:08:35Z. **Review:** COMMENTED --- Review of `4dc1389b`: 1 finding(s) (1 medium), most severe first. 1. **Medium** `crates/xcl/src/gpu/dxil/graphics.rs:763`: Not certain about this one: `seen_values` is sized from the largest instruction index found in a block (`value_count`), but it's indexed with any `Value::Inst` reached 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._
bmjask commented 2026-12-02 18:08:36 +00:00 (Migrated from github.com)

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 763

@@ -754,179 +754,103 @@ fn compute_deps(s: &Shader, inputs: &[Placed], outputs: &[Placed], prims: &[Plac
     // A load depends on every write to its root, including each write's address
     // and the branch that controls whether it happens.
     let mut root_stores: HashMap<Value, Vec<(Vec<Value>, usize)>> = HashMap::new();
+    let in_base: Vec<Option<u32>> = inputs.iter().map(|e| e.at.map(|(r, c)| r * 4 + c as u32)).collect();
+    // Dependency sets are unions. An input contributes to an output exactly when
+    // walking data and control edges backwards from that output reaches its load.
+    // Visit each definition once per output, including in a cycle of loop phis.
+    enum Source { Value(Value), Block(usize) }
+    let mut seeds: HashMap<(u8, u32), Vec<Source>> = HashMap::new();
+    let mut value_count = 0;

Medium: Not certain about this one: seen_values is sized from the largest instruction index found in a block (value_count), but it's indexed with any Value::Inst reached 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 that optimize returned early on as malformed and left for the writer to report; the old recursive version handled any index through a HashMap. Sizing seen_values by the module's instruction count (or bounds-checking) would turn this back into a normal error path.

<!-- greyfinch-sync:ivall/xcl:review-comment:4773717971 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#discussion_r4773717971). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T18:08:36Z. **Code review location:** `crates/xcl/src/gpu/dxil/graphics.rs`; line 763 ~~~~diff @@ -754,179 +754,103 @@ fn compute_deps(s: &Shader, inputs: &[Placed], outputs: &[Placed], prims: &[Plac // A load depends on every write to its root, including each write's address // and the branch that controls whether it happens. let mut root_stores: HashMap<Value, Vec<(Vec<Value>, usize)>> = HashMap::new(); + let in_base: Vec<Option<u32>> = inputs.iter().map(|e| e.at.map(|(r, c)| r * 4 + c as u32)).collect(); + // Dependency sets are unions. An input contributes to an output exactly when + // walking data and control edges backwards from that output reaches its load. + // Visit each definition once per output, including in a cycle of loop phis. + enum Source { Value(Value), Block(usize) } + let mut seeds: HashMap<(u8, u32), Vec<Source>> = HashMap::new(); + let mut value_count = 0; ~~~~ --- **Medium**: Not certain about this one: `seen_values` is sized from the largest instruction index found in a block (`value_count`), but it's indexed with any `Value::Inst` reached 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 that `optimize` returned early on as malformed and left for the writer to report; the old recursive version handled any index through a HashMap. Sizing `seen_values` by the module's instruction count (or bounds-checking) would turn this back into a normal error path.
bmjask commented 2026-12-02 18:08:37 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:ivall/xcl:comment:7354001029 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7354001029). Originally posted by [bmjask](https://github.com/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.
stijn-boer commented 2026-12-02 18:08:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by stijn-boer on 2026-12-02T18:08:37Z.


merge-check
base: 817eb1fc9f
head: 4dc1389b58
verdict: 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 4dc1389

Clean merge onto main at 817eb1f (merge commit bb460baf02c4d403d48b514388dd9516026e73af). git diff --check was clean.

Setup

  • AMD Radeon RX 9060 XT (driver 32.0.32029.2010), Ryzen 7 5700X, Windows 10 21H2 build 19044.6332
  • Rust 1.100.0, debug builds, Agility SDK 1.620.2 with matching d3d12SDKLayers.dll, DXC 1.9.2609.5

Tested

cargo build --workspace passed. cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output exited 101 on both builds. The baseline table row is from a prior run of the same commit, machine, SDK, and command.

Build Passed Failed Ignored SKIPPED notices
main 340 3 23 0
Merged PR 338 3 23 0

Counts are partial because two test processes aborted on each build.

  • Tests that failed on the PR and passed on main — none observed in the comparable results. Two fewer passing status lines appeared before the aborts on the merge.
  • Focused tests — 12 passed, 0 failed, 0 ignored, 0 skip notices with --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.
  • Debug-layer coverage — both debug-layer E2E tests, including DRED, and uploads_start_from_each_subresources_state passed.
Shared failures and process aborts
  • fuzz_validate_and_gpu_1, fuzz_validate_and_gpu_3, and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs reported failures on both builds.
  • The library and gpu_compute_e2e test processes exited with 0xc0000409 on both builds.

Retail smoke

Ran scripts/smoke.ps1 -Game <local folder> -Seconds 60 -Xcl <debug binary> with XCL_UMA_DRIVER=mixed for title hash 2c508222.

Build Exit Frames logged Device removals logged Peak commit
main 0xc0000409 None 0 1321 MB
Merged PR, first attempt 0xc0000409 None 0 6422 MB
Merged PR, repeat from fresh data root 0xc0000409 None 0 1320 MB

The 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.

<!-- greyfinch-sync:ivall/xcl:comment:7354001173 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7354001173). Originally posted by [stijn-boer](https://github.com/stijn-boer) on 2026-12-02T18:08:37Z. --- merge-check base: 817eb1fc9fb0763008ae5d8de1f7f586f442b51d head: 4dc1389b58fac2e1e07bdbb440168089c139f4f6 verdict: not yet: all 12 focused checks passed and the workspace and smoke interruptions reproduced on main. The independent [same-head suite and startup smoke](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7350223314) 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 `4dc1389`** Clean merge onto `main` at `817eb1f` (merge commit `bb460baf02c4d403d48b514388dd9516026e73af`). `git diff --check` was clean. **Setup** - AMD Radeon RX 9060 XT (driver 32.0.32029.2010), Ryzen 7 5700X, Windows 10 21H2 build 19044.6332 - Rust 1.100.0, debug builds, Agility SDK 1.620.2 with matching `d3d12SDKLayers.dll`, DXC 1.9.2609.5 **Tested** `cargo build --workspace` passed. `cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output` exited 101 on both builds. The baseline table row is from a prior run of the same commit, machine, SDK, and command. | Build | Passed | Failed | Ignored | `SKIPPED` notices | |---|---:|---:|---:|---:| | `main` | 340 | 3 | 23 | 0 | | Merged PR | 338 | 3 | 23 | 0 | Counts are partial because two test processes aborted on each build. - **Tests that failed on the PR and passed on `main`** — none observed in the comparable results. Two fewer passing status lines appeared before the aborts on the merge. - **Focused tests** — 12 passed, 0 failed, 0 ignored, 0 skip notices with `--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. - **Debug-layer coverage** — both debug-layer E2E tests, including DRED, and `uploads_start_from_each_subresources_state` passed. <details><summary>Shared failures and process aborts</summary> - `fuzz_validate_and_gpu_1`, `fuzz_validate_and_gpu_3`, and `two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs` reported failures on both builds. - The library and `gpu_compute_e2e` test processes exited with `0xc0000409` on both builds. </details> **Retail smoke** Ran `scripts/smoke.ps1 -Game <local folder> -Seconds 60 -Xcl <debug binary>` with `XCL_UMA_DRIVER=mixed` for title hash `2c508222`. | Build | Exit | Frames logged | Device removals logged | Peak commit | |---|---|---|---:|---:| | `main` | `0xc0000409` | None | 0 | 1321 MB | | Merged PR, first attempt | `0xc0000409` | None | 0 | 6422 MB | | Merged PR, repeat from fresh data root | `0xc0000409` | None | 0 | 1320 MB | The 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.
Kalmarv commented 2026-12-02 18:21:30 +00:00 (Migrated from github.com)

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 to 7204890cd (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:

  1. Dropped output-changing and bundled pieces (@Foniass, @bmjask):

    • Removed the unsigned endpoint folds (opt.rs + lower_geom.rs test edit) and restored main's exact optimizer iteration stop rule (opt.rs).
    • Removed the graphics.rs (compute_deps) and shader.rs (uses_fmad) rewrite — this eliminates @bmjask's graphics.rs:763 (seen_values) finding and removes the textual conflict with #3654 in shader.rs (those can be proposed separately if wanted).
    • Retained CseTable + WordHasher, hoist_entry_readnone pre-filtering, successors_in / flat block_layout (including #3655's split.rs uniform-cut walk), and the max_vgpr fast-path.
  2. Direct A/B compile-time & byte-for-byte DXIL identity measurement on this commit (@Foniass, @stijn-boer):

    • Measured origin/main (817eb1fc9) vs 7204890cd in --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).
  3. Fresh verification on 7204890cd:

    • cargo build --release -p xcl: 39 warnings (0 new vs 817eb1fc9).
    • scripts/test.ps1: 3006 passed, 0 failed, 52 ignored across 44 targets; 24 SKIPPED (22 no wave64, 2 no heap windows).
    • 60 s smoke (title: ea3b5e4d): 817eb1fc9 1610 frames (14895 MB) vs 7204890cd 1681 frames (60 60 61, 16461 MB), 0 device removals, 0 crashes, exit: 0x0.
    • python scripts/pr_check.py --local: description ok.

Ready for re-review! (Updated and verified with Antigravity, Gemini 4 Neon.)

<!-- greyfinch-sync:ivall/xcl:comment:7354438675 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7354438675). Originally posted by [Kalmarv](https://github.com/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 to `7204890cd` (**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**: 1. **Dropped output-changing and bundled pieces (`@Foniass`, `@bmjask`):** - Removed the unsigned endpoint folds (`opt.rs` + `lower_geom.rs` test edit) and restored `main`'s exact optimizer iteration stop rule (`opt.rs`). - Removed the `graphics.rs` (`compute_deps`) and `shader.rs` (`uses_fmad`) rewrite — this eliminates `@bmjask`'s `graphics.rs:763` (`seen_values`) finding and removes the textual conflict with `#3654` in `shader.rs` (those can be proposed separately if wanted). - Retained `CseTable` + `WordHasher`, `hoist_entry_readnone` pre-filtering, `successors_in` / flat `block_layout` (including `#3655`'s `split.rs` uniform-cut walk), and the `max_vgpr` fast-path. 2. **Direct A/B compile-time & byte-for-byte DXIL identity measurement on this commit (`@Foniass`, `@stijn-boer`):** - Measured `origin/main` (`817eb1fc9`) vs `7204890cd` in `--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`). 3. **Fresh verification on `7204890cd`:** - `cargo build --release -p xcl`: `39` warnings (`0` new vs `817eb1fc9`). - `scripts/test.ps1`: `3006 passed, 0 failed, 52 ignored` across 44 targets; `24 SKIPPED` (`22 no wave64`, `2 no heap windows`). - 60 s smoke (`title: ea3b5e4d`): `817eb1fc9` `1610` frames (`14895 MB`) vs `7204890cd` `1681` frames (`60 60 61`, `16461 MB`), `0` device removals, `0` crashes, `exit: 0x0`. - `python scripts/pr_check.py --local`: `description ok`. Ready for re-review! (Updated and verified with Antigravity, Gemini 4 Neon.)
Lum7nt commented 2026-12-02 22:05:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Lum7nt on 2026-12-02T22:05:57Z.


merge-check
base: 5ad98adbc3
head: 7204890cdc
merge: 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) + 4 gpu_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 on origin/main 5ad98adbc on this machine (driver 581.42 returns 0x8000FFFF on GetCachedBlob/StorePipeline, zero new failures). gpu::dxil::: 355 passed, 0 failed, 4 ignored (1 SKIPPED no 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. CseTable checks collisions against finalized m.insts[other] after std::mem::replace restoration and restores bucket heads in LIFO order on rewind; hoist_entry_readnone pre-filters by FuncDecl eligibility before cloning operands; block_layout Step::Enter/Leave with seen[b] checked on Enter preserves the exact DFS post-order while flattening edge storage via successors_in; max_vgpr scan is gated on V_MOVREL*/V_SWAPREL_B32. Note: wave64 GPU paths did not execute here (native wave32 RTX 3060).
performance: Release (--release) compile-time A/B on 5ad98adbc vs 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%, identical 48508 B DXIL)
  • 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)
<!-- greyfinch-sync:ivall/xcl:comment:7360221470 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7360221470). Originally posted by [Lum7nt](https://github.com/Lum7nt) on 2026-12-02T22:05:57Z. --- merge-check base: 5ad98adbc360225ac8a57ad9661e16fe8df9d8dd head: 7204890cdcfeeae509b53962da1df5c7a5320091 merge: 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`) + 4 `gpu_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 on `origin/main` `5ad98adbc` on this machine (driver `581.42` returns `0x8000FFFF` on `GetCachedBlob`/`StorePipeline`, zero new failures). `gpu::dxil::`: 355 passed, 0 failed, 4 ignored (1 SKIPPED `no 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. `CseTable` checks collisions against finalized `m.insts[other]` after `std::mem::replace` restoration and restores bucket heads in LIFO order on `rewind`; `hoist_entry_readnone` pre-filters by `FuncDecl` eligibility before cloning operands; `block_layout` `Step::Enter`/`Leave` with `seen[b]` checked on `Enter` preserves the exact DFS post-order while flattening edge storage via `successors_in`; `max_vgpr` scan is gated on `V_MOVREL*`/`V_SWAPREL_B32`. Note: wave64 GPU paths did not execute here (native wave32 RTX 3060). performance: Release (`--release`) compile-time A/B on `5ad98adbc` vs 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%`, identical `48508 B` DXIL) - `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`)
stijn-boer commented 2026-12-02 22:13:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by stijn-boer on 2026-12-02T22:13:24Z.


merge-check
base: 5ad98adbc3
head: 7204890cdc
verdict: 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) at cfdacf961cf9cced7aba34f4f11e6219ce55df2d. The updated #3646 head merged cleanly onto it at 02ccc832ce5a491cd7deae962772c8bf5d9751e1. git diff --check passed.

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 --workspace passed on the same combined baseline in the prior #3613 retest. With #3646 added, a fresh Cargo target failed to build at crates/xcl/src/gpu/dxil/module.rs:823 with E0599: no method named successors found for mutable reference &mut Module.

#3707 adds a production call to self.successors(tail.0 as usize). #3646 introduces successors_in and places the old successors wrapper 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.

<!-- greyfinch-sync:ivall/xcl:comment:7360395742 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7360395742). Originally posted by [stijn-boer](https://github.com/stijn-boer) on 2026-12-02T22:13:24Z. --- merge-check base: 5ad98adbc360225ac8a57ad9661e16fe8df9d8dd head: 7204890cdcfeeae509b53962da1df5c7a5320091 verdict: 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`) at `cfdacf961cf9cced7aba34f4f11e6219ce55df2d`. The updated #3646 head merged cleanly onto it at `02ccc832ce5a491cd7deae962772c8bf5d9751e1`. `git diff --check` passed. **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 --workspace` passed on the same combined baseline in the prior #3613 retest. With #3646 added, a fresh Cargo target failed to build at `crates/xcl/src/gpu/dxil/module.rs:823` with `E0599: no method named successors found for mutable reference &mut Module`. #3707 adds a production call to `self.successors(tail.0 as usize)`. #3646 introduces `successors_in` and places the old `successors` wrapper 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.
Kalmarv commented 2026-12-02 22:34:40 +00:00 (Migrated from github.com)

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 onto origin/main 078358a05, which now includes #3652):

  • Changed #[cfg(test)] to #[allow(dead_code)] on Module::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 (39 release warnings vs 39 on 078358a05).
  • Verified combined 5ad98adbc + #3707 (912ff558e) + 5f7f461fb: cargo check --workspace passes with 0 errors and 39 warnings (0 new).
  • Re-verified standalone on 5f7f461fb:
    • scripts/test.ps1: 44 targets, 3008 passed, 0 failed, 52 ignored, 24 SKIPPED (22 no wave64, 2 no heap windows).
    • Paired 60 s smoke (title: ea3b5e4d, RTX 5070 Ti): 078358a05 1689 frames (16405 MB, 60 60 60) vs 5f7f461fb 1681 frames (16435 MB, 60 60 60), 0 device removals, 0 crashes, exit: 0x0.
    • python scripts/pr_check.py --local: description ok.

Ready for re-check! (Updated and verified with Antigravity, Gemini 4 Neon.)

<!-- greyfinch-sync:ivall/xcl:comment:7360881370 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7360881370). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-12-02T22:34:40Z. --- Thanks for catching that combined-tree build issue with #3707, @stijn-boer! Updated #3646 to `5f7f461fb` (rebased onto `origin/main` `078358a05`, which now includes #3652): - Changed `#[cfg(test)]` to `#[allow(dead_code)]` on `Module::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 (`39` release warnings vs `39` on `078358a05`). - Verified combined `5ad98adbc + #3707 (912ff558e) + 5f7f461fb`: `cargo check --workspace` passes with 0 errors and 39 warnings (0 new). - Re-verified standalone on `5f7f461fb`: - `scripts/test.ps1`: **44 targets, 3008 passed, 0 failed, 52 ignored, 24 SKIPPED** (22 no wave64, 2 no heap windows). - Paired 60 s smoke (`title: ea3b5e4d`, RTX 5070 Ti): `078358a05` `1689` frames (`16405 MB`, `60 60 60`) vs `5f7f461fb` `1681` frames (`16435 MB`, `60 60 60`), `0` device removals, `0` crashes, `exit: 0x0`. - `python scripts/pr_check.py --local`: `description ok`. Ready for re-check! (Updated and verified with Antigravity, Gemini 4 Neon.)
jsalzy commented 2026-12-02 23:34:19 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by jsalzy on 2026-12-02T23:34:19Z.


merge-check claim
head: 5f7f461fbd

<!-- greyfinch-sync:ivall/xcl:comment:7362166520 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7362166520). Originally posted by [jsalzy](https://github.com/jsalzy) on 2026-12-02T23:34:19Z. --- merge-check claim head: 5f7f461fbd2eb0428dff962c0417a37c47ca3b1e
jsalzy commented 2026-12-02 23:44:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by jsalzy on 2026-12-02T23:44:25Z.


merge-check
base: 078358a
head: 5f7f461
merge: 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.

<!-- greyfinch-sync:ivall/xcl:comment:7362366887 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7362366887). Originally posted by [jsalzy](https://github.com/jsalzy) on 2026-12-02T23:44:25Z. --- merge-check base: 078358a head: 5f7f461 merge: 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.
Foniass commented 2026-12-03 04:12:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T04:12:51Z.


merge-check
base: 078358a058
head: 5f7f461fbd
merge: 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

  1. Random seed in CseTable. opt.rs ~101 seeds each table from RandomState, so the bucket chain order and the optimizer's run time vary between runs for no benefit; a fixed seed keeps timings reproducible. Output is not affected.
  2. Byte identity checked offline only. The byte-identical claim rests on three synthetic kernels measured on 817eb1fc against the PR's earlier commit 7204890c; 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
  • Earlier finding fixed: the unsigned endpoint folds, the iteration stop-rule change and the compute_deps rewrite are dropped, so the PR no longer changes the emitted DXIL by design
  • Earlier finding fixed: Module::successors stays in non-test builds (allow(dead_code)), so #3655's and #3707's callers still build; by reading it builds together with #3707
  • Earlier finding fixed: the description now has a release A/B against main's code with byte-identical DXIL on three kernels, and the PR is about 275 lines
  • CseTable compares the full (op, ty) with the stored instruction on every bucket hit, stored definitions are not rewritten during the walk, and rewind restores bucket heads in LIFO order, so two different values never merge
  • The new block_layout DFS marks blocks on entry and pushes successors in descending order, which gives the same post-order as the old per-frame successor stack, duplicate Switch targets included
  • The hoist pre-filter skips only calls that is_hoistable_readnone_call refused anyway, and stopping when no count reaches 2 skips only a pass that could hoist nothing
  • max_vgpr is read only by the movrel/swaprel lowering (lower_wide.rs ~288), so leaving it at 0 without those instructions changes nothing
  • Merges cleanly onto main and with the other four PRs
How this was tested
  • Merged onto main 078358a0, then cargo build --workspace and cargo test --workspace --no-fail-fast -- --test-threads=4.
  • The skipped GPU tests are those this card can't run (no wave64 on NVIDIA, no D3D12 debug layer, and similar).
  • scripts/smoke.ps1: 60 s of a retail title on main 078358a0 and on this merge; presents per 2 s at the end: 60 61 60.
  • Title run: the release build of this merge launched the retail title with XCL_RUN_SECONDS=300 and 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.

<!-- greyfinch-sync:ivall/xcl:comment:7367389965 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3646#issuecomment-7367389965). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-03T04:12:51Z. --- merge-check base: 078358a058f7ba5d16690dba8dc4e55d2c88ae0a head: 5f7f461fbd2eb0428dff962c0417a37c47ca3b1e merge: 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 1. **Random seed in CseTable.** opt.rs ~101 seeds each table from RandomState, so the bucket chain order and the optimizer's run time vary between runs for no benefit; a fixed seed keeps timings reproducible. Output is not affected. 2. **Byte identity checked offline only.** The byte-identical claim rests on three synthetic kernels measured on 817eb1fc against the PR's earlier commit 7204890c; 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. <details><summary>Checked and fine</summary> - Earlier finding fixed: the unsigned endpoint folds, the iteration stop-rule change and the compute_deps rewrite are dropped, so the PR no longer changes the emitted DXIL by design - Earlier finding fixed: Module::successors stays in non-test builds (allow(dead_code)), so #3655's and #3707's callers still build; by reading it builds together with #3707 - Earlier finding fixed: the description now has a release A/B against main's code with byte-identical DXIL on three kernels, and the PR is about 275 lines - CseTable compares the full (op, ty) with the stored instruction on every bucket hit, stored definitions are not rewritten during the walk, and rewind restores bucket heads in LIFO order, so two different values never merge - The new block_layout DFS marks blocks on entry and pushes successors in descending order, which gives the same post-order as the old per-frame successor stack, duplicate Switch targets included - The hoist pre-filter skips only calls that is_hoistable_readnone_call refused anyway, and stopping when no count reaches 2 skips only a pass that could hoist nothing - max_vgpr is read only by the movrel/swaprel lowering (lower_wide.rs ~288), so leaving it at 0 without those instructions changes nothing - Merges cleanly onto main and with the other four PRs </details> <details><summary>How this was tested</summary> - Merged onto main `078358a0`, then `cargo build --workspace` and `cargo test --workspace --no-fail-fast -- --test-threads=4`. - The skipped GPU tests are those this card can't run (no wave64 on NVIDIA, no D3D12 debug layer, and similar). - `scripts/smoke.ps1`: 60 s of a retail title on main `078358a0` and on this merge; presents per 2 s at the end: 60 61 60. - Title run: the release build of this merge launched the retail title with `XCL_RUN_SECONDS=300` and 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. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3646:upstream-pr/3646'
git switch 'upstream-pr/3646'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/3646'
git switch 'upstream-pr/3646'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3646'
git switch 'upstream-pr/3646'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3646'
git switch 'main'
git merge --squash 'upstream-pr/3646'
git switch 'main'
git merge --ff-only 'upstream-pr/3646'
git switch 'main'
git merge 'upstream-pr/3646'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!3646
No description provided.