Repository navigation
Shaders: XCL_DXC_PROCESS runs DXC in worker processes with a memory cap - #1638
marquezinii wants to merge 1 commit into
Conversation
gut0to
left a comment
There was a problem hiding this comment.
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.
|
@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 AI use: Claude Code (Claude Opus 5.5) drafted this reply. |
Hardware test report — commit
|
|
@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. AI use: Claude Code (Claude Opus 5.5) drafted this reply. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
c7d07e1 to
4802750
Compare
|
Rebased onto That leaves @eizispark's smoke pair on the old head AI use: Claude Code (Claude Opus 5.5) did the rebase, ran the tests and drafted this comment. |
|
In-game runs with 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
Not tested: a load that reaches the >8 MB sources; other GPUs; repeat runs beyond these five; the rebased head AI use: Claude Code (Claude Opus 5.5) ran the builds and runs and drafted this; I checked it before posting. |
|
@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. |
Test report: #1638 (
|
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.sysallocated 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_DIRnot set -
Clone:
git statusempty before and after (checked again after run 4), HEAD back at9e3831eafter. PR fetched withgit fetch origin pull/1638/head;FETCH_HEAD=c7d07e1400e7e96edbc5ce30a0848e18d8206cec, its only parent9e3831e1f570d3646e53ab753b19ec07eb8f1485 -
Builds:
cargo build --release -p xcl --bin xclat each commit, exit 0, 2 warnings each (bothdeprecated:fetch_update, renamed totry_update) →build-9e3831e.log,build-c7d07e1.logcopy size SHA-256 bin-9e3831e\xcl.exe7,229,952 B 36E5AF60369FCFC5545F0F605A706009FCA8F4B4E1EF3D876B9424808F71CBD1bin-c7d07e1\xcl.exe7,428,608 B E22C4ED25BDDF71730ED1E07B57A5AE5214DC1081F6843D5CC275E4223281D59 -
Every run: run from its own
bin-*folder, a new emptyXCL_DXIL_CACHE=C:\xcl-1638-cache\<run>,XCL_TRANSLATED_CACHE=0, no otherXCL_*variable (XCL_DXC_WORKER_EXEunset), no--pipelines, stdout and stderr together (*>&1) into<run>.log. A sampler (sampler.ps1) wrote<run>-sampler.csv: committed bytes, commit limit, mainxcl.exeprivate bytes, count / total / largest private bytes of the--dxc-workerprocesses, and ends the mainxcl.exeand 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 cscompiles 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 3000compiles nothing on this pack:--limittakes the first N records and the first 3000 have no CS. With and withoutXCL_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_PROCESSunset, 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 26000was started by a mistake in my loop and ended by me withStop-Processafter 11.8 s; it is not used here.) -
--precompile --only cs --limit 22400:XCL_DXC_PROCESSunset (run1-probe-l22400.log)XCL_DXC_PROCESS=1(run1d-process1-l22400.log)summary compiled 243, already cached 0, errors 0compiled 243, already cached 0, errors 0exit, 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 processin 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
- a 150952 KB source (154,575,599 B HLSL,
- No
DXC worker process ended (…)line, no other DXC error, noLLVM 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
- a 150952 KB source (154,575,599 B HLSL):
- No
DXC worker process ended (…)line, no other DXC error, noLLVM 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:23says "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 newermainno 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 atdxc.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) withXCL_DXC_PROCESS=1, and the regressionscripts/smoke.ps1runs - graphics stages on the whole pack (PS, MS, VS, GS): only
--only cswas 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'scrates/xcl/tests/dxc_worker.rs - what run 2 would have done without the sampler (
LLVM ERRORor 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.
|
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 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 Probe (a local example, not pushed): it links
So beyond the cap that #1598 / #1566 need, Tests on Not tested
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.
4802750 to
2639c08
Compare
|
@wayback94 thank you, this is the run on the whole pack that the PR needed, and with numbers that are easy to trust. On Both of your observations are right:
That's in @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 The head moved again, so the smoke pair is still open: anyone with a title, a AI use: Claude Code (Claude Opus 5.5) made the correction and drafted this reply. |
|
@marquezinii here is the smoke pair on
PR Frames 100.3 % of Also on
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 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 |
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 reportsE_OUTOFMEMORYor 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 throughdxc_processwhen it is on;compile_hereandDXC_STACKvisible to it.crates/xcl/src/main.rs:--dxc-worker.crates/xcl/tests/dxc_worker.rs: with thexclbinary 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
cargo test --workspace -- --test-threads=4on4802750(rebased ontomain1d027e5): 963 passed, 0 failed, 43 ignored.XCL_DXC_PROCESS=1,XCL_DXC_WORKER_EXE= the builtxcl.exe): 963 passed, 0 failed, 43 ignored.lower/lower_dxilandgpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64), the f16 and conversion formslower_dxilrefuses 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). Onc7d07e1, before the rebase: 780 passed, 0 failed, 41 ignored both ways.E_OUTOFMEMORY, worker replacedE_OUTOFMEMORY, worker replacedCost, 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, onc7d07e1with XG: fix CopyFromSubresource 7-argument ABI and guard destination span #684 merged, five runs alternated.+0x23cf683, Retail title 1.0.2.1 (Linux, RTX 3060 Ti 8 GB): past the end of story loading, then title assert 0x80000003 at +0x4da6315 #1164), with or without the setting. That load does not reach the >8 MB sources of Compute pipeline build takes >120 GB of memory on NVIDIA #1598, so it does not test the cap itself.On a whole retail pack, by @wayback94 (comment). Setup: RTX 3080, i7-13700K, 32 GB, release,
xcl shaders <pack> --precompile --only cs, onc7d07e1.main, commit ran away (22 → 35 GB in 11 s) and the run was stopped at 22600 of 26503.XCL_DXC_PROCESS=1it finished: 2688 compiled, 1 failed at the cap (a 150 MB source), main process under 1.14 GB, commit at most 70.5 %.Pipeline builds next to DXC, by @milesah3ad (comment). Setup: RTX 5080, synthetic programs, on
4802750.2639c08(this head) corrects the cap's comment indxc_process.rsfrom @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 isc7d07e1rebased ontomain1d027e5(the only conflict was the module list ingpu/recomp/mod.rs), plus the comment and README correction above; the code is unchanged. The pair below was run onc7d07e1. Run by @eizispark on an AMD Radeon RX 9070 XT, 60 s each, warm caches,XCL_DXC_PROCESSunset (the default), copied from their comment as posted:main:
PR:
Not tested
XCL_DXC_PROCESSon (@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 --precompilegoes through the same pool but was not run here.AI use