Skip to content

D3D12.X: compute pipelines are built ahead of their first bind - #889

Open
isaacwingate wants to merge 1 commit into
xcl-dev:mainfrom
isaacwingate:compute-pso-preload
Open

isaacwingate wants to merge 1 commit into
xcl-dev:mainfrom
isaacwingate:compute-pso-preload

Conversation

@isaacwingate

@isaacwingate isaacwingate commented Nov 24, 2026 •

Copy link
Copy Markdown

A lazy compute pipeline is built at its first bind, on the title's thread. The bind has to wait (a skipped dispatch corrupts what it computes), and on an NVIDIA GPU the driver takes seconds for a big translated compute shader. #690 preloads only the shaders an earlier run used, so every compute pipeline new to a run is still compiled in the middle of a frame. With this change every compute pipeline goes to the preload workers when the title makes it, queued behind the earlier run's ones. Graphics pipelines stay lazy. XCL_PRELOAD_COMPUTE=0 turns this off and keeps #690's preload. Part of #505: testers' runs on several GPUs (below) show it moves early compute builds off the title's threads, but the world load still stops on pipelines the title makes and binds at once.

Open PRs that change pso_async.rs too: #828 (the same preload function: a textual conflict), #533, #267, #754, #628. Each limits or reorders waits; none builds a pipeline before its first use.

What is in it

  • crates/xcl/src/hle/d3d12x/pso_async.rs:
    • submit_lazy sends compute pipelines to the preload queue too. The queue has two lines: an earlier run's pipelines first, then the other compute ones.
    • A bind that comes first still builds or waits as before.
    • XCL_PRELOAD_COMPUTE=0 leaves compute pipelines to their first bind, as before this PR. XCL_PSO_PRELOAD=0 would also turn off D3D12.X: pipelines an earlier run used are built ahead of their first use #690's preload.
    • Tests:
      • a_compute_pipeline_is_built_ahead_of_its_first_bind. It fails without the change: the compute pipeline is still pending after 10 s.
      • xcl_preload_compute_0_leaves_compute_pipelines_to_their_first_bind, which runs itself as a child process with the variable set.
  • Since the first version: rebased onto main 1d027e5, and the XCL_PRELOAD_COMPUTE switch added (@frozht's request, for its memory cost).

Tested

  • NVIDIA GeForce RTX 5080, driver 32.0.16.2124, i9-12900K, Windows 11 build 26300, rustc 1.100.0; tests in debug, runs in release.
  • cargo test --workspace -- --test-threads=4 on a39c399: 961 passed, 0 failed, 43 ignored. The 23 SKIPPED lines:
    • no wave64: the wave64 forms of the lower / lower_dxil GPU tests, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware
    • refused: the wave32 per-lane cases of f16_programs_on_the_gpu / f32_programs_on_the_gpu
    • 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
  • The retail title of Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505, XCL_NETWORK=0, 240 s timed runs, with D3D12.X: log how long a bind waits for a pipeline still being built #899's wait counter (on the first version, main e50836b / 1ec4c98):
    • without this, 16 compute binds built their pipeline on a title thread. They took 3–23 s each, 92.7 s in all, on five threads within 10 s, and the title's hang watchdog ended the run at 125 s.
    • with this, 1 compute bind waited, for 2 ms.
  • Testers' reports in this thread:
    • RTX 4080, 5070 Ti, 5080, 5090, 3060, 3070 Laptop, 5060 Laptop; RX 9060 XT; RX 7900 XT under Wine.
    • They agree that the early builds leave the title's threads.
    • None of them got past the world load: there the title makes and binds new compute pipelines at once. On the 3070 Laptop, the three preload workers were held by big_compile_turn.

Regression run
Both with XCL_COHERENT_MB=4095, one after the other, with no input, so both stay in the title's menus.

main:

xcl-smoke v1
commit: 1d027e5c76c9a86a7ee2ca1cc677edf0be95d331
gpu: NVIDIA GeForce RTX 5080
title: 8a66b2b2
seconds: 90
exit: 0x0
frames shown: 2535 (PresentX 2535)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16900 MB

PR:

xcl-smoke v1
commit: a39c3992c7a45baf73e374616e4e9c718f533887
gpu: NVIDIA GeForce RTX 5080
title: 8a66b2b2
seconds: 90
exit: 0x0
frames shown: 2512 (PresentX 2512)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17943 MB

Not tested

  • AMD and Intel GPUs myself (see the testers' reports above); other titles.
  • A run that gets through the world load: this is one part of Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505, not all of it.
  • Memory cost:
    • Compute pipelines built ahead stay in the driver. Commit went up 1 GB in the regression run, and 2.3 GB at the world load in an RTX 4080 report.
    • Under Wine/RADV, @frozht measured 7–10 GB more host memory over 10 minutes.
    • XCL_PRELOAD_COMPUTE=0 turns the build-ahead off. There is no byte or count budget: the size is only known after DXC.
  • A run with XCL_PRELOAD_COMPUTE=0 on the retail title: the switch is covered by its test only.

AI use

  • Claude Code with Claude Opus 5.5: found the cause (profiling the title's threads and the counter on resolve_wait), wrote the change and the tests, ran the tests and the runs, and wrote this description.

🤖 Generated with Claude Code

@emirduran707

emirduran707 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

AMD RDNA4 test report for e1d3b9d (this PR's head, on main 1ec4c98).

Correction: an earlier version of this comment described a retail-title run as made with this PR. My run script pointed at a main build (d5442d2), so that run did not test this PR. I removed it. The run below is with this PR's build (xcl.exe built from e1d3b9d in its own worktree; I checked the path before launching).

Tested

What the log shows:

  • Built ahead (this PR): the preload workers xcl-pso-pre-0/1 built 512 pipelines ahead of their first use.
  • World loading (presents drop from ~116 s): the other 4 long builds ran on title threads (70–100 KB, 1.2–3.9 s, at 142–172 s). Presents fell to 0–19 per 2 s.
  • No presents from 172 s; the title's watchdog ends it at 197.7 s (+0x23cf683).
    • At that point three title threads wait in SetPipelineState → pso_async::resolve_wait (bind.rs:710 → pso_async.rs:387/398), and one thread is inside amdxc64.dll, the driver's compiler.
    • Both preload workers were idle.

So on AMD, with cold caches, this PR moves most of the long driver builds off the title's threads and into the menu time. What is left is the pipelines the title makes during loading: they are still built at their bind, and one of them was still being built when the watchdog fired.

Not tested: more than one run; the same build with warm caches; with #533 / #891; NVIDIA.

Tested and written with Claude Code (Claude Opus 5.5). The runs were made on my machine.

@Xeltax

Xeltax commented Nov 24, 2026

Copy link
Copy Markdown

NVIDIA test report for e1d3b9d (this PR's head, merged without conflicts onto main 077ce40), the retail title of #505.

Tested

  • NVIDIA GeForce RTX 4080 16 GB (driver 621.01, 32-lane waves); Ryzen 9 9900X; 32 GB RAM, 59 GB commit limit; Windows 11 Pro 26200; rustc 1.100.0; DXC 1.9.2609.5; release builds.
  • One run each, same session, warm DXIL and driver-blob caches from earlier runs of the day:
    • XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RUN_SECONDS=240
    • A pressed through XCL_PRESS_AT every 4 s from 20 s (first-run setup already done)
main 077ce40 077ce40 + this PR
first ListX #101 call 66.1 s 76.8 s
last 2 s window with presents 80.0 s 78.0 s
ends with +0x23cf683 at 109.4 s +0x23cf683 at 107.5 s
peak commit 30 378 MB 32 677 MB
compute PSOs built on title threads after 60 s 146 builds, 14.6 s in all 125 builds, 1.9 s in all
compute PSOs built by xcl-pso-pre-* after 60 s 5 builds, 202.6 s in all 8 builds, 59.2 s in all

Not tested

  • More than one run per build, a cold cache, AMD.
  • The test suite on this merge.
  • Which pipeline that execute_indirect wait was for. XCL logs a build only when it ends.

AI use

  • Claude Code (Claude Opus 5.5) ran the builds and the title on my machine, read the logs, resolved the frames and wrote this report.

@isaacwingate

Copy link
Copy Markdown
Author

Thanks both – this matches what I see on an RTX 5080: #889 takes the pipelines made early off the title's threads, and the world load still stalls on pipelines the title makes and binds at once.

@Xeltax the wait at the abort, bind::execute_indirect → resolve_wait, is for a graphics pipeline: draws and ExecuteIndirect wait for graphics builds, although pso_async means graphics pipelines to go on with their stand-in. I have a separate change that lets them (compute is still waited for); on my machine it took the graphics waits during the world load from 25 (33 s in all) to 0. I'll open it as its own PR.

The commit going up (30.4 → 32.7 GB) fits the compute pipelines built ahead staying in the driver; I'll add it to the description.

@IvyNotFound

IvyNotFound commented Nov 24, 2026 •

Copy link
Copy Markdown

Second RTX 5080, same driver: with this PR the title still ends in "GPU Loc Sig", at 96 s; two compute builds take 21 s and 32 s on the workers

Update: the same run with #899's wait log applied on top (e1d3b9d + c3d5429's diff, uncommitted): binds do wait, from 63 s on, mostly building the pipeline themselves

  • Up to 60 s: 6 compute binds found their pipeline not built, 13 ms in all (longest 4 ms).
  • At 63.4–63.6 s the count goes from 9 to 64 compute waits in 0.2 s, 44 of them "built in the call", i.e. no worker had taken them yet.
  • Then 15 compute waits of a second or more on four threads between 66 and 93 s, 98.3 s in all: 2.1–7.7 s each up to 78 s, then 15.5, 13.8, 14.3 and 13.1 s; all "built in the call". Two graphics binds waited for a worker for 2.9 s and 8.8 s.
  • Meanwhile two other threads were in the biggest builds: 994 KB of DXIL in 47.7 s (done at 52.7 s) and 606 KB in 63.4 s (done at 68.8 s).
  • Presents stop at 64 s, the abort is at 93.5 s (+0x23cf683), as in the run below.

My reading: on this machine the build-ahead does not reach these pipelines in time; the title binds them in one burst at 63 s, before a worker has started them, and the binds build them on its threads. Whether the workers were held up by the 48 s and 63 s builds I cannot tell from the log. One run.


Setup: NVIDIA GeForce RTX 5080 16 GB, driver 621.24 (32.0.16.2124); Ryzen 7 7800X3D; Windows 11 25H2 (26200.9974); rustc 1.100.0 MSVC, release; DXC 1.9.2602.17. scripts/smoke.ps1 -Seconds 300 (XCL_NETWORK=0, XCL_ACTIVITY=1), A pressed by hand at the title screen. PR head e1d3b9d as it is (base 1ec4c98), warm DXIL and driver-blob caches from earlier runs.

build last present ends skipped draws / dispatches peak commit
main 09940bb, warm cache 62 s +0x23cf683 ("GPU Loc Sig") at 90 s 0 / 0 28943 MB
#891 8cada26, XCL_PSO_WAIT_MS=50 116 s +0x23cf683 at 145 s 2048 / 8474 28923 MB
this PR e1d3b9d 68 s +0x23cf683 at 96 s 0 / 0 29632 MB
  • The build-ahead works: the pipelines of 1109 shader sets of earlier runs were queued at 2 s and over 1024 were built by 20.4 s (the counter logs powers of two only), and 128 compute pipelines were built on 9 threads in all (118.7 s of builds).
  • The slow ones: 809 KB of DXIL in 21.4 s (done at 38.1 s), 354 KB in 31.7 s (done at 54.5 s), 409 KB in 6.5 s (73.0 s), then 2.2 to 3.6 s each up to 94.6 s. Presents stop at 68 s and the abort follows at 96 s, as on main.
  • I did not have the resolve_wait counter from your runs, so I cannot say whether a bind waited for one of these builds or for something else. No Wait64BitValueX timeout in this run, no device removal.
  • Your run on the same GPU and driver got past the watchdog to D3D12.X: GPU addresses above 2^40 make the title's BVH builder throw ("more than 40b of address set") #585 at 137 s; here it did not. Differences I know of: CPU (7800X3D, 8 cores, against your i9-12900K), and base (main 09940bb for my main row, the PR's own base for the PR run).

Not tested

AI use

  • Claude Code, Claude Opus 5.5: ran the builds and the run, read the log and wrote this report. The numbers come from that run.

wondercrash added a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
Since every compute pipeline is built ahead (xcl-dev#889), the 2-4 lowest-priority preload threads
each take a job, translate it and then queue on the single big driver-compile slot. A bind of
a pipeline whose job a preload thread had taken could not build it itself and waited behind
every big compile queued there in no order: without XCL_PSO_WAIT_MS the title's thread was
held (its 30 s watchdog), with it the pipeline's dispatches were skipped all that time.

A bind now marks the pipeline wanted (resolve_wait/resolve_wait_for, both with and without a
budget). A worker or preload thread knows which pipeline it builds (thread-local, set around
each job) and lists it with the slot while it waits. A free slot goes to a wanted build; the
others do not take it while a wanted one is listed, even if its thread has not woken up since
the bind. The wanted build runs at normal priority while it holds the slot.
Still one slot (each compile ~1.5 GB of commit, wait_for_commit under it); XCL_PSO_WAIT_MS is
unchanged. The slot moves from real.rs to pso_async.rs (big_compile), which knows the binds.

Assisted-by: omp (claude-opus-5-5)
@frozht

frozht commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Test report: retail GTA6 under Wine, with a memory cost.

@SlopTart

Copy link
Copy Markdown

Linux / AMD RDNA3 datapoint.

Merged state: head e1d3b9d onto main 6efdabc, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 721 passed, 7 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows. build-ahead-of-bind compute pipeline tests green (late rerun of the PR dropped from an earlier sweep list).

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

@Filip722

Copy link
Copy Markdown

I tested e1d3b9d on an RTX 5060 Laptop GPU (8 GB, NVIDIA 615.78.08), Intel Core 7 240H and 16 GB RAM, Bazzite 44 and Proton Experimental 11.0-20261112. The private test stack was main 47efa2e plus #640/#782/#793/#820/#1123, vkd3d-proton v3.1 with #257 and dxil-spirv 1dc543f, and the nonlocal texture-pool experiment from #175. Both runs used the same prefix and driver cache, temporary NVMe swap and XCL_PSO_WAIT_MS=5000.

Adding this PR gave 2,444 sampled presents and 80,736 DirectStorage executions with zero storage failures. The last pipeline checkpoint recorded 21,185 draws and 4,096 dispatches with zero skips. The title still exited at its watchdog-associated exception site after 14 consecutive two-second samples without a present. The comparison run reached 2,207 sampled presents and the same exception. This is one pair of sequential Wine runs. I did not isolate the effect of the progressively warmed cache.

OpenAI Codex with GPT-6.2-Sol high assisted with the build, tests and report.

@Kalmarv

Kalmarv commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Test report for #889 at e1d3b9d, merged on main b7aa9f3 (local merge 44097dc), against b7aa9f3 alone. The title is the newer retail one, at its world load; one run each.

Tested

  • RTX 5070 Ti 16 GB (driver 610.74), Ryzen 9 9950X (16 cores, 32 threads), 31 GB RAM (57 GB commit limit), Windows 11 Pro 26200, rustc 1.99.0, release, DXC 1.7.2308 (the Windows SDK's).
  • scripts/smoke.ps1, 300 s, XCL_NETWORK=0, A presses at 14/17/21 s and every 6 s from 125 s, no XCL_PSO_WAIT_MS.
  • Each run had its own new, empty XCL_DXIL_CACHE: no DXIL, no translations, no used-pipelines.txt, no XCL driver blobs.
  • The NVIDIA driver's own shader cache (%USERPROFILE%\AppData\LocalLow\NVIDIA\DXCache) is shared and was not cleared. Programs that earlier runs had built came out of it in milliseconds (see the reading).
b7aa9f3 + #889
first #101 64.1 s 170.6 s
last 2 s window with a present 68.0 s 184.2 s
end null write at game+0x23cf683 (the title's watchdog), 96.4 s the same, 212.9 s
compute pipelines built before #101 9 on the title's threads 213 by the preload workers (188 s in the driver, 24 of them ≥ 1 s), 6 on the title's threads
after #101 94 on the title's threads, 0.6 s in the driver 97 on the title's threads (0.6 s), 12 by the preload workers (23.9 s)
DXIL built, in all 7.8 MB 30.8 MB
peak commit 28.5 GB 28.9 GB

No device removal in either run.

Read

Not tested

AI use

  • Claude Code (Claude Opus 5.5) built the binaries, ran the runs on this PC, read the logs and thread dumps and wrote this report.

@JorgeMJM

JorgeMJM commented Nov 24, 2026 •

Copy link
Copy Markdown

Test report on an 8 GB laptop card, this PR together with #1316: the build-ahead happens, but on this machine the three preload workers are held by the biggest builds and the title builds the mid-size ones itself, one after another, while the 15 xcl-pso-N workers stay idle.

Tested

xcl-smoke v1
commit: 03f98d36cf54a73fbfc219295da636cccec2bd94
gpu: NVIDIA GeForce RTX 3070 Laptop GPU
title: d7b197a1
seconds: 300
exit: 0x0
frames shown: 1501 (PresentX 1501)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 33287 MB

The intro video plays; presents stop at 90 s, at the world's loading screen, and do not come back.

Compute pipeline builds after the last frame (84–300 s), from the compute PSO with the translated console CS lines, by the thread that built them:

built by builds
title threads (five unnamed threads) 138
xcl-pso-pre-0 / -1 90
xcl-pso-0 … xcl-pso-14 0

Build times: median 80 ms, p90 1.9 s, max 73 s, 410 s in all.

  • The preload workers are held by the biggest programs. The three slowest are on them and all three went through big_compile_turn: 1 050 616 B of DXIL in 62.8 s after waiting 34.5 s for the turn, 768 548 B in 61.3 s after 62.6 s, 914 984 B in 73.1 s after 60.5 s. The process is at 30–33 GB of commit on 28 GB of RAM here, so the turn is slow to come.
  • Meanwhile one title thread builds mid-size programs itself, in series: 180–260 KB of DXIL, 12–20 s each (e.g. 17.3, 13.7, 19.7, 15.3, 12.5, 18.6, 13.9 s), on the same thread, in the dumps at 120 and 280 s inside nvgpucomp64.dll. Another title thread waits in execute_indirect → resolve_wait in all three dumps.
  • The main workers have nothing to do: at most one xcl-pso-N is in the driver or DXC in each dump; the rest wait on their empty queue.

Suggestion, if you want it: let an idle xcl-pso-N worker take from the preload queue (or at least the pipelines that do not go through big_compile_turn), so the mid-size ones are built in parallel while the big ones keep their one-at-a-time turn. On this machine that is up to 15 threads on the 12–20 s builds instead of the title's one. I can write it as a commit on top of yours if that is useful; I would not open a separate PR for it.

Not tested: this PR without #1316 on this machine, more than one run, a machine with enough RAM that big_compile_turn does not hold (the picture may differ there), whether the world renders once the builds catch up.

AI use: Claude Code (Claude Opus 5.5) ran the run and the thread-dump analysis on my machine and drafted this.

Edit: I tried that suggestion locally and it does not help here, so please don't take it as is. Idle xcl-pso-N workers taking from the preload queue (all but two, at the lowest priority, uncommitted, on top of the same merge; a unit test that holds the preload workers passes with it and fails without it). In a 300 s run on the same machine the last frame was again at 90 s; after it 93 compute builds instead of 228, 86 of them on title threads, 0 on the xcl-pso-N workers, and the dumps at 200 and 280 s have 10–11 of those workers in help_ahead → build_compute → translated_compute_pso_once → big_compile_turn. They take the big programs too (the DXIL size is only known after DXC) and wait for the turn, so the mid-size ones are still built on the title's thread. To help on a machine like this, the helper would need to know the size before taking the turn, e.g. compile the DXIL first and hand a big one back to wait for its turn without holding a worker; that is closer to the size-based admission claimed as A19 in #1269 than to this PR.

@JRamos1993

Copy link
Copy Markdown

Test report for e1d3b9d on an RTX 5090, four runs back to back with warm caches: the world-load stop stays. In the dumps, the stall is still title threads building compute pipelines in their binds, for programs the preload has not reached yet.

Setup: RTX 5090 32 GB (driver 621.24), i9-14900KF, 64 GB RAM, Windows 11 Pro 26200, rustc 1.97.1 x86_64-pc-windows-msvc, release. This PR merged onto main c160d86 (clean merge). Retail 1.0.2.1, setup done in earlier runs. Each run: XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_PRESS_AT=25:A, 300 s cap. The DXIL and driver-blob caches were warm from earlier c160d86 runs, and each run adds its own blobs.

run compute PSOs: from disk / built last presents stop at +0x23cf683 builds of 1 s or more that ended after the last presents −10 s
1 339 / 133 80 s 109.2 s 1 (10.9 s)
2 344 / 167 84 s 113.1 s 1 (17.5 s)
3 343 / 169 86 s 116.0 s 1 (12.1 s)
4 (with dumps) 353 / 172 76 s 105.2 s 1 (13.8 s)
  • Every run logged "1024 pipelines built ahead of their first use" within about 5 s, and 2048 never.
  • In run 4 the title submitted nothing from 78 s until the stop.

Thread dumps in run 4 (XCL_THREAD_DUMP_AT=92,100, plus the one at the stop; XCL frames looked up with the build's xcl.pdb):

  • The thread at +0x43c3d5d waits in all three.
  • At 92 s, one of the ring worker threads kernelx: XCL_TRACE_WAITS names what the title's waiting threads wait on #924 describes is in bind::execute_indirect → pso_async::resolve_wait. It got its pipeline at 95.5 s, from disk.
  • An unnamed thread that had logged a 13.8 s build at 89.4 s was, at 92 s, building the next one: build_compute → translated_compute_pso → pso::console_to_dxil_in → dxc::compile, a program not translated yet. At 100 s and at the stop it was in NVIDIA's compiler.
  • Another unnamed thread was in NVIDIA's compiler in all three dumps.
  • Neither of those two builds ended before the stop, so the log never names them.
  • A build job runs on an xcl-pso-* thread, or on the title thread that binds the pipeline. So these are title threads building in their binds: the preload had not started those pipelines.

Reading: with this PR, a thousand or more compute pipelines are ready early, but the ones the world load binds next are still new here. The title builds them one after another in its binds, and each run ends about one of them before the watchdog. So on this machine the stop is still compute builds, now on pipelines the queue has not reached yet. That is probably because the big ones go one at a time at the lowest priority. At this rate, "every compute pipeline built before the world load" would take many more runs. I did not get there.

Not tested: more runs; XCL_BIG_COMPILES (#820) with this PR; XCL_PSO_WAIT_MS.

AI use: Claude Code with Claude Opus 5.5 ran the builds and runs, read the dumps and wrote this report.

A lazy compute pipeline was built at its first bind, on the title's
thread: the bind has to wait for it (a skipped dispatch corrupts what it
computes), and the driver takes seconds for a big one. Preloading (xcl-dev#690)
covered only the shaders an earlier run used, so every compute pipeline
new to a run was still compiled in the middle of a frame.

Every compute pipeline now goes to the preload workers when the title
makes it, after the ones of an earlier run (a second, lower line of the
same queue). Graphics pipelines stay lazy: a retail title makes ~58 000
pipelines and only 2 734 of them have a compute shader, so building
these costs little. A bind that comes first still builds or waits as
before, and each build is kept on disk for later runs (driver_cache).

Measured on the retail title of xcl-dev#505 (RTX 5080, driver 32.0.16.2124,
XCL_NETWORK=0, 240 s), counting resolve_wait calls that found their
pipeline not built: without this, 16 compute binds built theirs on a
title thread, 3 - 23 s each and 92.7 s in all, on five threads within
10 s, and the title's hang watchdog ended the run at 125 s. With it, one
bind waited 2 ms; the run went on until XboxBvhBuilder refused an
acceleration structure above 2^40 (xcl-dev#585) at 137 s.

Part of xcl-dev#505.

XCL_PRELOAD_COMPUTE=0 turns off this build-ahead alone: the driver keeps
each compute pipeline built (an AMD GPU under Wine measured 7 - 10 GB more
host memory), and XCL_PSO_PRELOAD=0 would also turn off xcl-dev#690's preload
of the pipelines an earlier run used.

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

Copy link
Copy Markdown
Author

Thanks all for the runs. Pushed a39c399, rebased onto main 1d027e5:

Suite and regression runs on the new head are in the description.

@JRamos1993

Copy link
Copy Markdown

Follow-up to my report above: with 4 big compiles at once on top of this PR, the world load gets 20–40 s further, but the stop stays. In the dumps, the title still waits on compute builds, now for programs whose builds take longer than the watchdog's 30 s. Those never finish within a run, so they never get cached.

Setup: as above (c160d86 + this PR, RTX 5090, MSVC release), plus a local change equivalent to #820: big_compile_turn reads XCL_BIG_COMPILES. I made it locally because #820's branch conflicts with current main. Runs used XCL_BIG_COMPILES=4, six back to back, then one with dumps. Another game was running on the same GPU and CPU during these runs.

last presents stop at +0x23cf683
this PR, runs 1–4 above 76–86 s 105–116 s
with XCL_BIG_COMPILES=4, runs 1–6 96–125 s 124–154 s
same, run 7 (dumps) 124 s 154 s
  • The driver-blob cache stopped growing after run 4. In runs 5–7, no compute build of 1 s or more ended in the whole run.
  • The long builds that did end in runs 2–3 were 0.8–1.2 MB of DXIL and took 60–110 s each (four at once, next to the other game). The preload had started them about 5 s into the run.

Dumps in run 7, at 134 s and 146 s (presents had ended at 124 s; XCL frames looked up with the build's xcl.pdb):

  • The thread at +0x43c3d5d waits in both.
  • A ring worker thread is in bind::execute_indirect → pso_async::resolve_wait in both dumps.
  • An unnamed (title) thread was, at 134 s, in build_compute → translated_compute_pso → pso::console_to_dxil_in → dxc::compile: a program never translated in any earlier run. At 146 s it was in NVIDIA's compiler.
  • Another unnamed thread was in NVIDIA's compiler in both dumps, and 5–6 xcl-pso / xcl-pso-pre threads were in it too.

Reading: the stop is still compute builds on this machine. With more of them in parallel, the title gets further, and at that point it binds programs it has not built before. Some of those take a minute or more here, so a run never finishes them before the watchdog. Each run therefore only moves the point where it stops waiting. Builds that long probably need to be made outside a title run: xcl shaders --precompile --pipelines, which has no watchdog, or similar.

Not tested: a full offline --precompile --pipelines before these runs (it did not finish in 3 h here earlier); runs without the other game running; XCL_BIG_COMPILES other than 4.

AI use: Claude Code with Claude Opus 5.5 ran the builds and runs, read the dumps and wrote this report.

@iggyvilla

Copy link
Copy Markdown
Contributor

Test report for #889 on AMD RDNA2 8 GB: it does not move the stop on this card.

Commit tested: origin/main 930e8b4 with #889 at e1d3b9d (the head then; it is now a39c399, not retested) merged clean (local merge 08ae50e, release build; the PR's
only file is pso_async.rs) vs origin/main 930e8b4 itself. Same machine, same day, run back to back: main first (22:38),
then main+#889 (22:44). Hardware: AMD RDNA2 8 GB card (RX 6650 XT, driver 32.0.21045.29003), Windows 11, retail
title of #505/#675, XCL_NETWORK=0, XCL_ACTIVITY=1, XCL_PSO_WAIT_MS unset, auto.ps1 300 s scripted walk (default
later press list), screenshots every 2 s, fresh save. Both runs looked at: PASSED-SETUP (Legal Notices at ~60 s, loading
spinner from ~100 s to the end).

main 930e8b4 main + #889
title crashes (+0x23cf683, write at 0x0) at 227.8 s 229.8 s
compute builds on title threads after 100 s 14, 28.6 s in all, longest 21.2 s 19, 35.8 s in all, longest 25.9 s
compute builds on xcl-pso* workers after 100 s 66, 354.7 s 93, 404.6 s
presents in the last 2 s windows 0 from ~200 s 0 from ~200 s

(Thread class: threads named xcl-pso* in the crash's thread dump are workers; unnamed ones are the title's. Lines:
compute PSO with the translated console CS (N B DXIL, N ms).)

Result on this card: #889 does not move the stop and does not take the compute builds off the title's threads.
The workers are busy: ~600 s of build time in 230 s on the 18 xcl-pso* worker threads (15 build workers + 3 preload), single builds of 10 - 80 s
(0.5 - 1.2 MB DXIL on AMD), so a compute pipeline the title binds is still not built (or started) when it binds it, and
the bind compiles it itself (resolve_wait takes job): the same 278 872 B shader took 21.2 s (main) / 25.9 s (#889) on a
title thread at ~200 - 227 s. Presents stop at ~200 s in both runs and the title's watchdog ends it ~28 - 30 s later.
It is a fix for a GPU where the builds are fast (the PR's RTX 5080 numbers); here the queue is too slow.

Why the builds are this slow here: the logged times are the driver call only, and most big builds load the driver's blob of an earlier run. The same blob that loads in 14 - 26 ms when it is preloaded at ~5.6 s takes 55 - 88 s at ~95 - 111 s, once the world load has taken process commit to 25 - 41 GB (32 GB host) and local video memory to ~14 GB on the 8 GB card. So on this card the build-ahead queue is limited by memory pressure during the world load, not by the number of workers.

Not tested: the NVIDIA case of the PR; one run each (the timings differ by a few seconds between runs, the crash point
and the stall at ~200 s were the same in both and in the three earlier runs on this card); not run with more preload
threads or a different order.

AI use: Claude Code, Claude Sonnet 5.5, ran the builds and the two 300 s runs and wrote the first draft; a second Claude Code session (Claude Sonnet 5.5) re-derived every number above from the two xcl.log files and edited the text.

@JJAutoCompare

Copy link
Copy Markdown

Empirical test report (a39c399)

Tested xcl-dev/xcl PR #889 at commit a39c3992c7a45baf73e374616e4e9c718f533887.

Hardware / environment

  • Windows x64 build 26200 on an AMD CPU (family 23, model 113, stepping 0).
  • rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC target. DXC reported 1.9.2609.5 (01b62ad47).
  • Cargo test profile with incremental compilation and debug info disabled. The focused run used XCL_ADAPTER=NONE_CPU_ONLY and RUST_TEST_NOCAPTURE=1 outside the Arc test wrapper. Both fixtures used CPU closures as stand-ins for pipeline creation.

Commands and results

  • cargo test --workspace --no-run exited 0 and built the workspace test binaries.
  • cargo test -p xcl --lib first_bind -- --test-threads=1 exited 0. The harness reported 2 passed, 0 failed, 0 ignored, and 0 SKIPPED lines. The filter selected the two new tests in hle::d3d12x::pso_async::used_tests.

Observed behavior

  • The default path ran the compute job before its first bind for a key without prior-use history. The graphics job submitted alongside it stayed pending until its first bind.
  • The switch fixture validated both configurations in separate child test processes. With XCL_PRELOAD_COMPUTE unset, the compute job completed before bind. With the value set to 0, the job stayed pending and the first bind completed it. The parent fixture verified that both children ran and passed.

Not tested

The full GPU workspace suite and game smoke runs were omitted. The fixtures covered queue and bind behavior with stand-ins. GPU driver pipeline creation and retail-title performance were outside this run.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr889-focused.log and published.

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.