D3D12.X: pipelines an earlier run used are built ahead of their first use #690
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!690
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/690/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@theaustinayers on GitHub · 2026-11-24 03:32 UTC · original
theaustinayers:pso-preload→main· +245 −21 · 3 files · 1 commits · merged 2026-11-24 03:38 UTCA lazy pipeline (#162) is built at its first use: until then a graphics one draws nothing and a compute one is waited for on the title's thread. A retail title's first frames of its world use hundreds of pipelines for the first time at once. This keeps which pipelines a title used and builds those ahead of their first use in the next run, while the title loads.
I searched the open PRs first: #628 orders the worker pool's queue, #533 / #267 bound the waits, #214 / #567 the compile concurrency; none builds a pipeline before its first use. This works with any of them.
What is in it
crates/xcl/src/hle/d3d12x/pso_async.rs:mod used– the shader-set keys of pipelines a run used, appended toused-pipelines.txtbeside the DXIL cache and read at the start of the next run;preload– two to four workers at the lowest thread priority, apart from the ones a bind sends to, that build a lazy pipeline as soon as it is made when an earlier run used one of its shaders (whoever takes the job first builds it, so a bind is never held up by them).submit_lazytakes the key;resolve/resolve_waitnote the first use.XCL_PSO_PRELOAD=0turns it off. Pipelines no run used stay lazy as before.crates/xcl/src/hle/d3d12x/real.rs:shaders_key(a hash of the pipeline's shader blobs in their order), passed fromgo_background.crates/xcl/src/hle/d3d12x/bind.rs: the threesubmit_lazycalls of an existing test get the new argument.the_keys_of_a_file_are_read_and_other_lines_passed_over,a_pipeline_an_earlier_run_used_is_built_ahead_of_its_first_use(built with no bind when an earlier run used it, still pending when none did, and a first use is kept),a_key_follows_the_shaders_and_their_order_and_is_never_zero.Tested
cargo build --workspace, thencargo test --workspace -- --test-threads=4on 2e36ce0: 695 passed, 0 failed, 41 ignored. The head commit7296a8bdiffers from it in a doc comment and the commit message only; on it I rerancargo test --release -p xcl --lib -- used_tests shaders_key_tests: 3 passed.gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.used-pipelines.txtof 1197 shader sets from earlier runs: 512 pipelines were built ahead within 5.2 s of the start (the log line is printed at powers of two), in the smoke run below and in a 200 s run into the title's world.maina compute pipeline is waited for, and the title's world still ends at its watchdog with this PR as without it (102 s without, 106 s with: no difference I can claim). On a build of mine that skips a dispatch instead of waiting (bounded waits, as #533 does), the title's first world frames skipped ~2 170 dispatches without this and 94 – 150 with it, in runs on this machine.Regression run
Both runs had the same scripted input (
XCL_PRESS_AT, A at 20 s and so on), so they leave the title's first menu and go on into its loading, where its pipelines are made.main:
```
xcl-smoke v1
commit:
91f9a5e9f0gpu: NVIDIA GeForce RTX 5090
title: NYCMain
seconds: 60
exit: 0x0
frames shown: 1311 (PresentX 1311)
presents per 2 s (last 3): 2 2 0
device removals: 0
crashes: 0
peak commit: 22607 MB
Not tested
used-pipelines.txt: nothing is built ahead then (covered by the unit test's pipeline that no run used, not by a title run with the file removed).main.AI use
xcl pipelines) #755@thehollowedone on GitHub · 2026-11-24 03:35 UTC · original
Tested
On
7296a8b, I checked the real D3D12 pipeline hook in three fresh processes using an isolated synthetic cache. A scratch extension togpu_compute_e2eobserved the stand-in and translated-pipeline count before the first call toresolve_wait.used-pipelines.txt.XCL_PSO_PRELOAD=0: with the same saved key, the pipeline stayed pending before first use and no ahead-of-use build completed. The startup line still said the recorded shader sets are built ahead. The stand-in state and completion log distinguished the disabled behavior.Each dispatch matched all 1,536 readback words. The focused test passed 1/1 in each process with the D3D12 debug layer enabled and no errors or runtime skips. Runtime code was stock.
Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, DXC 1.8.2502.11, Rust 1.99.1 MSVC, debug.
cargo test --offline --locked -p xcl --test gpu_compute_e2e console_wave64_compute_through_the_pso_hook_dispatch_and_read_back -- --exact --nocapture --test-threads=1.Not tested
Graphics pipeline preload, contention with a large history, and retail loading.
AI use
Codex with GPT-6.2 Sol adapted the scratch fixture, ran the tests, and drafted the report.
@MesshM on GitHub · 2026-11-24 03:42 UTC · original
Test run of
7296a8bd42a2e96c22c1a7dbb1f39b252cf4e589on AMD RDNA4. I merged it onto currentmain91f9a5elocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 695 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 655 passed, 0 failed, 21 ignoredSKIPPED;a_pipeline_an_earlier_run_used_is_built_ahead_of_its_first_usepasses.Review: The set written this run starts as the file's set, so only keys that are new append a line:
used-pipelines.txtgrows by distinct shader sets, not by every run. Undercfg(test)the file is neither read nor written. A small thing: keys are never removed, so after a title update its stale keys stay in the file (they only cost a lookup, since a key with no lazy pipeline builds nothing). I found nothing to change.Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@crosettiremi on GitHub · 2026-11-24 03:56 UTC · original · edited 2026-11-24 04:05 UTC
Independent Windows 11 / RX 7900 XT result on retail 1.0.2.1, with DXC 1.9.2602.17. I tested the preload change at
7296a8bon a local combined build with bounded graphics and compute waits, first-use tracking on those paths, and a sparse-buffer release fix. The prior-use file started with 180 shader sets. I had seeded 177 from earlier traces before the preceding run.The log recorded 128 pipelines built ahead of first use by 6.643 s. The account picker held 60 presents per two seconds and accepted A at 37.004 s. The game displayed the loading artwork and began streaming. It later hit the known world-loading watchdog at 154.691 s (0xc0000005 at title+0x23cf683), with no device removal. The submission thread logged 14 two-second Wait64BitValueX timeouts. Peak process commit was 40,842 MB.
This verifies preloading on AMD. The build and warmed cache do not isolate its effect on frame rate or time to the watchdog. The combined workspace passed 722 tests with 41 ignored.
Upstream change tested:
7296a8b. Workspace command:cargo test --workspace --locked --offline -- --test-threads=4. Codex (GPT-6) ran the checks and summarized the local logs.@crosettiremi on GitHub · 2026-11-24 04:50 UTC · original
Follow-up to my earlier AMD test. I repeated a Series S-profile run on the RX 7900 XT with the exact same release executable, saved profile and A press at 37 s. The second launch used the complete application caches written by the first. Both builds had #690 enabled, so this measures repeat-launch behavior on the integration stack.
The 512th pipeline finished preloading at 9.883 s on the repeat, compared with 16.952 s on the first run. The repeat accepted driver blobs on 282 successful compute pipeline creations. It still encountered 21 successful cold creations and two cold creations that returned
E_OUTOFMEMORY.The two failed compute compilations were serialized. ScreenProbes ActivateProbes (22,909,544 bytes of DXIL) took 91.119 s and ActivateRays (13,015,316 bytes) took 54.018 s. Both were started by a preload worker. Peak process commit was 68,701 MB. The repeat recorded 2,215 presents and zero device removals before a title access violation in world loading at 174.409 s. The trace establishes driver memory pressure; it does not establish the cause of the title exception.
The local integration workspace reported 737 passed, 0 failed and 41 ignored. One counted pass printed a skip for the missing xgameruntime.dll debug-layer fixture. The same binary was used for both game runs. Codex (GPT-6) ran the tests and prepared this report.
@WarmMilkCodes on GitHub · 2026-11-24 05:31 UTC · original
<html> <html><head></head>Title: Pipeline preload (#690): committed memory climbs ~1.4 GB/s on AMD RDNA2 until Windows runs out (retail title from #505)
Hardware: AMD Radeon RX 6600 XT (8 GB, RDNA2), Ryzen 5 5500, 32 GB RAM, page file on a second drive (commit limit 130 GB), Windows 11, DXC 1.8.2502.11.
Build: a local test branch: main with #690 and #713, plus #533 and two local changes that bound pipeline waits (no changes to
pso_async's preload code). #762 was in some of the runs; #688 in one (taken out after). The leak followsXCL_PSO_PRELOADin every run, with or without those.What happens
Once
used-pipelines.txtholds a few hundred entries, a run logs512 pipelines built ahead of their first useabout 11 s in. From then on, the process's committed memory grows at about 1.4 GB/s until the commit limit is reached. Committed memory, sampled every 2 s with\Memory\Committed Bytes:The title sat at its account picker the whole time. XCL's log is nearly silent after ~100 s, with no pipeline builds or uploads logged while memory climbs. The desktop stopped drawing (blank icon boxes, error dialogs) until a reboot. Two other runs with the same list ended at ~130 s with
memory allocation of 4920320 bytes failedand exit 0xc0000409, with no crash dump.With
XCL_PSO_PRELOAD=0, the same build:When it started: an earlier run with a short list (
32 pipelines built ahead) had no leak (294 s, past the world loading screen). The leak appeared once the list reached 512+ (605 shader sets at the last run).Not checked yet:
- Whether the memory is held in the driver (pipelines built ahead and kept) or in XCL.
- Whether a smaller preload list, or one preload thread, still leaks.
- NVIDIA, or a fresh
</html> </html>used-pipelines.txt.@crosettiremi on GitHub · 2026-11-24 05:39 UTC · original
Follow-up to my RX 7900 XT report about the two cold world-loading compute PSOs. I tested an experimental offline compute backend built from XCL's existing instruction emitter. This is on a separate integration worktree. The #690 PR itself is unchanged.
Both complete programs created a native PSO under a 10 GiB job limit. A new process offered the 954-byte driver blob returned for each shader. Creation still took 48.836 s and 68.559 s respectively. In-process repeat dispatches were substantially faster. These are single observations for each cache condition.
For execution coverage I dispatched the full ActivateRays program, with controlled resource descriptors, on a path that clears output records and exits before lighting samples. The conventional translation of the reachable prefix and an independent expected memory image agreed. With 256 workgroups and two loop iterations the shader wrote 262,144 32-bit words. A second D3D12 queue waited for the producer's actual fence and ran a compute consumer on the output. All 278,544 words, including the consumer result and the surrounding memory, matched. I also checked 64 differential cases on small wave32 and wave64 branch regions, including nonzero memory-window reads and a failing window-zero negative control.
This experiment has no in-title integration or playable-world result. The complete ActivateProbes program has native creation coverage. The ActivateRays test covers one real control-flow path with synthetic input. Neither establishes correct scene lighting. The results support testing live-device prewarming for these two large pipelines and measuring actual dispatch dimensions.
AI use: Codex (GPT-6) implemented the local prototype, ran these checks and prepared this report.
@crosettiremi on GitHub · 2026-11-24 05:57 UTC · original · edited 2026-11-24 05:58 UTC
Following up on the two lighting pipelines from my previous test on Windows / RX 7900 XT. I ran the opt-in compact compute prototype on the retail title's actual D3D12 device, with a saved player profile and device_type set to anaconda (Series X) and a 28 GiB Windows job commit limit.
Reference for the memory comparison:
github.com/ThatRecompDev/five-star-recomp@dbbdb0746cmainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175