Recompiler: lift literals that differ inside a family (XCL_LIFT_LITERALS) #3262

Open
KOLESNiii wants to merge 1 commit from upstream-pr/3262 into main
KOLESNiii commented 2026-11-29 02:14:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-29T02:14:47Z.


Compute programs in a title's pack that are one program with different numeric constants get their literals that differ lifted into io, so the whole family compiles to one HLSL text, one DXC result and one driver blob. Behind XCL_LIFT_LITERALS=1 (off by default) until cold-run numbers are in. Related: #2711 (identical split pieces share a container, does not fold literal variants), #2088.

Why: in a cold run of a retail game (RTX 2070 SUPER), 13 repeat driver compiles of literal-only variants took 253 s of the 1,327 s spent in the driver (19 %). Pack-wide, 127 families (312 programs) make 156 extra compiles of 2,682 compute programs (5.8 %). Example: records b162ea7db32e1657 / 0ed9e58ef6dc9cdb, 462 KB of DXIL each, compiled twice. All 21 same-size repeats in that run took the HLSL path, which is where this works.

How:

  • Preparation (xcl shaders --precompile, launch preparation) finds the families. Programs with the same instruction sequence are translated, and those whose HLSL is equal once every literal is masked form a family.
  • Only the literal positions that differ inside a family are lifted. The other constants stay folded.
  • Liftable: plain u integer literals in main's body only. Never attributes, declarations, control-flow or preprocessor lines, [], texture offsets or quad operations. A family with a differing literal anywhere else is left alone.
  • A lifted literal is uint xcl_liftN = io.Load(512 + 4N), the same 32-bit value as a uint, so the program computes the same thing. Lifting is correct for any program; the family only decides what is worth lifting.
  • The lifted text drops comments, so every member has the same text and the DXC cache and driver blob cache share it. A pipeline keeps its member's values, and both compute dispatch paths write them after the SGPRs.
  • If DXC refuses a lifted text, the program compiles as it is (logged).

What is in it

  • crates/xcl/src/gpu/recomp/lift.rs: scanner, masked hash, family positions, rewrite, family key, table (built at preparation, kept next to the caches under the translation-cache identity), unit tests, and an XCL_SAMPLE_LIFT_HLSL test over exported HLSL.
  • crates/xcl/src/gpu/recomp/pso.rs: Compiled::lifted. The HLSL path compiles a family member lifted. A member skips the translated disk cache, which keeps no lifted values.
  • crates/xcl/src/hle/d3d12x/real.rs, bind.rs, console_list.rs: per-pipeline values, written after the SGPRs by both compute dispatch paths.
  • crates/xcl/src/shaders.rs: precompile builds the family table first when enabled, with a log line.
  • crates/xcl/src/gpu/recomp/tests.rs + runner.rs: GPU test. Two programs differing only in literals give one lifted text and one DXIL container, and each gives the same output as its plain translation. runner::dispatch keeps io words past the SGPRs.

Size: ~450 changed lines outside tests (679 with them). One PR because the parts only do something together: the table without the dispatch writes would produce programs that read zeros, and the dispatch writes without the table never run.

Tested

  • NVIDIA GeForce RTX 2070 SUPER (driver 621.40), AMD Ryzen 5 3600XT, Windows 11 Home build 26300, rustc 1.100.0, debug.
  • cargo test -p xcl --lib recomp::lift::tests: 7 passed, 0 failed, 0 ignored.
  • XCL_SAMPLE_LIFT_HLSL=<export of the retail game's compute HLSL> cargo test -p xcl --lib sample_families_compile_lifted: 34 liftable families among the programs under 256 KB. The 12 smallest were compiled with DXC 1.9.2609, and each family's members gave one identical DXIL container.
  • cargo build --workspace --tests && cargo test --workspace --no-fail-fast -- --test-threads=4 on c0a0ec03 (debug; rebased onto main 81bfbf0d, run at the same time as the suites of #3262, #3242 and #3241): 2741 passed, 4 failed, 49 ignored, including gpu_lifted_literal_family_shares_dxil_and_keeps_results (ok)
    • the 4 failures are the e2e target, whose test title had not been built (missing …xcl_testtitle.exe – build first: cargo build --workspace)
    • rerun alone after cargo build --workspace: cargo test -p xcl --test e2e: 5 passed, 0 failed
    • Together: 2745 passed, 0 failed, 49 ignored
  • SKIPPED on this adapter (28): 22 no wave64, 3 f16 instructions refused (#1426 semantics differ from the console's), 2 no heap windows (opt-in XCL_HEAP_WINDOWS=1), 1 no GPU_UPLOAD heaps

Regression run

main (fa204595):

xcl-smoke v1
commit: fa204595a488c60c6c5f905244f0172072c9c2a9
gpu: NVIDIA GeForce RTX 2070 SUPER
title: retail game
seconds: 60
exit: 0x0
frames shown: 1533 (PresentX 1533)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 17409 MB

this PR's head (1d3b1cb9):

xcl-smoke v1
commit: 1d3b1cb934847faa3d11c428ee20b47c5e08b43c
gpu: NVIDIA GeForce RTX 2070 SUPER
title: retail game
seconds: 60
exit: 0x0
frames shown: 1500 (PresentX 1500)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17303 MB

Both: scripts/smoke.ps1 -Seconds 60, XCL_PREPARE=0, XCL_PRESS_AT=25:A, run through the local exclusive queue. XCL_LIFT_LITERALS is unset (off), so the lifting path is not exercised here.

These runs are on the head before the rebase (1d3b1cb9); they have not been repeated on c0a0ec03.

Not tested

  • Cold-run gain with XCL_LIFT_LITERALS=1 (preparation time, driver compiles): numbers requested from contributors in a comment below.
  • Frame-time cost of lifted literals (uniform io loads instead of folded constants).
  • AMD / Intel GPUs, wave64 adapters.
  • Families of programs over 256 KB through DXC: covered only by the runtime fallback if DXC refuses one.
  • A launch whose preparation runs in a separate builder process: the title reads the table file the first time it looks it up.

AI use

  • Claude Code, Claude Opus 5.5: wrote the code, the tests and this description. The investigation that found the families was Claude Code, Claude Opus 5.5 too.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5546729915 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3262). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-29T02:14:47Z. --- Compute programs in a title's pack that are one program with different numeric constants get their literals that differ lifted into `io`, so the whole family compiles to one HLSL text, one DXC result and one driver blob. Behind `XCL_LIFT_LITERALS=1` (off by default) until cold-run numbers are in. Related: #2711 (identical split pieces share a container, does not fold literal variants), #2088. Why: in a cold run of a retail game (RTX 2070 SUPER), 13 repeat driver compiles of literal-only variants took **253 s of the 1,327 s** spent in the driver (19 %). Pack-wide, 127 families (312 programs) make **156 extra compiles of 2,682 compute programs (5.8 %)**. Example: records `b162ea7db32e1657` / `0ed9e58ef6dc9cdb`, 462 KB of DXIL each, compiled twice. All 21 same-size repeats in that run took the HLSL path, which is where this works. How: - Preparation (`xcl shaders --precompile`, launch preparation) finds the families. Programs with the same instruction sequence are translated, and those whose HLSL is equal once every literal is masked form a family. - Only the literal positions that differ inside a family are lifted. The other constants stay folded. - Liftable: plain `u` integer literals in `main`'s body only. Never attributes, declarations, control-flow or preprocessor lines, `[]`, texture offsets or quad operations. A family with a differing literal anywhere else is left alone. - A lifted literal is `uint xcl_liftN = io.Load(512 + 4N)`, the same 32-bit value as a `uint`, so the program computes the same thing. Lifting is correct for any program; the family only decides what is worth lifting. - The lifted text drops comments, so every member has the same text and the DXC cache and driver blob cache share it. A pipeline keeps its member's values, and both compute dispatch paths write them after the SGPRs. - If DXC refuses a lifted text, the program compiles as it is (logged). **What is in it** - `crates/xcl/src/gpu/recomp/lift.rs`: scanner, masked hash, family positions, rewrite, family key, table (built at preparation, kept next to the caches under the translation-cache identity), unit tests, and an `XCL_SAMPLE_LIFT_HLSL` test over exported HLSL. - `crates/xcl/src/gpu/recomp/pso.rs`: `Compiled::lifted`. The HLSL path compiles a family member lifted. A member skips the translated disk cache, which keeps no lifted values. - `crates/xcl/src/hle/d3d12x/real.rs`, `bind.rs`, `console_list.rs`: per-pipeline values, written after the SGPRs by both compute dispatch paths. - `crates/xcl/src/shaders.rs`: precompile builds the family table first when enabled, with a log line. - `crates/xcl/src/gpu/recomp/tests.rs` + `runner.rs`: GPU test. Two programs differing only in literals give one lifted text and one DXIL container, and each gives the same output as its plain translation. `runner::dispatch` keeps io words past the SGPRs. Size: ~450 changed lines outside tests (679 with them). One PR because the parts only do something together: the table without the dispatch writes would produce programs that read zeros, and the dispatch writes without the table never run. **Tested** - NVIDIA GeForce RTX 2070 SUPER (driver 621.40), AMD Ryzen 5 3600XT, Windows 11 Home build 26300, rustc 1.100.0, debug. - `cargo test -p xcl --lib recomp::lift::tests`: 7 passed, 0 failed, 0 ignored. - `XCL_SAMPLE_LIFT_HLSL=<export of the retail game's compute HLSL> cargo test -p xcl --lib sample_families_compile_lifted`: 34 liftable families among the programs under 256 KB. The 12 smallest were compiled with DXC 1.9.2609, and each family's members gave one identical DXIL container. - `cargo build --workspace --tests && cargo test --workspace --no-fail-fast -- --test-threads=4` on c0a0ec03 (debug; rebased onto main 81bfbf0d, run at the same time as the suites of #3262, #3242 and #3241): 2741 passed, 4 failed, 49 ignored, including `gpu_lifted_literal_family_shares_dxil_and_keeps_results` (ok) - the 4 failures are the `e2e` target, whose test title had not been built (`missing …xcl_testtitle.exe – build first: cargo build --workspace`) - rerun alone after `cargo build --workspace`: `cargo test -p xcl --test e2e`: 5 passed, 0 failed - Together: **2745 passed, 0 failed, 49 ignored** - `SKIPPED` on this adapter (28): 22 no wave64, 3 f16 instructions refused (#1426 semantics differ from the console's), 2 no heap windows (opt-in `XCL_HEAP_WINDOWS=1`), 1 no GPU_UPLOAD heaps **Regression run** main (fa204595): ``` xcl-smoke v1 commit: fa204595a488c60c6c5f905244f0172072c9c2a9 gpu: NVIDIA GeForce RTX 2070 SUPER title: retail game seconds: 60 exit: 0x0 frames shown: 1533 (PresentX 1533) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 17409 MB ``` this PR's head (1d3b1cb9): ``` xcl-smoke v1 commit: 1d3b1cb934847faa3d11c428ee20b47c5e08b43c gpu: NVIDIA GeForce RTX 2070 SUPER title: retail game seconds: 60 exit: 0x0 frames shown: 1500 (PresentX 1500) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17303 MB ``` Both: `scripts/smoke.ps1 -Seconds 60`, `XCL_PREPARE=0`, `XCL_PRESS_AT=25:A`, run through the local exclusive queue. `XCL_LIFT_LITERALS` is unset (off), so the lifting path is not exercised here. These runs are on the head before the rebase (1d3b1cb9); they have not been repeated on c0a0ec03. **Not tested** - Cold-run gain with `XCL_LIFT_LITERALS=1` (preparation time, driver compiles): numbers requested from contributors in a comment below. - Frame-time cost of lifted literals (uniform io loads instead of folded constants). - AMD / Intel GPUs, wave64 adapters. - Families of programs over 256 KB through DXC: covered only by the runtime fallback if DXC refuses one. - A launch whose preparation runs in a separate builder process: the title reads the table file the first time it looks it up. **AI use** - Claude Code, Claude Opus 5.5: wrote the code, the tests and this description. The investigation that found the families was Claude Code, Claude Opus 5.5 too. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
KOLESNiii commented 2026-11-29 02:14:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-29T02:14:57Z.


Results wanted: cold preparation with literal lifting on and off

Some compute programs in a pack differ only in numeric constants. This PR lifts those constants so a family compiles once (DXC and driver). On a retail game, RTX 2070 SUPER: 13 repeat driver compiles = 253 s of 1,327 s driver time in one cold run (19 %); pack-wide 156 extra compiles of 2,682 compute programs (5.8 %). Gain still unmeasured with the switch on: we need cold numbers from other hardware.

  • Baseline and candidate: the same build of this PR's head (KOLESNiii:recomp-lift-literals, commit in the PR), XCL_LIFT_LITERALS=0 vs XCL_LIFT_LITERALS=1.
  • Build: cargo build --release -p xcl, say your Rust version.
  • Run, cold each time:
    • fresh DXIL cache: set XCL_DXIL_CACHE to a new empty folder for each run;
    • clear the driver's shader cache (NVIDIA: %LOCALAPPDATA%\NVIDIA\DXCache; AMD: %LOCALAPPDATA%\AMD\DxcCache / DxCache);
    • then either xcl shaders <your title's shader pack> --precompile --pipelines, or a cold launch of your title with preparation on;
    • other programs closed.
  • Order: off, on, off, on, on the same title.
  • What to paste back:
    • preparation time (the precompiling … run's end time, or the launch's preparation line);
    • the literal lifting: N families, M compute programs lifted (T s) line (on runs);
    • number and total time of driver compile start / finish lines for compute PSOs (or XCL_ACTIVITY=1 totals);
    • if you play after: frame time or a 60 s scripts/smoke.ps1 -Seconds 60 block on both sides, with XCL_PRESS_AT=25:A;
    • GPU + driver, CPU, RAM, Windows build.
  • Our environment: NVIDIA GeForce RTX 2070 SUPER, driver 621.40, AMD Ryzen 5 3600XT, 32 GB, Windows 11 Home build 26300, rustc 1.100.0.
  • Most needed: AMD RDNA2/3/4, and any wave64 adapter.

Written by Claude Code, Claude Opus 5.5.

<!-- greyfinch-sync:ivall/xcl:comment:7249305431 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3262#issuecomment-7249305431). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-29T02:14:57Z. --- **Results wanted: cold preparation with literal lifting on and off** Some compute programs in a pack differ only in numeric constants. This PR lifts those constants so a family compiles once (DXC and driver). On a retail game, RTX 2070 SUPER: 13 repeat driver compiles = 253 s of 1,327 s driver time in one cold run (19 %); pack-wide 156 extra compiles of 2,682 compute programs (5.8 %). Gain still unmeasured with the switch on: we need cold numbers from other hardware. - Baseline and candidate: the same build of this PR's head (`KOLESNiii:recomp-lift-literals`, commit in the PR), `XCL_LIFT_LITERALS=0` vs `XCL_LIFT_LITERALS=1`. - Build: `cargo build --release -p xcl`, say your Rust version. - Run, cold each time: - fresh DXIL cache: set `XCL_DXIL_CACHE` to a new empty folder for each run; - clear the driver's shader cache (NVIDIA: `%LOCALAPPDATA%\NVIDIA\DXCache`; AMD: `%LOCALAPPDATA%\AMD\DxcCache` / `DxCache`); - then either `xcl shaders <your title's shader pack> --precompile --pipelines`, or a cold launch of your title with preparation on; - other programs closed. - Order: off, on, off, on, on the same title. - What to paste back: - preparation time (the `precompiling …` run's end time, or the launch's preparation line); - the `literal lifting: N families, M compute programs lifted (T s)` line (on runs); - number and total time of `driver compile start` / `finish` lines for compute PSOs (or `XCL_ACTIVITY=1` totals); - if you play after: frame time or a 60 s `scripts/smoke.ps1 -Seconds 60` block on both sides, with `XCL_PRESS_AT=25:A`; - GPU + driver, CPU, RAM, Windows build. - Our environment: NVIDIA GeForce RTX 2070 SUPER, driver 621.40, AMD Ryzen 5 3600XT, 32 GB, Windows 11 Home build 26300, rustc 1.100.0. - Most needed: AMD RDNA2/3/4, and any wave64 adapter. Written by Claude Code, Claude Opus 5.5.
KOLESNiii commented 2026-11-29 10:05:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-29T10:05:21Z.


Cold full preparation, XCL_LIFT_LITERALS=1 vs off (one run each, NVIDIA)

Two cold runs of full shader preparation (XCL_PREPARE_ALL=1) on a retail game, each with a fresh XCL_DXIL_CACHE and the NVIDIA and D3D shader caches cleared. The only difference between them is this PR, switched on.

  • A: 7db2f391 + #3241 + #3242
  • B: the same + this PR's commit (cherry-picked cleanly), XCL_LIFT_LITERALS=1

Lifting was active in B: literal lifting: 112 families, 268 compute programs lifted (10.8 s), and no fallbacks were logged.

A (lifting off) B (lifting on)
translation + DXC phase finished 54.4 min 56.1 min
driver phase, records checked at 60 min 22,474 22,337
at 90 min 23,003 22,970
at 115 min 23,601 23,448
at stop 23,624 of 26,503 (117 min) 23,614 of 26,503 (120 min, cap)
driver blobs in the cache at stop 4,981 4,868
  • Fewer compiles, no time saved. The lifted families did share driver compiles: 113 fewer distinct blobs at about the same point. But preparation got no faster. After about 60 minutes the driver phase is a slow tail of roughly 10–25 pipelines a minute in both runs.
  • Neither run finished. About 2,900 pipelines were still left in each, so total preparation time is not measured.
  • The 19 % estimate in the description doesn't hold for full preparation. It came from a cold gameplay run, where the 13 constant-only compiles happened to be expensive ones. Across the whole pack they are a small share of the driver phase.
  • This supports keeping lifting off by default. On NVIDIA preparation the gain is small, possibly zero.

Limits

  • One run per side. Run A also overlapped with low-priority cargo builds and was still marginally ahead, so a difference this small is within noise.
  • NVIDIA only. AMD's per-pipeline driver cost may differ, so results from RDNA would help.

Setup

  • Hardware: RTX 2070 SUPER (driver 32.0.16.2140), Ryzen 5 3600XT, Windows build 26300, release build.

Measured and written with Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7254199481 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3262#issuecomment-7254199481). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-29T10:05:21Z. --- **Cold full preparation, `XCL_LIFT_LITERALS=1` vs off (one run each, NVIDIA)** Two cold runs of full shader preparation (`XCL_PREPARE_ALL=1`) on a retail game, each with a fresh `XCL_DXIL_CACHE` and the NVIDIA and D3D shader caches cleared. The only difference between them is this PR, switched on. - A: 7db2f391 + #3241 + #3242 - B: the same + this PR's commit (cherry-picked cleanly), `XCL_LIFT_LITERALS=1` Lifting was active in B: `literal lifting: 112 families, 268 compute programs lifted (10.8 s)`, and no fallbacks were logged. | | A (lifting off) | B (lifting on) | |---|---|---| | translation + DXC phase finished | 54.4 min | 56.1 min | | driver phase, records checked at 60 min | 22,474 | 22,337 | | at 90 min | 23,003 | 22,970 | | at 115 min | 23,601 | 23,448 | | at stop | 23,624 of 26,503 (117 min) | 23,614 of 26,503 (120 min, cap) | | driver blobs in the cache at stop | 4,981 | 4,868 | - **Fewer compiles, no time saved.** The lifted families did share driver compiles: 113 fewer distinct blobs at about the same point. But preparation got no faster. After about 60 minutes the driver phase is a slow tail of roughly 10–25 pipelines a minute in both runs. - **Neither run finished.** About 2,900 pipelines were still left in each, so total preparation time is not measured. - **The 19 % estimate in the description doesn't hold for full preparation.** It came from a cold gameplay run, where the 13 constant-only compiles happened to be expensive ones. Across the whole pack they are a small share of the driver phase. - **This supports keeping lifting off by default.** On NVIDIA preparation the gain is small, possibly zero. **Limits** - One run per side. Run A also overlapped with low-priority cargo builds and was still marginally ahead, so a difference this small is within noise. - NVIDIA only. AMD's per-pipeline driver cost may differ, so results from RDNA would help. **Setup** - Hardware: RTX 2070 SUPER (driver 32.0.16.2140), Ryzen 5 3600XT, Windows build 26300, release build. Measured and written with Claude Code (Claude Opus 5.5).
bmjask commented 2026-11-29 14:50:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T14:50:15Z.


Current-main audit (2026-11-29): discard as an experiment, not a merge candidate.

The PR's own cold full-preparation comparison is decisive: it produced 113 fewer blobs around the same point but saved no wall time (54.4 vs 56.1 min for translation/DXC, and the driver tail remained effectively unchanged). The change is 679 additions across nine files, adds per-PSO runtime metadata/ABI uploads and a custom HLSL scanner, and current main now defaults to direct DXIL, where this HLSL-only lifting does not apply.

That complexity is not justified by the measured result. Keep the analysis/data, but close the implementation unless a narrowly targeted gameplay-critical family demonstrates a reproducible critical-path win.

Cache impact: not safe for affected cached PSOs; it intentionally rewrites HLSL/DXIL and shares a different driver blob.

Review assisted by Codex; exact model name was not exposed in this session. No additional cold run was performed.

<!-- greyfinch-sync:ivall/xcl:comment:7257614707 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3262#issuecomment-7257614707). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-29T14:50:15Z. --- **Current-main audit (2026-11-29): discard as an experiment, not a merge candidate.** The PR's own cold full-preparation comparison is decisive: it produced 113 fewer blobs around the same point but saved no wall time (54.4 vs 56.1 min for translation/DXC, and the driver tail remained effectively unchanged). The change is 679 additions across nine files, adds per-PSO runtime metadata/ABI uploads and a custom HLSL scanner, and current `main` now defaults to direct DXIL, where this HLSL-only lifting does not apply. That complexity is not justified by the measured result. Keep the analysis/data, but close the implementation unless a narrowly targeted gameplay-critical family demonstrates a reproducible critical-path win. Cache impact: **not safe for affected cached PSOs**; it intentionally rewrites HLSL/DXIL and shares a different driver blob. Review assisted by Codex; exact model name was not exposed in this session. No additional cold run was performed.
Foniass commented 2026-12-01 09:31:33 +00:00 (Migrated from github.com)

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


Review (head c0a0ec03, diff read, not a merge-check; draft, conflicts with main, PR description red):

  • No measured benefit, and less reach than when it was written. The author's own cold run made 113 fewer driver blobs in about the same wall time. Since then, main sends compute through direct DXIL by default (kernel::enabled()), and lifting only works on the HLSL path.
  • The conflict isn't only textual. Main added an edited -> compile_cached_in branch in pso.rs compile_console_shader that lifting has to respect, and removed finish_two_pass. After that, shaders.rs ~2440 (a new Compiled { on main) still lacks lifted and won't compile.
  • The lifted path has never run in a title. The values are written only in bind.rs ~5265 and console_list.rs ~1065, and no test covers those dispatch writes. Any other writer of a compute program's io would leave the lifted words unset (unverified that one exists).
  • Unmeasured cost: up to 64 io loads per program, DXC loses constant folding, and lifted members bypass the disk cache (pso.rs ~272), so they retranslate on every launch.
  • The lift table is read once per process (lift.rs ~318). A title whose first lookup comes before the preparation process writes the table never lifts in that run.
  • The red CI is a 0xc0000005 in the eh / agility tests, before any lift test ran, which looks like #1487 (unverified). The smoke runs are from 1d3b1cb9 with lifting off.

Fine: the design holds. Only differing u integer literals in plain statements of main are lifted, and values come from each member's own HLSL under a masked hash. A uint stays a uint, constant-required contexts are excluded, a lifted text DXC rejects falls back to the plain one, the sample test uses XCL_SAMPLE_*, and it's off by default. If it goes on, a split fits: the Compiled.lifted and dispatch plumbing, then lift.rs with its tests, then the wiring.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7306826852 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3262#issuecomment-7306826852). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T09:31:33Z. --- Review (head c0a0ec03, diff read, not a merge-check; draft, conflicts with main, `PR description` red): - **No measured benefit, and less reach than when it was written.** The author's own cold run made 113 fewer driver blobs in about the same wall time. Since then, main sends compute through direct DXIL by default (`kernel::enabled()`), and lifting only works on the HLSL path. - **The conflict isn't only textual.** Main added an `edited` -> `compile_cached_in` branch in `pso.rs` `compile_console_shader` that lifting has to respect, and removed `finish_two_pass`. After that, `shaders.rs` ~2440 (a new `Compiled {` on main) still lacks `lifted` and won't compile. - **The lifted path has never run in a title.** The values are written only in `bind.rs` ~5265 and `console_list.rs` ~1065, and no test covers those dispatch writes. Any other writer of a compute program's `io` would leave the lifted words unset (unverified that one exists). - **Unmeasured cost:** up to 64 `io` loads per program, DXC loses constant folding, and lifted members bypass the disk cache (`pso.rs` ~272), so they retranslate on every launch. - The lift table is read once per process (`lift.rs` ~318). A title whose first lookup comes before the preparation process writes the table never lifts in that run. - The red CI is a 0xc0000005 in the eh / agility tests, before any lift test ran, which looks like #1487 (unverified). The smoke runs are from 1d3b1cb9 with lifting off. Fine: the design holds. Only differing `u` integer literals in plain statements of `main` are lifted, and values come from each member's own HLSL under a masked hash. A uint stays a uint, constant-required contexts are excluded, a lifted text DXC rejects falls back to the plain one, the sample test uses `XCL_SAMPLE_*`, and it's off by default. If it goes on, a split fits: the `Compiled.lifted` and dispatch plumbing, then `lift.rs` with its tests, then the wiring. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Foniass commented 2026-12-01 09:47:01 +00:00 (Migrated from github.com)

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


Triage (#1607) – head c0a0ec0

No open or merged PR lifts differing literals of a compute family. #2711 (named in the description) shares identical split pieces only.
No problems found in the parts I read: the lifted literals go at io word KERNEL_SGPRS (512 bytes), and both dispatch paths (bind.rs and console_list.rs) append them after io has been resized to KERNEL_SGPRS. The switch is off by default. The branch conflicts with main and its checks fail.
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:7307200050 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3262#issuecomment-7307200050). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T09:47:01Z. --- **Triage (#1607)** – head c0a0ec0 No open or merged PR lifts differing literals of a compute family. #2711 (named in the description) shares identical split pieces only. No problems found in the parts I read: the lifted literals go at `io` word `KERNEL_SGPRS` (512 bytes), and both dispatch paths (`bind.rs` and `console_list.rs`) append them after `io` has been resized to `KERNEL_SGPRS`. The switch is off by default. The branch conflicts with main and its checks fail. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
KOLESNiii commented 2026-12-02 15:11:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-12-02T15:11:09Z.


@Foniass thanks. Rebased onto main df0cfef6: lifting now respects main's edited → compile_cached_in branch (a text an XCL_DEBUG_* switch edited is never lifted and goes to compile_cached_in), finish_two_pass is gone as on main, and the Compiled literals main added (pso.rs, shaders.rs) carry lifted: Vec::new(). New head 28a3be03. Whether to keep this PR open, given no measured benefit and main defaulting to direct DXIL, is the PR author's decision.

— Claude Code (Claude Opus 5.5), on behalf of the PR author

<!-- greyfinch-sync:ivall/xcl:comment:7349883470 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3262#issuecomment-7349883470). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-12-02T15:11:09Z. --- @Foniass thanks. Rebased onto `main` df0cfef6: lifting now respects `main`'s `edited` → `compile_cached_in` branch (a text an `XCL_DEBUG_*` switch edited is never lifted and goes to `compile_cached_in`), `finish_two_pass` is gone as on `main`, and the `Compiled` literals `main` added (`pso.rs`, `shaders.rs`) carry `lifted: Vec::new()`. New head `28a3be03`. Whether to keep this PR open, given no measured benefit and `main` defaulting to direct DXIL, is the PR author's decision. — Claude Code (Claude Opus 5.5), on behalf of the PR author
Foniass commented 2026-12-02 15:12:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T15:12:48Z.


Follow-up review (head 28a3be03, since c0a0ec0, diff read, not a merge-check; draft, checks red, conflicts):

  • Earlier points: unchanged otherwise. This push (a rebase onto main's XCL_DEBUG_* edited-text path) also never lifts a text an XCL_DEBUG_* switch edited (!edited in the lift condition) and compiles such a text through compile_cached_in like main does.

New: none.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7349937777 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3262#issuecomment-7349937777). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T15:12:48Z. --- Follow-up review (head 28a3be03, since c0a0ec0, diff read, not a merge-check; draft, checks red, conflicts): - **Earlier points:** unchanged otherwise. This push (a rebase onto main's `XCL_DEBUG_*` edited-text path) also never lifts a text an `XCL_DEBUG_*` switch edited (`!edited` in the lift condition) and compiles such a text through `compile_cached_in` like main does. New: none. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
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/3262:upstream-pr/3262'
git switch 'upstream-pr/3262'

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