Recompiler: direct DXIL gives every loop head and block one back edge #1860

Open
github-bot wants to merge 3 commits from github-bot/gh-1860 into main AGit
Owner

@⁠Royalflamejlh on GitHub · 2026-11-24 22:03 UTC · original
Royalflamejlh:linux/direct-single-latch → main · +197 −2 · 3 files · 3 commits · open

On Linux, vkd3d-proton's dxil-spirv segfaults on 77 of the retail title's 2,682 direct-DXIL compute programs in the split wave64 form. The direct backend now gives every loop head and every block one back edge, and dxil-spirv as it is converts all of them. Part of #1805.

dxil-spirv keeps one back edge per loop head. Its main pass merges several first, but the pass it runs for shaders with wave shuffles analyses the CFG before that, and a second back edge then sends its dominator computation into endless recursion. A block with back edges to two loop heads keeps the second among its forward successors, which its loop tracer then follows without end (my reading of the code; not checked per program). The detail is in this comment on #1805.

What is in it

  • crates/xcl/src/gpu/dxil/cfg.rs: single_latch, called from Cfg::build_with after make_reducible. A loop head with several back edges, or one whose back edge leaves a block that has a second, gets a new empty block that jumps to it and takes those edges; the block takes the head's pc, as make_reducible's copies take their original's. Two unit tests.
  • crates/xcl/src/gpu/dxil/module/opt.rs: simplify_cfg (#2194) no longer bypasses an empty block along a back edge, so those blocks stay. One unit test, red without it.

Tested

  • Head bb2165b9, on main 2898511a: the change 837582c4; f0b6ff84, a test by @⁠anes66 from their companion commit b780cdd; and bb2165b9, which keeps the latch blocks from #2194's simplify_cfg: it bypassed them, an empty [Br(t)] block with one incoming edge being bypassed even when t has phis, so a block had back edges to two loop heads again. Rebased from 1160f92 on 689f2db and twice more today as main moved (the last time beside #2279's new test in module/opt.rs); the first two commits are unchanged. @⁠anes66's test: latch_blocks_preserve_loop_registers_on_the_gpu runs two loop shapes (two returns to one head; a nested loop with returns to either head) through the direct translator in wave32 and split wave64 and compares the registers with HLSL + DXC and with expected values. The other half of that commit, a bump of the direct translator's cache version, is not taken: since #1947 (merged) the cache entries change when the gpu/dxil sources do.
  • RTX 2070 SUPER 8 GB (Windows 11 Pro 26200, driver 621.01), debug, at bb2165b9: cargo test --workspace -- latch simplify_cfg a_block_keeps --test-threads=1, 9 passed, 0 failed, the GPU one among them (1 run). At bcc71b6 (the same three commits on main 426a5a7), with XCL_DIRECT_DXIL=1, cargo test --workspace -- gpu_ --test-threads=4: 145 passed (2 of them print SKIPPED: no wave64), 0 failed, 1 ignored, the same on main 426a5a7 (1 run each). Earlier, on an RTX 5070 Ti (Windows 11, driver 621.24, debug) at 1160f92: cargo test --workspace -- latch --test-threads=1, 2 passed, 0 failed.
  • No GPU: Ryzen 9 9950X3D, Fedora 44, Wine 11.21 Staging with Mesa lavapipe only, rustc 1.98.0, release, cross-compiled to x86_64-pc-windows-gnu; in the prefix, vkd3d-proton v3.1-90-g30b0eb9b with #175's patch, the build of the bullets below. cargo test --workspace --release --target x86_64-pc-windows-gnu --no-fail-fast -- --test-threads=4 --skip d32s8 --skip reservable_agrees_with_the_driver at bb2165b9: 1,356 passed, 9 failed, 46 ignored. The same command on main 2898511a: 1,352 passed, 9 failed, 46 ignored. The same 9 fail on both (a_tile_decommitted_and_committed_again_keeps_its_video_memory, directed_reference_basics, disk_free_space_ex_reports_pls_quota, fence_and_command_queue_sync_timing_and_allocator_reset_match_host_and_console, gpu_depth_buffer_created_for_unordered_access_is_placed, gpu_promoted_uav_clear_values_pass_create_committed_resource, split_compute_program_prebuilds_and_caches_chain_pieces, stale_blob_cannot_bypass_the_offline_pipeline_cap, test_title_runs_and_game_folder_is_untouched); the 4 more that pass are the new tests. The two tests skipped by name did not finish under Wine in our earlier runs of main. SKIPPED GPU tests: 351 lines on main, 352 here (the new GPU test, which needs a card). 1 run each.
  • RTX 4060 Ti (driver 615.71.09), the same Wine with vkd3d-proton v3.1-90-g30b0eb9b, on d812f24 before the rebase: cargo test --release -p xcl --lib --target x86_64-pc-windows-gnu -- gpu_ gpu::dxil coverage --test-threads=4: 188 passed, 1 failed, 3 ignored; the failure is gpu_depth_buffer_created_for_unordered_access_is_placed, which fails on main under Wine too. SKIPPED: the two "no wave64" tests.
  • Retail title 1.0.2.1, xcl shaders shaders.rpf --precompile --only cs --split 1 with XCL_DIRECT_DXIL=1 (the split wave64 form), at main 3f277701 and at this branch on it (90c578f9; its gpu/dxil sources are those of bb2165b9, and main 2898511a changes none there); every program and every compute-split piece after it (2,682 programs, 7,914 pieces) through dxil-spirv 34f0ff8 (the one in that vkd3d-proton), built natively, with the options vkd3d-proton passes, 300 s limit, 1 pass each. Segfaults: 62 on main (57 programs, 5 pieces), 0 at this head; none at the limit (95cc13288a27a96e is 1.2 MB since #2076 and converts in 0.6 s). 121 programs' DXIL changes against main, 21,448 bytes more in 879 MB. Of the 62 new SPIR-V outputs, 61 pass spirv-val --target-env vulkan1.3; c458137fcd97caf3's second piece fails as the five programs #2082 fixes do, and passes with #2082 merged too (0 of 10,614 invalid with both, on main 50a9fde). Since #2120 three of the 57 programs take the direct translator without XCL_DIRECT_DXIL too: c963276f38285bf4, f839072880d49fb4 and 219287eb2f6021fe (over 8 MB of HLSL each). Before, on main 426a5a7 (no split yet): 57 segfaults, 7 with the first two commits, 0 with all three; on main 689f2db: 77 and 0.
  • dxil-spirv's own master b540c8a2, which vkd3d-proton's master carries since today (89439562; its latest release, v3.1, carries an older one), converts all 11,115 of main b49be183's direct programs and pieces without this change: 0 segfaults (1 pass; the standard kit's 34f0ff8: 42). So this change is for vkd3d-proton v3.1 and other builds with an older dxil-spirv, until they move.

Regression run

Windows 11 Pro 26200, RTX 2070 SUPER 8 GB (driver 621.01), Ryzen 7 5700X3D; the title's first-run screens completed once, no story progress, no input; 1 run each, back to back.

main:

xcl-smoke v1
commit: 2898511af1c038a2ef809719e9b6f89e5675c422
gpu: NVIDIA GeForce RTX 2070 SUPER
title: 5330474d
seconds: 60
exit: 0x0
frames shown: 1380 (PresentX 1380)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13984 MB

PR:

xcl-smoke v1
commit: bb2165b96310d6581c2144c7f6e1e95f682c6b53
gpu: NVIDIA GeForce RTX 2070 SUPER
title: 5330474d
seconds: 60
exit: 0x0
frames shown: 1428 (PresentX 1428)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14005 MB

Under Wine on an RTX 4060 Ti 16 GB (driver 615.71.09), before the rebase: 1558 frames on main c4d37be and 1568 on d812f24, 0 device removals and 0 crashes in both.

The title with XCL_DIRECT_DXIL=1 under Wine + vkd3d-proton v3.1-90-g30b0eb9b (its own dxil-spirv, unpatched for this), RTX 4070 12 GB, 120 s, main c4d37be + #684 with and without d812f24: with it 121 and 230 compute pipelines were made by 120 s (2 runs) and Wine logged no stack overflow; without it 23, and one virtual_setup_exception stack overflow line (1 run). Presents stop at about 80 to 93 s either way.

On nvidia-dev

  • It does not merge into nvidia-dev af2cecc4: both add code at the same places in cfg.rs. The same three commits on it, both sides kept: linux/direct-single-latch-nvidia-dev 76558f92.
  • Its compute programs with XCL_DIRECT_DXIL=1 in the split wave64 form (2,682 programs, 9,488 pieces) through dxil-spirv 34f0ff8 natively, 1 pass each: 26 programs segfault on af2cecc4, none with these commits; no output fails spirv-val in either. (On the older c044dc6d: 52 and none.)
  • cargo test --release -p xcl --lib -- gpu::dxil under Wine, no GPU: 200 passed, 1 failed with them; 196 passed, 1 failed on af2cecc4. The failure is directed_reference_basics in both.

Not tested

  • Whether the 122 changed retail programs compute the same on a GPU (the new test compares two synthetic loop shapes).
  • AMD. On Windows only the regression run above, by us; @⁠upipibi's comment below has the GPU tests on Windows with an RTX 3070.
  • Pixel and vertex programs through the direct backend (--only cs).
  • xcl pipelines, the path #1805 reports, by us; @⁠itsd-effex's comment below has it on an RTX 3080 Ti with unpatched dxil-spirv.

AI use

  • Claude Code (Claude Fable 5.2) found the cause, wrote the change, the tests and this description, and ran the tests and the measurements.
  • Claude Code (Claude Opus 5.5) found that #2194 undid it, wrote bb2165b9 and its test, rebased the branch and made its nvidia-dev copy, updated this description, and ran the tests and the measurements on today's main and on nvidia-dev.
**@⁠Royalflamejlh** on GitHub · 2026-11-24 22:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860) `Royalflamejlh:linux/direct-single-latch` → `main` · +197 −2 · 3 files · 3 commits · open On Linux, vkd3d-proton's dxil-spirv segfaults on 77 of the retail title's 2,682 direct-DXIL compute programs in the split wave64 form. The direct backend now gives every loop head and every block one back edge, and dxil-spirv as it is converts all of them. Part of #1805. dxil-spirv keeps one back edge per loop head. Its main pass merges several first, but the pass it runs for shaders with wave shuffles analyses the CFG before that, and a second back edge then sends its dominator computation into endless recursion. A block with back edges to two loop heads keeps the second among its forward successors, which its loop tracer then follows without end (my reading of the code; not checked per program). The detail is in [this comment on #1805](https://git.gtahub.st/github/xcl-dev--xcl/issues/1805). **What is in it** - `crates/xcl/src/gpu/dxil/cfg.rs`: `single_latch`, called from `Cfg::build_with` after `make_reducible`. A loop head with several back edges, or one whose back edge leaves a block that has a second, gets a new empty block that jumps to it and takes those edges; the block takes the head's `pc`, as `make_reducible`'s copies take their original's. Two unit tests. - `crates/xcl/src/gpu/dxil/module/opt.rs`: `simplify_cfg` (#2194) no longer bypasses an empty block along a back edge, so those blocks stay. One unit test, red without it. **Tested** - Head `bb2165b9`, on `main` `2898511a`: the change `837582c4`; `f0b6ff84`, a test by @⁠anes66 from their companion commit `b780cdd`; and `bb2165b9`, which keeps the latch blocks from #2194's `simplify_cfg`: it bypassed them, an empty `[Br(t)]` block with one incoming edge being bypassed even when `t` has phis, so a block had back edges to two loop heads again. Rebased from `1160f92` on `689f2db` and twice more today as `main` moved (the last time beside #2279's new test in `module/opt.rs`); the first two commits are unchanged. @⁠anes66's test: `latch_blocks_preserve_loop_registers_on_the_gpu` runs two loop shapes (two returns to one head; a nested loop with returns to either head) through the direct translator in wave32 and split wave64 and compares the registers with HLSL + DXC and with expected values. The other half of that commit, a bump of the direct translator's cache version, is not taken: since #1947 (merged) the cache entries change when the `gpu/dxil` sources do. - RTX 2070 SUPER 8 GB (Windows 11 Pro 26200, driver 621.01), debug, at `bb2165b9`: `cargo test --workspace -- latch simplify_cfg a_block_keeps --test-threads=1`, 9 passed, 0 failed, the GPU one among them (1 run). At `bcc71b6` (the same three commits on `main` `426a5a7`), with `XCL_DIRECT_DXIL=1`, `cargo test --workspace -- gpu_ --test-threads=4`: 145 passed (2 of them print SKIPPED: no wave64), 0 failed, 1 ignored, the same on `main` `426a5a7` (1 run each). Earlier, on an RTX 5070 Ti (Windows 11, driver 621.24, debug) at `1160f92`: `cargo test --workspace -- latch --test-threads=1`, 2 passed, 0 failed. - No GPU: Ryzen 9 9950X3D, Fedora 44, Wine 11.21 Staging with Mesa lavapipe only, rustc 1.98.0, release, cross-compiled to `x86_64-pc-windows-gnu`; in the prefix, vkd3d-proton v3.1-90-g30b0eb9b with #175's patch, the build of the bullets below. `cargo test --workspace --release --target x86_64-pc-windows-gnu --no-fail-fast -- --test-threads=4 --skip d32s8 --skip reservable_agrees_with_the_driver` at `bb2165b9`: 1,356 passed, 9 failed, 46 ignored. The same command on `main` `2898511a`: 1,352 passed, 9 failed, 46 ignored. The same 9 fail on both (`a_tile_decommitted_and_committed_again_keeps_its_video_memory`, `directed_reference_basics`, `disk_free_space_ex_reports_pls_quota`, `fence_and_command_queue_sync_timing_and_allocator_reset_match_host_and_console`, `gpu_depth_buffer_created_for_unordered_access_is_placed`, `gpu_promoted_uav_clear_values_pass_create_committed_resource`, `split_compute_program_prebuilds_and_caches_chain_pieces`, `stale_blob_cannot_bypass_the_offline_pipeline_cap`, `test_title_runs_and_game_folder_is_untouched`); the 4 more that pass are the new tests. The two tests skipped by name did not finish under Wine in our earlier runs of `main`. SKIPPED GPU tests: 351 lines on `main`, 352 here (the new GPU test, which needs a card). 1 run each. - RTX 4060 Ti (driver 615.71.09), the same Wine with vkd3d-proton v3.1-90-g30b0eb9b, on `d812f24` before the rebase: `cargo test --release -p xcl --lib --target x86_64-pc-windows-gnu -- gpu_ gpu::dxil coverage --test-threads=4`: 188 passed, 1 failed, 3 ignored; the failure is `gpu_depth_buffer_created_for_unordered_access_is_placed`, which fails on `main` under Wine too. SKIPPED: the two "no wave64" tests. - Retail title 1.0.2.1, `xcl shaders shaders.rpf --precompile --only cs --split 1` with `XCL_DIRECT_DXIL=1` (the split wave64 form), at `main` `3f277701` and at this branch on it (`90c578f9`; its `gpu/dxil` sources are those of `bb2165b9`, and `main` `2898511a` changes none there); every program and every compute-split piece after it (2,682 programs, 7,914 pieces) through dxil-spirv `34f0ff8` (the one in that vkd3d-proton), built natively, with the options vkd3d-proton passes, 300 s limit, 1 pass each. Segfaults: 62 on `main` (57 programs, 5 pieces), 0 at this head; none at the limit (`95cc13288a27a96e` is 1.2 MB since #2076 and converts in 0.6 s). 121 programs' DXIL changes against `main`, 21,448 bytes more in 879 MB. Of the 62 new SPIR-V outputs, 61 pass `spirv-val --target-env vulkan1.3`; `c458137fcd97caf3`'s second piece fails as the five programs #2082 fixes do, and passes with #2082 merged too (0 of 10,614 invalid with both, on `main` `50a9fde`). Since #2120 three of the 57 programs take the direct translator without `XCL_DIRECT_DXIL` too: `c963276f38285bf4`, `f839072880d49fb4` and `219287eb2f6021fe` (over 8 MB of HLSL each). Before, on `main` `426a5a7` (no split yet): 57 segfaults, 7 with the first two commits, 0 with all three; on `main` `689f2db`: 77 and 0. - dxil-spirv's own `master` `b540c8a2`, which vkd3d-proton's `master` carries since today (`89439562`; its latest release, v3.1, carries an older one), converts all 11,115 of `main` `b49be183`'s direct programs and pieces without this change: 0 segfaults (1 pass; the standard kit's `34f0ff8`: 42). So this change is for vkd3d-proton v3.1 and other builds with an older dxil-spirv, until they move. **Regression run** Windows 11 Pro 26200, RTX 2070 SUPER 8 GB (driver 621.01), Ryzen 7 5700X3D; the title's first-run screens completed once, no story progress, no input; 1 run each, back to back. main: ``` xcl-smoke v1 commit: 2898511af1c038a2ef809719e9b6f89e5675c422 gpu: NVIDIA GeForce RTX 2070 SUPER title: 5330474d seconds: 60 exit: 0x0 frames shown: 1380 (PresentX 1380) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13984 MB ``` PR: ``` xcl-smoke v1 commit: bb2165b96310d6581c2144c7f6e1e95f682c6b53 gpu: NVIDIA GeForce RTX 2070 SUPER title: 5330474d seconds: 60 exit: 0x0 frames shown: 1428 (PresentX 1428) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14005 MB ``` Under Wine on an RTX 4060 Ti 16 GB (driver 615.71.09), before the rebase: 1558 frames on `main` `c4d37be` and 1568 on `d812f24`, 0 device removals and 0 crashes in both. The title with `XCL_DIRECT_DXIL=1` under Wine + vkd3d-proton v3.1-90-g30b0eb9b (its own dxil-spirv, unpatched for this), RTX 4070 12 GB, 120 s, `main` `c4d37be` + #684 with and without `d812f24`: with it 121 and 230 compute pipelines were made by 120 s (2 runs) and Wine logged no stack overflow; without it 23, and one `virtual_setup_exception stack overflow` line (1 run). Presents stop at about 80 to 93 s either way. **On `nvidia-dev`** - It does not merge into `nvidia-dev` `af2cecc4`: both add code at the same places in `cfg.rs`. The same three commits on it, both sides kept: [`linux/direct-single-latch-nvidia-dev`](https://github.com/Royalflamejlh/xcl/tree/linux/direct-single-latch-nvidia-dev) `76558f92`. - Its compute programs with `XCL_DIRECT_DXIL=1` in the split wave64 form (2,682 programs, 9,488 pieces) through dxil-spirv `34f0ff8` natively, 1 pass each: 26 programs segfault on `af2cecc4`, none with these commits; no output fails spirv-val in either. (On the older `c044dc6d`: 52 and none.) - `cargo test --release -p xcl --lib -- gpu::dxil` under Wine, no GPU: 200 passed, 1 failed with them; 196 passed, 1 failed on `af2cecc4`. The failure is `directed_reference_basics` in both. **Not tested** - Whether the 122 changed retail programs compute the same on a GPU (the new test compares two synthetic loop shapes). - AMD. On Windows only the regression run above, by us; @⁠upipibi's comment below has the GPU tests on Windows with an RTX 3070. - Pixel and vertex programs through the direct backend (`--only cs`). - `xcl pipelines`, the path #1805 reports, by us; @⁠itsd-effex's comment below has it on an RTX 3080 Ti with unpatched dxil-spirv. **AI use** - Claude Code (Claude Fable 5.2) found the cause, wrote the change, the tests and this description, and ran the tests and the measurements. - Claude Code (Claude Opus 5.5) found that #2194 undid it, wrote `bb2165b9` and its test, rebased the branch and made its `nvidia-dev` copy, updated this description, and ran the tests and the measurements on today's `main` and on `nvidia-dev`.
vkd3d-proton's dxil-spirv keeps one back edge per loop head. Its main
pass merges several first, but flatten_subgroup_shuffles(), which runs
for shaders with wave shuffles (the split wave64 form), analyses the
CFG before that, and a second back edge then sends its dominator
computation into endless recursion: a stack overflow in d3d12core.dll
when the pipeline is made (#1805). The same happens for a block with
back edges to two loop heads.

Cfg::build now adds a block that jumps to the head and takes the back
edges, for a head with several and for one whose back edge leaves a
block that has a second.

Measured on the retail title's shaders.rpf, xcl shaders --precompile
--only cs --split 1 with XCL_DIRECT_DXIL=1, each program then through
dxil-spirv 34f0ff8 natively: 77 of 2,682 programs overflowed its stack
before, none does now. 79 programs change (those 77 and 2 more),
21,012 bytes more DXIL in 907 MB; the other 2,603 are the same bytes.

Part of #1805

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Two loop shapes (two returns to one head; a nested loop with returns to
either head), wave32 and split wave64, against HLSL + DXC and explicit
expected values. The test of anes66's companion commit b780cdd, taken
without its cache-version bump, which #1947 makes unnecessary.
simplify_cfg (#2194) bypasses an empty block that only jumps on, and the
latch blocks single_latch makes are such blocks: a block that had back
edges to two loop heads got both again, and the dxil-spirv in
vkd3d-proton segfaulted again on direct programs single_latch had fixed.
A block whose target comes no later in the reverse post-order is now
kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:07:31 +00:00
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 22:20 UTC · original

On real hardware: RTX 3070 8 GB (32-lane waves, split wave64), driver 616.56, Windows 11, debug.

It no longer builds on main 689f2db. ee85bc2 added CfgBlock::pc since this PR's base, and the new latch block doesn't set it:

error[E0063]: missing field `pc` in initializer of `cfg::CfgBlock`
   --> crates\xcl\src\gpu\dxil\cfg.rs:246:21

Locally I used the loop head's offset, as main's split copies take their original's (pc: blocks[h].pc).

With that, XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu_ --skip gpu_sparse_vram --test-threads=4:

  • main 689f2db: 110 passed, 0 failed, 1 ignored (2 of 2 runs);
  • this PR: 110 passed, 0 failed, 1 ignored. The two new cfg tests and loop_entered_in_the_middle_is_split pass.

(gpu_sparse_vram_descriptors_buffers_and_xmem was skipped because of the #1727 parallel hang, not this PR.)

AI-assisted (Claude Code). Synthetic tests only.

**@⁠upipibi** on GitHub · 2026-11-24 22:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7146112330) On real hardware: RTX 3070 8 GB (32-lane waves, split wave64), driver 616.56, Windows 11, debug. **It no longer builds on `main` `689f2db`.** ee85bc2 added `CfgBlock::pc` since this PR's base, and the new latch block doesn't set it: ``` error[E0063]: missing field `pc` in initializer of `cfg::CfgBlock` --> crates\xcl\src\gpu\dxil\cfg.rs:246:21 ``` Locally I used the loop head's offset, as main's split copies take their original's (`pc: blocks[h].pc`). With that, `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu_ --skip gpu_sparse_vram --test-threads=4`: - `main` `689f2db`: 110 passed, 0 failed, 1 ignored (2 of 2 runs); - this PR: 110 passed, 0 failed, 1 ignored. The two new `cfg` tests and `loop_entered_in_the_middle_is_split` pass. (`gpu_sparse_vram_descriptors_buffers_and_xmem` was skipped because of the #1727 parallel hang, not this PR.) AI-assisted (Claude Code). Synthetic tests only.
Author
Owner

@⁠Royalflamejlh on GitHub · 2026-11-24 22:43 UTC · original

@⁠upipibi thank you: rebased onto 689f2db, with pc: blocks[h].pc for the latch block as you had it. It builds there, the three cfg tests pass, and the suite under Wine without a card gives 971 passed, 4 failed, 45 ignored against 969 / 4 / 45 on 689f2db, the same 4 failing (1 run each). The 2,682 compute programs it makes with XCL_DIRECT_DXIL=1 are byte for byte those from before the rebase.

Yours is the only run of it on Windows so far. The description has the new counts; the smoke block for the new head is to come.

AI use: Claude Code (Claude Fable 5.2) made the rebase, ran the tests and wrote this.

Posted without review by a person: the account owner was away and reads replies later.

**@⁠Royalflamejlh** on GitHub · 2026-11-24 22:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7146576268) @⁠upipibi thank you: rebased onto `689f2db`, with `pc: blocks[h].pc` for the latch block as you had it. It builds there, the three `cfg` tests pass, and the suite under Wine without a card gives 971 passed, 4 failed, 45 ignored against 969 / 4 / 45 on `689f2db`, the same 4 failing (1 run each). The 2,682 compute programs it makes with `XCL_DIRECT_DXIL=1` are byte for byte those from before the rebase. Yours is the only run of it on Windows so far. The description has the new counts; the smoke block for the new head is to come. AI use: Claude Code (Claude Fable 5.2) made the rebase, ran the tests and wrote this. Posted without review by a person: the account owner was away and reads replies later.
Author
Owner

@⁠itsd-effex on GitHub · 2026-11-24 22:45 UTC · original

Tested on a GPU, with the pipelines from #1805: this change alone stops the worker deaths, with dxil-spirv unpatched.

Two builds of the same tree: this PR's head a6e5c0e + #759 dd66d20 (for xcl pipelines), and the same tree with a6e5c0e reverted. Both with vkd3d-proton ec207194 (+ #257's patch) and unpatched dxil-spirv 7c048638, loaded from next to xcl.exe (checked with WINEDEBUG=+loaddll). xcl pipelines with XCL_DIRECT_DXIL=1, 14 workers, empty DXIL and vkd3d-proton caches, a data root of its own. Input: the 21 retail pipelines that each killed their worker on their own in #1805 (on that same unpatched dxil-spirv).

stack overflows result
without this PR 12 14 → 2 live workers within about 60 s, 0 of 21 made (stopped once no worker was busy)
this PR 0 made 21, failed 0, 287 s; the worker count only fell as the last programs finished

The 21: 05a6f7b3c517c29a, 240e0081d6fcbfa3, 241fc505f962313b and 18 more, the killer lines of the classification described in #1805 (comment).

Tested: Linux (CachyOS), Proton Experimental's Wine, RTX 3080 Ti (NVIDIA 620.73.04), i7-11700KF, 32 GB RAM. Retail 1.0.2.1, the title's own journal. Release, cross-built for x86_64-pc-windows-msvc. For the build only, a local commit with a switch to make chosen pipelines (XCL_PIPELINES_ONLY) and a two-line fix that #759 needs to build on this main (#1524 renamed what it uses; reported on #759).

Not tested: the test suite on this head; the title's own runtime compiles; AMD; native Windows; the pack's other ~58,000 pipelines with this change.

AI use

  • Claude Code (Claude Opus 5.5) built the trees, ran the test and wrote this comment.
**@⁠itsd-effex** on GitHub · 2026-11-24 22:45 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7146610700) **Tested on a GPU, with the pipelines from #1805:** this change alone stops the worker deaths, with dxil-spirv unpatched. Two builds of the same tree: this PR's head `a6e5c0e` + #759 `dd66d20` (for `xcl pipelines`), and the same tree with `a6e5c0e` reverted. Both with vkd3d-proton `ec207194` (+ #257's patch) and **unpatched** dxil-spirv `7c048638`, loaded from next to `xcl.exe` (checked with `WINEDEBUG=+loaddll`). `xcl pipelines` with `XCL_DIRECT_DXIL=1`, 14 workers, empty DXIL and vkd3d-proton caches, a data root of its own. Input: the 21 retail pipelines that each killed their worker on their own in #1805 (on that same unpatched dxil-spirv). | | stack overflows | result | |---|---|---| | without this PR | 12 | 14 → 2 live workers within about 60 s, **0 of 21 made** (stopped once no worker was busy) | | this PR | 0 | **made 21, failed 0, 287 s**; the worker count only fell as the last programs finished | The 21: `05a6f7b3c517c29a`, `240e0081d6fcbfa3`, `241fc505f962313b` and 18 more, the `killer` lines of the classification described in #1805 ([comment](https://git.gtahub.st/github/xcl-dev--xcl/issues/1805)). **Tested:** Linux (CachyOS), Proton Experimental's Wine, RTX 3080 Ti (NVIDIA 620.73.04), i7-11700KF, 32 GB RAM. Retail 1.0.2.1, the title's own journal. Release, cross-built for `x86_64-pc-windows-msvc`. For the build only, a local commit with a switch to make chosen pipelines (`XCL_PIPELINES_ONLY`) and a two-line fix that #759 needs to build on this `main` (#1524 renamed what it uses; reported on #759). **Not tested:** the test suite on this head; the title's own runtime compiles; AMD; native Windows; the pack's other ~58,000 pipelines with this change. **AI use** - Claude Code (Claude Opus 5.5) built the trees, ran the test and wrote this comment.
Author
Owner

@⁠Royalflamejlh on GitHub · 2026-11-24 23:22 UTC · original

The goal:world-load label is missing here: this is part of #1805, which carries it (#1833: "If yours is missing, say so here or on the PR").

Posted without review by a person: the account owner was away and reads replies later.

**@⁠Royalflamejlh** on GitHub · 2026-11-24 23:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7147322533) The `goal:world-load` label is missing here: this is part of #1805, which carries it (#1833: "If yours is missing, say so here or on the PR"). Posted without review by a person: the account owner was away and reads replies later.
Author
Owner

@⁠pablogonz12 on GitHub · 2026-11-25 00:06 UTC · original

Tested on AMD / RADV under Wine: no regression here, but the AMD-side abort is a different failure from #1805 and this change does not touch it.

  • Radeon RX 9070 XT (RDNA4, gfx1201, wave64), Mesa 26.3.1-5 (RADV), CachyOS / Linux 7.3.6, Wine 11.0 (GE-Proton11-14), vkd3d-proton 3.1.0, x86_64-pc-windows-msvc, -C target-feature=+crt-static, release.
  • Head a6e5c0e against its base main 689f2db, same command on both:
    cargo test -p xcl --lib --release -- --test-threads=4 --skip integer_ops_match_cpu --skip uaddc_and_usubb_match_cpu --skip jumps_to_outer_loop_heads_are_structured
    • head: 916 passed, 9 failed, 25 ignored, 3 filtered (one run)
    • main: 914 passed, 9 failed, 25 ignored, 3 filtered (two runs; a first run showed the #343 cross-test interference group in title_textures/vram, which passed in the second run and in the head run)
    • the same 9 fail on both: gpu_f64_roots, gpu_f64_math_random, gpu_nonfused_mad_and_mac_prevent_fma_contraction, gpu_depth_buffer_created_for_unordered_access_is_placed (#1475), xma2_source_voice_decodes_and_manages_lifetime (#890, #1557), fuzz_validate_and_gpu_2, directed_reference_basics (host fmaf under Wine), lower_dxil f32 and f64. The two extra passes on the head are this PR's two cfg tests; they pass here too.
  • The three skips are needed on this stack: integer_ops_match_cpu and uaddc_and_usubb_match_cpu abort the test process with exit status 3 — on main and on a6e5c0e, with XCL_DIRECT_DXIL unset and with XCL_DIRECT_DXIL=1; jumps_to_outer_loop_heads_are_structured exits 5 (#1246).
  • What that abort is, WINEDEBUG=+virtual,+seh on main 689f2db, one-op-per-process runs:
    warn:seh:dwarf_virtual_unwind backtrace: 0x7f3a173b599c: /usr/lib/libvulkan_radeon.so + 0x9b599c
    ...
    err:vulkan:vkCreateComputePipelines Exception 0xc0000005 in Unix call.
    
    An access violation inside libvulkan_radeon.so, entered from winevulkan: not a stack overflow and not in dxil-spirv, so it is not the flatten_subgroup_shuffles recursion of #1805, and it is reproduced without the direct-DXIL backend at all. Seen before this PR too (reported on #1807).

Not tested: a retail title (no xcl-smoke pair from me); NVIDIA and Windows-native AMD.

**@⁠pablogonz12** on GitHub · 2026-11-25 00:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7148148551) **Tested on AMD / RADV under Wine:** no regression here, but the AMD-side abort is a different failure from #1805 and this change does not touch it. - Radeon RX 9070 XT (RDNA4, gfx1201, wave64), Mesa 26.3.1-5 (RADV), CachyOS / Linux 7.3.6, Wine 11.0 (GE-Proton11-14), vkd3d-proton 3.1.0, `x86_64-pc-windows-msvc`, `-C target-feature=+crt-static`, release. - Head `a6e5c0e` against its base `main` `689f2db`, same command on both: `cargo test -p xcl --lib --release -- --test-threads=4 --skip integer_ops_match_cpu --skip uaddc_and_usubb_match_cpu --skip jumps_to_outer_loop_heads_are_structured` - head: **916 passed, 9 failed, 25 ignored, 3 filtered** (one run) - main: **914 passed, 9 failed, 25 ignored, 3 filtered** (two runs; a first run showed the #343 cross-test interference group in `title_textures`/`vram`, which passed in the second run and in the head run) - the same 9 fail on both: `gpu_f64_roots`, `gpu_f64_math_random`, `gpu_nonfused_mad_and_mac_prevent_fma_contraction`, `gpu_depth_buffer_created_for_unordered_access_is_placed` (#1475), `xma2_source_voice_decodes_and_manages_lifetime` (#890, #1557), `fuzz_validate_and_gpu_2`, `directed_reference_basics` (host `fmaf` under Wine), `lower_dxil` f32 and f64. The two extra passes on the head are this PR's two `cfg` tests; they pass here too. - The three skips are needed on this stack: `integer_ops_match_cpu` and `uaddc_and_usubb_match_cpu` **abort the test process with exit status 3** — on `main` and on `a6e5c0e`, with `XCL_DIRECT_DXIL` unset and with `XCL_DIRECT_DXIL=1`; `jumps_to_outer_loop_heads_are_structured` exits 5 (#1246). - What that abort is, `WINEDEBUG=+virtual,+seh` on `main` `689f2db`, one-op-per-process runs: ``` warn:seh:dwarf_virtual_unwind backtrace: 0x7f3a173b599c: /usr/lib/libvulkan_radeon.so + 0x9b599c ... err:vulkan:vkCreateComputePipelines Exception 0xc0000005 in Unix call. ``` An access violation **inside `libvulkan_radeon.so`**, entered from `winevulkan`: not a stack overflow and not in dxil-spirv, so it is not the `flatten_subgroup_shuffles` recursion of #1805, and it is reproduced without the direct-DXIL backend at all. Seen before this PR too (reported on #1807). **Not tested:** a retail title (no `xcl-smoke` pair from me); NVIDIA and Windows-native AMD.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 01:38 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 01:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7149782925) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠Royalflamejlh on GitHub · 2026-11-25 01:50 UTC · original

@⁠anes66 thank you: your GPU test is in as your commit (1160f92, the core_tests.rs part of b780cdd). On an RTX 5070 Ti (Windows 11, driver 621.24, debug) cargo test --workspace -- latch --test-threads=1 gives 2 passed, 0 failed, the GPU one among them (1 run), and the description has a new regression block for that head.

I did not take the version bump: #1947, merged since, makes the direct translator's cache entries change when the gpu/dxil sources do, so a translation cached before this change is no longer reused once this is on main. Say if you see a case that still slips through.

AI use: Claude Code (Claude Fable 5.2) made the commit from yours, ran the test and the regression run and wrote this reply.

Posted without review by a person: the account owner was away and reads replies later.

**@⁠Royalflamejlh** on GitHub · 2026-11-25 01:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7150012534) @⁠anes66 thank you: your GPU test is in as your commit (`1160f92`, the `core_tests.rs` part of `b780cdd`). On an RTX 5070 Ti (Windows 11, driver 621.24, debug) `cargo test --workspace -- latch --test-threads=1` gives 2 passed, 0 failed, the GPU one among them (1 run), and the description has a new regression block for that head. I did not take the version bump: #1947, merged since, makes the direct translator's cache entries change when the `gpu/dxil` sources do, so a translation cached before this change is no longer reused once this is on `main`. Say if you see a case that still slips through. AI use: Claude Code (Claude Fable 5.2) made the commit from yours, ran the test and the regression run and wrote this reply. Posted without review by a person: the account owner was away and reads replies later.
Author
Owner

@⁠Royalflamejlh on GitHub · 2026-11-25 03:35 UTC · original

Still needed after #2034: on main aaa0936 vkd3d-proton's own dxil-spirv segfaults on 77 of the 2,682 direct-DXIL compute programs, in the split wave64 form and in the unsplit one, and with 1160f92 merged in (no conflict) on none in either form.

Setup: Fedora 44, Ryzen 9 9950X3D, Wine 11.21 Staging, no GPU. Retail title 1.0.2.1, xcl shaders shaders.rpf --precompile --only cs with XCL_DIRECT_DXIL=1 and --split 1 or --split 0, release builds of aaa0936 and of aaa0936 with 1160f92 merged locally. Each program's DXIL then through dxil-spirv 34f0ff8 (the one in vkd3d-proton v3.1-90-g30b0eb9b, with the one resource-metadata patch our build of it carries), built natively, with the options vkd3d-proton passes on a card with 32-lane waves (--subgroup-size 32 32) for both forms, 4 at a time, 300 s limit. 1 pass each.

2,682 programs main aaa0936 aaa0936 + 1160f92
split form (--split 1, a card with 32-lane waves) 2,604 convert, 77 segfault, 1 not done in 300 s 2,681 convert, 0 segfault, 1 not done in 300 s
unsplit form (--split 0, the form for 64-lane waves) 2,604 convert, 77 segfault, 1 not done in 300 s 2,681 convert, 0 segfault, 1 not done in 300 s
  • The 78 that fail on main are the same programs in both forms, and the 77 are those of the description. 50 of the 77 are the same bytes in both forms, so the unsplit pass is a new test for 27 of them. The description above measured the split form only.
  • The one not done in 300 s is record 95cc13288a27a96e (3.9 MB of DXIL) in all four passes. That is dxil-spirv's conversion time, not the recursion (#1269 has patches for it).
  • The merge changes the DXIL of 79 programs in each form, the same 79 as in the description (the 77 and 2 more).

Not tested: the title or a GPU on this merge; whether the 79 changed programs compute the same; the unsplit form with the subgroup sizes a card with 64-lane waves reports; pixel and vertex programs.

AI use: Claude Code (Claude Fable 5.2) built the trees, ran the conversions and wrote this comment.

Posted without review by a person: the account owner was away and reads replies later.

**@⁠Royalflamejlh** on GitHub · 2026-11-25 03:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7152053710) Still needed after #2034: on `main` `aaa0936` vkd3d-proton's own dxil-spirv segfaults on 77 of the 2,682 direct-DXIL compute programs, in the split wave64 form and in the unsplit one, and with `1160f92` merged in (no conflict) on none in either form. **Setup:** Fedora 44, Ryzen 9 9950X3D, Wine 11.21 Staging, no GPU. Retail title 1.0.2.1, `xcl shaders shaders.rpf --precompile --only cs` with `XCL_DIRECT_DXIL=1` and `--split 1` or `--split 0`, release builds of `aaa0936` and of `aaa0936` with `1160f92` merged locally. Each program's DXIL then through dxil-spirv `34f0ff8` (the one in vkd3d-proton v3.1-90-g30b0eb9b, with the one resource-metadata patch our build of it carries), built natively, with the options vkd3d-proton passes on a card with 32-lane waves (`--subgroup-size 32 32`) for both forms, 4 at a time, 300 s limit. 1 pass each. | 2,682 programs | `main` `aaa0936` | `aaa0936` + `1160f92` | |---|---|---| | split form (`--split 1`, a card with 32-lane waves) | 2,604 convert, 77 segfault, 1 not done in 300 s | 2,681 convert, 0 segfault, 1 not done in 300 s | | unsplit form (`--split 0`, the form for 64-lane waves) | 2,604 convert, 77 segfault, 1 not done in 300 s | 2,681 convert, 0 segfault, 1 not done in 300 s | - The 78 that fail on `main` are the same programs in both forms, and the 77 are those of the description. 50 of the 77 are the same bytes in both forms, so the unsplit pass is a new test for 27 of them. The description above measured the split form only. - The one not done in 300 s is record `95cc13288a27a96e` (3.9 MB of DXIL) in all four passes. That is dxil-spirv's conversion time, not the recursion (#1269 has patches for it). - The merge changes the DXIL of 79 programs in each form, the same 79 as in the description (the 77 and 2 more). **Not tested:** the title or a GPU on this merge; whether the 79 changed programs compute the same; the unsplit form with the subgroup sizes a card with 64-lane waves reports; pixel and vertex programs. **AI use:** Claude Code (Claude Fable 5.2) built the trees, ran the conversions and wrote this comment. Posted without review by a person: the account owner was away and reads replies later.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 04:29 UTC · original

Tested

Independent Arc A770 run of open PR #1860 at 1160f92c1480df891561083a9279d3b2ca9b1aa9 on STOR-WINLAB. The test run verified the reused checkout was clean and detached at that SHA before and after.

Windows 11 Enterprise Evaluation x64 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust and Cargo 1.100.0 MSVC, DXC/DXIL 1.9.2609.5. Used two Cargo jobs with incremental compilation and test debug info disabled.

cargo test --locked -p xcl --lib --no-run
$env:XCL_ADAPTER = 'A770'
$env:XCL_DXC_DIR = Join-Path $env:LOCALAPPDATA 'XclTooling/dxc-1.9.2609/bin/x64'
& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test {
    & 'L:/XclTooling/pr2014-1c971de6/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe' gpu::dxil::core_tests::latch_blocks_preserve_loop_registers_on_the_gpu --exact --nocapture --test-threads=1
}

The build completed outside the Arc mutex. The fully captured GPU invocation reported 1 passed, 0 failed, 0 ignored, 0 explicit skips, 953 filtered out, 0.34 s. The wrapper exited 0 and logged lock release. An earlier invocation printed a pass, and PowerShell lost part of its stderr. This report uses the fully captured rerun.

The fixture checked both the two-return and nested loop shapes in wave32 and split wave64, with iteration counts 0, 1, 2, and 5. It validated direct DXIL, compiled the HLSL/DXC reference, and matched registers v1–v3 against expected values and the HLSL/DXC GPU output.

Not tested

Native wave64, other adapters or drivers, additional fixtures, the workspace suite, retail smoke, and performance.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the checked-in fixture and checked the captured logs. The coordinator prepared this summary from the completed run.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 04:29 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7152889537) **Tested** Independent Arc A770 run of open PR #1860 at `1160f92c1480df891561083a9279d3b2ca9b1aa9` on STOR-WINLAB. The test run verified the reused checkout was clean and detached at that SHA before and after. Windows 11 Enterprise Evaluation x64 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust and Cargo 1.100.0 MSVC, DXC/DXIL 1.9.2609.5. Used two Cargo jobs with incremental compilation and test debug info disabled. ```powershell cargo test --locked -p xcl --lib --no-run $env:XCL_ADAPTER = 'A770' $env:XCL_DXC_DIR = Join-Path $env:LOCALAPPDATA 'XclTooling/dxc-1.9.2609/bin/x64' & 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { & 'L:/XclTooling/pr2014-1c971de6/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe' gpu::dxil::core_tests::latch_blocks_preserve_loop_registers_on_the_gpu --exact --nocapture --test-threads=1 } ``` The build completed outside the Arc mutex. The fully captured GPU invocation reported **1 passed, 0 failed, 0 ignored, 0 explicit skips**, 953 filtered out, 0.34 s. The wrapper exited 0 and logged lock release. An earlier invocation printed a pass, and PowerShell lost part of its stderr. This report uses the fully captured rerun. The fixture checked both the two-return and nested loop shapes in wave32 and split wave64, with iteration counts 0, 1, 2, and 5. It validated direct DXIL, compiled the HLSL/DXC reference, and matched registers v1–v3 against expected values and the HLSL/DXC GPU output. **Not tested** Native wave64, other adapters or drivers, additional fixtures, the workspace suite, retail smoke, and performance. **AI use** T3 Code / Codex (gpt-6.2-sol) ran the checked-in fixture and checked the captured logs. The coordinator prepared this summary from the completed run.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 10:58 UTC · original

Diff review on 1160f92 (single_latch in crates/xcl/src/gpu/dxil/cfg.rs + latch_blocks_preserve_loop_registers_on_the_gpu in core_tests.rs) looks solid, CI is green, and RTX 5070 Ti, RTX 3080 Ti, RTX 3060 Ti, and Arc A770 results are all green on 1160f92.

Only item remaining before merge is an AMD GPU pass (e.g. latch_blocks_preserve_loop_registers_on_the_gpu) on exact head 1160f92 (the earlier RADV run was on pre-rebase a6e5c0e).

**@⁠raylitebull** on GitHub · 2026-11-25 10:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7160414815) Diff review on `1160f92` (`single_latch` in `crates/xcl/src/gpu/dxil/cfg.rs` + `latch_blocks_preserve_loop_registers_on_the_gpu` in `core_tests.rs`) looks solid, CI is green, and RTX 5070 Ti, RTX 3080 Ti, RTX 3060 Ti, and Arc A770 results are all green on `1160f92`. Only item remaining before merge is an AMD GPU pass (e.g. `latch_blocks_preserve_loop_registers_on_the_gpu`) on exact head `1160f92` (the earlier RADV run was on pre-rebase `a6e5c0e`).
Author
Owner

@⁠Royalflamejlh on GitHub · 2026-11-25 11:11 UTC · original · edited 2026-11-25 11:37 UTC

@⁠raylitebull thank you. We have no AMD card to run it on, so that pass has to come from someone who has one.

1160f92 is a6e5c0e plus one commit that adds the GPU test (core_tests.rs, +73 lines, no other file); cfg.rs is the same at both. @⁠pablogonz12's RADV run on a6e5c0e (RX 9070 XT, above) found no regression and passed this PR's two cfg tests, but those run on the CPU, so the latch blocks have not yet run on an AMD GPU. This is the test for that:

cargo test -p xcl --lib --release latch_blocks_preserve_loop_registers_on_the_gpu -- --nocapture

It prints a SKIPPED line and still counts as passed when there is no device, no wave32 or no DXC. @⁠pablogonz12, if you still have that setup, one run of this on 1160f92 would settle it; please say whether it passed or printed SKIPPED.

Not tested: AMD, as said.

AI use: Claude Code (Claude Fable 5.2) read the two commits and wrote this reply.

Posted without review by a person: the account owner was away and reads replies later.

Edited 11:37 UTC: 15 minutes after this was posted the branch was rebased onto main 426a5a7, and the head is now bcc71b6: the same two commits plus one in module/opt.rs, so that the CFG clean-up merged today (#2194) keeps the latch blocks. The test above is the same; the commit to run it on is bcc71b6, not 1160f92.

**@⁠Royalflamejlh** on GitHub · 2026-11-25 11:11 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7160708733) · edited 2026-11-25 11:37 UTC @⁠raylitebull thank you. We have no AMD card to run it on, so that pass has to come from someone who has one. `1160f92` is `a6e5c0e` plus one commit that adds the GPU test (`core_tests.rs`, +73 lines, no other file); `cfg.rs` is the same at both. @⁠pablogonz12's RADV run on `a6e5c0e` (RX 9070 XT, above) found no regression and passed this PR's two `cfg` tests, but those run on the CPU, so the latch blocks have not yet run on an AMD GPU. This is the test for that: ``` cargo test -p xcl --lib --release latch_blocks_preserve_loop_registers_on_the_gpu -- --nocapture ``` It prints a `SKIPPED` line and still counts as passed when there is no device, no wave32 or no DXC. @⁠pablogonz12, if you still have that setup, one run of this on `1160f92` would settle it; please say whether it passed or printed `SKIPPED`. **Not tested:** AMD, as said. **AI use:** Claude Code (Claude Fable 5.2) read the two commits and wrote this reply. Posted without review by a person: the account owner was away and reads replies later. **Edited 11:37 UTC:** 15 minutes after this was posted the branch was rebased onto `main` `426a5a7`, and the head is now `bcc71b6`: the same two commits plus one in `module/opt.rs`, so that the CFG clean-up merged today (#2194) keeps the latch blocks. The test above is the same; the commit to run it on is `bcc71b6`, not `1160f92`.
Author
Owner

@⁠Royalflamejlh on GitHub · 2026-11-25 12:14 UTC · original

This branch is rebased onto main 426a5a7 and has a third commit, bcc71b6, because #2194 (merged today) took its latch blocks out again. On 426a5a7, vkd3d-proton's dxil-spirv 34f0ff8 (split wave64 form, 1 pass of each tree, as in the description) segfaulted on 7 of the 2,682 direct compute programs with the first two commits, and on 0 with all three.

#2194's simplify_cfg bypasses an empty [Br(t)] block, and the latch single_latch adds is one: with one incoming edge it is bypassed even when t has phis, so a block with back edges to two loop heads gets both again. bcc71b6 skips the bypass when t comes no later than the block in the reverse post-order the pass already takes, and adds a unit test that is red without it. It keeps 520 bytes more DXIL than the first two commits alone, in 51 of the 2,682 programs. The first two commits are the same patches as a6e5c0e and 1160f92, so the reviews and card results above were of them, on the older main; bcc71b6 is new.

main 426a5a7 + segfault in dxil-spirv 34f0ff8
nothing 57
the first two commits 7
this branch (bcc71b6) 0
  • Since #2120, three of those 57 reach dxil-spirv without XCL_DIRECT_DXIL too: c963276f38285bf4, f839072880d49fb4 and 219287eb2f6021fe have over 8 MB of HLSL each, and with this branch they convert in 3.6 to 3.9 s. A fourth that #2120 sends there, 95cc13288a27a96e, is not in the counts: it did not finish in 300 s on any of the three trees, main included.
  • bcc71b6 on an RTX 2070 SUPER (Windows 11, driver 621.01, debug): cargo test --workspace -- latch simplify_cfg a_block_keeps, 9 passed, 0 failed; the gpu_ tests with XCL_DIRECT_DXIL=1, 145 passed (2 printed SKIPPED: no wave64), 0 failed, 1 ignored, the same as on main 426a5a7. The description has the setup and both smoke blocks.

Not tested: AMD; the unsplit form on 426a5a7; the title under Wine with this head.

AI use: Claude Code (Claude Opus 5.5) found the interaction, wrote bcc71b6 and this comment, and ran the measurements.

Posted without review by a person: the account owner was away and reads replies later.

**@⁠Royalflamejlh** on GitHub · 2026-11-25 12:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7162098524) This branch is rebased onto `main` `426a5a7` and has a third commit, `bcc71b6`, because #2194 (merged today) took its latch blocks out again. On `426a5a7`, vkd3d-proton's dxil-spirv `34f0ff8` (split wave64 form, 1 pass of each tree, as in the description) segfaulted on 7 of the 2,682 direct compute programs with the first two commits, and on 0 with all three. #2194's `simplify_cfg` bypasses an empty `[Br(t)]` block, and the latch `single_latch` adds is one: with one incoming edge it is bypassed even when `t` has phis, so a block with back edges to two loop heads gets both again. `bcc71b6` skips the bypass when `t` comes no later than the block in the reverse post-order the pass already takes, and adds a unit test that is red without it. It keeps 520 bytes more DXIL than the first two commits alone, in 51 of the 2,682 programs. The first two commits are the same patches as `a6e5c0e` and `1160f92`, so the reviews and card results above were of them, on the older `main`; `bcc71b6` is new. | `main` `426a5a7` + | segfault in dxil-spirv `34f0ff8` | |---|---| | nothing | 57 | | the first two commits | 7 | | this branch (`bcc71b6`) | 0 | - Since #2120, three of those 57 reach dxil-spirv without `XCL_DIRECT_DXIL` too: `c963276f38285bf4`, `f839072880d49fb4` and `219287eb2f6021fe` have over 8 MB of HLSL each, and with this branch they convert in 3.6 to 3.9 s. A fourth that #2120 sends there, `95cc13288a27a96e`, is not in the counts: it did not finish in 300 s on any of the three trees, `main` included. - `bcc71b6` on an RTX 2070 SUPER (Windows 11, driver 621.01, debug): `cargo test --workspace -- latch simplify_cfg a_block_keeps`, 9 passed, 0 failed; the `gpu_` tests with `XCL_DIRECT_DXIL=1`, 145 passed (2 printed SKIPPED: no wave64), 0 failed, 1 ignored, the same as on `main` `426a5a7`. The description has the setup and both smoke blocks. **Not tested:** AMD; the unsplit form on `426a5a7`; the title under Wine with this head. **AI use:** Claude Code (Claude Opus 5.5) found the interaction, wrote `bcc71b6` and this comment, and ran the measurements. Posted without review by a person: the account owner was away and reads replies later.
Author
Owner

@⁠anes66 on GitHub · 2026-11-25 00:04 UTC · original · edited 2026-11-25 14:37 UTC

CPU-only follow-up on rebased head bcc71b69fe4258970dd096ffd0ccc6c89587e841: the new back-edge guard preserves nested latches and their loop-carried phi inputs. Optional test companion 2fd3b33 is directly on that head and adds one test only.

Tested

  • Windows 10 Pro 19045, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, debug. CPU IR checks; no GPU initialization or shader compilation.
  • 28 nested-loop fixtures: seven rotations of block allocation order, each forward and reversed, with conditional or switch branches. The switch has two cases sharing an inner latch. Both loop headers carry live phis; a forward trampoline exercises the optimization that should still happen.
  • Each fixture runs Module::optimize twice. After each pass it checks at most one distinct back-edge target per block and one returning block per loop header, both retained loops/latches, removal of the forward trampoline, live phi predecessor multiplicities, exact loop-carried phi values and uses_well_formed.
  • cargo test --locked -p xcl --lib gpu::dxil::module::opt::tests:: -j 2 -- --nocapture --test-threads=1: 8 passed / 0 failed / 0 ignored / 0 skips.
  • cargo test --locked -p xcl --lib gpu::dxil::cfg::tests:: -j 2 -- --nocapture --test-threads=1: 3 passed / 0 failed / 0 ignored / 0 skips.
  • Negative control: temporarily removing only pos[t] <= pos[b] from the trampoline guard makes the new test fail with multiple back edges in its first conditional fixture. Restored before the final passing runs and commit.

Not tested
GPU execution or output parity, DXIL validation/serialization, dxil-spirv, release, full workspace, a title or integration onto newer main. These CPU checks supplement the earlier GPU fixture; they do not supply the outstanding AMD execution result.


Earlier report below applies only to a6e5c0e and companion b780cdd. The author adopted the GPU fixture; the manual version bump became unnecessary after #1947 added direct-source cache identity. Those earlier GPU/workspace counts are not results for bcc71b6.

The latch change needs a direct-translator cache-version bump. Exact head a6e5c0ebe12abfb2fdaa4ee02e719cad10f243e6 changes only gpu/dxil/cfg.rs, which is outside build.rs's source hash, and keeps TRANSLATOR_VERSION=7. A pre-fix disk translation can therefore bypass the new CFG entirely.

Companion patch: b780cdd, directly on that head. It bumps 7 to 8, adds a disk-cache regression, and adds a synthetic GPU output check for the latch rewrite. No competing upstream PR.

Tested

  • Windows 10 Pro 19045, RTX 3060 12 GB / driver 32.0.16.2114, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, DXC 1.9.2602.17, Agility 1.620.2, debug. No XCL_SAMPLE_* inputs.
  • Cache regression before the bump: 0 passed / 1 failed; the old marker was loaded and the translation closure was never called. After: 1/0. It seeds a synthetic v7 entry through the existing cache helpers, requires rebuilding in both direct routing modes, and checks that HLSL still reuses its entry. This is a storage-identity check, not execution of an old retail shader.
  • cargo test --locked -p xcl --lib latch -- --nocapture --test-threads=1: 3/0/0, no skips. The new GPU fixture translates two RDNA2 loop shapes (two returns to one head; a nested loop with returns to either head), asserts the inserted latches, validates DXIL, and compares GPU registers against HLSL+DXC and explicit expected values. Wave32 and split wave64, 0/1/2/5 iterations: 16 input/mode cases, 32 GPU dispatches, all matched. Native wave64 was not run.
  • cargo build --locked --workspace -j 4: passed.
  • Patched workspace, cargo test --locked --workspace --no-fail-fast -j 4 -- --test-threads=1 --show-output: 979 passed / 0 failed / 45 ignored, 23 explicit SKIPPED lines (18 no-native-wave64 cases, three per-lane f16 refusals, the Developer-Mode-dependent PSO measurement, and the heap-window-only case). Skips and sample-gated returns are included in Rust's pass counts.

Parallel limitation
The same patched workspace at --test-threads=4 was 976/3/45, 26 explicit SKIPPED lines. write_buffer_immediate_on_open_existing_heap_visible_to_cpu, rotating_queue_self_deadlock_and_non_monotonic_rescue_do_not_hang, and timestamps_outside_unified_memory_land_after_the_queue failed creating queues with 0x887A0005; subsequent GPU-unavailable skips occurred.

An unmodified exact-head control, cargo test --locked -p xcl --lib -- --test-threads=4 --show-output, was 926/2/25, 23 explicit SKIPPED lines: coherent_buffer_sanitizes_console_flags_and_state and the same write_buffer_immediate_on_open_existing_heap_visible_to_cpu failed. This is a library-only control, not a clean full-workspace comparison. The parallel failures' cause is not established; the serial result does not make the parallel suite green.

Not tested
Wine/vkd3d, AMD/Intel, native wave64, release, title/world-load regression, the 79 changed retail programs, or integration onto newer main. The new GPU fixture calls the direct translator explicitly; the workspace runs used the default backend, not a full XCL_DIRECT_DXIL=1 suite. No proprietary inputs were accessed. A maintainer/title tester still needs the required exact-head regression pair before merging a runtime change.

AI use
Codex (GPT-6; exact variant unavailable) wrote the companion patch and synthetic tests, ran the native checks and controls, and prepared this report. The latch algorithm is the original author's work.

**@⁠anes66** on GitHub · 2026-11-25 00:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7148102345) · edited 2026-11-25 14:37 UTC CPU-only follow-up on rebased head `bcc71b69fe4258970dd096ffd0ccc6c89587e841`: the new back-edge guard preserves nested latches and their loop-carried phi inputs. Optional test companion [2fd3b33](https://github.com/anes66/xcl/commit/2fd3b336842360e29ec5989525eaf6b7a23aeecc) is directly on that head and adds one test only. **Tested** - Windows 10 Pro 19045, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, debug. CPU IR checks; no GPU initialization or shader compilation. - **28 nested-loop fixtures:** seven rotations of block allocation order, each forward and reversed, with conditional or switch branches. The switch has two cases sharing an inner latch. Both loop headers carry live phis; a forward trampoline exercises the optimization that should still happen. - Each fixture runs `Module::optimize` twice. After each pass it checks at most one distinct back-edge target per block and one returning block per loop header, both retained loops/latches, removal of the forward trampoline, live phi predecessor multiplicities, exact loop-carried phi values and `uses_well_formed`. - `cargo test --locked -p xcl --lib gpu::dxil::module::opt::tests:: -j 2 -- --nocapture --test-threads=1`: **8 passed / 0 failed / 0 ignored / 0 skips**. - `cargo test --locked -p xcl --lib gpu::dxil::cfg::tests:: -j 2 -- --nocapture --test-threads=1`: **3 passed / 0 failed / 0 ignored / 0 skips**. - Negative control: temporarily removing only `pos[t] <= pos[b]` from the trampoline guard makes the new test fail with `multiple back edges` in its first conditional fixture. Restored before the final passing runs and commit. **Not tested** GPU execution or output parity, DXIL validation/serialization, dxil-spirv, release, full workspace, a title or integration onto newer main. These CPU checks supplement the earlier GPU fixture; they do not supply the outstanding AMD execution result. --- Earlier report below applies only to `a6e5c0e` and companion `b780cdd`. The author adopted the GPU fixture; the manual version bump became unnecessary after #1947 added direct-source cache identity. Those earlier GPU/workspace counts are not results for `bcc71b6`. The latch change needs a direct-translator cache-version bump. Exact head `a6e5c0ebe12abfb2fdaa4ee02e719cad10f243e6` changes only `gpu/dxil/cfg.rs`, which is outside `build.rs`'s source hash, and keeps `TRANSLATOR_VERSION=7`. A pre-fix disk translation can therefore bypass the new CFG entirely. Companion patch: [b780cdd](https://github.com/anes66/xcl/commit/b780cdd1f49bb634489aea027dd325e841408a09), directly on that head. It bumps 7 to 8, adds a disk-cache regression, and adds a synthetic GPU output check for the latch rewrite. No competing upstream PR. **Tested** - Windows 10 Pro 19045, RTX 3060 12 GB / driver 32.0.16.2114, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, DXC 1.9.2602.17, Agility 1.620.2, debug. No `XCL_SAMPLE_*` inputs. - Cache regression before the bump: **0 passed / 1 failed**; the old marker was loaded and the translation closure was never called. After: **1/0**. It seeds a synthetic v7 entry through the existing cache helpers, requires rebuilding in both direct routing modes, and checks that HLSL still reuses its entry. This is a storage-identity check, not execution of an old retail shader. - `cargo test --locked -p xcl --lib latch -- --nocapture --test-threads=1`: **3/0/0**, no skips. The new GPU fixture translates two RDNA2 loop shapes (two returns to one head; a nested loop with returns to either head), asserts the inserted latches, validates DXIL, and compares GPU registers against HLSL+DXC and explicit expected values. Wave32 and split wave64, 0/1/2/5 iterations: **16 input/mode cases, 32 GPU dispatches**, all matched. Native wave64 was not run. - `cargo build --locked --workspace -j 4`: passed. - Patched workspace, `cargo test --locked --workspace --no-fail-fast -j 4 -- --test-threads=1 --show-output`: **979 passed / 0 failed / 45 ignored**, 23 explicit SKIPPED lines (18 no-native-wave64 cases, three per-lane f16 refusals, the Developer-Mode-dependent PSO measurement, and the heap-window-only case). Skips and sample-gated returns are included in Rust's pass counts. **Parallel limitation** The same patched workspace at `--test-threads=4` was **976/3/45**, 26 explicit SKIPPED lines. `write_buffer_immediate_on_open_existing_heap_visible_to_cpu`, `rotating_queue_self_deadlock_and_non_monotonic_rescue_do_not_hang`, and `timestamps_outside_unified_memory_land_after_the_queue` failed creating queues with `0x887A0005`; subsequent GPU-unavailable skips occurred. An unmodified exact-head control, `cargo test --locked -p xcl --lib -- --test-threads=4 --show-output`, was **926/2/25**, 23 explicit SKIPPED lines: `coherent_buffer_sanitizes_console_flags_and_state` and the same `write_buffer_immediate_on_open_existing_heap_visible_to_cpu` failed. This is a library-only control, not a clean full-workspace comparison. The parallel failures' cause is not established; the serial result does not make the parallel suite green. **Not tested** Wine/vkd3d, AMD/Intel, native wave64, release, title/world-load regression, the 79 changed retail programs, or integration onto newer main. The new GPU fixture calls the direct translator explicitly; the workspace runs used the default backend, not a full `XCL_DIRECT_DXIL=1` suite. No proprietary inputs were accessed. A maintainer/title tester still needs the required exact-head regression pair before merging a runtime change. **AI use** Codex (GPT-6; exact variant unavailable) wrote the companion patch and synthetic tests, ran the native checks and controls, and prepared this report. The latch algorithm is the original author's work.
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-25 10:20 UTC · original · edited 2026-11-25 14:45 UTC

Independent Windows run on 1160f92. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, DXC 1.8.2502.11.

cargo build --workspace --offline --locked -j 4 passed. cargo test --workspace --offline --locked --no-fail-fast -j 4 -- --nocapture --test-threads=4 finished with 978 passed, 0 failed, 45 ignored, including 23 runtime skips in Cargo's pass count. The two control-flow assertions and the native register comparison passed on the clean head.

I also assembled both synthetic loop forms with LLVM MC 23.1.6 for gfx1030, using labels for the branch targets. Each was one bit different from XCL's encoded input in the unused source field of v_readlane_b32. LLVM disassembled both encodings to the same instruction. Feeding the LLVM bytes into the same test still passed all 16 combinations of loop form, wave32 or split wave64, and iteration count. Direct DXIL validated and matched the expected registers and the HLSL/DXC GPU output in every tested lane. The focused command was cargo test --offline --locked -j 4 -p xcl --lib latch_blocks_preserve_loop_registers_on_the_gpu -- --nocapture --test-threads=1, 1 passed, 0 failed, zero skips. Coverage is synthetic D3D12, including the split wave64 path on a wave32 adapter.

AI use: Codex (GPT-6, exact variant unspecified) assembled the inputs, adapted the scratch fixture, ran the tests and drafted this report.

Current-head recheck. On the same RTX 3080 Ti and Windows toolchain, I tested exact bcc71b6 and its clean local integration onto main 06c9f55.

  • Both passed cargo build --offline --locked --workspace -j 4. The workspace tests finished with 1,247 passed, 0 failed, 46 ignored on the exact head and 1,269 passed, 0 failed, 46 ignored on the integration. The pass counts include 25 and 26 runtime skips respectively.
  • With XCL_DIRECT_DXIL=1, both passed all nine latch and CFG tests with zero skips. The loop-register fixture matched HLSL and the expected values for both wave32 and split wave64.
  • The current-main integration also passed the eight dispatch_chain_ tests, including one skip for the native-wave64 GPU portion.

Test commands were cargo test --offline --locked --workspace --no-fail-fast -j 4 -- --test-threads=4 --nocapture and cargo test --offline --locked -p xcl --lib -j 4 -- --test-threads=1 --nocapture latch simplify_cfg a_block_keeps, with a separate dispatch_chain_ filter for the integration. Synthetic Windows/NVIDIA verification only. AMD remains open. Codex (GPT-6, exact variant unavailable) ran the checks and drafted this update.

**@⁠thehollowedone** on GitHub · 2026-11-25 10:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7159551206) · edited 2026-11-25 14:45 UTC Independent Windows run on [1160f92](https://github.com/xcl-dev/xcl/commit/1160f92c1480df891561083a9279d3b2ca9b1aa9). Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, DXC 1.8.2502.11. `cargo build --workspace --offline --locked -j 4` passed. `cargo test --workspace --offline --locked --no-fail-fast -j 4 -- --nocapture --test-threads=4` finished with **978 passed, 0 failed, 45 ignored**, including 23 runtime skips in Cargo's pass count. The two control-flow assertions and the native register comparison passed on the clean head. I also assembled both synthetic loop forms with LLVM MC 23.1.6 for `gfx1030`, using labels for the branch targets. Each was one bit different from XCL's encoded input in the unused source field of `v_readlane_b32`. LLVM disassembled both encodings to the same instruction. Feeding the LLVM bytes into the same test still passed all 16 combinations of loop form, wave32 or split wave64, and iteration count. Direct DXIL validated and matched the expected registers and the HLSL/DXC GPU output in every tested lane. The focused command was `cargo test --offline --locked -j 4 -p xcl --lib latch_blocks_preserve_loop_registers_on_the_gpu -- --nocapture --test-threads=1`, 1 passed, 0 failed, zero skips. Coverage is synthetic D3D12, including the split wave64 path on a wave32 adapter. AI use: Codex (GPT-6, exact variant unspecified) assembled the inputs, adapted the scratch fixture, ran the tests and drafted this report. **Current-head recheck.** On the same RTX 3080 Ti and Windows toolchain, I tested exact [bcc71b6](https://github.com/xcl-dev/xcl/commit/bcc71b69fe4258970dd096ffd0ccc6c89587e841) and its clean local integration onto [main 06c9f55](https://github.com/xcl-dev/xcl/commit/06c9f5505f63f10c5ec49ef932d75b2c28177324). - Both passed `cargo build --offline --locked --workspace -j 4`. The workspace tests finished with **1,247 passed, 0 failed, 46 ignored** on the exact head and **1,269 passed, 0 failed, 46 ignored** on the integration. The pass counts include 25 and 26 runtime skips respectively. - With `XCL_DIRECT_DXIL=1`, both passed all nine latch and CFG tests with zero skips. The loop-register fixture matched HLSL and the expected values for both wave32 and split wave64. - The current-main integration also passed the eight `dispatch_chain_` tests, including one skip for the native-wave64 GPU portion. Test commands were `cargo test --offline --locked --workspace --no-fail-fast -j 4 -- --test-threads=4 --nocapture` and `cargo test --offline --locked -p xcl --lib -j 4 -- --test-threads=1 --nocapture latch simplify_cfg a_block_keeps`, with a separate `dispatch_chain_` filter for the integration. Synthetic Windows/NVIDIA verification only. AMD remains open. Codex (GPT-6, exact variant unavailable) ran the checks and drafted this update.
Author
Owner

@⁠throny on GitHub · 2026-11-25 20:50 UTC · original

Two contributors checked independently and found that #1844 #1852 solves the same problem (for #1805) in a different way: #1607, group D87. 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.

**@⁠throny** on GitHub · 2026-11-25 20:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7174259851) <!-- xcl-1607-hint:D87 --> Two contributors checked independently and found that #1844 #1852 solves the same problem (for #1805) in a different way: #1607, group D87. 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.
Author
Owner

@⁠Royalflamejlh on GitHub · 2026-11-25 21:02 UTC · original

On the #1607 hint (group D87): #1844 and #1852 fix a different crash from this one, so this pull request is needed with either of them. They keep XCL's own Ssa::read from overflowing a worker's stack while it translates (#1844's test: 8,192 joins on a 256 KiB stack), and #1852's description already says #1805's retail crash was traced to dxil-spirv here. This one changes the DXIL XCL emits so that vkd3d-proton's dxil-spirv 34f0ff8 does not segfault on it afterwards. On main 6d12f58a, dxil-spirv segfaulted on 42 of the 11,115 direct compute programs and split pieces, and on none with this branch and #2082 in (1 pass each); #2082 is there for invalid SPIR-V only. On main 426a5a7, this branch alone took the segfaults from 57 to 0 (the table above), and #2082 alone left them at 57.

AI use: Claude Code (Claude Opus 5.5) ran the conversions and wrote this comment.

Posted without review by a person: the account owner was away and reads replies later.

**@⁠Royalflamejlh** on GitHub · 2026-11-25 21:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7174526943) On the #1607 hint (group D87): #1844 and #1852 fix a different crash from this one, so this pull request is needed with either of them. They keep XCL's own `Ssa::read` from overflowing a worker's stack while it translates (#1844's test: 8,192 joins on a 256 KiB stack), and #1852's description already says #1805's retail crash was traced to dxil-spirv here. This one changes the DXIL XCL emits so that vkd3d-proton's dxil-spirv `34f0ff8` does not segfault on it afterwards. On `main` `6d12f58a`, dxil-spirv segfaulted on 42 of the 11,115 direct compute programs and split pieces, and on none with this branch and #2082 in (1 pass each); #2082 is there for invalid SPIR-V only. On `main` `426a5a7`, this branch alone took the segfaults from 57 to 0 (the table above), and #2082 alone left them at 57. **AI use:** Claude Code (Claude Opus 5.5) ran the conversions and wrote this comment. Posted without review by a person: the account owner was away and reads replies later.
Author
Owner

@⁠Royalflamejlh on GitHub · 2026-11-25 22:52 UTC · original

Reopening: this is not a duplicate of #1844 / #1852. They stop XCL's own Ssa::read from overflowing a worker's stack; this stops vkd3d-proton's dxil-spirv from segfaulting on the DXIL XCL emits, which only Linux (Wine + vkd3d-proton) runs, so the two Windows checks in #1607 D87 could not see it. On main 426a5a7 this branch alone took dxil-spirv's segfaults from 57 to 0 of 2,682 direct programs; #1852's description says the same ("traced to dxil-spirv in #1860, so this PR does not claim to fix #1805"). Details in my comment above (21:02 UTC).

AI use: Claude Code (Claude Opus 5.5) wrote this comment.

**@⁠Royalflamejlh** on GitHub · 2026-11-25 22:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7176894796) Reopening: this is not a duplicate of #1844 / #1852. They stop XCL's own `Ssa::read` from overflowing a worker's stack; this stops vkd3d-proton's dxil-spirv from segfaulting on the DXIL XCL emits, which only Linux (Wine + vkd3d-proton) runs, so the two Windows checks in #1607 D87 could not see it. On `main` `426a5a7` this branch alone took dxil-spirv's segfaults from 57 to 0 of 2,682 direct programs; #1852's description says the same ("traced to `dxil-spirv` in #1860, so this PR does not claim to fix #1805"). Details in my comment above (21:02 UTC). **AI use:** Claude Code (Claude Opus 5.5) wrote this comment.
Author
Owner

@⁠humsterbumster on GitHub · 2026-11-26 00:37 UTC · original

Retail title 1.0.2.1 on Linux / RTX 5090: with this change + #1844 + #2082 the overflow no longer ends the process

Machine: Linux x64 (kernel 7.3.5), 14 cores, RTX 5090 32 GiB, Proton 11 Wine, vkd3d-proton 3.2.0
(dxil-spirv 7c04863 with a local null guard in find_common_post_dominator/find_common_dominator),
XCL's direct-DXIL backend (XCL_DIRECT_DXIL=1), driver blob cache on, workers' stack 512 MiB.

Before (6a9e87b): the world load ended with STATUS_STACK_OVERFLOW (0xC00000FD) on XCL's
xcl-pso-N workers inside dxil-spirv, then the process exited with code 1. vkd3d-proton's
parse_dxbc: Ignoring DXBC checksum / skip_dword_unknown lines precede every overflow, and the
recursion is in-process inside CreateComputePipelineState, on the split wave64 form — the
signature this issue describes.

After bb2165b (this change) + 71f2ceb (#1844) + cab89ed (#2082):

  • the process no longer dies of the overflow — 7 overflow reports in a 430 s world-load run, 0
    process deaths from them
    ; the load goes on (it never did before this change on this machine);
  • the load reaches further than before: compute split: up to 145 programs split / 1557 pieces
    built, and driver compiles of the split form complete (482 KB, 797 KB, 851 KB DXIL; the huge
    ones take 12-22 s each here);
  • what ends the run now is not XCL: the container's 28 GiB cgroup limit (memory.max
    read-only, memory.swap.max 0) — RSS 24-24.7 GB plus page cache is the limit, and the cgroup's
    memory.events oom_kill goes up by one per run while /proc/vmstat oom_kill does not. XCL's
    own heap at that point measures 677 MB peak (a counting global allocator around mimalloc); the
    rest is the title's console memory (about 20 GB of Wine heap plus 9 GB of tiled GPU pages).

What is left of the recursion after this change is still very deep: XCL's pipeline workers grow
their 512 MiB stacks to about 500 MiB on the biggest compute programs (VirtualQuery says the
whole stack is committed under Wine, so this is measured from the guard page), and the same
programs take 12-22 s each in the driver's translation. On this machine the world load is a few
thousand of those, so it does not finish before the memory limit does. If the split form is meant
to be cheap, the depth (not just the endless case) is worth a look.

Not tested: Windows with this change (everything above is Linux + vkd3d-proton).

"ai": "omp (DeepSeek V4.1 Flash 1017)"

**@⁠humsterbumster** on GitHub · 2026-11-26 00:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7178948808) **Retail title 1.0.2.1 on Linux / RTX 5090: with this change + #1844 + #2082 the overflow no longer ends the process** Machine: Linux x64 (kernel 7.3.5), 14 cores, RTX 5090 32 GiB, Proton 11 Wine, vkd3d-proton 3.2.0 (dxil-spirv `7c04863` with a local null guard in `find_common_post_dominator`/`find_common_dominator`), XCL's direct-DXIL backend (`XCL_DIRECT_DXIL=1`), driver blob cache on, workers' stack 512 MiB. Before (`6a9e87b`): the world load ended with `STATUS_STACK_OVERFLOW` (`0xC00000FD`) on XCL's `xcl-pso-N` workers inside dxil-spirv, then the process exited with code 1. vkd3d-proton's `parse_dxbc: Ignoring DXBC checksum` / `skip_dword_unknown` lines precede every overflow, and the recursion is in-process inside `CreateComputePipelineState`, on the split wave64 form — the signature this issue describes. After `bb2165b` (this change) + `71f2ceb` (#1844) + `cab89ed` (#2082): - the process no longer dies of the overflow — **7 overflow reports in a 430 s world-load run, 0 process deaths from them**; the load goes on (it never did before this change on this machine); - the load reaches further than before: `compute split:` up to 145 programs split / 1557 pieces built, and driver compiles of the split form complete (482 KB, 797 KB, 851 KB DXIL; the huge ones take 12-22 s each here); - what ends the run now is not XCL: the container's **28 GiB cgroup limit** (`memory.max` read-only, `memory.swap.max` 0) — RSS 24-24.7 GB plus page cache is the limit, and the cgroup's `memory.events oom_kill` goes up by one per run while `/proc/vmstat` `oom_kill` does not. XCL's own heap at that point measures 677 MB peak (a counting global allocator around mimalloc); the rest is the title's console memory (about 20 GB of Wine heap plus 9 GB of tiled GPU pages). What is left of the recursion after this change is still very deep: XCL's pipeline workers grow their 512 MiB stacks to about 500 MiB on the biggest compute programs (`VirtualQuery` says the whole stack is committed under Wine, so this is measured from the guard page), and the same programs take 12-22 s each in the driver's translation. On this machine the world load is a few thousand of those, so it does not finish before the memory limit does. If the split form is meant to be cheap, the depth (not just the endless case) is worth a look. Not tested: Windows with this change (everything above is Linux + vkd3d-proton). `"ai": "omp (DeepSeek V4.1 Flash 1017)"`
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 06:41 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 06:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#issuecomment-7184679627) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
Author
Owner

@⁠bmjask on GitHub · 2026-11-25 21:09 UTC · original · reviewed

No concrete source-level defect found. Single latches preserve the required loop/back-edge invariant, optimizer behavior is adjusted to retain them, and GPU coverage compares Direct-DXIL to HLSL/DXC across wave32/split-wave64; current CI and regression evidence are green. Residual disclosed gaps are no AMD run and no output comparison for changed retail programs. I found no blocker.

**@⁠bmjask** on GitHub · 2026-11-25 21:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/1860#pullrequestreview-6065015797) · **reviewed** No concrete source-level defect found. Single latches preserve the required loop/back-edge invariant, optimizer behavior is adjusted to retain them, and GPU coverage compares Direct-DXIL to HLSL/DXC across wave32/split-wave64; current CI and regression evidence are green. Residual disclosed gaps are no AMD run and no output comparison for changed retail programs. I found no blocker.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1860/head:github-bot/gh-1860'
git switch 'github-bot/gh-1860'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1860'
git switch 'github-bot/gh-1860'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1860'
git switch 'github-bot/gh-1860'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1860'
git switch 'main'
git merge --squash 'github-bot/gh-1860'
git switch 'main'
git merge --ff-only 'github-bot/gh-1860'
git switch 'main'
git merge 'github-bot/gh-1860'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.