Skip to content

D3D12.X: scale huge pipeline compile slots with available CPUs - #2098

Open
Kalmarv wants to merge 3 commits into
xcl-dev:mainfrom
Kalmarv:huge-pso-cpu-default
Open

Kalmarv wants to merge 3 commits into
xcl-dev:mainfrom
Kalmarv:huge-pso-cpu-default

Conversation

@Kalmarv

@Kalmarv Kalmarv commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1269. Background driver compiles of pipelines from 256 KiB to under 4 MiB of DXIL take turns in one slot by default (XCL_HUGE_PSO_CONCURRENCY=1). In a cold 120 s title run with XCL_DIRECT_DXIL=1, seven cascade-shadow compute pipelines of 520–990 KB queue behind each other there, each starting when the last finishes. With the new default of four at once, the same seven finish 2.3× sooner (87.5 s to 38.8 s) for about 1.1 GiB more commit.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs: the default becomes one slot per four available logical CPUs, at least 1 and at most 4. XCL_HUGE_PSO_CONCURRENCY still overrides it (1–64). The separate one-wide lane for 4 MiB and up is unchanged. The free-commit check before each background compile now counts what the huge compiles already admitted have reserved: each admitted compile reserves its headroom (3 GiB, or 512× its DXIL above 6 MiB) in one pool shared with the 4 MiB lane until it finishes, and the check and the reservation happen under one lock, so several workers can't all pass the same check before the driver's allocations show (review by @bmjask). A compile a title thread waits for still skips the check, but reserves too. A unit test covers the default for 1 to 64 CPUs, and two cover the reservation: one over both lanes, and eight workers racing for 7 GiB of free commit.
  • README.md: the new default and the measurement behind it, and which compiles the commit check applies to.
  • crates/xcl/src/hle/d3d12x/real.rs (d27d471): a build a game thread waits for keeps one slot above the background ones. With the CPU-scaled default the background limit is 4 here, and the wanted cap stayed base.max(2), also 4, so with four background huge compiles running a wanted one queued behind them. The wanted default is now one more than the background limit, which is what it was when that limit was 1. Found by D3D12.X: the pieces of a split program read their slab from a root CBV #2633's a_title_thread_does_not_wait_behind_a_background_whole_build_waiting_for_its_turn with both merged; that test passes with XCL_HUGE_PSO_CONCURRENCY=1 or XCL_HUGE_PSO_WANTED_CONCURRENCY=5 on the same exe. The new unit test a_wanted_huge_compile_has_a_slot_above_the_background_ones fails on f22f239 and passes on d27d471.

Tested

  • Ryzen 9 9950X (32 logical CPUs, so 4 slots with this default; the table below sets the count by hand), RTX 5070 Ti (NVIDIA 610.74), 31 GiB RAM, 85 GiB commit limit, Windows 11 build 26200, release, DXC 1.9.2609.

  • Cold driver builds of the seven pipelines as the title emits them (byte-identical to the title's cache), one fresh process per level, implicit caches off, nothing else running:

    At once Wall, all seven Longest build Peak process commit Least commit available
    1 87.5 s 16.0 s 0.81 GiB 69.5 GiB
    2 56.0 s 20.4 s 1.27 GiB 69.7 GiB
    4 38.8 s 24.6 s 1.88 GiB 69.1 GiB
    7 26.3 s 26.3 s 2.86 GiB 67.5 GiB

    Each build gets slower as more run together (1.65× at 7), but the wall time keeps falling. At 7 it equals the longest single build. Commit grows by about 0.34 GiB per extra build. On this machine 7 was still the fastest. @milesah3ad's 16-thread machine took 656 s at 7 against 604 s at 4, for more memory, so the default stops at 4.

  • AMD RDNA4, measured by @bielfreedom (comment), RX 9070 XT, Ryzen 7 7700 (16 logical CPUs, so 4 slots with this default), 32 GB RAM. Seven direct compute programs of 701–970 KB, driver builds only: 395–419 s one at a time, 156–159 s at 4 (2.6×), 127–131 s at 7 (3.2×). Peak process private bytes rose from 4.1 to 17.9 GB, about 2.3 GB per extra build, against about 0.34 GiB on NVIDIA. On AMD, then, the free-commit check before each gated build (3 GiB, counting what the builds already admitted reserve) carries the weight of keeping a smaller machine safe.

  • A cold title run under Linux (Wine + vkd3d-proton) on an RTX 4070, measured by @Royalflamejlh (comment), Ryzen 9 9950X3D (32 threads), on 55eafb2 with XCL_DIRECT_DXIL=1, NVIDIA's disk cache off, 100 s: up to 4 big compiles went through the gate at once and none waited, against 1 at a time and 222–225 s of summed waiting on main. The 14 big compiles that every run finished were done by 41.5 s, against 95.0 and 90.4 s on main, though each took about 1.5× as long in the driver. Of the two runs with this change, the second hit a crash at 19.1 s, the one D3D12.X: title texture reads outside the coherent window use the safe copy #751 fixes, which main runs there have had too; its numbers are left out.

  • Independent memory measurement by @tiagonleal (comment), RTX 5070 Ti, 32 GB: whole builds of a medium size bucket add about 0.35 GiB of peak memory per extra worker, from 1 to 8 at once, matching the 0.34 GiB above. With 8 at once on their large bucket (up to 1.8 MB), free RAM stayed above 16 GB. Wall time fell 3.8× (medium) and 2.5× (large), while summed driver time rose about 1.65×.

  • Lib tests of d27d471 by @upipibi (comment), RTX 3070 8 GB (driver 616.56), Ryzen 9 5950X (32 logical CPUs: 4 background slots, 5 for compiles a title thread waits for), debug, on the PR's base 06c9f55: cargo test -p xcl --lib (with hle::xaudio2 skipped, which hangs there on main too) 1191 passed, 0 failed, 26 ignored, the same 25 SKIPPED lines from 15 tests; a_wanted_huge_compile_has_a_slot_above_the_background_ones and the 15 big_compile_tests, 3 runs each: all passed. No title run.

  • cargo test --workspace -- --test-threads=4 (debug, DXC 1.9.2609) on d27d471: 1269 passed, 0 failed, 46 ignored (the xcl library: 1200 passed, 26 ignored), with the same 25 SKIPPED notices from 15 tests (21 no native wave64, three refused per-lane cases, one no heap windows).

  • cargo test --workspace -- --test-threads=4 (debug) on f22f239, on main 06c9f55: 1268 passed, 0 failed, 46 ignored (the xcl library: 1199 passed, 26 ignored), with 25 SKIPPED notices from 15 tests (21 for no native wave64, three refused per-lane cases, one for no heap windows). main 06c9f55 in the same setup: 1265 passed, 0 failed, 46 ignored, the same 25 notices. Both reservation tests fail with the check left without the pool (the old behaviour) and pass with it.

Regression run

scripts/smoke.ps1 through our pair runner, 60 s each, main at b49be18 (a newer main than this PR's base 06c9f55, which it contains) then this PR's head d27d471, release builds from clean trees, on the RTX 5070 Ti under Tested, as one queue job beside other work, with XCL_DIRECT_DXIL=1 set for the pair. Both runs got the full 4095 MB coherent window. The earlier 120 s pair on f22f239 (1333 / 1313 frames, peak commit 29863 / 29957 MB) is superseded by this one.

main:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1200 (PresentX 1200)
presents per 2 s (last 3): 4 4 2
device removals: 0
crashes: 0
peak commit: 24762 MB

PR:

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

PR vs main: 1215 / 1200 frames (101 %), peak commit 23142 / 24762 MB (93 %); device removals 0 and crashes 0 on both.

The change only matters when several huge pipelines are built cold at once, which a warm driver cache on this machine mostly hides, so this pair checks that nothing regresses.

Not tested

  • A title run on Windows that shows the gain: on this machine the driver's own cache already held six of the seven from earlier runs (49–122 ms each), and clearing it would touch a system-wide cache. The gain applies to a cold machine.
  • First-use binds. A pipeline the title is already waiting for skips the gate, so this doesn't change a chain of first-use waits.
  • A title run on AMD, and machines with less RAM or commit than the ones above. A 16 GB machine with 16 logical CPUs gets 4 slots, which on AMD could mean about 7 GB more commit for builds, as far as the 3 GiB check allows.
  • The preload has (compile_threads() / 4).clamp(2, 4) workers (pso_async.rs), the same at most 4 as this default. This PR leaves that count alone.

AI use

OpenAI Codex (GPT-6.2) wrote the change and the test. Claude Code (Claude Opus 5.5) wrote the commit reservation and its tests. Claude Code (Claude Opus 5.5) helpers ran the concurrency measurement, and Claude Code wrote this description and opened the PR. Claude Code (Claude Opus 5.5) found the wanted-slot case on an integration branch and wrote d27d471 and its test.

🤖 Generated with Claude Code

@bielfreedom

Copy link
Copy Markdown

AMD RDNA4 data for #2098. The speed-up from building huge pipelines side by side carries over to AMD: 3.2× at 7 at once. The memory cost does not. Each extra concurrent build adds about 2.3 GB of process private bytes on the AMD driver, against 0.34 GiB on NVIDIA in the description. So the commit check carries more of the weight on AMD.

Setup

  • GPU: RX 9070 XT 16 GB (RDNA4), AMD driver 32.0.32029.2010.
  • CPU and memory: Ryzen 7 7700 (16 logical CPUs, so 4 slots with this PR's default), 32 GB RAM, Windows 11, release.
  • Build: main 8e87fc7 plus a local logging patch that times each CreateComputePipelineState. This is not this PR's head: the measurement drives the offline builder's XCL_PIPELINE_THREADS, not the title's slot gate, so it measures the driver's side of the change.

Method

  • Seven retail compute programs on the direct route (XCL_DIRECT_DXIL=1), 701–970 KB of direct DXIL, none of them split. They are not the same seven cascade-shadow programs as in the description, but the same size class.
  • xcl shaders --precompile --only cs --pipelines from a filled DXIL cache, so only the driver runs. XCL_PIPELINE_THREADS was set to 1, 2, 4 and 7.
  • XCL_PSO_DISK_CACHE=0, with a fresh exe name for every run, because the AMD driver's own cache is keyed on the exe file name (A26).
  • Two rounds; nothing else running.
  • "Free commit" is the system's lowest FreeVirtualMemory during the run, sampled every 0.5 s.

Results (round 1 / round 2; 7 of 7 made and 0 refused in all eight runs)

At once Wall, all seven vs 1 Longest build Peak process private Least free commit
1 395 / 419 s 1× 67 s 4.1 GB 44.5 GB
2 261 / 270 s 1.54× 78 / 83 s 6.5 / 6.9 GB 42.0 GB
4 156 / 159 s 2.6× 83 s 11.2 / 11.4 GB 37.4 GB
7 127 / 131 s 3.2× 98 / 100 s 17.8 / 17.9 GB 30.8 GB
  • Single builds take 34–67 s each here, against about 16 s on the 5070 Ti. On AMD the same scaling saves far more wall time: 4 slots, this PR's default on a 16-thread CPU, save about 4 minutes on these seven programs.
  • The slowdown per build is similar to NVIDIA's (longest build 1.5× at 7, against 1.65×). At 7 the wall time is again close to the longest single build.
  • Memory: from 1 to 7, peak private rose from 4.1 to 17.9 GB, about 2.3 GB per extra build. Free commit fell by 13.7 GB, consistent with that.

Read / inference

  • On AMD the default of one slot per 4 logical CPUs looks right for speed. A 16-thread desktop gets 2.6×.
  • It makes the free-commit check before each gated compile the thing that keeps a smaller machine safe. If that check asks for about 3 GiB per build, it covers the ~2.3 GB seen here for 0.7–1 MB programs. It may not cover larger direct programs: the first build alone was ~4.1 GB.
  • A 16 GB machine with a 16-thread CPU would get 4 slots, about +7 GB for the builds next to the title's own commit. I couldn't test that machine.

Not tested

  • This PR's head in a title run.
  • Larger direct programs (1–4 MiB).
  • Machines with 16 GB RAM.
  • Other AMD generations.

AI use: Claude Code (Claude Opus 5.5) ran the measurement and drafted this. Counts and timings only, no game data.

@Kalmarv

Kalmarv commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@bielfreedom thanks, this is the measurement I was missing. 2.6× at 4 slots on RDNA4 supports the default. 2.3 GB per extra build, against 0.34 GiB on NVIDIA, means the free-commit check has to stay as it is. I've added both to the description, and the 16 GB, 16-thread case to Not tested.

It also changes a follow-up. I was about to shrink that check's headroom to scale with program size, using the NVIDIA figure, as part of a fix for #505 (a background build that holds its slot and waits for free commit forever). With your numbers that would have been unsafe on AMD. So the follow-up keeps the 3 GiB headroom and only bounds the wait.

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

@futurepro62

futurepro62 commented Nov 25, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head 55eafb2 (on its base cbc296a).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1143 passed, 0 failed, 44 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: default_huge_pso_slots_scale_with_available_cpus.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1154 passed, 0 failed, 46 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 6020a33 too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests, const_and_null_mask_operands_agree_with_hlsl_on_the_gpu and mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

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

AI use

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

IvyNotFound added a commit to IvyNotFound/xcl that referenced this pull request Nov 25, 2026
@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@JoaoPauluu

Copy link
Copy Markdown

A regression run under Wine on Linux on the retail title: no device removal, no crash, frames level with main (1387 here; 1360 and 1374 on the two main runs). This title's pipelines in 60 s are not in the huge class as far as the log shows, so the new slot count is not seen; this is a regression run only. The new test default_huge_pso_slots_scale_with_available_cpus passes under Wine (this CPU has 12 threads).

Tested

Regression run

main (first run):

xcl-smoke v1
commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1360 (PresentX 1360)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

this PR:

xcl-smoke v1
commit: 55eafb20c1da8dbd90bf1816b047bed081e479d3
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1387 (PresentX 1387)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

The second main run: 1374 frames, exit: 0x0, no device removal, no crash. Under Wine, peak commit reads 0 MB, so these blocks do not check memory.

Not tested

  • the whole test suite on this head, huge pipeline builds, other CPU counts, native Windows.

AI use

  • Claude Code (Claude Opus 5.5) built both commits, ran the tests and the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.

@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
@Royalflamejlh

Copy link
Copy Markdown
Contributor

Linux (Wine + vkd3d-proton) + NVIDIA test of 55eafb2 on a 32-thread machine, 100 s runs of the title with XCL_DIRECT_DXIL=1, the preload on (the default), no driver blobs and NVIDIA's disk cache off (XCL's DXIL cache warm): with it up to 4 big compiles went through the gate at once and none waited for a slot; without it 1 at a time (2 of 2 runs each), with 222 to 225 s of waiting in all. In the one run with it that did not fault, the 14 big compiles that all four runs finished were done by 41.5 s, against 95.0 and 90.4 s without; each took about 1.5 times as long in the driver (126.1 s in all, against 85.9 and 87.2 s), and 24 finished in the 100 s against 15 and 14.

Setup: Fedora 44, Wine 11.21 Staging, Ryzen 9 9950X3D (32 threads), 62 GB RAM, RTX 4070 12 GB (driver 615.71.09). vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175; its dxil-spirv is the branch legacy-struct-remove at e084e35c with master's 061225da and three patches from #1269, as on #1805. 55eafb2 merged on main f5c5bdf with #684, release, x86_64-pc-windows-gnu; XCL_SKIP_BINK=1, 100 s. Retail title 1.0.2.1, the first-run screens completed once and no story progress. Order: without, with, with, without.

Tested

compiles of 256 KiB of DXIL or more, gated (waited N ms) lines only main + #684 (2 runs) with 55eafb2 (1 run; the run that faulted in brackets)
finished in the run 15, 14 24 (16)
most at once 1, 1 4 (4)
time waiting at the gate, summed 224.9, 221.6 s 0 (0) s
time in the driver, summed 93.0, 87.2 s 290.3 (122.8) s
the 14 all four runs finished: last one done 95.0, 90.4 s 41.5 (37.5) s
the same 14: time in the driver, summed 85.9, 87.2 s 126.1 (107.5) s
  • The second run with it faulted at 19.1 s in tiling::Chain::detile_level ← title_textures::subresources (msvcrt.dll+0xa52b, a read), the fault D3D12.X: title texture reads outside the coherent window use the safe copy #751 fixes, which runs of ours without this change have had too; it stopped presenting at 20.0 s and the title took its second exit, game+0x2215c35, at 50.5 s. Its numbers are in brackets and left out of the comparison; whether this change makes the fault more frequent, 2 runs cannot say.
  • Of the 9 compiles it finished that neither run without did, 7 were of 0.73 to 0.99 MB of DXIL at 15 to 21 s each in the driver; that, more than the slowdown at 4 at once, is why its driver time summed to 290.3 s.

Read

  • pso_async.rs:353: the preload has (compile_threads() / 4).clamp(2, 4) workers, 4 here. In these runs every gated compile was on one of 4 threads, so no more than 4 of the 7 slots were ever used. The 31 xcl-pso-{k} workers (pso_async.rs:181) can take slots too, but did not here. Is the preload meant to stay at 4, or should it follow the new default?

Not tested: memory: the harness kept no free-memory samples in these runs and under Wine XCL's commit counter reads 0, so what 4 driver compiles at once cost here is not known (the description measured 0.34 GiB per extra build on NVIDIA under Windows); the standard dxil-spirv; a machine with fewer threads; Windows; AMD and Intel.

AI use: Claude Code (Claude Fable 5.2 read the diff and built the trees; Claude Opus 5.5 ran these runs and wrote this comment).

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

@Kalmarv

Kalmarv commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

@Royalflamejlh, thanks for the Linux run. I've added it to the description.

On the preload: this PR doesn't change it, and it should stay at 4 here.

  • Why it's capped: the preload's workers run at the lowest priority while the title is loading. Its count, (compile_threads() / 4).clamp(2, 4), decides how many title-independent builds compete with the title for CPU.
  • What the slots are for: the slots above 4 are for the xcl-pso-* workers' builds of pipelines the title has created but isn't waiting for yet. A build a frame is already waiting for skips the gate.
  • Why not raise it here: that would add up to three more huge builds at once during loading. Each costs about 0.34 GiB of commit on NVIDIA and about 2.3 GB on AMD (@bielfreedom's numbers above), so it needs its own measurement on a smaller machine.

I've noted the 4-worker limit under Not tested. Tying the preload to the slot default is a possible follow-up, but nobody has started it.

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

@milesah3ad

Copy link
Copy Markdown
Contributor

The 16-thread / 16 GB NVIDIA case from Not tested: on a Ryzen 7 9800X3D + RTX 5080, building huge pipelines side by side helps, but less than on the 9950X, and it peaks at 4. 4 at once was 1.79× faster than one at a time. 7 at once was slower than 4 (1.65×), because each build took about 3× as long. The PR's default here is (16 / 4).clamp(1, 7) = 4, the best of the four settings I measured. No game files were used.

Setup: RTX 5080 16 GB, driver 621.24; Ryzen 7 9800X3D (8 cores, 16 logical CPUs); 64 GB RAM; Windows 11 Pro 26300; rustc 1.100.0, release; main 568e7db. The default test also ran on this head, 55eafb2: default_huge_pso_slots_scale_with_available_cpus passed.

Method (a local probe, not pushed):

  • Seven synthetic compute programs from the nv680 generator (base / loop / wave / atomic / atomic64 shapes, split wave64, 4 memory windows), translated by the direct DXIL translator (dxil::kernel::translate_compute) as with XCL_DIRECT_DXIL=1: 569, 680, 723, 732, 774, 866 and 921 KB, inside the PR's 520–990 KB class.
  • One fresh process per run. All seven were built by K threads (CreateComputePipelineState, the ABI root signature), with private bytes and system commit sampled every 200 ms.
  • New seeds for every run, so the DXIL bytes differ between runs and nothing comes from the driver's cache. Two runs per K, in the order 1, 7, 4, 2, 2, 4, 7, 1.
at once wall, all seven (two runs) mean vs 1 at a time longest build mean per build peak private per added build
1 1,097.6 / 1,069.7 s 1,083.7 s 1.00× 231.7 / 235.4 s 155 s 3,595 / 3,914 MB –
2 770.0 / 720.4 s 745.2 s 1.45× 329.2 / 276.5 s 183 s 4,628 / 4,615 MB ~870 MB
4 588.6 / 619.8 s 604.2 s 1.79× 361.9 / 382.9 s 256 s 5,217 / 6,100 MB ~630 MB
7 667.3 / 645.1 s 656.2 s 1.65× 667.1 / 645.0 s 455 s 7,108 / 7,607 MB ~600 MB
  • Mean per build is the sum of the seven builds' times / 7: 155 s alone, 256 s at 4 at once, 455 s at 7. With 7 on 16 logical CPUs the builds slow each other enough that all seven finish together at the very end, and the batch takes longer than at 4.
  • Memory: about 0.6–0.9 GB of extra private bytes per added concurrent build, against 0.34 GiB in the description. These are different programs, so the size per build isn't directly comparable. Peak private at 7 was 7.1–7.6 GB. System commit rose by 7.0–7.1 GB at 7 and 3.5–4.4 GB at 1.

Reading: on this machine the cpus / 4 rule lands on the best setting, and a fixed 7 would cost time as well as memory. So scaling by CPU count is right for 16-thread machines, not only for memory reasons. The 9950X gain (3.3× at 7) doesn't carry over to 8 cores: here the gain stops at about 1.8×.

Not tested: retail programs (synthetic shapes only, though in the PR's size class and through the direct translator), a title run of this PR's runtime path, AMD, other CPU sizes (e.g. 12 or 24 threads, to see where the knee moves).

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.

@milesah3ad

Copy link
Copy Markdown
Contributor

@Kalmarv for the rebase after #1996 (merged 10:49, now conflicting here): #1996 caps wanted huge builds at XCL_HUGE_PSO_WANTED_CONCURRENCY, default 2, clamped to at least XCL_HUGE_PSO_CONCURRENCY. So with this PR's default of 4 on 16 CPUs, the wanted cap would become 4 too. My 16-thread numbers above bear on that: on the 9800X3D / RTX 5080, 7 huge programs took 745 s at 2 at once (1.45× over one at a time) and 604 s at 4 (1.79×), and 7 at once was slower than 4 (656 s). On this machine, then, 4 for wanted builds gains about 19 % over #1996's 2, for roughly 0.6 GB more private memory per extra build. That trade is what #1996's commit check is there to police. Synthetic programs and one machine only, so treat it as one data point for the default, not a rule.

AI use: Claude Code (Claude Opus 5.5) wrote this from my earlier measurements on this PR.

@Kalmarv

Kalmarv commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@milesah3ad thanks. The rebase onto #1996 is done locally: one commit on 5478c4a, and it merges cleanly with main 1a0bbe3. Only the test hunk conflicted, and both tests are kept.

Here is what it does with #1996's cap. #1996 keeps the wanted cap at max(2, base), at least the base. So with this PR the wanted cap follows the new base: 4 on 16 CPUs, and up to 7 on 28 or more.

Your 16-thread numbers make 7 look too many. 7 at once took 656 s against 604 s at 4, for more memory. So I'm weighing two defaults for the push: the current one bound to 1–7, or a bound of 1–4.

The opposite data point is @b3IKK's RTX 5080 run on #505 (comment). There, two huge-compile slots changed nothing in the title (30 builds finished against 31), because each driver compile itself took 60–103 s.

Kalmarv picks the default today. Then it gets a new suite and smoke pair on the pushed head, and I'll push it.

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

Seven cold cascade-shadow pipelines on an RTX 5070 Ti took 87.5 s at one build at a time and 26.3 s at seven. Default the ordinary huge-build gate to one slot per four available logical CPUs, bounded to 1–4: on a 16-thread machine seven huge programs took 604 s at four builds at once and 656 s at seven. Keep the explicit override and existing free-commit check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Kalmarv
Kalmarv force-pushed the huge-pso-cpu-default branch from 55eafb2 to c3fe7f4 Compare November 25, 2026 14:21
@thehollowedone

thehollowedone commented Nov 25, 2026 •

Copy link
Copy Markdown

Independent Windows check of the current f22f239, superseding my earlier report on c3fe7f4.

Tested: Clean exact-head worktree; Windows 11 build 26300, Ryzen 7 9800X3D (16 logical CPUs), RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11, debug.

  • cargo test -p xcl --lib big_compile_tests -- --test-threads=1: 14 passed, 0 failed, 0 ignored. This includes the shared commit-reservation test across ordinary and giant compile lanes and the eight-worker low-commit race.
  • workers_racing_for_low_commit_never_overcommit passed in 10 additional single-test runs.
  • cargo build --workspace: passed.
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1,268 passed, 0 failed, 46 ignored; 25 GPU skip notices. All 14 compile-admission tests passed in this run.

Not tested: A current-head retail smoke pair, a cold driver-cache compile, actual title compile throughput, AMD hardware, or lower-memory hardware. The PR description still shows a smoke pair for the prior head; the author is preparing a current-head pair. These synthetic tests establish reservation behavior, not a measured title speedup.

AI use: Codex (GPT-6.2 Sol) reviewed the current diff, ran the tests on this machine, and drafted this report. AI-assisted.

@amazedturnip

Copy link
Copy Markdown
Contributor

Independent AMD Radeon (native wave64) verification of exact head c3fe7f4e6ff7c7f3eed330e8ee79c9a218ff8c6d (clean detached worktree, compared against main 3f4495a2b325).

Tested

  • Hardware / OS / Rust: AMD Ryzen 7 9800X3D 8-Core Processor, Windows 11 Pro 10.0.26100 (Build 26100), rustc 1.94.1 (e408947bf 2026-03-25), stable-x86_64-pc-windows-msvc
  • Adapter: AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64) (XCL_ADAPTER=radeon, native wave64)
  • Targeted unit tests (debug): cargo test -p xcl --lib hle::d3d12x -- --test-threads=2 — 218 passed, 0 failed, 2 ignored (exit 0)

Regression run (scripts/smoke.ps1 -Seconds 60, release build, XCL_ADAPTER=radeon)
main:

xcl-smoke v1
commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09
gpu: AMD Radeon(TM) Graphics
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 782 (PresentX 782)
presents per 2 s (last 3): 34 2 2
device removals: 0
crashes: 0
peak commit: 13996 MB

PR:

xcl-smoke v1
commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09
gpu: AMD Radeon(TM) Graphics
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 675 (PresentX 675)
presents per 2 s (last 3): 26 0 17
device removals: 0
crashes: 0
peak commit: 15117 MB

Not tested

  • Full workspace test suite and NVIDIA wave32 adapter (verified targeted subsystem tests + 60 s retail smoke on AMD Radeon native wave64 only)

AI use

  • Antigravity CLI orchestrated worktree checkout, local build/test/smoke execution, and summary formatting; all test and smoke outputs above are verbatim from this machine.

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

P1 concurrent admission does not reserve commit. CPU-based default permits up to four ordinary huge compiles, but big_compile_turn only checks currently free 3GiB; workers can all observe it before driver allocations become visible, then each allocate ~2.3GiB (per PR AMD evidence). Giant lane can add another unreserved build. Reserve global headroom/require available >= headroom*(in_flight+1) atomically and add low-commit multi-worker test. README also wrongly claims every gated compile checks 3GiB; wanted compiles bypass it and their cap rises too.

With several huge compiles allowed at once, each checked only that 3 GiB
was free when it was admitted. The workers could all see the same free
commit before any driver allocation showed, then take about 2.3 GiB each.
Each admitted compile now reserves its headroom (big_compile_headroom) in
a pool shared by the ordinary and the giant lane until it finishes, and a
background compile is admitted only when its headroom plus the pool is
free: same-size compiles need headroom * (in flight + 1). The check and
the reservation are taken under one lock. A wanted compile still skips
the check, but reserves. Once a compile's own allocations show, they are
counted twice: on a machine with little commit, fewer huge compiles run
at once.

The README now says which compiles check for commit and that wanted ones
may run up to XCL_HUGE_PSO_WANTED_CONCURRENCY.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Kalmarv

Kalmarv commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, you're right: four workers could all pass the same 3 GiB check before any driver allocation showed up in the free commit.

f22f239 reserves it. Each admitted huge compile adds its big_compile_headroom (3 GiB, or 512× its DXIL above 6 MiB) to one pool shared by the ordinary and the giant lane, and gives it back when it finishes (SlotGuard drop). A background compile is admitted only when its own headroom plus everything already reserved is free, so same-size compiles need headroom × (in flight + 1), as you suggested. The check and the reservation happen under one lock, so two workers can't both take the last room. The giant lane's compile counts in the same pool. A wanted compile (one a title thread waits for) still skips the check, but it reserves too, so background compiles after it count it.

Once a running compile's own allocations show up in the free commit, its reservation counts them a second time. That is deliberate, on the conservative side: on a machine with little commit, fewer huge compiles run at once, never more. With plenty of commit (the machines in the description had 67 GiB or more available) nothing changes.

Tests (CPU only, no driver):

  • admitted_compiles_reserve_their_commit_over_both_lanes: 7 GiB free, 3 GiB each, four slots open. Two are admitted and the third waits without holding a slot until one finishes. A 5 GiB giant reservation blocks a 3 GiB ordinary compile, and a wanted compile admitted at zero free commit then blocks a background one that would fit on its own.
  • workers_racing_for_low_commit_never_overcommit: eight workers released at once with 7 GiB free and four slots never have more than two inside.

Both tests fail when the check leaves the pool out (commit_free(need), the old behaviour), and both pass with it.

Why the extra slots matter: in one of our own 600 s title runs (main 6d12f58 + #1826, cold graphics builds, main's default gate: one background slot, two for builds a title thread waits for), after the first 120 s, 138 gated graphics builds of 256 KB or more took 615 s of driver time and 1151 s waiting for a huge-build slot (for example, a 7.4 s compile after a 17.5 s wait). The title thread spent 346 s in execute_indirect → resolve_wait_for on them. Peak commit was 31.7 GB on a 64 GB machine. The run is gate-bound, and the reservation keeps the extra slots within the commit there is.

README: fixed as well. The commit check is for background compiles only. Wanted ones skip it (they still reserve) and run up to XCL_HUGE_PSO_WANTED_CONCURRENCY at once (default: the concurrency, at least 2).

cargo test --workspace -- --test-threads=4 (debug, RTX 5070 Ti) on f22f239: 1268 passed, 0 failed, 46 ignored (the xcl library: 1199 passed, 26 ignored), with the same 25 SKIPPED notices as main. The 14 big_compile_tests pass. The 120 s smoke pair on the new head is queued, and the description gets it when it lands.

AI use: Claude Code (Claude Opus 5.5) wrote the change and tests, ran the suite, and drafted this reply.

With the CPU-scaled default, huge_pso_concurrency is 4 on a 16-thread
machine while huge_pso_wanted_concurrency stayed base.max(2), also 4: with
four background huge compiles running, a build a title thread waits for
had no slot of its own and queued behind them. The wanted default is now
one more than the background concurrency, as it was when that was 1.

Found by xcl-dev#2633's a_title_thread_does_not_wait_behind_a_background_whole_
build_waiting_for_its_turn, which fails with this branch merged and passes
with XCL_HUGE_PSO_CONCURRENCY=1 or XCL_HUGE_PSO_WANTED_CONCURRENCY=5.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Kalmarv

Kalmarv commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Pushed d27d471: a build a game thread waits for keeps one slot above the background ones.

With this PR's CPU-scaled default the background limit is 4 on a 16+ thread machine, while huge_pso_wanted_concurrency stayed base.max(2), also 4. So with four background huge compiles running, a compile the title waits for had no slot of its own and queued behind them. #2633's a_title_thread_does_not_wait_behind_a_background_whole_build_waiting_for_its_turn shows it with both merged: it fails (the title thread waits 5 s) and passes on the same exe with XCL_HUGE_PSO_CONCURRENCY=1 or XCL_HUGE_PSO_WANTED_CONCURRENCY=5. The wanted default is now base + 1, as it was when the base was 1. New test a_wanted_huge_compile_has_a_slot_above_the_background_ones: fails on f22f239, passes on d27d471. Suite and a new smoke pair on d27d471 are in the description (1269 passed, 0 failed, 46 ignored; 1215 / 1200 frames vs main b49be18).

Claude Code (Claude Opus 5.5) found the case, wrote the fix and test, and ran these.

@upipibi

upipibi commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

NVIDIA test report for d27d471: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug. Head tested as-is on its base 06c9f55 (older than main b49be18, so the lib count is lower than on current heads). Ryzen 9 5950X (32 logical CPUs: the new default gives 4 background slots and 5 for compiles a title thread waits for).

  • cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4 (the hle::xaudio2 tests hang on this machine, on main too): 1191 passed, 0 failed, 26 ignored; 25 SKIPPED lines from 15 tests (21 no native wave64, three refused per-lane cases, one that cannot turn off the driver cache without Developer Mode).
  • a_wanted_huge_compile_has_a_slot_above_the_background_ones, --test-threads=1 --nocapture, 3 runs: 3/3 passed, 0 SKIPPED.
  • default_huge_pso_slots_scale_with_available_cpus, admitted_compiles_reserve_their_commit_over_both_lanes and workers_racing_for_low_commit_never_overcommit, the same way, 3 runs each: 3/3 passed each, 0 SKIPPED. The whole big_compile_tests module (15 tests), 3 runs: 15/15 passed each time.
    Lib tests only; no title run.
    AI-assisted (Claude Code, Claude Opus 5.5).

@Kalmarv

Kalmarv commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @upipibi: a 3070 with 32 logical CPUs is a useful second machine for the 4 + 1 slot split. Added to the description under Tested.

@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

@Prime1997 Prime1997 mentioned this pull request Nov 26, 2026
Osanchez pushed a commit to Osanchez/xcl that referenced this pull request Nov 26, 2026
Runs 1-6 on an RTX 5080 showed that a draw binding an unbuilt pipeline
builds it on the title's thread (about 3.7 s each, back to back), so the
title presents nothing after its loading screen. The entry holds the
approved spec: adopt xcl-dev#2579, xcl-dev#2098, xcl-dev#2698 and xcl-dev#751 through the gate, then
units U1-U9 (draws wait inside a shared 100 ms frame budget and never
build, compute waits for a worker, a graphics lane and RAM-scaled slots
at the gate, replaced parked workers, an end watchdog, telemetry).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018RbZY1Ag73eDeCUZHpW3is
Osanchez pushed a commit to Osanchez/xcl that referenced this pull request Nov 26, 2026
Commit:   d27d471
Reviewer: Claude Code (Opus 5.5, claude-opus-5-5), Opus worker, full read (clean)
Review:   sha256 525d26b0234c9461c9a680386b203c7662f688d59c5dbc20381346daf12e7caa
Osanchez pushed a commit to Osanchez/xcl that referenced this pull request Nov 26, 2026
While a title waited for compute pipelines it had put off, the one slot
for big driver compiles was held for 62 of 90 s by a speculative preload
of an earlier run's program, and graphics builds queued behind compute.

Graphics pipelines take their own lane (GRAPHICS_COMPILES) with the same
limits and the shared commit reservation; 4 MiB and larger still go to
the giant lane. A preload that nobody waits for takes a slot only while
no other preload holds one of that lane and no wanted build is waiting.
The default slot count also scales with memory: one per 12 GiB of RAM on
top of the CPU rule of xcl-dev#2098, so a 16 GB machine keeps one.

Tested on Windows 11, RTX 5080 (63 GB RAM), driver 32.0.16.2140, together
with the draw change before it:
cargo test -p xcl --lib -- pso_async:: bind:: list_x:: big_compile host::
96 passed, 0 failed; whole suite 1624 passed, 4 failed (the dxil
fuzz_validate_and_gpu_0..3 that fail on this GPU without the change),
47 ignored, 44 SKIPPED lines. Not tested on AMD or on a machine with
less than 48 GB. Unit U6 of the stall-fix entry in decisions.md.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018RbZY1Ag73eDeCUZHpW3is
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.