Repository navigation
Description
Concurrent cold requests for the same compute pipeline may both miss XCL's driver-blob cache and independently enter driver compilation. Investigate and reproduce this before adding coordination.
Evidence and scope
Source review of main beeb81be4b7e96fce26a54615be9ee170474c19e found cache lookup before driver admission in crates/xcl/src/hle/d3d12x/real.rs::compute_container(). This is a source-level race hypothesis; no XCL duplicate-build count has been measured. Main had advanced to 47ccaf40c867be8f0e611833759a9af776a6ee15 at drafting; reproduce on the latest head before implementation.
XSEmu PR #36 at c07b3526809283878ebc44332ae7d98e2ab0f644 adds per-key claims and a cache recheck after waiting. Its author reports three focused tests passing, NVIDIA smoke runs, and 21 unresolved workspace failures. These are external reports, not XCL validation.
Existing work
#3011 C18 covers shader conversion coalescing already present in dxc.rs; its follow-up explicitly leaves driver-blob handling unchecked. This proposal concerns driver pipeline creation. Related scheduling and preparation PRs include #2791, #2800, #3054, #3181 and #3182; refresh overlap before claiming implementation. Coordinate this work under #2088. XSEmu ports have separate issues, as #3073 explains.
Proposed work
- Reproduce simultaneous cache misses using a deterministic fake driver callback and barriers. Count actual builds and keep requests identical in complete pipeline identity.
- Reuse existing identity rules, including device/root-signature compatibility, static samplers, flags, node mask and compiled program identity. Audit the current key rather than keying only by guest hash.
- Coordinate one producer per key and recheck reusable output after waiting. Preserve generation-aware rejected-blob invalidation and retry behavior.
- Define lock ordering with driver slots and memory admission. Waiting for another producer must not deadlock or unnecessarily consume unrelated compile capacity. Keep waits outside global cache locks.
- Define behavior when compilation fails, unwinds, or produces no retained blob. Avoid permanent failed claims and unbounded flight-map growth. Keep cached-only preparation behavior intact.
Regression tests
- Concurrent identical requests reuse a successfully published result.
- Distinct keys can compile concurrently, including identical DXIL with differing flags or static samplers.
- Waiting includes a second cache lookup after driver admission delays.
- Failure and unwind release ownership and wake waiters; later retries can proceed.
- A rejected older blob cannot delete a newer replacement.
- Small builds below the retention threshold and missing cache output remain live.
- Exercise both runtime and preparation callers through their normal entry points.
Measurement and acceptance
Record cold driver-build invocation counts per key, coalesced waits, elapsed preparation time and first-use wait. Use identical driver/cache conditions and repeated equal-scene A/B runs. Report Windows build, exact main/head commits, full workspace totals and explicit skips. AMD and NVIDIA validation and paired generated title smoke blocks remain pending. No FPS gain is promised.
Provenance and AI use
Credit XSEmu's authors and exact source revision for any adaptation, verify per-file licenses, retain notices and add XCL's required provenance and THIRD_PARTY.md entry. OpenAI Codex (GPT-6 Astra) reviewed source and coordination threads and drafted this proposal. No implementation or GPU test was performed for this draft.
Activity
oni-swr commentedon Nov 28, 2026
Withdrawn (was a claim): draft #1652 (rdj415, head
5829b34f) already does per-key cold compute PSO coalescing incompute_container, with a cache recheck after the per-key lock and same-key / distinct-key tests. That PR is CONFLICTING on main and bundled with other changes. @rdj415, would you split that piece out for this issue? If you'd rather not, we can carry it with your authorship. Either way we can add RX 7800 XT (RDNA3, Windows) cold-build counts.AI-assisted: Codex (gpt-6.2-sol) found the overlap, Claude coordinates.