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.
    • 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).

  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4 (debug) on this PR's head 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 (release builds, menus, no input):

main:

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

this PR:

xcl-smoke v1
commit: 964f5ed9be2eff8d18e4ed5073f0a826c9ed6015
gpu: NVIDIA GeForce RTX 5070 Ti
title: retail
seconds: 60
exit: 0x0
frames shown: 1630 (PresentX 1630)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15916 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.

@Pipodi

Pipodi commented Nov 25, 2026

Copy link
Copy Markdown

@CowboyBingus heads-up: since main merged #1836 (80f4819), this PR's head 964f5ed no longer merges into main. git merge-tree shows two conflicts, both in crates/xcl/src/gpu/recomp/pso.rs:

Both need a decision on how the compact routing and #1836's deferral combine, so I haven't tried to resolve them. #1448 and #1692 are stacked on this PR, so I've put them back to draft until it's rebased, and I'll rebase them onto your new head then.

AI use: Claude Code with Claude Opus 5.5.

@Parakeet-Wheat

Copy link
Copy Markdown

A/B on a desktop 8 GB card, with this PR merged onto main 95ae589 (after #1321 and the direct-translator commits, before #1836). No conflicts there.

  • Setup: NVIDIA GeForce RTX 3070 8 GB (driver 610.88, 32-lane waves), Ryzen 5 5600X, 32 GB RAM, Windows 11 26300, Rust 1.95.0, DXC 1.8.2502, retail 1.0.2.1, release. XCL_NETWORK=0, XCL_RUN_SECONDS=420, XCL_COMPACT_CS unset. A pressed a few times at the start screen, no other input. Warm DXIL cache, this PR run first.
  • 56c0cd3b82a00c6e: with this PR it is routed to the compact form and comes out at 1,050,616 B of DXIL. Its driver build starts at 113 s, after waiting behind another ~1 MB build (94.9 s), and finishes in 41.9 s. On main it is 29,215,776 B and never finishes: not within 420 s here, and not within 904 s in an earlier run on this machine.
  • 15ec6daefb19a780 falls back (9975-word table (at most 8192)), as reported above. After that the title stops presenting. At 420 s a 13,823,000 B compute build (record 95cc13288a27a96e, started at 280 s) and a 1,064,140 B one are still in the driver.
  • Both runs: exit 0x0, 0 crashes, 0 device removals, 0 ERROR lines, 40 mesh pipelines refused (MS in the AS slot). Both stop presenting after the world load starts, so neither reaches the world.

Not tested: the test suite, the smoke pair, AMD, native wave64. AI-assisted (Claude Code, Claude Opus 5.5); run on my machine.

@Royalflamejlh

Copy link
Copy Markdown
Contributor

With #1448 merged in, record 95cc13288a27a96e takes the compact form, and its DXIL crashes vkd3d-proton's dxil-spirv in the recursion @vitor127wt, @St5sz2Jk and @0naku reported for it on #1269 (1, 2, 3). On XCL's side the cause is two back edges to the dispatch loop's head. Three lines in compact.rs give it one: dxil-spirv then no longer crashes, and in 1 title run with the change on an RTX 4060 Ti the pipeline was made in 149.5 s (vkd3d-proton with the dxil-spirv speed patches of #1269; unpatched, the conversion alone had not finished in 2,400 s).

Setup: RTX 4060 Ti 16 GB (NVIDIA 615.71.09), Ryzen 9 9950X3D, Fedora 44, Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b (dxil-spirv 34f0ff8 with its pull request 372), DXC 1.9.2609.5, retail 1.0.2.1, release, the first-run screens completed once, no story progress. Tree: main 4178e88 merged locally with #684 e56dbc3, #751 1a480bc, #850 a314f04, #906 29e21fb, #688 760f742, #1273 be8d052, this PR at f207df1, #1448 42b2f11 and #1321 69a892c. It is #1448 that makes this record compact (with this PR alone it falls back at the table limit).

Tested

title run 95cc13288a27a96e 56c0cd3b82a00c6e
the tree, 1110 s 2,846,904 B of DXIL. driver compile start at 523.0 s is its thread's last line; the thread is in the 8 thread dumps from 150 to 500 s and in none of the 11 after 940,156 B, 241.9 s
the tree + the three lines, 1060 s 2,846,124 B, made in 149.5 s; its thread is in all 18 dumps 940,132 B, 26.2 s
  • 1 run each. The second run differs in two more things: its vkd3d-proton has the dxil-spirv speed patches of [OFFICIAL] Looking for PRs with shaders optimization #1269, and both programs were built by the preload workers from 10.5 s, where a title thread built them in the first.
  • The first run's log has no line for the thread's end (Wine's messages were off); that it died in dxil-spirv is my reading of the dumps and of the native run.

Natively, no GPU: xcl shaders shaders.rpf --export-hlsl <dir> --record-hash 95cc13288a27a96e --split 1 from the tree, then DXC with -E main -T cs_6_6 -HV 2021 -O1, gives byte for byte the DXIL the first run cached. dxil-spirv's CLI, built from the same 34f0ff8, with the options vkd3d-proton passes:

DXIL back edges to the loop head dxil-spirv 34f0ff8 with the speed patches of #1269
as it is 2,846,904 B, 6,324 blocks 2 segfault in 1 s; its master 061225da too segfault
with the three lines 2,846,124 B, 6,322 blocks 1 no crash; not converted in 2,400 s (stopped there) 10.6 and 15.4 s

Read

The line is in compact.rs, which comes from #1315 (bd69c5d); it is the same at this PR's head 964f5ed (line 218) and, as compact.rs:269, at #1448's 57d7574:

    let _ = writeln!(body, "        if (xcl_nb <= xcl_b) {{ {LOOP_GUARD} }}");

At -O1, which XCL uses from 1 MB of HLSL, DXC leaves both sides of that if as branches to the loop head (@ClosetPie107 found that the recursion needs -O1, 5). dxil-spirv keeps one back edge per loop head and, in shaders with wave shuffles, analyses the CFG before it merges them (#1805; #1860 does the same repair for the direct backend). Without the branch there is one:

    // no branch here: a second back edge to the loop head crashes dxil-spirv (#1805)
    body.push_str("        bool xcl_back = xcl_nb <= xcl_b;\n        if (xcl_back && xcl_budget == 0u) break;\n        xcl_budget -= (uint)xcl_back;\n");

(LOOP_GUARD then leaves the file's use line.) The HLSL the changed tree exports for the record differs from the original in those three lines only.

The SPIR-V of this program fails spirv-val --target-env vulkan1.3 with or without the change ("Maximum Control Flow nesting depth exceeded"), as @0naku and @itsd-effex found (3, 4). Offline, 0naku's NVIDIA compiler went past 20 GB on it (RTX 4060 Ti 8 GB, 620.70.06); in the title run above, 615.71.09 built it in 149.5 s. I have not looked for what differs.

dxil-spirv's maintainer has since fixed the recursion on its branch legacy-struct-remove (e084e35c, not in its master yet): natively the unchanged DXIL above no longer crashes there (not converted in 900 s; 11.1 s with the speed patches of #1269 on top). So the three lines are a stopgap: they are not needed once a vkd3d-proton with that dxil-spirv is what people run.

Not tested: the title with the change on unpatched vkd3d-proton; #1448's current head 57d7574 and #1692's nested form (the same line, compact.rs:312 there); whether the changed loop gives the same results on a GPU (the 17 GPU tests were skipped here, and the title run did not compare output); Windows and AMD, where no dxil-spirv is involved.

AI use: Claude Code (Claude Fable 5.2) read the runs, made the native reproduction and the change, and wrote this comment.

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

Royalflamejlh added a commit to Royalflamejlh/xcl that referenced this pull request Nov 25, 2026
The two largest compute programs of a retail pack are 14,377 and 14,346
blocks of 602 and 576 kinds: one code many times, each copy lowered again.
A program of at least 20,000 instructions with under 30 % of them in its
distinct blocks (the HLSL compact form's thresholds) now takes a compact
form: each distinct block once, inside one loop that reads the block's
class and its two successors from constant tables and switches to the
class.
Registers are local variables across the loop; as SSA values each was a
phi with an edge from every class, and the form came out larger.

Two blocks are of one class when the lowering would emit the same for
both: the same instruction words, the same kind of end, and the same of
what it looks up by address (static samplers, whether a mask is read
whole in the split form, s_getpc_b64).

The tables are constant data the driver has to take, and xcl-dev#1316 measured
an RTX 5070 Ti accepting a table of 12,288 words and refusing one of
15,360, so a program takes the form by itself only when its two tables
are at most 8,192 words (the HLSL compact form's limit).

The largest compute programs of the pack, split wave64, direct DXIL:
4,321,608 -> 471,728 B and 4,293,632 -> 436,740 B for the two the rule
picks. The third largest (3,914,652 B) repeats itself too, but its
branches go to 6,530 different pairs of offsets and its tables would be
23,913 words: it keeps the plain form, and is 1,294,548 B when forced.
XCL_DIRECT_COMPACT=1 forces the form on every compute program and 0
turns it off.

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 two largest compute programs of a retail pack are about 14,000
blocks of about 600 kinds: one code many times, each copy lowered again,
4.3 MB of DXIL each. A program of at least 20,000 instructions with
under 30 % of them in its distinct blocks (the HLSL compact form's
thresholds) now takes a compact form: each distinct block once, inside
one loop that reads the block's class and its two successors from
constant tables and switches to the class. The two come out under
0.5 MB each.

Two blocks are of one class when the lowering would emit the same for
both: the same instruction words, the same kind of end, and the same of
what it looks up by address (static samplers, whether a mask written
there is read whole in the split form, s_getpc_b64).

Registers are local variables across the loop; as SSA values each was a
phi with an edge from every class, and the form came out larger than the
plain one for programs with little repetition.

The tables are constant data the driver has to take, and xcl-dev#1316 measured
an RTX 5070 Ti accepting a table of 12,288 words and refusing one of
15,360, so a program takes the form by itself only when its two tables
are at most 8,192 words together (the HLSL compact form's limit). The
third largest program repeats itself too, but its branches go to
thousands of different offsets and its tables would be about 24,000
words: it keeps the plain form.

XCL_DIRECT_COMPACT=1 forces the form on every compute program and 0
turns it off.

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 two largest compute programs of a retail pack are about 14,000
blocks of about 600 kinds: one code many times, each copy lowered again,
4.3 MB of DXIL each. A program of at least 20,000 instructions with
under 30 % of them in its distinct blocks (the HLSL compact form's
thresholds) now takes a compact form: each distinct block once, inside
one loop that reads the block's class and its two successors from
constant tables and switches to the class. The two come out under
0.5 MB each.

Two blocks are of one class when the lowering would emit the same for
both: the same instruction words, the same kind of end, and the same of
what it looks up by address (static samplers, whether a mask written
there is read whole in the split form, s_getpc_b64).

Registers are local variables across the loop; as SSA values each was a
phi with an edge from every class, and the form came out larger than the
plain one for programs with little repetition.

The tables are constant data the driver has to take, and xcl-dev#1316 measured
an RTX 5070 Ti accepting a table of 12,288 words and refusing one of
15,360, so a program takes the form by itself only when its two tables
are at most 8,192 words together (the HLSL compact form's limit). The
third largest program repeats itself too, but its branches go to
thousands of different offsets and its tables would be about 24,000
words: it keeps the plain form.

XCL_DIRECT_COMPACT=1 forces the form on every compute program and 0
turns it off.

Part of xcl-dev#1269.

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

Copy link
Copy Markdown

Test report for the table cap on RTX 5090 (driver 32.0.16.1714), main 689f2db + this PR (964f5ed):

ActivateRays (95cc13288a27a96e, 9,975-word table) builds in the compact form when MAX_TABLE_WORDS is raised to 10,240 (local change): DXC 797.6 s, driver 1,109.9 s (896.2 s with XCL_HEAP_WINDOWS=1), DXIL 10.66 MB, ~2 GB peak — vs 8,586 s (2 h 23 min) for the normal form on the same machine. Details and the full table in #1269.

Not tested: correctness of the compact ActivateRays against the normal form. AI use: Claude Code (Claude Opus 5.5).

Royalflamejlh added a commit to Royalflamejlh/xcl that referenced this pull request Nov 25, 2026
The two largest compute programs of a retail pack are about 14,000
blocks of about 600 kinds: one code many times, each copy lowered again,
4.3 MB of DXIL each. A program of at least 20,000 instructions with
under 30 % of them in its distinct blocks (the HLSL compact form's
thresholds) now takes a compact form: each distinct block once, inside
one loop that reads the block's class and its two successors from
constant tables and switches to the class. The two come out under
0.5 MB each.

Two blocks are of one class when the lowering would emit the same for
both: the same instruction words, the same kind of end, and the same of
what it looks up by address (static samplers, whether a mask written
there is read whole in the split form, s_getpc_b64).

Registers are local variables across the loop; as SSA values each was a
phi with an edge from every class, and the form came out larger than the
plain one for programs with little repetition.

The tables are constant data the driver has to take, and xcl-dev#1316 measured
an RTX 5070 Ti accepting a table of 12,288 words and refusing one of
15,360, so a program takes the form by itself only when its two tables
are at most 8,192 words together (the HLSL compact form's limit). The
third largest program repeats itself too, but its branches go to
thousands of different offsets and its tables would be about 24,000
words: it keeps the plain form.

XCL_DIRECT_COMPACT=1 forces the form on every compute program and 0
turns it off.

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 two largest compute programs of a retail pack are about 14,000
blocks of about 600 kinds: one code many times, each copy lowered again,
4.3 MB of DXIL each. A program of at least 20,000 instructions with
under 30 % of them in its distinct blocks (the HLSL compact form's
thresholds) now takes a compact form: each distinct block once, inside
one loop that reads the block's class and its two successors from
constant tables and switches to the class. The two come out under
0.5 MB each.

Two blocks are of one class when the lowering would emit the same for
both: the same instruction words, the same kind of end, and the same of
what it looks up by address (static samplers, whether a mask written
there is read whole in the split form, s_getpc_b64).

Registers are local variables across the loop; as SSA values each was a
phi with an edge from every class, and the form came out larger than the
plain one for programs with little repetition.

The tables are constant data the driver has to take, and xcl-dev#1316 measured
an RTX 5070 Ti accepting a table of 12,288 words and refusing one of
15,360, so a program takes the form by itself only when its two tables
are at most 8,192 words together (the HLSL compact form's limit). The
third largest program repeats itself too, but its branches go to
thousands of different offsets and its tables would be about 24,000
words: it keeps the plain form.

XCL_DIRECT_COMPACT=1 forces the form on every compute program and 0
turns it off.

Part of xcl-dev#1269.

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

@gsucristo gsucristo 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.

Reviewed the top commit (964f5ed9) — clean routing, _c.bin cache isolation, and thorough unit tests for XCL_COMPACT_CS.

A couple of points to consider:

  1. Redundant compact_wanted scans on cache misses (crates/xcl/src/gpu/recomp/pso.rs & mod.rs): In Auto mode on a cache miss, compact_form(blob) / cs.takes(code) decodes and scans the full compute program up to 3 times (once in console_to_dxil_in to choose the _c.bin path, once in compile_console_shader for goes_direct, and once in translate_as). Passing the already-computed bool down would avoid re-decoding 88k-instruction shaders on misses.
  2. XCL_DIRECT_DXIL precedence (pso.rs, goes_direct): Now that #2034 implements the compact form natively in Direct DXIL (0.48 MB DXIL with no DXC compile), routing XCL_DIRECT_DXIL=1 compute shaders to the HLSL+DXC compact path first may no longer be desirable once #2034 lands.
  3. Tiny formatting nit (crates/xcl/src/gpu/recomp/mod.rs): Missing space in let compact =compact::translate_compact(&code, &opt).unwrap(); in only_compute_goes_to_the_compact_backend.

(AI disclosure: review drafted with Antigravity — exact model name not provided to the agent — and checked by the reviewer before posting.)

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>
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.