Recompiler: direct DXIL folds EXEC selects no lane observes, and the bitcast pairs they leave #2576

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

@⁠Kalmarv on GitHub · 2026-11-25 23:38 UTC · original
Kalmarv:op-diet/on-1906 → main · +798 −36 · 7 files · 3 commits · draft

Stacked on #1906: review only the last two commits; this rebases onto main when #1906 lands.

The direct RDNA2 → DXIL translator writes a VGPR under EXEC as select(exec, new, old). Two passes in Module::optimize shrink the DXIL handed to the driver. Part of #1096.

  1. EXEC-select fold. A lane-local instruction under the same EXEC that reads such a register, and whose own result is selected by that EXEC again, never observes old. The pass tracks, per value, where it is observed (unused, only where one condition holds, all lanes) and reads through those selects; DCE drops the selects left without uses. Phis, memory, wave ops, derivatives and integer division observe all lanes and keep their selects.
  2. Bitcast-pair fold. Reading through select(exec, bitcast(f), old) turns a float operation's bitcast(select) operand into bitcast(bitcast(f)). The CSE peephole that folds such pairs runs before the select fold, so a linear pass after it maps bitcast(bitcast(x)) back to x when the types match (64-bit kept, as in the peephole).

#1972 (@⁠raylitebull) had the select-guard idea first (propagate_select_guards). The fold here tracks observation per value and reaches more selects: on the bench below it saves 8.1 % of the bytes on main against 4.1 % for #1972, and #1972 adds 0.5 % on top of it. Our offer on #1972 (#1972) to combine the two still stands. This PR came out of @⁠Decodere's suggestion on #1906 to keep these passes separate from it.

What is in it

  • Recompiler: fold direct DXIL EXEC selects no lane observes: fold_guarded_selects and lane_local in crates/xcl/src/gpu/dxil/module/opt.rs, run after CSE (XCL_DXIL_NO_OPT=select leaves it out); NO_SELECT_FOLD (tests only), handed to the translator thread in kernel.rs; unit test guarded_selects_fold_where_no_lane_sees_the_other_arm; GPU test gpu_select_fold_keeps_inactive_lanes in crates/xcl/src/gpu/dxil/select_tests.rs.
  • Recompiler: fold the bitcast pairs the EXEC select fold leaves: fold_bitcast_pairs in module/opt.rs (XCL_DXIL_NO_OPT=pairs); NO_PAIR_FOLD (tests only); unit test bitcast_pairs_left_by_the_select_fold_fold (fails with the pass left out); GPU test gpu_bitcast_pair_fold_keeps_words.
  • Both GPU tests translate the same program with and without the pass and compare every VGPR of every lane and the SGPRs. The programs are VALU chains under a narrowed, re-narrowed and restored EXEC, with v_readlane and DPP reads while lanes are off, NaN (quiet and signalling payloads), signed-zero, infinity and denormal operands, and sentinels in lanes that never run. They run in wave32 and wave64, whole and split, and the folded form must be smaller.
  • 457 changed lines: 183 runtime, 274 tests.

Tested

  • Size, offline (no GPU): a release xcl.exe translates and binds the 802 compute programs that a retail title (title: ea3b5e4d) has in use at its device-memory crash.

    tree bound DXIL MiB instructions
    main 6d12f58a 239.44 31,926,579
    main + select fold 219.95 28,068,096
    main + both passes 212.88 27,188,468
    #1906 894e29d6 235.61 30,634,434
    #1906 + both passes (this head) 210.55 26,710,803

    That is −10.6 % bytes and −12.8 % instructions on top of #1906.

  • Native code on the NVIDIA driver, RTX 5070 Ti, measured on main with and without the select fold: 4 of the largest of these programs go from 3.60 to 3.40 MB of driver blob (−5.4 %). The bitcast-pair fold changes only the DXIL: on a synthetic chain of 512 v_mul_legacy_f32 the driver's code is the same with and without it.

  • Graphics, measured on main by our graphics size bench (runtime path, XCL_DIRECT_DXIL=all): VS DXIL 30.41 → 26.73 MiB (−12.1 %), PS of the cold pipelines 104.41 → 94.73 MiB (−9.3 %), 0 failed translations.

  • GPU tests at 71b76742, on an RTX 2060 (NVIDIA 595.91) under Wine 11.21 + vkd3d-proton master 30b0eb9, DXC 1.9.2609, release test executables:

    • select_tests module::opt: 11 passed, 0 failed, 0 ignored, no SKIPPED (main e1d84b7d: 7 / 0 / 0). Both new GPU tests ran on the GPU and passed.
    • gpu::dxil --test-threads=4: 186 passed, 2 failed, 3 ignored (main e1d84b7d: 181 / 2 / 3). The same two tests fail on main on that stack: raw_loads_in_root_windows_respect_exec_and_bounds (memory-window gap of that Wine build) and directed_reference_basics (fma precision under vkd3d). SKIPPED: dispatch_chain_native_wave64_builds_whole (no wave64).
  • Whole suite at 71b76742 on an RTX 5070 Ti (NVIDIA 610.74), Windows 11 Pro 26200, rustc 1.99.0, DXC 1.9.2609, debug: cargo test --workspace --no-fail-fast -- --test-threads=4: 1,428 passed, 0 failed, 46 ignored. 25 SKIPPED notices, none from the new tests: 21 no wave64, 3 forms refused in f16_programs_on_the_gpu / f32_programs_on_the_gpu (#1426 semantics), 1 no heap windows. Then select_tests --nocapture: both new GPU tests ran and passed.

  • Output of a retail compute program (title: ea3b5e4d, program 6f3a2502a8d6b129) on the GPU, RTX 5070 Ti, native Windows D3D12, one seeded 8×16 group, guest wave64 split on wave32, full buffer and texture readback: main 6d12f58a, main + the select fold, and main + both passes each change 2,048 words, 0 different from main, and match the expected 256/256 texels; two repeated main controls also match. DXIL 477,884 → 454,064 → 437,536 bytes. The pass code is this head's, except that simplify_op takes #1906's extra argument.

Tested by others

  • Thanks to @⁠thehollowedone (#2576): 71b7674 on an RTX 3080 Ti (NVIDIA 621.35), Windows 11 26300, rustc 1.99.1, DXC 1.8.2502.11, debug. gpu_select_fold_keeps_inactive_lanes with XCL_DXIL_NO_OPT=pairs (the select fold on its own): 1 passed. gpu_bitcast_pair_fold_keeps_words: 1 passed. cargo test --workspace --no-fail-fast -- --test-threads=4: 1,428 passed, 0 failed, 46 ignored, 25 SKIPPED notices; both new GPU tests ran without a skip.
  • Thanks to @⁠DavidM1911 (#2576): RTX 3060 Ti, Windows 11, this branch merged with current main: cargo test -p xcl --lib: all passed, 0 failed, 26 ignored (no commit or pass count given).
  • Thanks to @⁠luckyteagirl (#2576): 71b76742 on an AMD Radeon RX 6800M (driver 30.0.13002.13003), Windows 11 26200, Rust 1.99.0, DXC 1.9.2609.5, debug, XCL_DIRECT_DXIL=1 XCL_REQUIRE_GPU=wave64: gpu_select_fold_keeps_inactive_lanes 1 passed, gpu_bitcast_pair_fold_keeps_words 1 passed, no SKIPPED line. The log does not show whether the native wave64 form ran.
  • Thanks to @⁠bielfreedom (#2576): 71b7674 against #1906 894e29d, both merged onto main 08db802, on an AMD RX 9070 XT (driver 32.0.32029.2010), Windows 11, release, offline xcl shaders --precompile --only cs --pipelines with every build cold. Direct DXIL over all 2,689 retail compute programs: 875.1 → 808.7 MB (−7.6 % against #1906). CreateComputePipelineState over 26 large programs, 3 interleaved rounds: mean 80.5 → 76.0 s (−5.7 %), 0 failed pipelines; faster in every round, but by 1 % in the first, which they read as a modest gain. The six split programs give 47 pieces instead of 55. Not covered by that run: heap windows, GPU output, a title run.
  • Thanks to @⁠pvfreis (#2576): NVIDIA driver code size (GetCachedBlob) on an RTX 3060 (NVIDIA 617.14), Windows 11, debug, one run. Their tree is 71b76742 with #1906 894e29d6, on main b49be183 with #2427, #2428, #2496 and #2567. 60 compute programs of one retail title, one pipeline each (XCL_DIRECT_SPLIT_INSTRUCTIONS=0), with XCL_DIRECT_DXIL=1, XCL_WINDOW_NO_CARRY=1, XCL_DXIL_OUTLINE=1, flat heap windows and translated caches off. The two passes, XCL_DXIL_NO_OPT=select against unset in the same build: driver code 32.863 → 30.536 MB (−7.1 %; 54 programs smaller, 3 the same, 3 larger), DXIL 24.170 → 21.196 MB (−12.3 %), all 120 containers pass both validators, 60/60 pipelines built per arm. #1906's own folds come to about 0 there (−0.04 %, from two builds). Not covered by that run: the pair fold on its own, the suite or any correctness check with the passes on, timing, a title run, graphics.
    • With dispatch chains on (default piece limit, one pipeline per piece, blobs summed), the same 60 programs: driver code 38.745 → 35.430 MB (−8.6 %), 288 → 248 pieces, DXIL −13.6 %; #1906's folds −1.2 % there.
  • Thanks to @⁠Royalflamejlh (#2576): NVIDIA compile time on an RTX 2070 SUPER (driver 621.01), Windows 11, debug, main b49be18 against main + 71b7674 (with #1906's commit), XCL_DIRECT_DXIL=1, heap windows, split wave64. The first CreateComputePipelineState of three large retail compute programs, 3 interleaved cold builds per tree: whole forms −7.1 %, −17.6 % and −7.3 % (medians), every build with this PR quicker than every build of main; DXIL −11 to −12 %. Built as dispatch-chain pieces one after another (9, 12, 10 pieces → 7, 10, 8), the summed time is −12 %, −7 % and −13 %, while the longest single piece got a little slower (medians 1.14 → 1.33 s, 1.16 → 1.21 s, 1.27 → 1.32 s). Not covered by that run: other NVIDIA cards and drivers, a title run.
    • With the pieces built in parallel, one thread per piece, wall time (#2576), 3 interleaved rounds: medians +3.9 % and +3.6 % with overlapping ranges for two of the programs (no difference either way), −8.8 % for the third (every build quicker). The whole forms in the same runs: −10.0 %, −18.4 % and −10.2 %.
  • Thanks to @⁠veyn-sudo (#2403): combined with #2567 3c0fc4b9 (XCL_DXIL_OUTLINE=1) and #2427 c8c2b7a6, all merged on their tree (main b49be183 plus other open PRs); #2427's flat form (XCL_HEAP_FLAT=1) was not set, so it was most likely off; this PR's own share not measured. RTX 2070 SUPER 8 GB (NVIDIA 617.14), release: over 926 compute programs the title bound, DXIL −27.5 % and driver code −21.8 %; in the title, code in use 323–353 MB against 381–410 MB, and the device was not removed in 2 of 2 runs, while the base runs were removed at about 196 s (one card, few runs). Not covered by that run: each PR on its own, main without their other PRs, AMD.

Regression run

  • Title smoke pair, 60 s each, RTX 5070 Ti, NVIDIA 610.74, release builds. The base side is #1906's head 894e29d6, the base of this stacked PR, not main. It ran after one warm-up run of the base and back to back with it, as one job beside a CPU-bound shader precompile on the same machine that was running at both ends of both sides. Frames 1,291 against 1,318 (98 %), peak commit 26,833 against 26,885 MB, no crash or device removal.

    Base, #1906's head 894e29d6:

    xcl-smoke v1
    commit: 894e29d63b3a668f5d04bb74a6cc88f06798805f
    gpu: NVIDIA GeForce RTX 5070 Ti
    title: ea3b5e4d
    seconds: 60
    exit: 0x0
    frames shown: 1318 (PresentX 1318)
    presents per 2 s (last 3): 37 43 33
    device removals: 0
    crashes: 0
    peak commit: 26885 MB
    

    This head, 71b76742:

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

Not tested

  • A smoke pair against main: the pair above uses #1906's head as its base. Once #1906 lands and this rebases, it runs again as main / head, and the description check may stay red until then.
  • NVIDIA compile time on more than one card (native size, one card's compile time with whole forms and with pieces built one after another and in parallel, and AMD driver time of this head are under Tested by others).
  • The whole suite on AMD (AMD has the two new GPU tests on an RX 6800M and the driver-time run on an RX 9070 XT); wave32-only GPUs.

AI use

  • Claude Code, Claude Opus 5.5: wrote the code, the tests, the measurements and this description.

🤖 Generated with Claude Code

**@⁠Kalmarv** on GitHub · 2026-11-25 23:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/2576) `Kalmarv:op-diet/on-1906` → `main` · +798 −36 · 7 files · 3 commits · draft Stacked on #1906: review only the last two commits; this rebases onto main when #1906 lands. The direct RDNA2 → DXIL translator writes a VGPR under EXEC as `select(exec, new, old)`. Two passes in `Module::optimize` shrink the DXIL handed to the driver. Part of #1096. 1. **EXEC-select fold.** A lane-local instruction under the same EXEC that reads such a register, and whose own result is selected by that EXEC again, never observes `old`. The pass tracks, per value, where it is observed (unused, only where one condition holds, all lanes) and reads through those selects; DCE drops the selects left without uses. Phis, memory, wave ops, derivatives and integer division observe all lanes and keep their selects. 2. **Bitcast-pair fold.** Reading through `select(exec, bitcast(f), old)` turns a float operation's `bitcast(select)` operand into `bitcast(bitcast(f))`. The CSE peephole that folds such pairs runs before the select fold, so a linear pass after it maps `bitcast(bitcast(x))` back to `x` when the types match (64-bit kept, as in the peephole). #1972 (@⁠raylitebull) had the select-guard idea first (`propagate_select_guards`). The fold here tracks observation per value and reaches more selects: on the bench below it saves 8.1 % of the bytes on main against 4.1 % for #1972, and #1972 adds 0.5 % on top of it. Our offer on #1972 (https://git.gtahub.st/github/xcl-dev--xcl/pulls/1972) to combine the two still stands. This PR came out of @⁠Decodere's suggestion on #1906 to keep these passes separate from it. **What is in it** - `Recompiler: fold direct DXIL EXEC selects no lane observes`: `fold_guarded_selects` and `lane_local` in `crates/xcl/src/gpu/dxil/module/opt.rs`, run after CSE (`XCL_DXIL_NO_OPT=select` leaves it out); `NO_SELECT_FOLD` (tests only), handed to the translator thread in `kernel.rs`; unit test `guarded_selects_fold_where_no_lane_sees_the_other_arm`; GPU test `gpu_select_fold_keeps_inactive_lanes` in `crates/xcl/src/gpu/dxil/select_tests.rs`. - `Recompiler: fold the bitcast pairs the EXEC select fold leaves`: `fold_bitcast_pairs` in `module/opt.rs` (`XCL_DXIL_NO_OPT=pairs`); `NO_PAIR_FOLD` (tests only); unit test `bitcast_pairs_left_by_the_select_fold_fold` (fails with the pass left out); GPU test `gpu_bitcast_pair_fold_keeps_words`. - Both GPU tests translate the same program with and without the pass and compare every VGPR of every lane and the SGPRs. The programs are VALU chains under a narrowed, re-narrowed and restored EXEC, with `v_readlane` and DPP reads while lanes are off, NaN (quiet and signalling payloads), signed-zero, infinity and denormal operands, and sentinels in lanes that never run. They run in wave32 and wave64, whole and split, and the folded form must be smaller. - 457 changed lines: 183 runtime, 274 tests. **Tested** - Size, offline (no GPU): a release `xcl.exe` translates and binds the 802 compute programs that a retail title (title: ea3b5e4d) has in use at its device-memory crash. | tree | bound DXIL MiB | instructions | |---|---|---| | main `6d12f58a` | 239.44 | 31,926,579 | | main + select fold | 219.95 | 28,068,096 | | main + both passes | 212.88 | 27,188,468 | | #1906 `894e29d6` | 235.61 | 30,634,434 | | #1906 + both passes (this head) | 210.55 | 26,710,803 | That is −10.6 % bytes and −12.8 % instructions on top of #1906. - Native code on the NVIDIA driver, RTX 5070 Ti, measured on main with and without the select fold: 4 of the largest of these programs go from 3.60 to 3.40 MB of driver blob (−5.4 %). The bitcast-pair fold changes only the DXIL: on a synthetic chain of 512 `v_mul_legacy_f32` the driver's code is the same with and without it. - Graphics, measured on main by our graphics size bench (runtime path, `XCL_DIRECT_DXIL=all`): VS DXIL 30.41 → 26.73 MiB (−12.1 %), PS of the cold pipelines 104.41 → 94.73 MiB (−9.3 %), 0 failed translations. - GPU tests at `71b76742`, on an RTX 2060 (NVIDIA 595.91) under Wine 11.21 + vkd3d-proton master `30b0eb9`, DXC 1.9.2609, release test executables: - `select_tests module::opt`: 11 passed, 0 failed, 0 ignored, no SKIPPED (main `e1d84b7d`: 7 / 0 / 0). Both new GPU tests ran on the GPU and passed. - `gpu::dxil --test-threads=4`: 186 passed, 2 failed, 3 ignored (main `e1d84b7d`: 181 / 2 / 3). The same two tests fail on main on that stack: `raw_loads_in_root_windows_respect_exec_and_bounds` (memory-window gap of that Wine build) and `directed_reference_basics` (fma precision under vkd3d). SKIPPED: `dispatch_chain_native_wave64_builds_whole` (no wave64). - Whole suite at `71b76742` on an RTX 5070 Ti (NVIDIA 610.74), Windows 11 Pro 26200, rustc 1.99.0, DXC 1.9.2609, debug: `cargo test --workspace --no-fail-fast -- --test-threads=4`: 1,428 passed, 0 failed, 46 ignored. 25 SKIPPED notices, none from the new tests: 21 `no wave64`, 3 forms refused in `f16_programs_on_the_gpu` / `f32_programs_on_the_gpu` (#1426 semantics), 1 `no heap windows`. Then `select_tests --nocapture`: both new GPU tests ran and passed. - Output of a retail compute program (title: ea3b5e4d, program `6f3a2502a8d6b129`) on the GPU, RTX 5070 Ti, native Windows D3D12, one seeded 8×16 group, guest wave64 split on wave32, full buffer and texture readback: main `6d12f58a`, main + the select fold, and main + both passes each change 2,048 words, 0 different from main, and match the expected 256/256 texels; two repeated main controls also match. DXIL 477,884 → 454,064 → 437,536 bytes. The pass code is this head's, except that `simplify_op` takes #1906's extra argument. **Tested by others** - Thanks to @⁠thehollowedone (https://git.gtahub.st/github/xcl-dev--xcl/pulls/2576): `71b7674` on an RTX 3080 Ti (NVIDIA 621.35), Windows 11 26300, rustc 1.99.1, DXC 1.8.2502.11, debug. `gpu_select_fold_keeps_inactive_lanes` with `XCL_DXIL_NO_OPT=pairs` (the select fold on its own): 1 passed. `gpu_bitcast_pair_fold_keeps_words`: 1 passed. `cargo test --workspace --no-fail-fast -- --test-threads=4`: 1,428 passed, 0 failed, 46 ignored, 25 SKIPPED notices; both new GPU tests ran without a skip. - Thanks to @⁠DavidM1911 (https://git.gtahub.st/github/xcl-dev--xcl/pulls/2576): RTX 3060 Ti, Windows 11, this branch merged with current main: `cargo test -p xcl --lib`: all passed, 0 failed, 26 ignored (no commit or pass count given). - Thanks to @⁠luckyteagirl (https://git.gtahub.st/github/xcl-dev--xcl/pulls/2576): `71b76742` on an AMD Radeon RX 6800M (driver 30.0.13002.13003), Windows 11 26200, Rust 1.99.0, DXC 1.9.2609.5, debug, `XCL_DIRECT_DXIL=1 XCL_REQUIRE_GPU=wave64`: `gpu_select_fold_keeps_inactive_lanes` 1 passed, `gpu_bitcast_pair_fold_keeps_words` 1 passed, no SKIPPED line. The log does not show whether the native wave64 form ran. - Thanks to @⁠bielfreedom (https://git.gtahub.st/github/xcl-dev--xcl/pulls/2576): `71b7674` against #1906 `894e29d`, both merged onto main `08db802`, on an AMD RX 9070 XT (driver 32.0.32029.2010), Windows 11, release, offline `xcl shaders --precompile --only cs --pipelines` with every build cold. Direct DXIL over all 2,689 retail compute programs: 875.1 → 808.7 MB (−7.6 % against #1906). `CreateComputePipelineState` over 26 large programs, 3 interleaved rounds: mean 80.5 → 76.0 s (−5.7 %), 0 failed pipelines; faster in every round, but by 1 % in the first, which they read as a modest gain. The six split programs give 47 pieces instead of 55. Not covered by that run: heap windows, GPU output, a title run. - Thanks to @⁠pvfreis (https://git.gtahub.st/github/xcl-dev--xcl/pulls/2576): NVIDIA driver code size (`GetCachedBlob`) on an RTX 3060 (NVIDIA 617.14), Windows 11, debug, one run. Their tree is `71b76742` with #1906 `894e29d6`, on main `b49be183` with #2427, #2428, #2496 and #2567. 60 compute programs of one retail title, one pipeline each (`XCL_DIRECT_SPLIT_INSTRUCTIONS=0`), with `XCL_DIRECT_DXIL=1`, `XCL_WINDOW_NO_CARRY=1`, `XCL_DXIL_OUTLINE=1`, flat heap windows and translated caches off. The two passes, `XCL_DXIL_NO_OPT=select` against unset in the same build: driver code 32.863 → 30.536 MB (−7.1 %; 54 programs smaller, 3 the same, 3 larger), DXIL 24.170 → 21.196 MB (−12.3 %), all 120 containers pass both validators, 60/60 pipelines built per arm. #1906's own folds come to about 0 there (−0.04 %, from two builds). Not covered by that run: the pair fold on its own, the suite or any correctness check with the passes on, timing, a title run, graphics. - With dispatch chains on (default piece limit, one pipeline per piece, blobs summed), the same 60 programs: driver code 38.745 → 35.430 MB (−8.6 %), 288 → 248 pieces, DXIL −13.6 %; #1906's folds −1.2 % there. - Thanks to @⁠Royalflamejlh (https://git.gtahub.st/github/xcl-dev--xcl/pulls/2576): NVIDIA compile time on an RTX 2070 SUPER (driver 621.01), Windows 11, debug, main `b49be18` against main + `71b7674` (with #1906's commit), `XCL_DIRECT_DXIL=1`, heap windows, split wave64. The first `CreateComputePipelineState` of three large retail compute programs, 3 interleaved cold builds per tree: whole forms −7.1 %, −17.6 % and −7.3 % (medians), every build with this PR quicker than every build of main; DXIL −11 to −12 %. Built as dispatch-chain pieces one after another (9, 12, 10 pieces → 7, 10, 8), the summed time is −12 %, −7 % and −13 %, while the longest single piece got a little slower (medians 1.14 → 1.33 s, 1.16 → 1.21 s, 1.27 → 1.32 s). Not covered by that run: other NVIDIA cards and drivers, a title run. - With the pieces built in parallel, one thread per piece, wall time (https://git.gtahub.st/github/xcl-dev--xcl/pulls/2576), 3 interleaved rounds: medians +3.9 % and +3.6 % with overlapping ranges for two of the programs (no difference either way), −8.8 % for the third (every build quicker). The whole forms in the same runs: −10.0 %, −18.4 % and −10.2 %. - Thanks to @⁠veyn-sudo (https://git.gtahub.st/github/xcl-dev--xcl/issues/2403): combined with #2567 `3c0fc4b9` (`XCL_DXIL_OUTLINE=1`) and #2427 `c8c2b7a6`, all merged on their tree (main `b49be183` plus other open PRs); #2427's flat form (`XCL_HEAP_FLAT=1`) was not set, so it was most likely off; this PR's own share not measured. RTX 2070 SUPER 8 GB (NVIDIA 617.14), release: over 926 compute programs the title bound, DXIL −27.5 % and driver code −21.8 %; in the title, code in use 323–353 MB against 381–410 MB, and the device was not removed in 2 of 2 runs, while the base runs were removed at about 196 s (one card, few runs). Not covered by that run: each PR on its own, main without their other PRs, AMD. **Regression run** - Title smoke pair, 60 s each, RTX 5070 Ti, NVIDIA 610.74, release builds. The base side is #1906's head `894e29d6`, the base of this stacked PR, not main. It ran after one warm-up run of the base and back to back with it, as one job beside a CPU-bound shader precompile on the same machine that was running at both ends of both sides. Frames 1,291 against 1,318 (98 %), peak commit 26,833 against 26,885 MB, no crash or device removal. Base, #1906's head `894e29d6`: ``` xcl-smoke v1 commit: 894e29d63b3a668f5d04bb74a6cc88f06798805f gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1318 (PresentX 1318) presents per 2 s (last 3): 37 43 33 device removals: 0 crashes: 0 peak commit: 26885 MB ``` This head, `71b76742`: ``` xcl-smoke v1 commit: 71b76742803a7055d1feb9083cdd290c56a96abc gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1291 (PresentX 1291) presents per 2 s (last 3): 38 52 5 device removals: 0 crashes: 0 peak commit: 26833 MB ``` **Not tested** - A smoke pair against main: the pair above uses #1906's head as its base. Once #1906 lands and this rebases, it runs again as main / head, and the description check may stay red until then. - NVIDIA compile time on more than one card (native size, one card's compile time with whole forms and with pieces built one after another and in parallel, and AMD driver time of this head are under **Tested by others**). - The whole suite on AMD (AMD has the two new GPU tests on an RX 6800M and the driver-time run on an RX 9070 XT); wave32-only GPUs. **AI use** - Claude Code, Claude Opus 5.5: wrote the code, the tests, the measurements and this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Extend `gpu::dxil::module::opt` to fold remaining post-phi redundancies in
direct-DXIL shaders without colliding with CFG-level folding or violating DXC
validator shader-flag invariants:

- Enable 64-bit integer constant/identity folding and DCE (`i64` arithmetic,
  shifts, `LShr(ZExt)` / `LShr(Or(ZExt, Shl(ZExt)))` window-high patterns,
  `Trunc(ZExt|SExt)`, and `i1` / `ZExt(i1)` compares) and clear
  `Feature::Int64Ops` in `Shader::infer_type_features` when no surviving
  instruction uses `i64`.
- Fold finite constant `BitCast` (`i32 <-> f32`, `i16 <-> f16`, excluding NaN
  and Inf in both directions), reuse dominating `BitCast`s from CSE, collapse
  nested same-condition `Select` chains, and push `BitCast` through `Select`
  only when the `Select` has no surviving non-bitcast uses (preventing select
  duplication).
- Canonicalize commutative integer binops (`Add`/`Mul`/`And`/`Or`/`Xor`) and
  integer `Cmp` predicates before dominator CSE, separate `XCL_DXIL_NO_OPT=fold`
  from `cse`, and expand flag-neutral `ReadNone` intrinsic DCE.
- Add validator + RTX 4060 GPU execution parity tests (direct-DXIL cache
  invalidation is automatic via `XCL_DIRECT_DXIL_SOURCE_ID`).

On a 252-program validated direct-DXIL corpus sample (100% across CS/GS/MS/PS/VS):
-3.25% DXIL bytes (-397 KB, 252/252 shrank), -6.33% instructions, -28.74%
bitcasts, -2.30% selects, -38.32% i64 ops, 0 validator errors (and 0 errors
across 977 programs in a 1,000-record sample).

Assisted-by: Google Antigravity (Gemini 4 Neon)
The direct translator writes a VGPR under EXEC as select(exec, new, old).
A lane-local instruction under the same EXEC that reads the register, and
whose own result is selected by that EXEC again, never observes the old
arm. optimize() now tracks where each value is observed (unused, only
where one condition holds, all lanes) and reads through such selects;
DCE then drops the selects left without uses. Phis, memory, wave ops,
derivatives and integer division observe all lanes.

XCL_DXIL_NO_OPT=select leaves the pass out. Tests turn it off per thread;
the translator thread takes the caller's setting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The select fold reads through select(exec, bitcast(f), old) to the
bitcast, so a float operation that read the register through
bitcast(select) now reads bitcast(bitcast(f)). The CSE peephole that
folds such pairs ran before the fold, so they stayed (6,305 in one
program of 110 k instructions). A linear pass after the fold maps
bitcast(bitcast(x)) back to x when the types match (64-bit kept, as in
the peephole); DCE drops the casts left without uses.

Measured on the 802 programs in use at the crash (bound DXIL bytes):
239.44 MiB on main, 219.95 with the select fold, 212.88 with this.

XCL_DXIL_NO_OPT=pairs leaves the pass out.

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

@⁠thehollowedone on GitHub · 2026-11-25 23:51 UTC · original

Independent NVIDIA GPU check of 71b7674 on Windows 11 build 26300, RTX 3080 Ti / 621.35, rustc 1.99.1, DXC 1.8.2502.11 (debug build).

Tested

  • With XCL_DXIL_NO_OPT=pairs, cargo test -p xcl --lib gpu_select_fold_keeps_inactive_lanes -- --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored. Disabling the pair pass makes this comparison isolate the EXEC-select fold.
  • With that variable cleared, cargo test -p xcl --lib gpu_bitcast_pair_fold_keeps_words -- --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored.
  • cargo build --workspace: passed. With the variable cleared, cargo test --workspace --no-fail-fast -- --test-threads=4: 1,428 passed, 0 failed, 46 ignored; 25 explicit SKIPPED GPU notices. The two new GPU tests passed without skips.

Not tested: AMD or native hardware wave64, production title smoke, native driver blob size, memory use, or world-load time.

AI use: Codex (GPT-6.2 Sol) reviewed the test setup, ran these commands, and drafted this report.

**@⁠thehollowedone** on GitHub · 2026-11-25 23:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/2576#issuecomment-7178147897) Independent NVIDIA GPU check of [`71b7674`](https://github.com/xcl-dev/xcl/commit/71b76742803a7055d1feb9083cdd290c56a96abc) on Windows 11 build 26300, RTX 3080 Ti / 621.35, rustc 1.99.1, DXC 1.8.2502.11 (debug build). **Tested** - With `XCL_DXIL_NO_OPT=pairs`, `cargo test -p xcl --lib gpu_select_fold_keeps_inactive_lanes -- --nocapture --test-threads=1`: 1 passed, 0 failed, 0 ignored. Disabling the pair pass makes this comparison isolate the EXEC-select fold. - With that variable cleared, `cargo test -p xcl --lib gpu_bitcast_pair_fold_keeps_words -- --nocapture --test-threads=1`: 1 passed, 0 failed, 0 ignored. - `cargo build --workspace`: passed. With the variable cleared, `cargo test --workspace --no-fail-fast -- --test-threads=4`: 1,428 passed, 0 failed, 46 ignored; 25 explicit `SKIPPED` GPU notices. The two new GPU tests passed without skips. **Not tested:** AMD or native hardware wave64, production title smoke, native driver blob size, memory use, or world-load time. AI use: Codex (GPT-6.2 Sol) reviewed the test setup, ran these commands, and drafted this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 00:01 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.

Thanks!

— Devin

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

@⁠luckyteagirl on GitHub · 2026-11-26 00:54 UTC · original

RX 6800M focused GPU report for #2576: both new select/bitcast fold parity fixtures passed on the exact PR head.

Setup: clean detached head 71b76742803a7055d1feb9083cdd290c56a96abc; Windows 11 Home build 26200; Ryzen 9 5980HX; AMD Radeon RX 6800M, driver 30.0.13002.13003; Rust 1.99.0 MSVC; DXC/dxil 1.9.2609.5. XCL_ADAPTER=6800M XCL_REQUIRE_GPU=wave64 XCL_DIRECT_DXIL=1, pinned XCL_DXC_DIR, debug lib-test build in an isolated Cargo target.

Tested: cargo test --locked -p xcl --lib -j 1 gpu_select_fold_keeps_inactive_lanes -- --test-threads=1 --show-output under a free-memory guard: 1 passed, 0 failed, 0 ignored, 0 measured, 1328 filtered out, 1.27 s, no SKIPPED line, guard did not stop the run. Then the exact gpu::dxil::select_tests::gpu_bitcast_pair_fold_keeps_words fixture was run directly from the just-built test binary with --exact --test-threads=1 --nocapture and the same environment: 1 passed, 0 failed, 0 ignored, 0 measured, 1328 filtered out, 0.59 s, no SKIPPED line. This second run did not rebuild.

Both fixtures compare folded and unfolded GPU results across all tested lanes/registers. The source always runs wave32 whole and split-wave64 forms, and conditionally runs native wave64 when runner::wave64_supported() reports true. The test output does not record that capability or print which forms ran, so I cannot confirm the native-wave64 branch from this log alone.

Not tested: full workspace suite, title smoke pair, other GPU vendors, or a measured native-wave64-only run. No game files were used.

AI use: Codex (GPT-6) and a Codex Luna subagent prepared the clean worktree, ran the focused tests, checked the counts and source-level form coverage, and wrote this report.

**@⁠luckyteagirl** on GitHub · 2026-11-26 00:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/2576#issuecomment-7179230146) **RX 6800M focused GPU report for #2576:** both new select/bitcast fold parity fixtures passed on the exact PR head. **Setup:** clean detached head `71b76742803a7055d1feb9083cdd290c56a96abc`; Windows 11 Home build 26200; Ryzen 9 5980HX; AMD Radeon RX 6800M, driver `30.0.13002.13003`; Rust 1.99.0 MSVC; DXC/dxil 1.9.2609.5. `XCL_ADAPTER=6800M XCL_REQUIRE_GPU=wave64 XCL_DIRECT_DXIL=1`, pinned `XCL_DXC_DIR`, debug lib-test build in an isolated Cargo target. **Tested:** `cargo test --locked -p xcl --lib -j 1 gpu_select_fold_keeps_inactive_lanes -- --test-threads=1 --show-output` under a free-memory guard: **1 passed, 0 failed, 0 ignored, 0 measured, 1328 filtered out**, 1.27 s, no `SKIPPED` line, guard did not stop the run. Then the exact `gpu::dxil::select_tests::gpu_bitcast_pair_fold_keeps_words` fixture was run directly from the just-built test binary with `--exact --test-threads=1 --nocapture` and the same environment: **1 passed, 0 failed, 0 ignored, 0 measured, 1328 filtered out**, 0.59 s, no `SKIPPED` line. This second run did not rebuild. Both fixtures compare folded and unfolded GPU results across all tested lanes/registers. The source always runs wave32 whole and split-wave64 forms, and conditionally runs native wave64 when `runner::wave64_supported()` reports true. The test output does not record that capability or print which forms ran, so I cannot confirm the native-wave64 branch from this log alone. **Not tested:** full workspace suite, title smoke pair, other GPU vendors, or a measured native-wave64-only run. No game files were used. **AI use:** Codex (GPT-6) and a Codex Luna subagent prepared the clean worktree, ran the focused tests, checked the counts and source-level form coverage, and wrote this report.
Author
Owner

@⁠bielfreedom on GitHub · 2026-11-26 01:55 UTC · original

AMD Windows driver timing for #2576 (the last two commits, on top of #1906): on the RX 9070 XT the EXEC-select fold cuts direct DXIL by 7.6 % over all 2,689 retail compute programs, and AMD's CreateComputePipelineState is about 6 % faster over 26 large ones. No pipeline failed.

Setup

  • GPU: RX 9070 XT 16 GB (RDNA4, native wave64), AMD driver 32.0.32029.2010.
  • CPU and memory: Ryzen 7 7700 (16 threads), 32 GB RAM, Windows 11, release.
  • Builds, both merged onto main 08db802:
    • base: #1906 at 894e29d;
    • this PR at 71b7674 (#1906 plus the two commits).
  • Both builds carry a local timing patch in xcl shaders that writes each program's DXIL size and each CreateComputePipelineState time to a file.
  • Offline: xcl shaders <retail shaders.rpf> --precompile --only cs --pipelines with XCL_DIRECT_DXIL=1, switch windows, XCL_PSO_DISK_CACHE=0, one driver thread, a fresh translation cache and a fresh executable name for every run (the AMD driver keys its own cache on the exe name, so every build is cold).

DXIL size, all 2,689 compute programs (translation only)

build total direct DXIL programs changed
main 885.9 MB
#1906 875.1 MB (−1.2 %) 2,659 vs main
this PR 808.7 MB (−7.6 % vs #1906) 2,528 vs #1906

Driver time, 26 large programs, 3 interleaved rounds

build pipelines (incl. split pieces) DXIL to driver driver time r1 / r2 / r3 peak memory
#1906 75 9.45 MB 76.1 / 81.6 / 83.9 s 1.47 GB
this PR 67 8.47 MB 75.2 / 75.4 / 77.3 s 1.39 GB

Mean 80.5 → 76.0 s (−5.7 %). The PR was faster in every round, but by 1 % in the first, so read it as a modest gain. Per program, the larger ones gain the most; small ones move in both directions, within noise:

program DXIL #1906 → PR driver ms #1906 driver ms PR
620491641aa9bad6 370 → 326 KB 10,701 / 11,328 / 11,655 10,172 / 10,280 / 10,507
6d1e4583f8129771 629 → 576 KB 6,856 / 6,997 / 7,226 6,397 / 6,300 / 6,493
6f3a2502a8d6b129 360 → 336 KB 3,440 / 3,899 / 3,851 2,944 / 2,995 / 3,021
6fd9a5ebc95aee46 317 → 288 KB 2,706 / 3,007 / 3,107 2,614 / 2,613 / 2,713

With the fold, the six split programs produce 47 pieces instead of 55.

Not tested: heap windows, GPU output, and a title run.

AI use: Claude Code (Claude Opus 5.5) built the binaries, ran the measurements and wrote this report; I posted it.

**@⁠bielfreedom** on GitHub · 2026-11-26 01:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/2576#issuecomment-7180280986) **AMD Windows driver timing for #2576 (the last two commits, on top of #1906): on the RX 9070 XT the EXEC-select fold cuts direct DXIL by 7.6 % over all 2,689 retail compute programs, and AMD's `CreateComputePipelineState` is about 6 % faster over 26 large ones.** No pipeline failed. **Setup** - GPU: RX 9070 XT 16 GB (RDNA4, native wave64), AMD driver 32.0.32029.2010. - CPU and memory: Ryzen 7 7700 (16 threads), 32 GB RAM, Windows 11, release. - Builds, both merged onto `main` `08db802`: - base: #1906 at `894e29d`; - this PR at `71b7674` (#1906 plus the two commits). - Both builds carry a local timing patch in `xcl shaders` that writes each program's DXIL size and each `CreateComputePipelineState` time to a file. - Offline: `xcl shaders <retail shaders.rpf> --precompile --only cs --pipelines` with `XCL_DIRECT_DXIL=1`, switch windows, `XCL_PSO_DISK_CACHE=0`, one driver thread, a fresh translation cache and a fresh executable name for every run (the AMD driver keys its own cache on the exe name, so every build is cold). **DXIL size, all 2,689 compute programs (translation only)** | build | total direct DXIL | programs changed | |---|---:|---:| | `main` | 885.9 MB | | | #1906 | 875.1 MB (−1.2 %) | 2,659 vs `main` | | this PR | 808.7 MB (−7.6 % vs #1906) | 2,528 vs #1906 | **Driver time, 26 large programs, 3 interleaved rounds** | build | pipelines (incl. split pieces) | DXIL to driver | driver time r1 / r2 / r3 | peak memory | |---|---:|---:|---:|---:| | #1906 | 75 | 9.45 MB | 76.1 / 81.6 / 83.9 s | 1.47 GB | | this PR | 67 | 8.47 MB | 75.2 / 75.4 / 77.3 s | 1.39 GB | Mean 80.5 → 76.0 s (−5.7 %). The PR was faster in every round, but by 1 % in the first, so read it as a modest gain. Per program, the larger ones gain the most; small ones move in both directions, within noise: | program | DXIL #1906 → PR | driver ms #1906 | driver ms PR | |---|---:|---:|---:| | `620491641aa9bad6` | 370 → 326 KB | 10,701 / 11,328 / 11,655 | 10,172 / 10,280 / 10,507 | | `6d1e4583f8129771` | 629 → 576 KB | 6,856 / 6,997 / 7,226 | 6,397 / 6,300 / 6,493 | | `6f3a2502a8d6b129` | 360 → 336 KB | 3,440 / 3,899 / 3,851 | 2,944 / 2,995 / 3,021 | | `6fd9a5ebc95aee46` | 317 → 288 KB | 2,706 / 3,007 / 3,107 | 2,614 / 2,613 / 2,713 | With the fold, the six split programs produce 47 pieces instead of 55. **Not tested:** heap windows, GPU output, and a title run. **AI use:** Claude Code (Claude Opus 5.5) built the binaries, ran the measurements and wrote this report; I posted it.
Author
Owner

@⁠pvfreis on GitHub · 2026-11-26 03:42 UTC · original · edited 2026-11-26 04:48 UTC

Test report for 71b76742 (on #1906 894e29d6), stacked on flat heap + no-carry and #2567: NVIDIA driver code size (GetCachedBlob) on Ampere.

Tested

  • RTX 3060 (617.14), Ryzen 9 5900XT, Windows 11. Sandbox: non-interactive session, Low integrity, debug, --test-threads=4, NVIDIA 32-lane waves only. One run per setting.
  • Tree 3bc3b7c6: main b49be183 + #2427 c8c2b7a6 + #2428 970823e4 + #2496 78bba5ca + #2567 89e1a91d + this PR 71b76742 (with #1906 894e29d6). #2428 has since been pushed to c6e5af86; not rerun on it (its new commit doesn't change compute translation).
  • Conflicts, both sides kept. This layer: core_tests.rs (#2567's and #1906's appended tests) and kernel.rs (this PR's test-only NO_SELECT_FOLD / NO_PAIR_FOLD hand-over around #2496's with_no_carry and #2567's outline argument). Below it: kernel.rs (#2496 against main's doc line; #2567's outline argument next to with_no_carry), real.rs (#2567's vendor id next to #2428's set_adapter_vendor).
  • Command: cargo test --workspace --locked --offline --no-fail-fast -- --test-threads=4 with only the size test enabled.
  • Size only: our size test (not in this PR) translates 60 compute records of one retail title (30 largest, 30 sampled, chosen beforehand), builds each with CreateComputePipelineState and sums GetCachedBlob sizes. Settings: XCL_DIRECT_DXIL=1, XCL_WINDOW_NO_CARRY=1, XCL_DXIL_OUTLINE=1, flat heap windows (0x304), translated caches off; XCL_DIRECT_SPLIT_INSTRUCTIONS=0 (dispatch chains off, one pipeline per record) except in the chains-on run below.
  • This PR's two passes, dispatch chains off, XCL_DXIL_NO_OPT=select vs unset in the same build:
    • driver code: 32.863 → 30.536 MB (−7.1 %); 54 records smaller, 3 the same, 3 larger; per record 0.891–1.031
    • DXIL: 24.170 → 21.196 MB (−12.3 %); per record 0.805–1.000
    • all 120 containers pass both validators; every pipeline built (60/60 per arm)
  • #1906 under it, chains off (two builds, so less exact): the same 60 with #2567 and without #1906 gave 32.875 MB, so #1906's own folds change driver code by about 0 (−0.04 %) here.
  • The whole stack, chains off, from flat heap + no-carry (34.755 MB) to this tree: 30.536 MB (−12.1 %).
  • Dispatch chains on (XCL_DIRECT_SPLIT_INSTRUCTIONS unset, so the default 12,500 instructions per piece; the same 60 records, tree and other settings; a split record is built as one pipeline per piece and the blobs are summed):
    • this PR's two passes, XCL_DXIL_NO_OPT=select vs unset in the same build: driver code 38.745 → 35.430 MB (−8.6 %); 54 records smaller, 3 the same, 3 larger; per record 0.851–1.031
    • pieces 288 → 248 (36 of the 60 records are split in both arms); every piece built and counted
    • DXIL: 31.008 → 26.778 MB (−13.6 %)
    • #1906 under it (two builds): 39.203 → 38.745 MB (−1.2 %)
    • the whole stack, from flat heap + no-carry (41.129 MB): 35.430 MB (−13.9 %)
  • The pair fold alone was not measured as its own arm.

Not tested: the suite, this PR's GPU tests or any correctness arm with these passes on; timing (build or dispatch); a title run; graphics; other GPUs.

AI use: Claude Code. Claude Opus 5.5 wrote the size test, ran it and wrote this; Claude Fable 5.2 rechecked it.

**@⁠pvfreis** on GitHub · 2026-11-26 03:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/2576#issuecomment-7181948598) · edited 2026-11-26 04:48 UTC Test report for `71b76742` (on #1906 `894e29d6`), stacked on flat heap + no-carry and #2567: NVIDIA driver code size (`GetCachedBlob`) on Ampere. **Tested** - RTX 3060 (617.14), Ryzen 9 5900XT, Windows 11. Sandbox: non-interactive session, Low integrity, debug, `--test-threads=4`, NVIDIA 32-lane waves only. One run per setting. - Tree `3bc3b7c6`: `main` `b49be183` + #2427 `c8c2b7a6` + #2428 `970823e4` + #2496 `78bba5ca` + #2567 `89e1a91d` + this PR `71b76742` (with #1906 `894e29d6`). #2428 has since been pushed to `c6e5af86`; not rerun on it (its new commit doesn't change compute translation). - Conflicts, both sides kept. This layer: `core_tests.rs` (#2567's and #1906's appended tests) and `kernel.rs` (this PR's test-only `NO_SELECT_FOLD` / `NO_PAIR_FOLD` hand-over around #2496's `with_no_carry` and #2567's `outline` argument). Below it: `kernel.rs` (#2496 against `main`'s doc line; #2567's `outline` argument next to `with_no_carry`), `real.rs` (#2567's vendor id next to #2428's `set_adapter_vendor`). - Command: `cargo test --workspace --locked --offline --no-fail-fast -- --test-threads=4` with only the size test enabled. - **Size only:** our size test (not in this PR) translates 60 compute records of one retail title (30 largest, 30 sampled, chosen beforehand), builds each with `CreateComputePipelineState` and sums `GetCachedBlob` sizes. Settings: `XCL_DIRECT_DXIL=1`, `XCL_WINDOW_NO_CARRY=1`, `XCL_DXIL_OUTLINE=1`, flat heap windows (`0x304`), translated caches off; `XCL_DIRECT_SPLIT_INSTRUCTIONS=0` (dispatch chains off, one pipeline per record) except in the chains-on run below. - **This PR's two passes, dispatch chains off**, `XCL_DXIL_NO_OPT=select` vs unset in the same build: - driver code: 32.863 → **30.536 MB (−7.1 %)**; 54 records smaller, 3 the same, 3 larger; per record 0.891–1.031 - DXIL: 24.170 → 21.196 MB (−12.3 %); per record 0.805–1.000 - all 120 containers pass both validators; every pipeline built (60/60 per arm) - **#1906 under it, chains off** (two builds, so less exact): the same 60 with #2567 and without #1906 gave 32.875 MB, so #1906's own folds change driver code by about 0 (−0.04 %) here. - **The whole stack, chains off**, from flat heap + no-carry (34.755 MB) to this tree: 30.536 MB (−12.1 %). - **Dispatch chains on** (`XCL_DIRECT_SPLIT_INSTRUCTIONS` unset, so the default 12,500 instructions per piece; the same 60 records, tree and other settings; a split record is built as one pipeline per piece and the blobs are summed): - this PR's two passes, `XCL_DXIL_NO_OPT=select` vs unset in the same build: driver code 38.745 → **35.430 MB (−8.6 %)**; 54 records smaller, 3 the same, 3 larger; per record 0.851–1.031 - pieces 288 → 248 (36 of the 60 records are split in both arms); every piece built and counted - DXIL: 31.008 → 26.778 MB (−13.6 %) - #1906 under it (two builds): 39.203 → 38.745 MB (−1.2 %) - the whole stack, from flat heap + no-carry (41.129 MB): 35.430 MB (−13.9 %) - The pair fold alone was not measured as its own arm. **Not tested:** the suite, this PR's GPU tests or any correctness arm with these passes on; timing (build or dispatch); a title run; graphics; other GPUs. **AI use:** Claude Code. Claude Opus 5.5 wrote the size test, ran it and wrote this; Claude Fable 5.2 rechecked it.
Author
Owner

@⁠Royalflamejlh on GitHub · 2026-11-26 06:15 UTC · original

NVIDIA compile time, which the description lists as not tested: on an RTX 2070 SUPER, the whole forms of three large direct compute programs of the title took 7 to 18 % less time in CreateComputePipelineState with this head, in 3 of 3 interleaved cold builds each.

Setup: main b49be18 against main + 71b7674 (merges cleanly; #1906's commit comes with it), each with a test-only probe that translates a record and times its first CreateComputePipelineState. RTX 2070 SUPER 8 GB, driver 621.01, Windows 11, debug test build, XCL_DIRECT_DXIL=1, heap windows, split wave64, the plain form. Three rounds, the two trees' order alternating; in each round both trees were built under new folder names. The driver's cache could not be turned off there, but every first build took the full time, and the second build in the same process took 0.01 s.

record main, 3 builds with this PR, 3 builds median
4d6641bffff793fa 8.54, 8.45, 8.43 s 8.17, 7.64, 7.85 s −7.1 %
7b70856bc455ac4b 15.25, 15.29, 15.21 s 12.41, 12.56, 12.85 s −17.6 %
ef008c0f04b6261a 9.31, 9.31, 9.27 s 8.56, 8.73, 8.62 s −7.3 %
  • Every build with this PR was quicker than every build of main. The three builds of one record varied by 1.3 % at most on main and 7.0 % at most with this PR.
  • Built as dispatch-chain pieces, one after another (9, 12 and 10 pieces on main; 7, 10 and 8 with this PR), the summed time went 8.07 → 7.06 s, 10.73 → 10.00 s and 8.89 → 7.72 s (medians, −12, −7 and −13 %), again with no overlap. The longest piece took longer (medians 1.14 → 1.33 s, 1.16 → 1.21 s and 1.27 → 1.32 s; for the second record the builds overlap).
  • The DXIL went from 729,000 to 644,648 B, from 986,276 to 879,408 B and from 774,072 to 687,896 B.

Not tested: the pieces built in parallel, as the runtime builds them; other NVIDIA cards and drivers (on an RTX 5070 Ti, two builds of the same main bytes took 13.29 and 15.43 s, so one build per tree there could not show a difference); Linux; the title with it.

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

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

**@⁠Royalflamejlh** on GitHub · 2026-11-26 06:15 UTC · [original](https://github.com/xcl-dev/xcl/pull/2576#issuecomment-7184249730) **NVIDIA compile time, which the description lists as not tested: on an RTX 2070 SUPER, the whole forms of three large direct compute programs of the title took 7 to 18 % less time in `CreateComputePipelineState` with this head, in 3 of 3 interleaved cold builds each.** Setup: `main` `b49be18` against `main` + `71b7674` (merges cleanly; #1906's commit comes with it), each with a test-only probe that translates a record and times its first `CreateComputePipelineState`. RTX 2070 SUPER 8 GB, driver 621.01, Windows 11, debug test build, `XCL_DIRECT_DXIL=1`, heap windows, split wave64, the plain form. Three rounds, the two trees' order alternating; in each round both trees were built under new folder names. The driver's cache could not be turned off there, but every first build took the full time, and the second build in the same process took 0.01 s. | record | `main`, 3 builds | with this PR, 3 builds | median | |---|---|---|---:| | `4d6641bffff793fa` | 8.54, 8.45, 8.43 s | 8.17, 7.64, 7.85 s | −7.1 % | | `7b70856bc455ac4b` | 15.25, 15.29, 15.21 s | 12.41, 12.56, 12.85 s | −17.6 % | | `ef008c0f04b6261a` | 9.31, 9.31, 9.27 s | 8.56, 8.73, 8.62 s | −7.3 % | - Every build with this PR was quicker than every build of `main`. The three builds of one record varied by 1.3 % at most on `main` and 7.0 % at most with this PR. - Built as dispatch-chain pieces, one after another (9, 12 and 10 pieces on `main`; 7, 10 and 8 with this PR), the summed time went 8.07 → 7.06 s, 10.73 → 10.00 s and 8.89 → 7.72 s (medians, −12, −7 and −13 %), again with no overlap. The longest piece took longer (medians 1.14 → 1.33 s, 1.16 → 1.21 s and 1.27 → 1.32 s; for the second record the builds overlap). - The DXIL went from 729,000 to 644,648 B, from 986,276 to 879,408 B and from 774,072 to 687,896 B. **Not tested:** the pieces built in parallel, as the runtime builds them; other NVIDIA cards and drivers (on an RTX 5070 Ti, two builds of the same `main` bytes took 13.29 and 15.43 s, so one build per tree there could not show a difference); Linux; the title with it. **AI use:** Claude Code (Claude Opus 5.5) ran the builds and wrote this comment. Posted without review by a person: the account owner was away and reads replies later.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-26 06:21 UTC · original

@⁠Royalflamejlh thank you, this fills the NVIDIA compile-time gap. It is now under Tested by others in the description.

What it covers: whole-form compile time of three large programs on one card (RTX 2070 SUPER, 621.01, debug), with no overlap between the trees in any of the 3 interleaved rounds, and the summed piece time. What it doesn't: pieces built in parallel, which is how the runtime builds them (the longest piece got slightly slower, so the wall time of a parallel build may gain less than the sum), other NVIDIA cards and drivers, and a title run. The description's Not tested now lists those.

AI use: Claude Code, Claude Opus 5.5 wrote this reply.

**@⁠Kalmarv** on GitHub · 2026-11-26 06:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/2576#issuecomment-7184352756) @⁠Royalflamejlh thank you, this fills the NVIDIA compile-time gap. It is now under **Tested by others** in the description. What it covers: whole-form compile time of three large programs on one card (RTX 2070 SUPER, 621.01, debug), with no overlap between the trees in any of the 3 interleaved rounds, and the summed piece time. What it doesn't: pieces built in parallel, which is how the runtime builds them (the longest piece got slightly slower, so the wall time of a parallel build may gain less than the sum), other NVIDIA cards and drivers, and a title run. The description's Not tested now lists those. AI use: Claude Code, Claude Opus 5.5 wrote this reply.
Author
Owner

@⁠Royalflamejlh on GitHub · 2026-11-26 07:50 UTC · original

@⁠Kalmarv the parallel case you listed: built all at once, the pieces of two of the three programs showed no gain with this head (the two trees' times overlap), and those of the third were quicker in every build (median −8.8 %), in 3 interleaved rounds on the same RTX 2070 SUPER.

Setup: as in my comment above, except that each program's dispatch-chain pieces were built on as many threads as there are pieces (the runtime builds them on up to min(pieces, available_parallelism − 1) workers, 15 on this PC's 16 threads, so all at once here too when no other pipeline holds the workers), and the wall time of the lot was taken. New folder names each round, the trees' order alternating.

record main, 3 rounds with this PR, 3 rounds median
4d6641bffff793fa (9 / 7 pieces) 1.47, 1.52, 1.36 s 1.59, 1.48, 1.53 s +3.9 %
7b70856bc455ac4b (12 / 10 pieces) 2.17, 2.27, 1.96 s 2.25, 2.27, 2.10 s +3.6 %
ef008c0f04b6261a (10 / 8 pieces) 1.62, 1.62, 1.62 s 1.48, 1.47, 1.55 s −8.8 %
  • For the first two the ranges overlap, so this shows no difference either way. For the third every build with this PR was quicker. So, as you suggested, a parallel build gains less than the summed time did (−12, −7 and −13 %).
  • The whole forms, built in the same runs, were again quicker in every build: −10.0, −18.4 and −10.2 % (medians; −7.1, −17.6 and −7.3 % in my first comment).

Not tested: other NVIDIA cards and drivers, Linux, the title with it.

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

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

**@⁠Royalflamejlh** on GitHub · 2026-11-26 07:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/2576#issuecomment-7185887530) @⁠Kalmarv the parallel case you listed: built all at once, the pieces of two of the three programs showed no gain with this head (the two trees' times overlap), and those of the third were quicker in every build (median −8.8 %), in 3 interleaved rounds on the same RTX 2070 SUPER. Setup: as in my comment above, except that each program's dispatch-chain pieces were built on as many threads as there are pieces (the runtime builds them on up to `min(pieces, available_parallelism − 1)` workers, 15 on this PC's 16 threads, so all at once here too when no other pipeline holds the workers), and the wall time of the lot was taken. New folder names each round, the trees' order alternating. | record | `main`, 3 rounds | with this PR, 3 rounds | median | |---|---|---|---:| | `4d6641bffff793fa` (9 / 7 pieces) | 1.47, 1.52, 1.36 s | 1.59, 1.48, 1.53 s | +3.9 % | | `7b70856bc455ac4b` (12 / 10 pieces) | 2.17, 2.27, 1.96 s | 2.25, 2.27, 2.10 s | +3.6 % | | `ef008c0f04b6261a` (10 / 8 pieces) | 1.62, 1.62, 1.62 s | 1.48, 1.47, 1.55 s | −8.8 % | - For the first two the ranges overlap, so this shows no difference either way. For the third every build with this PR was quicker. So, as you suggested, a parallel build gains less than the summed time did (−12, −7 and −13 %). - The whole forms, built in the same runs, were again quicker in every build: −10.0, −18.4 and −10.2 % (medians; −7.1, −17.6 and −7.3 % in my first comment). **Not tested:** other NVIDIA cards and drivers, Linux, the title with it. **AI use:** Claude Code (Claude Opus 5.5) ran the builds and wrote this comment. Posted without review by a person: the account owner was away and reads replies later.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-26 07:55 UTC · original

@⁠Royalflamejlh thank you for the parallel run. It is in the description now. As measured: built in parallel, the pieces of two of the three programs show no gain with this head (+3.9 % and +3.6 % medians, overlapping ranges), and only the third is quicker (−8.8 %). So the gain on that card is in the whole forms (−10.0, −18.4 and −10.2 % in the same runs) and in the summed piece time, not in a parallel piece build's wall time.

AI use: Claude Code, Claude Opus 5.5 wrote this reply.

**@⁠Kalmarv** on GitHub · 2026-11-26 07:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/2576#issuecomment-7185991584) @⁠Royalflamejlh thank you for the parallel run. It is in the description now. As measured: built in parallel, the pieces of two of the three programs show no gain with this head (+3.9 % and +3.6 % medians, overlapping ranges), and only the third is quicker (−8.8 %). So the gain on that card is in the whole forms (−10.0, −18.4 and −10.2 % in the same runs) and in the summed piece time, not in a parallel piece build's wall time. AI use: Claude Code, Claude Opus 5.5 wrote this reply.
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/2576/head:github-bot/gh-2576'
git switch 'github-bot/gh-2576'

Merge

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