Recompiler: one skip variable for all forward jumps of structured code #1345

Open
github-bot wants to merge 1 commit from github-bot/gh-1345 into main AGit
Owner

@⁠Sr-0w on GitHub · 2026-11-24 15:01 UTC · original
Sr-0w:recomp-one-skip-variable → main · +103 −28 · 2 files · 1 commits · open

Part of #1269.

Every forward jump out of nested structured code had its own flag (xcl_skip_<target>), and the code after it ran under if (!(xcl_skip_a || xcl_skip_b || …)) over every jump pending at that level, written again after each block that raised another one. A long run of crossing forward jumps is therefore quadratic in HLSL. In a retail pack, one compute program of 76 699 instructions had 10 877 such guards of up to ~600 flags each (about 10 KB per line): 95 of its 147 MB of HLSL. That program is one of the six over 8 MB that are compiled at -O0 and that the driver does not finish (see the numbers in #1269).

At most one of these jumps is taken at a time: once one is taken, no code runs until its target, so no other one can be raised in between. They now share one variable holding the taken jump's target (0 = none):

  • a jump sets xcl_skip = <target + 1> (0xFFFFFFFF for the end);
  • a level's guard is if (xcl_skip == 0u) — plus || xcl_skip == <t> for targets inside a loop it enters, which the old guard left out the same way;
  • a target clears the variable if it is the one taken, outside the guard that skipped up to it;
  • after a loop body: clear the latch's jump, continue for a jump to the head, then one if (xcl_skip != 0u) break; for every other one.

What is in it

  • crates/xcl/src/gpu/recomp/mod.rs: skip_flag → skip_id / skip_taken / skip_clear; emit_structured, emit_range and the declaration use the one variable.
  • crates/xcl/src/gpu/recomp/tests.rs: crossing_forward_jumps_guard_in_linear_size — N forward jumps whose ranges cross (cannot nest as ifs). It checks that the uses of the skip variable grow linearly with N, then runs the structured and the dispatcher forms on the GPU for several jump patterns and compares the state. Without the change: 1638 for 40, 25758 for 160 and the test fails; with it, it passes.

Measured on a retail pack's 12 361 compute programs (4 heap windows, structured):

before after
the 76 699-instruction program 147 MB HLSL 51 MB
three ~45 000-instruction programs 12.7 / 12.3 / 12.0 MB 12.6 / 12.2 / 11.9 MB
all compute programs ≈ 6.11 GB 6.01 GB

This fixes the quadratic case only. The ordinary large programs that stall a world load (20 000 – 45 000 instructions, ~1 MB of DXIL) barely change: their size is per instruction.

Tested

  • Windows 11, AMD Radeon RX 7800 XT (RDNA3, 64-lane waves), DXC 1.9.2602.17.
  • cargo test --workspace -- --test-threads=4 on the PR head: 752 passed, 0 failed, 41 ignored; no SKIPPED tests.
  • jumps_to_outer_loop_heads_are_structured (120 random loop nests run in structured and dispatcher form on the GPU) passes with the change.
  • The new test fails on main (quadratic count) and passes on the PR head.

Regression run

main:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: AMD  Radeon RX 7800 XT
title: a retail title
seconds: 60
exit: 0x0
frames shown: 1521 (PresentX 1521)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18201 MB

PR head:

xcl-smoke v1
commit: c92035532ae47cd61fbd0e2d461a1fc13826359a
gpu: AMD  Radeon RX 7800 XT
title: a retail title
seconds: 60
exit: 0x0
frames shown: 1435 (PresentX 1435)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17345 MB

Not tested

  • 32-lane GPUs (NVIDIA) and the split wave64 form on them; the emitted control flow is the same for both forms.
  • DXC and driver compile time of the 76 699-instruction program after the change: at 51 MB it is still compiled at -O0 (over 8 MB), so it is still far too big for the driver; this only removes the quadratic part.
  • A 60 s smoke run does not reach the world load, where the largest compute programs are built.

AI use

  • Claude Code (Claude Opus 5.5) found the cause in the emitted HLSL, wrote the change and the test, ran the measurements and the runs, and wrote this description, under author review.

🤖 Generated with Claude Code

**@⁠Sr-0w** on GitHub · 2026-11-24 15:01 UTC · [original](https://github.com/xcl-dev/xcl/pull/1345) `Sr-0w:recomp-one-skip-variable` → `main` · +103 −28 · 2 files · 1 commits · open Part of #1269. Every forward jump out of nested structured code had its own flag (`xcl_skip_<target>`), and the code after it ran under `if (!(xcl_skip_a || xcl_skip_b || …))` over **every** jump pending at that level, written again after each block that raised another one. A long run of crossing forward jumps is therefore quadratic in HLSL. In a retail pack, one compute program of 76 699 instructions had 10 877 such guards of up to ~600 flags each (about 10 KB per line): 95 of its 147 MB of HLSL. That program is one of the six over 8 MB that are compiled at `-O0` and that the driver does not finish (see the numbers in #1269). At most one of these jumps is taken at a time: once one is taken, no code runs until its target, so no other one can be raised in between. They now share one variable holding the taken jump's target (`0` = none): - a jump sets `xcl_skip = <target + 1>` (`0xFFFFFFFF` for the end); - a level's guard is `if (xcl_skip == 0u)` — plus `|| xcl_skip == <t>` for targets inside a loop it enters, which the old guard left out the same way; - a target clears the variable if it is the one taken, outside the guard that skipped up to it; - after a loop body: clear the latch's jump, `continue` for a jump to the head, then one `if (xcl_skip != 0u) break;` for every other one. **What is in it** - `crates/xcl/src/gpu/recomp/mod.rs`: `skip_flag` → `skip_id` / `skip_taken` / `skip_clear`; `emit_structured`, `emit_range` and the declaration use the one variable. - `crates/xcl/src/gpu/recomp/tests.rs`: `crossing_forward_jumps_guard_in_linear_size` — N forward jumps whose ranges cross (cannot nest as `if`s). It checks that the uses of the skip variable grow linearly with N, then runs the structured and the dispatcher forms on the GPU for several jump patterns and compares the state. Without the change: `1638 for 40, 25758 for 160` and the test fails; with it, it passes. Measured on a retail pack's 12 361 compute programs (4 heap windows, structured): | | before | after | |---|---|---| | the 76 699-instruction program | 147 MB HLSL | 51 MB | | three ~45 000-instruction programs | 12.7 / 12.3 / 12.0 MB | 12.6 / 12.2 / 11.9 MB | | all compute programs | ≈ 6.11 GB | 6.01 GB | This fixes the quadratic case only. The ordinary large programs that stall a world load (20 000 – 45 000 instructions, ~1 MB of DXIL) barely change: their size is per instruction. **Tested** - Windows 11, AMD Radeon RX 7800 XT (RDNA3, 64-lane waves), DXC 1.9.2602.17. - `cargo test --workspace -- --test-threads=4` on the PR head: 752 passed, 0 failed, 41 ignored; no SKIPPED tests. - `jumps_to_outer_loop_heads_are_structured` (120 random loop nests run in structured and dispatcher form on the GPU) passes with the change. - The new test fails on `main` (quadratic count) and passes on the PR head. **Regression run** `main`: ``` xcl-smoke v1 commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56 gpu: AMD Radeon RX 7800 XT title: a retail title seconds: 60 exit: 0x0 frames shown: 1521 (PresentX 1521) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 18201 MB ``` PR head: ``` xcl-smoke v1 commit: c92035532ae47cd61fbd0e2d461a1fc13826359a gpu: AMD Radeon RX 7800 XT title: a retail title seconds: 60 exit: 0x0 frames shown: 1435 (PresentX 1435) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17345 MB ``` **Not tested** - 32-lane GPUs (NVIDIA) and the split wave64 form on them; the emitted control flow is the same for both forms. - DXC and driver compile time of the 76 699-instruction program after the change: at 51 MB it is still compiled at `-O0` (over 8 MB), so it is still far too big for the driver; this only removes the quadratic part. - A 60 s smoke run does not reach the world load, where the largest compute programs are built. **AI use** - Claude Code (Claude Opus 5.5) found the cause in the emitted HLSL, wrote the change and the test, ran the measurements and the runs, and wrote this description, under author review. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Every forward jump out of nested structured code had its own flag, and the
code after it ran under `if (!(flag_a || flag_b || ...))` over every jump
pending at that level, written again after each block that raised another.
In a long run of crossing jumps that is quadratic: a retail compute program
of 76 699 instructions had 10 877 such guards of up to 600 flags, 95 of its
147 MB of HLSL.

At most one of these jumps is taken at a time: once one is, no code runs
until its target. They now share one variable holding the taken jump's
target (0: none). A guard is `xcl_skip == 0u` (plus the targets inside a
loop it enters), a target clears the variable if it is the one taken, and a
loop is left with one `if (xcl_skip != 0u) break;` after its `continue`.

That program's HLSL goes from 147 MB to 51 MB. Other programs barely change
(a retail pack's compute programs: 6.11 GB to 6.01 GB).

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

@⁠futurepro62 on GitHub · 2026-11-24 15:03 UTC · original · edited 2026-11-24 15:08 UTC

Full-suite run, since this PR has no test report yet. Tested exact head c920355 (on its base 930e8b4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: crossing_forward_jumps_guard_in_linear_size.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored, no skips.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-24 15:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/1345#issuecomment-7135397924) · edited 2026-11-24 15:08 UTC Full-suite run, since this PR has no test report yet. Tested exact head `c920355` (on its base `930e8b4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **752 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `crossing_forward_jumps_guard_in_linear_size`. - Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **752 passed, 0 failed, 41 ignored**, no skips. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠mastrr9 on GitHub · 2026-11-24 15:30 UTC · original

Verified head c92035532ae47cd61fbd0e2d461a1fc13826359a on Windows 11 / NVIDIA RTX 5080 (wave32 / split-wave64, DXC 1.9.2602.17, Rust MSVC, debug build, clean worktree):

  • cargo test -p xcl --lib -- gpu::recomp --test-threads=4: 190 passed, 0 failed, 18 ignored (0 new compiler warnings).

Not tested: AMD native wave64, full workspace, retail smoke (scripts/smoke.ps1).
AI use: T3 Code (Antigravity / Claude Sonnet 5.5) ran the build and tests on our RTX 5080 and drafted this report.

**@⁠mastrr9** on GitHub · 2026-11-24 15:30 UTC · [original](https://github.com/xcl-dev/xcl/pull/1345#issuecomment-7136146348) Verified head `c92035532ae47cd61fbd0e2d461a1fc13826359a` on Windows 11 / NVIDIA RTX 5080 (wave32 / split-wave64, DXC 1.9.2602.17, Rust MSVC, debug build, clean worktree): - `cargo test -p xcl --lib -- gpu::recomp --test-threads=4`: **190 passed, 0 failed, 18 ignored** (0 new compiler warnings). **Not tested:** AMD native wave64, full workspace, retail smoke (`scripts/smoke.ps1`). **AI use:** T3 Code (Antigravity / Claude Sonnet 5.5) ran the build and tests on our RTX 5080 and drafted this report.
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-24 15:49 UTC · original

Wave32 GPU follow-up on c920355, Windows 11 build 26300, RTX 3080 Ti / 621.35, DXC 1.8.2502.11, Rust 1.99.1 MSVC, debug.

The GPU sections of these two tests require native wave64 as written. In a scratch copy I selected wave32 in the test fixtures and left the PR’s translator code unchanged.

  • crossing_forward_jumps_guard_in_linear_size: 1 passed. Both generated forms matched an independent CPU reference for all six branch inputs.
  • jumps_to_outer_loop_heads_are_structured: 1 passed. All 120 generated programs ran both ways, including 70 with jumps into a loop. The scalar registers, vector registers and condition flag matched.

Each filter ran under cargo test --offline --locked -p xcl --lib <filter> -- --test-threads=1 --nocapture. Synthetic wave32 coverage only.

AI-assisted. Codex (GPT-6 family, exact variant unavailable) adapted and ran the fixtures and drafted this report.

**@⁠thehollowedone** on GitHub · 2026-11-24 15:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/1345#issuecomment-7136683625) Wave32 GPU follow-up on [c920355](https://github.com/ivall/xcl/commit/c92035532ae47cd61fbd0e2d461a1fc13826359a), Windows 11 build 26300, RTX 3080 Ti / 621.35, DXC 1.8.2502.11, Rust 1.99.1 MSVC, debug. The GPU sections of these two tests require native wave64 as written. In a scratch copy I selected wave32 in the test fixtures and left the PR’s translator code unchanged. - `crossing_forward_jumps_guard_in_linear_size`: 1 passed. Both generated forms matched an independent CPU reference for all six branch inputs. - `jumps_to_outer_loop_heads_are_structured`: 1 passed. All 120 generated programs ran both ways, including 70 with jumps into a loop. The scalar registers, vector registers and condition flag matched. Each filter ran under `cargo test --offline --locked -p xcl --lib <filter> -- --test-threads=1 --nocapture`. Synthetic wave32 coverage only. AI-assisted. Codex (GPT-6 family, exact variant unavailable) adapted and ran the fixtures and drafted this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 16:11 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 16:11 UTC · [original](https://github.com/xcl-dev/xcl/pull/1345#issuecomment-7137259236) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. Thanks!
Author
Owner

@⁠wondercrash on GitHub · 2026-11-24 16:26 UTC · original

We hit the same blow-up on the retail title (95cc13288a27a96e, the program from #1307) and fixed it the same way independently: one uint xcl_skip holding the pending target, guards testing a single value, loops entered in the middle letting their entry targets through. Control flow is equivalent to this PR. Three things from our version that may be worth taking:

  1. Indentation cap. With this PR, 95cc's structured HLSL is 53.0 MB, of which 42.7 MB is leading whitespace (its loops nest 65 deep). Capping indentation at 8 levels brings it to 19.3 MB (dispatcher form: 15.4 MB). DXC output is unchanged; it is text only.
  2. GPU check on 32-lane GPUs. The new GPU test only runs where 64-lane waves exist, so it is skipped on NVIDIA. Running it as wave32 there covers NVIDIA too.
  3. Optional: one loop in 95cc is entered by about 600 jumps, giving ~90 guard lines of ~14 KB each. A range test (xcl_skip > a && xcl_skip <= b) over the contiguous entry targets is equivalent and saves about 1 MB.

Note for #1269: size alone does not make 95cc compile. Its structured form at DXC -O1 did not finish, and the -O0 DXIL (9.8 MB) did not finish in the NVIDIA driver in 30 minutes (RTX 5090, driver 621.14). The cost there is the 65-deep loop nest, not the guards.

Measured on our integration tree (upstream main + our open changes), not on this PR's head alone: translation sizes from xcl shaders on the retail shaders.rpf, DXC 1.8.2502.

AI use: omp with Claude Opus 5.5 (the comparison and measurements).

**@⁠wondercrash** on GitHub · 2026-11-24 16:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/1345#issuecomment-7137676632) We hit the same blow-up on the retail title (95cc13288a27a96e, the program from #1307) and fixed it the same way independently: one `uint xcl_skip` holding the pending target, guards testing a single value, loops entered in the middle letting their entry targets through. Control flow is equivalent to this PR. Three things from our version that may be worth taking: 1. **Indentation cap.** With this PR, 95cc's structured HLSL is 53.0 MB, of which 42.7 MB is leading whitespace (its loops nest 65 deep). Capping indentation at 8 levels brings it to 19.3 MB (dispatcher form: 15.4 MB). DXC output is unchanged; it is text only. 2. **GPU check on 32-lane GPUs.** The new GPU test only runs where 64-lane waves exist, so it is skipped on NVIDIA. Running it as wave32 there covers NVIDIA too. 3. Optional: one loop in 95cc is entered by about 600 jumps, giving ~90 guard lines of ~14 KB each. A range test (`xcl_skip > a && xcl_skip <= b`) over the contiguous entry targets is equivalent and saves about 1 MB. Note for #1269: size alone does not make 95cc compile. Its structured form at DXC `-O1` did not finish, and the `-O0` DXIL (9.8 MB) did not finish in the NVIDIA driver in 30 minutes (RTX 5090, driver 621.14). The cost there is the 65-deep loop nest, not the guards. Measured on our integration tree (upstream main + our open changes), not on this PR's head alone: translation sizes from `xcl shaders` on the retail `shaders.rpf`, DXC 1.8.2502. AI use: omp with Claude Opus 5.5 (the comparison and measurements).
Author
Owner

@⁠nnonno91 on GitHub · 2026-11-24 16:35 UTC · original

Synthetic DXC scaling check on c920355

The PR’s crossing-jump fixture shows a growing DXC compile-time difference as the number of jumps increases. At 320 jumps the generated HLSL was 8.15× smaller, and median DXC time went from 6.00 s to 0.169 s.

Tested

  • Base 930e8b49c1c2ec683d22c724a398b39111cd0e56 and head c92035532ae47cd61fbd0e2d461a1fc13826359a, with separate Cargo target directories. Ryzen 7 9800X3D, Windows 11 25H2 (26200.9974), AMD Radeon(TM) Graphics (driver 32.0.21042.62, native wave64), Rust 1.100.0 MSVC, DXC 1.9.2609.5.
  • I adapted only the PR’s test fixture to write HLSL for 40, 160, and 320 crossing jumps on each revision. cargo test --locked -p xcl --lib probe_crossing_jumps_hlsl_and_gpu_results -- --nocapture --test-threads=1 also ran the 24-jump correctness fixture on native wave64. Both builds matched their dispatcher for all six inputs, with zero hardware skips.
  • I compiled each generated shader using dxc.exe -E main -T cs_6_6 -HV 2021 -O1. The table uses three paired wall-clock timings per size after one warm-up per build, alternating the order and writing a new output file for each invocation.
Crossing jumps HLSL bytes, base → PR Skip references, base → PR Median DXC, base → PR DXIL bytes, base → PR
40 79,572 → 55,483 1,638 → 195 81.44 → 30.05 ms 6,976 → 4,244
160 537,852 → 134,641 25,758 → 795 1,127.94 → 74.50 ms 18,452 → 5,032
320 1,958,716 → 240,369 102,718 → 1,595 6,001.88 → 168.65 ms 34,620 → 6,072

Not tested

  • Whole workspace suite, driver pipeline creation time, larger retail shaders, and retail-title smoke behavior in this run. The timing measures the standalone compiler on synthetic source.

AI use

  • OpenAI Codex (GPT-6, exact model variant unavailable) adapted the test fixture, ran the checks and measurements, and prepared this report.
**@⁠nnonno91** on GitHub · 2026-11-24 16:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/1345#issuecomment-7137899933) ### Synthetic DXC scaling check on `c920355` The PR’s crossing-jump fixture shows a growing DXC compile-time difference as the number of jumps increases. At 320 jumps the generated HLSL was **8.15× smaller**, and median DXC time went from **6.00 s to 0.169 s**. **Tested** - Base `930e8b49c1c2ec683d22c724a398b39111cd0e56` and head `c92035532ae47cd61fbd0e2d461a1fc13826359a`, with separate Cargo target directories. Ryzen 7 9800X3D, Windows 11 25H2 (26200.9974), AMD Radeon(TM) Graphics (driver 32.0.21042.62, native wave64), Rust 1.100.0 MSVC, DXC 1.9.2609.5. - I adapted only the PR’s test fixture to write HLSL for 40, 160, and 320 crossing jumps on each revision. `cargo test --locked -p xcl --lib probe_crossing_jumps_hlsl_and_gpu_results -- --nocapture --test-threads=1` also ran the 24-jump correctness fixture on native wave64. Both builds matched their dispatcher for all six inputs, with zero hardware skips. - I compiled each generated shader using `dxc.exe -E main -T cs_6_6 -HV 2021 -O1`. The table uses three paired wall-clock timings per size after one warm-up per build, alternating the order and writing a new output file for each invocation. | Crossing jumps | HLSL bytes, base → PR | Skip references, base → PR | Median DXC, base → PR | DXIL bytes, base → PR | | ---: | ---: | ---: | ---: | ---: | | 40 | 79,572 → 55,483 | 1,638 → 195 | 81.44 → 30.05 ms | 6,976 → 4,244 | | 160 | 537,852 → 134,641 | 25,758 → 795 | 1,127.94 → 74.50 ms | 18,452 → 5,032 | | 320 | 1,958,716 → 240,369 | 102,718 → 1,595 | 6,001.88 → 168.65 ms | 34,620 → 6,072 | **Not tested** - Whole workspace suite, driver pipeline creation time, larger retail shaders, and retail-title smoke behavior in this run. The timing measures the standalone compiler on synthetic source. **AI use** - OpenAI Codex (GPT-6, exact model variant unavailable) adapted the test fixture, ran the checks and measurements, and prepared this report.
Author
Owner

@⁠zGLados on GitHub · 2026-11-24 16:36 UTC · original

Test report for head c920355 on Windows AMD RDNA3 with the retail pack: the HLSL size and DXC memory of the 76k-instruction program, driver pipeline builds, and a 300 s title run. These cover two of the PR's Not tested points.

Tested

  • AMD Radeon RX 7700 XT (RDNA3, native wave64), driver 32.0.32015.7029; Ryzen 7 7700X, 32 GB; Windows 11 26300; rustc 1.98.1 MSVC, release; DXC 1.9.2602.17 (Windows SDK).
  • Retail shaders.rpf (1.0.2.1), xcl shaders <pack> --precompile --only cs [--pipelines] [--limit N]. Private bytes of xcl.exe were sampled every 10 s.
  • The 76,699-instruction program (95cc13288a27a96e, record 22823 here): 53.0 MB HLSL with this PR, 154.6 MB on main 930e8b4, 15.4 MB on main with b8b1f49 reverted. Without leading whitespace it is 10.3 MB with this PR against 9.4 MB reverted. What is left is indentation from nesting 121 levels deep (29 when reverted). 14,693 guards are if (xcl_skip == 0u) {.
  • DXC: with this PR, all 667 compute programs up to that record compiled with 15 DXC threads, with 0 errors and a peak of 8.8 GB. The big program alone took ~11 min at a flat ~4 GB, giving 15.6 MB of DXIL (14.1 MB reverted). On main the same command grew ~1 GB/s and I stopped it at 66 GB (15 threads). With 2 threads it reached 33 GB in 41 s. With 1 thread it was still on this program after 60 s.
  • Driver pipelines (--pipelines): one program hangs the AMD device with this PR. Record 22571 horse_standard_hair:CS_RaytracingResolve_b1139868_Wrapped (DXIL 1,068,432 B) fails CreateComputePipelineState within ~2 s. The error is DXGI_ERROR_DEVICE_REMOVED, and GetDeviceRemovedReason returns DXGI_ERROR_DEVICE_HUNG (0x887A0006). Every later pipeline is refused. It reproduced on every try, with XCL_PIPELINE_THREADS=1 and XCL_PSO_DISK_CACHE=0 (no driver blobs):
    • this PR, --limit 22571: 414 made, 0 refused; --limit 22572: 414 made, 1 refused (twice each);
    • main 930e8b4, --limit 22572: 415 made, 0 refused.
      The HRESULTs came from a build with one added eprintln! in shaders.rs (Pipelines::make throws them away). The counts above come from the unchanged head.
  • With 4 driver threads (the default), a --pipelines run went from ~8 GB to 70 GB of private bytes within 80 s once it reached records 22600–22800 (DXIL from the cache, so the driver's compiles). I stopped it there, so it is not known whether those finish.
  • 300 s title runs with A presses (XCL_PRESS_A_AT, 10–118 s), main and this PR's head, same caches. Both end with the title's own stall watchdog (+0x23cf683, "GPU Loc Sig" 7333478d, as in #505 / #534): main at 118.3 s, this PR at 116.2 s. Neither had a device removal. Peak commit was 29.8 GB on main and 29.6 GB on this PR. On this machine the title does not reach the big programs before the watchdog, so these runs cover neither the memory growth nor the hang above.

Regression run

main:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: AMD Radeon RX 7700 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 300
exit: 0xc0000005
frames shown: none logged (the run did not reach its end)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 2
peak commit: 29787 MB

PR head:

xcl-smoke v1
commit: c92035532ae47cd61fbd0e2d461a1fc13826359a
gpu: AMD Radeon RX 7700 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 300
exit: 0xc0000005
frames shown: none logged (the run did not reach its end)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 2
peak commit: 29604 MB

Not tested

  • The workspace test suite on this GPU (the RX 7800 XT runs above cover RDNA3).
  • Whether record 22571 also hangs on RDNA2/RDNA4 or NVIDIA, and which part of its new control flow the driver chokes on. I did not compare its HLSL against main's.
  • Driver build time and memory of the 53 MB program itself: the device was hung before --pipelines reached it.

AI use

  • Claude Code (Claude Opus 5.5) ran the builds, measurements and runs on this machine and wrote this report.
**@⁠zGLados** on GitHub · 2026-11-24 16:36 UTC · [original](https://github.com/xcl-dev/xcl/pull/1345#issuecomment-7137919178) Test report for head `c920355` on Windows AMD RDNA3 with the retail pack: the HLSL size and DXC memory of the 76k-instruction program, driver pipeline builds, and a 300 s title run. These cover two of the PR's **Not tested** points. **Tested** - AMD Radeon RX 7700 XT (RDNA3, native wave64), driver 32.0.32015.7029; Ryzen 7 7700X, 32 GB; Windows 11 26300; rustc 1.98.1 MSVC, release; DXC 1.9.2602.17 (Windows SDK). - Retail `shaders.rpf` (1.0.2.1), `xcl shaders <pack> --precompile --only cs [--pipelines] [--limit N]`. Private bytes of `xcl.exe` were sampled every 10 s. - **The 76,699-instruction program (`95cc13288a27a96e`, record 22823 here)**: 53.0 MB HLSL with this PR, 154.6 MB on `main` `930e8b4`, 15.4 MB on `main` with `b8b1f49` reverted. Without leading whitespace it is 10.3 MB with this PR against 9.4 MB reverted. What is left is indentation from nesting 121 levels deep (29 when reverted). 14,693 guards are `if (xcl_skip == 0u) {`. - **DXC**: with this PR, all 667 compute programs up to that record compiled with 15 DXC threads, with 0 errors and a peak of 8.8 GB. The big program alone took ~11 min at a flat ~4 GB, giving 15.6 MB of DXIL (14.1 MB reverted). On `main` the same command grew ~1 GB/s and I stopped it at 66 GB (15 threads). With 2 threads it reached 33 GB in 41 s. With 1 thread it was still on this program after 60 s. - **Driver pipelines (`--pipelines`): one program hangs the AMD device with this PR.** Record 22571 `horse_standard_hair:CS_RaytracingResolve_b1139868_Wrapped` (DXIL 1,068,432 B) fails `CreateComputePipelineState` within ~2 s. The error is `DXGI_ERROR_DEVICE_REMOVED`, and `GetDeviceRemovedReason` returns `DXGI_ERROR_DEVICE_HUNG` (0x887A0006). Every later pipeline is refused. It reproduced on every try, with `XCL_PIPELINE_THREADS=1` and `XCL_PSO_DISK_CACHE=0` (no driver blobs): - this PR, `--limit 22571`: 414 made, 0 refused; `--limit 22572`: 414 made, 1 refused (twice each); - `main` `930e8b4`, `--limit 22572`: 415 made, 0 refused. The HRESULTs came from a build with one added `eprintln!` in `shaders.rs` (`Pipelines::make` throws them away). The counts above come from the unchanged head. - With 4 driver threads (the default), a `--pipelines` run went from ~8 GB to 70 GB of private bytes within 80 s once it reached records 22600–22800 (DXIL from the cache, so the driver's compiles). I stopped it there, so it is not known whether those finish. - 300 s title runs with A presses (`XCL_PRESS_A_AT`, 10–118 s), `main` and this PR's head, same caches. Both end with the title's own stall watchdog (`+0x23cf683`, "GPU Loc Sig" 7333478d, as in #505 / #534): `main` at 118.3 s, this PR at 116.2 s. Neither had a device removal. Peak commit was 29.8 GB on `main` and 29.6 GB on this PR. On this machine the title does not reach the big programs before the watchdog, so these runs cover neither the memory growth nor the hang above. **Regression run** `main`: ``` xcl-smoke v1 commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56 gpu: AMD Radeon RX 7700 XT title: GTA6.Xbox.v1.0.2.1 seconds: 300 exit: 0xc0000005 frames shown: none logged (the run did not reach its end) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 2 peak commit: 29787 MB ``` PR head: ``` xcl-smoke v1 commit: c92035532ae47cd61fbd0e2d461a1fc13826359a gpu: AMD Radeon RX 7700 XT title: GTA6.Xbox.v1.0.2.1 seconds: 300 exit: 0xc0000005 frames shown: none logged (the run did not reach its end) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 2 peak commit: 29604 MB ``` **Not tested** - The workspace test suite on this GPU (the RX 7800 XT runs above cover RDNA3). - Whether record 22571 also hangs on RDNA2/RDNA4 or NVIDIA, and which part of its new control flow the driver chokes on. I did not compare its HLSL against `main`'s. - Driver build time and memory of the 53 MB program itself: the device was hung before `--pipelines` reached it. **AI use** - Claude Code (Claude Opus 5.5) ran the builds, measurements and runs on this machine and wrote this report.
Author
Owner

@⁠Pipodi on GitHub · 2026-11-24 17:19 UTC · original

@⁠wondercrash @⁠Sr-0w: unless one of you is already opening it, I'll take point 1 above (the indentation cap of structured code) as its own small PR against main, separate from this one so it can be reviewed on its own. It only changes the text: the PR will show the HLSL size before and after on a nested program and check that DXC's output is unchanged on the tests' programs. If either of you has it ready, say so and I'll test yours on an RTX 4090 instead.

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

**@⁠Pipodi** on GitHub · 2026-11-24 17:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/1345#issuecomment-7139018590) @⁠wondercrash @⁠Sr-0w: unless one of you is already opening it, I'll take point 1 above (the indentation cap of structured code) as its own small PR against `main`, separate from this one so it can be reviewed on its own. It only changes the text: the PR will show the HLSL size before and after on a nested program and check that DXC's output is unchanged on the tests' programs. If either of you has it ready, say so and I'll test yours on an RTX 4090 instead. AI use: Claude Code (Claude Opus 5.5) wrote this comment.
Author
Owner

@⁠LocranKing on GitHub · 2026-11-24 17:43 UTC · original

Independent Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB, wave32) test and retail smoke report on clean head c92035532ae47cd61fbd0e2d461a1fc13826359a.

Tested

  • Commit: c92035532ae47cd61fbd0e2d461a1fc13826359a (clean tree, merge-base 930e8b4)
  • Hardware / software: Windows 11 Home Build 26200, AMD Ryzen 5 5500, 31.8 GB RAM, NVIDIA GeForce RTX 3060 Ti (8024 MiB VRAM, driver 32.0.16.2101), rustc 1.100.0 (x86_64-pc-windows-msvc, MSVC 14.44.35207), DXC 1.9.2602.17 (SDK 10.0.26100.0), --release
  • cargo build --release --workspace: ok (exit 0)
  • cargo test --workspace --release --no-fail-fast -- --test-threads=4: 752 passed, 0 failed, 41 ignored, exit 0
    • SKIPPED (no wave64): gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware

Regression run
main baseline (b7aa9f3bd212088e0d927439284dc5ed325ce3c7):

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1508 (PresentX 1508)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14730 MB

PR head (c92035532ae47cd61fbd0e2d461a1fc13826359a):

xcl-smoke v1
commit: c92035532ae47cd61fbd0e2d461a1fc13826359a
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1567 (PresentX 1568)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14726 MB

Not tested: debug build, offline --precompile timings on the full shader pack, AMD / native wave64 hardware, extended gameplay past 60 s.

AI use: Antigravity (Gemini 4 Neon) ran the build, tests, and smoke runs and drafted this report from the command outputs.

**@⁠LocranKing** on GitHub · 2026-11-24 17:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/1345#issuecomment-7139611058) Independent Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB, wave32) test and retail smoke report on clean head `c92035532ae47cd61fbd0e2d461a1fc13826359a`. **Tested** - Commit: `c92035532ae47cd61fbd0e2d461a1fc13826359a` (clean tree, merge-base `930e8b4`) - Hardware / software: Windows 11 Home Build 26200, AMD Ryzen 5 5500, 31.8 GB RAM, NVIDIA GeForce RTX 3060 Ti (`8024 MiB VRAM`, driver `32.0.16.2101`), `rustc 1.100.0` (`x86_64-pc-windows-msvc`, MSVC `14.44.35207`), DXC `1.9.2602.17` (SDK `10.0.26100.0`), `--release` - `cargo build --release --workspace`: ok (`exit 0`) - `cargo test --workspace --release --no-fail-fast -- --test-threads=4`: **752 passed, 0 failed, 41 ignored**, exit `0` - `SKIPPED` (`no wave64`): `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware` **Regression run** `main` baseline (`b7aa9f3bd212088e0d927439284dc5ed325ce3c7`): ``` xcl-smoke v1 commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7 gpu: NVIDIA GeForce RTX 3060 Ti title: retail-1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1508 (PresentX 1508) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14730 MB ``` PR head (`c92035532ae47cd61fbd0e2d461a1fc13826359a`): ``` xcl-smoke v1 commit: c92035532ae47cd61fbd0e2d461a1fc13826359a gpu: NVIDIA GeForce RTX 3060 Ti title: retail-1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1567 (PresentX 1568) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14726 MB ``` **Not tested:** debug build, offline `--precompile` timings on the full shader pack, AMD / native wave64 hardware, extended gameplay past 60 s. **AI use:** Antigravity (`Gemini 4 Neon`) ran the build, tests, and smoke runs and drafted this report from the command outputs.
Author
Owner

@⁠pvfreis on GitHub · 2026-11-24 22:48 UTC · original

Since my review, #1321 (e9e94ce) is on main. c920355 still merges without a conflict, but the merged tree fails one test that main passes:

thread 'gpu::recomp::tests::oversized_structured_code_falls_back_to_pc_blocks' (21324) panicked at crates\xcl\src\gpu\recomp\tests.rs:7639:5:
200 crossing jumps: past the bound, pc blocks

cargo test --workspace --locked --offline --no-fail-fast -- --test-threads=4, debug, RTX 3060 (32-lane waves), DXC 1.9.2602.17, isolated session without a swap chain:

  • main 689f2db: 974 passed, 1 failed, 45 ignored
  • c920355 merged onto it: 974 passed, 2 failed, 45 ignored

The other failure is the e2e title test on both (no swap chain in that session). 22 identical SKIPPED lines on both. The GPU half of crossing_forward_jumps_guard_in_linear_size returns early on this adapter (no wave64).

Why: the test needs its 200-jump program to exceed STRUCTURED_BYTES_PER_CODE_BYTE (128 B of structured HLSL per code byte, mod.rs:641). With no loop to enter, as here, your guard is if (xcl_skip == 0u) however many jumps are pending, so the HLSL grows linearly and stays below the bound: nnonno91's table above for this PR's similar fixture gives 661 B per added jump of 20 code bytes, about 33 B per byte. The test needs a program that still crosses the bound, or the bound goes; @⁠tiagonogueiraa-bit named those options on #1321. Question: zGLados measured 53.0 MB of HLSL for 95cc13288a27a96e with this head, and #1307 gives its code as 334 KB, so it is still about 159 B per byte, above the bound: on the merged tree it would still take the pc form. Intended? The comment above the constant ("Each guard of the structured form lists every pending skip flag") and the test's doc comment stop being true with this PR.

Correction to point 1 of my review: "so the behaviour checks out" was too broad. It rests on one scratch run (RTX 3080 Ti, wave32) of the same six inputs that point itself says cover four cases. zGLados later reported an RX 7700 XT device hang in CreateComputePipelineState for one program with this head and not with main 930e8b4 (report).

Not tested here: AMD, native wave64, a title.

Run and written with Claude Code (Claude Opus 5.5), checked with Claude Fable 5.2; each point checked by a person before posting.

**@⁠pvfreis** on GitHub · 2026-11-24 22:48 UTC · [original](https://github.com/xcl-dev/xcl/pull/1345#issuecomment-7146662052) Since my review, #1321 (`e9e94ce`) is on `main`. `c920355` still merges without a conflict, but the merged tree fails one test that `main` passes: ``` thread 'gpu::recomp::tests::oversized_structured_code_falls_back_to_pc_blocks' (21324) panicked at crates\xcl\src\gpu\recomp\tests.rs:7639:5: 200 crossing jumps: past the bound, pc blocks ``` `cargo test --workspace --locked --offline --no-fail-fast -- --test-threads=4`, debug, RTX 3060 (32-lane waves), DXC 1.9.2602.17, isolated session without a swap chain: - `main` 689f2db: 974 passed, 1 failed, 45 ignored - c920355 merged onto it: 974 passed, 2 failed, 45 ignored The other failure is the e2e title test on both (no swap chain in that session). 22 identical SKIPPED lines on both. The GPU half of `crossing_forward_jumps_guard_in_linear_size` returns early on this adapter (no wave64). Why: the test needs its 200-jump program to exceed `STRUCTURED_BYTES_PER_CODE_BYTE` (128 B of structured HLSL per code byte, `mod.rs:641`). With no loop to enter, as here, your guard is `if (xcl_skip == 0u)` however many jumps are pending, so the HLSL grows linearly and stays below the bound: nnonno91's table above for this PR's similar fixture gives 661 B per added jump of 20 code bytes, about 33 B per byte. The test needs a program that still crosses the bound, or the bound goes; @⁠tiagonogueiraa-bit named those options on #1321. Question: zGLados measured 53.0 MB of HLSL for `95cc13288a27a96e` with this head, and #1307 gives its code as 334 KB, so it is still about 159 B per byte, above the bound: on the merged tree it would still take the `pc` form. Intended? The comment above the constant ("Each guard of the structured form lists every pending skip flag") and the test's doc comment stop being true with this PR. Correction to point 1 of my review: "so the behaviour checks out" was too broad. It rests on one scratch run (RTX 3080 Ti, wave32) of the same six inputs that point itself says cover four cases. zGLados later reported an RX 7700 XT device hang in `CreateComputePipelineState` for one program with this head and not with `main` `930e8b4` ([report](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1345)). Not tested here: AMD, native wave64, a title. Run and written with Claude Code (Claude Opus 5.5), checked with Claude Fable 5.2; each point checked by a person before posting.
Author
Owner

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

Run on a 32-lane NVIDIA card (listed under Not tested).

Setup: RTX 3060 12 GB (32-lane waves, driver 32.0.16.2101), Ryzen 5 5600X, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0, DXC 1.9.2609.5, debug build. Head c920355.

Result: cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED: 2 GPU tests for no wave64 (expected on this card).

Not tested: DXC / driver compile times; a title run.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.

**@⁠jennydeth** on GitHub · 2026-11-25 14:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/1345#issuecomment-7164984072) Run on a 32-lane NVIDIA card (listed under Not tested). Setup: RTX 3060 12 GB (32-lane waves, driver 32.0.16.2101), Ryzen 5 5600X, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0, DXC 1.9.2609.5, debug build. Head c920355. Result: cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED: 2 GPU tests for no wave64 (expected on this card). Not tested: DXC / driver compile times; a title run. AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 04:53 UTC · original

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.

**@⁠DavidM1911** on GitHub · 2026-11-26 04:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/1345#issuecomment-7182990654) 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.
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/gpu/recomp/tests.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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