Shaders: precompile compute pipelines through a recorded present #2104
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!2104
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2104"
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?
@RandomGithub12309 on GitHub · 2026-11-25 04:22 UTC · original
RandomGithub12309:shaders/compute-milestone→main· +181 −2 · 3 files · 1 commits · openPart of #2088, workstream 1. This consumes the v1 manifest recorded by Anon64’s #2096. With a recorded present count, the offline precompiler builds just the compute pipelines first used through that present. The option is opt-in and works with an RPF pack, a folder, or a single record.
What is in it
shaders.rsandshaders/milestone.rsselect compute first-use keys in manifest order, match the full prefix against the input before GPU work, and use the existing compute translator, pipeline builder, and blob cache. A missing cutoff, an unmatched key, or an incomplete build returns a failure exit code.Tested
Base
cbc296ab65a2661a61e3e2da109134bcd5319f60, headf1810d0c362e73822e08bacf789e7422736ffafc. Windows 11 build 26300.9974, Core Ultra 7 255HX, 15.43 GiB usable RAM, RTX 5050 Laptop GPU (8 GB), NVIDIA 621.14, Rust 1.100.0, debug build.cargo build --workspace --offlinesucceeded.cargo test --workspace --offline --no-fail-fast -- --test-threads=4 --show-outputfinished with 1154 passed, 4 failed, 46 ignored. The harness counted skipped GPU cases among passes. The four new milestone tests passed. On base,cargo test --offline -p xcl --lib gpu::dxil::fuzz_tests::fuzz_validate_and_gpu -- --test-threads=4reproduced all four failures on the same seeds (70, 545, 1019, 1507), each withCreateComputePipelineStatereturning0x8007000E. The suite used separate writableXCL_DXIL_CACHEandXCL_DATA_ROOTdirectories.Recorded a retail manifest using #2096’s recorder diff on the base above, with
XCL_NETWORK=0 XCL_ADAPTER=auto XCL_PSO_MANIFEST=1and isolated cache/data directories. The 115-second recording reached 2,899 frames with 60/60/60 presents in the last three two-second windows. Present 512 was the first recorded cutoff after a compute use.Ran
xcl shaders <pack> --precompile --pipelines --pso-manifest <recording> --through-present 512twice with the same isolatedXCL_DXIL_CACHE. First pass, empty XCL cache: 1 built, 0 blob hits, 7.189 s total. Repeat: 1 built, 1 blob hit, 5.559 s total. Both exited 0 with zero refused or capped. NVIDIA implicit cache was enabled and had already seen this program. These are whole-command times including the pack scan.Record
1e32f25121c1552f, pipeline key197228a8e18192ff, 95,616 DXIL bytes. On the initial recorder run the driver build took 573 ms with no XCL blob supplied. A subsequent recording supplied an XCL blob and reported 35 ms. Driver-cache-off measurement withxcl shaders <pack> --measure-pso 1e32f25121c1552f --repeat 2returned exit 2 (ShaderCacheControl,0x887A002D).CLI checks for an unmatched compute key and an unrecorded cutoff each returned exit 2.
Launched the title with the cache produced by the offline command and a fresh title-data directory. At first use the compute pipeline was still pending. Its runtime build supplied the saved blob and took 18 ms. The run reached present 512 at 55.989 s after the first manifest event and finished at 862 frames in 85 s, with zero device removals or crashes.
28 explicit GPU skip messages from the full suite
Regression run
scripts/smoke.ps1 -Game <retail-folder> -Seconds 60 -Xcl <debug-binary>on each clean revision, withXCL_NETWORK=0 XCL_ADAPTER=auto, an empty per-run XCL cache/data directory, and NVIDIA implicit caching enabled. These check normal title execution with the new CLI option inactive.Not tested
Fully cold NVIDIA driver compilation, first playable frame, steady-state GPU time, AMD hardware, graphics pipeline replay, and bounded-lookahead scheduling. The present counter measures a rendering milestone. Its screen content and playability were not verified. No startup speedup is claimed.
AI use
OpenAI Codex (GPT-6) wrote the change, tests, and description, and ran the validation on the hardware above.
@JJAutoCompare on GitHub · 2026-11-25 04:34 UTC · original
Tested
All three synthetic shader manifest fixtures passed on STOR-WINLAB at PR #2104 head
f1810d0c362e73822e08bacf789e7422736ffafc. The checkout was clean and detached before and after testing. I read upstreamAGENTS.mdandCONTRIBUTING.md. The PR remained open at that SHA, and its live discussion and T3 thread search showed no duplicate verification.3 passed, 0 failed, 0 ignored, 0 skipped. Each command exited
0and ran one test, with 1,127 filtered out.1selected[9, 1]and present2selected[9, 1, 3]. The fixture covers duplicate compute uses, graphics exclusion, and an error for unrecorded present4.[1, 0]in manifest order.0000000000000009then0000000000000001.Windows 11 Enterprise Evaluation 25H2 x64 build
26200.9974, AMD Ryzen 7 3800X, Rust and Cargo1.100.0(x86_64-pc-windows-msvc). The unoptimized test build used two Cargo jobs, incremental compilation disabled, and dev/test debug info disabled.TEMPandTMPwere private toL:/XclTooling/pr2104/tmp. The fixtures used synthetic inputs and CPU parsing, hashing, and record matching.XCL_ADAPTERwas set to an unmatched name as a precaution. DXC1.9.2602.17and1.9.2609.5were installed. The fixture paths did not invoke DXC, create pipelines, or dispatch GPU work.Not tested — Other fixtures, the full suite, CLI precompile execution, live shader inputs, GPU compilation or execution, and retail smoke.
AI use — T3 Code / Codex (
gpt-6.2-sol) inspected the fixture paths, ran the tests, and wrote this report.@DavidM1911 on GitHub · 2026-11-25 06:02 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@ettehn on GitHub · 2026-11-25 07:06 UTC · original
Windows CPU-only integration check. I combined #2096 (
5ffbb5e) and this PR (f1810d0) onmainat568e7db. The first-use parser accepted events serialized by #2096’s actual formatter and preserved the expected compute-key order through the selected present. A truncated record after that present left the completed prefix usable.I also tested a local follow-up that counts a selected pipeline as cache-ready when the driver accepts an existing blob or a new blob is saved. With a regular file blocking the cache directory,
driver_cache::writereturnedfalseand the milestone completion check reported one pipeline still requiring a runtime build. This covers a write failure after pipeline creation, which can currently leaverefusedandcappedat zero.On Windows 11 25H2 (26200.9974), Ryzen 9 8945HX, Rust 1.97.1 MSVC,
cargo test --locked --offline -j 2 -p xcl --lib <filter> -- --test-threads=1passed 12/12 with the follow-up:shaders::milestone::tests(6),pso_manifest::tests(2), andhle::d3d12x::real::driver_cache::tests(4). These fixtures did not exercise a real driver blob, GPU pipeline creation, or a retail title.Verification and local patch assisted by OpenAI Codex (GPT-6).
@Anon64 on GitHub · 2026-11-25 07:36 UTC · original · edited 2026-11-25 08:07 UTC
A run of this PR's head
f1810d0on a manifest from a world load, and a limit of present cutoffs that it shows.Setup: RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release. The manifest was recorded with #2096 on
maincbc296a(XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_PSO_PRELOAD=0, 150 s of a retail title). The precompile ran with an empty, separateXCL_DXIL_CACHE.xcl shaders <pack> --precompile --pipelines --pso-manifest <file> --through-present 1024:present 1024: 3 compute pipelines in first-use order,made 3, including 0 from driver blobs; refused 0, over cap 0, exit 0. So it works as described.--through-presentcutoff can reach the pipelines the title waits on there. That is likely the common case on cards where the world load stalls, which is the case that needs the precompile most.Two ways around it:
--through-seq N) or byms, so a manifest that ends in a stall can be taken whole, or up to a point in time.tickline every 10 s. Then--through-presenthas a time-based sibling.I'll add (2) to #2096 if you'd rather keep this PR's cutoff as it is, or we can do (1) here. Which one?
Written with Claude Code (Claude Opus 5.5) from runs on this machine.
Edit: option (2) isn't needed. Every manifest line already carries
ms(column 2) as well asseq, so a--through-ms Nor--through-seq Nin this PR can cut a manifest that ends in a stall with no format change. I'd go with (1) and leave #2096's format as it is.@itsSio on GitHub · 2026-11-25 12:38 UTC · original
Two native Windows GPU runs confirm the cache-write gap that @ettehn identified in the CPU-only follow-up above. On the current PR head, a successful GPU pipeline build counts as complete even when the driver blob cannot be saved.
Tested: Clean
f1810d0c362e73822e08bacf789e7422736ffafc, Windows 11 Pro build 26200, NVIDIA 610.88, debug MSVC.On each GPU I ran
xcl shaders <one-record directory> --precompile --pipelines --windows 4 --split 1 --pso-manifest <capture> --through-present 1twice, each with a new privateXCL_DXIL_CACHEandXCL_PSO_DISK_CACHE=1. The input was the syntheticmirror_program_through_the_hookshader, and the manifest contained its recorded first use (b3b2fd750cde2d8d) followed by an explicitly synthetic present. For the negative control, a regular file occupied the cache'sdriversubdirectory path; the DXIL cache root remained writable.All four CLI runs selected one compute pipeline, exited 0, and printed
made 1, including 0 from driver blobs; refused 0, over cap 0. On each PC the writable control produced one nonempty.pso; the blocked case produced none. No shared cache was touched.cargo build --workspace --locked -j 4passed on both PCs.cargo test -p xcl --lib --locked -j 4 shaders::milestone::tests -- --test-threads=1 --nocapturepassed 4 / 0 / 0 with no runtime skips on each.cargo test --workspace --locked -j 4 --no-fail-fast -- --test-threads=4 --nocapturepassed 1158 / 0 / 46 on each. RTX 5080: 25 runtime skips (20 no native wave64, three unsupported per-lane cases, one unavailable implicit driver-cache control, and one no heap windows). RTX 2080 SUPER: 27 runtime skips (same plus two missing D3D12 debug-layer cases).Not tested: The proposed follow-up patch, retail startup or playability, AMD, or implicit driver-cache behavior.
AI use
Ran via Samaritan:
@ettehn on GitHub · 2026-11-25 13:40 UTC · original
Thanks @itsSio for confirming the failure path on both GPUs. I ran the local persistence fix on top of
f1810d0on Windows 11, RTX 5070 Ti Laptop (621.24), DXC 1.8.2502.11. The same one-record synthetic input and--through-present 1manifest were used throughout. A regular file blocked only thedriversubdirectory in the negative controls.The original-behavior binary has a test-only early return behind
XCL_TEST_STOP_BEFORE_DEVICE, which was unset. The five milestone tests on the patched tree passed. The patch counts a PSO as cache-ready only if the driver accepts an existing blob or a new blob is saved. Synthetic inputs only.OpenAI Codex assisted.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.