Skip to content

Recompiler: route compute programs through a compact backend (XCL_COMPACT_CS) - #1316

Open
CowboyBingus wants to merge 4 commits into
xcl-dev:mainfrom
CowboyBingus:recomp-compact-routing
Open

CowboyBingus wants to merge 4 commits into
xcl-dev:mainfrom
CowboyBingus:recomp-compact-routing

Conversation

@CowboyBingus

@CowboyBingus CowboyBingus commented Nov 24, 2026 •

Copy link
Copy Markdown

Stacked on #1315; only the top commit belongs here.

Routes translated compute programs through the compact form of #1315 when it pays, behind XCL_COMPACT_CS:

  • unset or auto (the default): the programs compact::compact_wanted takes (20,000+ instructions, distinct blocks under 30 % of them);
  • 0: never;
  • 1: every compute program. It is for tests and measurements, not for play: in brainhay5's run it raised the total driver compile time from 84.2 s to 158.8 s; on an RX 7800 XT, forcing it on 18 sampled records raised DXIL from 5.29 to 17.03 MB and driver time from 186.5 s to more than 1,152 s (oni-swr).

A compact translation that returns an error or is incomplete falls back to translate, and so does one whose HLSL fails in DXC (dxc::compile_cached). Part of #1269, #505 and #1598.

With it, indirect_diffuse_lighting:CS_ScreenProbes_ActivateProbes (56c0cd3b82a00c6e) is compiled as 1,053,264 B of DXIL instead of 29,750,144 B (numbers in #1315).

What is in it

  • Recompiler: route compute programs through a compact backend (XCL_COMPACT_CS):
    • gpu/recomp/mod.rs: CompactCs (the switch, read once) and translate_routed. Only compute is routed; geometry, mesh and kernel mode are not.
    • gpu/recomp/pso.rs: console_translation uses translate_as (translate_routed with the switch given). A program routed to the compact backend gets a …_c.bin translated-cache entry, so the two forms never share an entry. DXC and driver-blob keys already come from the HLSL / DXIL bytes. When dxc::compile_cached fails on a compact form, the program is compiled in the normal form (or taken from the normal entry when that is on disk) and kept under the normal entry, not the _c one, with one WARN line; a cached-only attempt is not retried, and a refusal is not remembered between runs. A driver (CreateComputePipelineState) rejection of a compact pipeline is not retried in the normal form. With XCL_DIRECT_DXIL (gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426) on, a compute program XCL_COMPACT_CS routes to the compact form goes to the compact form first, not to the direct translator; a program the compact form then refuses (e.g. its table limit) falls back to translate, and one whose compact HLSL DXC refuses is retried in the normal form through the direct translator first, then translate. Every other compute program goes to the direct translator as before (goes_direct, tested in the_compact_routing_goes_before_direct_dxil). The reason: for ActivateProbes on an RX 9070 XT, ezamelczyk measured 80.9 / 81.2 MB of DXIL from gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426's direct translator against 0.77 / 0.87 MB compact.
    • With Recompiler: enormous compute programs take the direct DXIL translator #2120 on main, a title's compute program (and xcl shaders --precompile's) whose HLSL is longer than dxc::UNOPTIMISED_ABOVE (8 MiB) is tried in the direct translator first when XCL_DIRECT_DXIL is off (pso::compile_hlsl); xcl shaders --measure-pso does not do this. That check is made on the HLSL console_translation returns: the compact HLSL for a program in the compact form, the normal HLSL for one the compact form refuses or whose compact HLSL DXC refuses.
    • shaders.rs, gpu/shader.rs: the offline xcl shaders paths are routed the same way.
    • build.rs: compact.rs is listed as a translator source, so the translated cache's identity follows it.
    • One INFO line per routed program, the first time.

Tested

  • RTX 5070 Ti (driver 621.24), AMD Ryzen 7 9800X3D, Windows 11 (10.0.26300).

  • This PR's head 5328b15 (on main afc5ee8): cargo build --workspace and cargo build --release -p xcl succeeded; cargo test -p xcl --lib compact -- --test-threads=4: 33 passed, 0 failed, 0 ignored, with gpu_compact_native_wave64_form SKIPPED (no wave64); cargo test -p xcl --lib pso:: -- --test-threads=4: 23 passed, 0 failed, 1 ignored (compile_time_bench::repeated_pso_shader_compile). The full suite was not run locally on this head.

  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4 (debug) on an earlier head of this PR, 964f5ed (on main 266b845): 981 passed, 1 failed, 42 ignored (lib tests 932 / 1 / 22). The failure is hle::kernelx::tests::xmem_virtual_query_marks_cpu_readable_memory (kernelx.rs:2070), which fails the same way on main 930e8b4. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, gpu_compact_native_wave64_form, and 16 lines of main's lower / lower_dxil tests. SKIPPED (per-lane form refused): 3 lines of lower_dxil's f16 / f32-conversion tests. SKIPPED (no heap windows): heap_window_out_of_memory_falls_back_to_the_switch_form.

  • Same base, cold: main 266b845 against this PR's head 964f5ed with XCL_COMPACT_CS unset (auto), on the programs auto routes. Each record was extracted to a folder of its own (xcl rpf shaders.rpf --extract <name>) and measured with xcl shaders <folder> --measure-pso <hash> (driver caches off), one process per run from a new copy of the exe and an empty XCL_DXIL_CACHE, 4 memory windows, split wave64; HLSL from xcl shaders shaders.rpf --export-hlsl <dir> --record-hash <hash>; peak commit is the process's peak private commit, sampled every 0.5 s; one run each, a run of main stopped at 600 s:

    program build HLSL DXIL DXC CreateComputePipelineState peak commit
    56c0cd3b82a00c6e (ActivateProbes) main 30,301 KB – – not built within 600 s 4,986 MB
    this PR 706 KB 1,050,616 B 15.0 s 18.3 s 579 MB
    958400d2caf07244 (ActivateProbesTarget) main 30,222 KB – – not built within 600 s 4,973 MB
    this PR 650 KB 953,540 B 23.4 s 6.2 s 503 MB

    95cc13288a27a96e (ActivateRays) is left out: both builds translate it the same way (15,000 KB of HLSL each; this PR's compact form refuses it, 9975-word table (at most 8192)).

  • A title run (retail title) of a local build of 31be310 plus ac1ca18:

    • 31be310 is a merge of this stack's branches; its tree differs from this stack's in tests_compact.rs, two comments in compact.rs and the order of two pub mod lines in mod.rs.
    • ac1ca18 is an earlier local version of the Sleep rule in kernelx: Sleep does not count the time a bind waits for a pipeline build #1288; its code differs from kernelx: Sleep does not count the time a bind waits for a pipeline build #1288's.
    • At 342.1 s the title translated 56c0cd3b82a00c6e in the compact form, logged by its code hash: [SHADER] compact backend, compute program d122faa48eb0afdc: 88863 instructions, 723453 B HLSL.
    • At 370.8 s ActivateRays fell back: compact form: 19949 blocks of 11909 texts need a 9975-word table (at most 8192) – translated as before.
    • Presents had stopped at 88 s in that run. It ended at 403 s on my harness's memory guard (system commit at 99 %), with no crash or device removal.

Regression run
scripts/smoke.ps1 -Game <game folder> -Seconds 60 -Title retail (release builds, menus, no input):

main:

xcl-smoke v1
commit: afc5ee86ae3a9521c9f15d96505cd73fe72f2191
gpu: NVIDIA GeForce RTX 5070 Ti
title: retail
seconds: 60
exit: 0x0
frames shown: 1664 (PresentX 1664)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16555 MB

this PR:

xcl-smoke v1
commit: 5328b157590f14bd4b04eaa6719d9b112f766e1b
gpu: NVIDIA GeForce RTX 5070 Ti
title: retail
seconds: 60
exit: 0x0
frames shown: 1664 (PresentX 1664)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17124 MB

Not tested

AI use

  • Claude Code (Claude Opus 5.5) wrote the code, the tests and this description; I ran the tests and runs on my machine and checked the results.

🤖 Generated with Claude Code

@Filip722

Copy link
Copy Markdown

Tested on Bazzite

RTX 5060 Laptop GPU (8 GB, NVIDIA 615.78.08), Intel Core 7 240H, 16 GB RAM, Bazzite 44 Testing and Proton Experimental 11.0-20261112. Windows MSVC release, Rust 1.98.1 and DXC 1.9.2609.5. Exact #1316 head 490ccbb491e99508e10be5c1b78e4ba03f543398 on XCL main 930e8b4 with our existing local Series X texture and mesh loading changes. Eight focused routing, cache-key and DXC tests passed.

Using the same executable, separate empty DXIL caches, one compile worker, four memory windows and split wave64, I compiled the same 88,863-instruction compute shader used in #1315. Both runs compiled one input with zero errors. XCL's CPU-only precompile took 125.3 s with XCL_COMPACT_CS=0 and 15.0 s with auto. The single cached DXIL file went from 29,750,440 to 1,053,272 bytes. Auto selected the compact route and emitted 723,453 bytes of HLSL.

Separate offline Series X title runs with 0 and auto reached loading artwork, then the same title GPU watchdog. Both recorded 17 pipeline-bind timeout warnings and zero D3D12 device removals or kernel GPU faults. Auto logged no compact translation attempts in this window. The memory caps tightened at different elapsed times, so I am reporting the shared milestone and route observation.

Not tested

Driver PSO creation for the isolated CPU comparison, native Windows on this laptop, or playable world entry.

AI use

OpenAI Codex with GPT-6.2-Sol high ran the focused tests, compared the builds and prepared this report.

@futurepro62

futurepro62 commented Nov 24, 2026 •

Copy link
Copy Markdown

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

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 773 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_compact_native_wave64_form, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: equal_blocks_share_one_case, compact_is_wanted_for_large_repetitive_programs, gpu_compact_matches_translate, the_switch_reads_auto_0_and_1, only_compute_goes_to_the_compact_backend, translated_compact_and_normal_forms_are_kept_apart, compact_and_normal_forms_compile, gpu_compact_execz_nest, gpu_compact_backward_loops, gpu_compact_repeated_blocks, gpu_compact_far_jumps, gpu_compact_v_mul_lo_u32, gpu_compact_buffer_load_format_x, gpu_compact_native_wave64_form, gpu_compact_compute_dispatch, gpu_compact_memory_windows, gpu_compact_memory_windows_loop, gpu_compact_programs_with_four_windows, gpu_compact_exchange_repeated, gpu_compact_buffer_load_format_x_repeated, gpu_compact_endpgm_before_last_block, gpu_compact_sample_big_cs.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 773 passed, 0 failed, 41 ignored, no skips.
  • With XCL_COMPACT_CS=1, cargo test -p xcl --lib -- gpu:: on both GPUs: 306 passed, 0 failed, 18 ignored. That says less than it looks: the recompiler GPU tests in tests.rs (via runner.rs) call translate directly, and only the pso.rs, shader.rs and shaders.rs paths go through translate_routed. So the env var does not put the existing GPU tests on the compact backend, and the compact backend is covered by tests_compact.rs only. A switch in runner.rs to route through translate_as would let the whole GPU test set run against it.

Not tested

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

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@brainhay5

Copy link
Copy Markdown

Tested the branch you named (5e312d5, merged onto main 930e8b4, clean), RTX 5070 Ti, driver 32.0.16.1088, Windows 11 22631, release, XCL_NETWORK=0, A every 5 s, 140 s world load each.

auto (default): 1 program routed, 156 compute PSO builds, driver time 84.2 s, largest 1,144,224 B / 84,029 ms.

XCL_COMPACT_CS=1: 106 programs routed, 102 builds, driver time 158.8 s, largest 1,537,704 B / 57,249 ms.

So forcing the compact form on every compute program is a regression on this title: nearly double the driver time, and the largest build got bigger (1.54 MB against 1.14 MB). It compacted 106 programs where it does not pay. Worth saying in the PR description, because 1 reads like "turn the feature on" and invites exactly this test.

auto is the right default and behaves like main in this window — it routed one program and the totals are within run-to-run variance (84.2 s here against 104.1 s on main in the previous run).

The other thing the run shows: the programs the compact form targets are not reached in the first 140 s. With auto, one program is routed; you saw ActivateProbes translated at 342 s in your run. So no 140 s run can show the tail benefit either way — the comparison needs a run that gets past ~340 s, which ours does not (it ends at +0x23cf683 first).

If you want, I can run auto with a longer window (say 400 s, watchdog permitting) once the branch is rebased on the next main, and report the tail share before and after as two numbers.

AI use: OpenCode, DeepSeek V4.1 Flash 1017.

@More1215

Copy link
Copy Markdown

Testing #1316 at 5e312d5 against main 930e8b4 on Windows: the full-pack pass xcl shaders --precompile --only cs --pipelines (driver PSO creation included), RTX 5080 (driver 621.35), Ryzen 7 9800X3D, 32 GB, DXC 1.9.2602.17, separate empty DXIL caches. This is the pass that stops advancing around record 22 600 on RTX 4080/4090/5080 (#744). I will report whether it gets past that point, how long it takes, and the driver times of the routed programs. Counts and timings only.

AI use: Claude Code (Claude Opus 5.5) runs the measurements and writes the report.

@IvyNotFound

Copy link
Copy Markdown

Retail world load on an RTX 5080 (32-lane waves) at 5e312d5: ActivateProbes takes the compact form and its pipeline is built in 24.2 s; on main it is not built within the run. ActivateRays falls back as described. No new crash: every run of both builds ends in the title's known ones at 140–160 s.

Tested

  • NVIDIA GeForce RTX 5080 16 GB, driver 621.24 (32.0.16.2124); Ryzen 7 7800X3D, 32 GB; Windows 11 25H2 (26200.9974); rustc 1.100.0 MSVC; DXC 1.9.2602.17. This PR's head 5e312d5 as is (base main 930e8b4), clean tree.
  • cargo test -p xcl --lib compact (debug): 22 passed, 0 failed; SKIPPED gpu_compact_native_wave64_form (no wave64).
  • Retail title 1.0.2.1 (the one of Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505), release, scripts/smoke.ps1 -Seconds 240, XCL_PRESS_A_AT=15, XCL_PSO_WAIT_MS=50 (past the first ListX #101, into world loading), XCL_COMPACT_CS unset (auto). Two runs of the PR back to back, then one of main 930e8b4, same DXIL / driver-blob caches.
PR, run 1 PR, run 2 main
[SHADER] compact backend, compute program d122faa48eb0afdc: 88863 instructions, 723453 B HLSL 67.8 s – (translated-cache hit) –
15ec6daefb19a780 (ActivateRays): … need a 9975-word table (at most 8192) – translated as before 67.5 s 67.0 s –
compute PSO of 1 053 272 B DXIL (the compact ActivateProbes) not logged before the end 90.7 s, 24 215 ms in the driver –
largest compute DXIL built in the run 1 847 764 B 1 847 764 B 1 847 764 B
compute PSOs built without a driver blob / their driver time 229 / 352.8 s 224 / 31.7 s 223 / 143.1 s
GPU queue.Wait timeouts (#505) 21 23 20
last window with a present 112 s 110 s 102 s
end null write +0x2215c35 (#232) at 140.5 s 0xc0000409 +0x23cf683 ("GPU Loc Sig") at 160.6 s
peak commit 40 843 MB 42 412 MB 40 986 MB

Not tested

AI use

  • Claude Code, Claude Opus 5.5: ran the tests and the runs, read the logs and wrote this report.

@vitor127wt

vitor127wt commented Nov 24, 2026 •

Copy link
Copy Markdown

Linux / Wine test report on the RTX 5070 Ti

I tested the exact head 5e312d5b3252d2a20a8a687bd4f2ef20eecfb877 in a clean release build. This adds the offline PSO step to the earlier Wine precompile results. Both selected shaders translated through the compact route. With the default structurizer, both cold PSO attempts reached the 120 s process cap. Both completed with the legacy structurizer in the follow-up below. Earlier Bazzite report

Tested

  • NVIDIA GeForce RTX 5070 Ti (16,303 MiB reported), NVIDIA Linux driver 620.73.04, Ryzen 7 9700X, 32 GB DDR5. CachyOS x86-64 (kernel 7.3.5-2-cachyos), Wine 11.22, DXVK v2.7.1-498-ga6764047e587178, vkd3d-proton ec20719452e916b (dxil-spirv 7c04863), Windows DXC 1.9.2609.5, Rust 1.100.0 and cargo-xwin 0.24.1. Upstream vkd3d-proton artifact
  • Built with cargo xwin build --offline --locked --target x86_64-pc-windows-msvc --release -p xcl --bin xcl. I used xcl rpf to isolate each compute record from my Series 1.0.2.1 extract in its own input folder.
  • For each folder I ran wine xcl.exe shaders DIR --precompile --only cs --windows 4 --split 1 with XCL_COMPACT_CS=auto, a fresh XCL DXIL cache, and one DXC and PSO worker. I then ran the same command with --pipelines and reused that DXIL. XCL PSO blobs, vkd3d-proton shader cache, and NVIDIA disk cache were disabled. Each PSO process had a 120 s timeout and an 8 GiB memory cap.
Compute shader Instructions Cold translation + DXC DXIL Cold PSO with default structurizer, precompiled DXIL
ActivateProbes 88,863 8.8 s 1,053,272 B Timed out at 120 s (max RSS 613 MiB)
ActivateProbesTarget 88,445 18.8 s 956,252 B Timed out at 120 s (max RSS 597 MiB)

The two precompiles completed with zero errors. Both PSO runs logged entry to D3D12 pipeline creation with an empty pipeline cache, then exited with timeout code 124. I collected a five-second user-space CPU profile during each attempt with perf record -e cpu-clock:u -F 199 -p PID -- sleep 5. All 990 samples for ActivateProbes and all 994 for ActivateProbesTarget were in d3d12core.dll. The profiles give module-level attribution for the sampled intervals.

Follow-up with the legacy structurizer

I repeated the cold PSO step on the same head, RTX 5070 Ti, driver, and vkd3d-proton build, following the experiment reported by itsd-effex. I reused the exact DXIL files. The vkd3d-proton shader hashes matched across the two runs, and the cached DXIL SHA-256s stayed unchanged during the rerun. The configuration changed from VKD3D_CONFIG=pipeline_library_log to VKD3D_CONFIG=legacy_structurizer,pipeline_library_log. The other settings, cold PSO caches, and limits stayed the same. Initial legacy-structurizer measurements

Shader Default structurizer Legacy, total XCL command Legacy, Vulkan pipeline feedback
ActivateProbes 120 s timeout 16.2 s 13.11 s
ActivateProbesTarget 120 s timeout 12.3 s 10.12 s

Both legacy runs exited successfully and each reported one pipeline made, zero refused, and zero loaded from disk. The total is the XCL CLI time with DXIL already compiled. I also recorded user-space CPU samples across each complete legacy command with perf record -e cpu-clock:u -F 199. NVIDIA's libnvidia-gpucomp.so accounted for 75.16% and 77.68% of the samples, respectively. d3d12core.dll accounted for 14.05% and 11.40%. The default-mode profiles above covered five-second windows during the stalled calls.

ActivateRays with #1321 applied on top of #1316

I ran the requested commit pair on Wine against the single CS_ScreenProbes_ActivateRays compute program from my Series 1.0.2.1 extraction. Both builds detected compute program 15ec6daefb19a780 and fell back from the compact backend because it needed 9,975 words and the limit was 8,192. The second build is a local merge of #1321 at 0936337142a114668e29652163a62c6d255ff5d3 into #1316 at 6cefa5c342fe71a88cd64153d81e755683887fb3, with the conflict resolved as described by the author. Request and merge notes

Windows MSVC release build under Wine HLSL Cold translation + DXC DXIL Cold D3D12 PSO, cached DXIL
6cefa5c 154,575,599 B Cgroup OOM at 9.0 s, 8 GiB cap, exit 137 — —
6cefa5c + 0936337 15,359,988 B 48.7 s, peak RSS 2.37 GiB, 1 compiled, 0 errors 14,105,380 B 120 s timeout, exit 124, peak RSS 3.16 GiB

I measured HLSL size separately with a translation-only helper using the corresponding build's routed translator and the same shader options. The actual timed runs used xcl shaders <isolated folder> --precompile --only cs --windows 4 --split 1, with XCL_COMPACT_CS=auto, one DXC worker, one PSO worker, and fresh DXIL caches per build. After the combined build produced DXIL, I ran the same command with --pipelines, kept that DXIL, and disabled the XCL, vkd3d-proton, and NVIDIA disk pipeline caches. The driver log confirms an empty pipeline cache. The 80, 90, and 100 s checkpoints in this separate PSO process were all about 3.00 GiB in Linux cgroup memory.current.

Same RTX 5070 Ti, driver 620.73.04, Ryzen 7 9700X, CachyOS 7.3.5-2-cachyos, Wine 11.22, vkd3d-proton ec20719452e916b, and Windows DXC 1.9.2609.5 as above. This run covers the isolated shader. Windows private commit, full-title loading and execution of the retail shader remain unmeasured in this setup.

Not tested

Native Windows, full title or shader dispatch, the non-compact form of the original two compact shaders, and default-structurizer completion beyond the process timeout.

Synthetic cross-check of the compact translator

I exercised compact::translate_compact directly at the tested XCL commit 5e312d5, using the BetterJdue’s synthetic generator at 5ae62c5. The 668-case shader compiled to 655,944 B of DXIL with native DXC 1.9.2609.5. Standalone dxil-spirv 7c04863 on the Ryzen 7 9700X reached a 45 s cap in default mode. Legacy converted the same DXIL in 0.97 s and passed spirv-val --target-env vulkan1.3. CFGNode::dominates accounted for 96.85% of 1,335 CPU samples in a separate default-mode profile, principally under insert_phi_frontiers. This covers the compact translator and standalone conversion on synthetic input. Generator source XCL results and upstream reproducer

AI use

Codex (GPT-6, exact variant unavailable) cross-built the PR, ran and profiled the commands, and drafted the report. Codex also generated the synthetic inputs and ran the standalone conversion tests. Codex also resolved the local merge and ran the isolated ActivateRays comparison.

@ettehn

ettehn commented Nov 24, 2026 •

Copy link
Copy Markdown

A short native Windows run can exercise ActivateProbes on this head. On 5e312d5 (release, RTX 5070 Ti Laptop 12 GB, driver 621.24, DXC 1.8.2502.11, XCL_COMPACT_CS=auto, an existing XCL cache copied before launch), the compact backend logged code hash d122faa48eb0afdc at 7.431 s: 88,863 instructions, 723,453 B of HLSL. The resulting translation cache contains 56c0cd3b82a00c6e_Compute_0_4_1_c.bin (shader-container hash). This establishes translation during the run; it does not establish when the title first bound that pipeline.

We sampled the presented buffer every fourth frame. At 77.593 s, frame 1523 was opaque black at every one of the 518,400 sampled texels. XCL counted 1,526 presents in total, so the final two frames were outside our capture cadence. The last interval with a present ended at 78.088 s. The title faulted at +0x23cf683 at 108.605 s. At 90.801 s a different program, 15ec6daefb19a780, fell back to the existing translator because its table needed 9,975 words (cap 8,192). We have no wait-to-shader link implicating that fallback.

The control run was interrupted, so these observations cover auto only and provide no A/B timing claim. AI-assisted with OpenAI Codex (GPT-6.2 Astra).

Offline PSO cache check on native Windows

Same release 5e312d5b3252d2a20a8a687bd4f2ef20eecfb877, RTX 5070 Ti Laptop 12 GB, driver 621.24, and DXC 1.8.2502.11. In two fresh processes I ran xcl shaders <single-record folder> --precompile --only cs --split 1 --windows 4 --pipelines with XCL_COMPACT_CS=auto, one DXC worker, one pipeline worker, and identical preseeded compact translations for ActivateProbes (56c0cd3b82a00c6e). Only the second XCL cache was seeded with the existing 893,274-byte PSO blob.

XCL driver blob at start PSOs made Refused Loaded from driver cache Command time
Absent 1 0 0 10.8 s
Present 1 0 1 0.3 s

One run per arm. NVIDIA’s internal cache was uncontrolled, and a separate compile was running in the background, so the timings are descriptive. This check covers offline PSO creation. In-title reuse and progression beyond the black frame remain unverified.

AI use for this update: OpenAI Codex (GPT-6.2 Sol) assisted with verification and reporting.

@CowboyBingus

Copy link
Copy Markdown
Author

@brainhay5 thanks. 1 routes every compute program and is for tests and measurements, not for play. I've added your 84.2 s → 158.8 s numbers to the description, under that setting. auto stays the default.

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

@pvfreis pvfreis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of 5e312d5 (stacked on #1315; merge base 930e8b4), by reading the code; nothing was built or run here. No defect found in the routing or the cache naming: only compute programs are routed, an incomplete or failed compact form falls back to translate, and a _c entry and a normal one are never served for each other.

  1. CONFIRMED: only_compute_goes_to_the_compact_backend does not test that only compute is routed. Its non-compute case is a lone S_ENDPGM, which has no branch target, so compact() returns translate for it (compact.rs:167-169) and always.hlsl == normal.hlsl holds whether or not kernel programs are routed. Removing matches!(opt.mode, Mode::Compute(_)) from translate_as (mod.rs:1409) would leave the test green, and that check is what keeps other modes out under XCL_COMPACT_CS=1. A branching program for the non-compute mode, asserting that its compact text differs from translate's and that the routed result equals translate's, would cover it.

Also: the stack conflicts with #1321 in crates/xcl/src/gpu/recomp/mod.rs (git merge-tree), so whichever lands second needs a rebase; and at the next rebase, the body of 5e312d5 still says it adds "a stub recomp::compact", which comes from 2912ed3.

Verdict: fine as far as I read once the routing test checks what its name says.

Review by Claude Code (written by Claude Opus 5.5, two adversarial checks by Claude Fable 5.2, checked by Claude Opus 5.5); each point checked by a person before posting.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

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

Thanks!

@t4l03

t4l03 commented Nov 24, 2026

Copy link
Copy Markdown

RTX 4070 Ti follow-up: the shared-target prototype completed ActivateRays with a longer time budget

This is an independent check alongside Pipodi’s RTX 4090 experiment. I reran the exact branch-free, factored DXIL from my earlier #1269 report, which stopped at 75 s. With a 150 s limit, both runs created the pipeline and saved a 1,300,766-byte driver blob.

Run Pipeline creation, including helper startup Peak private commit
1 79.41 s 4.047 GiB
2 88.84 s 4.056 GiB

RTX 4070 Ti, driver 617.14, Windows 11 build 26300, DXC 1.9.2609.5. Four switch-based memory windows, release helper using XCL’s ABI root signature and the shader’s static samplers. Each run used a differently named helper executable and a fresh XCL cache. NVIDIA’s global DXCache remained enabled.

The local prototype also has 2,516 shared cases. It uses a different override encoding: a default target per case plus 6,566 sparse absolute-target overrides assigned by block index (11,498 total table words in this experiment). Its 2,787,188-byte DXIL has 6,418 explicit block labels, 44,484 SSA definitions and 6,526 select instructions. This adds Ada data for the tradeoff between table size and override work. The two machines and encodings differ, so the timings are separate observations.

Not tested: dispatch output, full-title loading, or Pipodi’s exact implementation. The shared-target PR is theirs. I’m looking at the remaining case bodies and memory-window variants as noted in #1269.

AI use: Codex (gpt-6.2-sol) ran the measurements and wrote this report.

@CowboyBingus
CowboyBingus force-pushed the recomp-compact-routing branch from 5e312d5 to 6cefa5c Compare November 24, 2026 15:36
@imnicho

imnicho commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Test report at 5e312d5 on a small machine (16 GB RAM, 4 cores): the fallback of 15ec6daefb19a780 takes the title's process to its commit cap at the start of every run. With the table cap at 12,288 words it takes the compact form and the commit stays flat, but DXC does not finish that form in 14 minutes here.

Tested

build runs process commit (XCL's memory line) end
without this PR one of 900 s, the first to get this far 30.6 GB until 800 s, then 31.4 → 51.1 GB between 810 and 870 s at the cap to the time limit; last dispatch at 830.8 s
without this PR the next 3 16.8 → 34.4 → 48.9 GB at 30 / 60 / 90 s 0xc0000409 at 95.6 to 99.5 s, before the title's world set-up, 3 of 3
this PR, 5e312d5 1 17.5 → 38.6 → 50.2 GB at 20 / 60 / 100 s 0xc0000409 at 125.8 s
this PR + MAX_TABLE_WORDS = 12288 (local) 420 s and 900 s 28.7 to 29.4 GB from 140 s to the end running at the limit in both; world set-up at 139.1 and 140.8 s
  • Without the PR, the three runs that end at the start have the preload's builds of the used programs going from the first seconds. Thread dumps at 50, 70 and 85 s of one of them show one xcl-dxc worker inside dxcompiler.dll and one xcl-pso-pre worker inside nvgpucomp64.dll, the same two each time. I did not separate DXC's share of the growth from the driver's.
  • With the PR as it is: d122faa48eb0afdc goes through the compact form (88,863 instructions, 718,281 B of HLSL, 983,404 B of DXIL). The driver built its pipeline in 75.6 s here, during the title's start with other builds beside it, and later runs take it from its blob. 15ec6daefb19a780 is refused ("19949 blocks of 11909 texts need a 9975-word table (at most 8192) – translated as before"), and the commit goes to the cap again; the process ends about half a minute later than without the PR.
  • With the cap at 12,288 words: 15ec6daefb19a780 goes through the compact form too (76,699 instructions, 5,249,095 B of HLSL) and the commit stays flat. But its DXIL never reached the cache: no …_c.bin entry for it after the 420 s run or after the 900 s run (884 s after its translation at 16.0 s), and the second run translated it again. So on this CPU DXC needs more than 14 minutes for that form with the title running beside it. The driver's time for it was not reached.

So on a machine of this size the fallback is more than slow: once the title has used the program, the preload starts it in every run and the process is gone before the world's set-up. A higher cap alone does not make the program usable here either (11,909 texts are 5.2 MB of HLSL), which speaks for the denser table discussed in #1269. I can run that on this machine when it is up.

Not tested

AI use

  • Claude Code with Claude Fable 5.2 ran the builds and the runs on the machine named and wrote this report.

@oni-swr

oni-swr commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

AMD dedicated GPU (RX 7800 XT, native wave64) at 5e312d5: full suite green; the compact ActivateProbes and ActivateProbesTarget build in the AMD driver, but in 439 s and 342 s with 19–23 GB of commit; the old forms fail with E_OUTOFMEMORY. Counts and timings only. This adds the AMD driver side next to @Pipodi's RTX 4090 numbers on #1269, and the per-program times for the programs auto routes, which the XCL_COMPACT_CS=1 run on an RX 9070 in #1269 did not reach.

Tested

  • AMD Radeon RX 7800 XT 16 GB (RDNA3, native 64-lane waves, driver 32.0.31035.1003), Ryzen 7 5700X3D, 64 GB RAM, Windows 11 26200, Rust 1.100.0 MSVC, DXC 1.8.2502.11 (Windows SDK 10.0.26100.0). PR head 5e312d5 (on main 930e8b4), clean tree, its own worktree and its own CARGO_TARGET_DIR. The PR's head is now 6cefa5c; it differs from 5e312d5 in one test (only_compute_goes_to_the_compact_backend), and I did not rerun on it.
  • cargo test --workspace -- --test-threads=4 (debug), twice (the second with --nocapture): 773 passed, 0 failed, 41 ignored both times, no SKIPPED line. gpu_compact_native_wave64_form ran and passed.
  • The three screen-probe programs, one at a time, with @Pipodi's method: each record alone in its own folder, a new empty XCL_DXIL_CACHE, then xcl shaders <folder> --precompile --only cs (DXC), then the same with --pipelines (cold driver build), then --pipelines again (from the blob). Release, one process at a time, wall time of each process, peak private commit polled every 0.5 s, one run each:
program form HLSL DXC DXIL cold --pipelines run peak commit from the blob
ActivateProbes compact, native wave64 716,691 B 9.3 s 867,356 B 439.1 s, made 23.23 GB 0.6 s
ActivateProbesTarget compact, native wave64 659,094 B 8.2 s 774,200 B 342.1 s, made 19.24 GB 0.6 s
ActivateRays (15ec6daefb19a780) refused: 19949 blocks of 11909 texts need a 9975-word table (at most 8192) – translated as before – stopped, see below – not run 28.06 GB at the stop –

For the same two programs @Pipodi measured on the 4090: 14.3 s and 11.4 s of driver time, 1.8 and 1.5 GB. Here the driver time is about 30 times longer and the commit about 13 times higher. The rows are not matched (DXC 1.8.2502.11 here, and the HLSL is the native wave64 form), but a factor of 30 is not explained by that.

  • ActivateRays' fallback (the old form, about 150 MB of HLSL) went into DXC and was stopped 33 s in, at 28.06 GB private commit and 3.03 GB of system commit left, by a guard of mine (floor 4 GB). No DXC time and no driver run for it.
  • gpu_compact_sample_big_cs (release, XCL_SAMPLE_BIG_CS set to each program's code, native wave64, no split), on the old form (translate):
program HLSL (translate / compact) DXC DXIL CreateComputePipelineState
ActivateProbes 29,605,161 / 690,720 B 111.6 s 22,239,220 B E_OUTOFMEMORY (0x8007000E), about 110 s later
ActivateProbesTarget 29,530,437 / 636,447 B 111.1 s 22,052,376 B E_OUTOFMEMORY (0x8007000E), about 100 s later
ActivateRays translate_compact refuses: 19832 blocks of 11829 texts need a 9916-word table (at most 8192) – – –

On this adapter that test panics at tests_compact.rs:1163 on the old form's E_OUTOFMEMORY, and at tests_compact.rs:91 on ActivateRays' refusal, before it compares or times the compact form. On a driver that builds the old form the test gets further; here it does not, so it shows nothing about the compact form on AMD. The compact form is covered by the two cold builds in the table above.

What it says

  • On AMD the compact forms of the two screen-probe programs build and the blob works (0.6 s), but a first build takes 5.7 to 7.3 minutes and 19–23 GB of commit, for a title whose watchdog fires about 30 s after its main thread stops. That is the same direction as @HKEY-Funk-Machine's RX 9070 run (about 2x per PSO with XCL_COMPACT_CS=1) and @Sr-0w's RX 7800 XT variant table, at a much larger factor, on the programs auto routes.
  • Whether the auto default helps or hurts a world load on AMD is not answered here: no title run reached these programs on this card.

Not tested

  • A title run, the smoke run (scripts/smoke.ps1), and a full-pack --pipelines pass.
  • XCL_COMPACT_CS=0 and =1 in the title; DXC 1.9.x; repeat runs of the timings (one run each).
  • Whether the compact programs' output matches translate on the GPU for the retail programs.
  • Any other AMD generation; ActivateRays' compact form (cap raised or shared targets, @Pipodi's local change); 6cefa5c.

AI use

  • Claude Code, Claude Opus 5.5: ran the suite and the gpu_compact_sample_big_cs runs, and wrote the timing script.
  • Claude Code, Claude Sonnet 5.5: ran the timing script, checked the three threads for AMD reports, and wrote this comment.

@thaqiart139-alt

thaqiart139-alt commented Nov 24, 2026 •

Copy link
Copy Markdown

Edited: rerun on the current head 5749171 (rebased onto main c160d86, on top of #1315's a45ac0c). The first runs were on 5e312d5 and 6cefa5c, against main 930e8b4, with the same result: all pass on both GPUs.

Test report for this PR's head 5749171 (the stack with #1315) on AMD RDNA2 with native 64-lane waves, and on a 32-lane NVIDIA card.

Tested

  • GPUs: AMD Radeon(TM) Graphics, the RDNA2 iGPU of a Ryzen 7 7800X3D (native wave64, driver 32.0.21045.29003), and NVIDIA GeForce RTX 5070 (driver 32.0.16.2101). Ryzen 7 7800X3D, 32 GB, Windows 11 Home build 26300, Rust 1.100.0, debug, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0). Adapter chosen with XCL_ADAPTER=radeon / nvidia; the SKIPPED lists below show which GPU each run used.
  • cargo test --workspace -- --test-threads=4, this PR against its base:
main c160d86 this PR 5749171
RTX 5070 858 passed, 0 failed, 42 ignored 882 passed, 0 failed, 42 ignored
Radeon iGPU 858 passed, 0 failed, 42 ignored 882 passed, 0 failed, 42 ignored
Radeon iGPU, XCL_COMPACT_CS=1 – 882 passed, 0 failed, 42 ignored
  • With XCL_COMPACT_CS=1 the compact backend logged two compute programs more than with the default (2 and 22 instructions), and the suite still passed. That is little extra coverage: most of the suite's compute programs do not go through console_translation.
  • SKIPPED, the same on c160d86 except gpu_compact_native_wave64_form, which is new in the stack:
    • RTX 5070: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware and gpu_compact_native_wave64_form (no wave64); heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
    • iGPU: gpu::dxil::graphics::tests::emitted_ms_primitive_attribute_reaches_the_pixel_shader, gpu::dxil::graphics::tests::emitted_ms_ps_draw_a_triangle, gpu_geometry_mode_es_gs_strip and gpu_mesh_mode_two_passes (no mesh shaders); heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).

Not tested

  • A title run, the giant retail programs, DXC or driver timings, other AMD generations, Linux / Wine.

AI use

  • Claude Code (Claude Opus 5.5) ran the builds and tests and wrote this report.

@CowboyBingus

Copy link
Copy Markdown
Author

Thanks, @pvfreis (review). New head: 6cefa5c, the same single commit on top of #1315, amended.

  1. only_compute_goes_to_the_compact_backend now uses a program with a branch (S_CBRANCH_SCC1 to the next instruction, then S_ENDPGM). For Mode::Kernel and Mode::Compute it asserts that compact::translate_compact gives a complete translation whose HLSL differs from translate's, and that translate_as(.., CompactCs::Always) returns translate's HLSL for Mode::Kernel and the compact HLSL for Mode::Compute. With matches!(opt.mode, Mode::Compute(_)) removed from translate_as (locally, not pushed), the test fails (assertion `left == right` failed at mod.rs:1594); with it, the test passes.
  2. The commit message no longer says the commit adds a stub recomp::compact.
  3. Recompiler: oversized structured code falls back to pc blocks (#1307) #1321: git merge-tree of 6cefa5c with Recompiler: oversized structured code falls back to pc blocks (#1307) #1321's head 0936337 conflicts in crates/xcl/src/gpu/recomp/mod.rs only, in one block: Recompiler: oversized structured code falls back to pc blocks (#1307) #1321 adds let program = code; as the first line of translate, at the lines that Recompiler: compact form that emits every distinct block text once #1315 moves into prepare(). Keeping this PR's side and adding let program = code; as the first line of translate resolves it. The resulting mod.rs is identical to the one in our local merge of 5e312d5 with Recompiler: oversized structured code falls back to pc blocks (#1307) #1321's earlier head 156b0de (in our local integration tree 355c727, not pushed), apart from this push's test change. 0936337 differs from 156b0de only in tests.rs.

Full suite on 6cefa5c (cargo test --workspace --no-fail-fast -- --test-threads=4): 772 passed, 1 failed, 41 ignored, of the passed 3 SKIPPED (no wave64). The failure is xmem_virtual_query_marks_cpu_readable_memory (kernelx.rs:2070), the one listed in the description. The description's Tested line and regression run are updated to 6cefa5c.

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

@Anon64

Anon64 commented Nov 24, 2026

Copy link
Copy Markdown

World-loading run on a 12 GB 32-lane card, for the case nobody above has: RTX 3060 12 GB (581.80), Windows 11 26200, 64 GB RAM. This PR's head 6cefa5c (with #1315, on main 930e8b4), release, XCL_COMPACT_CS unset (auto), XCL_NETWORK=0, A pressed every 4 s from 20 s, 200 s, warm DXIL and driver caches. Compared with a run of #253's head on the same main (f67e35a; #253 only changes eh.rs), same setup.

main 930e8b4 (+ #253) this PR
presents per 2 s drop below 20 58 s 58 s
presents 0 from 78 s 74 s
title's watchdog (+0x23cf683) 105 s 102 s
process commit at 80 / 90 / 100 s 31.5 / 31.6 / 32.1 GB 30.2 / 44.4 / 49.9 GB
peak commit (smoke.ps1) 32.2 GB 54.6 GB
  • d122faa48eb0afdc took the compact form at 5.9 s (88 863 instructions, 723 453 B HLSL); its pipeline was built at 56.0 s: 1 053 272 B DXIL, 36.5 s in the driver.
  • 15ec6daefb19a780 fell back at 71.9 s (9 975-word table, at most 8 192), as in your run.
  • Other compute builds over 3 s: 395 KB in 7.6 s, 322 KB in 3.5 s. 394 compute PSOs in all.

So on this card the PR gets the big program built, but the title still stops at the same point, and process commit grows by ~18 GB between 80 s and 100 s where main stays flat; I have not found which thread allocates it. One run each.

Written with Claude Code (Claude Opus 5.5) from runs on this machine.

@claudetools-gh

Copy link
Copy Markdown

A data point for the routing rule here: forcing the compact form on the title's mid-size compute programs (XCL_COMPACT_CS=1) does not help them, so the auto rule looks right.

Setup: RTX 5070 Ti (driver 621.01), Ryzen 7 9700X, Windows 11 26300, release. main 47efa2e plus #1315/#1316 and other local PRs. The test is gpu_compact_sample_big_cs with XCL_SAMPLE_BIG_CS set to programs from the retail 1.0.2.1 pack. The program code was dumped locally and is not attached.

program instructions HLSL translate → compact DXIL translate → compact DXC translate / compact create + run translate / compact
a90b92233fcb9719 (wave32) 10,315 2.31 MB → 1.18 MB 474 KB → 987 KB 6.7 s / 5.2 s 4.64 s / 4.82 s
e666f4964e13c649 (wave32) 9,580 2.37 MB → 1.10 MB 428 KB → 921 KB 3.8 s / 4.2 s 3.71 s / 4.64 s
  • At this size the compact form halves the HLSL but roughly doubles the DXIL, and pipeline creation plus the run is not faster. Results matched between the two forms; the test passed.
  • A third program, ddee0954b55bc286 (12,638 instructions, wave64 split), failed in the harness's run of the plain translate form, before the compact form was tried. I have not looked into why.
  • A forced 15-minute xcl pipelines pass (XCL_COMPACT_CS=1) routed 116 programs. Only the small ones reached the driver (55–205 KB DXIL, 0.3–2.7 s). The large ones were still in DXC when the pass was stopped.

So the compact form pays off for the giants with heavy block repetition, as in the PR's 29.75 MB case, but not as a general switch for big programs. The title's ~1,800 compute programs with 0.5–1.4 MB of DXIL, at 30–190 s each in NVIDIA's compiler in our precompile logs, stay the open problem from #1269.

Not tested: the 1.4 MB-DXIL programs themselves (the two above are smaller), AMD, and the driver compile timed on its own, separately from the run.

AI-assisted.

@Tjabooo

Tjabooo commented Nov 24, 2026

Copy link
Copy Markdown

AMD on Linux, since the reports so far are NVIDIA: 5e312d5, RX 9070 XT (RDNA4), RADV / Mesa 26.2.6, Wine 11.21, vkd3d-proton v3.1 (with #257's patch), DXC 2026_09_29, cross-built for x86_64-pc-windows-gnu, debug.

Not tested: XCL_COMPACT_CS=1 over the whole suite (blocked by the same crash), a title. No game data. AI-assisted (Claude Code, Claude Opus 5.5).

@Frtuchinno

Frtuchinno commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Test report for #1316 on AMD RDNA3 (native wave64), Windows: head 5749171, 882 passed, 0 failed, 42 ignored

Edited: rerun on the current head 5749171 (rebased onto main c160d86). Earlier versions of this comment were on 5e312d5, ee904f1, 57377fb (on 930e8b4) and c3d119c (on 9e3831e), with no failures.

This covers the "Not tested: AMD, wave64 hardware" line of #1315 / #1316. On this adapter gpu_compact_native_wave64_form runs instead of being skipped, and every compact GPU test ran in the native wave64 form.

Tested

  • Head 5749171 (Recompiler: route compute programs through a compact backend (XCL_COMPACT_CS) #1316, contains Recompiler: compact form that emits every distinct block text once #1315's commits), against its base main c160d86
  • AMD Radeon RX 7800 XT (driver 32.0.32029.2010), Ryzen 5 7600, 32 GB RAM, Windows 11 Pro build 26300
  • rustc 1.100.0 stable-x86_64-pc-windows-msvc, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), debug
  • Adapter: default selection (auto, high-performance order), which is the RX 7800 XT; the other adapter is the CPU's integrated GPU
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4
    • main c160d86: 858 passed, 0 failed, 42 ignored (lib tests 809 / 0 / 22)
    • 5749171: 882 passed, 0 failed, 42 ignored (lib tests 833 / 0 / 22)
    • SKIPPED on both, so not from this PR: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)
    • Earlier heads: c3d119c 799 / 0 / 41 (on 9e3831e, 776 / 0 / 41); on 930e8b4, 5e312d5 and ee904f1 773 / 0 / 41 and 57377fb 774 / 0 / 41
  • cargo test -p xcl --lib compact -- --test-threads=1 --nocapture on 5749171: 24 passed, 0 failed. Output lines of note:
    • gpu_compact_native_wave64_form ... ok (execz nest, backward loops, buffer_load_format_x: both backends agree)
    • memory windows (wave64 native, 2 windows): 263172 result bytes identical
    • execz nest (wave64 native, unstructured, 4 windows): 394244 result bytes identical

Not tested

  • gpu_compact_sample_big_cs: XCL_SAMPLE_BIG_CS not set, so it returned without running
  • No retail title or shader pack on this machine: no xcl shaders pass, no title run, no smoke run, no driver compile times for the large programs
  • RDNA2 (the iGPU on this machine was not selected), Linux / Wine
  • Release build

AI use

  • Claude Code (Claude Opus 5.5) installed the toolchain, ran the commands above and wrote this report.

@IvovdBruggen

Copy link
Copy Markdown

RTX 3080 10 GB on head 6cefa5c (the current head; earlier reports were on 5e312d5): 773 passed, 0 failed, 41 ignored; smoke run equal to main with warm caches

Tested

  • Head 6cefa5c342fe71a88cd64153d81e755683887fb3 (base main 930e8b4), no local changes
  • NVIDIA GeForce RTX 3080 10 GB, driver 617.42 (32-lane waves only); AMD Ryzen 5 5600, 32 GB RAM; Windows 11 IoT Enterprise LTSC build 26100
  • Rust 1.100.0 stable-x86_64-pc-windows-msvc, MSVC 14.52.37025, DXC 1.8.2502.11 (Windows SDK 10.0.26100.0)
  • cargo test --workspace --no-fail-fast -- --test-threads=4 (debug): 773 passed, 0 failed, 41 ignored (lib tests 729 / 0 / 21)
  • SKIPPED (no wave64): gpu_compact_native_wave64_form, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware

Regression run
scripts/smoke.ps1 -Game <game folder> (release builds, 60 s, menus, no input), both with warm caches:

main:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: NVIDIA GeForce RTX 3080
title: Retail Game.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1117 (PresentX 1117)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15302 MB

this PR:

xcl-smoke v1
commit: 6cefa5c342fe71a88cd64153d81e755683887fb3
gpu: NVIDIA GeForce RTX 3080
title: Retail Game.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1114 (PresentX 1114)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15313 MB
  • The first run of this PR's build was slower (857 frames, 32–39 presents per 2 s at the end) because the changed translator sources give it a new translated-cache directory. The second run matches main.
  • The log has no compact backend line: in 60 s of menus the title did not reach a program this PR routes.

Review note (found with an AI tool, checked in the code): translate_as falls back to translate only when the compact translation errors or is incomplete. If DXC or CreateComputePipelineState later rejects the compact HLSL, compile_console_shader (pso.rs:262 → :292) has no retry with the normal form, and that program gets the stand-in CS. With MAX_TABLE_WORDS measured on one adapter, a retry in the normal form on rejection may be worth considering.

Not tested

  • A title run that reaches ActivateProbes / ActivateRays
  • XCL_COMPACT_CS=1
  • AMD / wave64; Linux / Wine
  • Tests on game data: no XCL_SAMPLE_* set

AI use

  • Claude Code: Claude Fable 5.2 ran the main build and tests; Claude Opus 5.5 ran this PR's tests, all smoke runs and the review, and wrote this report. All results are from runs on the machine above.

Royalflamejlh added a commit to Royalflamejlh/xcl that referenced this pull request Nov 25, 2026
The third-largest compute program of a retail pack repeats itself as the
two largest do (13,890 blocks of 2,643 kinds), but its branches go to
6,530 different pairs of offsets. As an index into a table of pairs its
tables were about 24,000 words, over the limit, and it kept the plain
form: 3.9 MB of DXIL.

In it, as in the other large programs, a block's second successor is
always the next block. For such a program a table entry now holds the
taken successor itself when that makes the tables smaller, about 11,300
words here. The limit goes from 8,192 to 12,288 words, the size xcl-dev#1316
measured an RTX 5070 Ti accepting, and the program takes the form.

A class's key also marks whether an instruction has a static sampler
(from the review of xcl-dev#2034): the one section an instruction can have and
another with the same words lack.

Part of xcl-dev#1269.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Royalflamejlh added a commit to Royalflamejlh/xcl that referenced this pull request Nov 25, 2026
The third-largest compute program of a retail pack repeats itself as the
two largest do (13,890 blocks of 2,643 kinds), but its branches go to
6,530 different pairs of offsets. As an index into a table of pairs its
tables were about 24,000 words, over the limit, and it kept the plain
form: 3.9 MB of DXIL.

In it, as in the other large programs, a block's second successor is
always the next block. For such a program a table entry now holds the
taken successor itself when that makes the tables smaller, about 11,300
words here. The limit goes from 8,192 to 12,288 words, the size xcl-dev#1316
measured an RTX 5070 Ti accepting, and the program takes the form.

Part of xcl-dev#1269.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Royalflamejlh added a commit to Royalflamejlh/xcl that referenced this pull request Nov 25, 2026
The third-largest compute program of a retail pack repeats itself as the
two largest do (13,890 blocks of 2,643 kinds), but its branches go to
6,530 different pairs of offsets. As an index into a table of pairs its
tables were about 24,000 words, over the limit, and it kept the plain
form: 3.9 MB of DXIL.

In it, as in the other large programs, a block's second successor is
always the next block. For such a program a table entry now holds the
taken successor itself when that makes the tables smaller, about 11,300
words here. The limit goes from 8,192 to 12,288 words, the size xcl-dev#1316
measured an RTX 5070 Ti accepting, and the program takes the form.

Part of xcl-dev#1269.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@ettehn

ettehn commented Nov 25, 2026

Copy link
Copy Markdown

I tested a local resolution of the pso.rs conflicts Pipodi described above, merging 964f5ed9be2eff8d18e4ed5073f0a826c9ed6015 into main cbc296ab65a2661a61e3e2da109134bcd5319f60 without committing.

  • Keep main's shared shader_cache() as the in-memory cache and this PR's normal_after_refusal around the two translated-disk lookups. Pass compact = false from console_mesh to the extended disk-cache API.
  • Put main's dxc::defer() check inside the Some(direct) arm of direct_first, before invoking the direct translator. None still reaches the HLSL path and can use its cached DXIL. The outer caches still get first chance to return a finished translation.

Tested on Windows 11 26200.9974, RTX 5070 Ti Laptop (621.24), Rust 1.97.1, DXC 1.8.2502.11, release. shader_cache_tests: 20 passed, including a regression test where a cold cached_only call marks a miss and runs neither translator, then a normal call populates the cache and a later cached_only call returns the same entry. gpu::recomp::compact::tests: 3 passed. gpu::recomp::tests_compact: 17 reported OK, including one explicit native-wave64 skip and one unconfigured retail sample. pso_measurement_compiles_an_exact_synthetic_record: 1 passed. No failures or ignored tests in those filters.

Not tested: full suite, retail smoke, Linux, and native wave64. This is a candidate resolution for the rebase, with the branch left to the PR author.

AI use: OpenAI Codex (GPT-6.2 Sol) assisted with the local integration and verification.

@Swagi-REDACTED

Copy link
Copy Markdown

Targeted RTX 3060 test report for the compute record 56c0cd3b82a00c6e from A newer retail game, encountered during first world loading.

Hardware: Ryzen 7 9800X3D, RTX 3060 12 GB (driver 621.14), approximately 16 GB RAM, Windows 11 Home 26200. Rust 1.95.0 MSVC; DXC/DXIL 1.9.2602.17.

Tested local integration: main cbc296ab65a2661a61e3e2da109134bcd5319f60 plus the four original commits d94c34a, bd69c5d, c195f07, 964f5ed (local head fc05b6d). This is not an unmodified PR-head test: conflicts were resolved to retain main's shared shader cache and cached-only direct-DXIL deferral, and the current mesh-cache call needed a false compact argument. A separate, optional live-input test harness was also present.

With XCL_COMPACT_CS=auto, the existing CLI command xcl shaders <private-single-record-folder> --precompile --only cs --pipelines --limit 1 produced:

compact backend, compute program d122faa48eb0afdc: 88863 instructions, 730151 B HLSL
compiled 1, already cached 0, errors 0, skipped (GS – paired at pipeline creation) 0, time 37.5 s
pipelines made on the GPU 1, refused 0
pipelines loaded from the driver cache 0

The serialized translated-cache payload contains 1,067,116 bytes of DXIL. The previous main-based world-load attempt logged this same record entering driver compilation with 22,089,024 bytes of DXIL; it had not finished when that run was intentionally stopped. This is not a timed, completed before/after benchmark.

Additional validation on this integration:

  • cargo test --locked -p xcl --lib compact -- --test-threads=4: 30 passed, 0 failed, 0 ignored; 1 explicit native-wave64 skip (included among the passing tests).
  • cargo test --locked -p xcl --lib gpu::recomp::pso::shader_cache_tests -- --test-threads=4: 19 passed, 0 failed, 0 ignored; no explicit skips.
  • Release workspace build passed. Full workspace tests and clean main/head smoke pairs have not been run for this integration.

World loading is being retested separately; this report does not establish gameplay or prologue completion. No game data is attached.

AI use: Codex, GPT-6 (exact serving variant not exposed), integrated the existing patches, ran these commands, inspected the cache payload, and wrote this report. The compact backend remains CowboyBingus's work.

@CowboyBingus
CowboyBingus force-pushed the recomp-compact-routing branch from 964f5ed to eb1f131 Compare November 25, 2026 06:13
@CowboyBingus

Copy link
Copy Markdown
Author

@Pipodi thanks for the heads-up. Rebased onto main 6e1e2be and pushed: #1315 is now 0d7907b, this PR eb1f131. Both show as mergeable.

TESTED on eb1f131 (RTX 5070 Ti, Windows 11): cargo build --workspace and cargo build --release succeeded; cargo test -p xcl --lib compact -- --test-threads=4: 30 passed, 0 failed, 0 ignored (gpu_compact_native_wave64_form printed SKIPPED: no wave64 and counts among the passed); cargo test -p xcl --lib pso:: -- --test-threads=4: 19 passed, 0 failed, 1 ignored (compile_time_bench::repeated_pso_shader_compile). On #1315's 0d7907b: the same builds succeeded, compact 25 / 0 / 0 (same skip), pso:: 16 / 0 / 1. No full suite or smoke run on these heads.

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

@itsSio

itsSio commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Tested

Independent Windows verification requested in #1269, on clean head eb1f1313a8ce0515b1b9587b4bcbee521718996d. Windows 11 Pro 26200 on both systems, x64 MSVC, unoptimized dev/test with debug info off. cargo build --workspace --locked and cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --nocapture exited 0 on both.

GPU / driver CPU, RAM, toolchain Passed / failed / ignored Runtime SKIPPED
RTX 5080 / 32.0.16.1088 Ryzen 7 9800X3D, 32 GiB; Rust 1.97.0, DXC/DXIL 1.9.2609.5 1179 / 0 / 46 26
RTX 2080 SUPER / 32.0.16.1088 Ryzen 5 5600X, 16 GiB; Rust 1.99.1, DXC/DXIL 1.8.2502.11 1179 / 0 / 46 28

Both logged 21 native-wave64 skips, three per-lane f16/f32 refusals, unavailable driver-cache control and unavailable heap windows. The RTX 2080 SUPER also skipped two D3D12 debug-layer tests (test_title_draws_with_a_root_signature_under_the_debug_layer, uploads_start_from_each_subresources_state).

Focused cargo test -p xcl --lib --locked gpu::recomp::tests_compact -- --test-threads=1 --nocapture: 17 / 0 / 0 on the Radeon RDNA2 iGPU (32.0.21043.5001, same Ryzen 7 system) with no runtime skips, and 17 / 0 / 0 on the RTX 2080 SUPER with one native-wave64 skip. Default XCL shader options throughout.

Not tested

Retail smoke or shader samples, full AMD workspace, RADV, Intel, or compile and gameplay performance.

AI use

Ran via Samaritan:

  • OpenCode with OpenAI GPT-6.2 Sol (openai/gpt-6.2-sol): ran both Windows checks, verified the raw results and wrote this report.

@CowboyBingus
CowboyBingus force-pushed the recomp-compact-routing branch 2 times, most recently from 4a407fb to dcd3837 Compare November 25, 2026 11:01
CowboyBingus and others added 4 commits November 25, 2026 05:40
…nslate

No behaviour change: the decoding, block leaders and emitter set-up at the
start of translate() move into prepare(), so a second form of the program
(the compact form) is built from exactly the same decoded program and
emitter state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DXC inlines every helper of a cs_6_x target, so a retail compute shader
with thousands of equal blocks (ActivateProbes 56c0cd3b82a00c6e: 88,863
instructions, 3,281 buffer_load_format_x) becomes 29.75 MB of DXIL that
the driver needs minutes for. translate_compact() cuts the program into
blocks (leaders, plus every instruction whose HLSL exceeds 600 B on its
own), emits each instruction with emit::Em as translate() does,
temporaries numbered from t1 per instruction, and shares equal block
texts as cases of one dispatch loop. Branches go to a block at an offset
from their own (part of the text), so a static table only holds every
block's case, packed. The table is capped at 8,192 words: on an RTX 5070
Ti, CreateComputePipelineState of this program's compact form with an
added 12,288-word static array succeeded; with 15,360 words it failed
with E_OUTOFMEMORY. Back edges spend the loop budget (65,536 per lane);
once it is spent the program ends, where the structured form leaves the
loop and runs what follows. compact_wanted() picks programs of
20,000+ instructions whose distinct blocks hold under 30 % of them.
Not called yet.

Measured on 56c0cd3b82a00c6e (4 memory windows, split wave64, RTX 5070
Ti, a local merge, 31be310): 723,453 B HLSL, DXIL
1,053,264 B in 12.5 s, CreateComputePipelineState 9.7 s from a new exe
with no cached blob.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tests_compact translates each program with translate and with
compact::translate_compact and runs both on the same inputs. The kernel
programs assert byte-identical SGPRs, SCC, VGPRs of all lanes, exports
and the split form's upper-half SGPRs, plus flat memory or the first
64 KiB of each memory window; the compute dispatch compares memory.

Programs: nested execz regions, divergent and scalar backward loops,
one block repeated at five addresses, far jumps (s_getpc_b64, add or
sub, s_setpc_b64) forward and backward, v_mul_lo_u32,
buffer_load_format_x in twelve formats and repeated as a block of its
own, a cross-lane block (ballot, readfirstlane, readlane) repeated
under four exec masks, s_endpgm before the last block, a loop through
four memory windows with loads, stores and per-lane atomics, a
compute dispatch, and 200 forward jumps that xcl-dev#1307's bound sends to
pc blocks in translate (gpu_compact_against_the_pc_block_fallback). The kernel programs run in each form forms() lists
for the adapter (wave64 split or native, wave32; with branches also
unstructured), and in the wave64 forms with mem_windows: 4; the
compute dispatch runs in wave64 (split where the adapter needs it) and
wave32.

Every program here except one has a branch, and the tests assert that
translate_compact gives it the compact form: they read its dispatch
loop back from the HLSL. translate_compact keeps translate's form for a
program without branches, so the two straight-line programs start with
a branch to the next instruction. For the repeated blocks, the
exchange block, the buffer loads, the window loop, the far jumps and
s_endpgm they also assert the shape: fewer cases than blocks, one case
for the four copies of the exchange block and one for the block after
the load, the load a case of its own, the far jumps' block offsets,
two program ends before the last block. The exception is the
memory-window program of gpu_memory_windows_above_4_gib (no branch):
it gets translate's form from both, so its test compares translate
with itself; the window loop runs the compact form through the
windows.

The atomics in the memory-window programs add to a dword per lane. On
an RTX 5070 Ti (split wave64, 4 windows), with all 64 lanes adding to
one dword, 40 runs of the same DXIL returned two different lane 0
values (5 and 35 runs): the split halves' atomics land in either
order.

gpu_compact_sample_big_cs (XCL_SAMPLE_BIG_CS=<code file>) runs a retail
program both ways. A program translate_compact refuses (e.g. its table
limit) is SKIPPED; when the driver cannot create translate's pipeline
(e.g. E_OUTOFMEMORY), the A/B comparison is SKIPPED and the compact
form must still compile and run.

Needs the compact backend (compact.rs and `pub mod compact`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…PACT_CS)

The switch XCL_COMPACT_CS: unset / auto = the programs compact_wanted
picks, 0 = none, 1 = every compute program; another value logs a warning
and acts as auto.
`translate_routed` gives a compute program to translate_compact where the
switch says so and uses `translate` when that returns an error or an
incomplete translation. The PSO path (console_translation, both FSPX and
FSSM), `xcl shaders` statistics and precompile, and the shader dump's
recompile use it.

The on-disk translation cache names an entry of a program routed to the
compact backend `..._c.bin`, so a compact and a normal translation of one
program never share a file; the file name of a normal entry is unchanged.
compact.rs is added to the translator sources that identify compatible
cache entries (this commit changes that identity, so existing entries are
translated again once). One INFO line per compute program routed to the
compact backend, the first time: instructions and HLSL bytes, or why it
fell back.

When dxc::compile_cached fails on a compute program's compact-form HLSL, the
program is compiled in the normal form (or taken from the normal form's
translation-cache entry when that is on disk), and the result is kept under
the normal entry, never the `_c` one; one WARN line is logged before that.
A cached-only attempt is not retried: its DXIL is not refused, only not made
yet. A refusal is not remembered between runs. A driver
(CreateComputePipelineState) rejection of a compact pipeline is not retried in
the normal form.

With XCL_DIRECT_DXIL (xcl-dev#1426) on, a compute program XCL_COMPACT_CS routes to
the compact form goes to the HLSL path's compact form first, not to the direct
translator; if DXC refuses that HLSL, the retry in the normal form goes to the
direct translator first, then to translate. Every other compute program goes
to the direct translator as before, and to the HLSL path when that falls back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.