Repository navigation
D3D12.X: compute pipelines are built ahead of their first bind - #889
isaacwingate wants to merge 1 commit into
Conversation
|
AMD RDNA4 test report for e1d3b9d (this PR's head, on Correction: an earlier version of this comment described a retail-title run as made with this PR. My run script pointed at a Tested
What the log shows:
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. |
|
NVIDIA test report for Tested
Not tested
AI use
|
|
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, 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. |
|
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 (
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.
Not tested
AI use
|
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)
|
Test report: retail GTA6 under Wine, with a memory cost.
|
|
Linux / AMD RDNA3 datapoint. Merged state: head Full suite, Not tested: retail titles (none here), Windows, RDNA4. 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 AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting. |
|
I tested 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. |
|
Test report for #889 at Tested
No device removal in either run. Read
Not tested
AI use
|
|
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 Tested
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
Build times: median 80 ms, p90 1.9 s, max 73 s, 410 s in all.
Suggestion, if you want it: let an idle Not tested: this PR without #1316 on this machine, more than one run, a machine with enough RAM that 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 |
|
Test report for Setup: RTX 5090 32 GB (driver 621.24), i9-14900KF, 64 GB RAM, Windows 11 Pro 26200, rustc 1.97.1
Thread dumps in run 4 (
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; 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>
e1d3b9d to
a39c399
Compare
|
Thanks all for the runs. Pushed
Suite and regression runs on the new head are in the description. |
|
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 (
Dumps in run 7, at 134 s and 146 s (presents had ended at 124 s; XCL frames looked up with the build's
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: Not tested: a full offline AI use: Claude Code with Claude Opus 5.5 ran the builds and runs, read the dumps and wrote this report. |
|
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
(Thread class: threads named Result on this card: #889 does not move the stop and does not take the compute builds off the title's threads. 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 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 |
Empirical test report (a39c399)Tested xcl-dev/xcl PR #889 at commit Hardware / environment
Commands and results
Observed behavior
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 |
# Conflicts: # crates/xcl/src/hle/d3d12x/pso_async.rs
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=0turns 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.rstoo: #828 (the samepreloadfunction: 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_lazysends compute pipelines to the preload queue too. The queue has two lines: an earlier run's pipelines first, then the other compute ones.XCL_PRELOAD_COMPUTE=0leaves compute pipelines to their first bind, as before this PR.XCL_PSO_PRELOAD=0would also turn off D3D12.X: pipelines an earlier run used are built ahead of their first use #690's preload.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.main1d027e5, and theXCL_PRELOAD_COMPUTEswitch added (@frozht's request, for its memory cost).Tested
cargo test --workspace -- --test-threads=4on a39c399: 961 passed, 0 failed, 43 ignored. The 23 SKIPPED lines:no wave64: the wave64 forms of thelower/lower_dxilGPU tests,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwaref16_programs_on_the_gpu/f32_programs_on_the_gpuheap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowspso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cacheXCL_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):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:
PR:
Not tested
XCL_PRELOAD_COMPUTE=0turns the build-ahead off. There is no byte or count budget: the size is only known after DXC.XCL_PRELOAD_COMPUTE=0on the retail title: the switch is covered by its test only.AI use
resolve_wait), wrote the change and the tests, ran the tests and the runs, and wrote this description.🤖 Generated with Claude Code