Direct DXIL: make compute_deps and is_const_global_ptr iterative (#1805) #1842

Open
fixgep wants to merge 2 commits from upstream-pr/1852 into main
fixgep commented 2026-11-24 21:54:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fixgep on 2026-11-24T21:54:11Z.


Make DXIL graphics dependency analysis (compute_deps) and constant-global-pointer checks (is_const_global_ptr) iterative so deep shader CFGs and load/store chains do not overflow the thread stack.

Rebased onto upstream/main: the redundant production Ssa::read rewrite in crates/xcl/src/gpu/dxil/ssa.rs was dropped in favor of #1844, while keeping the bounded-stack tests and updating kernel.rs for 3cde0cc.

Part of #1805.

What is in it

  • crates/xcl/src/gpu/dxil/graphics.rs: replace recursive value_deps / block_deps in compute_deps with an explicit frame stack (eval_dep and DepChildren), borrowing root_stores slices via a DepChildren::Writes cursor instead of cloning store lists per live frame, and preserving Sets open/close fixpoint iteration.
  • crates/xcl/src/gpu/dxil/module/opt.rs: convert is_const_global_ptr from recursion to an iterative loop.
  • crates/xcl/src/gpu/dxil/ssa.rs: keep upstream/main's #1844 Ssa::read implementation; add deep_join_chain_does_not_overflow_stack and deep_region_join_and_loop_phi_preserve_semantics.
  • crates/xcl/src/gpu/dxil/graphics_tests.rs: add deep_phi_deps_do_not_overflow_stack and deep_shared_root_loads_borrow_store_list_without_quadratic_children.
  • crates/xcl/src/gpu/dxil/kernel.rs: add deep_branch_chain_compiles_on_bounded_stack (using Vec::new() and 0 for translate_on_this_thread).

Tested

  • Hardware: NVIDIA GeForce RTX 3060 (12108 MiB VRAM) and XCL_ADAPTER=warp, Windows 11 x64 (stable-x86_64-pc-windows-msvc).
  • cargo build -j 4 --workspace, cargo test -j 4 --workspace --no-run, cargo build -j 4 --release -p xcl: exited 0, 0 new warnings.
  • RTX 3060 (--test-threads=1):
    • cargo test -j 4 -p xcl --lib gpu::dxil::ssa -- --test-threads=1: 3 passed, 0 failed, 0 ignored (0 skipped)
    • cargo test -j 4 -p xcl --lib gpu::dxil::graphics -- --test-threads=1: 34 passed, 0 failed, 0 ignored (0 skipped)
    • cargo test -j 4 -p xcl --lib gpu::dxil::kernel -- --test-threads=1: 8 passed, 0 failed, 0 ignored (1 skipped: dispatch_chain_native_wave64_builds_whole: no wave64)
    • cargo test -j 4 -p xcl --lib gpu::dxil::module::opt -- --test-threads=1: 24 passed, 0 failed, 0 ignored (0 skipped)
  • XCL_ADAPTER=warp (--test-threads=1):
    • cargo test -j 4 -p xcl --lib gpu::dxil::ssa -- --test-threads=1: 3 passed, 0 failed, 0 ignored (0 skipped)
    • cargo test -j 4 -p xcl --lib gpu::dxil::graphics -- --test-threads=1: 34 passed, 0 failed, 0 ignored (2 skipped: no wave64)
    • cargo test -j 4 -p xcl --lib gpu::dxil::kernel -- --test-threads=1: 8 passed, 0 failed, 0 ignored (3 skipped: no wave32 GPU / no wave64 / no wave32)
    • cargo test -j 4 -p xcl --lib gpu::dxil::module::opt -- --test-threads=1: 24 passed, 0 failed, 0 ignored (1 skipped: no wave32)

Regression run

xcl-smoke v1
commit: 6bfb5c5153ccc23517daf30aa1071ddb0fadb53c
gpu: NVIDIA GeForce RTX 3060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1663 (PresentX 1663)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15783 MB
xcl-smoke v1
commit: 1fbdea91a556b73e503baab65aa24235193115d2
gpu: NVIDIA GeForce RTX 3060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1663 (PresentX 1663)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16559 MB

Not tested

  • Full workspace test suite (cargo test --workspace) and native wave64 GPU execution (no wave64 hardware on this machine).

AI use

  • Antigravity (Gemini 4 Hydrogen): rebased onto upstream/main, dropped redundant ssa.rs Ssa::read rewrite in favor of #1844, adapted DepChildren::Writes for root_stores (Vec<Value>, usize) entries and kernel.rs test arguments, ran builds, targeted tests, and smoke runs.
<!-- greyfinch-sync:ivall/xcl:issue:5480968568 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1852). Originally posted by [fixgep](https://github.com/fixgep) on 2026-11-24T21:54:11Z. --- Make DXIL graphics dependency analysis (`compute_deps`) and constant-global-pointer checks (`is_const_global_ptr`) iterative so deep shader CFGs and load/store chains do not overflow the thread stack. Rebased onto `upstream/main`: the redundant production `Ssa::read` rewrite in `crates/xcl/src/gpu/dxil/ssa.rs` was dropped in favor of `#1844`, while keeping the bounded-stack tests and updating `kernel.rs` for `3cde0cc`. Part of #1805. **What is in it** - `crates/xcl/src/gpu/dxil/graphics.rs`: replace recursive `value_deps` / `block_deps` in `compute_deps` with an explicit frame stack (`eval_dep` and `DepChildren`), borrowing `root_stores` slices via a `DepChildren::Writes` cursor instead of cloning store lists per live frame, and preserving `Sets` open/close fixpoint iteration. - `crates/xcl/src/gpu/dxil/module/opt.rs`: convert `is_const_global_ptr` from recursion to an iterative loop. - `crates/xcl/src/gpu/dxil/ssa.rs`: keep `upstream/main`'s `#1844` `Ssa::read` implementation; add `deep_join_chain_does_not_overflow_stack` and `deep_region_join_and_loop_phi_preserve_semantics`. - `crates/xcl/src/gpu/dxil/graphics_tests.rs`: add `deep_phi_deps_do_not_overflow_stack` and `deep_shared_root_loads_borrow_store_list_without_quadratic_children`. - `crates/xcl/src/gpu/dxil/kernel.rs`: add `deep_branch_chain_compiles_on_bounded_stack` (using `Vec::new()` and `0` for `translate_on_this_thread`). **Tested** - Hardware: NVIDIA GeForce RTX 3060 (12108 MiB VRAM) and `XCL_ADAPTER=warp`, Windows 11 x64 (`stable-x86_64-pc-windows-msvc`). - `cargo build -j 4 --workspace`, `cargo test -j 4 --workspace --no-run`, `cargo build -j 4 --release -p xcl`: exited 0, 0 new warnings. - RTX 3060 (`--test-threads=1`): - `cargo test -j 4 -p xcl --lib gpu::dxil::ssa -- --test-threads=1`: 3 passed, 0 failed, 0 ignored (0 skipped) - `cargo test -j 4 -p xcl --lib gpu::dxil::graphics -- --test-threads=1`: 34 passed, 0 failed, 0 ignored (0 skipped) - `cargo test -j 4 -p xcl --lib gpu::dxil::kernel -- --test-threads=1`: 8 passed, 0 failed, 0 ignored (1 skipped: `dispatch_chain_native_wave64_builds_whole: no wave64`) - `cargo test -j 4 -p xcl --lib gpu::dxil::module::opt -- --test-threads=1`: 24 passed, 0 failed, 0 ignored (0 skipped) - `XCL_ADAPTER=warp` (`--test-threads=1`): - `cargo test -j 4 -p xcl --lib gpu::dxil::ssa -- --test-threads=1`: 3 passed, 0 failed, 0 ignored (0 skipped) - `cargo test -j 4 -p xcl --lib gpu::dxil::graphics -- --test-threads=1`: 34 passed, 0 failed, 0 ignored (2 skipped: `no wave64`) - `cargo test -j 4 -p xcl --lib gpu::dxil::kernel -- --test-threads=1`: 8 passed, 0 failed, 0 ignored (3 skipped: `no wave32 GPU` / `no wave64` / `no wave32`) - `cargo test -j 4 -p xcl --lib gpu::dxil::module::opt -- --test-threads=1`: 24 passed, 0 failed, 0 ignored (1 skipped: `no wave32`) **Regression run** ``` xcl-smoke v1 commit: 6bfb5c5153ccc23517daf30aa1071ddb0fadb53c gpu: NVIDIA GeForce RTX 3060 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1663 (PresentX 1663) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15783 MB ``` ``` xcl-smoke v1 commit: 1fbdea91a556b73e503baab65aa24235193115d2 gpu: NVIDIA GeForce RTX 3060 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1663 (PresentX 1663) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16559 MB ``` **Not tested** - Full workspace test suite (`cargo test --workspace`) and native wave64 GPU execution (no wave64 hardware on this machine). **AI use** - Antigravity (Gemini 4 Hydrogen): rebased onto `upstream/main`, dropped redundant `ssa.rs` `Ssa::read` rewrite in favor of `#1844`, adapted `DepChildren::Writes` for `root_stores` `(Vec<Value>, usize)` entries and `kernel.rs` test arguments, ran builds, targeted tests, and smoke runs.
lewisnic94-max commented 2026-11-24 22:50:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lewisnic94-max on 2026-11-24T22:50:28Z.

Review: COMMENTED


[P2] Excessive dependency walker memory allocation

At line 868, each pending load copies the full store list for its pointer root. A 1,024-step pixel shader retained 1,050,625 copied entries.

Borrowing the list preserved traversal depth and byte-identical DXIL while reducing median additional peak commit inside compute_deps from 16.621 to 0.727 MiB across seven release runs.

Please keep a cursor into the shared list and add a regression test for live child storage.

AI-assisted validation by Codex (GPT-6).

Independent follow-up

Reviewed commit c2b1029c224fa279aa83323bf5b42a3684ba5c04.

On a 1,024-step synthetic pixel shader, seven paired release runs measured median additional peak process commit inside compute_deps of 16.691 MiB with the copying walk (16.617–16.703 MiB) and 0.723 MiB with a borrowed list (0.715–0.789 MiB). Frame-array capacity stayed at 393,216 bytes. Live child-vector capacity fell from 16,891,936 to 131,136 bytes, with 1,050,625 store entries copied versus zero. All 14 translations had the same DXIL SHA-256, abd199f5003ece1b194be93660c8a0b84a63981e55a9c42e9ad9392fb1903fc9. The readout brackets the dependency pass and excludes subsequent DXC work.

The normal review build gave 16.531 MiB median against 0.832 MiB for #1844 at 71f2ceb5a0. Both heads passed the 4,000-join shader on a 2 MiB stack and all 24 seeded GPU draws per head. The stack improvement and child-storage regression can be addressed independently. In crates/xcl/src/gpu/dxil/graphics.rs:868, keep a cursor over the shared store list and add a test that bounds live child storage while preserving the DXIL.

Windows 11 x64, Ryzen 7 5800X, GeForce RTX 3080 (616.92), Rust 1.100.0 MSVC and DXC 1.9.2602.17. No runtime skips in those draw trials. Measurements are process commit deltas and instrumented capacities on a synthetic workload. Retail performance was not measured.

AI assistance: OpenAI Codex (GPT-6) inspected the implementation, analyzed the synthetic test evidence and drafted this review.

<!-- greyfinch-sync:ivall/xcl:review:6048634203 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1852#pullrequestreview-6048634203). Originally posted by [lewisnic94-max](https://github.com/lewisnic94-max) on 2026-11-24T22:50:28Z. **Review:** COMMENTED --- **[P2] Excessive dependency walker memory allocation** At line 868, each pending load copies the full store list for its pointer root. A 1,024-step pixel shader retained 1,050,625 copied entries. Borrowing the list preserved traversal depth and byte-identical DXIL while reducing median additional peak commit inside `compute_deps` from 16.621 to 0.727 MiB across seven release runs. Please keep a cursor into the shared list and add a regression test for live child storage. AI-assisted validation by Codex (GPT-6). **Independent follow-up** Reviewed commit `c2b1029c224fa279aa83323bf5b42a3684ba5c04`. On a 1,024-step synthetic pixel shader, seven paired release runs measured median additional peak process commit inside compute_deps of 16.691 MiB with the copying walk (16.617–16.703 MiB) and 0.723 MiB with a borrowed list (0.715–0.789 MiB). Frame-array capacity stayed at 393,216 bytes. Live child-vector capacity fell from 16,891,936 to 131,136 bytes, with 1,050,625 store entries copied versus zero. All 14 translations had the same DXIL SHA-256, abd199f5003ece1b194be93660c8a0b84a63981e55a9c42e9ad9392fb1903fc9. The readout brackets the dependency pass and excludes subsequent DXC work. The normal review build gave 16.531 MiB median against 0.832 MiB for #1844 at 71f2ceb5a05951f8d3d1f6aebe92c13eec240317. Both heads passed the 4,000-join shader on a 2 MiB stack and all 24 seeded GPU draws per head. The stack improvement and child-storage regression can be addressed independently. In crates/xcl/src/gpu/dxil/graphics.rs:868, keep a cursor over the shared store list and add a test that bounds live child storage while preserving the DXIL. Windows 11 x64, Ryzen 7 5800X, GeForce RTX 3080 (616.92), Rust 1.100.0 MSVC and DXC 1.9.2602.17. No runtime skips in those draw trials. Measurements are process commit deltas and instrumented capacities on a synthetic workload. Retail performance was not measured. AI assistance: OpenAI Codex (GPT-6) inspected the implementation, analyzed the synthetic test evidence and drafted this review.
vitor127wt commented 2026-11-24 23:08:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by vitor127wt on 2026-11-24T22:25:10Z.


Independent bounded-stack tests on Proton / Wine

I ran the two published 2 MiB stack cases individually on base 1d027e5c76c9a86a7ee2ca1cc677edf0be95d331 with only their test functions added to the tree, and then on clean PR head c2b1029c224fa279aa83323bf5b42a3684ba5c04.

Test Base with test only PR
deep_join_chain_does_not_overflow_stack Wine stack overflow, test failed Passed
deep_branch_chain_compiles_on_bounded_stack Wine stack overflow, test failed Passed
deep_region_join_and_loop_phi_preserve_semantics — Passed
deep_phi_deps_do_not_overflow_stack — Passed

Both base runs logged virtual_setup_exception stack overflow and returned test-harness status 101. Totals across separate processes were 0 passed / 2 failed on the base and 4 passed / 0 failed on the PR, with zero ignored or skipped in these filtered runs.

Tested

  • RTX 5070 Ti 16 GB, NVIDIA 620.73.04, Ryzen 7 9700X, 32 GB DDR5, CachyOS 7.3.5-2-cachyos, Proton Experimental 11.0 (experimental-11.0-20261112-x86_64), vkd3d-proton ec207194 with the #257 patch and dxil-spirv 7c048638. Rust 1.100.0, LLVM-MinGW 20261117 (x86_64-pc-windows-gnullvm), DXC 1.9.2609.5.
  • Debug library test binaries from cargo test --locked --target x86_64-pc-windows-gnullvm -p xcl --lib --no-run. Ran each filter under Wine with --exact --test-threads=1 --nocapture.

These results cover the synthetic compiler tests on this PR. The retail replay was made with #759 to reproduce the worker loss separately. Retail reproduction on #1805

AI use — OpenAI Codex (GPT-6, exact variant unavailable) ran the tests, checked the logs, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7146205501 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1852#issuecomment-7146205501). Originally posted by [vitor127wt](https://github.com/vitor127wt) on 2026-11-24T22:25:10Z. --- **Independent bounded-stack tests on Proton / Wine** I ran the two published 2 MiB stack cases individually on base `1d027e5c76c9a86a7ee2ca1cc677edf0be95d331` with only their test functions added to the tree, and then on clean PR head `c2b1029c224fa279aa83323bf5b42a3684ba5c04`. | Test | Base with test only | PR | | --- | --- | --- | | `deep_join_chain_does_not_overflow_stack` | Wine stack overflow, test failed | Passed | | `deep_branch_chain_compiles_on_bounded_stack` | Wine stack overflow, test failed | Passed | | `deep_region_join_and_loop_phi_preserve_semantics` | — | Passed | | `deep_phi_deps_do_not_overflow_stack` | — | Passed | Both base runs logged `virtual_setup_exception stack overflow` and returned test-harness status 101. Totals across separate processes were **0 passed / 2 failed** on the base and **4 passed / 0 failed** on the PR, with zero ignored or skipped in these filtered runs. **Tested** - RTX 5070 Ti 16 GB, NVIDIA 620.73.04, Ryzen 7 9700X, 32 GB DDR5, CachyOS `7.3.5-2-cachyos`, Proton Experimental 11.0 (`experimental-11.0-20261112-x86_64`), vkd3d-proton `ec207194` with the #257 patch and dxil-spirv `7c048638`. Rust 1.100.0, LLVM-MinGW 20261117 (`x86_64-pc-windows-gnullvm`), DXC 1.9.2609.5. - Debug library test binaries from `cargo test --locked --target x86_64-pc-windows-gnullvm -p xcl --lib --no-run`. Ran each filter under Wine with `--exact --test-threads=1 --nocapture`. These results cover the synthetic compiler tests on this PR. The retail replay was made with #759 to reproduce the worker loss separately. [Retail reproduction on #1805](https://github.com/xcl-dev/xcl/issues/1805#issuecomment-7146202387) **AI use** — OpenAI Codex (GPT-6, exact variant unavailable) ran the tests, checked the logs, and drafted this report.
itsd-effex commented 2026-11-24 23:08:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by itsd-effex on 2026-11-24T22:47:02Z.


A note from #1805's reporter: the Ssa::read suspicion in #1805's description was mine and is withdrawn. The retail crash there is in dxil-spirv (Royalflamejlh's analysis on #1805), and #1860 alone fixes it: with ssa.rs unchanged and dxil-spirv unpatched, the 21 retail pipelines that killed workers all build (test), against 0 of 21 without it. So this PR doesn't fix #1805's crash as far as I can tell. The deep-join recursion it removes is real on small stacks (vitor127wt's 2 MiB runs), so it may still be worth having as hardening. I haven't tested this PR against those 21. Sorry for the misdirection.

AI use

  • Claude Code (Claude Opus 5.5) wrote this comment.
<!-- greyfinch-sync:ivall/xcl:comment:7146639628 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1852#issuecomment-7146639628). Originally posted by [itsd-effex](https://github.com/itsd-effex) on 2026-11-24T22:47:02Z. --- A note from #1805's reporter: the `Ssa::read` suspicion in #1805's description was mine and is withdrawn. The retail crash there is in dxil-spirv (Royalflamejlh's analysis on #1805), and #1860 alone fixes it: with `ssa.rs` unchanged and dxil-spirv unpatched, the 21 retail pipelines that killed workers all build ([test](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7146610700)), against 0 of 21 without it. So this PR doesn't fix #1805's crash as far as I can tell. The deep-join recursion it removes is real on small stacks (vitor127wt's 2 MiB runs), so it may still be worth having as hardening. I haven't tested this PR against those 21. Sorry for the misdirection. **AI use** - Claude Code (Claude Opus 5.5) wrote this comment.
throny commented 2026-11-25 01:11:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-25T01:02:00Z.


Two contributors checked independently and found that #1844 solves the same problem (for #1805) in a different way: #1607, group D70. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.

This is a hint from the community triage in #1607, not a maintainer decision.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

<!-- greyfinch-sync:ivall/xcl:comment:7149136606 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1852#issuecomment-7149136606). Originally posted by [throny](https://github.com/throny) on 2026-11-25T01:02:00Z. --- <!-- xcl-1607-hint:D70 --> Two contributors checked independently and found that #1844 solves the same problem (for #1805) in a different way: #1607, group D70. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
DavidM1911 commented 2026-11-25 02:08:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T01:28:44Z.


Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7149591542 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1852#issuecomment-7149591542). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T01:28:44Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
CalvyPZ commented 2026-11-25 23:09:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by CalvyPZ on 2026-11-25T22:43:15Z.


This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.

<!-- greyfinch-sync:ivall/xcl:comment:7176707849 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1852#issuecomment-7176707849). Originally posted by [CalvyPZ](https://github.com/CalvyPZ) on 2026-11-25T22:43:15Z. --- This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.
DavidM1911 commented 2026-11-26 01:05:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T00:34:57Z.


Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current main on the new head — needs another rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7178905370 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1852#issuecomment-7178905370). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T00:34:57Z. --- Re-verification on RTX 3060 Ti (Windows 11): still a **merge conflict with current `main`** on the new head — needs another rebase before it can be tested.
fixgep commented 2026-11-26 05:05:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fixgep on 2026-11-26T04:37:54Z.


@DavidM1911 Rebased onto main (b49be183, new HEAD 2a6feac2) and resolved the conflicts in graphics.rs and kernel.rs

<!-- greyfinch-sync:ivall/xcl:comment:7182762602 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1852#issuecomment-7182762602). Originally posted by [fixgep](https://github.com/fixgep) on 2026-11-26T04:37:54Z. --- @DavidM1911 Rebased onto `main` (`b49be183`, new HEAD `2a6feac2`) and resolved the conflicts in `graphics.rs` and `kernel.rs`
Kalmarv commented 2026-11-29 00:55:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T00:55:26Z.


merge-check
base: fa204595a4
head: 2a6feac292
merge: clean as text (trial merge fa9e8773a02e15d0d153a5ebd8f0139903c8bcb8, local, not pushed; git diff --check clean), but it does not build as a test on current main (see tests)
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_DXC_DIR = DXC 1.9.2609) on the merge as it is -> lib test target fails to compile: error[E0425]: cannot find value TABLE_WORDS_WAVE32 in module crate::gpu::dxil::compact at kernel.rs:1436. The new deep_branch_chain_compiles_on_bounded_stack passes compact::TABLE_WORDS_WAVE32 as the last argument of translate_on_this_thread; main 3cde0cc3 ("Recompiler: use larger compact tables on every GPU") removed that constant and the parameter is now rodata: Vec<(u32, Vec<u32>)>. With that one argument changed to Vec::new() locally (6294eda7, not pushed) -> 2613 passed, 0 failed, 49 ignored; SKIPPED: 26 (21 no wave64 on this 32-lane GPU, 3 per-lane f16/f32 forms refused (#1426 semantics), 2 no heap windows); failing: none. All five new tests ran and passed: ssa::tests::deep_join_chain_does_not_overflow_stack, ssa::tests::deep_region_join_and_loop_phi_preserve_semantics, graphics::tests::deep_phi_deps_do_not_overflow_stack, graphics::tests::deep_shared_root_loads_borrow_store_list_without_quadratic_children, kernel::tests::deep_branch_chain_compiles_on_bounded_stack. I did not check that they overflow without the change.
review: whole diff read (ssa.rs, graphics.rs, graphics_tests.rs, kernel.rs, module/opt.rs). Only blocker: the stale test call above. Ssa::read as an explicit frame stack matches main's recursion: same cache lookups, predecessor order, visiting marker, and trivial-phi removal. eval_dep in compute_deps matches the old block_deps / value_deps pair: children are visited in the same order (block: each ctrl edge's cond, then the edge block if it is not itself; loadInput: the row value only when the row is not constant, after the row components; other calls: args; phi: value, incoming block, its cond; load: pointer, then the root's stores; other: operands). Sets::known / open / close happen at the same points, and a non-instruction value still returns an empty set without touching Sets. Calls and loads borrow their argument / store slices instead of copying them, so live child storage stays linear (the new peak-children test checks this). is_const_global_ptr as a loop is equivalent. Context: #1607 group D70 lists #1844 (same goal, a different approach) as a duplicate, and #1805's crash was traced to dxil-spirv (#1860), so this PR alone may not close #1805.
performance: no default cost expected: the same work in the same order, with heap frames instead of stack frames. Not measured. No title run, because the merge does not build its tests on main; the head will change.
verdict: not yet: the new kernel test does not compile on current main (TABLE_WORDS_WAVE32 was removed by 3cde0cc3); rebase and pass Vec::new() (rodata) instead. With that change the suite passes here and I found no other issue.
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, wave32 only), AMD Ryzen 9 9950X, Windows 11 build 26200; rustc 1.99.0, debug test profile, DXC 1.9.2609 via XCL_DXC_DIR. Claude Code, Claude Opus 5.5: merge, build, suite and full-diff review; this report.

<!-- greyfinch-sync:ivall/xcl:comment:7248443959 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1852#issuecomment-7248443959). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-29T00:55:26Z. --- merge-check base: fa204595a488c60c6c5f905244f0172072c9c2a9 head: 2a6feac29252a49af8553ed459f71b00883cde6d merge: clean as text (trial merge fa9e8773a02e15d0d153a5ebd8f0139903c8bcb8, local, not pushed; `git diff --check` clean), but it does not build as a test on current main (see tests) build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_DXC_DIR = DXC 1.9.2609) on the merge as it is -> lib test target fails to compile: `error[E0425]: cannot find value TABLE_WORDS_WAVE32 in module crate::gpu::dxil::compact` at `kernel.rs:1436`. The new `deep_branch_chain_compiles_on_bounded_stack` passes `compact::TABLE_WORDS_WAVE32` as the last argument of `translate_on_this_thread`; main 3cde0cc3 ("Recompiler: use larger compact tables on every GPU") removed that constant and the parameter is now `rodata: Vec<(u32, Vec<u32>)>`. With that one argument changed to `Vec::new()` locally (6294eda7, not pushed) -> 2613 passed, 0 failed, 49 ignored; SKIPPED: 26 (21 no wave64 on this 32-lane GPU, 3 per-lane f16/f32 forms refused (#1426 semantics), 2 no heap windows); failing: none. All five new tests ran and passed: `ssa::tests::deep_join_chain_does_not_overflow_stack`, `ssa::tests::deep_region_join_and_loop_phi_preserve_semantics`, `graphics::tests::deep_phi_deps_do_not_overflow_stack`, `graphics::tests::deep_shared_root_loads_borrow_store_list_without_quadratic_children`, `kernel::tests::deep_branch_chain_compiles_on_bounded_stack`. I did not check that they overflow without the change. review: whole diff read (ssa.rs, graphics.rs, graphics_tests.rs, kernel.rs, module/opt.rs). Only blocker: the stale test call above. `Ssa::read` as an explicit frame stack matches main's recursion: same cache lookups, predecessor order, visiting marker, and trivial-phi removal. `eval_dep` in `compute_deps` matches the old `block_deps` / `value_deps` pair: children are visited in the same order (block: each ctrl edge's cond, then the edge block if it is not itself; loadInput: the row value only when the row is not constant, after the row components; other calls: args; phi: value, incoming block, its cond; load: pointer, then the root's stores; other: operands). `Sets::known` / `open` / `close` happen at the same points, and a non-instruction value still returns an empty set without touching `Sets`. Calls and loads borrow their argument / store slices instead of copying them, so live child storage stays linear (the new peak-children test checks this). `is_const_global_ptr` as a loop is equivalent. Context: #1607 group D70 lists #1844 (same goal, a different approach) as a duplicate, and #1805's crash was traced to dxil-spirv (#1860), so this PR alone may not close #1805. performance: no default cost expected: the same work in the same order, with heap frames instead of stack frames. Not measured. No title run, because the merge does not build its tests on main; the head will change. verdict: not yet: the new kernel test does not compile on current main (TABLE_WORDS_WAVE32 was removed by 3cde0cc3); rebase and pass `Vec::new()` (rodata) instead. With that change the suite passes here and I found no other issue. hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, wave32 only), AMD Ryzen 9 9950X, Windows 11 build 26200; rustc 1.99.0, debug test profile, DXC 1.9.2609 via XCL_DXC_DIR. Claude Code, Claude Opus 5.5: merge, build, suite and full-diff review; this report.
Foniass commented 2026-12-01 06:59:36 +00:00 (Migrated from github.com)

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


Triage (#1607) – head 1fbdea9

After the rebase (1fbdea91) the ssa.rs part only adds a deep-join test; Ssa::read itself is main's (#1844). The commit is still titled "make Ssa::read iterative", which no longer matches what it changes. The rest is not on main: compute_deps in graphics.rs (block_deps / value_deps are still recursive there), the loop in module/opt.rs is_const_global_ptr, and the bounded-stack tests. The explicit-stack eval_dep keeps the old child order and the Sets open/close fixpoint. #1860 takes a different approach (one back edge per loop head for dxil-spirv) and is not a duplicate. The branch now merges cleanly into main.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7303518614 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1852#issuecomment-7303518614). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:59:36Z. --- **Triage (#1607)** – head 1fbdea9 After the rebase (1fbdea91) the `ssa.rs` part only adds a deep-join test; `Ssa::read` itself is main's (#1844). The commit is still titled "make Ssa::read iterative", which no longer matches what it changes. The rest is not on main: `compute_deps` in `graphics.rs` (`block_deps` / `value_deps` are still recursive there), the loop in `module/opt.rs` `is_const_global_ptr`, and the bounded-stack tests. The explicit-stack `eval_dep` keeps the old child order and the `Sets` open/close fixpoint. #1860 takes a different approach (one back edge per loop head for dxil-spirv) and is not a duplicate. The branch now merges cleanly into main. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
fixgep commented 2026-12-01 16:46:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fixgep on 2026-12-01T16:46:10Z.


Thanks @Foniass and @Kalmarv! Rebased onto upstream/main (6bfb5c51):

  • Dropped the redundant Ssa::read rewrite in crates/xcl/src/gpu/dxil/ssa.rs in favor of #1844, while keeping the two bounded-stack tests (deep_join_chain_does_not_overflow_stack and deep_region_join_and_loop_phi_preserve_semantics).
  • Updated eval_dep in graphics.rs for upstream/main's (Vec<Value>, usize) root_stores entries (borrowing via DepChildren::Writes and handling InstInfo::Atomic).
  • Switched deep_branch_chain_compiles_on_bounded_stack in kernel.rs from the removed compact::TABLE_WORDS_WAVE32 to Vec::new() (and 0 for ps_rt32_mask).
  • Re-verified the DXIL unit suites on RTX 3060 and WARP, plus paired 60s smoke.ps1 runs.
<!-- greyfinch-sync:ivall/xcl:comment:7318193477 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1852#issuecomment-7318193477). Originally posted by [fixgep](https://github.com/fixgep) on 2026-12-01T16:46:10Z. --- Thanks `@Foniass` and `@Kalmarv`! Rebased onto `upstream/main` (`6bfb5c51`): - Dropped the redundant `Ssa::read` rewrite in `crates/xcl/src/gpu/dxil/ssa.rs` in favor of `#1844`, while keeping the two bounded-stack tests (`deep_join_chain_does_not_overflow_stack` and `deep_region_join_and_loop_phi_preserve_semantics`). - Updated `eval_dep` in `graphics.rs` for `upstream/main`'s `(Vec<Value>, usize)` `root_stores` entries (borrowing via `DepChildren::Writes` and handling `InstInfo::Atomic`). - Switched `deep_branch_chain_compiles_on_bounded_stack` in `kernel.rs` from the removed `compact::TABLE_WORDS_WAVE32` to `Vec::new()` (and `0` for `ps_rt32_mask`). - Re-verified the DXIL unit suites on RTX 3060 and WARP, plus paired 60s `smoke.ps1` runs.
fromthemoonx commented 2026-12-01 16:59:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-01T16:59:32Z.


merge-check
base: 6bfb5c5153
head: 1fbdea91a5
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2909 passed, 0 failed, 51 ignored (base: 2904); SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same set as base; failing: none from this PR. The counts are the lib binary's clean run (2761 passed, 0 failed, 31 ignored) plus the other binaries (148 passed, 0 failed, 20 ignored). How the runs went:

  • The first two whole-suite runs ended the lib binary with 0xc0000005 during eh::tests::thread_dumps_while_threads_run_and_exit (after 7 and 5 of its 40 dumps). That is #3586: it is on main too, and this PR does not touch eh.rs.
  • Then the lib binary 4 times on each tree, alternating:
    • main: 4 of 4 ok.
    • this merge: 3 of 4 ok. The 4th failed title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels ("superseded unaligned extra_pages must be reclaimed immediately", a device-wide page count), plus 3 tests of that module poisoned by the shared TEST_LOCK.
    • That test passed alone 3 of 3 and its module 10 of 10 at 8 threads on both trees. #2591 is the open fix for it; not this PR.
      review: read the whole diff (5 files, +463 -74). No correctness problem found.
  • compute_deps: the explicit frame stack visits children in the same order as the old block_deps / value_deps recursion:
    • for a block, each control parent's condition and then the parent;
    • for a phi, value, block and condition;
    • for a load, the pointer and then each store's operands and block.
      It calls Sets::known / open / close at the same points, so cuts and fixpoint passes are unchanged. Writes borrows the store lists instead of copying them.
  • is_const_global_ptr: the loop returns the same answers as the recursion.
  • Mutation: main's recursive graphics.rs and opt.rs with the PR's tests (plus a shim for compute_deps_with_peak). gpu::dxil::graphics::tests::deep_phi_deps_do_not_overflow_stack and deep_shared_root_loads_borrow_store_list_without_quadratic_children each abort with "has overflowed its stack" on their 2 MiB thread. Good.
  • The three other new tests pass with that mutation too: ssa::tests::deep_join_chain_does_not_overflow_stack, ssa::tests::deep_region_join_and_loop_phi_preserve_semantics and kernel::tests::deep_branch_chain_compiles_on_bounded_stack. They guard #1844's iterative Ssa::read, already on main, not this PR's code. No test reaches a deep GEP chain in is_const_global_ptr.
  • Minor: the first commit's subject is still "Direct DXIL: make Ssa::read iterative to avoid stack overflow (#1805)". After the rebase it no longer changes Ssa::read; it changes compute_deps.
  • No retail title on this machine: no real deep shader was translated here.
    performance: not measured. The same work per node, with frames on the heap instead of the stack. peak_children is counted on every call, including in production, which is a few additions.
    verdict: safe to merge
    hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
<!-- greyfinch-sync:ivall/xcl:comment:7318572259 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1852#issuecomment-7318572259). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-12-01T16:59:32Z. --- merge-check base: 6bfb5c5153ccc23517daf30aa1071ddb0fadb53c head: 1fbdea91a556b73e503baab65aa24235193115d2 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2909 passed, 0 failed, 51 ignored (base: 2904); SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same set as base; failing: none from this PR. The counts are the lib binary's clean run (2761 passed, 0 failed, 31 ignored) plus the other binaries (148 passed, 0 failed, 20 ignored). How the runs went: - The first two whole-suite runs ended the lib binary with 0xc0000005 during `eh::tests::thread_dumps_while_threads_run_and_exit` (after 7 and 5 of its 40 dumps). That is #3586: it is on main too, and this PR does not touch `eh.rs`. - Then the lib binary 4 times on each tree, alternating: - main: 4 of 4 ok. - this merge: 3 of 4 ok. The 4th failed `title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels` ("superseded unaligned extra_pages must be reclaimed immediately", a device-wide page count), plus 3 tests of that module poisoned by the shared `TEST_LOCK`. - That test passed alone 3 of 3 and its module 10 of 10 at 8 threads on both trees. #2591 is the open fix for it; not this PR. review: read the whole diff (5 files, +463 -74). No correctness problem found. - `compute_deps`: the explicit frame stack visits children in the same order as the old `block_deps` / `value_deps` recursion: - for a block, each control parent's condition and then the parent; - for a phi, value, block and condition; - for a load, the pointer and then each store's operands and block. It calls `Sets::known` / `open` / `close` at the same points, so cuts and fixpoint passes are unchanged. `Writes` borrows the store lists instead of copying them. - `is_const_global_ptr`: the loop returns the same answers as the recursion. - Mutation: main's recursive `graphics.rs` and `opt.rs` with the PR's tests (plus a shim for `compute_deps_with_peak`). `gpu::dxil::graphics::tests::deep_phi_deps_do_not_overflow_stack` and `deep_shared_root_loads_borrow_store_list_without_quadratic_children` each abort with "has overflowed its stack" on their 2 MiB thread. Good. - The three other new tests pass with that mutation too: `ssa::tests::deep_join_chain_does_not_overflow_stack`, `ssa::tests::deep_region_join_and_loop_phi_preserve_semantics` and `kernel::tests::deep_branch_chain_compiles_on_bounded_stack`. They guard #1844's iterative `Ssa::read`, already on main, not this PR's code. No test reaches a deep GEP chain in `is_const_global_ptr`. - Minor: the first commit's subject is still "Direct DXIL: make Ssa::read iterative to avoid stack overflow (#1805)". After the rebase it no longer changes `Ssa::read`; it changes `compute_deps`. - No retail title on this machine: no real deep shader was translated here. performance: not measured. The same work per node, with frames on the heap instead of the stack. `peak_children` is counted on every call, including in production, which is a few additions. verdict: safe to merge hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
Decodere commented 2026-12-02 08:07:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T08:07:09Z.


merge-check
base: 1c8b551475
head: 1fbdea91a5
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2913 passed, 1 failed, 51 ignored; SKIPPED: 28 (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); failing: tests/gpu_two_pass_cache_e2e.rs :: two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (pre-existing on clean base 1c8b5514: 2908 passed, 1 failed, 51 ignored, identical 28 SKIPPED). All 5 new bounded-stack tests pass (+5 vs base).
review: Full merged diff read (5 files, +463/-74). No blocking findings. eval_dep in graphics.rs preserves the exact visit order and Sets::{known, open, close} fixpoint semantics of recursive block_deps/value_deps with zero-copy DepChildren::{Values, Writes} cursors so shared-root load/store graphs avoid quadratic child storage, and is_const_global_ptr in module/opt.rs is an exact iterative equivalent. Minor non-blocking notes: commit 1's subject still mentions Ssa::read although ssa.rs only adds tests here (iterative Ssa::read is already on main), and open PR #3646 also rewrites graphics.rs::compute_deps. Untested: AMD/native wave64 GPUs, D3D12 debug layer, and retail smoke (Tier 1 compiler pass, not required by TESTING.md).
performance: Negligible on normal shaders; replaces call-stack recursion with a heap Vec frame stack and zero-copy borrowed slices for Call/Load children, preventing stack overflow on deep CFGs without quadratic child copies (reasoned; linear peak_live_children verified by unit test).
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:7339025885 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1852#issuecomment-7339025885). Originally posted by [Decodere](https://github.com/Decodere) on 2026-12-02T08:07:09Z. --- merge-check base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: 1fbdea91a556b73e503baab65aa24235193115d2 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2913 passed, 1 failed, 51 ignored; SKIPPED: 28 (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); failing: tests/gpu_two_pass_cache_e2e.rs :: two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (pre-existing on clean base 1c8b5514: 2908 passed, 1 failed, 51 ignored, identical 28 SKIPPED). All 5 new bounded-stack tests pass (+5 vs base). review: Full merged diff read (5 files, +463/-74). No blocking findings. eval_dep in graphics.rs preserves the exact visit order and Sets::{known, open, close} fixpoint semantics of recursive block_deps/value_deps with zero-copy DepChildren::{Values, Writes} cursors so shared-root load/store graphs avoid quadratic child storage, and is_const_global_ptr in module/opt.rs is an exact iterative equivalent. Minor non-blocking notes: commit 1's subject still mentions Ssa::read although ssa.rs only adds tests here (iterative Ssa::read is already on main), and open PR #3646 also rewrites graphics.rs::compute_deps. Untested: AMD/native wave64 GPUs, D3D12 debug layer, and retail smoke (Tier 1 compiler pass, not required by TESTING.md). performance: Negligible on normal shaders; replaces call-stack recursion with a heap Vec frame stack and zero-copy borrowed slices for Call/Load children, preventing stack overflow on deep CFGs without quadratic child copies (reasoned; linear peak_live_children verified by unit test). 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)
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/1852:upstream-pr/1852'
git switch 'upstream-pr/1852'

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/1852'
git switch 'upstream-pr/1852'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1852'
git switch 'upstream-pr/1852'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1852'
git switch 'main'
git merge --squash 'upstream-pr/1852'
git switch 'main'
git merge --ff-only 'upstream-pr/1852'
git switch 'main'
git merge 'upstream-pr/1852'
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!1842
No description provided.