Skip to content

Shaders: XCL_DXC_PROCESS runs DXC in worker processes with a memory cap - #1638

Open
marquezinii wants to merge 1 commit into
xcl-dev:mainfrom
marquezinii:dxc-worker-processes
Open

marquezinii wants to merge 1 commit into
xcl-dev:mainfrom
marquezinii:dxc-worker-processes

Conversation

@marquezinii

@marquezinii marquezinii commented Nov 24, 2026 •

Copy link
Copy Markdown

DXC compiles inside XCL's process, so nothing bounds its memory. Retail packs have translated programs that drove it past 120 GB of commit in --precompile (#1598), and to ~1.2 GB/s while the title loaded its world (ofc0urse's runs on #1566). When DXC's allocations fail, it can end the process outright (LLVM ERROR: out of memory, exit 0xC0000409, the in-game exit code on #1598), and that process is the title.

With XCL_DXC_PROCESS=1, each DXC thread of the pool sends its compiles to its own worker process, xcl.exe --dxc-worker. All workers sit in one job object with a per-process memory limit (8 GB by default, XCL_DXC_PROCESS=<MB> for another cap) and kill-on-close, so they end with XCL. A compile past the cap fails like any other DXC error and the pipeline keeps its stand-in: either DXC reports E_OUTOFMEMORY or the worker ends. In both cases the worker is replaced for the next compile, and what it held goes back to Windows. If a worker can't be started, or the program doesn't answer as one, the compile runs in XCL's process as before. Off by default. This is the opt-in step; turning it on would be its own PR once it has been run with a title.

Part of #1598 and #1566 (the DXC side of the growth).

What is in it

  • crates/xcl/src/gpu/recomp/dxc_process.rs (new): the setting, the job object, starting and replacing workers, the stdin/stdout protocol (a hello, then length-prefixed requests and replies), the worker loop on a thread with DXC's 64 MB stack; unit tests for the setting, the protocol (a truncated reply reads as an error) and the fallback when no worker starts.
  • crates/xcl/src/gpu/recomp/dxc.rs: the pool's threads compile through dxc_process when it is on; compile_here and DXC_STACK visible to it.
  • crates/xcl/src/main.rs: --dxc-worker.
  • crates/xcl/tests/dxc_worker.rs: with the xcl binary as the worker and a 24 MB cap, a small program compiles, a 176 KB generated one fails with the cap in its error, and the next small one compiles again in a new worker.
  • README.md: the setting.

Tested

  • NVIDIA GeForce RTX 5070 12 GB, driver 621.40; Ryzen 5 5600X, 32 GB; Windows 11 Pro 26300; Rust 1.99.1 MSVC; DXC 1.9.2602.17; debug.
  • cargo test --workspace -- --test-threads=4 on 4802750 (rebased onto main 1d027e5): 963 passed, 0 failed, 43 ignored.
  • The same with every compile in workers (XCL_DXC_PROCESS=1, XCL_DXC_WORKER_EXE = the built xcl.exe): 963 passed, 0 failed, 43 ignored.
  • SKIPPED in both: the wave64 cases of lower / lower_dxil and gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64), the f16 and conversion forms lower_dxil refuses in wave32, heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), pso_measurement_compiles_an_exact_synthetic_record (cannot disable the driver cache). On c7d07e1, before the rebase: 780 passed, 0 failed, 41 ignored both ways.
  • Both ways a compile fails at the cap, on the 176 KB source (peak per worker from the job's accounting: 37 MB without a cap):
cap what happened runs
8, 16, 20 MB DXC returned E_OUTOFMEMORY, worker replaced 1 each
24 MB (the test's default) DXC returned E_OUTOFMEMORY, worker replaced every run
12 MB the worker ended with 0xC0000409, the test process went on 3 of 3
  • Cost, same generated sources and pool, in XCL's process vs. in workers: a 351 KB source 10.8–11.2 s vs. 10.5–11.2 s (4 runs each); 22 compiles of 107 KB at once on 11 DXC threads 4.1–4.2 s vs. 4.2 s (2 runs each). Peak worker commit after a small compile: 3 MB.

  • With a title and XCL_DXC_PROCESS=1, by @denverquane (their comment). Setup: RTX 5070, retail 1.0.2.1, cold DXIL cache, release, on c7d07e1 with XG: fix CopyFromSubresource 7-argument ABI and guard destination span #684 merged, five runs alternated.

  • On a whole retail pack, by @wayback94 (comment). Setup: RTX 3080, i7-13700K, 32 GB, release, xcl shaders <pack> --precompile --only cs, on c7d07e1.

    • On main, commit ran away (22 → 35 GB in 11 s) and the run was stopped at 22600 of 26503.
    • With XCL_DXC_PROCESS=1 it finished: 2688 compiled, 1 failed at the cap (a 150 MB source), main process under 1.14 GB, commit at most 70.5 %.
    • With a 4096 MB cap, two ~30 MB sources failed too. They compiled under 8 GB, so the default stays at 8 GB.
  • Pipeline builds next to DXC, by @milesah3ad (comment). Setup: RTX 5080, synthetic programs, on 4802750.

  • 2639c08 (this head) corrects the cap's comment in dxc_process.rs from @wayback94's numbers: it said the biggest translations take ~0.7 GB in DXC. It also says that the cap is per worker and that the free-commit wait before each compile bounds them together. The README says the cap is per worker. Comments and README only: 4802750's code, and its 963 / 0 / 43 suite, are unchanged.

Regression run
Needs a new pair for this head 2639c08. It is c7d07e1 rebased onto main 1d027e5 (the only conflict was the module list in gpu/recomp/mod.rs), plus the comment and README correction above; the code is unchanged. The pair below was run on c7d07e1. Run by @eizispark on an AMD Radeon RX 9070 XT, 60 s each, warm caches, XCL_DXC_PROCESS unset (the default), copied from their comment as posted:

main:

xcl-smoke v1
commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1671 (PresentX 1671)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14861 MB

PR:

xcl-smoke v1
commit: c7d07e1400e7e96edbc5ce30a0848e18d8206cec
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1677 (PresentX 1677)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14857 MB

Not tested

  • A load that reaches the cap with XCL_DXC_PROCESS on (@denverquane's runs above stayed far below it): whether 8 GB is the right default cap, and how a title takes a big pipeline that fails at the cap instead of building after minutes (it keeps its stand-in, as with any DXC error). xcl shaders --precompile goes through the same pool but was not run here.
  • The worst compiles of Compute pipeline build takes >120 GB of memory on NVIDIA #1598 under the cap: the generated sources above only reach tens of MB.
  • AMD, Wine (the job object and pipes are plain Win32, not checked under Wine).

AI use

  • Claude Code (Claude Opus 5.5): wrote the change, the tests and this description, and ran the tests and the measurements on the hardware above.

@gut0to gut0to left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The unit, worker-mode, and failure-cap tests are thorough. The required runtime regression evidence is still missing: CONTRIBUTING.md requires scripts/smoke.ps1 blocks for both main and this head whenever crates/xcl/src changes, even if the title does not exercise the changed path. The Regression run section currently leaves both blocks empty and says no retail title was available. Please add the paired runs before merge (or get a maintainer with a title to run them). AI-assisted review; I checked the description against the project guide.

@marquezinii

Copy link
Copy Markdown
Author

@gut0to agreed, the smoke pair is still missing. I have no retail title on this machine, so I can't produce the blocks myself. The description asks for someone with a title to post main and this head, or for a maintainer to run them. Until then it waits, as CONTRIBUTING says.

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

@eizispark

eizispark commented Nov 24, 2026 •

Copy link
Copy Markdown

Hardware test report — commit 4802750

(Updated for rebased head 4802750; previous head c7d07e1 also passed.)

Verified 4802750664de0842527ee479e61555908f0c2d17 (clean merge with main 689f2db; rebased on main 4e3515e): pass.

Tested

  • Hardware: AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64, driver 32.0.32015.16001), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 x64, rustc 1.100.0 (0ef1bc386 2026-11-09), debug tests + release smoke
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 963 passed, 0 failed, 43 ignored (8 skipped: 6 gpu::recomp::lower_dxil::tests f16/f32 direct-DXIL per-lane cases refused where #1426 semantics differ from the console's; shaders::tests::pso_measurement_compiles_an_exact_synthetic_record — Windows Developer Mode required, 0x887A002D; heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows)
  • gpu::recomp::dxc_process::tests (3/3 passed: caps_from_the_setting, requests_and_replies_round_trip, without_a_worker_the_compile_runs_here) and dxc_worker (1/1 passed with XCL_DXC_PROCESS: a_compile_past_the_cap_ends_its_worker_and_the_next_one_gets_a_new_worker)
  • Both wave64 GPU tests skipped on NVIDIA (gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware, plus console_wave64_compute_through_the_pso_hook_dispatch_and_read_back) ran natively and passed on RDNA4

Regression run (scripts/smoke.ps1, 60 s, warm shader/driver cache, XCL_DXC_PROCESS unset as default)
main (4e3515eed124b9f4779f5ef4e2b54adf97da936a):

xcl-smoke v1
commit: 4e3515eed124b9f4779f5ef4e2b54adf97da936a
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1676 (PresentX 1676)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14731 MB

PR (4802750664de0842527ee479e61555908f0c2d17):

xcl-smoke v1
commit: 4802750664de0842527ee479e61555908f0c2d17
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1670 (PresentX 1670)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14859 MB

Not tested

  • retail run with XCL_DXC_PROCESS=1 on a cold cache, NVIDIA/Intel GPUs, Wine/vkd3d-proton, gameplay past the menus

AI use

  • Verified and formatted with Antigravity (Google DeepMind, Gemini 4 Carbon).

@marquezinii

Copy link
Copy Markdown
Author

@eizispark thank you, that's the smoke pair this was waiting on, plus the native wave64 run I couldn't do. I've copied both blocks into Regression run as you posted them, credited to you. c160d86 is on main and the PR block names this head. I've also noted under Not tested that the pair ran with XCL_DXC_PROCESS off, as you said, so a run with it on (cold cache) is still open.

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

@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, ~22 ignored.

Thanks!

@ivall ivall added the goal:world-load Bears on the retail title getting past world loading label Nov 24, 2026
@marquezinii

Copy link
Copy Markdown
Author

Rebased onto main 1d027e5, because the PR no longer merged. The only conflict was the module list in gpu/recomp/mod.rs (dxil, lane_masks, lower, lower_dxil came in next to dxc_process); the code is unchanged. The new head is 4802750. Here, cargo test --workspace -- --test-threads=4 gives 963 passed, 0 failed, 43 ignored, and the same with every compile in workers (XCL_DXC_PROCESS=1). @DavidM1911, thanks for the run on the 3060 Ti.

That leaves @eizispark's smoke pair on the old head c7d07e1, so the description check needs a new one for 4802750. @eizispark, or anyone with a title: a scripts/smoke.ps1 pair on main and 4802750 would put it back where it was. I'll copy it in as before.

AI use: Claude Code (Claude Opus 5.5) did the rebase, ran the tests and drafted this comment.

@denverquane

Copy link
Copy Markdown

In-game runs with XCL_DXC_PROCESS=1 and a cold DXIL cache. Worker mode got through the retail title's world load without a compile failure. This load never reached the cap: DXC is not where memory went here.

Setup: RTX 5070 12 GB (driver 621.24, 32-lane waves), Ryzen 7 9800X3D, 64 GB RAM, commit limit 129.5 GB, Windows 10 Home 22H2 (19045), rustc 1.100.0, release, DXC 1.9.2609.5. Retail 1.0.2.1, Series X. Tree: this PR's c7d07e1 (on 9e3831e) with #684's head e56dbc3 merged (without #684 the load ends at 63 s in xg::copy_from, #662). The PR has since been rebased onto 1d027e5 as 4802750; the commit's change itself is unchanged (git range-diff), but these runs are on the old base. XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_PSO_WAIT_MS=50, XCL_DXIL_CACHE set to an empty folder for each run, runs alternated.

run XCL_DXC_PROCESS DXC compiles (failed) compute PSOs peak commit, xcl.exe peak commit, all workers end
1 unset 454 (0) 277 31.5 GB – +0x23cf683 at 130 s
2 1 62 (0) 15 28.0 GB 0.15 GB +0x23cf683 at 311 s
3 1 435 (0) 244 29.5 GB 1.59 GB +0x23cf683 at 91 s
4 unset 497 (0) 293 33.0 GB – +0x23cf683 at 166 s
5 1 503 (0) 274 30.8 GB 1.62 GB 0x80000003 at +0x4da6315, 98 s (#1164)
  • In worker mode 15 workers started. None used more than 0.33 GB, and the log has no worker messages.
  • Run 2 stalled on the GPU at about 62 s (title texture: upload failed: texture copy: GPU fence still pending after 10000 ms) and asked for almost no world pipelines after that. At the 120 s thread dump all DXC threads were waiting for jobs. Runs 3 and 5 did not stall, so I don't attribute it to this PR.
  • With DXC in-process, xcl.exe commit levelled off at 31–33 GB. The thread dumps show at most one DXC thread compiling while up to 15 xcl-pso threads are inside nvgpucomp64.dll. This load ends at the watchdog before it reaches the sources that grow DXC's heap in Compute pipeline build takes >120 GB of memory on NVIDIA #1598, so it does not test the cap itself.

Not tested: a load that reaches the >8 MB sources; other GPUs; repeat runs beyond these five; the rebased head 4802750.

AI use: Claude Code (Claude Opus 5.5) ran the builds and runs and drafted this; I checked it before posting.

@marquezinii

Copy link
Copy Markdown
Author

@denverquane thank you, that's the first run of worker mode with a title and the piece that was missing. Five alternated runs with a cold cache, no failed compile, and the workers small (0.33 GB at most) all say the opt-in path holds up in a real load. I've added it to Tested with a link, and narrowed Not tested to what it leaves open, as you say: a load that reaches the cap.

The 28–31 GB against 31.5–33 GB for xcl.exe fits DXC's heap moving into the workers. With five runs ending at different times, I wouldn't read more into it than that.

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

@wayback94

Copy link
Copy Markdown

Test report: #1638 (XCL_DXC_PROCESS) with a retail shader pack, Windows + NVIDIA

Tested: PR head c7d07e1400e7e96edbc5ce30a0848e18d8206cec (one commit, parent 9e3831e1f570d3646e53ab753b19ec07eb8f1485)
against main 9e3831e1f570d3646e53ab753b19ec07eb8f1485, release builds, xcl shaders <pack> --precompile --only cs on the whole retail pack (26503 records, as in #1598).

Yes, on this pack the cap does what the PR says. On 9e3831e the compute-only precompile ran away
in XCL's own process (main process 22.94 GB private, commit from 22.11 to 35.19 GB in about 11 s) and my
sampler had to end it after 22600/26503. On the PR with XCL_DXC_PROCESS=1 the same command finished:
one 150952 KB source failed with … past its 8192 MB cap and there was no other error
(compiled 2688 + 1 error = 2689, the pack's CS count), with the main process under 1.14 GB and commit at most 70.5 %.

run 2: 9e3831e, DXC in process run 3: c7d07e1, XCL_DXC_PROCESS=1
outcome ended by my sampler (STOPPED AT 92 %); exit −1 is from Stop-Process. No LLVM ERROR in the log finished, exit 0
progress reached last line 22600/26503 (138 s) all 26503 (last progress line 24600/26503 (1792 s))
summary line none (stopped) compiled 2688, already cached 0, errors 1, skipped (GS – paired at pipeline creation) 0, time 1859.6 s
wall time 222.1 s 1859.7 s
peak committed bytes 35,186,266,112 (97.1 % of 36,231,794,688) 25,547,538,432 (70.5 %)
peak private bytes, main xcl.exe 22,944,813,056 1,136,013,312
peak private bytes, one worker / all workers – 8,587,812,864 / 12,807,950,336
most --dxc-worker processes at once – 23
errors – 1 (the cap, see below)

With a 4096 MB cap (run 4) two more sources fail, 30222 KB and 30301 KB, which the 8192 MB cap compiled.

run 3: XCL_DXC_PROCESS=1 (8192 MB) run 4: XCL_DXC_PROCESS=4096
outcome finished, exit 0 finished, exit 0
summary line compiled 2688, already cached 0, errors 1, …, time 1859.6 s compiled 2686, already cached 0, errors 3, …, time 1782.7 s
wall time 1859.7 s 1782.8 s
peak committed bytes 25,547,538,432 (70.5 %) 23,213,961,216 (64.1 %)
peak private bytes, main xcl.exe 1,136,013,312 1,085,841,408
peak private bytes, one worker / all workers (5 s samples) 8,587,812,864 / 12,807,950,336 3,773,173,760 / 10,509,053,952
most workers at once 23 23
sources failed by the cap 150952 KB 150952 KB, 30222 KB, 30301 KB

Run 2 did not die on its own: commit went 22.11 → 25.30 → 35.19 GB across three 5 s samples, and the
sampler (then checking every 5 s) caught it at 97.1 %, not at 92 %. It is not known whether it would have
ended with LLVM ERROR: out of memory or taken Windows to its commit limit.

Tested

  • Hardware: NVIDIA GeForce RTX 3080 10 GB (10240 MiB), driver 621.14 (Windows driver 32.0.16.2114); Intel Core i7-13700K (24 threads); 32 GB RAM (34,084,311,040 B)

  • Windows 11 Home 26H2, build 26300.9974

  • Page file: system-managed (AutomaticManagedPagefile: True), C:\pagefile.sys allocated 2048 MB before and after the runs; commit limit 36,231,794,688 B before, during (every sampler line) and after. Committed before the first run: 10.97 GB; when run 2 started: 12.82 GB (15.00 GB a few minutes earlier, with other programs still open); after run 3: 11.66 GB

  • Rust 1.100.0 (stable-x86_64-pc-windows-msvc, rustc 0ef1bc386 2026-11-09, LLVM 23.1.5), cargo 1.100.0 (3acc79c0c 2026-11-05)

  • Visual Studio Build Tools 2022 17.14.45, MSVC 14.44.35207, Windows SDK 10.0.26100.0

  • DXC: the Windows SDK's, as the logs print it: dxcompiler 1.9.2602.17 (21d28f72), dxil 1.9.2602.17, from C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64; XCL_DXC_DIR not set

  • Clone: git status empty before and after (checked again after run 4), HEAD back at 9e3831e after. PR fetched with git fetch origin pull/1638/head; FETCH_HEAD = c7d07e1400e7e96edbc5ce30a0848e18d8206cec, its only parent 9e3831e1f570d3646e53ab753b19ec07eb8f1485

  • Builds: cargo build --release -p xcl --bin xcl at each commit, exit 0, 2 warnings each (both deprecated: fetch_update, renamed to try_update) → build-9e3831e.log, build-c7d07e1.log

    copy size SHA-256
    bin-9e3831e\xcl.exe 7,229,952 B 36E5AF60369FCFC5545F0F605A706009FCA8F4B4E1EF3D876B9424808F71CBD1
    bin-c7d07e1\xcl.exe 7,428,608 B E22C4ED25BDDF71730ED1E07B57A5AE5214DC1081F6843D5CC275E4223281D59
  • Every run: run from its own bin-* folder, a new empty XCL_DXIL_CACHE=C:\xcl-1638-cache\<run>, XCL_TRANSLATED_CACHE=0, no other XCL_* variable (XCL_DXC_WORKER_EXE unset), no --pipelines, stdout and stderr together (*>&1) into <run>.log. A sampler (sampler.ps1) wrote <run>-sampler.csv: committed bytes, commit limit, main xcl.exe private bytes, count / total / largest private bytes of the --dxc-worker processes, and ends the main xcl.exe and its workers above 92 % of the commit limit. Up to run 2 it checked every 5 s; for run 3 every 1 s (CSV line every 5 s), because run 2 overshot.

  • Pack stage counts (xcl shaders <pack>, analysis only, no compile, → analysis-stages.log): 26503 shader records; stages (DXIL): PS 12101, MS 9282, CS 2689, VS 2236, GS 195. So --only cs compiles at most 2689 programs; the progress counter also counts the records it skips.

Run 1, smoke check of the worker (bin-c7d07e1)

  • As written, --precompile --only cs --limit 3000 compiles nothing on this pack: --limit takes the first N records and the first 3000 have no CS. With and without XCL_DXC_PROCESS=1 (run1a-unset.log, run1b-process1.log): compiled 0, already cached 0, errors 0, no worker started (no compile went to one). --limit 8000 (run1c-unset-l8000.log): the same.

  • I then looked for a limit with CS programs, XCL_DXC_PROCESS unset, each with its own new cache (run1-probe-l*.log): 21000 to 22000 in steps of 200: compiled 0; 22200: 43; 22400: 243. (One probe at --limit 26000 was started by a mistake in my loop and ended by me with Stop-Process after 11.8 s; it is not used here.)

  • --precompile --only cs --limit 22400:

    XCL_DXC_PROCESS unset (run1-probe-l22400.log) XCL_DXC_PROCESS=1 (run1d-process1-l22400.log)
    summary compiled 243, already cached 0, errors 0 compiled 243, already cached 0, errors 0
    exit, wall 0, 116.5 s 0, 80.1 s
    most workers at once 0 23
    peak private, main 5,326 MB 712 MB
    peak private, one worker / all – 1,222 MB / 5,921 MB
    peak commit 20.14 GB 21.63 GB

    Workers started (23, one per DXC thread); no compiling in XCL's process in the log. One run each, so the wall time difference is not a measurement of speed.

Run 2: D:\xcl-logs-1638\bin-9e3831e\xcl.exe shaders <pack> --precompile --only cs, env XCL_DXIL_CACHE=C:\xcl-1638-cache\run2-9e3831e XCL_TRANSLATED_CACHE=0 → run2-9e3831e.log, run2-9e3831e-sampler.csv. Results in the table above. Progress lines: 22200/26503 (2 s), 22400/26503 (73 s), 22600/26503 (138 s); stopped at 221 s (16:15:00 sample).

Run 3: D:\xcl-logs-1638\bin-c7d07e1\xcl.exe shaders <pack> --precompile --only cs, env XCL_DXC_PROCESS=1 XCL_DXIL_CACHE=C:\xcl-1638-cache\run3-c7d07e1-process1 XCL_TRANSLATED_CACHE=0 → run3-c7d07e1-process1.log, run3-c7d07e1-process1-sampler.csv. Results in the table above. It went past run 2's last line (22600/26503 at 107 s, 22800/26503 at 212 s) and finished; the sampler never reached 92 %.

  • Errors caused by the cap (all errors of the run):
    • a 150952 KB source (154,575,599 B HLSL, cs_6_6): Compile: Not enough memory resources are available to complete this operation. (0x8007000E) – a 150952 KB source in a DXC worker process past its 8192 MB cap
  • No DXC worker process ended (…) line, no other DXC error, no LLVM ERROR. Its peak commit (25.55 GB, 16:18:25) and the 8.59 GB worker peak are while that compile ran into its cap.
  • Run 1's samples had no errors with either setting, so this source was not among their 243 programs.
  • The log prints HLSL sizes only for failed compiles, so I did not check whether this pack has the 12.0 – 29.6 MB sources of Compute pipeline build takes >120 GB of memory on NVIDIA #1598; no source other than the 150952 KB one failed.

Run 4: as run 3 with XCL_DXC_PROCESS=4096: D:\xcl-logs-1638\bin-c7d07e1\xcl.exe shaders <pack> --precompile --only cs, env XCL_DXC_PROCESS=4096 XCL_DXIL_CACHE=C:\xcl-1638-cache\run4-c7d07e1-process4096 XCL_TRANSLATED_CACHE=0 → run4-c7d07e1-process4096.log, run4-c7d07e1-process4096-sampler.csv. Results in the run 3 / run 4 table above; the sampler never reached 92 %.

  • Errors caused by the cap (all errors of the run), all cs_6_6:
    • a 150952 KB source (154,575,599 B HLSL): Compile: Not enough memory resources are available to complete this operation. (0x8007000E) – a 150952 KB source in a DXC worker process past its 4096 MB cap
    • a 30222 KB source (30,947,951 B HLSL): … (0x8007000E) – a 30222 KB source in a DXC worker process past its 4096 MB cap
    • a 30301 KB source (31,028,669 B HLSL): … (0x8007000E) – a 30301 KB source in a DXC worker process past its 4096 MB cap
  • No DXC worker process ended (…) line, no other DXC error, no LLVM ERROR.
  • The 30222 KB and 30301 KB sources (29.5 and 29.6 MB) are the sizes of two of the six sources in Compute pipeline build takes >120 GB of memory on NVIDIA #1598; under the 8192 MB cap (run 3) they compiled.
  • The worker peak in the table (3.77 GB) is the largest 5 s sample, below the 4096 MB cap; the moment a worker hit the cap fell between samples.

Two observations from these runs

  • The cap's comment understates what DXC takes on this pack. dxc_process.rs:23 says "the biggest translations of a retail pack take ~0.7 GB in DXC". Here the 30222 KB and 30301 KB sources failed at 4096 MB and compiled at 8192 MB (runs 3 and 4), so each took more than 4 GB, and the 150952 KB source took more than 8 GB. 8192 MB was enough for every source except the 150952 KB one, which newer main no longer produces (Recompiler: oversized structured code falls back to pc blocks (#1307) #1321). A 4096 MB cap would also fail the two ~30 MB ones.
  • The cap is per worker, not in total. With 23 DXC threads there were 23 workers (runs 1, 3 and 4), so the workers together could take up to 23 × 8 GB = 184 GB, about 5 times this machine's 36.2 GB commit limit. In these runs they did not: at most 12.8 GB in total (run 3). Reading the code, what limits the total is the free-commit check that each compile already passes before it starts (wait_for_memory, dxc.rs:427, called at dxc.rs:461), not the job object. I did not test a case where several big compiles run at once.

Not tested

  • --pipelines (NVIDIA driver memory on top of DXC's)
  • a title run (xcl run) with XCL_DXC_PROCESS=1, and the regression scripts/smoke.ps1 runs
  • graphics stages on the whole pack (PS, MS, VS, GS): only --only cs was run on the whole pack
  • caps other than 8192 MB (XCL_DXC_PROCESS=1) and 4096 MB (XCL_DXC_PROCESS=4096)
  • AMD GPUs, Wine / vkd3d-proton, debug builds
  • the test suite (cargo test), including the PR's crates/xcl/tests/dxc_worker.rs
  • what run 2 would have done without the sampler (LLVM ERROR or the commit limit)
  • one run per setting only; no timing comparison

AI use

  • Claude Code (desktop app), model Claude Opus 5.5 (claude-opus-5-5): read the PR's diff, built both commits, wrote the sampler and run scripts, ran every run, and wrote this report from the logs and sampler CSVs. A second Claude Code session (Claude Opus 5.5) checked every figure against the logs and CSVs, corrected one, and wrote the two observations from the run results and a reading of the PR's code. The user reviews and posts it.

@milesah3ad

Copy link
Copy Markdown

Speed, not just memory: with DXC in worker processes, NVIDIA pipeline builds that run alongside DXC are about 22 % faster on this machine, and the whole batch finishes 21 % sooner. No game files: synthetic programs, RTX 5080. This adds the side of #1638 nobody has measured. On #156, compiles in the same process slowed the driver down, and @wondercrash's WinDbg snapshot there showed nvgpucomp64 holding the NT process-heap lock while DXC threads waited.

Setup: RTX 5080 16 GB, driver 621.24, Ryzen 7 9800X3D (16 threads), 64 GB, Windows 11 Pro 26300, rustc 1.100.0, release, DXC 1.9.2609.5. This head 4802750.

Probe (a local example, not pushed): it links xcl, answers --dxc-worker itself through dxc_process::serve() (so the workers are copies of it), and calls dxc::compile, the pool the runtime uses (XCL_DXC_THREADS=8).

  • 40 distinct split-wave64 compute programs (the nv680 shapes from Recompiler: memory windows from the descriptor heap (no per-access switch) #680: 4 memory windows, switch form, 250 and 500 rounds), 10.7 MB of DXIL in total. Fresh seeds every run, so neither the DXIL cache nor the driver's can answer.
  • Concurrent: 8 threads compile through dxc::compile, and 6 threads build each DXIL with CreateComputePipelineState as it arrives (each pipeline released right after). This is the overlap a world load has.
  • In-process and XCL_DXC_PROCESS=1 runs alternated, 2 rounds each, plus two controls.
run wall (s) driver build: mean / median (s) DXC: mean (s) main process peak / worker peak (MB)
concurrent, DXC in process, round 1 397.7 52.27 / 47.17 17.42 3019 / –
concurrent, XCL_DXC_PROCESS=1, round 1 342.0 45.27 / 33.46 17.26 2764 / 272
concurrent, DXC in process, round 2 429.0 58.29 / 50.22 15.12 3148 / –
concurrent, XCL_DXC_PROCESS=1, round 2 309.6 40.99 / 37.19 16.61 2830 / 272
control: DXC only, in process 53.7 – 8.91 1107 / –
control: DXC only, workers 47.5 – 8.19 109 / 272
control: driver only (DXIL made beforehand), 6 threads 248.4 (driver phase) 32.48 / 25.44 – 2937 / –
  • Driver builds: 55.3 s mean in process against 43.1 s with workers (−22 %). Wall: 413 s against 326 s (−21 %, means of the two rounds). The direction is the same in both rounds.
  • There is contention, and workers remove about half of it. Alone, the same driver work averages 32.5 s a build. Next to DXC in the same process it took +70 % (55.3 s), and next to DXC in workers +33 % (43.1 s). What's left with workers fits plain CPU sharing: 8 DXC + 6 driver threads, plus the driver's own threads, on 16 hardware threads.
  • DXC's own time doesn't change between the two concurrent arms (16.3 s against 16.9 s mean). Alone it's about 2× faster in both, so it's slowed by sharing the CPU, not by the move. With nothing else running, the workers were slightly faster (8.19 s against 8.91 s).
  • Memory: the worker job's peak per process was 272 MB, and the main process's peak dropped from 3.0–3.1 GB to 2.8 GB in the concurrent runs (1107 → 109 MB with DXC alone).

So beyond the cap that #1598 / #1566 need, XCL_DXC_PROCESS=1 takes the DXC-versus-driver heap contention out of the title's process. That matters for the world load, where cold DXC compiles and driver builds overlap. It may be worth noting when the default is decided.

Tests on 4802750: cargo test -p xcl --lib dxc: 41 passed, 0 failed, 3 ignored (including dxc_process::tests::*).

Not tested

  • Any title or retail program; one machine; NVIDIA only (the heap lock was seen in nvgpucomp64, and AMD's driver may differ). Two rounds per arm, so treat the size as approximate rather than exact.
  • Different thread counts, and whether the remaining +33 % falls with fewer DXC threads.

AI use: Claude Code (Claude Opus 5.5) wrote the probe, ran it on the machine above and wrote this report. I checked the numbers against the logs.

In XCL's process one DXC compile can take all of the machine's commit:
a retail pack's translated programs drove it past 120 GB in
`--precompile` (xcl-dev#1598) and ~1.2 GB/s while a title loaded its world
(xcl-dev#1566), and when DXC's allocations fail it can end the process
(LLVM's out-of-memory abort, 0xC0000409), which is the title.

With XCL_DXC_PROCESS=1 (or =<MB>) each DXC thread of the pool sends its
compiles to its own `xcl.exe --dxc-worker` process, all in one job
object with a per-process memory limit (8 GB by default) and
kill-on-close. A compile past the cap fails like any DXC error: DXC
reports E_OUTOFMEMORY, or the worker ends. Either way the worker is
replaced for the next compile. A worker that does not start, or a
program that does not answer as one, falls back to compiling in XCL's
process. Off by default.

On an RTX 5070 machine the same compiles took the same time in a worker
as in the process (10.5-11.2 s for a 351 KB source; 22 parallel
compiles 4.1-4.2 s either way), and the whole test suite passes with
every compile in workers.
@marquezinii

Copy link
Copy Markdown
Author

@wayback94 thank you, this is the run on the whole pack that the PR needed, and with numbers that are easy to trust. On main commit went 22 → 35 GB in 11 s; with XCL_DXC_PROCESS=1 it finished with 1 cap failure and the main process under 1.14 GB.

Both of your observations are right:

  • The comment was wrong. "~0.7 GB" came from smaller programs. It now says what your runs show: two ~30 MB sources took more than 4 GB and compiled under 8 GB, and only the 150 MB one went past it. That 150 MB translation is one main no longer makes (Recompiler: oversized structured code falls back to pc blocks (#1307) #1321). So 8 GB stays the default, and your 4096 MB run shows why.
  • The cap is per worker. What bounds them together is the free-commit wait each compile passes before it starts (wait_for_memory), as you read it. The comment and the README now say so.

That's in 2639c08, comments and README only, squashed into the one commit.

@milesah3ad thank you, that's a side nobody had measured. Driver builds 22 % faster with DXC out of the process, and contention cut roughly in half, matches the nvgpucomp64 heap-lock snapshot on #156. Both reports are in Tested now, with links.

The head moved again, so the smoke pair is still open: anyone with a title, a scripts/smoke.ps1 pair on main and 2639c08 would complete it.

AI use: Claude Code (Claude Opus 5.5) made the correction and drafted this reply.

@wayback94

Copy link
Copy Markdown

@marquezinii here is the smoke pair on 2639c08, against its parent main 1d027e5: RTX 3080, driver 621.14, Windows 11 26300, release builds from clean trees, 60 s, warm caches (one discarded warm-up run of each build first). Ready to paste under Regression run:

main 1d027e5:

xcl-smoke v1
commit: 1d027e5c76c9a86a7ee2ca1cc677edf0be95d331
gpu: NVIDIA GeForce RTX 3080
title: 9a60a330
seconds: 60
exit: 0x0
frames shown: 1613 (PresentX 1614)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14795 MB

PR 2639c08:

xcl-smoke v1
commit: 2639c0806ef2231bda8b775f4af691cfd2db82aa
gpu: NVIDIA GeForce RTX 3080
title: 9a60a330
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14799 MB

Frames 100.3 % of main's, peak commit 100.0 %, no device removal, no crash. This was the second of two pairs; I chose it before running it, because it would be the latest. The first pair gave 1632 / 1630 frames and 14681 / 14605 MB.

Also on 2639c08:

  • cargo test --workspace -- --test-threads=4 (debug): 963 passed, 0 failed, 43 ignored. SKIPPED: the wave64 cases (no wave64), the wave32 f16 / f32-conversion per-lane cases lower_dxil refuses, pso_measurement_compiles_an_exact_synthetic_record (no Developer Mode), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • The title with XCL_DXC_PROCESS=1 and an empty XCL_DXIL_CACHE, 60 s, twice: 1576 and 1579 frames, no crash, no device removal.
    • Up to 12 --dxc-worker processes at once, each at most ~4 MB private.
    • 12 compiles, 0 failures, and no fallback to compiling in XCL's process.
    • It's a light test of the workers: in 60 s from a cold cache the title reached only 6 translated pipelines (228 when warm), and nothing came near the cap.

Not tested: AMD, Wine, runs longer than 60 s or past the menus, a cap other than the default or a compile that reaches it, and a cold-cache run without the workers to compare the XCL_DXC_PROCESS=1 runs against.

AI use: Claude Code (Claude Opus 5.5) built both commits, ran the tests, the smoke runs and the memory sampler, and wrote this from the logs. The blocks were copied from smoke.ps1's output, not typed.

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.

8 participants