Repository navigation
Description
xcl shaders --precompile --pipelines can issue a second native compute PSO creation after the first call already returned a valid pipeline. Startup shader preparation uses the same path.
- The precompile worker translates the compute record, then calls
Pipelines::make. Whole pipelines and split pieces both reachmake_one. The cache path uses the DXIL hash and length, pipeline flags, and the whole/chain suffix. A nonempty file is loaded without checking its driver identity. Both native calls occupy the samerunningslot, which is limited byXCL_PIPELINE_THREADS.crates/xcl/src/shaders.rs:1457–1489·shaders.rs:1520–1545·shaders.rs:1730–1736·crates/xcl/src/hle/d3d12x/real.rs:4520–4549 - The first
CreateComputePipelineStatesuppliesCachedPSO. The.filterdrops a successful PSO ifGetCachedBlobfails or returns a different size. At or below the configured cap, or with the cap disabled, the fallback clearsCachedPSOand callsCreateComputePipelineStateagain with the same DXIL, root signature, and flags. The second result controls whether the pipeline is counted as made or refused. The over-cap path already skips this retry.crates/xcl/src/shaders.rs:1546–1590
The maintainer observed a successful stale-blob probe with internal fallback on RTX 4090 in #1774. A driver can also reject incompatible blobs with an error, which still requires the uncached retry for an eligible program. Static review confirms the extra native call after success. XCL was not built or tested for this report, and the latency of the second call is unmeasured. D3D12 cached-pipeline documentation
Preserve the native creation result separately from the blob-hit check. For an eligible program whose probe succeeds but misses that check, count the returned PSO as made, leave the reuse counter alone, and publish its replacement blob when available. Keep the current cap handling and retry without CachedPSO when the probe fails. A deterministic regression can simulate successful creation with a mismatched returned blob size and assert one native create, zero hits, and publication of the replacement. Include a failed-probe case to check that the uncached retry still runs.
AI use — OpenAI Codex (GPT-6, exact serving variant unavailable) performed the static review and drafted this report.
Category: pso_pipeline_perf | Verified at commit 8b957be
Activity
ettehn commentedon Nov 27, 2026
Reproduced the second native create on
8b957bec(Windows, RTX 5070 Ti Laptop, NVIDIA 621.24, SDK DXC 1.8.2502.11). The synthetic case is a valid 1,402-byte blob for the stock compute fixture with 16 zero bytes appended. D3D12 accepted all 1,418 input bytes and returned a PSO whose cached blob was 1,402 bytes. The size check then discarded that PSO and calledCreateComputePipelineStateagain without the blob.A local candidate that keeps the successful probe separate from the hit check reduced this case from two native creates to one and wrote the 1,402-byte replacement. A valid unmodified blob still used one cached create. Garbage, a truncated blob, and a valid blob from a different shader still returned
E_INVALIDARGon the probe and succeeded on the uncached retry. The over-cap stale-blob regression and split-piece prebuild/cache test also passed (pipeline-cap module: 3 passed, 0 failed, 0 skipped).This reproduces the size-mismatch path; I did not measure retail startup time or simulate a driver upgrade. I have the candidate locally. OpenAI Codex (6.2sol) assisted.
akimfomin commentedon Nov 27, 2026
ettehn’s 1,418 → 1,402 byte probe is a useful reproducer. One distinct synthetic control for the candidate is a successful create whose returned blob differs in bytes while having the same length as the supplied blob. The current size comparison cannot distinguish that pair. It is a useful way to pin the one-create rule separately from any size-based reuse counter.
The Continued fresh-process pilot is a reference for the empty/populated control design. Its Vulkan cache-hit feedback has no equivalent in the D3D12 CachedPSO contract, so the reusable part is the test design. PortBridge can help with a title-free fixture after the candidate is public.
AI-assisted source review and drafting with OpenAI Codex. This comment adds a source-based control; ettehn ran the hardware test above.
Update from RTX 4070 Ti SUPER. Thanks to ettehn for adding the bookkeeping control, and to CryingLaughing for the 800-piece replay. On driver 617.14, a separate minimal D3D12 harness accepted the padded test blob in four fresh processes (1,438 bytes in, 1,422 out, first HRESULT
S_OK). The size-gated path issued two native creates. Keeping the returned PSO issued one; both strategies finished successfully. For the untouched blob we also observed different bytes being returned at the same length.Source, commands, exact controls and results. These runs measured call counts. The driver-internal hit and application startup effect remain unknown. OpenAI Codex assisted with the isolated synthetic harness.
ettehn commentedon Nov 27, 2026
Thanks for the control. I added it to the local regression and ran the pipeline-cap module on the RTX 5070 Ti Laptop (621.24): 4 passed, 0 failed, 0 skipped. The test injects the create result and uses a real seed PSO; the substituted input bytes never go to the driver.
For a successful probe, both controls call create once. With a different-sized returned blob the test checks replacement on disk and no reuse increment. With a same-sized, byte-different blob it checks one create, the existing size-based reuse increment, and no rewrite. A failed probe still calls create twice, retrying without the blob. The same-size result verifies XCL’s bookkeeping under the injected case; it does not identify a native D3D12 cache hit.
OpenAI Codex (6.2sol) assisted.
CryingLaughing commentedon Nov 27, 2026
I reproduced the requested successful, same-length, different-bytes case on an RTX 4080. I used main
8b957bec6f82495aec940944c6bf47faa02db590with an observer that counts native creates and compares the exported COM blob to the supplied bytes. The observer preserves the existing size predicate and cap handling. Requested control · Exact observer and corpus generatorEach replay used a separate fresh process and byte-for-byte copies of the 800 valid
.chain.psoblobs generated by its corresponding empty-cache process. Both replays reported zero length changes and zero unavailable exported blobs. The on-disk blob hashes stayed unchanged. The two independent empty-cache processes produced the same 800 keys, and 686 same-key pairs differed in bytes at equal length.Across the two replays, 1,141 successful cached creates returned different bytes at the supplied length. XCL made zero uncached calls and incremented its size-based reuse counter for all 1,600. The native call counts and byte comparisons are separate observations from that counter. These runs concern split pieces on the instrumented main checkout. The driver's internal reuse behavior and the local candidate discussed above were outside this run.
All four serial processes exited 0 and reported 160 synthetic compute programs, 800 pieces, zero refusals, zero translation errors, and zero skips. The machine used Windows 11 25H2 build 26200.9974, Core i5-13600K, RTX 4080 driver 621.01, Rust 1.100.0 MSVC, and DXC 1.8.2502.11. NVIDIA and Windows system caches were retained.
The runs used a separate
XCL_DXIL_CACHEandXCL_DATA_ROOTfor each process withXCL_ADAPTER=4080 XCL_NETWORK=0 XCL_DXC_THREADS=15 XCL_PIPELINE_THREADS=4 XCL_DIRECT_DXIL=1 XCL_DIRECT_SPLIT_INSTRUCTIONS=12 XCL_PSO_DISK_CACHE=1 XCL_SPLIT_GATE_PROBE=1 XCL_PSO_BLOB_IDENTITY_PROBE=1and the defaultXCL_PIPELINE_MAX_KB. The corpus manifest SHA-256 is75b27646d15556b9b6ad44198cfeecf8485184d88f87acadb44a346895d77924.Successive replays with byte-based replacement
To measure the write volume of the proposed byte-equality rule, I ran four more serial processes on the same RTX 4080 and corpus. The first received the valid driver-authored files from Empty A. Before each subsequent process, I copied the previous input into a new private cache and overlaid exactly the same-length, byte-different blobs exported by the driver in the preceding run. The probe writes its observations to a separate private directory. XCL kept the existing size rule, and each process left all 800 of its input driver-file hashes unchanged. Exact export observer · Byte-match question
All 3,200 cached native calls succeeded. Every process made 800 split PSOs with zero uncached creates, refusals, translation errors, skips, or export failures. Across four replays, a byte-based rule would have made 2,198 replacements totaling 4,161,292 bytes. Among the 800 keys, 755 changed at least once and 298 changed in every replay. This measures the logical replacement volume for this adapter and driver through four generations. Internal driver reuse and write latency were outside the run.
The release build and shader command above were unchanged. The follow-up added
XCL_PSO_BLOB_EXPORT=1, with a new privateXCL_DXIL_CACHEandXCL_DATA_ROOTper process. NVIDIA and Windows caches were retained.KOLESNiii commentedon Nov 27, 2026
Proposed fix, as draft #2940 (GPU suite and smoke runs still queued; I'll update the PR with the real counts):
Pipelines::make_onemoves intobuild_with_blob(cached, over_cap, create, blob_of), which takes the native create andGetCachedBlobas closures, ascreate_graphics_pso_cachedinreal.rsalready does. A successful probe is the pipeline: one create, counted as made. It counts as reused only when the returned blob has the size handed over (unchanged). Otherwise the returned blob replaces the stale file. A failed probe still retries without the blob, and over the cap it is still capped and removed.One change beyond the issue: over the cap, a stale blob the driver takes is now made and replaced instead of capped and deleted.Dropped from Shaders: a stale-blob probe the driver takes is not created a second time #2940: over the cap is unchanged frommain. It broke the over-cap tests in the full suite, becausepso_measurement_compiles_an_exact_synthetic_recordturns the driver cache off on the process-wide device, after which the driver takes any blob, garbage included.@ettehn, your local candidate and its 4-test module land on the same bookkeeping as this one. I'm glad to take your tests into #2940 with a
Co-authored-by, or to close #2940 in favour of yours if you open it. Tell me which you prefer.Questions I'd like settled before any follow-up. #2940 doesn't depend on them:
CachedPSO, so this is XCL's own bookkeeping. Options: (a) returned blob has the same size (kept in Shaders: a stale-blob probe the driver takes is not created a second time #2940, and what ettehn's candidate does); (b) byte-equal, which also catches akimfomin's control for one memcmp per hit, but rewrites the file on a driver whose real hits return different bytes; (c) any successful probe, which is what the runtime does today. I'd go to (b) only if a test on AMD/Intel shows real hits come back byte-equal.real.rscompute_containerandcreate_graphics_pso_cachedcount any successful probe as reused and never replace the stale file. After a driver update, the stale blob stays on disk and the driver compiles past it on every run (the Shaders: size-based admission for big compute driver compiles #1774 case), anddriver_cache::note(true)counts it as a hit. Proposal: movebuild_with_blobintodriver_cacheand use it in both runtime paths, so offline and runtime share one rule. That would be a separate D3D12.X PR stacked on Shaders: a stale-blob probe the driver takes is not created a second time #2940. Its open questions: whether the in-memoryCOMPUTE_BLOBSentry should also be replaced, and whether the replacement goes throughdriver_cache::keep(the 250 ms threshold) or is written unconditionally as offline does.build_with_blob_testsneeds nothing. The GPU test needs DXC and a D3D12 device and prints one line (adapter=… good_blob=… padded_blob=… creates=… made=… refused=… reused=… kept_blob=…) that a Test Lab entry could collect across GPUs, starting with AMD and Intel, where the successful-stale-probe path is unverified. @akimfomin, if PortBridge needs a stable test name or output format for that, say so and I'll keep these fixed.Claude Code (Claude Opus 5.5) wrote #2940 and drafted this comment. The tests named above are the ones in the PR. Their GPU results will be posted on the PR once the runs finish.
Shaders: a blob not used over the cap stays capped, as before
Shaders: a stale-blob probe the driver takes is not created a second …
Shaders: a stale-blob probe the driver takes is not created a second …
Shaders: a stale-blob probe the driver takes is not created a second …
Shaders: a stale-blob probe the driver takes is not created a second …
Shaders: a stale-blob probe the driver takes is not created a second …
Shaders: a stale-blob probe the driver takes is not created a second …