Skip to content

Recompiler: oversized structured code falls back to pc blocks (#1307) - #1321

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
tiagonogueiraa-bit:structured-size-bound
Nov 24, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
tiagonogueiraa-bit:structured-size-bound

Conversation

@tiagonogueiraa-bit

@tiagonogueiraa-bit tiagonogueiraa-bit commented Nov 24, 2026 •

Copy link
Copy Markdown

Since b8b1f49, one compute program of the retail pack comes out as 148 MB of HLSL (334 KB of code), against 14 MB as pc blocks before. The structured form's guards each list every pending skip flag and reopen whenever the set changes, so they grow with the square of the flags: this program has 3 861 flags, guards of up to 597 terms, and 99 MB in guard lines. DXC on that fits #1307's commit growing about 1 GB/s with b8b1f49 and not without it. Fixes #1307 and #1332 (record 22619 of the pack, the same program), pending a run that confirms the title's memory.

Structured code longer than 128 bytes per byte of program is now translated as pc blocks.

What is in it

  • crates/xcl/src/gpu/recomp/mod.rs: STRUCTURED_BYTES_PER_CODE_BYTE. In translate, structured code past it goes through translate again with structured: false.
  • crates/xcl/src/gpu/recomp/tests.rs: oversized_structured_code_falls_back_to_pc_blocks (CPU only). 200 conditional forward jumps whose targets all follow them, in order, cross the bound; 50 do not.

Tested

  • Head 69a892c is 0936337 rebased onto main c160d86. The conflict with Recompiler: memory windows from the descriptor heap (no per-access switch) #680's HEAP_WINDOWS normalization at the top of translate is resolved by keeping both, as @emirduran707 also did. 0936337 itself changed only tests.rs against 156b0de (review). The runs below were made on 156b0de / 0936337.
  • Every program of the retail pack's shaders.rpf, translated on the CPU with gpu::recomp built on its own (macOS) from main, from main with b8b1f49 reverted, and from this branch:
HLSL total programs as pc blocks largest
main 5108 MB 169 152.0 MB
b8b1f49 reverted 4707 MB 1670 29.6 MB
this PR 4970 MB 170 29.6 MB

Only one program changes against main: CS_ScreenProbes_ActivateRays in indirect_diffuse_lighting, 148.5 MB → 13.8 MB. The next largest structured program is at 61 bytes per byte.

Regression run
The PR block on this head 69a892c is by @CuteBooty (RTX 3070, 32 GB, scripts/smoke.ps1 -Seconds 60, no input, the title left at its start screen), unedited, from the report. The main block is @IvyNotFound's (RTX 5080, XCL_PRESS_A_AT=15), from their report. They are from two machines, so this pair shows only that the PR's run ended by itself with no device removal or crash; its frames and commit are not a comparison with main. A pair from one machine is still welcome.

main:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: NVIDIA GeForce RTX 5080
title: game
seconds: 60
exit: 0x0
frames shown: 1273 (PresentX 1273)
presents per 2 s (last 3): 11 6 14
device removals: 0
crashes: 0
peak commit: 26663 MB

PR, this head (@CuteBooty):

xcl-smoke v1
commit: 69a892c16e555c405737fd8c502c578967ce67f1
gpu: NVIDIA GeForce RTX 3070
title: game
seconds: 60
exit: 0x0
frames shown: 1503 (PresentX 1504)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 19638 MB

PR, earlier head 156b0de (@IvyNotFound, same machine as the main block above):

xcl-smoke v1
commit: 156b0de6de0dc303141e9d1906bdb4efb1ab8290
gpu: NVIDIA GeForce RTX 5080
title: game
seconds: 60
exit: 0x0
frames shown: 1297 (PresentX 1297)
presents per 2 s (last 3): 12 32 25
device removals: 0
crashes: 0
peak commit: 27707 MB

@CuteBooty's process commit levelled off at 17.7–17.9 GB by 36 s in both runs on 69a892c, where main b7aa9f3 with a local change passed 30 GB by 34–36 s; base and input differ between those sides.

In @IvyNotFound's report, two 140 s world-load runs of this head had no device removal and exited normally, like main. Their GPU queue.Wait timeouts were 63 and 133, against 19 for main. On that machine the count varies from 13 to 55 between runs of other builds, so the report does not attribute it to this change, and neither do I.

Not tested

  • The NVIDIA driver on the pc-block form's DXIL: @einfachama's 8 GB card had not finished it after more than 4 minutes.
  • A one-machine xcl-smoke pair on this head.
  • The driver's PSO creation for the retail program.

AI use

  • Claude Code with Claude Opus 5.5. It built the CPU-side survey, found the program and the cause, and wrote the change, the test and this description.

🤖 Generated with Claude Code

@fromthemoonx

Copy link
Copy Markdown

Windows run, since Tested says the suite was not run on Windows and Not tested lists any GPU.

Tested

  • NVIDIA GeForce RTX 3060 12 GB (32-lane waves, so wave64 runs split), driver 32.0.16.1088; AMD Ryzen 7 5700X; native Windows 11 Pro 26H2 (build 26300.9974), Graphics Tools (D3D12 debug layer) installed; rustc 1.100.0 stable-x86_64-pc-windows-msvc; DXC 1.9.2602.17; debug

  • Exact head 156b0de6de0dc303141e9d1906bdb4efb1ab8290, which is on current main 930e8b4 (so also the merged result): cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.

  • Fails without the fallback: with the STRUCTURED_BYTES_PER_CODE_BYTE check in translate disabled, oversized_structured_code_falls_back_to_pc_blocks fails with 200 crossing jumps: past the bound, pc blocks. 10 runs with it: 10 of 10 passed.

  • Both forms on the GPU (a scratch test, not pushed): I took your test's programs and changed each v_add to add 1, so v1 counts the adds that ran. Each program went through DXC and ran on this GPU through runner::run_code in kernel mode. s0 was set so the first taken branch is the 1st, 17th, 49th, 161st or 193rd, or none.

    • 50 jumps, structured: v1 matches a CPU model in all 64 lanes for all six starts.
    • 200 jumps, now as pc blocks: the same, in all 64 lanes.

    So the fallback form compiles and gives the same results as the structured one at this size. It says nothing about DXC or the driver on the retail 13.8 MB program.

  • e2e + gpu_pso_e2e, 3 runs: 3 of 3 passed

  • D3D12 debug layer: the e2e test title logs the same debug-layer error and warning ids as on main 930e8b4.

Not tested

AI use

  • Claude Code (Claude Opus 5.5) ran the build, the tests, the check without the fallback and the scratch GPU test on the machine above, and wrote this report from the output.

@dervoxx

dervoxx commented Nov 24, 2026

Copy link
Copy Markdown

Windows A/B on the retail compute shader from #1307. Both release builds used Rust 1.100.0 on Windows 11 build 26300 with a Ryzen 9 9900X3D. I generated HLSL with four memory windows in wave32, then ran Windows SDK DXC 1.8.2502.11 in a fresh process for each input with -T cs_6_6 -E main -HV 2021 -O0 and a hard 6 GiB process commit cap.

Revision HLSL bytes DXC wall / CPU Peak process commit Result
Parent 930e8b49c1c2ec683d22c724a398b39111cd0e56 154,575,599 14.343 / 14.297 s 6,442,442,752 B Out of memory at the cap, no DXIL
Head 156b0de6de0dc303141e9d1906bdb4efb1ab8290 15,359,988 67.734 / 67.484 s 2,802,188,288 B Success, 14,105,384 B of DXIL

Both builds completed HLSL translation. This run covered one shader through DXC. Driver PSO creation and title execution were outside its scope.

Codex (GPT-6 family) ran the experiment and drafted this report.

@tiagonogueiraa-bit
tiagonogueiraa-bit marked this pull request as ready for review November 24, 2026 14:56
@tiagonogueiraa-bit

Copy link
Copy Markdown
Author

Thank you both, @fromthemoonx and @dervoxx: that covers the suite on the exact head, the test failing without the bound, and DXC on the retail program itself. I added both to Tested, with links, and marked the PR ready for review.

Written with Claude Code (Claude Opus 5.5).

@IvyNotFound

Copy link
Copy Markdown

Regression runs on Windows for 156b0de (the description has none). Retail title, RTX 5080 (32-lane waves), plus two world-load runs.

Tested

  • NVIDIA GeForce RTX 5080 16 GB, driver 621.24; Ryzen 7 7800X3D; Windows 11 25H2 (26200.9974); rustc 1.100.0 MSVC; DXC 1.9.2602.17; release. The PR head as is (base 930e8b4), clean tree.
  • scripts/smoke.ps1 -Seconds 60, XCL_PRESS_A_AT=15, unedited, for Regression run if you want them. The main block is from 930e8b4 on the same machine.

main:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: NVIDIA GeForce RTX 5080
title: game
seconds: 60
exit: 0x0
frames shown: 1273 (PresentX 1273)
presents per 2 s (last 3): 11 6 14
device removals: 0
crashes: 0
peak commit: 26663 MB

this PR:

xcl-smoke v1
commit: 156b0de6de0dc303141e9d1906bdb4efb1ab8290
gpu: NVIDIA GeForce RTX 5080
title: game
seconds: 60
exit: 0x0
frames shown: 1297 (PresentX 1297)
presents per 2 s (last 3): 12 32 25
device removals: 0
crashes: 0
peak commit: 27707 MB
  • Two 140 s runs into world loading (XCL_PSO_WAIT_MS=50), against one of main 930e8b4 with the same settings:
main PR, run 1 PR, run 2
exit / device removals 0x0 / 0 0x0 / 0 0x0 / 0
frames shown 1434 1375 1395
peak commit 33 004 MB 34 718 MB 36 397 MB
compute PSOs built without a driver blob / driver time 187 / 288.9 s 202 / 0.1 s 211 / 79.6 s
GPU queue.Wait timeouts (#505) 19 63 133

The driver times depend on which blobs earlier runs left, not on this PR: run 1 had nearly everything cached. The timeout counts vary a lot between runs of one build on this title: 13–55 on other builds here. I can't tell from these runs whether this PR's one changed program (ActivateRays) was reached: I have no name-to-hash mapping for it on this side.

Not tested

  • the suite at this head (@fromthemoonx ran it)
  • the driver's PSO creation for the changed program on its own

AI use

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

@tiagonogueiraa-bit

Copy link
Copy Markdown
Author

Thank you, @IvyNotFound! I put both xcl-smoke blocks under Regression run exactly as posted, with credit. I also mentioned the world-load runs, with the queue.Wait timeout counts and your note that they vary between runs.

Written with Claude Code (Claude Opus 5.5).

@Rednaxeh

Copy link
Copy Markdown
Contributor

Regression run on RDNA3, since the PR has none: main 930e8b4 against this PR's head 156b0de checked out on it (fast-forward, so the second block names the head itself), same retail title, same 60 s, same input (A at ~13 s), same warm caches. Written with Claude Code (Claude Fable 5.1); the runs are mine.

Tested

  • AMD Radeon RX 7800 XT 16 GB (driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 26300, Rust 1.100.0 stable-x86_64-pc-windows-msvc, DXC 1.9.2602.17 (Windows SDK), release for the runs, debug for the tests
  • XCL_REQUIRE_GPU=wave64,mesh cargo test --workspace -- --test-threads=4 on 156b0de: 752 passed, 0 failed, 41 ignored, no SKIPPED (oversized_structured_code_falls_back_to_pc_blocks among them)

Regression run

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: AMD  Radeon RX 7800 XT
title: retail-game6
seconds: 60
exit: 0x0
frames shown: 1310 (PresentX 1310)
presents per 2 s (last 3): 3 2 8
device removals: 0
crashes: 0
peak commit: 24085 MB
xcl-smoke v1
commit: 156b0de6de0dc303141e9d1906bdb4efb1ab8290
gpu: AMD  Radeon RX 7800 XT
title: retail-game6
seconds: 60
exit: 0x0
frames shown: 1244 (PresentX 1244)
presents per 2 s (last 3): 6 2 3
device removals: 0
crashes: 0
peak commit: 24299 MB

Frames 95 % of main, peak commit +0.9 %; both runs end normally at 60 s during the world-loading screens, with the process at 24.1 / 24.3 GB committed and 11.7 / 12.1 GB of local video memory.

Not tested

@tiagonogueiraa-bit

Copy link
Copy Markdown
Author

Thank you, @Rednaxeh: a second GPU vendor for the suite and the smoke pair. Added to Tested, with your note that 60 s may not reach the changed program.

Written with Claude Code (Claude Opus 5.5).

@DavidM1911

Copy link
Copy Markdown
Contributor

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

  • cargo test -p xcl --lib -- --test-threads=1: 708 passed, 0 failed, 21 ignored. (Parallel runs intermittently abort with 0xc0000005 — same harness flake seen on unmodified main.)

Thanks!

@tiagonogueiraa-bit

Copy link
Copy Markdown
Author

Thanks, @DavidM1911, a third data point for the lib tests on this branch.

Written with Claude Code (Claude Opus 5.5).

@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 156b0de (merge base 930e8b4, current main), by reading the code; nothing was built or run here. No defect found in the fallback itself: it is a fresh translate with only structured changed, and cached translations from main are not reused.

  1. CONFIRMED: the test shows the switch to the pc form, not that the pc form is smaller. With structured: false, emit_range still emits the longest single-entry stretch through emit_structured (mod.rs:1084-1107, 1124-1126). In the 200-jump program that stretch is [0, last target), so the fallback is if (pc == 0u) { <the same guards> } plus one block, and contains("pc ==") (tests.rs:7482) holds because of the wrapper. This is how main already behaves and does not affect the retail program, which the reports here and in #1307 show fixed. Suggested: say in the test's comment that it checks the switch only, or use a program whose jumps are split across stretches. While there: the new test sits between jumps_to_outer_loop_heads_are_structured and its doc comment (tests.rs:7456-7463).

Question: #1345 makes these guards constant-size (if (xcl_skip == 0u)). On a tree with both, does the 200-jump program still cross the bound? If not, this test's second assertion fails without a merge conflict to warn of it.

Verdict: fine to merge as far as I read; the test comment and the #1345 interaction are worth a look.

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.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
ivall#1379

Integrate 22 open upstream PRs targeting world rendering, shader correctness, DirectStorage terrain loads, and crash/memory stability:
- ivall#1321 (ivall#1307): fall back to pc blocks when structured CFG HLSL grows oversized (eliminates the 148 MB HLSL / 1 GB/s commit explosion from b8b1f49 so XCL_PSO_PRELOAD=1 stays flat at ~5.4 GiB)
- ivall#549, ivall#1312: DirectStorage late page-array queue hold (fixes 0x89240009 terrain read failures) and 0-byte memory-source requests
- ivall#1365 (ivall#1361): GFX10.30 scratch SADDR 0x7F addresses the immediate offset alone instead of adding v0
- ivall#1368: translated compute PSOs use NodeMask 0
- ivall#1371 (ivall#105): deduplicate packed ISG1 vertex input struct fields
- ivall#1375 (ivall#1360): ES s_setpc_b64 ends block before gs_start
- ivall#1350, ivall#1351, ivall#1352, ivall#1353, ivall#1349: VS layer/viewport outputs, PS sample index/fixed-point position & SV_Coverage, depth+UAV initial states, console SetPredication
- ivall#1305, ivall#1306, ivall#1314, ivall#1319, ivall#1322, ivall#1334, ivall#1339, ivall#1355, ivall#1357, ivall#1379: console_list UMA hold on Release, v_cmp_class_f32 bitwise abs/neg, late_release vram queue wait, root arg clamping, empty BVH / NaN rays, NULL IASetIndexBuffer clearing, MSAA MipLevels=1, VFS lazy-page commits, coherent VirtualFree validation, cpu_writes PAGE_GUARD & stale fence wakeups
- README.md: document the integrated PRs, XCL_PSO_PRELOAD=1, and 16 GiB cap

Verified on RX 9060 XT / GE-Proton11-14: release build clean, targeted unit tests pass (75 passed, 0 failed), and 80 s run with XCL_PSO_PRELOAD=1 and XCL_MEM_LIMIT=12G stays flat at 5340-5413 MB with 512+ pipelines preloaded (1385 frames, exit 0x0).

Assisted-by: Antigravity (Google DeepMind)
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
ivall#1379

Integrate 22 open upstream PRs targeting world rendering, shader correctness, DirectStorage terrain loads, and crash/memory stability:
- ivall#1321 (ivall#1307): fall back to pc blocks when structured CFG HLSL grows oversized (eliminates the 148 MB HLSL / 1 GB/s commit explosion from b8b1f49 so XCL_PSO_PRELOAD=1 stays flat at ~5.4 GiB)
- ivall#549, ivall#1312: DirectStorage late page-array queue hold (fixes 0x89240009 terrain read failures) and 0-byte memory-source requests
- ivall#1365 (ivall#1361): GFX10.30 scratch SADDR 0x7F addresses the immediate offset alone instead of adding v0
- ivall#1368: translated compute PSOs use NodeMask 0
- ivall#1371 (ivall#105): deduplicate packed ISG1 vertex input struct fields
- ivall#1375 (ivall#1360): ES s_setpc_b64 ends block before gs_start
- ivall#1350, ivall#1351, ivall#1352, ivall#1353, ivall#1349: VS layer/viewport outputs, PS sample index/fixed-point position & SV_Coverage, depth+UAV initial states, console SetPredication
- ivall#1305, ivall#1306, ivall#1314, ivall#1319, ivall#1322, ivall#1334, ivall#1339, ivall#1355, ivall#1357, ivall#1379: console_list UMA hold on Release, v_cmp_class_f32 bitwise abs/neg, late_release vram queue wait, root arg clamping, empty BVH / NaN rays, NULL IASetIndexBuffer clearing, MSAA MipLevels=1, VFS lazy-page commits, coherent VirtualFree validation, cpu_writes PAGE_GUARD & stale fence wakeups
- README.md: document the integrated PRs, XCL_PSO_PRELOAD=1, and 16 GiB cap

Verified on RX 9060 XT / GE-Proton11-14: release build clean, targeted unit tests pass (75 passed, 0 failed), and 80 s run with XCL_PSO_PRELOAD=1 and XCL_MEM_LIMIT=12G stays flat at 5340-5413 MB with 512+ pipelines preloaded (1385 frames, exit 0x0).

Assisted-by: Antigravity (Google DeepMind)
@tiagonogueiraa-bit

Copy link
Copy Markdown
Author

Thanks for the careful read, @pvfreis. Both points were right.

  1. The test checks the switch, not the size. Its doc comment now says so: for this synthetic program the pc form keeps the same stretch under one guard and is no smaller, and the gain shows on the retail program, whose pc form is split into blocks (148 MB → 14 MB). The test also no longer sits between jumps_to_outer_loop_heads_are_structured and its doc comment. Both changes are in 0936337, which touches only tests.rs.
  2. Recompiler: one skip variable for all forward jumps of structured code #1345 removes the quadratic growth at its source (it was opened after this PR). The two fit together: Recompiler: one skip variable for all forward jumps of structured code #1345 makes the guards linear, and this bound stays a cap for any other structured blow-up. If Recompiler: one skip variable for all forward jumps of structured code #1345 merges first, this test's 200-jump case will no longer cross the bound, as you say. I'll rebase then and give the test a program that still does, or drop the bound if the maintainer prefers Recompiler: one skip variable for all forward jumps of structured code #1345 alone.

@IvyNotFound, @Rednaxeh: the force-push moved the head to 0936337 (tests only, runtime code identical), so PR checks wants the PR's xcl-smoke block on that commit. If either of you can rerun the PR side, I'll put it in.

Written with Claude Code (Claude Opus 5.5).

@Royalflamejlh

Copy link
Copy Markdown
Contributor

The run this asks for: with 156b0de merged the retail title's process no longer runs out of memory in its first minute on Linux / Wine (3 of 3 runs), where the same setup on b8b1f49 was killed for memory at 24–71 s (4 of 4). I ran 156b0de; the head 0936337 differs from it in tests.rs only.

Tested

Setup: Fedora 44 (kernel 7.2.9), 62 GB RAM, Ryzen 9 9950X3D, RTX 4060 Ti 16 GB (driver 615.71.09), Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b, DXC 1.9.2609.5, release, x86_64-pc-windows-gnu. Title 1.0.2.1 from a saved profile, one A press through XCL_PRESS_AT, pipeline preload on (the default), XCL_PSO_WAIT_MS=50. used-pipelines.txt holds 1260 shader sets, the program of #1332 among them. Each run is in a cgroup with a memory limit, 34 GB unless said.

tree runs first minute then
b8b1f49 + #684 #751 #1045 #850 #851 #906 #688 4 killed for memory at 56, 71 and 61 s (no limit: the kernel's OOM killer, the process at 45.0, 50.4 and 47.6 GB) and at 24 s (30 GB limit). The preload had made 333–337 compute pipelines by 30 s –
930e8b4 + #684 #751 #850 #906 #688 + 156b0de 3 all 3 past it; 341 compute pipelines built ahead by 62 s see below

After the first minute, on the tree with this pull request: 2 runs reached the world's pipelines at 92–94 s and were ended at the 34 GB limit at 110.3 and 113.8 s; a third with XCL_DXC_THREADS=4 stayed under it and ended at the title's watchdog (game+0x23cf683) at 152.6 s, the stall of #505. That later growth is not from this change: the first tree with b8b1f49 reverted reached the same limit at 130.8 s (1 run).

The two trees differ by more than this pull request (main moved from b8b1f49 to 930e8b4, #851 and #1045 no longer merge, #751 and #688 have new heads).

The offline pass on 156b0de alone (xcl shaders shaders.rpf --precompile --only cs, 2 DXC threads, 30 GB limit; --limit 22619 is already on #1332): --limit 23000 finished in 527 s, 843 compiled, 0 errors, and the process's resident memory, sampled every 2 s, peaked at 2.6 GB. On 930e8b4 without it, --limit 22619 was killed at the limit after 34 s.

Read

recomp/mod.rs only. The bound is checked after emit_structured has written the whole structured text, so the oversized form is still built once (148 MB for this program) before translate runs again with structured: false. That is the cost the description gives (about 1.5 s), and the second call cannot come back to the check. I found nothing in the ten lines that does more than the description says.

Not tested: the cargo test suite and the new test; the head 0936337; native Windows; AMD; the title without the other pull requests listed.

AI use: Claude Code (Claude Fable 5.2) merged the trees, ran the title and the offline pass, read the diff and drafted this comment.

@pvfreis

pvfreis commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Thanks. Checked at 0936337 (read only): the test's doc comment now says it checks the switch only, and jumps_to_outer_loop_heads_are_structured has its doc comment back. Understood on #1345.

Reply by Claude Code (Claude Opus 5.5); checked by a person before posting.

@tiagonogueiraa-bit

Copy link
Copy Markdown
Author

Thank you, @Royalflamejlh: the title's first minute and the offline pass are exactly the check #1307 / #1332 needed. It's in Tested, with your note that the later growth also shows with b8b1f49 reverted. And thanks, @pvfreis, for checking the fixes.

Written with Claude Code (Claude Opus 5.5).

@WillyboPeep

WillyboPeep commented Nov 24, 2026 •

Copy link
Copy Markdown

Test report: 0936337 on an RTX 4090 (Windows). With it, the host's commit levels off at about 18 GB when the title is left at its start screen; without it, it grows about 2 GB a second until my guard ended the run at 70 GB. Counts only.

Setup: NVIDIA GeForce RTX 4090 (driver 621.01, 32-lane waves), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro 26300, Rust 1.98.1 MSVC, release, DXC 1.9.2602.17. Retail 1.0.2.1. Tree: main 930e8b4 + this PR (0936337, a fast-forward), nothing else. XCL_NETWORK=0, XCL_RUN_SECONDS=60, no input, page file grown beforehand, the run killed at 70 GB of process commit. Commit from XCL's own memory: … MB committed by the process lines.

s main 930e8b4 b8b1f49 main + this PR
10 13.2 GB 13.6 GB 13.5 GB
20 30.4 GB 30.9 GB 14.0 GB
30 51.1 GB 53.2 GB 18.4 GB
40 68.3 GB 71.5 GB 18.3 GB
50 killed at 72.4 GB (50 s) killed at 72.3 GB (47 s) 18.6 GB
end killed killed exit after 60 s, as asked
  • Video memory stayed at 6 – 8 GB in the growing runs, so the growth is host memory, as in the report above.
  • On 930e8b4 it needed the title left at its start screen here (not on today's main: see the update at the end). The same main 930e8b4 (plus two script/README-only PRs) with A pressed every 4 s from 15 s had 18.0 GB at 60 s and 30.4 GB at 110 s, and reached the world load. That may be why @CuteBooty's run with input by hand did not show it.
  • cargo test --release -p xcl --lib recomp -- --test-threads=4 on this tree: 190 passed, 0 failed, 18 ignored.

Not tested: the full suite on this head, a world-load run with this PR, AMD.

AI use: Claude Code (Claude Opus 5.5) ran the builds and runs on my PC and wrote this report; I checked it.

Update, today's main: 9e3831e + three approved VFS / script PRs (#1170, #1092, #1229), same machine, A pressed every 4 s from 15 s. The growth shows with input now too: 13.2 GB at 10 s, 24.9 GB at 20 s, 51.0 GB at 30 s, and my guard ended the run at 45 s (60.9 GB, 0.9 GB of commit left). So "it needs the title left at its start screen" above held for 930e8b4 here, not for 9e3831e. The same build with XCL_HEAP_WINDOWS=1 (#680) stayed at or under 30.4 GB until the title's watchdog at 121 s. One run each; I have not looked into which program the growing run was building.

Update 2, the pipeline preload: main 9039900 + #1170 + #1229, XCL_HEAP_WINDOWS=1, the compute programs of used-pipelines.txt warmed into the driver cache beforehand (the three screen-probe programs left out), A every 4 s from 15 s, one run each:

preload on (default) XCL_PSO_PRELOAD=0
commit at 20 / 40 s 17.1 / 54.2 GB 11.7 / 15.9 GB
end my guard at 52 s (63.5 GB) +0x23cf683 at 106.9 s, commit at most 31.1 GB
compute pipelines from a kept blob 575 of 604 461 of 486

With a cold cache (run above, XCL_HEAP_WINDOWS=1, preload on) the growth did not show either. So here it comes from what the preload builds once the rest is in the cache, which fits #1307's program being in used-pipelines.txt; I did not check which program it was. In the preload-off run the render thread waited from about 77 s in execute_indirect → resolve_wait, with one xcl-pso worker in nvgpucomp64.dll at 100 s.

@tiagonogueiraa-bit

Copy link
Copy Markdown
Author

Thank you, @WillyboPeep: native Windows on the current head, with main and b8b1f49 side by side, is the clearest picture of #1307 so far. It's in Tested, including your note that it shows when the title is left at its start screen.

Written with Claude Code (Claude Opus 5.5).

@rntzaj

rntzaj commented Nov 24, 2026

Copy link
Copy Markdown

The full suite on 0936337, which the last report lists as not tested, and a smoke pair from a smaller machine (8 GB Ampere, 32 GB RAM). The pair agrees with @WillyboPeep's: with this PR the commit levels off, and without it the commit keeps climbing.

Tested

  • NVIDIA GeForce RTX 3070 Ti 8 GB (32-lane waves, so wave64 runs split), driver 32.0.16.2101; Intel Core i9-13900KF; 32 GB RAM; Windows 11 Home 25H2 (build 26200.9974); rustc 1.100.0 stable-x86_64-pc-windows-msvc; DXC 1.8.2502.11 (Windows SDK 10.0.26100); debug for the tests, release for the runs
  • Exact head 0936337142a114668e29652163a62c6d255ff5d3, on current main 930e8b4 (a fast-forward), clean tree: cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4 with XCL_SAMPLE_RPF, XCL_SAMPLE_DLLS and XCL_SAMPLE_BVH4 set: 752 passed, 0 failed, 41 ignored (oversized_structured_code_falls_back_to_pc_blocks among them). SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • Commit from XCL's memory: … MB committed by the process lines in the two runs below:
s main 930e8b4 this PR
20 18.6 GB 10.5 GB
30 37.6 GB 10.9 GB
40 57.4 GB 12.1 GB
50 72.4 GB 12.3 GB
peak 87.5 GB 16.3 GB

On main the commit grows by about 1.7 GB/s from 20 s on and passes this machine's 32 GB of RAM before 30 s. The run still ended normally at 60 s.

Regression run

scripts/smoke.ps1 -Seconds 60, unedited, back to back on the same machine, with warm caches, the preload on (used-pipelines.txt from earlier world-load runs) and no input: the title stays at its start screen.

main:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: NVIDIA GeForce RTX 3070 Ti
title: game
seconds: 60
exit: 0x0
frames shown: 1534 (PresentX 1535)
presents per 2 s (last 3): 57 58 48
device removals: 0
crashes: 0
peak commit: 87546 MB

this PR:

xcl-smoke v1
commit: 0936337142a114668e29652163a62c6d255ff5d3
gpu: NVIDIA GeForce RTX 3070 Ti
title: game
seconds: 60
exit: 0x0
frames shown: 1571 (PresentX 1571)
presents per 2 s (last 3): 60 59 21
device removals: 0
crashes: 0
peak commit: 16333 MB

Frames 102 % of main, peak commit 81 % lower.

Not tested

  • The world load with this PR, and whether the pc form of ActivateRays gives the right picture in the title.
  • AMD, and GPUs with 64-lane waves.

AI use

  • Claude Code (Claude Opus 5.5) ran the build, the tests and the smoke runs on the machine above and wrote this report from the output. Codex (gpt-6.2-astra) did a read-only review of the diff.

@isaacwingate

Copy link
Copy Markdown

Follow-up to my report above: the same title on the same machine, main without this PR against the merged tree with it. Same settings for both: XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_PSO_WAIT_MS=50, A through XCL_PRESS_AT every 4 s from 20 s, back to back.

tree what happened peak commit
main 4178e88 + #1798 commit rose 33.9 → 36.9 → 39.9 → 43.2 → 46.6 GB in 8 s while the title was still in its menus (22 – 30 fps), then memory allocation of 2073600 bytes failed and the process ended (0xc0000409) at 39 s, before the world load 46.6 GB
4178e88 + #1316 + this PR + #889 + #1798 no such growth: menus, then the world load from 74 s; ended at 129 s by the title's watchdog (+0x2215c35) while it waited on shader builds 36.2 GB

An earlier 600 s run of the second tree (no XCL_PSO_WAIT_MS) also stayed at 36.0 GB to the end.

Machine: NVIDIA GeForce RTX 5080, driver 32.0.16.2124, i9-12900K, 32 GB RAM, 48 GB commit limit, Windows 11 build 26300, release builds.

AI use

  • Claude Code (Claude Opus 5.5) ran both trees, read the logs and wrote this; the numbers come from those runs.

wondercrash added a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
Conflicts:
- build.rs: upstream's per-lane source hash kept; integ's second copy of the
  /HIGHENTROPYVA:NO link argument dropped (upstream's xcl-dev#631 copy at the top of
  main() stays).
- gpu/recomp/mod.rs: integ's loop budget kept next to upstream's xcl-dev#1321
  fallback, then xcl-dev#1321 left out: integ's one skip variable (c70c9f0)
  removes the quadratic guards it bounds. With it, no retail program comes
  near 128 B per byte (95cc13288a27a96e: 18.9 MB structured), and the bound
  would only move memory-dense programs (S_BUFFER_LOAD / BUFFER_LOAD runs at
  4 windows: 250-300 B per byte, structured no larger than the pc form) to
  the pc form. Its test is left out with it; c70c9f0's
  crossing_forward_jumps_keep_the_guards_short covers that layout.
- hle/d3d12x/bind.rs: xcl-dev#1791 is upstream's copy of d2d8c93 / 923c3f8:
  integ's call sites (gpu_profile, breadcrumbs, XCL_SKIP_SHADERS) kept
  around upstream's identical fresh_indirect_arguments; the test that both
  sides added is kept once, at upstream's place.
- hle/d3d12x/vram.rs: xcl-dev#1747 as ported on try-1747 (11a9069): the PR's side
  of place_on_pages, with integ's pages() at its two PAGES.lock() sites so
  releases deferred while PAGES was held still run.

Assisted-by: omp (Claude Opus 5.5)
mastrr9 added a commit to mastrr9/xcl that referenced this pull request Nov 24, 2026
Brings xcl-dev#1747, xcl-dev#1791, xcl-dev#605, xcl-dev#1679, xcl-dev#1806, xcl-dev#1745, xcl-dev#1307, xcl-dev#1321 among others.

Resolutions:
- dxil/kernel.rs: upstream's Lw::new / Lw::finish; the safe s_barrier state
  and policy and xcl-dev#1741's single-wave bounded exchange move into Lw::new, with
  a safe_barrier flag (false for the per-lane lowering).
- dxil/lower.rs: VAR_BAR_DEAD moves to VAR_BUDGET + 6 (+5 is VAR_F32_MODE).
- TRANSLATOR_VERSION 9.
- d3d12x/bind.rs: the bounded ExecuteIndirect call runs inside
  fresh_indirect_arguments.
- d3d12x/list_x.rs: tracked_list_type, and transition (pub(super)) over the
  batched transitions.
- recomp/mod.rs: compact backend and per-lane modules both kept; the
  oversized-structured-code fallback applies to translate after prepare.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@skypinglost

Copy link
Copy Markdown

Post-merge follow-up covering two items from @ivall's merge note (Not tested: DXC on the new 15 MB source, NVIDIA) on container 95cc13288a27a96e (rec=22618, 333,596 B console code, 76,699 instructions, wave32, 4 memory windows). Counts, sizes, timings, and peak private commit only; no game or shader names.

Summary

  • DXC frontend: fixed as intended. #1321's pc-block fallback shrinks HLSL from 154,570,427 B (9039900) to 15,355,149 B (7f7e768, -90.1%), rescuing DXC from hitting our 20 GiB commit guard at 28.3 s to a clean 77.19 s / 2,494.7 MB compile producing 13,016,392 B (12.41 MiB) of DXIL.
  • NVIDIA driver backend: still unfinishable within practical bounds on the HLSL path. Extending @einfachama's 244–327 s observation above, our isolated cold CreateComputePipelineState on that 12.41 MiB DXIL (hlsl-heap) hit our 900 s timeout (900.37 s, peak commit 7,868.4 MB, still climbing ~200–230 MB per 30 s). This aligns with @afpruivo's uninterrupted RTX 3090 run on [OFFICIAL] Looking for PRs with shaders optimization #1269 (comment), where the #1321 DXIL took 83 min 9 s (~23.1 GB).
  • Same-commit comparison on main: on the exact same commit (7f7e768), XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 (#1748 + #1693) emits 3,324,912 B (3.17 MiB) of DXIL and builds cold in 32.89 s / 1,606.7 MB (>27× faster in the driver and >4.9× lower peak commit than #1321 HLSL).

Measured (95cc13288a27a96e, one isolated process per run)

Commit Mode HLSL / DXIL bytes Phase 1 (translate / DXC) Phase 2 (NVIDIA cold driver) Total Status
9039900 (Pre-#1321) hlsl-heap 154,570,427 B / — 28.28 s / 20,571.6 MB — 28.28 s killed (20 GiB cap)
7f7e768 (Post-#1321) hlsl-heap 15,355,149 B / 13,016,392 B 77.19 s / 2,494.7 MB 900.37 s / 7,868.4 MB 977.56 s timeout(900s)
7f7e768 (#1748 only) direct-root — / 3,914,652 B (PASS) 1.26 s / 265.2 MB 600.26 s / 6,582.3 MB 601.53 s timeout(600s)
7f7e768 (#1748 + #1693) direct-heap — / 3,324,912 B (PASS) 1.06 s / 256.3 MB 32.89 s / 1,606.7 MB 33.95 s OK (made=1, reused=0)

Full 58-run Pre/Post dataset across 118–477 KiB compute programs: #1269 (comment).

Not tested: a title run on the merged tree; GPU dispatch correctness of the compiled pipeline; AMD / Intel / Linux.

AI use: Antigravity (Gemini 4 Neon) ran the isolated benchmark harness, summarized the logs, and drafted this comment.

Rednaxeh added a commit to Rednaxeh/xcl that referenced this pull request Nov 24, 2026
… verdict

The driver's refusal of a translated compute pipeline reached only
note_translation_error: the report's translation_errors, or the notes of a
cached-only attempt, which are dropped when a shader was missing. On an RX
7800 XT a retail title's 13.8 MB compute program (xcl-dev#1332 in the form of xcl-dev#1321)
took the driver 15 - 23 s and ~15 GB of commit in every run and was refused
with E_OUTOFMEMORY; xcl.log showed its `driver compile finish` and, a
millisecond later, the title's dispatch with that pipeline skipped - and
nothing in between. The same with the 3.9 MB form of the direct DXIL backend
(xcl-dev#1748). The verdict had to be taken from `xcl shaders --measure-pso`.

A huge program (`huge_pso_bytes` and up) the driver refuses is now logged with
its record hash, DXIL size, HRESULT and the time the driver took, next to the
compile lines it already has. Logging only; no behaviour changes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Rednaxeh added a commit to Rednaxeh/xcl that referenced this pull request Nov 25, 2026
The huge-pipeline gate (xcl-dev#1524) let a compile on an xcl-pso worker start with
3 GB of commit free, whatever the program's size. The driver's compiler takes
memory in proportion to the program: ~1.5 GB for a 1 MB one (NVIDIA), and an
AMD driver took a process from 34 to 42 GB of commit on a retail title's
13.8 MB compute program (xcl-dev#1332 in the form of xcl-dev#1321). With the giant lane next
to the ordinary ones that compile started at 4 s, in the background, while the
title's world loading took its own 25 GB: on 32 GB of RAM the process ran into
the machine's commit limit at 28 - 34 s, twice with XCL_HUGE_PSO_CONCURRENCY=4
and once with the defaults (a title thread's page could not be committed).

big_compile_commit_needed(bytes) is 3 GB plus 1 GB for every 2 MB of DXIL, and
big_compile_may_start also refuses a background compile that would take more
than a share of the machine's RAM (a quarter; XCL_HUGE_PSO_RAM_SHARE sets the
n of 1/n, 0 leaves the commit free alone to decide, as before): such a program
waits for a bind that wants it (the gate's existing way out) and is built then,
as a title thread would, and the log says so once per program and worker.
Compiles the title waits for, and small ones, are unchanged.

A graphics bind resolves without waiting and did not mark the pipeline wanted,
so a graphics program the share holds back would have stayed a stand-in, its
worker in the gate: `resolve` now calls `want()` too (found, with the test
a_graphics_bind_releases_the_background_ram_share_gate, by WebIdentity1 in
review).

Measured on an RX 7800 XT, 32 GB: with the rule the same runs end at 600 s,
the 13.8 MB program built at 97 s when the title bound it, and a 60 s smoke's
peak commit goes from 84 GB (main) to 27 GB.

Co-Authored-By: WebIdentity1 <WebIdentity1@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Rednaxeh added a commit to Rednaxeh/xcl that referenced this pull request Nov 25, 2026
The huge-pipeline gate (xcl-dev#1524, headroom by size since xcl-dev#1774) lets a compile on an
xcl-pso worker start when its commit headroom is free. That reading at the start
of a compile says nothing about what the title takes next: a retail title's
13.8 MB compute program (xcl-dev#1332 in the form of xcl-dev#1321) started at 4 s in the
background with 36 GB of commit free - its headroom is 7 GB - and, with the
title's own 25 GB of world loading after it, the AMD driver's ~15 GB for that
compile ran the process into the machine's commit limit at 28 - 34 s on 32 GB of
RAM, three times (twice with XCL_HUGE_PSO_CONCURRENCY=4, once with the defaults:
a title thread's page could not be committed).

A background compile now also needs what it takes (the headroom, or 1 GB per MB
of DXIL when that is more) to be within a share of the machine's RAM (a quarter;
XCL_HUGE_PSO_RAM_SHARE sets the n of 1/n, 0 leaves the commit free alone to
decide, as before) and within the RAM available now (under Wine the commit
reading is the memory available plus the free swap and never falls, as
Royalflamejlh measured in review). Such a program waits for a bind that wants
it (the gate's existing way out) and is built then, as a title thread would,
and the log says so once per program and worker. Compiles the title waits for,
and small ones, are unchanged.

A graphics bind resolves without waiting and did not mark its pipeline wanted,
so a graphics program the share holds back would have stayed a stand-in with
its worker in the gate: `resolve` now calls `want()` too (found, with the test
a_graphics_bind_releases_the_background_ram_share_gate, by WebIdentity1 in
review).

Measured on an RX 7800 XT, 32 GB: with the share the same runs end at 600 s, the
13.8 MB program built at 97 s when the title bound it, and a 60 s smoke's peak
commit goes from 84 GB (main) to 27 GB.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

b8b1f49 (structured jumps to outer loop heads): the retail title of #505 commits ~1 GB/s until XCL runs out of memory, before the world load