Recompiler: a program's HLSL has only the prelude functions it reaches #2817

Open
Alox0099 wants to merge 1 commit from upstream-pr/2827 into main
Alox0099 commented 2026-11-26 15:34:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Alox0099 on 2026-11-26T15:34:53Z.


Every translated program carries PRELUDE and PRELUDE_MEM whole – 91 helper functions, about 31 KB – and calls a few of them. The DXIL cache is keyed on the HLSL, so changing any one helper changes the key of every program, and a title then recompiles all of them, whether or not they use that helper. #587 (frexp_mant), #2334 (msad_u8, pk_sad_u16) and #2247 (rla) each did this on the retail pack. A program's HLSL now contains the globals and only the prelude functions it reaches. Changing a helper then recompiles only the programs that use it. DXC drops unreached functions, so the DXIL does not change. Part of #1269 and #2088.

What is in it

  • crates/xcl/src/gpu/recomp/emit.rs: finish puts placeholders where the two preludes go. with_preludes replaces them with the globals and the functions the program reaches: those named outside the two preludes, and in turn those that the kept functions name. A name counts wherever it appears as a whole word, so a stray match keeps a function it does not need, never the other way round. prelude_items splits a prelude into its functions, each with the comment lines above it, and the rest. Unit tests: the split puts the prelude back together exactly and finds every braced block; a program gets the functions it reaches and their dependencies, no others, and the globals; a program that names every function gets the preludes whole.
  • crates/xcl/src/gpu/recomp/tests.rs: gpu_mad_nf_f16_rounds_intermediate_in_binary16 adds calls to mad_nf_f16 to a translation. RDNA2 has no instruction that emits it, so the test now adds the definitions it needs with the probe (missing_prelude_functions, test only). Its assertions are unchanged.

Tested

  • NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.2140), AMD Ryzen 7 5800X, Windows 26H2 build 26300.9974, rustc 1.100.0; tests in debug, the measurements below and the regression runs in release
  • Rebased onto main 86e86fc. cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4, run on this commit and on 86e86fc alone:
    • this commit: 2887 passed, 5 failed, 51 ignored
    • main 86e86fc: 2885 passed, 5 failed, 51 ignored. In that run the lib test binary aborted part-way (misaligned pointer dereference in windows-core, on thread xcl-pso-ahead-2, STATUS_STACK_BUFFER_OVERRUN), so these counts are the other binaries of that run plus a rerun of cargo test -p xcl --lib -- --test-threads=4 on 86e86fc (2741 passed, 0 failed, 31 ignored).
    • The 5 failures are the same on both: test_title_runs_and_game_folder_is_untouched (raytracing AS SRV slot check), test_title_runs_under_the_debug_layer_with_dred, test_title_draws_with_a_root_signature_under_the_debug_layer, and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (counted twice by cargo). The 2 more passes are this PR's two tests.
    • The previous CI run of this PR (on eb9a9a7) failed on 8 title_textures tests that failed on main's CI at the same time (run 46261846646 on 7a649b0); they pass on 86e86fc.
  • SKIPPED on this adapter (the same 26 on both): 22 with "no wave64", pso_measurement_compiles_an_exact_synthetic_record ("cannot disable the driver cache", no Developer Mode), heap_window_out_of_memory_falls_back_to_the_switch_form and two_pass_binds_set_the_shared_view_heap ("no heap windows"), mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment ("no GPU_UPLOAD heaps")
  • Retail shader pack, 26 698 programs, measured before the rebases (main b49be18 against the same change on it, 3bdd5f2):
    • xcl shaders --recomp: the same report from both (the same programs translated, the same refusals); the whole pass took 544 s on main and 553 s here (one run each, run at the same time).
    • Every 40th program dumped by both (XCL_DUMP_HLSL, XCL_DUMP_EVERY=40: 671 programs, all stages) and compiled with dxc.exe 1.8.2502.11 with the same flags: 671 / 671 byte-identical DXIL.
    • Their HLSL is 6.6 % smaller in total, 27.6 % smaller for the 439 under 200 KB.
    • DXC on 100 of those small programs, one dxc.exe at a time: 18.3 s → 17.4 s (5 % less).
    • Of the 671 programs, frexp_mant and pk_sad_u16 are now in none (before: all 671), and rla is in 487.
  • Two of the 671 pixel shaders drop below the 1 MiB size at which XCL compiles at -O1, so DXC compiles them at -O3 instead: 0.5 s more each, 0.2–1 % smaller DXIL.

Regression run
The retail title on the RTX 3070 Ti, after a warm-up run of each build; the two blocks below were run back to back, PR first. main now prepares the whole shader pack before starting the title, which takes longer than the smoke allows here, so both runs set XCL_PREPARE=0 (README) and compile shaders as the title asks for them, as before. Frame counts vary from run to run on this PC: the other measured runs of the same two commits gave 1438 (main) and 1196 (this PR) frames.

xcl-smoke v1
commit: 86e86fcb33f94fa5d0c809d9b50af7b84bf49cce
gpu: NVIDIA GeForce RTX 3070 Ti
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1129 (PresentX 1129)
presents per 2 s (last 3): 40 33 37
device removals: 0
crashes: 0
peak commit: 16656 MB
xcl-smoke v1
commit: a59afc8dc572c6a7da8a1265f81267a44cf7b8c4
gpu: NVIDIA GeForce RTX 3070 Ti
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1134 (PresentX 1134)
presents per 2 s (last 3): 36 39 51
device removals: 0
crashes: 0
peak commit: 16516 MB

Not tested

  • AMD and Intel GPUs, wave64 hardware (the 22 "no wave64" skips above), the maintainer's RDNA4 run.
  • DXIL identity was checked on a 1-in-40 sample of the retail pack, not on every program, and not on the per-lane / direct DXIL paths (they do not use these preludes).
  • The program's own HLSL counts in the reach, comments included. A comment that names a helper keeps that helper; nothing that is used is dropped.
  • This PR itself changes the HLSL of every program once, so titles recompile once after it.
  • HANDOFF.md notes that a prelude change makes every title recompile (e.g. "Prelude changed: titles recompile"). After this PR that holds only for the programs that use the changed function.

AI use

  • Claude Code with Claude Opus 5.5: wrote the code, the tests, the measurement scripts and this description. It ran the tests and the measurements listed above on the hardware named.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5512890171 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2827). Originally posted by [Alox0099](https://github.com/Alox0099) on 2026-11-26T15:34:53Z. --- Every translated program carries `PRELUDE` and `PRELUDE_MEM` whole – 91 helper functions, about 31 KB – and calls a few of them. The DXIL cache is keyed on the HLSL, so changing any one helper changes the key of every program, and a title then recompiles all of them, whether or not they use that helper. #587 (`frexp_mant`), #2334 (`msad_u8`, `pk_sad_u16`) and #2247 (`rla`) each did this on the retail pack. A program's HLSL now contains the globals and only the prelude functions it reaches. Changing a helper then recompiles only the programs that use it. DXC drops unreached functions, so the DXIL does not change. Part of #1269 and #2088. **What is in it** - `crates/xcl/src/gpu/recomp/emit.rs`: `finish` puts placeholders where the two preludes go. `with_preludes` replaces them with the globals and the functions the program reaches: those named outside the two preludes, and in turn those that the kept functions name. A name counts wherever it appears as a whole word, so a stray match keeps a function it does not need, never the other way round. `prelude_items` splits a prelude into its functions, each with the comment lines above it, and the rest. Unit tests: the split puts the prelude back together exactly and finds every braced block; a program gets the functions it reaches and their dependencies, no others, and the globals; a program that names every function gets the preludes whole. - `crates/xcl/src/gpu/recomp/tests.rs`: `gpu_mad_nf_f16_rounds_intermediate_in_binary16` adds calls to `mad_nf_f16` to a translation. RDNA2 has no instruction that emits it, so the test now adds the definitions it needs with the probe (`missing_prelude_functions`, test only). Its assertions are unchanged. **Tested** - NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.2140), AMD Ryzen 7 5800X, Windows 26H2 build 26300.9974, rustc 1.100.0; tests in debug, the measurements below and the regression runs in release - Rebased onto main 86e86fc. `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`, run on this commit and on 86e86fc alone: - this commit: 2887 passed, 5 failed, 51 ignored - main 86e86fc: 2885 passed, 5 failed, 51 ignored. In that run the lib test binary aborted part-way (`misaligned pointer dereference` in windows-core, on thread `xcl-pso-ahead-2`, STATUS_STACK_BUFFER_OVERRUN), so these counts are the other binaries of that run plus a rerun of `cargo test -p xcl --lib -- --test-threads=4` on 86e86fc (2741 passed, 0 failed, 31 ignored). - The 5 failures are the same on both: `test_title_runs_and_game_folder_is_untouched` (raytracing AS SRV slot check), `test_title_runs_under_the_debug_layer_with_dred`, `test_title_draws_with_a_root_signature_under_the_debug_layer`, and `two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs` (counted twice by cargo). The 2 more passes are this PR's two tests. - The previous CI run of this PR (on eb9a9a7) failed on 8 `title_textures` tests that failed on main's CI at the same time (run 46261846646 on 7a649b0); they pass on 86e86fc. - SKIPPED on this adapter (the same 26 on both): 22 with "no wave64", `pso_measurement_compiles_an_exact_synthetic_record` ("cannot disable the driver cache", no Developer Mode), `heap_window_out_of_memory_falls_back_to_the_switch_form` and `two_pass_binds_set_the_shared_view_heap` ("no heap windows"), `mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment` ("no GPU_UPLOAD heaps") - Retail shader pack, 26 698 programs, measured before the rebases (main b49be18 against the same change on it, 3bdd5f2): - `xcl shaders --recomp`: the same report from both (the same programs translated, the same refusals); the whole pass took 544 s on main and 553 s here (one run each, run at the same time). - Every 40th program dumped by both (`XCL_DUMP_HLSL`, `XCL_DUMP_EVERY=40`: 671 programs, all stages) and compiled with `dxc.exe` 1.8.2502.11 with the same flags: **671 / 671 byte-identical DXIL**. - Their HLSL is 6.6 % smaller in total, 27.6 % smaller for the 439 under 200 KB. - DXC on 100 of those small programs, one `dxc.exe` at a time: 18.3 s → 17.4 s (5 % less). - Of the 671 programs, `frexp_mant` and `pk_sad_u16` are now in none (before: all 671), and `rla` is in 487. - Two of the 671 pixel shaders drop below the 1 MiB size at which XCL compiles at `-O1`, so DXC compiles them at `-O3` instead: 0.5 s more each, 0.2–1 % smaller DXIL. **Regression run** The retail title on the RTX 3070 Ti, after a warm-up run of each build; the two blocks below were run back to back, PR first. main now prepares the whole shader pack before starting the title, which takes longer than the smoke allows here, so both runs set `XCL_PREPARE=0` (README) and compile shaders as the title asks for them, as before. Frame counts vary from run to run on this PC: the other measured runs of the same two commits gave 1438 (main) and 1196 (this PR) frames. ``` xcl-smoke v1 commit: 86e86fcb33f94fa5d0c809d9b50af7b84bf49cce gpu: NVIDIA GeForce RTX 3070 Ti title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1129 (PresentX 1129) presents per 2 s (last 3): 40 33 37 device removals: 0 crashes: 0 peak commit: 16656 MB ``` ``` xcl-smoke v1 commit: a59afc8dc572c6a7da8a1265f81267a44cf7b8c4 gpu: NVIDIA GeForce RTX 3070 Ti title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1134 (PresentX 1134) presents per 2 s (last 3): 36 39 51 device removals: 0 crashes: 0 peak commit: 16516 MB ``` **Not tested** - AMD and Intel GPUs, wave64 hardware (the 22 "no wave64" skips above), the maintainer's RDNA4 run. - DXIL identity was checked on a 1-in-40 sample of the retail pack, not on every program, and not on the per-lane / direct DXIL paths (they do not use these preludes). - The program's own HLSL counts in the reach, comments included. A comment that names a helper keeps that helper; nothing that is used is dropped. - This PR itself changes the HLSL of every program once, so titles recompile once after it. - `HANDOFF.md` notes that a prelude change makes every title recompile (e.g. "Prelude changed: titles recompile"). After this PR that holds only for the programs that use the changed function. **AI use** - Claude Code with Claude Opus 5.5: wrote the code, the tests, the measurement scripts and this description. It ran the tests and the measurements listed above on the hardware named. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
SzczepanGrela commented 2026-11-26 16:06:19 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SzczepanGrela on 2026-11-26T15:49:19Z.


RDNA4 / Wine check of the HLSL prelude pruning, including byte comparisons with the current main.

Tested

  • Exact head 3bdd5f2fa7bc5566fb633739765bb84882257573, whose parent is b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7.
  • Current main 8b957bec6f82495aec940944c6bf47faa02db590, and a separate copy of that main with this PR's two changed source files applied. Both files were unchanged between the parent and current main, so this integration needed no conflict resolution.
  • RX 9070 16 GB (RADV GFX1201), Ryzen 7 7700, CachyOS kernel 7.3.0-5-cachyos, Mesa 26.3.1-arch3.5, GE-Proton11-12 Wine 11.0 Staging, vkd3d-proton 8293130ebe370b1+ (local asserts-disabled build), DXC/DXIL 1.9.2602.17, Rust 1.97.1, release x86_64-pc-windows-gnu.
  • Identical local observation hooks on all three copies, active only in tests, save the HLSL/DXIL returned by dxc::compile and the kernel runner's readbacks. No original assertion was changed. Removing those hooks reconstructs the pinned source bytes.

Results

gpu::recomp::emit::tests::, at both one and four test threads:

Source Passed / failed / ignored
Current main 4 / 0 / 0
Exact PR head 6 / 0 / 0
Current main plus this PR 6 / 0 / 0

Eleven original GPU tests were then run serially in three fresh processes per source copy, alternating source order. Each process: 11 passed, 0 failed, 0 ignored. The set covers frexp f32/f16 sign handling, f64 exponent/mantissa, f32 denorm modes, QSAD/MQSAD, integer multiply/shift/BFE, format packing/saturation, global/LDS atomics, permlane/WQM and the f16 intermediate-rounding probe changed in this PR. Native wave64 ran; the tests that explicitly request wave32 also ran. gpu_qsad_and_mqsad additionally exercises its own direct-DXIL controls. No capability skips in any of the 15 top-level processes.

From those GPU processes:

  • 16 HLSL variants per process, 144 captured successful compilations in total. Every corresponding DXIL container is byte-identical across main, exact head, integrated head and all repetitions, checked with SHA-256 and complete file comparisons. The 18 additional compilations from the emitter-module runs also match.
  • Across the 16 variants, main HLSL totals 608,269 bytes, exact/integrated head 128,877 bytes. This is a 78.8% source reduction for this small synthetic set, not a shader-pack or DXC-time measurement. The head and integrated HLSL match exactly.
  • 20 raw kernel readbacks per process, 180 total. All corresponding raw register/memory data match after checking the atomic fixture's documented variable LDS values as below.

The atomic fixture deliberately does not initialize its LDS counter. Its 64 DS_ADD_RTN_U32 old values passed an independent consecutive-values check modulo 2^32 in every run; their absolute starting value varies on main too. Lane 63's second DS_READ2 neighbor is outside the LDS area written by the fixture, and its original oracle explicitly excludes that value. Only those 65 raw slots are omitted from cross-run byte equality. The other raw slots and final global memory compare exactly; final atomic add/max values remain 64/163. This does not change or relax the original test assertions.

All summaries, skip checks, captured files, source inventories and executable hashes were independently verified.

Build: cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run. Run the libtest executable under GE-Proton Wine with the emitter-module filter and --nocapture --test-threads=1 / 4. The GPU matrix uses --exact --nocapture --test-threads=1 with these full gpu::recomp::tests:: selectors:

gpu_frexp_exp_f32_denorm_modes
gpu_frexp_f64_exp_and_mant
gpu_frexp_mant_f32_f16_keep_the_sign
gpu_qsad_and_mqsad
gpu_scalar_sext_mulhi_and_vector_i24_sub_co_ci_u64_shifts
gpu_signed_bfe_arithmetic_shift
gpu_fmt_encode_int_sat_and_f16_rtz
gpu_mad_nf_f16_rounds_intermediate_in_binary16
gpu_permlane16_wqm_and_lds_stride64
gpu_format_stores_atomics_global_lds
gpu_valu_16_and_64_bit

Inherited XCL_* flags are cleared, then explicit RX 9070 selection, XCL_REQUIRE_GPU=wave64, XCL_DIRECT_DXIL=0, XCL_DXC_THREADS=1, XCL_NETWORK=0, the DXC folder and private enabled XCL/vkd3d caches are set. The observation directory contains only these synthetic test artifacts.

Not tested

Retail inputs, scripts/smoke.ps1, full suite, native Windows, other GPUs, every prelude function or shader stage, a changed-helper cache-invalidation experiment, DXC/driver timing, startup time or FPS. The emitter module's RLA reference tests build from the full prelude constant; the eleven translator GPU tests above exercise the changed emission path.

AI use

OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, added the local observation hooks, ran the original tests on all three source copies, independently verified the evidence and drafted this report. Publication authorized by the account owner.

<!-- greyfinch-sync:ivall/xcl:comment:7196797069 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2827#issuecomment-7196797069). Originally posted by [SzczepanGrela](https://github.com/SzczepanGrela) on 2026-11-26T15:49:19Z. --- RDNA4 / Wine check of the HLSL prelude pruning, including byte comparisons with the current main. **Tested** - Exact head `3bdd5f2fa7bc5566fb633739765bb84882257573`, whose parent is `b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7`. - Current main `8b957bec6f82495aec940944c6bf47faa02db590`, and a separate copy of that main with this PR's two changed source files applied. Both files were unchanged between the parent and current main, so this integration needed no conflict resolution. - RX 9070 16 GB (RADV GFX1201), Ryzen 7 7700, CachyOS kernel 7.3.0-5-cachyos, Mesa 26.3.1-arch3.5, GE-Proton11-12 Wine 11.0 Staging, vkd3d-proton `8293130ebe370b1+` (local asserts-disabled build), DXC/DXIL 1.9.2602.17, Rust 1.97.1, release `x86_64-pc-windows-gnu`. - Identical local observation hooks on all three copies, active only in tests, save the HLSL/DXIL returned by `dxc::compile` and the kernel runner's readbacks. No original assertion was changed. Removing those hooks reconstructs the pinned source bytes. **Results** `gpu::recomp::emit::tests::`, at both one and four test threads: | Source | Passed / failed / ignored | | --- | --- | | Current main | 4 / 0 / 0 | | Exact PR head | 6 / 0 / 0 | | Current main plus this PR | 6 / 0 / 0 | Eleven original GPU tests were then run serially in three fresh processes per source copy, alternating source order. Each process: **11 passed, 0 failed, 0 ignored**. The set covers frexp f32/f16 sign handling, f64 exponent/mantissa, f32 denorm modes, QSAD/MQSAD, integer multiply/shift/BFE, format packing/saturation, global/LDS atomics, permlane/WQM and the f16 intermediate-rounding probe changed in this PR. Native wave64 ran; the tests that explicitly request wave32 also ran. `gpu_qsad_and_mqsad` additionally exercises its own direct-DXIL controls. No capability skips in any of the 15 top-level processes. From those GPU processes: - **16 HLSL variants per process**, 144 captured successful compilations in total. Every corresponding DXIL container is byte-identical across main, exact head, integrated head and all repetitions, checked with SHA-256 and complete file comparisons. The 18 additional compilations from the emitter-module runs also match. - Across the 16 variants, main HLSL totals **608,269 bytes**, exact/integrated head **128,877 bytes**. This is a 78.8% source reduction for this small synthetic set, not a shader-pack or DXC-time measurement. The head and integrated HLSL match exactly. - **20 raw kernel readbacks per process**, 180 total. All corresponding raw register/memory data match after checking the atomic fixture's documented variable LDS values as below. The atomic fixture deliberately does not initialize its LDS counter. Its 64 `DS_ADD_RTN_U32` old values passed an independent consecutive-values check modulo 2^32 in every run; their absolute starting value varies on main too. Lane 63's second `DS_READ2` neighbor is outside the LDS area written by the fixture, and its original oracle explicitly excludes that value. Only those 65 raw slots are omitted from cross-run byte equality. The other raw slots and final global memory compare exactly; final atomic add/max values remain 64/163. This does not change or relax the original test assertions. All summaries, skip checks, captured files, source inventories and executable hashes were independently verified. Build: `cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run`. Run the libtest executable under GE-Proton Wine with the emitter-module filter and `--nocapture --test-threads=1` / `4`. The GPU matrix uses `--exact --nocapture --test-threads=1` with these full `gpu::recomp::tests::` selectors: ```text gpu_frexp_exp_f32_denorm_modes gpu_frexp_f64_exp_and_mant gpu_frexp_mant_f32_f16_keep_the_sign gpu_qsad_and_mqsad gpu_scalar_sext_mulhi_and_vector_i24_sub_co_ci_u64_shifts gpu_signed_bfe_arithmetic_shift gpu_fmt_encode_int_sat_and_f16_rtz gpu_mad_nf_f16_rounds_intermediate_in_binary16 gpu_permlane16_wqm_and_lds_stride64 gpu_format_stores_atomics_global_lds gpu_valu_16_and_64_bit ``` Inherited `XCL_*` flags are cleared, then explicit RX 9070 selection, `XCL_REQUIRE_GPU=wave64`, `XCL_DIRECT_DXIL=0`, `XCL_DXC_THREADS=1`, `XCL_NETWORK=0`, the DXC folder and private enabled XCL/vkd3d caches are set. The observation directory contains only these synthetic test artifacts. **Not tested** Retail inputs, `scripts/smoke.ps1`, full suite, native Windows, other GPUs, every prelude function or shader stage, a changed-helper cache-invalidation experiment, DXC/driver timing, startup time or FPS. The emitter module's RLA reference tests build from the full prelude constant; the eleven translator GPU tests above exercise the changed emission path. **AI use** OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, added the local observation hooks, ran the original tests on all three source copies, independently verified the evidence and drafted this report. Publication authorized by the account owner.
DarkPanda69 commented 2026-11-26 16:06:19 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-26T15:49:39Z.


AMD run with native wave64 (listed as untested), and an RTX 3060 in the same PC: no change from main on either card.

Tested: pass, head 3bdd5f2 applied on main 8b957be, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17, XCL_DIRECT_DXIL unset (the HLSL path), card picked with XCL_ADAPTER.
cargo test -p xcl --lib -- gpu:: --test-threads=4 --nocapture, main and this PR one after the other on each card:

  • AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, waves 32..64: main 708 passed, 2 failed, 6 SKIPPED; this PR 710 passed, 2 failed, 6 SKIPPED. The 2 failures are fuzz_validate_and_gpu_1 and _3, the AMD fuzz seeds in #2115, the same on main. The "no wave64" subcases that skip on NVIDIA run here.
  • NVIDIA RTX 3060, driver 32.0.16.1088, waves 32 only: main 710 passed, 0 failed, 24 SKIPPED; this PR 712 passed, 0 failed, 24 SKIPPED.

On both cards the only result changes are the two new tests, a_program_gets_the_helpers_it_reaches_and_no_others and the_preludes_split_into_their_functions_and_back, both ok. The SKIPPED sets are the same as on main.

Not tested: the retail shader pack or a title on AMD, XCL_DIRECT_DXIL=1, release, Intel.

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

<!-- greyfinch-sync:ivall/xcl:comment:7196804499 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2827#issuecomment-7196804499). Originally posted by [DarkPanda69](https://github.com/DarkPanda69) on 2026-11-26T15:49:39Z. --- AMD run with native wave64 (listed as untested), and an RTX 3060 in the same PC: no change from `main` on either card. **Tested:** pass, head `3bdd5f2` applied on `main` `8b957be`, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17, `XCL_DIRECT_DXIL` unset (the HLSL path), card picked with `XCL_ADAPTER`. `cargo test -p xcl --lib -- gpu:: --test-threads=4 --nocapture`, `main` and this PR one after the other on each card: - AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, waves 32..64: `main` 708 passed, 2 failed, 6 SKIPPED; this PR 710 passed, 2 failed, 6 SKIPPED. The 2 failures are `fuzz_validate_and_gpu_1` and `_3`, the AMD fuzz seeds in #2115, the same on `main`. The "no wave64" subcases that skip on NVIDIA run here. - NVIDIA RTX 3060, driver 32.0.16.1088, waves 32 only: `main` 710 passed, 0 failed, 24 SKIPPED; this PR 712 passed, 0 failed, 24 SKIPPED. On both cards the only result changes are the two new tests, `a_program_gets_the_helpers_it_reaches_and_no_others` and `the_preludes_split_into_their_functions_and_back`, both ok. The SKIPPED sets are the same as on `main`. **Not tested:** the retail shader pack or a title on AMD, `XCL_DIRECT_DXIL=1`, release, Intel. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Decodere commented 2026-11-26 18:34:57 +00:00 (Migrated from github.com)

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


Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2827 at 3bdd5f2fa7bc5566fb633739765bb84882257573 (exact parent & merge-base b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7). Measurements and targeted test results only; not a full source review.

Setup

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6 cores / 12 threads), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200
  • Toolchain / caches: rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2609.5, release builds, quiet machine (zero concurrent builds/tests during timed runs; note emit.rs changes XCL_TRANSLATOR_SOURCE_ID, so HLSL-path shaders translated under 3bdd5f2f compiled into a fresh translator namespace)
  • Workload: Retail workload title: 29640639 via scripts/smoke.ps1 -Seconds 60 (XCL_NETWORK=0, default flags, no input)

Targeted RTX 4060 release unit & GPU tests (3bdd5f2f)

  • cargo test --release -p xcl --lib the_preludes_split_into_their_functions_and_back -- --nocapture: 1 passed, 0 failed, 0 ignored (0.00 s, 0 SKIPPED).
  • cargo test --release -p xcl --lib a_program_gets_the_helpers_it_reaches_and_no_others -- --nocapture: 1 passed, 0 failed, 0 ignored (0.00 s, 0 SKIPPED).
  • cargo test --release -p xcl --lib gpu::recomp::: 403 passed, 0 failed, 20 ignored (4.87 s; 23 SKIPPED notices: 20 no wave64 on NVIDIA wave32 RTX 4060 + 3 pre-existing #1426 per-lane-form refusals for V_MUL_F16, V_PK_MUL_F16, V_CVT_F16_F32).

Paired 60 s RTX 4060 smoke (exact parent b49be183 vs 3bdd5f2f)

Both runs completed cleanly at steady 60/2 s pacing with 0 device removals and 0 crashes (3bdd5f2f xcl.log: 6,176 / 6,116 MB peak/end local VRAM, 4,683 MB end non-local VRAM, 19,540 translated draws / 1,024 dispatches with 0 skipped).

Exact parent (b49be183):

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

PR #2827 head (3bdd5f2f):

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

Limits of coverage

  • Full workspace test suite was not run on 3bdd5f2f (only the 2 new tests individually, all 403 passing tests in gpu::recomp::, release build, and exact-parent paired 60 s smokes); 20 wave64 GPU tests skipped on wave32 NVIDIA hardware.
  • No standalone DXC compile-time microbenchmark across large shader corpora was timed separately here; visual inspection beyond the 60 s no-input smoke was not performed.
  • Single discrete NVIDIA 8 GB GPU (RTX 4060) on native Windows 11; no AMD, Intel, or Wine/Linux run on this host.

AI use

Ran the targeted release unit/GPU tests, release build, and exact-parent paired quiet 60 s smoke runs with assistance from Google Antigravity (Gemini 4 Neon); all test counts, timings, memory figures, and smoke blocks were extracted directly from cargo test, xcl.log, and scripts/smoke.ps1 outputs.

<!-- greyfinch-sync:ivall/xcl:comment:7200625143 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2827#issuecomment-7200625143). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-26T18:34:57Z. --- **Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2827 at `3bdd5f2fa7bc5566fb633739765bb84882257573`** (exact parent & merge-base `b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7`). Measurements and targeted test results only; not a full source review. ### Setup - **GPU:** NVIDIA GeForce RTX 4060 (8 GB / `7956 MiB` reported by D3D12), driver `32.0.16.2114` (NVIDIA `621.14`, WDDM 3.2) - **CPU / RAM / OS:** Intel Core i5-11400F (6 cores / 12 threads), 32 GB RAM (`31.9 GiB` usable), Windows 11 Home `26200` - **Toolchain / caches:** `rustc 1.100.0 (0ef1bc386 2026-11-09)`, DXC `1.9.2609.5`, release builds, quiet machine (zero concurrent builds/tests during timed runs; note `emit.rs` changes `XCL_TRANSLATOR_SOURCE_ID`, so HLSL-path shaders translated under `3bdd5f2f` compiled into a fresh translator namespace) - **Workload:** Retail workload `title: 29640639` via `scripts/smoke.ps1 -Seconds 60` (`XCL_NETWORK=0`, default flags, no input) ### Targeted RTX 4060 release unit & GPU tests (`3bdd5f2f`) - `cargo test --release -p xcl --lib the_preludes_split_into_their_functions_and_back -- --nocapture`: **1 passed, 0 failed, 0 ignored** (`0.00 s`, `0` `SKIPPED`). - `cargo test --release -p xcl --lib a_program_gets_the_helpers_it_reaches_and_no_others -- --nocapture`: **1 passed, 0 failed, 0 ignored** (`0.00 s`, `0` `SKIPPED`). - `cargo test --release -p xcl --lib gpu::recomp::`: **403 passed, 0 failed, 20 ignored** (`4.87 s`; `23` `SKIPPED` notices: `20` `no wave64` on NVIDIA wave32 RTX 4060 + `3` pre-existing `#1426` per-lane-form refusals for `V_MUL_F16`, `V_PK_MUL_F16`, `V_CVT_F16_F32`). ### Paired 60 s RTX 4060 smoke (exact parent `b49be183` vs `3bdd5f2f`) Both runs completed cleanly at steady 60/2 s pacing with `0` device removals and `0` crashes (`3bdd5f2f` `xcl.log`: `6,176` / `6,116 MB` peak/end local VRAM, `4,683 MB` end non-local VRAM, `19,540` translated draws / `1,024` dispatches with `0` skipped). Exact parent (`b49be183`): ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1518 (PresentX 1518) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14018 MB ``` PR #2827 head (`3bdd5f2f`): ``` xcl-smoke v1 commit: 3bdd5f2fa7bc5566fb633739765bb84882257573 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1600 (PresentX 1600) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14028 MB ``` ### Limits of coverage - Full workspace test suite was not run on `3bdd5f2f` (only the 2 new tests individually, all `403` passing tests in `gpu::recomp::`, release build, and exact-parent paired 60 s smokes); `20` wave64 GPU tests skipped on wave32 NVIDIA hardware. - No standalone DXC compile-time microbenchmark across large shader corpora was timed separately here; visual inspection beyond the 60 s no-input smoke was not performed. - Single discrete NVIDIA 8 GB GPU (`RTX 4060`) on native Windows 11; no AMD, Intel, or Wine/Linux run on this host. ### AI use Ran the targeted release unit/GPU tests, release build, and exact-parent paired quiet 60 s smoke runs with assistance from Google Antigravity (Gemini 4 Neon); all test counts, timings, memory figures, and smoke blocks were extracted directly from `cargo test`, `xcl.log`, and `scripts/smoke.ps1` outputs.
Foniass commented 2026-12-01 09:01:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:01:06Z.


Triage (#1607) – head a59afc8

#1043 solves the same problem differently: it splits PRELUDE_MEM by hand into blocks chosen by substrings of the body and also prunes the window accessors and FMT_INFO; this PR keeps the PRELUDE / PRELUDE_MEM functions reached through a whole-word name graph.
No problems found in the diff: with_preludes runs before windowed, but the accessors it inserts call no prelude function, and no code outside emit.rs injects calls to prelude helpers into emitted HLSL (the one test that does is adapted via missing_prelude_functions). Every DXIL cache key changes once.
Recommendation: keep open.

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

<!-- greyfinch-sync:ivall/xcl:comment:7306096474 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2827#issuecomment-7306096474). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T09:01:06Z. --- **Triage (#1607)** – head a59afc8 #1043 solves the same problem differently: it splits `PRELUDE_MEM` by hand into blocks chosen by substrings of the body and also prunes the window accessors and `FMT_INFO`; this PR keeps the `PRELUDE` / `PRELUDE_MEM` functions reached through a whole-word name graph. No problems found in the diff: `with_preludes` runs before `windowed`, but the accessors it inserts call no prelude function, and no code outside `emit.rs` injects calls to prelude helpers into emitted HLSL (the one test that does is adapted via `missing_prelude_functions`). Every DXIL cache key changes once. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
fromthemoonx commented 2026-12-03 13:14:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-03T13:14:22Z.


merge-check
base: a815de932c
head: a59afc8dc5
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3020 passed, 0 failed, 56 ignored; SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same list as on main 395405e4; failing: none
review: read the whole diff (2 files, +166 -3). No blocking finding.

  1. Same DXIL on current main. With a temporary hook, every program the tests translated was compiled twice, once with the whole preludes and once with this PR's, in an empty DXIL cache, and the containers were compared byte for byte:
tests run programs compared different or not compiling
gpu::, XCL_DIRECT_DXIL=0 383 (295 cs, 55 ps, 33 vs) 0
gpu::, XCL_DIRECT_DXIL=1 288 0
gpu::recomp, XCL_DIRECT_DXIL=0, XCL_HEAP_WINDOWS=1 359 0
hle::d3d12x::real, XCL_DIRECT_DXIL=0 2 0

The rows overlap, so the counts do not add up to distinct programs. Five compiles a run were of HLSL that a test had edited after the translation; those were not compared. All tests passed in these runs too. In the first row the HLSL is 4.1 MB instead of 17.2 MB.
2) Nothing that is added after the pruning needs a pruned function: windowed only renames mem. calls and adds the accessors, which use no prelude helper. The linked form (emit::linked_form) takes out those accessors, not the preludes.
3) The benefit holds with today's caches (from reading). The translated cache is keyed on a hash of emit.rs, so after a helper edit every program is still translated again. The DXC step is keyed on the HLSL text, so only programs that use the helper are compiled again.
4) Not tested: a retail title or its shader pack (none on this machine), AMD.
performance: one rebuild of the HLSL path's DXIL after this lands, as the description says. I did not measure the translation time; the description has 544 s on main and 553 s here for the whole pack, one run each.
verdict: safe to merge
hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300, DXC 1.9.2602.17 / Claude Code (Claude Opus 5.5)

<!-- greyfinch-sync:ivall/xcl:comment:7379517076 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2827#issuecomment-7379517076). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-12-03T13:14:22Z. --- merge-check base: a815de932c4dc8da3b383ca44f4b094aa406fec9 head: a59afc8dc572c6a7da8a1265f81267a44cf7b8c4 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3020 passed, 0 failed, 56 ignored; SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same list as on main 395405e4; failing: none review: read the whole diff (2 files, +166 -3). No blocking finding. 1) **Same DXIL on current main.** With a temporary hook, every program the tests translated was compiled twice, once with the whole preludes and once with this PR's, in an empty DXIL cache, and the containers were compared byte for byte: | tests run | programs compared | different or not compiling | |---|---|---| | `gpu::`, `XCL_DIRECT_DXIL=0` | 383 (295 cs, 55 ps, 33 vs) | 0 | | `gpu::`, `XCL_DIRECT_DXIL=1` | 288 | 0 | | `gpu::recomp`, `XCL_DIRECT_DXIL=0`, `XCL_HEAP_WINDOWS=1` | 359 | 0 | | `hle::d3d12x::real`, `XCL_DIRECT_DXIL=0` | 2 | 0 | The rows overlap, so the counts do not add up to distinct programs. Five compiles a run were of HLSL that a test had edited after the translation; those were not compared. All tests passed in these runs too. In the first row the HLSL is 4.1 MB instead of 17.2 MB. 2) Nothing that is added after the pruning needs a pruned function: `windowed` only renames `mem.` calls and adds the accessors, which use no prelude helper. The linked form (`emit::linked_form`) takes out those accessors, not the preludes. 3) The benefit holds with today's caches (from reading). The `translated` cache is keyed on a hash of `emit.rs`, so after a helper edit every program is still translated again. The DXC step is keyed on the HLSL text, so only programs that use the helper are compiled again. 4) Not tested: a retail title or its shader pack (none on this machine), AMD. performance: one rebuild of the HLSL path's DXIL after this lands, as the description says. I did not measure the translation time; the description has 544 s on main and 553 s here for the whole pack, one run each. verdict: safe to merge hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300, DXC 1.9.2602.17 / Claude Code (Claude Opus 5.5)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

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

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

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

No due date set.

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