Pipeline Rebuild #2508

Open
opened 2026-11-26 05:32:27 +00:00 by github-bot · 8 comments
Owner

@⁠bmjask on GitHub · 2026-11-25 21:08 UTC · original

No description provided.

**@⁠bmjask** on GitHub · 2026-11-25 21:08 UTC · [original](https://github.com/xcl-dev/xcl/issues/2508) *No description provided.*
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:32:27 +00:00
Author
Owner

@⁠bmjask on GitHub · 2026-11-25 21:08 UTC · original

The open PRs contain many necessary fixes and useful optimizations, but they do not yet form a complete stall solution. They address local symptoms—shader routing/caching, async PSOs, texture/mirror work, VRAM pressure, and synchronization—while the expensive work is still often discovered at first draw or dispatch.

The missing architectural work is a coherent pipeline-work model:

  1. Represent work needed soon as a dependency graph: shader translation, DXC, native PSO creation, split-chain pieces, descriptor/memory preparation, and required fences. Schedule it before the foreground draw reaches the dependency.
  2. Give every not-ready path explicit semantics: block, use a proven-correct fallback, defer/replay safely, or skip only when invisibility is proven. Skipping required whole-form dispatches, ExecuteIndirect work, or waits is not a safe stall workaround.
  3. Add per-driver admission control for Direct-DXIL/split/compact forms. Current local size heuristics do not capture cases where a smaller artifact compiles more slowly or consumes extreme driver memory.
  4. Unify deferred CPU writes, sparse copyback, sync cells, and tile/resource retirement under fence-owned visibility: completion must not be exposed until the real producer work has landed.
  5. Set a hot-path budget for per-draw title-memory work. Keep write-watch, mirror bookkeeping, allocation, and diagnostics out of the normal draw path unless enabled; batch or move maintenance to workers/boundaries.
  6. Establish repeatable end-to-end scenarios: cold-cache title startup, shader-heavy scenes, VRAM pressure, repeated PSO creation, and queue/fence contention. Unit and synthetic GPU tests are necessary but do not measure the actual stall envelope.

Recommended sequencing: land the narrow correctness fixes first; then build this as an explicit architectural series rather than treating each cache/scheduling/mirroring PR as an independent optimization.

**@⁠bmjask** on GitHub · 2026-11-25 21:08 UTC · [original](https://github.com/xcl-dev/xcl/issues/2508#issuecomment-7174670660) The open PRs contain many necessary fixes and useful optimizations, but they do not yet form a complete stall solution. They address local symptoms—shader routing/caching, async PSOs, texture/mirror work, VRAM pressure, and synchronization—while the expensive work is still often discovered at first draw or dispatch. The missing architectural work is a coherent pipeline-work model: 1. Represent work needed soon as a dependency graph: shader translation, DXC, native PSO creation, split-chain pieces, descriptor/memory preparation, and required fences. Schedule it before the foreground draw reaches the dependency. 2. Give every not-ready path explicit semantics: block, use a proven-correct fallback, defer/replay safely, or skip only when invisibility is proven. Skipping required whole-form dispatches, ExecuteIndirect work, or waits is not a safe stall workaround. 3. Add per-driver admission control for Direct-DXIL/split/compact forms. Current local size heuristics do not capture cases where a smaller artifact compiles more slowly or consumes extreme driver memory. 4. Unify deferred CPU writes, sparse copyback, sync cells, and tile/resource retirement under fence-owned visibility: completion must not be exposed until the real producer work has landed. 5. Set a hot-path budget for per-draw title-memory work. Keep write-watch, mirror bookkeeping, allocation, and diagnostics out of the normal draw path unless enabled; batch or move maintenance to workers/boundaries. 6. Establish repeatable end-to-end scenarios: cold-cache title startup, shader-heavy scenes, VRAM pressure, repeated PSO creation, and queue/fence contention. Unit and synthetic GPU tests are necessary but do not measure the actual stall envelope. Recommended sequencing: land the narrow correctness fixes first; then build this as an explicit architectural series rather than treating each cache/scheduling/mirroring PR as an independent optimization.
Author
Owner

@⁠bmjask on GitHub · 2026-11-25 21:12 UTC · original

A more critical reading: the previous proposal is directionally right, but “build a dependency graph” is too broad to be an actionable design and could turn into a second runtime scheduler whose overhead and failure modes are harder to reason about than today’s code.

The first architectural boundary should be stricter:

  • PSO/shader preparation is speculative work. It can be deduplicated, prioritized, cached, and run early, but a title can always present an unseen shader at execution time.
  • Memory visibility and queue synchronization are correctness work. They must be expressed by ownership and fences, not by scheduler priority or best-effort background jobs.

Those systems may share observability, but should not share a generic execution graph. A missed PSO deadline may block; a missed copyback/sync deadline must not expose completion or skip ordering.

Before rebuilding anything, establish causal stall attribution with negligible disabled-path cost. For every long frame or blocked submission, record mutually exclusive time in: translation, DXC, driver PSO creation, cache wait, scratch/resource allocation, mirror/write-watch work, GPU/fence wait, and lock contention. Without that breakdown, moving work to a worker can merely shift the stall, saturate the CPU, increase driver contention, or inflate commit.

Some important design constraints:

  1. Never make semantic work disappear to satisfy a latency budget. A not-ready PSO may block or use an equivalent prebuilt fallback; a required draw/dispatch/wait cannot be skipped. The reviewed whole-form and ExecuteIndirect changes show why timeout-based skipping is unsafe.
  2. Bound concurrency, not just queue depth. Multiple simultaneous DXC/driver builds can make every build slower and consume extreme memory. Reserve foreground CPU and cap native driver compilation separately from translation.
  3. Deduplicate by final identity. One logical PSO should have one in-flight translation/compile job shared by foreground, background, split-chain, and cache consumers. Promotion changes priority; it must not start another build.
  4. Treat driver policy as measured data, not permanent vendor branches. Static AMD/NVIDIA thresholds will age badly across driver versions. Persist observations keyed by adapter, driver, translator version, shader fingerprint, and chosen form; retain conservative hard safety caps.
  5. Account for the whole cost of splitting. Smaller pieces can lower one compiler latency while increasing piece count, scratch, barriers, cache residency, dispatch overhead, and eventual whole-form work. Admission should minimize predicted end-to-end cost, not DXIL bytes alone.
  6. Keep coherency fence-owned. Deferred CPU writes, sparse readback, sync cells, mirror reuse, and tile retirement may publish completion only when the real producer has completed. No try-lock timeout may turn into visible completion.
  7. Make caches an explicit resource policy. Define key/version invalidation, in-flight ownership, memory accounting, eviction safety, and cold/warm behavior. Otherwise the rebuild trades frame stalls for startup stalls, memory spikes, or stale artifacts.

Suggested small PR sequence:

  1. Stall attribution and cold/warm workload scripts, with instrumentation fully absent from the disabled hot path.
  2. Correctness invariants: no skipped semantic commands; fence-owned visibility; safe resource retirement.
  3. A single deduplicating PSO job table with priority promotion and separately bounded translation/driver workers—no behavior change yet.
  4. Route cache miss/build paths through that table while preserving today’s blocking semantics.
  5. Add trace-derived prewarming and measure whether it reduces foreground waits without increasing peak commit or startup time beyond agreed limits.
  6. Only then add adaptive form selection (whole/split/compact/per-lane), one decision variable at a time.

Merge gates should be numeric and paired against main: p50/p95/p99 foreground wait by cause, count and duration of >50 ms frames, title progress/output equivalence, zero skipped semantic work, driver-build peak commit, total startup time, warm-cache behavior, and the existing smoke frame/commit limits. A pipeline rebuild is successful only if it reduces attributed foreground wait without moving the cost into correctness failures, startup, memory, or background CPU contention.

AI-assisted analysis: Codex, GPT-5.6-sol; synthesized from the open-PR review evidence.

**@⁠bmjask** on GitHub · 2026-11-25 21:12 UTC · [original](https://github.com/xcl-dev/xcl/issues/2508#issuecomment-7174752856) A more critical reading: the previous proposal is directionally right, but “build a dependency graph” is too broad to be an actionable design and could turn into a second runtime scheduler whose overhead and failure modes are harder to reason about than today’s code. The first architectural boundary should be stricter: - **PSO/shader preparation** is speculative work. It can be deduplicated, prioritized, cached, and run early, but a title can always present an unseen shader at execution time. - **Memory visibility and queue synchronization** are correctness work. They must be expressed by ownership and fences, not by scheduler priority or best-effort background jobs. Those systems may share observability, but should not share a generic execution graph. A missed PSO deadline may block; a missed copyback/sync deadline must not expose completion or skip ordering. Before rebuilding anything, establish causal stall attribution with negligible disabled-path cost. For every long frame or blocked submission, record mutually exclusive time in: translation, DXC, driver PSO creation, cache wait, scratch/resource allocation, mirror/write-watch work, GPU/fence wait, and lock contention. Without that breakdown, moving work to a worker can merely shift the stall, saturate the CPU, increase driver contention, or inflate commit. Some important design constraints: 1. **Never make semantic work disappear to satisfy a latency budget.** A not-ready PSO may block or use an equivalent prebuilt fallback; a required draw/dispatch/wait cannot be skipped. The reviewed whole-form and ExecuteIndirect changes show why timeout-based skipping is unsafe. 2. **Bound concurrency, not just queue depth.** Multiple simultaneous DXC/driver builds can make every build slower and consume extreme memory. Reserve foreground CPU and cap native driver compilation separately from translation. 3. **Deduplicate by final identity.** One logical PSO should have one in-flight translation/compile job shared by foreground, background, split-chain, and cache consumers. Promotion changes priority; it must not start another build. 4. **Treat driver policy as measured data, not permanent vendor branches.** Static AMD/NVIDIA thresholds will age badly across driver versions. Persist observations keyed by adapter, driver, translator version, shader fingerprint, and chosen form; retain conservative hard safety caps. 5. **Account for the whole cost of splitting.** Smaller pieces can lower one compiler latency while increasing piece count, scratch, barriers, cache residency, dispatch overhead, and eventual whole-form work. Admission should minimize predicted end-to-end cost, not DXIL bytes alone. 6. **Keep coherency fence-owned.** Deferred CPU writes, sparse readback, sync cells, mirror reuse, and tile retirement may publish completion only when the real producer has completed. No try-lock timeout may turn into visible completion. 7. **Make caches an explicit resource policy.** Define key/version invalidation, in-flight ownership, memory accounting, eviction safety, and cold/warm behavior. Otherwise the rebuild trades frame stalls for startup stalls, memory spikes, or stale artifacts. Suggested small PR sequence: 1. Stall attribution and cold/warm workload scripts, with instrumentation fully absent from the disabled hot path. 2. Correctness invariants: no skipped semantic commands; fence-owned visibility; safe resource retirement. 3. A single deduplicating PSO job table with priority promotion and separately bounded translation/driver workers—no behavior change yet. 4. Route cache miss/build paths through that table while preserving today’s blocking semantics. 5. Add trace-derived prewarming and measure whether it reduces foreground waits without increasing peak commit or startup time beyond agreed limits. 6. Only then add adaptive form selection (whole/split/compact/per-lane), one decision variable at a time. Merge gates should be numeric and paired against main: p50/p95/p99 foreground wait by cause, count and duration of >50 ms frames, title progress/output equivalence, zero skipped semantic work, driver-build peak commit, total startup time, warm-cache behavior, and the existing smoke frame/commit limits. A pipeline rebuild is successful only if it reduces attributed foreground wait without moving the cost into correctness failures, startup, memory, or background CPU contention. AI-assisted analysis: Codex, GPT-5.6-sol; synthesized from the open-PR review evidence.
Author
Owner

@⁠bmjask on GitHub · 2026-11-25 21:57 UTC · original

I would redesign this around two deliberately separate systems:

Preparation plane                       Execution/coherency plane
-----------------                       -------------------------
translate shaders                       record commands
choose backend/form                     preserve title ordering
compile DXIL/PSOs                       submit queue segments
cache and prewarm                       publish CPU/GPU visibility
predict future demand                   retire resources fence-safely

The preparation plane may speculate and prioritize. The execution plane must never speculate about correctness.

1. One deduplicated pipeline job

Every logical PSO gets a stable content-derived key including shader/fixed state/root signature hashes, translator and policy versions, adapter, and driver. A device-wide job table owns one lifecycle:

Absent -> Translating -> DXIL ready -> Driver compiling -> Ready
                  \-> Failed

Foreground binds, background prewarming, cache loading, and split-chain construction join the same job. They may promote priority but cannot start duplicate work.

2. Separately bounded worker stages

Translation, DXC, driver PSO creation, and cache I/O need separate limits. Translation is CPU-bound; DXC is memory-heavy; native driver compilation should generally allow only one or two concurrent jobs per adapter. Reserve CPU/memory headroom for the title. Foreground demand promotes an existing job rather than bypassing limits.

3. Explicit not-ready semantics

A bind should resolve to Ready, a proven EquivalentFallback, MustWait, or Failed. There should be no generic Skip. Latency budgets may emit diagnostics, but cannot delete draws, dispatches, ExecuteIndirect work, or synchronization. Deferred replay is valid only with captured inputs, ordering, lifetime guarantees, and completion before every consumer.

4. Whole/split/compact/per-lane are plans

Choose a PipelinePlan before compiling. It should account for expected artifacts, scratch, predicted compile/driver cost, piece count, barriers, dispatch overhead, and cache residency. Optimize predicted end-to-end cost, not DXIL bytes alone. Persist measurements by adapter, driver, translator version, shader fingerprint, and form, with conservative hard safety limits.

5. Explicit cache ownership

Use separate content-addressed caches for translated DXIL, driver blobs, live PSOs, and split artifacts. Each needs complete versioned keys, exact byte accounting, one in-flight owner, safe eviction, bounded negative-result lifetime, and cold/warm metrics. Retiring resources still count against the budget until their fences complete.

6. Trace-derived prewarming

Record a local pipeline trace: first-use order, key, required frame, selected form, and measured costs. Later runs prewarm the critical path with bounded memory/concurrency, yielding to foreground demand. This moves repeatable world-load work before first use without pretending all title behavior is statically predictable.

7. Producer-token coherency

Every write should identify when it is actually visible: recorded GPU submission, deferred CPU operation with prerequisite fences, or complete. Consumers wait on that producer token. A deferred CPU write is not a GPU-ordered write merely because it was recorded. This rule should cover immediate writes, timestamps, sparse copyback, sync cells, mirrors, and tile/resource retirement. No try-lock timeout may publish completion early.

8. Segment lists when CPU work is ordered between GPU work

When console ordering requires GPU A -> CPU operation -> GPU B, represent it explicitly:

GPU segment A -> submit/fence -> CPU operation/publication -> GPU segment B

That is preferable to skipping the wait or inserting a queue wait that deadlocks on the same submission.

9. Generation-based dirty pages

Use dirty generations rather than one reset-and-consume set. Closing generation N atomically routes concurrent writes into N+1; hash/copy N and publish its mirror. Per draw, inspect exact required ranges and intersect them with the closed dirty generation. Keep VirtualQuery, allocations, logging, and global locks out of the common path.

10. Fence-safe residency

Reusable heaps, tiles, descriptor ranges, PSOs, and scratch buffers track last use on every relevant queue and are recycled only after all fences complete. CPU cooling delays are not GPU-completion proofs. Active plus retiring residency counts against the same budget.

11. Remove global hot-path locks

Recording should primarily mutate list-local state. Shared maps should be immutable after publication, sharded, or updated outside recording. Unbounded interval insertion, resource queries, filesystem work, and diagnostics do not belong under a global draw-path lock.

12. Attribute stalls before changing policy

Record mutually exclusive foreground time in translation, DXC, native PSO creation, existing-job waits, cache I/O, mirror/write-watch work, allocation/residency, GPU fences, and lock contention. Disabled instrumentation must be effectively absent from the hot path. Correlate causes to individual long frames rather than reporting totals alone.

Small PR sequence

  1. Stall attribution with a zero-cost disabled path.
  2. Producer tokens and fence-owned visibility invariants.
  3. Correct list segmentation for CPU-mediated ordering.
  4. A device-wide deduplicated PSO job table, preserving blocking behavior.
  5. Separately bounded translation/DXC/driver workers.
  6. Exact cache and retiring-memory accounting.
  7. Pipeline plans with conservative limits.
  8. Trace capture and bounded prewarming.
  9. Generation-based mirror dirty tracking.
  10. Adaptive form selection from persisted measurements.

Merge gates

Use paired measurements against main: p50/p95/p99 foreground waits by cause; count/duration of frames over 50 ms; cold and warm startup; peak commit/residency; compiler concurrency; identical output; zero skipped semantic work; no premature fence visibility/resource reuse; and existing smoke frame/memory limits.

The redesign succeeds only if it reduces foreground stalls without moving the cost into startup delay, memory growth, background contention, missing commands, or synchronization corruption.

AI-assisted analysis: Codex, GPT-5.6-sol; synthesized from the open-PR review evidence.

**@⁠bmjask** on GitHub · 2026-11-25 21:57 UTC · [original](https://github.com/xcl-dev/xcl/issues/2508#issuecomment-7175764333) I would redesign this around two deliberately separate systems: ``` Preparation plane Execution/coherency plane ----------------- ------------------------- translate shaders record commands choose backend/form preserve title ordering compile DXIL/PSOs submit queue segments cache and prewarm publish CPU/GPU visibility predict future demand retire resources fence-safely ``` The preparation plane may speculate and prioritize. The execution plane must never speculate about correctness. ## 1. One deduplicated pipeline job Every logical PSO gets a stable content-derived key including shader/fixed state/root signature hashes, translator and policy versions, adapter, and driver. A device-wide job table owns one lifecycle: ``` Absent -> Translating -> DXIL ready -> Driver compiling -> Ready \-> Failed ``` Foreground binds, background prewarming, cache loading, and split-chain construction join the same job. They may promote priority but cannot start duplicate work. ## 2. Separately bounded worker stages Translation, DXC, driver PSO creation, and cache I/O need separate limits. Translation is CPU-bound; DXC is memory-heavy; native driver compilation should generally allow only one or two concurrent jobs per adapter. Reserve CPU/memory headroom for the title. Foreground demand promotes an existing job rather than bypassing limits. ## 3. Explicit not-ready semantics A bind should resolve to `Ready`, a proven `EquivalentFallback`, `MustWait`, or `Failed`. There should be no generic `Skip`. Latency budgets may emit diagnostics, but cannot delete draws, dispatches, ExecuteIndirect work, or synchronization. Deferred replay is valid only with captured inputs, ordering, lifetime guarantees, and completion before every consumer. ## 4. Whole/split/compact/per-lane are plans Choose a `PipelinePlan` before compiling. It should account for expected artifacts, scratch, predicted compile/driver cost, piece count, barriers, dispatch overhead, and cache residency. Optimize predicted end-to-end cost, not DXIL bytes alone. Persist measurements by adapter, driver, translator version, shader fingerprint, and form, with conservative hard safety limits. ## 5. Explicit cache ownership Use separate content-addressed caches for translated DXIL, driver blobs, live PSOs, and split artifacts. Each needs complete versioned keys, exact byte accounting, one in-flight owner, safe eviction, bounded negative-result lifetime, and cold/warm metrics. Retiring resources still count against the budget until their fences complete. ## 6. Trace-derived prewarming Record a local pipeline trace: first-use order, key, required frame, selected form, and measured costs. Later runs prewarm the critical path with bounded memory/concurrency, yielding to foreground demand. This moves repeatable world-load work before first use without pretending all title behavior is statically predictable. ## 7. Producer-token coherency Every write should identify when it is actually visible: recorded GPU submission, deferred CPU operation with prerequisite fences, or complete. Consumers wait on that producer token. A deferred CPU write is not a GPU-ordered write merely because it was recorded. This rule should cover immediate writes, timestamps, sparse copyback, sync cells, mirrors, and tile/resource retirement. No try-lock timeout may publish completion early. ## 8. Segment lists when CPU work is ordered between GPU work When console ordering requires GPU A -> CPU operation -> GPU B, represent it explicitly: ``` GPU segment A -> submit/fence -> CPU operation/publication -> GPU segment B ``` That is preferable to skipping the wait or inserting a queue wait that deadlocks on the same submission. ## 9. Generation-based dirty pages Use dirty generations rather than one reset-and-consume set. Closing generation N atomically routes concurrent writes into N+1; hash/copy N and publish its mirror. Per draw, inspect exact required ranges and intersect them with the closed dirty generation. Keep VirtualQuery, allocations, logging, and global locks out of the common path. ## 10. Fence-safe residency Reusable heaps, tiles, descriptor ranges, PSOs, and scratch buffers track last use on every relevant queue and are recycled only after all fences complete. CPU cooling delays are not GPU-completion proofs. Active plus retiring residency counts against the same budget. ## 11. Remove global hot-path locks Recording should primarily mutate list-local state. Shared maps should be immutable after publication, sharded, or updated outside recording. Unbounded interval insertion, resource queries, filesystem work, and diagnostics do not belong under a global draw-path lock. ## 12. Attribute stalls before changing policy Record mutually exclusive foreground time in translation, DXC, native PSO creation, existing-job waits, cache I/O, mirror/write-watch work, allocation/residency, GPU fences, and lock contention. Disabled instrumentation must be effectively absent from the hot path. Correlate causes to individual long frames rather than reporting totals alone. ## Small PR sequence 1. Stall attribution with a zero-cost disabled path. 2. Producer tokens and fence-owned visibility invariants. 3. Correct list segmentation for CPU-mediated ordering. 4. A device-wide deduplicated PSO job table, preserving blocking behavior. 5. Separately bounded translation/DXC/driver workers. 6. Exact cache and retiring-memory accounting. 7. Pipeline plans with conservative limits. 8. Trace capture and bounded prewarming. 9. Generation-based mirror dirty tracking. 10. Adaptive form selection from persisted measurements. ## Merge gates Use paired measurements against main: p50/p95/p99 foreground waits by cause; count/duration of frames over 50 ms; cold and warm startup; peak commit/residency; compiler concurrency; identical output; zero skipped semantic work; no premature fence visibility/resource reuse; and existing smoke frame/memory limits. The redesign succeeds only if it reduces foreground stalls without moving the cost into startup delay, memory growth, background contention, missing commands, or synchronization corruption. AI-assisted analysis: Codex, GPT-5.6-sol; synthesized from the open-PR review evidence.
Author
Owner

@⁠KOLESNiii on GitHub · 2026-11-25 23:23 UTC · original

Static review of the pipeline rebuild proposals

Reviewed all three comments against main at 08db8020 and the relevant open issues and PRs. Keep shader/PSO preparation separate from command execution and memory visibility. Fix ordering and lifetime bugs first, and add stall attribution in parallel. The first comment identifies the right sources of work. Its proposed global dependency graph would put speculative preparation and mandatory queue ordering under the same scheduler. The later comments narrow that boundary appropriately. XCL already has useful pieces on both sides, so the rebuild can proceed in small changes.

Shader and pipeline preparation

  1. Extend the existing deduplication at the native PSO boundary. The translated-shader cache already has a per-key in-flight lock, DXC coalesces cache misses, and each async stand-in has one claimable job that preload and foreground users can share. Two equivalent title-created PSOs can still get separate jobs because the pending table is keyed by stand-in address. The sharing in standin.rs is for the placeholder, and the historical shader-set hash omits fixed state. Keep title-facing handles and their metadata independent. Share immutable shader artifacts by translation identity and native builds by canonical, device-scoped PSO identity, including effective root signature and static samplers, fixed state, flags/node, actual shader bytes and variant. Split pieces and the whole form need distinct identities. A build failure or cancelled owner must wake waiters. pso.rs, dxc.rs, standin.rs, pso_async.rs, real.rs, #2085, #2053.

  2. Close existing admission gaps before adding worker stages. Translation/PSO work and DXC already use separate pools, but the PSO pool takes its size from DXC and its jobs can block in DXC, driver creation, or cache I/O. The big/giant driver gate depends on the thread name, so inline foreground paths escape it. DXC checks headroom and increments its active count in separate operations, and its timeout can admit multiple waiting jobs. Use reservations for CPU/commit and native calls across runtime, inline, prewarm, pieces, and offline paths. Promotion should change queue priority under the same limits. Reserve room for urgent demand, including when speculative jobs occupy all slots, and keep parent jobs from holding permits needed by their children. Start with the existing gates and measure contention before adding a separate I/O pool or choosing a universal one- or two-job driver limit. pso_async.rs, pso_async.rs, real.rs, dxc.rs, shaders.rs, #2463, #2424, #2179, #2129.

  3. Make readiness and failure explicit at all consumers. The main tree already defers supported compute dispatches and dispatching ExecuteIndirect to submit. Pending graphics, a timed-out compute PSO, an unsupported split path, and a failed build can still reach stand-in/drop paths. Writes limited to images can affect later consumers. A skipped draw made visible to an occlusion query still has missing draw effects. Use ready, verified equivalent fallback, wait/defer, and failure outcomes. Propagate failure before dependent work or completion becomes visible. Audit console replay, Reset, KickoffX, CreateCommandList, bundles, indirect arguments and count buffers, and repeated submission. #2548 closes early waits in specific entry points. #2547 improves deferred dispatch but still permits a drop after its 30-second bound and can build on the submitting thread. #2550 addresses query fallout only. Keep watchdog and wait-budget diagnostics visible in traces. Review #2519 for scratch ownership on bundles and lists without tracked allocators, and #1124 as crash containment for two-pass indirect commands. bind.rs, bind.rs, console_list.rs, list_x.rs, pso_async.rs, #2455, #2417.

  4. Treat whole, split, compact and per-lane as legal candidates with different costs. Decide what is legal from capabilities, root/ABI requirements, semantics and dispatch context. Refine cost after translation when actual size and piece count are known. Charge translation/DXC, driver time and peak commit, chain scratch, barriers, slabs, residency and later whole-form demand. Main already has size gates, split scratch budgets and direct-DXIL policy switches. The latest main merge #174 changed DXC accessor handling, so new comparisons should start there. #2554 reports that removing control-flow constructs substantially helped some driver builds. #2567 reports smaller artifacts, which leaves driver time and title impact to measure. Use measured per-adapter/driver/toolchain observations after establishing repeatable baselines and keep conservative caps. pso.rs, dispatch_chain.rs, #1096, #1598, #2403, #2482.

  5. Repair the existing caches before expanding them. Module-level translated DXIL, DXC results, in-process driver blobs and disk blobs already exist. Keep split artifacts under their existing translated owner unless there is a measured reason for another store. The translated LRU subtracts piece capacities during eviction but omits them on insertion. Account from one calculation and distinguish bytes retained by the cache, by active callers, and by recorded/in-flight work. Canonicalize native disk keys across runtime and offline use, and namespace by adapter and driver/runtime identity. An accepted blob or matching byte count alone is weak evidence of avoided driver work. Track refused blobs, transient failures and cached negatives distinctly. #2515 addresses node mask, samplers and device setup. Adapter/driver namespacing and the reported stub/crash case remain separate. pso.rs, pso.rs, real.rs, real.rs, shaders.rs, #2454, #2475, #2540, #2453, #2512, #2003.

  6. Build trace-derived prewarming on the existing journal. used-pipelines.txt records first bind by shader-set hash, but reloads it as an unordered membership set and preloads matching descriptors as the title creates them. Extend that path with a title/build/config identity, exact descriptor identity, first demand and milestone, and observed cost. Batch writes away from the bind lock. Use a bounded startup budget, let demand promote a queued job, and report startup-through-checkpoint time including preparation. Coordinate with #755, #2088, #759, #898 and #2096. Keep #2551's whole-form work scoped to observed need or an explicit offline pass. I would revise #2555 before enabling it by default. Its patch scans the entire discovered input before title execution, disables the default offline size cap for launch preparation, builds whole forms for split compute, and can stop launch on preparation failures for artifacts the title may never request. The progress window is useful. An opt-in, capped, demand-ranked pass with a path to continue launching would let it demonstrate net improvement. pso_async.rs, pso_async.rs, shaders.rs, #1035.

Execution, coherency and the draw path

  1. Make completion depend on the real producer. The CPU-write worker currently publishes after its ten-second wait even if the GPU mark remains incomplete. Its loop also reaches publication after failure to arm the event. The sync bridge has CPU signal and timeout paths independent of actual memory publication. Use submission marks for GPU producers and a separate completion state for CPU store/copyback, with failure/device removal distinct from completion. Preserve order per issuing queue without letting a blocked queue stall unrelated CPU writes. Review #850 and #2439 together, and cover immediate writes, readbacks/timestamps and sparse alias visibility. cpu_writes.rs, list_x.rs, list_x.rs, #1452, D3D12 fence completion semantics.

  2. Reuse list segmentation and place the split at the ordering boundary. The runtime already splits lists and batches, but wait_memory can discard a wait based on overlapping prior writes, and a wait can be hoisted ahead of ordinary GPU commands. #2506 tests known written values, while its patch explicitly retains the old elision for an unknown fill/copy value. #851 covers ordinary work before eligible waits. Require evidence that the ordered producer satisfies the actual predicate. For CPU-mediated work use GPU prefix → producer fence → CPU publication → GPU suffix. Include same-batch and cross-queue cases, an earlier insufficient or unknown write, and the console/Wine split paths. Handle an unresolved dependency as failure with diagnostics. list_x.rs, list_x.rs, list_x.rs, list_x.rs, #916.

  3. Charge and retire resources through their last use. Allocator tracking and VRAM retirement already have multi-queue marks. Heap retirement can currently proceed with failed or missing marks, sparse unpin has an early recycling path, and split scratch chooses its size before charging the allocation. Review #2538, #2531, #2532, #2543 and #2417 first. On mark retry, preserve proof obligations for queues that participated in the original retirement even if they leave the live set. Keep active plus retiring bytes charged and handle removed devices as teardown. #2526 is an eviction policy for PSOs and has to retain recorded/in-flight use. Its own description says eviction alone is insufficient for the reported shader-code budget. alloc_pool.rs, vram.rs, sparse.rs, dispatch_chain.rs, #2457, #2403.

  4. Reduce per-draw work with evidence before replacing write tracking. sync_title_buffers takes the global list map, builds temporary vectors, looks up mirrors, checks readability, copies ranges and scans indices. Texture submit refresh already uses GetWriteWatch(WRITE_WATCH_FLAG_RESET) and has separate handling for unwatched mappings. A generation would let multiple consumers share observations, but it does not snapshot memory, prevent concurrent writes during the copy or track arbitrary mapped aliases. Key any generation by mapping identity, preserve a conservative path for unwatched/remapped memory, and publish a mirror only after its writes or uploads are visible to consumers. #2478 reports a slowdown for repeated identical writes. #2533 reports a better result on one measured workload, so compare changed-byte copies, cached index ranges and a draw fast exit before adopting generations. Track per-list mirror bindings so unrelated draws avoid the global lookup. For textures, sequence the per-page baseline, changed subresources and dirty-page lookup with #2484, #2396 and #2397. #2558 handles upload/mapping order and deserves its own review. Move allocations, scans and diagnostic work out of global critical sections where timing and ownership allow. list_x.rs, title_textures.rs, title_textures.rs, #2389, #2390, #2394, Windows write-watch semantics.

Benchmark and repository workflow

  • Measure the foreground critical path. Main has two-second XCL_ACTIVITY totals, PSO driver spans and sparse counters. Overlap with a no-present interval identifies suspects. It cannot establish causation across threads. Build on #2529 for log analysis, #2500 for opt-in timelines and #2566 for shader identification. Record exclusive wait time on the blocked thread and correlate it with job IDs, queue/fence events and background stage spans. Include translation, DXC, native calls, existing-job waits, cache I/O, mirrors, allocation and contention. Check disabled-path overhead. For paired runs use separate fresh and identically seeded warm cache directories and the same build profile, hardware/driver, title version, input schedule and checkpoint. Cover cold startup, world/shader-heavy scenes, duplicate PSO creation, VRAM pressure, and queue/fence contention. Track p50/p95/p99 foreground waits, frames over 50 ms, time to a playable checkpoint, peak commit/residency, build concurrency, skipped semantic commands and premature publication. Use workload outputs or checkpoints for correctness. Keep the existing smoke bounds and establish repeatability before adding more hard numeric gates. host.rs, real.rs, #2129, #2495, #1855, #2225, #717.

  • Stop restoring an immutable, toolchain-blind Windows build cache. The current key covers OS and Cargo files, while Rust floats and the cache includes all of target. An exact hit cannot refresh as sources or the toolchain change, and PR saves are scoped to their merge refs. Review #274 with #2214 and #2370. Use a size-controlled dependency/build cache keyed to toolchain, target and profile, restore on PRs and save from main. Record effective Rust and DXC versions. Compare cache-transfer time with rebuild time before choosing what compiled output to keep. ci.yml, GitHub cache behavior.

  • Give cheap and release checks their own place. Add checker/coverage Python tests on the ordinary unprivileged PR workflow, and run the PowerShell script fixtures in a cheap Windows script lane. The trusted description workflow checks base-branch code, so it cannot catch a checker regression introduced by the candidate. Keep a named required CI result if docs-only PRs bypass the Windows build inside the workflow, and classify changes against build inputs and workflow/script dependencies. Test the merge ref for normal CI. Add a release build on main or a targeted lane first, then expand using measured cost. Keep hosted-runner skips visible. Keep the workspace build until an alternative proves it produces the ordinary xcl.exe and both test-title fixtures. ci.yml, test.ps1, #1019, #279, #2264, GitHub required-check behavior.

  • Tie the PR description check to one revision and improve smoke evidence. Preserve the trusted base checkout and event-scoped test-only waiver. The workflow combines event body/head with the live, paginated file list. Check the live head, base SHA and description around file collection and handle superseded events explicitly. Scope concurrency carefully so an unrelated label or stale delivery cannot replace the required result. Preserve previous filenames for runtime renames and handle incomplete file lists. The checker currently defaults absent/malformed crash fields to zero, can accept a missing memory comparison or nonzero exit, and matches title/duration against a historical main ancestor without hardware matching. Start with #2388, #2406 and #952. Check both runs' measurements, baseline provenance, and explicit handling when main itself crashes. Pin the paired baseline per evaluation and reuse its artifact for matching hardware/settings where the repository policy permits. #2235 and #2351 cover different parts of matching. Record adapter identity, driver, profile, runtime flags and cache state, and derive build provenance from the launched binary or its build manifest. Preserve each run's logs and launcher streams with #1863 and #2471. pr-check.yml, pr_check.py, smoke.ps1, #2232, #2226, #2213, GitHub PR file-list limits.

  • Keep costly diagnostics and queue maintenance off the per-PR merge path. Hosted Windows CI, a local GPU suite and retail smoke answer different questions. Keep full retail/performance comparisons in a trusted hardware lane, with dispatch or scheduled diagnostics such as #2563. Fix failed, empty and unvalidated sweep handling before hard-gating shader coverage. Keep the existing stale-label exemptions for reviewed stacks or work awaiting hardware, and use the stale workflow's dry-run and backlog/operation counts to tune scheduling. The lifecycle policy is independent of build latency. coverage_gate.py, #2260, #2250, #2196, #2536, stale.yml.

Start the small PR series with narrow visibility, command-ordering, lifetime and cache-accounting fixes alongside opt-in attribution. Unify native descriptor identity and admission, then route one PSO family through shared in-flight ownership before expanding. Add bounded trace prewarming and use paired data to tune legal variants and mirror tracking. The CI and smoke-check changes can proceed independently.

Verification — Static source and PR review only. No builds, tests, workflows or benchmarks ran for this review. Reported measurements come from the linked PRs. AI use — Codex (GPT-6, serving variant unspecified) performed the static review and drafted this comment.

**@⁠KOLESNiii** on GitHub · 2026-11-25 23:23 UTC · [original](https://github.com/xcl-dev/xcl/issues/2508#issuecomment-7177485210) ## Static review of the pipeline rebuild proposals Reviewed all three comments against [main at `08db8020`](https://github.com/xcl-dev/xcl/commit/08db8020d323bf478964fcc586152cce54959cfc) and the relevant open issues and PRs. **Keep shader/PSO preparation separate from command execution and memory visibility. Fix ordering and lifetime bugs first, and add stall attribution in parallel.** The first comment identifies the right sources of work. Its proposed global dependency graph would put speculative preparation and mandatory queue ordering under the same scheduler. The later comments narrow that boundary appropriately. XCL already has useful pieces on both sides, so the rebuild can proceed in small changes. ### Shader and pipeline preparation 1. **Extend the existing deduplication at the native PSO boundary.** The translated-shader cache already has a per-key in-flight lock, DXC coalesces cache misses, and each async stand-in has one claimable job that preload and foreground users can share. Two equivalent title-created PSOs can still get separate jobs because the pending table is keyed by stand-in address. The sharing in `standin.rs` is for the placeholder, and the historical shader-set hash omits fixed state. Keep title-facing handles and their metadata independent. Share immutable shader artifacts by translation identity and native builds by canonical, device-scoped PSO identity, including effective root signature and static samplers, fixed state, flags/node, actual shader bytes and variant. Split pieces and the whole form need distinct identities. A build failure or cancelled owner must wake waiters. [pso.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/gpu/recomp/pso.rs#L854), [dxc.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/gpu/recomp/dxc.rs#L775), [standin.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/standin.rs#L41), [pso_async.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/pso_async.rs#L388), [real.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/real.rs#L5522), [#2085](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2085), [#2053](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2053). 2. **Close existing admission gaps before adding worker stages.** Translation/PSO work and DXC already use separate pools, but the PSO pool takes its size from DXC and its jobs can block in DXC, driver creation, or cache I/O. The big/giant driver gate depends on the thread name, so inline foreground paths escape it. DXC checks headroom and increments its active count in separate operations, and its timeout can admit multiple waiting jobs. Use reservations for CPU/commit and native calls across runtime, inline, prewarm, pieces, and offline paths. Promotion should change queue priority under the same limits. Reserve room for urgent demand, including when speculative jobs occupy all slots, and keep parent jobs from holding permits needed by their children. Start with the existing gates and measure contention before adding a separate I/O pool or choosing a universal one- or two-job driver limit. [pso_async.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/pso_async.rs#L294), [pso_async.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/pso_async.rs#L1074), [real.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/real.rs#L4046), [dxc.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/gpu/recomp/dxc.rs#L446), [shaders.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/shaders.rs#L1518), [#2463](https://git.gtahub.st/github/xcl-dev--xcl/issues/2463), [#2424](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2424), [#2179](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2179), [#2129](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2129). 3. **Make readiness and failure explicit at all consumers.** The main tree already defers supported compute dispatches and dispatching `ExecuteIndirect` to submit. Pending graphics, a timed-out compute PSO, an unsupported split path, and a failed build can still reach stand-in/drop paths. Writes limited to images can affect later consumers. A skipped draw made visible to an occlusion query still has missing draw effects. Use ready, verified equivalent fallback, wait/defer, and failure outcomes. Propagate failure before dependent work or completion becomes visible. Audit console replay, Reset, KickoffX, CreateCommandList, bundles, indirect arguments and count buffers, and repeated submission. [#2548](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2548) closes early waits in specific entry points. [#2547](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2547) improves deferred dispatch but still permits a drop after its 30-second bound and can build on the submitting thread. [#2550](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2550) addresses query fallout only. Keep watchdog and wait-budget diagnostics visible in traces. Review [#2519](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2519) for scratch ownership on bundles and lists without tracked allocators, and [#1124](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1124) as crash containment for two-pass indirect commands. [bind.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/bind.rs#L269), [bind.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/bind.rs#L872), [console_list.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/console_list.rs#L870), [list_x.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/list_x.rs#L2667), [pso_async.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/pso_async.rs#L1100), [#2455](https://git.gtahub.st/github/xcl-dev--xcl/issues/2455), [#2417](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2417). 4. **Treat whole, split, compact and per-lane as legal candidates with different costs.** Decide what is legal from capabilities, root/ABI requirements, semantics and dispatch context. Refine cost after translation when actual size and piece count are known. Charge translation/DXC, driver time and peak commit, chain scratch, barriers, slabs, residency and later whole-form demand. Main already has size gates, split scratch budgets and direct-DXIL policy switches. The latest main merge [#174](https://git.gtahub.st/github/xcl-dev--xcl/pulls/174) changed DXC accessor handling, so new comparisons should start there. [#2554](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2554) reports that removing control-flow constructs substantially helped some driver builds. [#2567](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2567) reports smaller artifacts, which leaves driver time and title impact to measure. Use measured per-adapter/driver/toolchain observations after establishing repeatable baselines and keep conservative caps. [pso.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/gpu/recomp/pso.rs#L582), [dispatch_chain.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs#L158), [#1096](https://git.gtahub.st/github/xcl-dev--xcl/issues/1096), [#1598](https://git.gtahub.st/github/xcl-dev--xcl/issues/1598), [#2403](https://git.gtahub.st/github/xcl-dev--xcl/issues/2403), [#2482](https://git.gtahub.st/github/xcl-dev--xcl/issues/2482). 5. **Repair the existing caches before expanding them.** Module-level translated DXIL, DXC results, in-process driver blobs and disk blobs already exist. Keep split artifacts under their existing translated owner unless there is a measured reason for another store. The translated LRU subtracts piece capacities during eviction but omits them on insertion. Account from one calculation and distinguish bytes retained by the cache, by active callers, and by recorded/in-flight work. Canonicalize native disk keys across runtime and offline use, and namespace by adapter and driver/runtime identity. An accepted blob or matching byte count alone is weak evidence of avoided driver work. Track refused blobs, transient failures and cached negatives distinctly. [#2515](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2515) addresses node mask, samplers and device setup. Adapter/driver namespacing and the reported stub/crash case remain separate. [pso.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/gpu/recomp/pso.rs#L742), [pso.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/gpu/recomp/pso.rs#L818), [real.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/real.rs#L4400), [real.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/real.rs#L4483), [shaders.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/shaders.rs#L1536), [#2454](https://git.gtahub.st/github/xcl-dev--xcl/issues/2454), [#2475](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2475), [#2540](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2540), [#2453](https://git.gtahub.st/github/xcl-dev--xcl/issues/2453), [#2512](https://git.gtahub.st/github/xcl-dev--xcl/issues/2512), [#2003](https://git.gtahub.st/github/xcl-dev--xcl/issues/2003). 6. **Build trace-derived prewarming on the existing journal.** `used-pipelines.txt` records first bind by shader-set hash, but reloads it as an unordered membership set and preloads matching descriptors as the title creates them. Extend that path with a title/build/config identity, exact descriptor identity, first demand and milestone, and observed cost. Batch writes away from the bind lock. Use a bounded startup budget, let demand promote a queued job, and report startup-through-checkpoint time including preparation. Coordinate with [#755](https://git.gtahub.st/github/xcl-dev--xcl/issues/755), [#2088](https://git.gtahub.st/github/xcl-dev--xcl/issues/2088), [#759](https://git.gtahub.st/github/xcl-dev--xcl/pulls/759), [#898](https://git.gtahub.st/github/xcl-dev--xcl/pulls/898) and [#2096](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2096). Keep [#2551](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2551)'s whole-form work scoped to observed need or an explicit offline pass. **I would revise [#2555](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2555) before enabling it by default.** Its patch scans the entire discovered input before title execution, disables the default offline size cap for launch preparation, builds whole forms for split compute, and can stop launch on preparation failures for artifacts the title may never request. The progress window is useful. An opt-in, capped, demand-ranked pass with a path to continue launching would let it demonstrate net improvement. [pso_async.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/pso_async.rs#L419), [pso_async.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/pso_async.rs#L475), [shaders.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/shaders.rs#L1593), [#1035](https://git.gtahub.st/github/xcl-dev--xcl/issues/1035). ### Execution, coherency and the draw path 7. **Make completion depend on the real producer.** The CPU-write worker currently publishes after its ten-second wait even if the GPU mark remains incomplete. Its loop also reaches publication after failure to arm the event. The sync bridge has CPU signal and timeout paths independent of actual memory publication. Use submission marks for GPU producers and a separate completion state for CPU store/copyback, with failure/device removal distinct from completion. Preserve order per issuing queue without letting a blocked queue stall unrelated CPU writes. Review [#850](https://git.gtahub.st/github/xcl-dev--xcl/pulls/850) and [#2439](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2439) together, and cover immediate writes, readbacks/timestamps and sparse alias visibility. [cpu_writes.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/cpu_writes.rs#L52), [list_x.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/list_x.rs#L1823), [list_x.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/list_x.rs#L2057), [#1452](https://git.gtahub.st/github/xcl-dev--xcl/issues/1452), [D3D12 fence completion semantics](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12fence-getcompletedvalue). 8. **Reuse list segmentation and place the split at the ordering boundary.** The runtime already splits lists and batches, but `wait_memory` can discard a wait based on overlapping prior writes, and a wait can be hoisted ahead of ordinary GPU commands. [#2506](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2506) tests known written values, while its patch explicitly retains the old elision for an unknown fill/copy value. [#851](https://git.gtahub.st/github/xcl-dev--xcl/pulls/851) covers ordinary work before eligible waits. Require evidence that the ordered producer satisfies the actual predicate. For CPU-mediated work use GPU prefix → producer fence → CPU publication → GPU suffix. Include same-batch and cross-queue cases, an earlier insufficient or unknown write, and the console/Wine split paths. Handle an unresolved dependency as failure with diagnostics. [list_x.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/list_x.rs#L1891), [list_x.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/list_x.rs#L2013), [list_x.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/list_x.rs#L2096), [list_x.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/list_x.rs#L2985), [#916](https://git.gtahub.st/github/xcl-dev--xcl/issues/916). 9. **Charge and retire resources through their last use.** Allocator tracking and VRAM retirement already have multi-queue marks. Heap retirement can currently proceed with failed or missing marks, sparse unpin has an early recycling path, and split scratch chooses its size before charging the allocation. Review [#2538](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2538), [#2531](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2531), [#2532](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2532), [#2543](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2543) and [#2417](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2417) first. On mark retry, preserve proof obligations for queues that participated in the original retirement even if they leave the live set. Keep active plus retiring bytes charged and handle removed devices as teardown. [#2526](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2526) is an eviction policy for PSOs and has to retain recorded/in-flight use. Its own description says eviction alone is insufficient for the reported shader-code budget. [alloc_pool.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/alloc_pool.rs#L185), [vram.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/vram.rs#L1112), [sparse.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/sparse.rs#L1411), [dispatch_chain.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs#L170), [#2457](https://git.gtahub.st/github/xcl-dev--xcl/issues/2457), [#2403](https://git.gtahub.st/github/xcl-dev--xcl/issues/2403). 10. **Reduce per-draw work with evidence before replacing write tracking.** `sync_title_buffers` takes the global list map, builds temporary vectors, looks up mirrors, checks readability, copies ranges and scans indices. Texture submit refresh already uses `GetWriteWatch(WRITE_WATCH_FLAG_RESET)` and has separate handling for unwatched mappings. A generation would let multiple consumers share observations, but it does not snapshot memory, prevent concurrent writes during the copy or track arbitrary mapped aliases. Key any generation by mapping identity, preserve a conservative path for unwatched/remapped memory, and publish a mirror only after its writes or uploads are visible to consumers. [#2478](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2478) reports a slowdown for repeated identical writes. [#2533](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2533) reports a better result on one measured workload, so compare changed-byte copies, cached index ranges and a draw fast exit before adopting generations. Track per-list mirror bindings so unrelated draws avoid the global lookup. For textures, sequence the per-page baseline, changed subresources and dirty-page lookup with [#2484](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2484), [#2396](https://git.gtahub.st/github/xcl-dev--xcl/issues/2396) and [#2397](https://git.gtahub.st/github/xcl-dev--xcl/issues/2397). [#2558](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2558) handles upload/mapping order and deserves its own review. Move allocations, scans and diagnostic work out of global critical sections where timing and ownership allow. [list_x.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/list_x.rs#L3723), [title_textures.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/title_textures.rs#L700), [title_textures.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/title_textures.rs#L868), [#2389](https://git.gtahub.st/github/xcl-dev--xcl/issues/2389), [#2390](https://git.gtahub.st/github/xcl-dev--xcl/issues/2390), [#2394](https://git.gtahub.st/github/xcl-dev--xcl/issues/2394), [Windows write-watch semantics](https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-getwritewatch). ### Benchmark and repository workflow - **Measure the foreground critical path.** Main has two-second `XCL_ACTIVITY` totals, PSO driver spans and sparse counters. Overlap with a no-present interval identifies suspects. It cannot establish causation across threads. Build on [#2529](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2529) for log analysis, [#2500](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2500) for opt-in timelines and [#2566](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2566) for shader identification. Record exclusive wait time on the blocked thread and correlate it with job IDs, queue/fence events and background stage spans. Include translation, DXC, native calls, existing-job waits, cache I/O, mirrors, allocation and contention. Check disabled-path overhead. For paired runs use separate fresh and identically seeded warm cache directories and the same build profile, hardware/driver, title version, input schedule and checkpoint. Cover cold startup, world/shader-heavy scenes, duplicate PSO creation, VRAM pressure, and queue/fence contention. Track p50/p95/p99 foreground waits, frames over 50 ms, time to a playable checkpoint, peak commit/residency, build concurrency, skipped semantic commands and premature publication. Use workload outputs or checkpoints for correctness. Keep the existing smoke bounds and establish repeatability before adding more hard numeric gates. [host.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/host.rs#L43), [real.rs](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/crates/xcl/src/hle/d3d12x/real.rs#L4046), [#2129](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2129), [#2495](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2495), [#1855](https://git.gtahub.st/github/xcl-dev--xcl/issues/1855), [#2225](https://git.gtahub.st/github/xcl-dev--xcl/issues/2225), [#717](https://git.gtahub.st/github/xcl-dev--xcl/issues/717). - **Stop restoring an immutable, toolchain-blind Windows build cache.** The current key covers OS and Cargo files, while Rust floats and the cache includes all of `target`. An exact hit cannot refresh as sources or the toolchain change, and PR saves are scoped to their merge refs. Review [#274](https://git.gtahub.st/github/xcl-dev--xcl/pulls/274) with [#2214](https://git.gtahub.st/github/xcl-dev--xcl/issues/2214) and [#2370](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2370). Use a size-controlled dependency/build cache keyed to toolchain, target and profile, restore on PRs and save from main. Record effective Rust and DXC versions. Compare cache-transfer time with rebuild time before choosing what compiled output to keep. [ci.yml](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/.github/workflows/ci.yml#L36), [GitHub cache behavior](https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching). - **Give cheap and release checks their own place.** Add checker/coverage Python tests on the ordinary unprivileged PR workflow, and run the PowerShell script fixtures in a cheap Windows script lane. The trusted description workflow checks base-branch code, so it cannot catch a checker regression introduced by the candidate. Keep a named required CI result if docs-only PRs bypass the Windows build inside the workflow, and classify changes against build inputs and workflow/script dependencies. Test the merge ref for normal CI. Add a release build on main or a targeted lane first, then expand using measured cost. Keep hosted-runner skips visible. Keep the workspace build until an alternative proves it produces the ordinary `xcl.exe` and both test-title fixtures. [ci.yml](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/.github/workflows/ci.yml#L25), [test.ps1](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/scripts/test.ps1#L1), [#1019](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1019), [#279](https://git.gtahub.st/github/xcl-dev--xcl/pulls/279), [#2264](https://git.gtahub.st/github/xcl-dev--xcl/issues/2264), [GitHub required-check behavior](https://docs.github.com/en/pull-requests/how-tos/merge-and-close-pull-requests/troubleshooting-required-status-checks). - **Tie the PR description check to one revision and improve smoke evidence.** Preserve the trusted base checkout and event-scoped `test-only` waiver. The workflow combines event body/head with the live, paginated file list. Check the live head, base SHA and description around file collection and handle superseded events explicitly. Scope concurrency carefully so an unrelated label or stale delivery cannot replace the required result. Preserve previous filenames for runtime renames and handle incomplete file lists. The checker currently defaults absent/malformed crash fields to zero, can accept a missing memory comparison or nonzero exit, and matches title/duration against a historical main ancestor without hardware matching. Start with [#2388](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2388), [#2406](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2406) and [#952](https://git.gtahub.st/github/xcl-dev--xcl/pulls/952). Check both runs' measurements, baseline provenance, and explicit handling when main itself crashes. Pin the paired baseline per evaluation and reuse its artifact for matching hardware/settings where the repository policy permits. [#2235](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2235) and [#2351](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2351) cover different parts of matching. Record adapter identity, driver, profile, runtime flags and cache state, and derive build provenance from the launched binary or its build manifest. Preserve each run's logs and launcher streams with [#1863](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1863) and [#2471](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2471). [pr-check.yml](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/.github/workflows/pr-check.yml#L35), [pr_check.py](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/scripts/pr_check.py#L130), [smoke.ps1](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/scripts/smoke.ps1#L32), [#2232](https://git.gtahub.st/github/xcl-dev--xcl/issues/2232), [#2226](https://git.gtahub.st/github/xcl-dev--xcl/issues/2226), [#2213](https://git.gtahub.st/github/xcl-dev--xcl/issues/2213), [GitHub PR file-list limits](https://docs.github.com/en/rest/pulls/pulls#list-pull-requests-files). - **Keep costly diagnostics and queue maintenance off the per-PR merge path.** Hosted Windows CI, a local GPU suite and retail smoke answer different questions. Keep full retail/performance comparisons in a trusted hardware lane, with dispatch or scheduled diagnostics such as [#2563](https://git.gtahub.st/github/xcl-dev--xcl/issues/2563). Fix failed, empty and unvalidated sweep handling before hard-gating shader coverage. Keep the existing stale-label exemptions for reviewed stacks or work awaiting hardware, and use the stale workflow's dry-run and backlog/operation counts to tune scheduling. The lifecycle policy is independent of build latency. [coverage_gate.py](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/scripts/coverage_gate.py#L59), [#2260](https://git.gtahub.st/github/xcl-dev--xcl/issues/2260), [#2250](https://git.gtahub.st/github/xcl-dev--xcl/issues/2250), [#2196](https://git.gtahub.st/github/xcl-dev--xcl/issues/2196), [#2536](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2536), [stale.yml](https://github.com/xcl-dev/xcl/blob/08db8020d323bf478964fcc586152cce54959cfc/.github/workflows/stale.yml#L6). Start the small PR series with narrow visibility, command-ordering, lifetime and cache-accounting fixes alongside opt-in attribution. Unify native descriptor identity and admission, then route one PSO family through shared in-flight ownership before expanding. Add bounded trace prewarming and use paired data to tune legal variants and mirror tracking. The CI and smoke-check changes can proceed independently. **Verification** — Static source and PR review only. No builds, tests, workflows or benchmarks ran for this review. Reported measurements come from the linked PRs. **AI use** — Codex (GPT-6, serving variant unspecified) performed the static review and drafted this comment.
Author
Owner

@⁠KOLESNiii on GitHub · 2026-11-26 00:52 UTC · original

A concrete cache-recovery issue for the rebuild discussion. The same ordering is in the #2001 head 008d9c1c and in amd-dev at 6a0bb5b4f294b0729771ed457af1f96c01f5c06b.

LibraryStore::open_latest maps the highest numbered generation, then tries to delete older generations and every .tmp in the directory. D3D12 validates the mapped bytes only afterward, in open_or_create. If D3D12 rejects the newest generation, the code can already have deleted a usable predecessor. The path starts an empty library for a rejected blob and does not try an older one. AMD open and cleanup, AMD validation, #2001 open and cleanup.

Offline warming and the title can also open the same adapter directory. Each LibraryStore seeds a process-local next-generation counter from the directory, and each writer serializes its own snapshot. Two writers starting at the same generation can choose the same final pathname. The temporary files include a PID, but startup cleanup does not check ownership. Even with unique final filenames, choosing only the newest independent snapshot does not combine their entries. Generation selection and cleanup, offline writer.

I'd validate before pruning, keep one last-known-good generation, and define one writer per cache namespace or give overlapping runs separate namespaces. A recovery fixture can seed a valid generation followed by a nonempty invalid one and check that the valid one is still available. A standalone filesystem probe confirmed what the current cleanup removes. Windows mapping and library recovery, driver timings and title impact remain unmeasured.

AI use — OpenAI Codex (GPT-6, exact serving variant unavailable) checked both source revisions, ran the filesystem probe and drafted this comment.

**@⁠KOLESNiii** on GitHub · 2026-11-26 00:52 UTC · [original](https://github.com/xcl-dev/xcl/issues/2508#issuecomment-7179208240) A concrete cache-recovery issue for the rebuild discussion. The same ordering is in the #2001 head `008d9c1c` and in `amd-dev` at `6a0bb5b4f294b0729771ed457af1f96c01f5c06b`. `LibraryStore::open_latest` maps the highest numbered generation, then tries to delete older generations and every `.tmp` in the directory. D3D12 validates the mapped bytes only afterward, in `open_or_create`. If D3D12 rejects the newest generation, the code can already have deleted a usable predecessor. The path starts an empty library for a rejected blob and does not try an older one. [AMD open and cleanup](https://github.com/xcl-dev/xcl/blob/6a0bb5b/crates/xcl/src/hle/d3d12x/pso_library.rs#L279-L307), [AMD validation](https://github.com/xcl-dev/xcl/blob/6a0bb5b/crates/xcl/src/hle/d3d12x/pso_library.rs#L463-L505), [#2001 open and cleanup](https://github.com/xcl-dev/xcl/blob/008d9c1c/crates/xcl/src/hle/d3d12x/pso_library.rs#L278-L308). Offline warming and the title can also open the same adapter directory. Each `LibraryStore` seeds a process-local next-generation counter from the directory, and each writer serializes its own snapshot. Two writers starting at the same generation can choose the same final pathname. The temporary files include a PID, but startup cleanup does not check ownership. Even with unique final filenames, choosing only the newest independent snapshot does not combine their entries. [Generation selection and cleanup](https://github.com/xcl-dev/xcl/blob/6a0bb5b/crates/xcl/src/hle/d3d12x/pso_library.rs#L263-L350), [offline writer](https://github.com/xcl-dev/xcl/blob/6a0bb5b/crates/xcl/src/shaders.rs#L1448-L1470). I'd validate before pruning, keep one last-known-good generation, and define one writer per cache namespace or give overlapping runs separate namespaces. A recovery fixture can seed a valid generation followed by a nonempty invalid one and check that the valid one is still available. A standalone filesystem probe confirmed what the current cleanup removes. Windows mapping and library recovery, driver timings and title impact remain unmeasured. AI use — OpenAI Codex (GPT-6, exact serving variant unavailable) checked both source revisions, ran the filesystem probe and drafted this comment.
Author
Owner

@⁠KOLESNiii on GitHub · 2026-11-26 01:08 UTC · original · edited 2026-11-26 01:18 UTC

Four driver blob cache cases on main at b49be18 that a rebuild should preserve tests for.

  • Graphics descriptor identity. With a translated VS and a native GS, translated_graphics_pso_once keeps the native GS in the descriptor sent to the driver. graphics_blob_key hashes GS bytes only when XCL generated a rect GS. It also omits stream-output state that the descriptor preserves. Descriptors that differ only in the omitted state can therefore share a RAM key and disk filename when only that state differs. A strong suspect for repeat compilation is an A/B/A sequence on these variants where the driver rejects each other variant’s blob. Check the actual key, native HRESULT and cold retry on that sequence. #902’s draft includes native GS bytes and skips stream-output PSOs. Translated descriptor and lookup · Key fields · D3D12 cached PSO contract

  • Graphics RAM budget. keep_graphics_blob checks for an existing key before the driver call, then charges the bytes and inserts under the lock without rechecking the key. In a standalone probe using the extracted functions, two simulated 16-byte results for the same key left one entry and 32 bytes charged. Forgetting the entry left an empty map with 16 bytes still charged. #826 covers the compute helper. The graphics counterpart is relevant to persistence too because the runtime disk write reads the value back from this RAM map. The frequency of competing stores in a title is unmeasured. Graphics map · Persistence caller

  • Late rejection can erase a newer blob. A caller reads a file, hands the bytes to the driver, and on refusal deletes the filename. The delete has no relationship to the version it read. A standalone probe reproduced read A → publish B at the same path → reject A → B gone using the extracted file helpers and a simulated rejection. Under overlapping warmers or duplicate builds, a correct replacement can disappear and leave the next run cold. The next Windows check is to pause one loader after its read, publish a replacement, then release the first caller with a refusal HRESULT. Read and refusal caller · Disk helpers

  • Warm disk hits stay out of the RAM cache. A successful disk-backed create in the ordinary compute, graphics and two-pass compute paths counts a disk hit without inserting the accepted byte buffer in RAM. Absent another insertion, the next create for the same key reads the file again. The time spent reading it is outside the existing driver-create span. If warm startup repeats the same large keys, avoidable read/copy time is plausible. Count disk bytes and distinct keys per process plus time inside the read. The OS file cache may make the cost small. Compute · Compute success · Graphics · Two-pass compute success

Static review plus two standalone probes on Linux. Windows driver behavior and timing remain unmeasured. AI use was OpenAI Codex (GPT-6, exact serving variant unavailable) for review, probes and drafting.

Follow-up issues

  • #2600 tracks offline graphics DXIL variant parity.
  • #2601 tracks protecting replacement blobs during invalidation.
  • #2602 tracks deferred dispatch command list close failures.
**@⁠KOLESNiii** on GitHub · 2026-11-26 01:08 UTC · [original](https://github.com/xcl-dev/xcl/issues/2508#issuecomment-7179477668) · edited 2026-11-26 01:18 UTC Four driver blob cache cases on `main` at `b49be18` that a rebuild should preserve tests for. - **Graphics descriptor identity.** With a translated VS and a native GS, `translated_graphics_pso_once` keeps the native GS in the descriptor sent to the driver. `graphics_blob_key` hashes GS bytes only when XCL generated a rect GS. It also omits stream-output state that the descriptor preserves. Descriptors that differ only in the omitted state can therefore share a RAM key and disk filename when only that state differs. A strong suspect for repeat compilation is an A/B/A sequence on these variants where the driver rejects each other variant’s blob. Check the actual key, native HRESULT and cold retry on that sequence. #902’s draft includes native GS bytes and skips stream-output PSOs. [Translated descriptor and lookup](https://github.com/xcl-dev/xcl/blob/b49be18/crates/xcl/src/hle/d3d12x/real.rs#L5233-L5285) · [Key fields](https://github.com/xcl-dev/xcl/blob/b49be18/crates/xcl/src/hle/d3d12x/real.rs#L4851-L4966) · [D3D12 cached PSO contract](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_cached_pipeline_state) - **Graphics RAM budget.** `keep_graphics_blob` checks for an existing key before the driver call, then charges the bytes and inserts under the lock without rechecking the key. In a standalone probe using the extracted functions, two simulated 16-byte results for the same key left one entry and 32 bytes charged. Forgetting the entry left an empty map with 16 bytes still charged. #826 covers the compute helper. The graphics counterpart is relevant to persistence too because the runtime disk write reads the value back from this RAM map. The frequency of competing stores in a title is unmeasured. [Graphics map](https://github.com/xcl-dev/xcl/blob/b49be18/crates/xcl/src/hle/d3d12x/real.rs#L4820-L4849) · [Persistence caller](https://github.com/xcl-dev/xcl/blob/b49be18/crates/xcl/src/hle/d3d12x/real.rs#L5278-L5285) - **Late rejection can erase a newer blob.** A caller reads a file, hands the bytes to the driver, and on refusal deletes the filename. The delete has no relationship to the version it read. A standalone probe reproduced `read A → publish B at the same path → reject A → B gone` using the extracted file helpers and a simulated rejection. Under overlapping warmers or duplicate builds, a correct replacement can disappear and leave the next run cold. The next Windows check is to pause one loader after its read, publish a replacement, then release the first caller with a refusal HRESULT. [Read and refusal caller](https://github.com/xcl-dev/xcl/blob/b49be18/crates/xcl/src/hle/d3d12x/real.rs#L4424-L4454) · [Disk helpers](https://github.com/xcl-dev/xcl/blob/b49be18/crates/xcl/src/hle/d3d12x/real.rs#L4533-L4588) - **Warm disk hits stay out of the RAM cache.** A successful disk-backed create in the ordinary compute, graphics and two-pass compute paths counts a disk hit without inserting the accepted byte buffer in RAM. Absent another insertion, the next create for the same key reads the file again. The time spent reading it is outside the existing driver-create span. If warm startup repeats the same large keys, avoidable read/copy time is plausible. Count disk bytes and distinct keys per process plus time inside the read. The OS file cache may make the cost small. [Compute](https://github.com/xcl-dev/xcl/blob/b49be18/crates/xcl/src/hle/d3d12x/real.rs#L4424-L4446) · [Compute success](https://github.com/xcl-dev/xcl/blob/b49be18/crates/xcl/src/hle/d3d12x/real.rs#L4467-L4475) · [Graphics](https://github.com/xcl-dev/xcl/blob/b49be18/crates/xcl/src/hle/d3d12x/real.rs#L5257-L5285) · [Two-pass compute success](https://github.com/xcl-dev/xcl/blob/b49be18/crates/xcl/src/hle/d3d12x/real.rs#L6040-L6048) Static review plus two standalone probes on Linux. Windows driver behavior and timing remain unmeasured. AI use was OpenAI Codex (GPT-6, exact serving variant unavailable) for review, probes and drafting. **Follow-up issues** - #2600 tracks offline graphics DXIL variant parity. - #2601 tracks protecting replacement blobs during invalidation. - #2602 tracks deferred dispatch command list close failures.
Author
Owner

@⁠KOLESNiii on GitHub · 2026-11-26 01:34 UTC · original

Follow-up on main b49be18. The review suggests four seams for a larger PSO rebuild. Each can be migrated separately.

  1. Use a common, lossless build request. Capture a request once at the API boundary, own all bytes used asynchronously, and use the same normalized descriptor to build, key and replay it. Translation identity needs the effective backend, paired graphics sampler layout, memory windows and wave form. A native artifact identity adds final shaders, root ABI, full fixed state and adapter/runtime compatibility. A live job also needs the device lifetime. The stand-in sharing key is intentionally less specific than a native descriptor. Use an explicit uncacheable path for state the codec cannot faithfully represent. Start with ordinary compute, run its legacy and stream entry points against the same request, then migrate graphics. This directly covers #2453, #2600, #2606 and #2607. Existing keys
  2. Put single-flight at the work that is shared. Keep distinct logical title PSOs while a keyed compilation job shares shader results and driver work. Let every subscriber raise demand on the dependency it is waiting for. Schedule cache lookup, translation/DXC and native creation separately. Carry structured failure and fallback results across worker threads. Cover a wanted waiter behind a preload-owned shader (#2608), and check class counts and combined commit reservation together (#2463, #1924). Start by coalescing build work or artifact bytes. Sharing a live PSO needs separate fencing and ownership tests (#2417).
  3. Make submission a checked boundary. A list needs an owned resolved PSO and all replay inputs through successful close and submit. Publish completion bookkeeping against work actually submitted. Use explicit states for pending, ready, failed and eligible equivalent fallback. Check current deferred failure handling before moving more graphics work to submission. Test split/Kickoff, repeated submit, abort, and failed close alongside #2602, #2547 and #2549.
  4. Use the same request in offline replay and demand tracing. The current journal calls note_use in resolve; that resolver is also invoked by metadata queries and binding well before native submission. Its shader-only key is a useful warm-up hint. Add first-demand and first-submitted events keyed to the final plan so the replay can prioritize actual world-entry dependencies, including specific whole fallbacks and graphics pairs. Verify with a bind-only recording and a batch that submits. Journal · Resolver · Metadata example

Keep persistence behind that request identity. A D3D12 pipeline-library backend can be compared with the per-blob store on the same corpus. It needs immutable backing storage for the loaded library's lifetime, external serialization of same-PSO loads, and generation recovery with a previous known-good snapshot (#2601, #2001). Measure file and load time and crash/interruption behavior before selecting a transport. D3D12 pipeline-library contract

Migration order: trace and parity tests, shared ordinary-compute descriptors, demand-aware shader jobs, one native PSO family, then offline replay and wider graphics adoption. For each transition use exact cache/driver controls, report union time on the dependency holding the frame, and verify submitted work and GPU output. No Windows timing has been measured for this proposal.

AI use was OpenAI Codex (GPT-6, exact serving variant unavailable) for static review and drafting.

**@⁠KOLESNiii** on GitHub · 2026-11-26 01:34 UTC · [original](https://github.com/xcl-dev/xcl/issues/2508#issuecomment-7179911236) Follow-up on `main` `b49be18`. The review suggests four seams for a larger PSO rebuild. Each can be migrated separately. 1. **Use a common, lossless build request.** Capture a request once at the API boundary, own all bytes used asynchronously, and use the same normalized descriptor to build, key and replay it. Translation identity needs the effective backend, paired graphics sampler layout, memory windows and wave form. A native artifact identity adds final shaders, root ABI, full fixed state and adapter/runtime compatibility. A live job also needs the device lifetime. The stand-in sharing key is intentionally less specific than a native descriptor. Use an explicit uncacheable path for state the codec cannot faithfully represent. Start with ordinary compute, run its legacy and stream entry points against the same request, then migrate graphics. This directly covers #2453, #2600, #2606 and #2607. [Existing keys](https://github.com/xcl-dev/xcl/blob/b49be18/crates/xcl/src/hle/d3d12x/real.rs#L5546-L5589) 2. **Put single-flight at the work that is shared.** Keep distinct logical title PSOs while a keyed compilation job shares shader results and driver work. Let every subscriber raise demand on the dependency it is waiting for. Schedule cache lookup, translation/DXC and native creation separately. Carry structured failure and fallback results across worker threads. Cover a wanted waiter behind a preload-owned shader (#2608), and check class counts and combined commit reservation together (#2463, #1924). Start by coalescing build work or artifact bytes. Sharing a live PSO needs separate fencing and ownership tests (#2417). 3. **Make submission a checked boundary.** A list needs an owned resolved PSO and all replay inputs through successful close and submit. Publish completion bookkeeping against work actually submitted. Use explicit states for pending, ready, failed and eligible equivalent fallback. Check current deferred failure handling before moving more graphics work to submission. Test split/Kickoff, repeated submit, abort, and failed close alongside #2602, #2547 and #2549. 4. **Use the same request in offline replay and demand tracing.** The current journal calls `note_use` in `resolve`; that resolver is also invoked by metadata queries and binding well before native submission. Its shader-only key is a useful warm-up hint. Add first-demand and first-submitted events keyed to the final plan so the replay can prioritize actual world-entry dependencies, including specific whole fallbacks and graphics pairs. Verify with a bind-only recording and a batch that submits. [Journal](https://github.com/xcl-dev/xcl/blob/b49be18/crates/xcl/src/hle/d3d12x/pso_async.rs#L419-L485) · [Resolver](https://github.com/xcl-dev/xcl/blob/b49be18/crates/xcl/src/hle/d3d12x/pso_async.rs#L1049-L1079) · [Metadata example](https://github.com/xcl-dev/xcl/blob/b49be18/crates/xcl/src/hle/d3d12x/real.rs#L3885-L3893) Keep persistence behind that request identity. A D3D12 pipeline-library backend can be compared with the per-blob store on the same corpus. It needs immutable backing storage for the loaded library's lifetime, external serialization of same-PSO loads, and generation recovery with a previous known-good snapshot (#2601, #2001). Measure file and load time and crash/interruption behavior before selecting a transport. [D3D12 pipeline-library contract](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device1-createpipelinelibrary) Migration order: trace and parity tests, shared ordinary-compute descriptors, demand-aware shader jobs, one native PSO family, then offline replay and wider graphics adoption. For each transition use exact cache/driver controls, report union time on the dependency holding the frame, and verify submitted work and GPU output. No Windows timing has been measured for this proposal. AI use was OpenAI Codex (GPT-6, exact serving variant unavailable) for static review and drafting.
Author
Owner

@⁠ettehn on GitHub · 2026-11-26 12:57 UTC · original · edited 2026-11-26 13:02 UTC

Native Windows data for the graphics descriptor identity case. I checked the GS dimension with a synthetic A/B/A fixture on an RTX 5070 Ti Laptop (12 GB), DXC 1.8.2502.11.

  • Both native GS variants built successfully without a blob. They shared the old XCL key on main b49be183 when the key included only generated rect GS. A narrow local patch that reads final desc.GS gave the variants separate keys.
  • With the corresponding cached blob, native CreateGraphicsPipelineState succeeded in all three calls. With the other variant's blob, it returned 0x80070057 all three times. The shader stages and fixed state apart from the GS were identical.

This supports the GS-key change in 1452463 and #902. That initial check used my local patch. It did not benchmark timings or run a retail title. There is no need for a duplicate GS-only PR from me if the broader change is going forward.

AI-assisted implementation and verification (OpenAI Codex).

Native Windows follow-up on 14524632d1847c704eb16b9ea172d0afc8bc5b71. The clean fork checkout passed all 8 graphics_blob_tests:: tests, including the stream-output cacheability guard. A separate test-only overlay with the same two synthetic GS variants again produced distinct keys and reproduced 3/3 own-blob accepts and 3/3 cross-blob refusals (0x80070057). The overlay was removed afterward. The stream-output result covers the guard test. No real stream-output draw or retail title was run. AI-assisted verification (OpenAI Codex).

**@⁠ettehn** on GitHub · 2026-11-26 12:57 UTC · [original](https://github.com/xcl-dev/xcl/issues/2508#issuecomment-7192687737) · edited 2026-11-26 13:02 UTC Native Windows data for the [graphics descriptor identity case](https://git.gtahub.st/github/xcl-dev--xcl/issues/2508). I checked the GS dimension with a synthetic A/B/A fixture on an RTX 5070 Ti Laptop (12 GB), DXC 1.8.2502.11. - Both native GS variants built successfully without a blob. They shared the old XCL key on `main` `b49be183` when the key included only generated rect GS. A narrow local patch that reads final `desc.GS` gave the variants separate keys. - With the corresponding cached blob, native `CreateGraphicsPipelineState` succeeded in all three calls. With the other variant's blob, it returned `0x80070057` all three times. The shader stages and fixed state apart from the GS were identical. This supports the GS-key change in [`1452463`](https://github.com/bmjask/xcl/commit/14524632d1847c704eb16b9ea172d0afc8bc5b71) and #902. That initial check used my local patch. It did not benchmark timings or run a retail title. There is no need for a duplicate GS-only PR from me if the broader change is going forward. AI-assisted implementation and verification (OpenAI Codex). **Native Windows follow-up on `14524632d1847c704eb16b9ea172d0afc8bc5b71`.** The clean fork checkout passed all 8 `graphics_blob_tests::` tests, including the stream-output cacheability guard. A separate test-only overlay with the same two synthetic GS variants again produced distinct keys and reproduced 3/3 own-blob accepts and 3/3 cross-blob refusals (`0x80070057`). The overlay was removed afterward. The stream-output result covers the guard test. No real stream-output draw or retail title was run. AI-assisted verification (OpenAI Codex).
This discussion has been locked. Commenting is limited to contributors.
No description provided.