D3D12.X: offload PSO builds, defer lazy compile-on-draw, and wire mmap ID3D12PipelineLibrary1 #2001

Open
github-bot wants to merge 7 commits from github-bot/gh-2001 into main AGit
Owner

@⁠raylitebull on GitHub · 2026-11-25 00:35 UTC · original
raylitebull:feat/pso-mmap-lib-and-lazy → main · +2152 −132 · 7 files · 7 commits · open

Offloads all PSO compilation off title threads with a shared per-frame wait budget (pso_async), defers lazy PSO builds until first Draw / Dispatch / ExecuteIndirect (XCL_LAZY_ON_DRAW), deduplicates used-only startup prewarm (XCL_PSO_PREWARM_USED), and wires a generational memory-mapped ID3D12PipelineLibrary1 cache (pso_library, pso_lib in real.rs, flushed on clean exit via present.rs) into compute, graphics, and mesh PSO creation paths.

Part of #1833 (addresses Gaps #1–#5: off-thread PSO builds, bounded per-frame bind wait, deferred compile-on-draw, deduplicated used-only prewarm, and persistent memory-mapped ID3D12PipelineLibrary1 reuse).

What is in it

  • crates/xcl/src/hle/d3d12x/pso_async.rs, list_x.rs, frame.rs, & mod.rs:
    • resolve_wait never compiles synchronously on calling title threads unless XCL_PSO_TITLE_BUILD=1; integrates #2080 (WorkerItem::Piece unified into workers(), urgent when parent is wanted), 625a0f36 (returning p.stand(pso) across resolve, resolve_for_bind, resolve_if_ready, resolve_within including exhausted-frame-budget early returns, and resolve_spared so stand-ins never reach the PC driver), #2176 (Pending::spared, image_skip(), image_only(), resolve_spared), and #2178/#2296 (drop_unstarted_job(&p) + waking waiters on released() alongside PcCalls frame clamping).
    • Checks frame_rem.is_zero() before begin_wait() and uses an RAII WaitWantGuard (resolve_wait_with_budgets unbounded path also holds p.begin_wait() so bounded timeouts never clear an active unbounded waiter's wanted flag); limits the implicit default AfterFirstPresent(500 ms) frame budget to graphics PSOs (!p.compute) so compute dispatches are never deferred unless XCL_PSO_FRAME_WAIT_MS=<ms> (Always) is explicitly set; unconditionally restores worker base_priority in build() under demand lock.
    • lazy_on_draw / resolve_for_bind (XCL_LAZY_ON_DRAW, default on when XCL_LAZY_PSO != 0) defers building lazy pipelines past SetPipelineState (passive resolve_if_ready lookup) until first draw/dispatch; prewarm_used_enabled (XCL_PSO_PREWARM_USED / XCL_PSO_PRELOAD) deduplicates duplicate shader keys.
  • crates/xcl/src/hle/d3d12x/pso_library.rs: generational memory-mapped ID3D12PipelineLibrary1 (MmapPipelineLibrary) passing explicit (std::ptr::null(), 0) via ID3D12Device1_Vtbl::CreatePipelineLibrary for Wine/vkd3d-proton compatibility, synchronizing Load* + StorePipeline (lib_rw.read()) vs serialization (write) via RwLock, waiting for in-flight saves during flush(), and removing rejected/corrupt .plib files on open_or_create.
  • crates/xcl/src/hle/d3d12x/real.rs & present.rs: pso_lib::try_load_compute + store_pipeline inside translated_compute_pso_once (preserving #1592 dred::label on library hits and keeping compute_container untouched for #2080), plus graphics, stream, and mesh pso_lib wiring (flush_pipeline_library on clean close), Entry::Vacant-guarded insert_cached_blob across COMPUTE_BLOBS / GRAPHICS_BLOBS, deterministic stream_key content hashing, PC ID3D12PipelineState adoption (deliver_adopted), and debounced background save scheduler (should_background_save).
  • Unit tests (pso_async::, pso_library::, pso_lib::tests, compute_blob_tests, graphics_blob_tests).

Tested

  • Toolchain: Windows 11 x64, rustc 1.99.1 (58cf8f9c3 2026-10-13), rebased cleanly onto 728e2548 (008d9c1c).
  • cargo check --workspace --tests: passed (0 new warnings).
  • cargo test -p xcl --lib pso_async::: 24 passed, 0 failed (including 625a0f36, #2296, #2176, #2178, #1782, and all #2001 tests).
  • cargo test -p xcl --lib pso_library::: 3 passed, 0 failed.
  • cargo test -p xcl --lib pso_lib::tests: 2 passed, 0 failed.
  • cargo test -p xcl --lib compute_blob_tests: 2 passed, 0 failed.
  • cargo test -p xcl --lib graphics_blob_tests: 5 passed, 0 failed.

Regression run

  • Standalone scripts/smoke.ps1 pair on 008d9c1c vs 728e2548 has not been run yet. AMD and NVIDIA reviewers are invited to test on 008d9c1c vs 728e2548 (including scripts/smoke.ps1, cold/warm XCL_PSO_LIBRARY=1 world loads, XCL_LAZY_PSO=1, and Linux/vkd3d-proton .plib creation) and post results in the comments.

Not tested

  • 60 s scripts/smoke.ps1 pair on 008d9c1c, full cargo test --workspace suite on 008d9c1c, runtime GPU execution across AMD / NVIDIA / Intel hardware, and Linux/Wine/vkd3d-proton runtime.

AI use

  • Antigravity assisted with implementation, review fixes, rebase onto 728e2548, and unit tests; the author reviewed the diff and test output.
**@⁠raylitebull** on GitHub · 2026-11-25 00:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001) `raylitebull:feat/pso-mmap-lib-and-lazy` → `main` · +2152 −132 · 7 files · 7 commits · open Offloads all PSO compilation off title threads with a shared per-frame wait budget (`pso_async`), defers lazy PSO builds until first `Draw` / `Dispatch` / `ExecuteIndirect` (`XCL_LAZY_ON_DRAW`), deduplicates used-only startup prewarm (`XCL_PSO_PREWARM_USED`), and wires a generational memory-mapped `ID3D12PipelineLibrary1` cache (`pso_library`, `pso_lib` in `real.rs`, flushed on clean exit via `present.rs`) into compute, graphics, and mesh PSO creation paths. Part of #1833 (addresses Gaps #1–#5: off-thread PSO builds, bounded per-frame bind wait, deferred compile-on-draw, deduplicated used-only prewarm, and persistent memory-mapped `ID3D12PipelineLibrary1` reuse). **What is in it** - `crates/xcl/src/hle/d3d12x/pso_async.rs`, `list_x.rs`, `frame.rs`, & `mod.rs`: - `resolve_wait` never compiles synchronously on calling title threads unless `XCL_PSO_TITLE_BUILD=1`; integrates `#2080` (`WorkerItem::Piece` unified into `workers()`, urgent when parent is wanted), `625a0f36` (returning `p.stand(pso)` across `resolve`, `resolve_for_bind`, `resolve_if_ready`, `resolve_within` including exhausted-frame-budget early returns, and `resolve_spared` so stand-ins never reach the PC driver), `#2176` (`Pending::spared`, `image_skip()`, `image_only()`, `resolve_spared`), and `#2178`/`#2296` (`drop_unstarted_job(&p)` + waking waiters on `released()` alongside `PcCalls` frame clamping). - Checks `frame_rem.is_zero()` *before* `begin_wait()` and uses an RAII `WaitWantGuard` (`resolve_wait_with_budgets` unbounded path also holds `p.begin_wait()` so bounded timeouts never clear an active unbounded waiter's `wanted` flag); limits the implicit default `AfterFirstPresent(500 ms)` frame budget to graphics PSOs (`!p.compute`) so compute dispatches are never deferred unless `XCL_PSO_FRAME_WAIT_MS=<ms>` (`Always`) is explicitly set; unconditionally restores worker `base_priority` in `build()` under `demand` lock. - `lazy_on_draw` / `resolve_for_bind` (`XCL_LAZY_ON_DRAW`, default on when `XCL_LAZY_PSO != 0`) defers building lazy pipelines past `SetPipelineState` (passive `resolve_if_ready` lookup) until first draw/dispatch; `prewarm_used_enabled` (`XCL_PSO_PREWARM_USED` / `XCL_PSO_PRELOAD`) deduplicates duplicate shader keys. - `crates/xcl/src/hle/d3d12x/pso_library.rs`: generational memory-mapped `ID3D12PipelineLibrary1` (`MmapPipelineLibrary`) passing explicit `(std::ptr::null(), 0)` via `ID3D12Device1_Vtbl::CreatePipelineLibrary` for Wine/vkd3d-proton compatibility, synchronizing `Load*` + `StorePipeline` (`lib_rw.read()`) vs serialization (`write`) via `RwLock`, waiting for in-flight saves during `flush()`, and removing rejected/corrupt `.plib` files on `open_or_create`. - `crates/xcl/src/hle/d3d12x/real.rs` & `present.rs`: `pso_lib::try_load_compute` + `store_pipeline` inside `translated_compute_pso_once` (preserving `#1592` `dred::label` on library hits and keeping `compute_container` untouched for `#2080`), plus graphics, stream, and mesh `pso_lib` wiring (`flush_pipeline_library` on clean close), `Entry::Vacant`-guarded `insert_cached_blob` across `COMPUTE_BLOBS` / `GRAPHICS_BLOBS`, deterministic `stream_key` content hashing, PC `ID3D12PipelineState` adoption (`deliver_adopted`), and debounced background save scheduler (`should_background_save`). - Unit tests (`pso_async::`, `pso_library::`, `pso_lib::tests`, `compute_blob_tests`, `graphics_blob_tests`). **Tested** - Toolchain: Windows 11 x64, `rustc 1.99.1 (58cf8f9c3 2026-10-13)`, rebased cleanly onto `728e2548` (`008d9c1c`). - `cargo check --workspace --tests`: passed (`0` new warnings). - `cargo test -p xcl --lib pso_async::`: 24 passed, 0 failed (including `625a0f36`, `#2296`, `#2176`, `#2178`, `#1782`, and all `#2001` tests). - `cargo test -p xcl --lib pso_library::`: 3 passed, 0 failed. - `cargo test -p xcl --lib pso_lib::tests`: 2 passed, 0 failed. - `cargo test -p xcl --lib compute_blob_tests`: 2 passed, 0 failed. - `cargo test -p xcl --lib graphics_blob_tests`: 5 passed, 0 failed. **Regression run** - Standalone `scripts/smoke.ps1` pair on `008d9c1c` vs `728e2548` has not been run yet. AMD and NVIDIA reviewers are invited to test on `008d9c1c` vs `728e2548` (including `scripts/smoke.ps1`, cold/warm `XCL_PSO_LIBRARY=1` world loads, `XCL_LAZY_PSO=1`, and Linux/vkd3d-proton `.plib` creation) and post results in the comments. **Not tested** - 60 s `scripts/smoke.ps1` pair on `008d9c1c`, full `cargo test --workspace` suite on `008d9c1c`, runtime GPU execution across AMD / NVIDIA / Intel hardware, and Linux/Wine/vkd3d-proton runtime. **AI use** - Antigravity assisted with implementation, review fixes, rebase onto `728e2548`, and unit tests; the author reviewed the diff and test output.
Switching bound pipelines A -> B via SetPipelineState previously called side-effecting pso_async::resolve(s.bound_pso) on the outgoing binding A, enqueueing lazy compilation and recording usage for a pipeline that was never drawn. Add passive pso_async::resolve_if_ready for bind-time identity comparison in list_x::on_set_pipeline_state and add an A-to-B bind regression test.
Address review findings on #2001: wake unbounded waiters on orphaned/released pending PSOs in workers, preload, and released(); synchronize StorePipeline against GetSerializedSize+Serialize with an RwLock; make shutdown flush() wait on save_lock for any active background save; remove any rejected .plib file on open_or_create; hash pointer-bearing pipeline stream subobjects by pointed-to content; and return ID3D12PipelineState directly in deliver_adopted without querying console IIDs.
Address world-loading findings on #2001: (1) apply the implicit default 500 ms AfterFirstPresent frame-wait cap only to graphics pipelines so compute dispatches writing GPU sync/indirect buffers are not skipped mid-frame (explicit XCL_PSO_FRAME_WAIT_MS still applies to both); (2) do not mark deferred pipelines as wanted when the frame budget is already exhausted, and clear wanted on budget/timeout abandonment so skipped huge pipelines cannot bypass big_compile_turn's commit/slot gate and spike process commit; (3) take the shared lib_rw read lock in MmapPipelineLibrary::load_{compute,graphics,stream} so Load*Pipeline never races with Serialize.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:14:02 +00:00
Author
Owner

@⁠WebIdentity1 on GitHub · 2026-11-25 00:47 UTC · original · edited 2026-11-25 00:50 UTC

Confirmed a bind-only escape from XCL_LAZY_ON_DRAW on 7244baadcf009af2a79e94c9fd9c6e7b41d89ab9. The sequence is SetPipelineState(A) followed by SetPipelineState(B), with no draw/dispatch. list_x::on_set_pipeline_state compares B against pso_async::resolve(s.bound_pso). That lookup queues A and calls note_use(), defeating the new deferral policy for a discarded binding. The existing unit test only calls resolve_for_bind, so it misses this bookkeeping path.

The small candidate below adds a passive peek for this identity comparison. It retains the real-PSO identity once built, without scheduling or recording use.

Tested — native Windows 10 19045, Ryzen 7 7800X3D, Rust 1.98.1 MSVC, debug; XCL_LAZY_PSO=1, XCL_LAZY_ON_DRAW=1:

cargo test --locked -p xcl --lib -- pso_async:: --test-threads=1 --show-output
  • Exact head + new regression: 12 passed / 1 failed / 0 ignored, zero skips. After A then B, queued=[true,false], used=[true,false].
  • Same head + candidate and test: 13 passed / 0 failed / 0 ignored, zero skips. Both arrays are [false,false]. The fixture then explicitly requests and completes both synthetic jobs before assertions/cleanup, checking that later demand still builds them.
  • This exercises the real on_set_pipeline_state tracking routine with synthetic list/pipeline identities and job closures; it performs no COM draw or GPU driver compilation. Both builds recompiled XCL, and all 312 source-file hashes matched before/after.
Candidate fix and deterministic regression (36 additions, 1 deletion)
diff --git a/crates/xcl/src/hle/d3d12x/list_x.rs b/crates/xcl/src/hle/d3d12x/list_x.rs
index a4bc5d2..ee28774 100644
--- a/crates/xcl/src/hle/d3d12x/list_x.rs
+++ b/crates/xcl/src/hle/d3d12x/list_x.rs
@@ -836,7 +836,7 @@ pub(super) unsafe fn on_set_pipeline_state(list: *mut c_void, pso: usize) {
         let mut g = LISTS.lock().unwrap();
         let s = g.get_or_insert_with(HashMap::new).entry(key).or_default();
         // Keep the title-visible base PSO key when `bind_abi` re-binds its resolved background PSO.
-        if s.bound_pso == 0 || pso == s.bound_pso || super::pso_async::resolve(s.bound_pso) != pso {
+        if s.bound_pso == 0 || pso == s.bound_pso || super::pso_async::peek(s.bound_pso) != pso {
             s.bound_pso = pso;
         }
         let effective = s.bound_pso;
diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs
index a21bb90..307d5e2 100644
--- a/crates/xcl/src/hle/d3d12x/pso_async.rs
+++ b/crates/xcl/src/hle/d3d12x/pso_async.rs
@@ -704,6 +704,33 @@ mod used_tests {
         assert!(!parse_prewarm_used(None, Some("0")));
     }
 
+    #[test]
+    fn switching_bound_pipelines_does_not_compile_the_unused_one() {
+        let list = 0x7E57_B401usize;
+        let a = 0x7E57_B402usize;
+        let b = 0x7E57_B403usize;
+        let ka = 0x5EED_B402u64;
+        let kb = 0x5EED_B403u64;
+        assert!(lazy_on_draw());
+        submit_lazy(a, false, Box::new(|| 0x6402), ka);
+        submit_lazy(b, false, Box::new(|| 0x6403), kb);
+        assert_eq!(resolve_for_bind(a), a);
+        unsafe { super::super::list_x::on_set_pipeline_state(list as *mut _, a) };
+        assert_eq!(resolve_for_bind(b), b);
+        unsafe { super::super::list_x::on_set_pipeline_state(list as *mut _, b) };
+        let queued = [a, b].map(|p| entry(p).unwrap().sent.load(Ordering::Acquire));
+        let used = [used::noted(ka), used::noted(kb)];
+        // Finish both synthetic jobs before assertions so the failing control leaves no worker behind.
+        let built = [resolve_wait_for(a, None), resolve_wait_for(b, None)];
+        super::super::list_x::on_release(list);
+        let _ = released(a);
+        let _ = released(b);
+        println!("bind A then B, no draw: queued={queued:?}, used={used:?}");
+        assert_eq!(built, [0x6402, 0x6403]);
+        assert_eq!(queued, [false, false], "bind bookkeeping queued an unused pipeline");
+        assert_eq!(used, [false, false], "bind bookkeeping polluted the used-pipeline ledger");
+    }
+
     #[test]
     fn lazy_on_draw_defers_build_past_bind_until_first_draw_or_dispatch() {
         let compute_standin = 0x7E57_B301usize;
@@ -816,6 +843,14 @@ fn entry(pso: usize) -> Option<Arc<Pending>> {
     PENDING.lock().unwrap().as_ref()?.get(&pso).cloned()
 }
 
+/// The available pipeline identity, without scheduling a build or recording use.
+pub(super) fn peek(pso: usize) -> usize {
+    entry(pso).map_or(pso, |p| match p.real.load(Ordering::Acquire) {
+        0 => pso,
+        r => r,
+    })
+}
+
 /// The pipeline to use for `pso` now: the real one once built, else `pso` itself.
 pub fn resolve(pso: usize) -> usize {
     let Some(p) = entry(pso) else { return pso };

Not tested: full workspace suite, this PR's pipeline-library changes, GPU output, retail smoke, or game-scale compilation-time/memory savings. This is a scheduling/usage-ledger finding, not a merge-readiness claim. No competing PR or source push.

AI use: Codex with GPT-6 Astra traced the hook, wrote the candidate and regression, ran the Windows comparison, and drafted this report.

**@⁠WebIdentity1** on GitHub · 2026-11-25 00:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7148881581) · edited 2026-11-25 00:50 UTC Confirmed a bind-only escape from `XCL_LAZY_ON_DRAW` on `7244baadcf009af2a79e94c9fd9c6e7b41d89ab9`. The sequence is `SetPipelineState(A)` followed by `SetPipelineState(B)`, with no draw/dispatch. `list_x::on_set_pipeline_state` compares B against `pso_async::resolve(s.bound_pso)`. That lookup queues A and calls `note_use()`, defeating the new deferral policy for a discarded binding. The existing unit test only calls `resolve_for_bind`, so it misses this bookkeeping path. The small candidate below adds a passive `peek` for this identity comparison. It retains the real-PSO identity once built, without scheduling or recording use. **Tested** — native Windows 10 19045, Ryzen 7 7800X3D, Rust 1.98.1 MSVC, debug; `XCL_LAZY_PSO=1`, `XCL_LAZY_ON_DRAW=1`: ```text cargo test --locked -p xcl --lib -- pso_async:: --test-threads=1 --show-output ``` - Exact head + new regression: **12 passed / 1 failed / 0 ignored**, zero skips. After A then B, `queued=[true,false]`, `used=[true,false]`. - Same head + candidate and test: **13 passed / 0 failed / 0 ignored**, zero skips. Both arrays are `[false,false]`. The fixture then explicitly requests and completes both synthetic jobs before assertions/cleanup, checking that later demand still builds them. - This exercises the real `on_set_pipeline_state` tracking routine with synthetic list/pipeline identities and job closures; it performs no COM draw or GPU driver compilation. Both builds recompiled XCL, and all 312 source-file hashes matched before/after. <details><summary>Candidate fix and deterministic regression (36 additions, 1 deletion)</summary> ```diff diff --git a/crates/xcl/src/hle/d3d12x/list_x.rs b/crates/xcl/src/hle/d3d12x/list_x.rs index a4bc5d2..ee28774 100644 --- a/crates/xcl/src/hle/d3d12x/list_x.rs +++ b/crates/xcl/src/hle/d3d12x/list_x.rs @@ -836,7 +836,7 @@ pub(super) unsafe fn on_set_pipeline_state(list: *mut c_void, pso: usize) { let mut g = LISTS.lock().unwrap(); let s = g.get_or_insert_with(HashMap::new).entry(key).or_default(); // Keep the title-visible base PSO key when `bind_abi` re-binds its resolved background PSO. - if s.bound_pso == 0 || pso == s.bound_pso || super::pso_async::resolve(s.bound_pso) != pso { + if s.bound_pso == 0 || pso == s.bound_pso || super::pso_async::peek(s.bound_pso) != pso { s.bound_pso = pso; } let effective = s.bound_pso; diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs index a21bb90..307d5e2 100644 --- a/crates/xcl/src/hle/d3d12x/pso_async.rs +++ b/crates/xcl/src/hle/d3d12x/pso_async.rs @@ -704,6 +704,33 @@ mod used_tests { assert!(!parse_prewarm_used(None, Some("0"))); } + #[test] + fn switching_bound_pipelines_does_not_compile_the_unused_one() { + let list = 0x7E57_B401usize; + let a = 0x7E57_B402usize; + let b = 0x7E57_B403usize; + let ka = 0x5EED_B402u64; + let kb = 0x5EED_B403u64; + assert!(lazy_on_draw()); + submit_lazy(a, false, Box::new(|| 0x6402), ka); + submit_lazy(b, false, Box::new(|| 0x6403), kb); + assert_eq!(resolve_for_bind(a), a); + unsafe { super::super::list_x::on_set_pipeline_state(list as *mut _, a) }; + assert_eq!(resolve_for_bind(b), b); + unsafe { super::super::list_x::on_set_pipeline_state(list as *mut _, b) }; + let queued = [a, b].map(|p| entry(p).unwrap().sent.load(Ordering::Acquire)); + let used = [used::noted(ka), used::noted(kb)]; + // Finish both synthetic jobs before assertions so the failing control leaves no worker behind. + let built = [resolve_wait_for(a, None), resolve_wait_for(b, None)]; + super::super::list_x::on_release(list); + let _ = released(a); + let _ = released(b); + println!("bind A then B, no draw: queued={queued:?}, used={used:?}"); + assert_eq!(built, [0x6402, 0x6403]); + assert_eq!(queued, [false, false], "bind bookkeeping queued an unused pipeline"); + assert_eq!(used, [false, false], "bind bookkeeping polluted the used-pipeline ledger"); + } + #[test] fn lazy_on_draw_defers_build_past_bind_until_first_draw_or_dispatch() { let compute_standin = 0x7E57_B301usize; @@ -816,6 +843,14 @@ fn entry(pso: usize) -> Option<Arc<Pending>> { PENDING.lock().unwrap().as_ref()?.get(&pso).cloned() } +/// The available pipeline identity, without scheduling a build or recording use. +pub(super) fn peek(pso: usize) -> usize { + entry(pso).map_or(pso, |p| match p.real.load(Ordering::Acquire) { + 0 => pso, + r => r, + }) +} + /// The pipeline to use for `pso` now: the real one once built, else `pso` itself. pub fn resolve(pso: usize) -> usize { let Some(p) = entry(pso) else { return pso }; ``` </details> **Not tested:** full workspace suite, this PR's pipeline-library changes, GPU output, retail smoke, or game-scale compilation-time/memory savings. This is a scheduling/usage-ledger finding, not a merge-readiness claim. No competing PR or source push. **AI use:** Codex with GPT-6 Astra traced the hook, wrote the candidate and regression, ran the Windows comparison, and drafted this report.
Author
Owner

@⁠gsucristo on GitHub · 2026-11-25 00:57 UTC · original

Technical review findings:

Blocking

  1. XCL_LAZY_ON_DRAW is bypassed by list_x::on_set_pipeline_state (list_x.rs:839): on_set_pipeline_state calls super::pso_async::resolve(s.bound_pso) when switching away from a bound PSO, which still calls p.note_use() and enqueues s.bound_pso for compilation even if nothing was ever drawn with it. Needs a passive lookup in on_set_pipeline_state.
  2. Permanent deadlock when a pending PSO is released() while a thread waits without a budget (pso_async.rs, workers() & resolve_wait_with_budgets): In workers(), if p.orphan.load(Ordering::Acquire) is true, the worker does continue; without setting *p.done = true and calling p.cv.notify_all(). Any thread blocked in while !*done { done = p.cv.wait(done).unwrap(); } (e.g. before first present or with XCL_PSO_FRAME_WAIT_MS=0) will hang forever.
  3. Race & D3D12 API violation between StorePipeline and GetSerializedSize/Serialize (pso_library.rs, store & save_if_dirty): save_if_dirty calls GetSerializedSize(), allocates a fixed-size MappedWriteFile, and calls Serialize(buf) without synchronizing against concurrent store() calls on worker threads. A concurrent StorePipeline grows the serialized size mid-save (E_INVALIDARG / driver UB). Needs an RwLock or mutex synchronizing store vs GetSerializedSize+Serialize.
  4. flush_pipeline_library() on WM_CLOSE drops the final save if background saver is active (pso_library.rs:save_if_dirty, present.rs:wndproc): save_if_dirty returns immediately if self.saving is already true, so WM_CLOSE proceeds straight to ExitProcess(0) and kills xcl-plib-save mid-write, losing unsaved pipelines and leaving an orphaned .tmp file. flush_now() should wait on save_lock for any active save to finish and then flush remaining dirty entries.

Major

  • open_or_create (pso_library.rs) only deletes stale .plib files on DRIVER_VERSION_MISMATCH/ADAPTER_NOT_FOUND; a corrupt .plib returning E_INVALIDARG stays as the latest generation and fails on every subsequent launch.
  • pso_lib::stream_key (real.rs) hashes raw subobject payloads for non-RS/non-shader subobjects, which would hash transient pointers if called on streams containing INPUT_LAYOUT/STREAM_OUTPUT/VIEW_INSTANCING/CACHED_PSO.
  • deliver_adopted (real.rs) passes a console riid to PC COM QueryInterface (which fails with E_NOINTERFACE and falls back to raw).
**@⁠gsucristo** on GitHub · 2026-11-25 00:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7149057249) Technical review findings: **Blocking** 1. **`XCL_LAZY_ON_DRAW` is bypassed by `list_x::on_set_pipeline_state` (`list_x.rs:839`)**: `on_set_pipeline_state` calls `super::pso_async::resolve(s.bound_pso)` when switching away from a bound PSO, which still calls `p.note_use()` and enqueues `s.bound_pso` for compilation even if nothing was ever drawn with it. Needs a passive lookup in `on_set_pipeline_state`. 2. **Permanent deadlock when a pending PSO is `released()` while a thread waits without a budget (`pso_async.rs`, `workers()` & `resolve_wait_with_budgets`)**: In `workers()`, if `p.orphan.load(Ordering::Acquire)` is true, the worker does `continue;` without setting `*p.done = true` and calling `p.cv.notify_all()`. Any thread blocked in `while !*done { done = p.cv.wait(done).unwrap(); }` (e.g. before first present or with `XCL_PSO_FRAME_WAIT_MS=0`) will hang forever. 3. **Race & D3D12 API violation between `StorePipeline` and `GetSerializedSize`/`Serialize` (`pso_library.rs`, `store` & `save_if_dirty`)**: `save_if_dirty` calls `GetSerializedSize()`, allocates a fixed-size `MappedWriteFile`, and calls `Serialize(buf)` without synchronizing against concurrent `store()` calls on worker threads. A concurrent `StorePipeline` grows the serialized size mid-save (`E_INVALIDARG` / driver UB). Needs an `RwLock` or mutex synchronizing `store` vs `GetSerializedSize`+`Serialize`. 4. **`flush_pipeline_library()` on `WM_CLOSE` drops the final save if background saver is active (`pso_library.rs:save_if_dirty`, `present.rs:wndproc`)**: `save_if_dirty` returns immediately if `self.saving` is already `true`, so `WM_CLOSE` proceeds straight to `ExitProcess(0)` and kills `xcl-plib-save` mid-write, losing unsaved pipelines and leaving an orphaned `.tmp` file. `flush_now()` should wait on `save_lock` for any active save to finish and then flush remaining dirty entries. **Major** - `open_or_create` (`pso_library.rs`) only deletes stale `.plib` files on `DRIVER_VERSION_MISMATCH`/`ADAPTER_NOT_FOUND`; a corrupt `.plib` returning `E_INVALIDARG` stays as the latest generation and fails on every subsequent launch. - `pso_lib::stream_key` (`real.rs`) hashes raw subobject payloads for non-RS/non-shader subobjects, which would hash transient pointers if called on streams containing `INPUT_LAYOUT`/`STREAM_OUTPUT`/`VIEW_INSTANCING`/`CACHED_PSO`. - `deliver_adopted` (`real.rs`) passes a console `riid` to PC COM `QueryInterface` (which fails with `E_NOINTERFACE` and falls back to `raw`).
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 01:14 UTC · original

Thanks for all the detailed catches, @WebIdentity1 and @gsucristo!

Updated #2001 cleanly onto 656c0e8 (4d53a2c):

  • Passive switch lookup (list_x::on_set_pipeline_state): switched from pso_async::resolve to passive pso_async::resolve_if_ready so A -> B SetPipelineState switches no longer enqueue or mark-used a bound-but-never-drawn PSO (XCL_LAZY_ON_DRAW preserved).
  • Orphaned waiter wakeup (pso_async.rs): workers(), preload(), and released() now set *p.done = true and call cv.notify_all() on orphaned/released pending PSOs so unbounded resolve_wait callers never hang.
  • Library serialization & shutdown sync (real.rs, pso_library.rs): added RwLock synchronizing StorePipeline (read) against GetSerializedSize/Serialize (write), changed flush() on shutdown (WM_CLOSE) to wait on save_lock for any active background save instead of returning early, and removed rejected/corrupt .plib files on open_or_create.
  • Stream keys & adoption (real.rs): stream_key hashes pointer-bearing pipeline stream subobjects (INPUT_LAYOUT, STREAM_OUTPUT, VIEW_INSTANCING; skips CACHED_PSO) by pointed-to content, and deliver_adopted returns ID3D12PipelineState directly without querying console IIDs.

Verified locally (cargo check --workspace --tests, pso_async 14 passed, 0 failed, pso_library 3 passed, 0 failed, pso_lib::tests 2 passed, 0 failed).

**@⁠raylitebull** on GitHub · 2026-11-25 01:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7149348119) Thanks for all the detailed catches, `@WebIdentity1` and `@gsucristo`! Updated `#2001` cleanly onto `656c0e8` (`4d53a2c`): - **Passive switch lookup (`list_x::on_set_pipeline_state`):** switched from `pso_async::resolve` to passive `pso_async::resolve_if_ready` so A -> B `SetPipelineState` switches no longer enqueue or mark-used a bound-but-never-drawn PSO (`XCL_LAZY_ON_DRAW` preserved). - **Orphaned waiter wakeup (`pso_async.rs`):** `workers()`, `preload()`, and `released()` now set `*p.done = true` and call `cv.notify_all()` on orphaned/released pending PSOs so unbounded `resolve_wait` callers never hang. - **Library serialization & shutdown sync (`real.rs`, `pso_library.rs`):** added `RwLock` synchronizing `StorePipeline` (`read`) against `GetSerializedSize`/`Serialize` (`write`), changed `flush()` on shutdown (`WM_CLOSE`) to wait on `save_lock` for any active background save instead of returning early, and removed rejected/corrupt `.plib` files on `open_or_create`. - **Stream keys & adoption (`real.rs`):** `stream_key` hashes pointer-bearing pipeline stream subobjects (`INPUT_LAYOUT`, `STREAM_OUTPUT`, `VIEW_INSTANCING`; skips `CACHED_PSO`) by pointed-to content, and `deliver_adopted` returns `ID3D12PipelineState` directly without querying console IIDs. Verified locally (`cargo check --workspace --tests`, `pso_async` `14 passed, 0 failed`, `pso_library` `3 passed, 0 failed`, `pso_lib::tests` `2 passed, 0 failed`).
Author
Owner

@⁠throny on GitHub · 2026-11-25 01:29 UTC · original

World-loading test of 7244baa merged onto main 279d3ea, on the retail title, XCL_DIRECT_DXIL=1, otherwise this PR's defaults. Two 15-minute runs in a row: the pipeline library cold, then warm. The XCL DXIL cache was warm for every compute program, from a full --precompile --only cs --pipelines of main 177cd40 (#1269).

run last presents presents after 82 s skipped draws / dispatches queue waits that did not complete end
1 (library cold) 170 s 55 36 054 / 20 692 144, from 115 s stopped by my memory guard (process commit 37.3 GB, 6 GB of system commit left)
2 (library warm) 108 s 23 10 241 / 4 096 32, from 91 s the title's watchdog at 137 s; the process then hung until the 15-minute limit

For comparison, main 177cd40 with the same caches (compute warm, no pipeline library, one run): last presents at 94 s, then 82 graphics PSO builds in the driver and no further frames, but no watchdog in 900 s and commit at 31 GB.

What I saw of the PR's own parts:

  • The library works as described. Run 2 opened gen-00000009 (47 MiB, memory-mapped) at 3 s and saved six more generations up to 73 MiB, the largest with 62 new pipelines (at 87 s).
  • The shared 500 ms per-frame budget runs out from 80 s on ("deferring bind to next frame").
  • With the warm library, run 2 got less far than run 1 and ended at the watchdog, which neither run 1 nor main hit within their runs. One run each, so this may be run-to-run variation, but it is the opposite of what a warm library should do. A second warm run, or XCL_PSO_LIBRARY=0 on a warm DXIL cache, would show which.
  • Run 1 is the furthest any run on this machine has got (presents to 170 s), with about 2.5 times more skipped draws than run 2. Its commit climbed past 37 GB, where my guard stopped it.

Tested: RTX 4080 16 GB (32-lane waves), i9-12900K, 64 GB (commit limit 68 GB), Windows 11 26300, release build; no input after the menus.
Not tested: the suite on this head, a main run at the same commit (279d3ea), repeat runs, AMD, XCL_PSO_LIBRARY=0 / XCL_PSO_TITLE_BUILD=1.

AI use: Claude Code (Claude Opus 5.5): ran the tests and wrote this; the diff was read for safety by a Claude Opus 5.5 sub-agent before it was built.

**@⁠throny** on GitHub · 2026-11-25 01:29 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7149612989) World-loading test of `7244baa` merged onto `main` `279d3ea`, on the retail title, `XCL_DIRECT_DXIL=1`, otherwise this PR's defaults. Two 15-minute runs in a row: the pipeline library cold, then warm. The XCL DXIL cache was warm for every compute program, from a full `--precompile --only cs --pipelines` of `main` `177cd40` ([#1269](https://git.gtahub.st/github/xcl-dev--xcl/issues/1269)). | run | last presents | presents after 82 s | skipped draws / dispatches | queue waits that did not complete | end | |---|---|---|---|---|---| | 1 (library cold) | **170 s** | 55 | 36 054 / 20 692 | 144, from 115 s | stopped by my memory guard (process commit 37.3 GB, 6 GB of system commit left) | | 2 (library warm) | 108 s | 23 | 10 241 / 4 096 | 32, from 91 s | the title's watchdog at 137 s; the process then hung until the 15-minute limit | For comparison, `main` `177cd40` with the same caches (compute warm, no pipeline library, one run): last presents at 94 s, then 82 graphics PSO builds in the driver and no further frames, but no watchdog in 900 s and commit at 31 GB. What I saw of the PR's own parts: - The library works as described. Run 2 opened `gen-00000009` (47 MiB, memory-mapped) at 3 s and saved six more generations up to 73 MiB, the largest with 62 new pipelines (at 87 s). - The shared 500 ms per-frame budget runs out from 80 s on ("deferring bind to next frame"). - With the warm library, run 2 got less far than run 1 and ended at the watchdog, which neither run 1 nor `main` hit within their runs. One run each, so this may be run-to-run variation, but it is the opposite of what a warm library should do. A second warm run, or `XCL_PSO_LIBRARY=0` on a warm DXIL cache, would show which. - Run 1 is the furthest any run on this machine has got (presents to 170 s), with about 2.5 times more skipped draws than run 2. Its commit climbed past 37 GB, where my guard stopped it. **Tested:** RTX 4080 16 GB (32-lane waves), i9-12900K, 64 GB (commit limit 68 GB), Windows 11 26300, release build; no input after the menus. **Not tested:** the suite on this head, a `main` run at the same commit (`279d3ea`), repeat runs, AMD, `XCL_PSO_LIBRARY=0` / `XCL_PSO_TITLE_BUILD=1`. AI use: Claude Code (Claude Opus 5.5): ran the tests and wrote this; the diff was read for safety by a Claude Opus 5.5 sub-agent before it was built.
Author
Owner

@⁠Anon64 on GitHub · 2026-11-25 01:47 UTC · original

Regression run for this PR: head 7244baa, based on main 80f4819. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, XCL_NETWORK=0, A pressed every 4 s from 20 s, scripts/smoke.ps1 on a retail title for 60 s, in one batch with the main run.

main 80f4819:

xcl-smoke v1
commit: 80f4819098e921f2e1ab371144d4832f68ffedd6
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1588 (PresentX 1589)
presents per 2 s (last 3): 47 56 27
device removals: 0
crashes: 0
peak commit: 25184 MB

this PR:

xcl-smoke v1
commit: 7244baadcf009af2a79e94c9fd9c6e7b41d89ab9
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1612 (PresentX 1612)
presents per 2 s (last 3): 60 60 40
device removals: 0
crashes: 0
peak commit: 23635 MB

No device removals or crashes; 101 % of main's frames, 93 % of its peak commit.

Not tested: the whole suite; world loading; whether the title reaches all of the changed code in these 60 s (default settings: XCL_DIRECT_DXIL and XCL_HEAP_WINDOWS unset).

Written with Claude Code (Claude Opus 5.5) from runs on this machine.

**@⁠Anon64** on GitHub · 2026-11-25 01:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7149960789) Regression run for this PR: head `7244baa`, based on `main` `80f4819`. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, `XCL_NETWORK=0`, A pressed every 4 s from 20 s, `scripts/smoke.ps1` on a retail title for 60 s, in one batch with the `main` run. main `80f4819`: ``` xcl-smoke v1 commit: 80f4819098e921f2e1ab371144d4832f68ffedd6 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1588 (PresentX 1589) presents per 2 s (last 3): 47 56 27 device removals: 0 crashes: 0 peak commit: 25184 MB ``` this PR: ``` xcl-smoke v1 commit: 7244baadcf009af2a79e94c9fd9c6e7b41d89ab9 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1612 (PresentX 1612) presents per 2 s (last 3): 60 60 40 device removals: 0 crashes: 0 peak commit: 23635 MB ``` No device removals or crashes; 101 % of main's frames, 93 % of its peak commit. **Not tested:** the whole suite; world loading; whether the title reaches all of the changed code in these 60 s (default settings: `XCL_DIRECT_DXIL` and `XCL_HEAP_WINDOWS` unset). Written with Claude Code (Claude Opus 5.5) from runs on this machine.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 01:53 UTC · original

Thanks for the detailed RTX 4080 world-load report, @throny! Your run exposed two real root causes on 7244baa, now fixed in 1f1d681:

  1. Commit climb (37.3 GB) under skipped draws: resolve_within was calling p.want() before checking frame_rem == 0 and never cleared demand.wanted after a budget skip or timeout — allowing deferred cold huge PSOs to bypass big_compile_turn gates concurrently across workers. 1f1d681 now checks frame_rem.is_zero() before begin_wait() and uses an RAII WaitWantGuard that resets wanted = false if a waiter abandons on budget exhaustion or timeout.
  2. Warm-library skipped compute dispatches + queue waits/watchdog: besides 4d53a2c's RwLock + orphan wakeup fix (previously missing on 7244baa when the 73 MiB save ran), the implicit default AfterFirstPresent(500 ms) frame budget was capping compute dispatches (4,096–20,692 skipped dispatches -> Wait64BitValueX stalls). 1f1d681 now applies the implicit default AfterFirstPresent(500 ms) cap ONLY to graphics PSOs (!p.compute, while explicit XCL_PSO_FRAME_WAIT_MS=<ms> still covers both), and also takes self.lib_rw.read() around MmapPipelineLibrary::load_{compute,graphics,stream} for concurrent Load* vs Serialize safety + adds default_frame_budget_only_defers_graphics_and_never_leaves_skipped_psos_wanted.

Compiled cleanly in release (0 errors) and pushed 1f1d681 for GitHub Actions Build and test + re-testing.

**@⁠raylitebull** on GitHub · 2026-11-25 01:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7150085035) Thanks for the detailed RTX 4080 world-load report, `@throny`! Your run exposed two real root causes on `7244baa`, now fixed in `1f1d681`: 1. **Commit climb (`37.3 GB`) under skipped draws:** `resolve_within` was calling `p.want()` *before* checking `frame_rem == 0` and never cleared `demand.wanted` after a budget skip or timeout — allowing deferred cold huge PSOs to bypass `big_compile_turn` gates concurrently across workers. `1f1d681` now checks `frame_rem.is_zero()` *before* `begin_wait()` and uses an RAII `WaitWantGuard` that resets `wanted = false` if a waiter abandons on budget exhaustion or timeout. 2. **Warm-library skipped compute dispatches + queue waits/watchdog:** besides `4d53a2c`'s `RwLock` + orphan wakeup fix (previously missing on `7244baa` when the 73 MiB save ran), the implicit default `AfterFirstPresent(500 ms)` frame budget was capping **compute** dispatches (`4,096`–`20,692` skipped dispatches -> `Wait64BitValueX` stalls). `1f1d681` now applies the implicit default `AfterFirstPresent(500 ms)` cap ONLY to graphics PSOs (`!p.compute`, while explicit `XCL_PSO_FRAME_WAIT_MS=<ms>` still covers both), and also takes `self.lib_rw.read()` around `MmapPipelineLibrary::load_{compute,graphics,stream}` for concurrent `Load*` vs `Serialize` safety + adds `default_frame_budget_only_defers_graphics_and_never_leaves_skipped_psos_wanted`. Compiled cleanly in release (`0` errors) and pushed `1f1d681` for GitHub Actions `Build and test` + re-testing.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 02:38 UTC · original

PR #2001 verification on STOR-WINLAB

Tested detached head 1f1d681439db77ea01a656dc8fc65aa4eabc7d1b with a clean tracked worktree.

Environment

  • Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X.
  • Intel Arc A770 16 GiB, driver 32.0.101.9175, wave range 8–32, DoublePrecisionFloatShaderOps=0.
  • DXC/DXIL 1.9.2609.5 from %LOCALAPPDATA%\XclTooling\dxc-1.9.2609\bin\x64. Rust rustc 1.100.0 (0ef1bc386 2026-11-09). Unoptimized Cargo dev/test profiles with debug info and incremental compilation disabled.

Tested

  • cargo build --workspace and cargo test --workspace --no-run both exited 0 outside the GPU lock.
  • cargo test -p xcl --lib <filter> -- --nocapture passed for all three filters. Each had zero failures, ignores, and skip markers.
    • hle::d3d12x::pso_async:: — 15 passed. Covered off-thread PSO construction, lazy bind-to-first-use deferral, frame wait budgeting, release waking orphaned waiters, and used-only prewarm deduplication.
    • hle::d3d12x::pso_library:: — 3 passed. Covered latest-generation selection, empty/missing file handling, and preserving an open Windows mapping while saving a new generation.
    • hle::d3d12x::real::pso_lib::tests:: — 2 passed. Covered deterministic compute/graphics/stream keys and background save scheduling.
  • The workspace run passed async_compute_pso_registers_real_pso_and_not_standin and console_wave64_compute_through_the_pso_hook_dispatch_and_read_back without skip markers. These exercised asynchronous compute PSO registration and synthetic compute dispatch/readback.

Workspace suite

cargo test --workspace --no-fail-fast -- --test-threads=4 ran once inside L:/XclTooling/Invoke-ArcTest.ps1 and exited 101. Combined output is in L:\XclTooling\neon-slot-2\tmp\pr2001-suite.log.

Test target Passed Failed Ignored SKIPPED lines
xcl library unit tests 1002 25 25 22
xcl binary unit tests 0 0 0 0
tests\bcpack_parity.rs 1 0 0 0
tests\console_dlls_e2e.rs 13 0 0 0
tests\console_shaders.rs 3 0 4 0
tests\disasm_e2e.rs 1 0 0 0
tests\e2e.rs 2 1 0 0
tests\gpu_compute_e2e.rs 4 0 0 1
tests\gpu_pso_e2e.rs 7 0 0 0
tests\heap_probe.rs 0 0 4 0
tests\low_va.rs 1 0 0 0
tests\pls_quota.rs 1 0 0 0
tests\predication_e2e.rs 1 0 0 0
tests\rpf_e2e.rs 2 0 0 0
tests\shaders_e2e.rs 4 0 0 0
tests\sparse_reinit.rs 1 0 0 0
tests\texture_states.rs 1 0 0 0
tests\xg_oracle.rs 6 0 12 0
xcl-testtitle binary unit tests 0 0 0 0
Doc-tests xcl 0 0 0 0
Total 1050 26 45 23

All 20 harnesses reported results. The counts above are libtest totals. The 23 emitted SKIPPED lines span 13 test names and mark whole tests or individual subcases excluded from coverage.

  • 18 for unavailable wave64 execution.
  • 3 for refused per-lane shader instructions (V_MUL_F16, V_PK_MUL_F16, V_CVT_F16_F32).
  • 1 for unavailable driver-cache control (0x887A002D).
  • 1 for unavailable heap windows.

Failures

25 unrelated by code path. These DXIL and recompiler unit tests use the direct D3D12 test runner and bypass the changed XCL PSO hooks. The 21 tests below failed at CreateComputePipelineState with 0x80070057 (E_INVALIDARG). The f64 cases are consistent with the adapter's lack of FP64 shader support.

  • gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0
  • gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1
  • gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_2
  • gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3
  • gpu::dxil::ops_tests::doubles_match_cpu
  • gpu::dxil::ops_tests::groupshared_barrier_and_atomics_run
  • gpu::dxil::round_tests::gpu_direct_f32_round_modes_dynamic_and_denormals
  • gpu::dxil::round_tests::gpu_direct_f32_round_modes_static
  • gpu::dxil::round_tests::gpu_direct_f32_round_preserved_denormal_times_inf_is_inf
  • gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu
  • gpu::recomp::tests::gpu_clamp_and_omod_per_instruction
  • gpu::recomp::tests::gpu_f64_class_compare
  • gpu::recomp::tests::gpu_f64_compares_with_nan
  • gpu::recomp::tests::gpu_f64_literal_high_word
  • gpu::recomp::tests::gpu_f64_math_random
  • gpu::recomp::tests::gpu_f64_roots
  • gpu::recomp::tests::gpu_f64_rounding_and_conversions
  • gpu::recomp::tests::gpu_float_compares_random
  • gpu::recomp::tests::gpu_frexp_f64_exp_and_mant
  • gpu::recomp::tests::gpu_ldexp_f64
  • gpu::recomp::tests::gpu_rndne_f64

Four more direct-runner tests reported shader result mismatches.

  • gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction — fused overflow control returned infinity.
  • gpu::recomp::tests::gpu_ps_image_sample_offset_implicit_lod_between_mips — got 25.609375, expected 26.
  • gpu::recomp::tests::gpu_valu_16_and_64_bit — v_add_f16 did not preserve the high half.
  • gpu::recomp::tests::gpu_wave64_ps_whole_wave_reductions — one channel read 217, expected 216.

1 confirmed pre-existing. test_title_runs_and_game_folder_is_untouched reached the synthetic title's RSSetDepthBiasX(-1000.5) check and saw blue [0, 0, 255, 255] where green was expected. The identical failure reproduced on the PR merge base 656c0e8ca070bdc9d7cb197d264792ef49304865 under the same Arc lock with cargo test -p xcl --test e2e test_title_runs_and_game_folder_is_untouched -- --exact. The baseline recorded 0 passed, 1 failed, 0 ignored, and 2 filtered out in pr2001-baseline-e2e.log.

Not tested

  • Retail Xbox title smoke runs, title-level graphics/mesh lazy compilation, and retail shader pack paths (XCL_SAMPLE_RPF unset). Sample-gated early returns can appear as passes.
  • D3D12 debug layer (d3d12SDKLayers.dll absent). The debug-layer test returns early under libtest capture, so that return is outside the 23 emitted markers.
  • Driver-backed ID3D12PipelineLibrary1 persistence across title runs, including verified cache hits and shutdown flushing. Unit tests covered mapped-file generation and save scheduling.
  • AMD/NVIDIA adapters and full native wave64 execution.

AI use

T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified the counts against pr2001-suite.log and published this report.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 02:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7150980110) # PR #2001 verification on STOR-WINLAB Tested detached head `1f1d681439db77ea01a656dc8fc65aa4eabc7d1b` with a clean tracked worktree. ## Environment - Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X. - Intel Arc A770 16 GiB, driver 32.0.101.9175, wave range 8–32, `DoublePrecisionFloatShaderOps=0`. - DXC/DXIL 1.9.2609.5 from `%LOCALAPPDATA%\XclTooling\dxc-1.9.2609\bin\x64`. Rust `rustc 1.100.0 (0ef1bc386 2026-11-09)`. Unoptimized Cargo dev/test profiles with debug info and incremental compilation disabled. ## Tested - `cargo build --workspace` and `cargo test --workspace --no-run` both exited 0 outside the GPU lock. - `cargo test -p xcl --lib <filter> -- --nocapture` passed for all three filters. Each had zero failures, ignores, and skip markers. - `hle::d3d12x::pso_async::` — 15 passed. Covered off-thread PSO construction, lazy bind-to-first-use deferral, frame wait budgeting, release waking orphaned waiters, and used-only prewarm deduplication. - `hle::d3d12x::pso_library::` — 3 passed. Covered latest-generation selection, empty/missing file handling, and preserving an open Windows mapping while saving a new generation. - `hle::d3d12x::real::pso_lib::tests::` — 2 passed. Covered deterministic compute/graphics/stream keys and background save scheduling. - The workspace run passed `async_compute_pso_registers_real_pso_and_not_standin` and `console_wave64_compute_through_the_pso_hook_dispatch_and_read_back` without skip markers. These exercised asynchronous compute PSO registration and synthetic compute dispatch/readback. ## Workspace suite `cargo test --workspace --no-fail-fast -- --test-threads=4` ran once inside `L:/XclTooling/Invoke-ArcTest.ps1` and exited 101. Combined output is in `L:\XclTooling\neon-slot-2\tmp\pr2001-suite.log`. | Test target | Passed | Failed | Ignored | `SKIPPED` lines | |---|---:|---:|---:|---:| | `xcl library unit tests` | 1002 | 25 | 25 | 22 | | `xcl binary unit tests` | 0 | 0 | 0 | 0 | | `tests\bcpack_parity.rs` | 1 | 0 | 0 | 0 | | `tests\console_dlls_e2e.rs` | 13 | 0 | 0 | 0 | | `tests\console_shaders.rs` | 3 | 0 | 4 | 0 | | `tests\disasm_e2e.rs` | 1 | 0 | 0 | 0 | | `tests\e2e.rs` | 2 | 1 | 0 | 0 | | `tests\gpu_compute_e2e.rs` | 4 | 0 | 0 | 1 | | `tests\gpu_pso_e2e.rs` | 7 | 0 | 0 | 0 | | `tests\heap_probe.rs` | 0 | 0 | 4 | 0 | | `tests\low_va.rs` | 1 | 0 | 0 | 0 | | `tests\pls_quota.rs` | 1 | 0 | 0 | 0 | | `tests\predication_e2e.rs` | 1 | 0 | 0 | 0 | | `tests\rpf_e2e.rs` | 2 | 0 | 0 | 0 | | `tests\shaders_e2e.rs` | 4 | 0 | 0 | 0 | | `tests\sparse_reinit.rs` | 1 | 0 | 0 | 0 | | `tests\texture_states.rs` | 1 | 0 | 0 | 0 | | `tests\xg_oracle.rs` | 6 | 0 | 12 | 0 | | `xcl-testtitle binary unit tests` | 0 | 0 | 0 | 0 | | `Doc-tests xcl` | 0 | 0 | 0 | 0 | | **Total** | **1050** | **26** | **45** | **23** | All 20 harnesses reported results. The counts above are libtest totals. The 23 emitted `SKIPPED` lines span 13 test names and mark whole tests or individual subcases excluded from coverage. - 18 for unavailable wave64 execution. - 3 for refused per-lane shader instructions (`V_MUL_F16`, `V_PK_MUL_F16`, `V_CVT_F16_F32`). - 1 for unavailable driver-cache control (`0x887A002D`). - 1 for unavailable heap windows. ## Failures **25 unrelated by code path.** These DXIL and recompiler unit tests use the direct D3D12 test runner and bypass the changed XCL PSO hooks. The 21 tests below failed at `CreateComputePipelineState` with `0x80070057` (`E_INVALIDARG`). The f64 cases are consistent with the adapter's lack of FP64 shader support. - `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0` - `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` - `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_2` - `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3` - `gpu::dxil::ops_tests::doubles_match_cpu` - `gpu::dxil::ops_tests::groupshared_barrier_and_atomics_run` - `gpu::dxil::round_tests::gpu_direct_f32_round_modes_dynamic_and_denormals` - `gpu::dxil::round_tests::gpu_direct_f32_round_modes_static` - `gpu::dxil::round_tests::gpu_direct_f32_round_preserved_denormal_times_inf_is_inf` - `gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu` - `gpu::recomp::tests::gpu_clamp_and_omod_per_instruction` - `gpu::recomp::tests::gpu_f64_class_compare` - `gpu::recomp::tests::gpu_f64_compares_with_nan` - `gpu::recomp::tests::gpu_f64_literal_high_word` - `gpu::recomp::tests::gpu_f64_math_random` - `gpu::recomp::tests::gpu_f64_roots` - `gpu::recomp::tests::gpu_f64_rounding_and_conversions` - `gpu::recomp::tests::gpu_float_compares_random` - `gpu::recomp::tests::gpu_frexp_f64_exp_and_mant` - `gpu::recomp::tests::gpu_ldexp_f64` - `gpu::recomp::tests::gpu_rndne_f64` Four more direct-runner tests reported shader result mismatches. - `gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction` — fused overflow control returned infinity. - `gpu::recomp::tests::gpu_ps_image_sample_offset_implicit_lod_between_mips` — got 25.609375, expected 26. - `gpu::recomp::tests::gpu_valu_16_and_64_bit` — `v_add_f16` did not preserve the high half. - `gpu::recomp::tests::gpu_wave64_ps_whole_wave_reductions` — one channel read 217, expected 216. **1 confirmed pre-existing.** `test_title_runs_and_game_folder_is_untouched` reached the synthetic title's `RSSetDepthBiasX(-1000.5)` check and saw blue `[0, 0, 255, 255]` where green was expected. The identical failure reproduced on the PR merge base `656c0e8ca070bdc9d7cb197d264792ef49304865` under the same Arc lock with `cargo test -p xcl --test e2e test_title_runs_and_game_folder_is_untouched -- --exact`. The baseline recorded 0 passed, 1 failed, 0 ignored, and 2 filtered out in `pr2001-baseline-e2e.log`. ## Not tested - Retail Xbox title smoke runs, title-level graphics/mesh lazy compilation, and retail shader pack paths (`XCL_SAMPLE_RPF` unset). Sample-gated early returns can appear as passes. - D3D12 debug layer (`d3d12SDKLayers.dll` absent). The debug-layer test returns early under libtest capture, so that return is outside the 23 emitted markers. - Driver-backed `ID3D12PipelineLibrary1` persistence across title runs, including verified cache hits and shutdown flushing. Unit tests covered mapped-file generation and save scheduling. - AMD/NVIDIA adapters and full native wave64 execution. ## AI use T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified the counts against `pr2001-suite.log` and published this report.
Author
Owner

@⁠akimfomin on GitHub · 2026-11-25 02:50 UTC · original

raylitebull, PortBridge followed up on victory-fork's duplicate pipeline work by checking XCL's driver blob cache. The compute and graphics publish and removal routines are unchanged between your 1f1d6814 head and main cbc296ab.

A CPU fixture forces four publishers of the same 16-byte key through those exact routines. Both caches charge 64 bytes with 16 present, then retain 48 bytes of charge after removal. Checking the vacant entry under the existing map lock makes both report 16 before removal and zero afterward. Under a 64-byte test budget, all four independent 16-byte keys then fit.

Exact patch, method and result. The patch only changes in-memory publishing and accounting. The fixture mocks blob retrieval and does not measure driver work or startup time.

**@⁠akimfomin** on GitHub · 2026-11-25 02:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7151258731) raylitebull, [PortBridge](https://github.com/akimfomin/PortBridge) followed up on [victory-fork's duplicate pipeline work](https://github.com/fxceless/victory-fork/issues/470#issuecomment-7150809773) by checking XCL's driver blob cache. The compute and graphics publish and removal routines are unchanged between your `1f1d6814` head and main `cbc296ab`. A CPU fixture forces four publishers of the same 16-byte key through those exact routines. Both caches charge 64 bytes with 16 present, then retain 48 bytes of charge after removal. Checking the vacant entry under the existing map lock makes both report 16 before removal and zero afterward. Under a 64-byte test budget, all four independent 16-byte keys then fit. [Exact patch, method and result](https://github.com/akimfomin/PortBridge/blob/cf1ef7a06dc6ab9ffd04f51ed576a1bb9d404b70/research/xcl-dxil-night/psoblob-accounting/ACCOUNTING.md). The patch only changes in-memory publishing and accounting. The fixture mocks blob retrieval and does not measure driver work or startup time.
Author
Owner

@⁠Royalflamejlh on GitHub · 2026-11-25 03:13 UTC · original

Linux (Wine + vkd3d-proton) + NVIDIA test of 1f1d681 on main 2bdf047 + #684: with no library file yet, the pipeline library was not created, so nothing was saved. The empty library is asked for with a non-null pointer and length 0, which vkd3d-proton refuses with E_INVALIDARG. With a null pointer it was created, saved, and read back in the next run.

Setup: Fedora 44, Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch (neither touches cache.c), RTX 4070 12 GB (driver 615.71.09), release build, XCL_PSO_PRELOAD=0 and no other switch. Retail title 1.0.2.1, the first-run screens completed once and no story progress, A pressed when the title presents steadily. One run per column, in this order.

Tested

main + #684 with 1f1d681 with the three lines below, run 1 the same, run 2
seconds 120 120 100 100
pipeline library lines in the log – 0 5 saved (gen 1 to 5, 160 pipelines) opened … gen-00000005, graphics PSO loaded from memory-mapped pipeline library from 5.1 s, 2 saved
draws skipped / dispatches skipped 0 / 0 64 to 127 / 0, the draws from 118.3 s 0 / 0 64 to 127 / 0, the draws from 88.0 s
last 2 s with a present 82.6 s 74.5 s 90.6 s 88.2 s
faults / device removals 0 / 0 0 / 0 0 / 0 0 / 0
  • A second run of 1f1d681 as it is, made after the last column, opened the file those runs had left (gen-00000007). So only the first, empty creation fails.
  • Native Windows (RTX 5070 Ti 16 GB, driver 621.24), 1 run of 120 s of the earlier head 4d53a2c on the same main + #684, preload on: 6 generations saved from gen 1 and no opened line, so there the empty library is created as it is.

Read

  • pso_library.rs:409: CreatePipelineLibrary::<ID3D12PipelineLibrary1>(&[]) passes the empty slice's pointer with length 0. vkd3d-proton refuses that (libs/vkd3d/cache.c:2534, if (!blob_length && blob); a probe of the one call on this prefix: 0x80070057 with a non-null pointer, 0 with NULL), .ok()? drops it and nothing is logged. What I ran in its place:
let mut lib: Option<ID3D12PipelineLibrary1> = None;
(Interface::vtable(&dev1).CreatePipelineLibrary)(Interface::as_raw(&dev1), std::ptr::null(), 0, &ID3D12PipelineLibrary1::IID, &mut lib as *mut _ as *mut _).ok().ok()?;
let lib = lib?;

Not tested: a world load (no run presented after 91 s); whether the library saves time here; scripts/smoke.ps1; XCL_LAZY_PSO=1; its unit tests at this head; 1f1d681 itself and the three lines on native Windows; AMD and Intel.

AI use: Claude Code (Claude Fable 5.2) read the diff, wrote and ran the probe and the three lines, ran the title and wrote this comment.

Posted without review by a person: the account owner was away and reads replies later.

**@⁠Royalflamejlh** on GitHub · 2026-11-25 03:13 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7151703011) Linux (Wine + vkd3d-proton) + NVIDIA test of `1f1d681` on `main` `2bdf047` + #684: with no library file yet, the pipeline library was not created, so nothing was saved. The empty library is asked for with a non-null pointer and length 0, which vkd3d-proton refuses with `E_INVALIDARG`. With a null pointer it was created, saved, and read back in the next run. **Setup:** Fedora 44, Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch (neither touches `cache.c`), RTX 4070 12 GB (driver 615.71.09), release build, `XCL_PSO_PRELOAD=0` and no other switch. Retail title 1.0.2.1, the first-run screens completed once and no story progress, A pressed when the title presents steadily. One run per column, in this order. **Tested** | | `main` + #684 | with `1f1d681` | with the three lines below, run 1 | the same, run 2 | |---|---|---|---|---| | seconds | 120 | 120 | 100 | 100 | | `pipeline library` lines in the log | – | 0 | 5 `saved` (gen 1 to 5, 160 pipelines) | `opened … gen-00000005`, `graphics PSO loaded from memory-mapped pipeline library` from 5.1 s, 2 `saved` | | draws skipped / dispatches skipped | 0 / 0 | 64 to 127 / 0, the draws from 118.3 s | 0 / 0 | 64 to 127 / 0, the draws from 88.0 s | | last 2 s with a present | 82.6 s | 74.5 s | 90.6 s | 88.2 s | | faults / device removals | 0 / 0 | 0 / 0 | 0 / 0 | 0 / 0 | - A second run of `1f1d681` as it is, made after the last column, opened the file those runs had left (`gen-00000007`). So only the first, empty creation fails. - Native Windows (RTX 5070 Ti 16 GB, driver 621.24), 1 run of 120 s of the earlier head `4d53a2c` on the same `main` + #684, preload on: 6 generations saved from gen 1 and no `opened` line, so there the empty library is created as it is. **Read** - `pso_library.rs:409`: `CreatePipelineLibrary::<ID3D12PipelineLibrary1>(&[])` passes the empty slice's pointer with length 0. vkd3d-proton refuses that (`libs/vkd3d/cache.c:2534`, `if (!blob_length && blob)`; a probe of the one call on this prefix: `0x80070057` with a non-null pointer, `0` with NULL), `.ok()?` drops it and nothing is logged. What I ran in its place: ```rust let mut lib: Option<ID3D12PipelineLibrary1> = None; (Interface::vtable(&dev1).CreatePipelineLibrary)(Interface::as_raw(&dev1), std::ptr::null(), 0, &ID3D12PipelineLibrary1::IID, &mut lib as *mut _ as *mut _).ok().ok()?; let lib = lib?; ``` **Not tested:** a world load (no run presented after 91 s); whether the library saves time here; `scripts/smoke.ps1`; `XCL_LAZY_PSO=1`; its unit tests at this head; `1f1d681` itself and the three lines on native Windows; AMD and Intel. **AI use:** Claude Code (Claude Fable 5.2) read the diff, wrote and ran the probe and the three lines, ran the title and wrote this comment. Posted without review by a person: the account owner was away and reads replies later.
Author
Owner

@⁠WebIdentity1 on GitHub · 2026-11-25 01:07 UTC · original · edited 2026-11-25 03:21 UTC

Both demand-lifecycle repairs are available as small commits

For adoption on 1f1d681439db77ea01a656dc8fc65aa4eabc7d1b, apply these in order:

  1. 8be0af7 — restore worker priority after abandoned waits: 2 added / 3 removed runtime lines plus its regression.
  2. 21bfbb0 — count unbounded waiters: one runtime line changed plus its regression, stacked on the first fix.

The second repair keeps wanted_here() true while an unbounded title thread still waits, even if another bounded wait times out. Both fixes reuse the existing demand lock/guard. No competing PR and no cache-accounting or Wine library-creation changes.

Combined validation: native Windows 10 Home 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74, Rust/Cargo 1.98.1 MSVC, DXC/DXIL 1.8.2502.11, debug. XCL_ADAPTER=3090, XCL_PSO_TITLE_BUILD=0.

cargo build --locked --workspace
cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output
Snapshot Build Passed / failed / ignored across 20 harness summaries
Priority fix 8be0af7 + mixed-waiter regression only passed 1075 / 3 / 45
Both fixes + same regressions, committed as 21bfbb0 passed 1077 / 1 / 45

The control's mixed-waiter regression reports an active unbounded waiter but wanted_after_timeout=false waiters=0. The candidate reports true / 1, then zero after completion. The priority regression passes on both snapshots: bases -1/-2, boost to 0, restored -1/-2 after the build and inside the next unwanted job.

Both retain the identical CLAMP mismatch (gpu_clamp_and_omod_per_instruction, lane-0 v_pk_add_i16, actual 2146467856, expected 2147516415). The control additionally fails d32s8_targets_take_their_own_size_of_video_memory at list.Close() with 0x80004005; the candidate passes it. That D32S8 difference is not credited to the scheduling fix. No candidate-only failures; both Cargo test commands exit 101, so this is not an all-green suite.

The same 26 explicit SKIPPED notices occur in each run: 19 native-wave64 subcases, three refused wave32 per-lane cases, two missing-debug-layer checks, one unavailable driver-cache-control check and one unavailable heap-window check. Data-dependent early returns do not establish retail coverage. All 314 source hashes match before/after execution and locally; the published tree matches the tested candidate exactly. XCL rebuilt for each snapshot.

Not tested: retail smoke, current-main integration, real driver-admission effects, compilation throughput, stutter or memory savings. The two native-thread regression fixtures check production demand/priority behavior with synthetic jobs. Required merge checks remain outstanding. Earlier isolated evidence and patches are preserved below.

AI use: Codex (GPT-6) prepared the fixes/tests, performed and verified the native Windows runs, and wrote this report.

Earlier isolated comparisons and patches

Priority cleanup: workspace comparison and cherry-pickable fix

The verified priority-lifecycle repair below is now available as commit 8be0af7, based directly on 1f1d681439db77ea01a656dc8fc65aa4eabc7d1b. Runtime change: 2 added / 3 removed lines, plus the regression. It restores the worker's base priority after the build finishes, under the existing demand lock. It does not include the separate mixed-waiter fix or PortBridge's cache-accounting change. No competing PR.

Tested: native Windows 10 Home 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74, Rust/Cargo 1.98.1 MSVC, DXC/DXIL 1.8.2502.11, debug. XCL_ADAPTER=3090, XCL_PSO_TITLE_BUILD=0.

cargo build --locked --workspace
cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output
Snapshot Workspace build Passed / failed / ignored across 20 harness summaries
PR head + regression passed 1075 / 2 / 45
PR head + priority fix + same regression passed 1076 / 1 / 45

Both retain gpu_clamp_and_omod_per_instruction: lane-0 v_pk_add_i16 clamp, actual 2146467856, expected 2147516415. Both Cargo test commands exit 101. No candidate-only failure observed; not an all-green suite. The repaired regression again checks actual Windows thread priority: base -1/-2 → boost 0 during the build; control stays 0 after completion and in the next unwanted job, while the fix restores -1/-2 for both observations.

Both runs emit the same 26 explicit SKIPPED notices: 19 unavailable native-wave64 subcases, three refused wave32 per-lane cases (f16 arithmetic, f16 packed, f32 conversions), two missing-debug-layer checks, one unavailable driver-cache-control check and one unavailable heap-window check. Data-dependent tests can return successfully without sample files, so raw pass counts are not retail coverage. All 314 source files matched before/after the Windows runs, locally, and in the published commit; XCL rebuilt each snapshot.

Not tested: retail smoke, actual driver-load scheduling benefit, stutter/throughput/CPU-use improvements, or current-main integration. The native priority probe uses dedicated test-owned threads calling production build() twice, rather than taking over shared queue workers. This completes the local workspace check for the priority patch; required merge and retail checks remain outstanding.

AI use: Codex (GPT-6) prepared the fix/test, ran and verified the Windows comparisons, and wrote this report.


Follow-up on 1f1d681: restore worker priority after an abandoned wait

Verified a separate priority-lifecycle bug on exact 1f1d681439db77ea01a656dc8fc65aa4eabc7d1b. A wait boosts the compile worker to normal priority. The new timeout guard can then clear d.wanted, but build() restores the worker's base priority only if d.wanted is still true. The next unwanted job inherits normal priority.

Small candidate in pso_async::build: always restore base_priority after clearing worker_thread, under the existing demand lock. This preserves the lock ordering that prevents a late want() from boosting a worker after cleanup. It restores priority when the build ends, not immediately on abandonment. This candidate is independent of the mixed-waiter fix below; neither comparison includes that patch.

Tested — native Windows 10 Home 19045, Ryzen 7 7800X3D, Rust/Cargo 1.98.1 x64 MSVC, debug; XCL_PSO_TITLE_BUILD=0.

cargo test --locked -p xcl --lib -- hle::d3d12x::pso_async --test-threads=1 --show-output

Snapshot Passed / failed / ignored / skipped After first build / inside next unwanted job
Head + regression 15 / 1 / 0 / 0 Normal / normal for both worker modes
Head + candidate + same regression 16 / 0 / 0 / 0 Below-normal / below-normal, and lowest / lowest

The regression uses test-owned native threads invoking production build() twice. It checks the actual Windows GetThreadPriority: initial bases -1 and -2, boosted priority 0 inside the first channel-gated job, then abandonment before releasing that job. Baseline records after=0 next=0 for both; candidate records after=-1 next=-1 and after=-2 next=-2. Both modes are checked before the final failure assertion. Pending entries are removed and threads joined before the result assertions. Existing 15 controls still pass. Both 314-file source manifests matched before/after and local snapshots; XCL recompiled both.

Not tested — actual shared-worker queue dispatch or driver compilation in this probe, GPU output, full workspace suite, retail smoke, stutter, CPU utilization or compilation throughput. This proves the priority leak and its cleanup fix, not a measured performance gain or resolution of the retail world-loading symptoms. No commit/push or competing PR; required merge checks remain separate.

AI use — Codex (GPT-6) identified the cleanup gap, wrote the candidate and regression, ran/verified the native comparison and prepared this update.

Independent candidate and regression
diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs
index 58147a9..46e46a6 100644
--- a/crates/xcl/src/hle/d3d12x/pso_async.rs
+++ b/crates/xcl/src/hle/d3d12x/pso_async.rs
@@ -84,9 +84,8 @@ fn build(p: &Arc<Pending>, job: Job, base_priority: i32) {
         // (under the lock: `want` does not raise this thread after it)
         let mut d = p.demand.lock().unwrap();
         d.worker_thread = 0;
-        if d.wanted {
-            unsafe { SetThreadPriority(GetCurrentThread(), base_priority) };
-        }
+        // A timed-out waiter can clear wanted after this worker was boosted.
+        unsafe { SetThreadPriority(GetCurrentThread(), base_priority) };
     }
     BUILDING.with(|b| *b.borrow_mut() = None);
 }
@@ -866,6 +865,55 @@ mod used_tests {
         gate.1.notify_all();
     }
 
+    #[test]
+    fn an_abandoned_wait_restores_worker_priority_before_its_next_job() {
+        use windows_sys::Win32::System::Threading::{GetCurrentThread, GetThreadPriority, SetThreadPriority, THREAD_PRIORITY_BELOW_NORMAL, THREAD_PRIORITY_LOWEST, THREAD_PRIORITY_NORMAL};
+        let mut failures = Vec::new();
+        for (i, base) in [THREAD_PRIORITY_BELOW_NORMAL, THREAD_PRIORITY_LOWEST].into_iter().enumerate() {
+            let standin = 0x7E57_B530usize + 2 * i;
+            let (started, building) = mpsc::channel();
+            let (go, finish) = mpsc::channel::<()>();
+            submit_lazy(standin, false, Box::new(move || {
+                started.send(unsafe { GetThreadPriority(GetCurrentThread()) }).unwrap();
+                let _ = finish.recv_timeout(Duration::from_secs(10));
+                0
+            }), 0);
+            submit_lazy(standin + 1, false, Box::new(|| 0), 0);
+            let p = entry(standin).unwrap();
+            let q = entry(standin + 1).unwrap();
+            let job = p.job.lock().unwrap().take().unwrap();
+            let _ = q.job.lock().unwrap().take();
+            let guard = p.begin_wait();
+            let worker_p = p.clone();
+            // Dedicated test-owned thread, using the production build lifecycle twice.
+            let worker = std::thread::spawn(move || unsafe {
+                assert_ne!(SetThreadPriority(GetCurrentThread(), base), 0);
+                let initial = GetThreadPriority(GetCurrentThread());
+                build(&worker_p, job, base);
+                let after = GetThreadPriority(GetCurrentThread());
+                let (tx, rx) = mpsc::channel();
+                build(&q, Box::new(move || {
+                    tx.send(GetThreadPriority(GetCurrentThread())).unwrap();
+                    0
+                }), base);
+                (initial, after, rx.recv().unwrap())
+            });
+            let during = building.recv_timeout(Duration::from_secs(10)).expect("boosted build started");
+            guard.abandon();
+            let abandoned = !p.demand.lock().unwrap().wanted;
+            let _ = go.send(());
+            let (initial, after, next) = worker.join().unwrap();
+            let _ = released(standin);
+            let _ = released(standin + 1);
+            println!("WORKER_PRIORITY base={base} initial={initial} during={during} abandoned={abandoned} after={after} next={next}");
+            assert_eq!(initial, base);
+            assert_eq!(during, THREAD_PRIORITY_NORMAL);
+            assert!(abandoned);
+            if after != base || next != base { failures.push(base); }
+        }
+        assert!(failures.is_empty(), "workers kept boosted priority after abandonment: {failures:?}");
+    }
+
     #[test]
     fn default_frame_budget_only_defers_graphics_and_never_leaves_skipped_psos_wanted() {
         let cap = Duration::from_millis(500);

Follow-up on 1f1d681: keep unbounded waits in the new demand count

Verified one remaining scheduling bug in exact 1f1d681439db77ea01a656dc8fc65aa4eabc7d1b. resolve_within uses begin_wait(), but the unbounded path in resolve_wait_with_budgets still calls p.want() directly. When a bounded waiter abandons the same pending pipeline, its guard sees zero counted waiters and clears wanted, even while the unbounded title thread remains blocked. wanted_here() then falsely tells the compile scheduler that nobody needs the build.

A possible policy transition is a graphics wait begun before the first Present (uncapped), followed by a second wait after the implicit frame cap activates. The test supplies these two budget modes directly; I have not observed this sequence in a retail title or proved a resulting watchdog/OOM.

Candidate: replace the unbounded path's p.want() with let _want_guard = p.begin_wait();. It joins the same existing lifetime/count mechanism, leaving timeout and frame policy unchanged. One runtime line changed, plus a 32-line regression in the same file (33 additions / 1 deletion overall).

Tested

Native Windows 10 Home19045, Ryzen7800X3D, Rust/Cargo1.98.1 x64 MSVC, debug. This is a real CPU-thread/worker test with a synthetic blocked job, not a GPU or driver compilation test. XCL_PSO_TITLE_BUILD=0 ensures the worker path.

cargo test --locked -p xcl --lib -- hle::d3d12x::pso_async --test-threads=1 --show-output

  • Head + same regression: 15 passed / 1 failed / 0 ignored / 0 skipped. Recorded initial=true unbounded_active=true wanted_after_timeout=false waiters=0.
  • Head + candidate + regression: 16 / 0 / 0 / 0. Recorded initial=true unbounded_active=true wanted_after_timeout=true waiters=1; final count is zero after completion.

The worker sends its actual wanted_here() callback, then stays behind a channel gate. The test observes active demand before making the second wait expire on a1ms frame budget. It records that the first waiter is still blocked, then opens the gate, joins it, and removes the pending entry before assertions, including on baseline failure. It checks the scheduler's callback as well as the counter. Existing lazy-bind, default-frame-budget, orphan-release, prewarm, bounded-wait and worker-demand tests all pass with the candidate.

Both314-file manifests matched before/after and the local snapshots; XCL recompiled both. No source commit/push or competing PR.

Not tested — full workspace, real GPU compile admission, retail world loading/watchdogs, actual commit-memory or performance effects, and other platforms. This fixes the false demand state; it does not establish that the earlier retail symptoms are resolved. Existing full-suite/retail requirements remain separate.

AI use — Codex (GPT-6) identified the uncounted path, wrote the one-line candidate and controlled regression, ran/verified the native comparison, and prepared this update.

Candidate and regression
diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs
index 58147a9..c3b3b11 100644
--- a/crates/xcl/src/hle/d3d12x/pso_async.rs
+++ b/crates/xcl/src/hle/d3d12x/pso_async.rs
@@ -866,6 +866,38 @@ mod used_tests {
         gate.1.notify_all();
     }
 
+    #[test]
+    fn a_timed_out_waiter_does_not_cancel_an_unbounded_waiters_demand() {
+        let standin = 0x7E57_B522usize;
+        let (started, building) = mpsc::channel();
+        let (go, finish) = mpsc::channel::<()>();
+        submit_lazy(standin, false, Box::new(move || {
+            started.send(wanted_here()).unwrap();
+            let _ = finish.recv_timeout(Duration::from_secs(10));
+            0
+        }), 0);
+        let bind = std::thread::spawn(move || resolve_wait_with_budgets(standin, None, None, &FrameWaitBudget::new()));
+        let wanted = building.recv_timeout(Duration::from_secs(10)).expect("worker started");
+        let start = Instant::now();
+        while !wanted() && start.elapsed() < Duration::from_secs(5) { std::thread::yield_now(); }
+        let initial = wanted();
+        let timed = resolve_wait_with_budgets(standin, None, Some(Duration::from_millis(1)), &FrameWaitBudget::new());
+        let pending = entry(standin).unwrap();
+        let still_waiting = !bind.is_finished();
+        let wanted_after_timeout = wanted();
+        let waiters = pending.demand.lock().unwrap().waiters;
+        // Release the worker and join the waiter before asserting, including on the negative control.
+        let _ = go.send(());
+        let resolved = bind.join().unwrap();
+        let _ = released(standin);
+        println!("MIXED_WAIT initial={initial} unbounded_active={still_waiting} wanted_after_timeout={wanted_after_timeout} waiters={waiters}");
+        assert!(initial && still_waiting, "unbounded waiter must be active during the timeout");
+        assert_eq!((timed, resolved), (standin, standin));
+        assert!(wanted_after_timeout, "an unbounded waiter still needs the compile");
+        assert_eq!(waiters, 1);
+        assert_eq!(pending.demand.lock().unwrap().waiters, 0);
+    }
+
     #[test]
     fn default_frame_budget_only_defers_graphics_and_never_leaves_skipped_psos_wanted() {
         let cap = Duration::from_millis(500);
@@ -1156,7 +1188,7 @@ fn resolve_wait_with_budgets(
     } else {
         enqueue(&p, true);
     }
-    p.want();
+    let _want_guard = p.begin_wait();
     let mut done = p.done.lock().unwrap();
     while !*done {
         done = p.cv.wait(done).unwrap();

Confirmed @⁠gsucristo's blocking finding 2 on 7244baadcf009af2a79e94c9fd9c6e7b41d89ab9, with a small cancellation fix and deterministic reproducer.

The worker's orphan branch skips the job without calling complete, leaving an existing resolve_wait_for(..., None) waiter blocked on Pending::done. The candidate marks cancellation done and notifies waiters in released(), under the existing done mutex, after setting orphan. It does not depend on either worker queue progressing. An already-running build still reaches complete, sees orphan, and releases its result instead of publishing it. No failed-build counter is incremented just for cancellation.

The regression holds the worker queue while the waiter captures the pending entry, releases that entry, then opens the queue. It checks the waiter returns the existing stand-in fallback and the compiler closure never runs. On old code, a bounded test timeout captures the failure and the fixture explicitly wakes/joins the thread before failing; it does not leave a hung test process. A synthetic COM release counter separately verifies that complete still releases a late result exactly once and does not publish it.

Tested — native Windows 10 19045, Ryzen 7 7800X3D, Rust 1.98.1 MSVC, debug. Thread scheduling / fake object tests; no GPU dispatch or real driver compilation.

XCL_DXC_THREADS=2 XCL_PSO_TITLE_BUILD=0
cargo test --locked -p xcl --lib -- pso_async --test-threads=1 --show-output
  • Exact head + regression: 12 passed / 1 failed / 0 ignored, failure released job was skipped but its waiter never completed (Err(Timeout)).
  • Same head + regression + cancellation change: 13 passed / 0 failed / 0 ignored.
  • Zero skips. Both builds recompiled XCL; all 312 source hashes matched before/after.

This patch is independent of the earlier passive-bind lookup patch. It is offered here for the author's integration, with credit for the finding above; #978 already covers not executing released jobs, and is not duplicated.

Not tested — full workspace suite, the two fixes combined, actual title object-lifetime races, real COM/driver builds, dedicated preload-cancellation ordering, retail smoke or whether this stall occurs during world loading. A returned stand-in is the existing resolver fallback; the test does not establish that using an object after another thread releases it is valid. Required main/head retail smoke remains outstanding.

AI use — Codex (GPT-6) implemented the candidate and regression, ran the native tests, reviewed the cancellation/late-completion ordering and prepared this report.

Candidate and regression: one file, 50 additions / 2 deletions
diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs
index a21bb90..c719e9c 100644
--- a/crates/xcl/src/hle/d3d12x/pso_async.rs
+++ b/crates/xcl/src/hle/d3d12x/pso_async.rs
@@ -485,6 +485,51 @@ mod used_tests {
     use super::*;
     use std::sync::mpsc;
 
+    #[test]
+    fn releasing_a_queued_pipeline_wakes_its_unbounded_waiter() {
+        let standin = 0x7E57_B620usize;
+        let ran = Arc::new(AtomicBool::new(false));
+        let job_ran = ran.clone();
+        submit_lazy(standin, true, Box::new(move || {
+            job_ran.store(true, Ordering::Release);
+            0
+        }), 0x5EED_B620);
+        let p = entry(standin).unwrap();
+        // Hold dequeue/enqueue until resolve has retained this Pending. The nonzero
+        // key makes note_use publish that observation before it reaches the queue.
+        let queue = workers().q.lock().unwrap();
+        let (tx, rx) = mpsc::channel();
+        let waiter = std::thread::spawn(move || { tx.send(resolve_wait_for(standin, None)).unwrap(); });
+        let limit = std::time::Instant::now() + Duration::from_secs(5);
+        while !p.used.load(Ordering::Acquire) && std::time::Instant::now() < limit {
+            std::thread::yield_now();
+        }
+        let retained = p.used.load(Ordering::Acquire);
+        assert_eq!(released(standin), 0);
+        drop(queue);
+        let result = rx.recv_timeout(Duration::from_secs(1));
+        // Clean up even on the old code: never leave a hung thread behind a failing test.
+        *p.done.lock().unwrap() = true;
+        p.cv.notify_all();
+        waiter.join().unwrap();
+        assert!(retained, "waiter did not retain the pending pipeline");
+        assert_eq!(result, Ok(standin), "released job was skipped but its waiter never completed");
+        assert!(!ran.load(Ordering::Acquire), "released pipeline reached its compiler");
+
+        // Cancellation must still release a real result from a build already in flight.
+        static RELEASES: AtomicUsize = AtomicUsize::new(0);
+        unsafe extern "system" fn count_release(_: *mut std::ffi::c_void) -> u32 {
+            RELEASES.fetch_add(1, Ordering::SeqCst);
+            0
+        }
+        RELEASES.store(0, Ordering::SeqCst);
+        let vtable = [0usize, 0, count_release as usize];
+        let object = [vtable.as_ptr() as usize];
+        complete(&p, object.as_ptr() as usize);
+        assert_eq!(RELEASES.load(Ordering::SeqCst), 1);
+        assert_eq!(p.real.load(Ordering::Acquire), 0);
+    }
+
     /// While a bind waits for a pipeline still being built, the title is held (`title_held`):
     /// `kernelx::Sleep` does not count that time.
     #[test]
@@ -1095,12 +1140,15 @@ pub fn resolve_for_bind(pso: usize) -> usize {
 /// the worker's result is then released when it arrives).
 pub fn released(pso: usize) -> usize {
     let Some(p) = PENDING.lock().unwrap().as_mut().and_then(|m| m.remove(&pso)) else { return 0 };
-    let done = p.done.lock().unwrap();
+    let mut done = p.done.lock().unwrap();
     if *done {
         p.real.swap(0, Ordering::AcqRel)
     } else {
-        // the worker stores its result into a Pending nobody will read: mark it orphaned
+        // An in-flight result is still released by complete. A skipped queued job
+        // never calls complete, so cancellation must also wake existing waiters.
         p.orphan.store(true, Ordering::Release);
+        *done = true;
+        p.cv.notify_all();
         0
     }
 }
**@⁠WebIdentity1** on GitHub · 2026-11-25 01:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7149228032) · edited 2026-11-25 03:21 UTC ### Both demand-lifecycle repairs are available as small commits For adoption on `1f1d681439db77ea01a656dc8fc65aa4eabc7d1b`, apply these in order: 1. [8be0af7 — restore worker priority after abandoned waits](https://github.com/WebIdentity1/xcl/commit/8be0af75daee2913591bd5fa5cba5b258ebe31e8): 2 added / 3 removed runtime lines plus its regression. 2. [21bfbb0 — count unbounded waiters](https://github.com/WebIdentity1/xcl/commit/21bfbb01e0cdc25316f4c82842f9d15ad1c7e92e): one runtime line changed plus its regression, stacked on the first fix. The second repair keeps `wanted_here()` true while an unbounded title thread still waits, even if another bounded wait times out. Both fixes reuse the existing demand lock/guard. No competing PR and no cache-accounting or Wine library-creation changes. **Combined validation:** native Windows 10 Home 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74, Rust/Cargo 1.98.1 MSVC, DXC/DXIL 1.8.2502.11, debug. `XCL_ADAPTER=3090`, `XCL_PSO_TITLE_BUILD=0`. ```text cargo build --locked --workspace cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output ``` | Snapshot | Build | Passed / failed / ignored across 20 harness summaries | |---|---|---| | Priority fix 8be0af7 + mixed-waiter regression only | passed | 1075 / 3 / 45 | | Both fixes + same regressions, committed as 21bfbb0 | passed | 1077 / 1 / 45 | The control's mixed-waiter regression reports an active unbounded waiter but `wanted_after_timeout=false waiters=0`. The candidate reports `true / 1`, then zero after completion. The priority regression passes on **both** snapshots: bases -1/-2, boost to 0, restored -1/-2 after the build and inside the next unwanted job. Both retain the identical CLAMP mismatch (`gpu_clamp_and_omod_per_instruction`, lane-0 `v_pk_add_i16`, actual `2146467856`, expected `2147516415`). The control additionally fails `d32s8_targets_take_their_own_size_of_video_memory` at `list.Close()` with `0x80004005`; the candidate passes it. **That D32S8 difference is not credited to the scheduling fix.** No candidate-only failures; both Cargo test commands exit 101, so this is not an all-green suite. The same 26 explicit SKIPPED notices occur in each run: 19 native-wave64 subcases, three refused wave32 per-lane cases, two missing-debug-layer checks, one unavailable driver-cache-control check and one unavailable heap-window check. Data-dependent early returns do not establish retail coverage. All 314 source hashes match before/after execution and locally; the published tree matches the tested candidate exactly. XCL rebuilt for each snapshot. **Not tested:** retail smoke, current-main integration, real driver-admission effects, compilation throughput, stutter or memory savings. The two native-thread regression fixtures check production demand/priority behavior with synthetic jobs. Required merge checks remain outstanding. Earlier isolated evidence and patches are preserved below. **AI use:** Codex (GPT-6) prepared the fixes/tests, performed and verified the native Windows runs, and wrote this report. <details> <summary>Earlier isolated comparisons and patches</summary> ### Priority cleanup: workspace comparison and cherry-pickable fix The verified priority-lifecycle repair below is now available as [commit 8be0af7](https://github.com/WebIdentity1/xcl/commit/8be0af75daee2913591bd5fa5cba5b258ebe31e8), based directly on `1f1d681439db77ea01a656dc8fc65aa4eabc7d1b`. Runtime change: 2 added / 3 removed lines, plus the regression. It restores the worker's base priority **after the build finishes**, under the existing demand lock. It does not include the separate mixed-waiter fix or PortBridge's cache-accounting change. No competing PR. **Tested:** native Windows 10 Home 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74, Rust/Cargo 1.98.1 MSVC, DXC/DXIL 1.8.2502.11, debug. `XCL_ADAPTER=3090`, `XCL_PSO_TITLE_BUILD=0`. ```text cargo build --locked --workspace cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output ``` | Snapshot | Workspace build | Passed / failed / ignored across 20 harness summaries | |---|---|---| | PR head + regression | passed | 1075 / 2 / 45 | | PR head + priority fix + same regression | passed | 1076 / 1 / 45 | Both retain `gpu_clamp_and_omod_per_instruction`: lane-0 `v_pk_add_i16 clamp`, actual `2146467856`, expected `2147516415`. Both Cargo test commands exit 101. **No candidate-only failure observed; not an all-green suite.** The repaired regression again checks actual Windows thread priority: base -1/-2 → boost 0 during the build; control stays 0 after completion and in the next unwanted job, while the fix restores -1/-2 for both observations. Both runs emit the same 26 explicit SKIPPED notices: 19 unavailable native-wave64 subcases, three refused wave32 per-lane cases (f16 arithmetic, f16 packed, f32 conversions), two missing-debug-layer checks, one unavailable driver-cache-control check and one unavailable heap-window check. Data-dependent tests can return successfully without sample files, so raw pass counts are not retail coverage. All 314 source files matched before/after the Windows runs, locally, and in the published commit; XCL rebuilt each snapshot. **Not tested:** retail smoke, actual driver-load scheduling benefit, stutter/throughput/CPU-use improvements, or current-main integration. The native priority probe uses dedicated test-owned threads calling production `build()` twice, rather than taking over shared queue workers. This completes the local workspace check for the priority patch; required merge and retail checks remain outstanding. **AI use:** Codex (GPT-6) prepared the fix/test, ran and verified the Windows comparisons, and wrote this report. --- ### Follow-up on `1f1d681`: restore worker priority after an abandoned wait Verified a separate priority-lifecycle bug on exact `1f1d681439db77ea01a656dc8fc65aa4eabc7d1b`. A wait boosts the compile worker to normal priority. The new timeout guard can then clear `d.wanted`, but `build()` restores the worker's base priority only if `d.wanted` is still true. The next unwanted job inherits normal priority. Small candidate in `pso_async::build`: always restore `base_priority` after clearing `worker_thread`, under the existing demand lock. This preserves the lock ordering that prevents a late `want()` from boosting a worker after cleanup. It restores priority **when the build ends**, not immediately on abandonment. This candidate is independent of the mixed-waiter fix below; neither comparison includes that patch. **Tested** — native Windows 10 Home 19045, Ryzen 7 7800X3D, Rust/Cargo 1.98.1 x64 MSVC, debug; `XCL_PSO_TITLE_BUILD=0`. `cargo test --locked -p xcl --lib -- hle::d3d12x::pso_async --test-threads=1 --show-output` | Snapshot | Passed / failed / ignored / skipped | After first build / inside next unwanted job | |---|---|---| | Head + regression | 15 / 1 / 0 / 0 | Normal / normal for both worker modes | | Head + candidate + same regression | 16 / 0 / 0 / 0 | Below-normal / below-normal, and lowest / lowest | The regression uses test-owned native threads invoking production `build()` twice. It checks the actual Windows `GetThreadPriority`: initial bases -1 and -2, boosted priority 0 inside the first channel-gated job, then abandonment before releasing that job. Baseline records `after=0 next=0` for both; candidate records `after=-1 next=-1` and `after=-2 next=-2`. Both modes are checked before the final failure assertion. Pending entries are removed and threads joined before the result assertions. Existing 15 controls still pass. Both 314-file source manifests matched before/after and local snapshots; XCL recompiled both. **Not tested** — actual shared-worker queue dispatch or driver compilation in this probe, GPU output, full workspace suite, retail smoke, stutter, CPU utilization or compilation throughput. This proves the priority leak and its cleanup fix, not a measured performance gain or resolution of the retail world-loading symptoms. No commit/push or competing PR; required merge checks remain separate. **AI use** — Codex (GPT-6) identified the cleanup gap, wrote the candidate and regression, ran/verified the native comparison and prepared this update. <details> <summary>Independent candidate and regression</summary> ```diff diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs index 58147a9..46e46a6 100644 --- a/crates/xcl/src/hle/d3d12x/pso_async.rs +++ b/crates/xcl/src/hle/d3d12x/pso_async.rs @@ -84,9 +84,8 @@ fn build(p: &Arc<Pending>, job: Job, base_priority: i32) { // (under the lock: `want` does not raise this thread after it) let mut d = p.demand.lock().unwrap(); d.worker_thread = 0; - if d.wanted { - unsafe { SetThreadPriority(GetCurrentThread(), base_priority) }; - } + // A timed-out waiter can clear wanted after this worker was boosted. + unsafe { SetThreadPriority(GetCurrentThread(), base_priority) }; } BUILDING.with(|b| *b.borrow_mut() = None); } @@ -866,6 +865,55 @@ mod used_tests { gate.1.notify_all(); } + #[test] + fn an_abandoned_wait_restores_worker_priority_before_its_next_job() { + use windows_sys::Win32::System::Threading::{GetCurrentThread, GetThreadPriority, SetThreadPriority, THREAD_PRIORITY_BELOW_NORMAL, THREAD_PRIORITY_LOWEST, THREAD_PRIORITY_NORMAL}; + let mut failures = Vec::new(); + for (i, base) in [THREAD_PRIORITY_BELOW_NORMAL, THREAD_PRIORITY_LOWEST].into_iter().enumerate() { + let standin = 0x7E57_B530usize + 2 * i; + let (started, building) = mpsc::channel(); + let (go, finish) = mpsc::channel::<()>(); + submit_lazy(standin, false, Box::new(move || { + started.send(unsafe { GetThreadPriority(GetCurrentThread()) }).unwrap(); + let _ = finish.recv_timeout(Duration::from_secs(10)); + 0 + }), 0); + submit_lazy(standin + 1, false, Box::new(|| 0), 0); + let p = entry(standin).unwrap(); + let q = entry(standin + 1).unwrap(); + let job = p.job.lock().unwrap().take().unwrap(); + let _ = q.job.lock().unwrap().take(); + let guard = p.begin_wait(); + let worker_p = p.clone(); + // Dedicated test-owned thread, using the production build lifecycle twice. + let worker = std::thread::spawn(move || unsafe { + assert_ne!(SetThreadPriority(GetCurrentThread(), base), 0); + let initial = GetThreadPriority(GetCurrentThread()); + build(&worker_p, job, base); + let after = GetThreadPriority(GetCurrentThread()); + let (tx, rx) = mpsc::channel(); + build(&q, Box::new(move || { + tx.send(GetThreadPriority(GetCurrentThread())).unwrap(); + 0 + }), base); + (initial, after, rx.recv().unwrap()) + }); + let during = building.recv_timeout(Duration::from_secs(10)).expect("boosted build started"); + guard.abandon(); + let abandoned = !p.demand.lock().unwrap().wanted; + let _ = go.send(()); + let (initial, after, next) = worker.join().unwrap(); + let _ = released(standin); + let _ = released(standin + 1); + println!("WORKER_PRIORITY base={base} initial={initial} during={during} abandoned={abandoned} after={after} next={next}"); + assert_eq!(initial, base); + assert_eq!(during, THREAD_PRIORITY_NORMAL); + assert!(abandoned); + if after != base || next != base { failures.push(base); } + } + assert!(failures.is_empty(), "workers kept boosted priority after abandonment: {failures:?}"); + } + #[test] fn default_frame_budget_only_defers_graphics_and_never_leaves_skipped_psos_wanted() { let cap = Duration::from_millis(500); ``` </details> --- ### Follow-up on `1f1d681`: keep unbounded waits in the new demand count Verified one remaining scheduling bug in exact `1f1d681439db77ea01a656dc8fc65aa4eabc7d1b`. `resolve_within` uses `begin_wait()`, but the unbounded path in `resolve_wait_with_budgets` still calls `p.want()` directly. When a bounded waiter abandons the same pending pipeline, its guard sees zero counted waiters and clears `wanted`, even while the unbounded title thread remains blocked. `wanted_here()` then falsely tells the compile scheduler that nobody needs the build. A possible policy transition is a graphics wait begun before the first Present (uncapped), followed by a second wait after the implicit frame cap activates. The test supplies these two budget modes directly; **I have not observed this sequence in a retail title or proved a resulting watchdog/OOM**. Candidate: replace the unbounded path's `p.want()` with `let _want_guard = p.begin_wait();`. It joins the same existing lifetime/count mechanism, leaving timeout and frame policy unchanged. One runtime line changed, plus a 32-line regression in the same file (33 additions / 1 deletion overall). **Tested** Native Windows 10 Home19045, Ryzen7800X3D, Rust/Cargo1.98.1 x64 MSVC, debug. This is a real CPU-thread/worker test with a synthetic blocked job, **not a GPU or driver compilation test**. `XCL_PSO_TITLE_BUILD=0` ensures the worker path. `cargo test --locked -p xcl --lib -- hle::d3d12x::pso_async --test-threads=1 --show-output` - Head + same regression: **15 passed / 1 failed / 0 ignored / 0 skipped**. Recorded `initial=true unbounded_active=true wanted_after_timeout=false waiters=0`. - Head + candidate + regression: **16 / 0 / 0 / 0**. Recorded `initial=true unbounded_active=true wanted_after_timeout=true waiters=1`; final count is zero after completion. The worker sends its actual `wanted_here()` callback, then stays behind a channel gate. The test observes active demand before making the second wait expire on a1ms frame budget. It records that the first waiter is still blocked, then opens the gate, joins it, and removes the pending entry **before assertions**, including on baseline failure. It checks the scheduler's callback as well as the counter. Existing lazy-bind, default-frame-budget, orphan-release, prewarm, bounded-wait and worker-demand tests all pass with the candidate. Both314-file manifests matched before/after and the local snapshots; XCL recompiled both. No source commit/push or competing PR. **Not tested** — full workspace, real GPU compile admission, retail world loading/watchdogs, actual commit-memory or performance effects, and other platforms. This fixes the false demand state; it does not establish that the earlier retail symptoms are resolved. Existing full-suite/retail requirements remain separate. **AI use** — Codex (GPT-6) identified the uncounted path, wrote the one-line candidate and controlled regression, ran/verified the native comparison, and prepared this update. <details><summary>Candidate and regression</summary> ```diff diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs index 58147a9..c3b3b11 100644 --- a/crates/xcl/src/hle/d3d12x/pso_async.rs +++ b/crates/xcl/src/hle/d3d12x/pso_async.rs @@ -866,6 +866,38 @@ mod used_tests { gate.1.notify_all(); } + #[test] + fn a_timed_out_waiter_does_not_cancel_an_unbounded_waiters_demand() { + let standin = 0x7E57_B522usize; + let (started, building) = mpsc::channel(); + let (go, finish) = mpsc::channel::<()>(); + submit_lazy(standin, false, Box::new(move || { + started.send(wanted_here()).unwrap(); + let _ = finish.recv_timeout(Duration::from_secs(10)); + 0 + }), 0); + let bind = std::thread::spawn(move || resolve_wait_with_budgets(standin, None, None, &FrameWaitBudget::new())); + let wanted = building.recv_timeout(Duration::from_secs(10)).expect("worker started"); + let start = Instant::now(); + while !wanted() && start.elapsed() < Duration::from_secs(5) { std::thread::yield_now(); } + let initial = wanted(); + let timed = resolve_wait_with_budgets(standin, None, Some(Duration::from_millis(1)), &FrameWaitBudget::new()); + let pending = entry(standin).unwrap(); + let still_waiting = !bind.is_finished(); + let wanted_after_timeout = wanted(); + let waiters = pending.demand.lock().unwrap().waiters; + // Release the worker and join the waiter before asserting, including on the negative control. + let _ = go.send(()); + let resolved = bind.join().unwrap(); + let _ = released(standin); + println!("MIXED_WAIT initial={initial} unbounded_active={still_waiting} wanted_after_timeout={wanted_after_timeout} waiters={waiters}"); + assert!(initial && still_waiting, "unbounded waiter must be active during the timeout"); + assert_eq!((timed, resolved), (standin, standin)); + assert!(wanted_after_timeout, "an unbounded waiter still needs the compile"); + assert_eq!(waiters, 1); + assert_eq!(pending.demand.lock().unwrap().waiters, 0); + } + #[test] fn default_frame_budget_only_defers_graphics_and_never_leaves_skipped_psos_wanted() { let cap = Duration::from_millis(500); @@ -1156,7 +1188,7 @@ fn resolve_wait_with_budgets( } else { enqueue(&p, true); } - p.want(); + let _want_guard = p.begin_wait(); let mut done = p.done.lock().unwrap(); while !*done { done = p.cv.wait(done).unwrap(); ``` </details> --- Confirmed [@⁠gsucristo's blocking finding 2](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2001) on `7244baadcf009af2a79e94c9fd9c6e7b41d89ab9`, with a small cancellation fix and deterministic reproducer. The worker's orphan branch skips the job without calling `complete`, leaving an existing `resolve_wait_for(..., None)` waiter blocked on `Pending::done`. The candidate marks cancellation done and notifies waiters **in `released()`, under the existing `done` mutex**, after setting `orphan`. It does not depend on either worker queue progressing. An already-running build still reaches `complete`, sees `orphan`, and releases its result instead of publishing it. No failed-build counter is incremented just for cancellation. The regression holds the worker queue while the waiter captures the pending entry, releases that entry, then opens the queue. It checks the waiter returns the existing stand-in fallback and the compiler closure never runs. On old code, a bounded test timeout captures the failure and the fixture explicitly wakes/joins the thread before failing; it does not leave a hung test process. A synthetic COM release counter separately verifies that `complete` still releases a late result exactly once and does not publish it. **Tested** — native Windows 10 19045, Ryzen 7 7800X3D, Rust 1.98.1 MSVC, debug. Thread scheduling / fake object tests; no GPU dispatch or real driver compilation. ```text XCL_DXC_THREADS=2 XCL_PSO_TITLE_BUILD=0 cargo test --locked -p xcl --lib -- pso_async --test-threads=1 --show-output ``` - Exact head + regression: **12 passed / 1 failed / 0 ignored**, failure `released job was skipped but its waiter never completed` (`Err(Timeout)`). - Same head + regression + cancellation change: **13 passed / 0 failed / 0 ignored**. - Zero skips. Both builds recompiled XCL; all 312 source hashes matched before/after. This patch is independent of the earlier passive-bind lookup patch. It is offered here for the author's integration, with credit for the finding above; #978 already covers not executing released jobs, and is not duplicated. **Not tested** — full workspace suite, the two fixes combined, actual title object-lifetime races, real COM/driver builds, dedicated preload-cancellation ordering, retail smoke or whether this stall occurs during world loading. A returned stand-in is the existing resolver fallback; the test does not establish that using an object after another thread releases it is valid. Required main/head retail smoke remains outstanding. **AI use** — Codex (GPT-6) implemented the candidate and regression, ran the native tests, reviewed the cancellation/late-completion ordering and prepared this report. <details><summary>Candidate and regression: one file, 50 additions / 2 deletions</summary> ```diff diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs index a21bb90..c719e9c 100644 --- a/crates/xcl/src/hle/d3d12x/pso_async.rs +++ b/crates/xcl/src/hle/d3d12x/pso_async.rs @@ -485,6 +485,51 @@ mod used_tests { use super::*; use std::sync::mpsc; + #[test] + fn releasing_a_queued_pipeline_wakes_its_unbounded_waiter() { + let standin = 0x7E57_B620usize; + let ran = Arc::new(AtomicBool::new(false)); + let job_ran = ran.clone(); + submit_lazy(standin, true, Box::new(move || { + job_ran.store(true, Ordering::Release); + 0 + }), 0x5EED_B620); + let p = entry(standin).unwrap(); + // Hold dequeue/enqueue until resolve has retained this Pending. The nonzero + // key makes note_use publish that observation before it reaches the queue. + let queue = workers().q.lock().unwrap(); + let (tx, rx) = mpsc::channel(); + let waiter = std::thread::spawn(move || { tx.send(resolve_wait_for(standin, None)).unwrap(); }); + let limit = std::time::Instant::now() + Duration::from_secs(5); + while !p.used.load(Ordering::Acquire) && std::time::Instant::now() < limit { + std::thread::yield_now(); + } + let retained = p.used.load(Ordering::Acquire); + assert_eq!(released(standin), 0); + drop(queue); + let result = rx.recv_timeout(Duration::from_secs(1)); + // Clean up even on the old code: never leave a hung thread behind a failing test. + *p.done.lock().unwrap() = true; + p.cv.notify_all(); + waiter.join().unwrap(); + assert!(retained, "waiter did not retain the pending pipeline"); + assert_eq!(result, Ok(standin), "released job was skipped but its waiter never completed"); + assert!(!ran.load(Ordering::Acquire), "released pipeline reached its compiler"); + + // Cancellation must still release a real result from a build already in flight. + static RELEASES: AtomicUsize = AtomicUsize::new(0); + unsafe extern "system" fn count_release(_: *mut std::ffi::c_void) -> u32 { + RELEASES.fetch_add(1, Ordering::SeqCst); + 0 + } + RELEASES.store(0, Ordering::SeqCst); + let vtable = [0usize, 0, count_release as usize]; + let object = [vtable.as_ptr() as usize]; + complete(&p, object.as_ptr() as usize); + assert_eq!(RELEASES.load(Ordering::SeqCst), 1); + assert_eq!(p.real.load(Ordering::Acquire), 0); + } + /// While a bind waits for a pipeline still being built, the title is held (`title_held`): /// `kernelx::Sleep` does not count that time. #[test] @@ -1095,12 +1140,15 @@ pub fn resolve_for_bind(pso: usize) -> usize { /// the worker's result is then released when it arrives). pub fn released(pso: usize) -> usize { let Some(p) = PENDING.lock().unwrap().as_mut().and_then(|m| m.remove(&pso)) else { return 0 }; - let done = p.done.lock().unwrap(); + let mut done = p.done.lock().unwrap(); if *done { p.real.swap(0, Ordering::AcqRel) } else { - // the worker stores its result into a Pending nobody will read: mark it orphaned + // An in-flight result is still released by complete. A skipped queued job + // never calls complete, so cancellation must also wake existing waiters. p.orphan.store(true, Ordering::Release); + *done = true; + p.cv.notify_all(); 0 } } ``` </details> </details>
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 03:42 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 03:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7152172307) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠PracticalStudios on GitHub · 2026-11-25 03:43 UTC · original

Test report for 1f1d681 in the retail title, RTX 3090 (Ampere, 32-lane waves): the world-load stop is unchanged, because the title waits in a compute bind.

  • RTX 3090 24 GB (driver 621.24), Ryzen 7 9800X3D, Windows 11 26200, release. main cbc296a + #684, with and without this PR (local merge), 300 s, XCL_PRESS_A_AT through the menus, DXIL and most driver blobs already cached, XCL_THREAD_DUMP_AT=100,140.
  • Without: last frame at 84 s, 1 566 shown. With: last frame at 82 s, 1 691 shown. No device removal in either.
  • With this PR, at 100 s and 140 s two title threads are in resolve_wait_with_budgets, from bind::dispatch and bind::execute_indirect. The pipeline they wait for is still building on a preload worker: record 56c0cd3b82a00c6e (22 089 020 B DXIL, no driver blob), started at 9.5 s, not finished at 300 s (the case of #1035).
  • Since the default frame wait cap is graphics-only (1f1d681), compute binds still wait without a limit, so this stop isn't covered.
  • Not tested: AMD; a cap for compute binds.

AI use: Claude Code (Claude Opus 5.5) ran the runs, read the symbolized dumps and wrote this report.

**@⁠PracticalStudios** on GitHub · 2026-11-25 03:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7152181630) Test report for `1f1d681` in the retail title, RTX 3090 (Ampere, 32-lane waves): the world-load stop is unchanged, because the title waits in a **compute** bind. - RTX 3090 24 GB (driver 621.24), Ryzen 7 9800X3D, Windows 11 26200, release. `main` `cbc296a` + #684, with and without this PR (local merge), 300 s, `XCL_PRESS_A_AT` through the menus, DXIL and most driver blobs already cached, `XCL_THREAD_DUMP_AT=100,140`. - Without: last frame at 84 s, 1 566 shown. With: last frame at 82 s, 1 691 shown. No device removal in either. - With this PR, at 100 s and 140 s two title threads are in `resolve_wait_with_budgets`, from `bind::dispatch` and `bind::execute_indirect`. The pipeline they wait for is still building on a preload worker: record `56c0cd3b82a00c6e` (22 089 020 B DXIL, no driver blob), started at 9.5 s, not finished at 300 s (the case of #1035). - Since the default frame wait cap is graphics-only (`1f1d681`), compute binds still wait without a limit, so this stop isn't covered. - Not tested: AMD; a cap for compute binds. AI use: Claude Code (Claude Opus 5.5) ran the runs, read the symbolized dumps and wrote this report.
Author
Owner

@⁠Toons29 on GitHub · 2026-11-25 03:43 UTC · original

Regression run of 1f1d6814 on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on cbc296ab, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: cbc296ab65a2661a61e3e2da109134bcd5319f60
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1623 (PresentX 1623)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14648 MB
xcl-smoke v1
commit: 1f1d681439db77ea01a656dc8fc65aa4eabc7d1b
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1633 (PresentX 1633)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14808 MB

Against the limits in CONTRIBUTING.md: 101 % of main's frames, 101 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; a script posted this right after the run, with both blocks exactly as printed.

**@⁠Toons29** on GitHub · 2026-11-25 03:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7152189853) Regression run of `1f1d6814` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `cbc296ab`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: cbc296ab65a2661a61e3e2da109134bcd5319f60 gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1623 (PresentX 1623) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14648 MB ``` ``` xcl-smoke v1 commit: 1f1d681439db77ea01a656dc8fc65aa4eabc7d1b gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1633 (PresentX 1633) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14808 MB ``` Against the limits in CONTRIBUTING.md: 101 % of `main`'s frames, 101 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; a script posted this right after the run, with both blocks exactly as printed.
Author
Owner

@⁠throny on GitHub · 2026-11-25 04:59 UTC · original

Retest at 1f1d681, merged onto main cbc296a, with the same setup as my earlier report: RTX 4080, XCL_DIRECT_DXIL=1, otherwise this PR's defaults, warm XCL DXIL cache, two 15-minute runs in a row, no input after the menus.

run last presents skipped draws / dispatches per-frame budget exhausted driver builds after 90 s process commit end
1 84 s 128 / 0 12 times 82 25 GB at 74 s, then rising slowly to 37 GB stopped by my memory guard at 783 s
2 78 s 0 / 0 0 8 25 GB at 68 s, then rising slowly to 36 GB stopped by my memory guard at 601 s

Compared with 7244baa:

  • Fixed: compute dispatches are no longer skipped (0 against 4 096 – 20 692), and there were no queue waits that did not complete (0 against 32 – 144). No watchdog stop in either run.
  • Not better: presents now stop at 78 – 84 s. The cold-library run of 7244baa presented until 170 s, while skipping far more. The process commit no longer jumps, but it climbs steadily for 10 minutes after the presents stop, until my guard stops it at about 37 GB.
  • For comparison: main 177cd40 with the same warm caches stopped presenting at 94 s and stayed at 31 GB.

So on this card the title still stops at about the same point as main, now without the watchdog. What keeps commit growing after the presents stop would be the next thing to look at. I can rerun with a setting you name (XCL_PSO_LIBRARY=0, XCL_PSO_FRAME_WAIT_MS=…) on the same caches.

Not tested: the suite on this head, AMD, a main run at cbc296a.

AI use: Claude Code (Claude Opus 5.5): ran the tests and wrote this.

**@⁠throny** on GitHub · 2026-11-25 04:59 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7153353089) Retest at `1f1d681`, merged onto `main` `cbc296a`, with the same setup as [my earlier report](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2001): RTX 4080, `XCL_DIRECT_DXIL=1`, otherwise this PR's defaults, warm XCL DXIL cache, two 15-minute runs in a row, no input after the menus. | run | last presents | skipped draws / dispatches | per-frame budget exhausted | driver builds after 90 s | process commit | end | |---|---|---|---|---|---|---| | 1 | 84 s | 128 / 0 | 12 times | 82 | 25 GB at 74 s, then rising slowly to 37 GB | stopped by my memory guard at 783 s | | 2 | 78 s | 0 / 0 | 0 | 8 | 25 GB at 68 s, then rising slowly to 36 GB | stopped by my memory guard at 601 s | Compared with `7244baa`: - **Fixed:** compute dispatches are no longer skipped (0 against 4 096 – 20 692), and there were no queue waits that did not complete (0 against 32 – 144). No watchdog stop in either run. - **Not better:** presents now stop at 78 – 84 s. The cold-library run of `7244baa` presented until 170 s, while skipping far more. The process commit no longer jumps, but it climbs steadily for 10 minutes after the presents stop, until my guard stops it at about 37 GB. - **For comparison:** `main` `177cd40` with the same warm caches stopped presenting at 94 s and stayed at 31 GB. So on this card the title still stops at about the same point as `main`, now without the watchdog. What keeps commit growing after the presents stop would be the next thing to look at. I can rerun with a setting you name (`XCL_PSO_LIBRARY=0`, `XCL_PSO_FRAME_WAIT_MS=…`) on the same caches. **Not tested:** the suite on this head, AMD, a `main` run at `cbc296a`. AI use: Claude Code (Claude Opus 5.5): ran the tests and wrote this.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 10:47 UTC · original

Thanks for all the catches and test details, @Royalflamejlh, @WebIdentity1, @akimfomin, and @throny!

Updated #2001 cleanly onto 6b3f1f1 (69795220):

  • Wine / vkd3d-proton empty .plib fix (pso_library.rs, @Royalflamejlh): pass explicit (std::ptr::null(), 0) via ID3D12Device1_Vtbl::CreatePipelineLibrary instead of &[] so fresh empty library creation succeeds without E_INVALIDARG.
  • Priority restore & unbounded-waiter demand (pso_async.rs, @WebIdentity1):
    • Unconditionally restore worker base_priority in build() under demand lock so abandoned waits never leak THREAD_PRIORITY_NORMAL (an_abandoned_wait_restores_worker_priority_before_its_next_job).
    • Hold let _want_guard = p.begin_wait(); on the unbounded wait path in resolve_wait_with_budgets so a concurrent bounded timeout cannot clear wanted while an unbounded waiter is blocked (a_timed_out_waiter_does_not_cancel_an_unbounded_waiters_demand).
  • Duplicate-key blob budget (real.rs, @akimfomin): check Entry::Vacant under the map lock in insert_cached_blob for both COMPUTE_BLOBS and GRAPHICS_BLOBS so racing duplicate publishes charge the byte budget once and free cleanly to zero (duplicate_blob_publishes_charge_budget_once_and_free_cleanly).

Verified locally (29/29 unit tests passed: pso_async:: 17/17, pso_library:: 3/3, pso_lib::tests 2/2, compute_blob_tests 2/2, graphics_blob_tests 5/5).

**@⁠raylitebull** on GitHub · 2026-11-25 10:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7160171155) Thanks for all the catches and test details, `@Royalflamejlh`, `@WebIdentity1`, `@akimfomin`, and `@throny`! Updated `#2001` cleanly onto `6b3f1f1` (`69795220`): - **Wine / vkd3d-proton empty `.plib` fix (`pso_library.rs`, `@Royalflamejlh`):** pass explicit `(std::ptr::null(), 0)` via `ID3D12Device1_Vtbl::CreatePipelineLibrary` instead of `&[]` so fresh empty library creation succeeds without `E_INVALIDARG`. - **Priority restore & unbounded-waiter demand (`pso_async.rs`, `@WebIdentity1`):** - Unconditionally restore worker `base_priority` in `build()` under `demand` lock so abandoned waits never leak `THREAD_PRIORITY_NORMAL` (`an_abandoned_wait_restores_worker_priority_before_its_next_job`). - Hold `let _want_guard = p.begin_wait();` on the unbounded wait path in `resolve_wait_with_budgets` so a concurrent bounded timeout cannot clear `wanted` while an unbounded waiter is blocked (`a_timed_out_waiter_does_not_cancel_an_unbounded_waiters_demand`). - **Duplicate-key blob budget (`real.rs`, `@akimfomin`):** check `Entry::Vacant` under the map lock in `insert_cached_blob` for both `COMPUTE_BLOBS` and `GRAPHICS_BLOBS` so racing duplicate publishes charge the byte budget once and free cleanly to zero (`duplicate_blob_publishes_charge_budget_once_and_free_cleanly`). Verified locally (`29/29` unit tests passed: `pso_async::` `17/17`, `pso_library::` `3/3`, `pso_lib::tests` `2/2`, `compute_blob_tests` `2/2`, `graphics_blob_tests` `5/5`).
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 11:01 UTC · original

Rebased #2001 cleanly onto f087b998 (814d31a8), integrating #2176 (5f4d32fb) and #2178 (93c3eb7e) in pso_async.rs:

  • Kept Pending::spared, image_skip(), image_only(), and resolve_spared (routed through enqueue(p, false) on the urgent/normal worker pool and checked inside resolve_wait_with_budgets), plus #2178's orphan job drain (p.job.lock().unwrap().take()) and all three @Royalflamejlh / @WebIdentity1 / @akimfomin fixes.
  • Verified locally (31/31 unit tests passed: pso_async:: 19/19, pso_library:: 3/3, pso_lib::tests 2/2, compute_blob_tests 2/2, graphics_blob_tests 5/5) and pushed 814d31a8.
**@⁠raylitebull** on GitHub · 2026-11-25 11:01 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7160481788) Rebased `#2001` cleanly onto `f087b998` (`814d31a8`), integrating `#2176` (`5f4d32fb`) and `#2178` (`93c3eb7e`) in `pso_async.rs`: - Kept `Pending::spared`, `image_skip()`, `image_only()`, and `resolve_spared` (routed through `enqueue(p, false)` on the urgent/normal worker pool and checked inside `resolve_wait_with_budgets`), plus `#2178`'s orphan job drain (`p.job.lock().unwrap().take()`) and all three `@Royalflamejlh` / `@WebIdentity1` / `@akimfomin` fixes. - Verified locally (`31/31` unit tests passed: `pso_async::` `19/19`, `pso_library::` `3/3`, `pso_lib::tests` `2/2`, `compute_blob_tests` `2/2`, `graphics_blob_tests` `5/5`) and pushed `814d31a8`.
Author
Owner

@⁠throny on GitHub · 2026-11-25 10:58 UTC · original · edited 2026-11-25 11:12 UTC

Test report for exact head 814d31a (updated from 6979522).

Tested

  • Windows 11 Pro 10.0.26300, NVIDIA GeForce RTX 4080 (driver 610.88, 32-lane waves), Intel i9-12900K, 64 GB; Rust 1.100.0 MSVC; DXC 1.9.2602.17; tests in debug, title runs in release.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 814d31a as it is: 1235 passed, 2 failed, 46 ignored; SKIPPED: 25 lines (no wave64 on this adapter, and the like).
    • Neither failure is from this PR: both fail the same way on main 9633138 (and in main's CI):
      • device_x::tests::pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa: #2233 fixes it.
      • pso::shader_cache_tests::rerouted_disk_entries_follow_the_direct_translator
  • scripts/smoke.ps1, the retail title, 60 s, release builds, main 9633138 first, then this head. Both runs started without the preload list newer builds leave behind (used-pipelines.txt in the DXIL cache):

main:

xcl-smoke v1
commit: 963313835813f475037b3a9f5fcc3cb591696928
gpu: NVIDIA GeForce RTX 4080
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1561 (PresentX 1561)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14478 MB

PR:

xcl-smoke v1
commit: 814d31a88a8c9b29427a5b80f0f29770d940d7c7
gpu: NVIDIA GeForce RTX 4080
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1603 (PresentX 1603)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 14477 MB

Not tested: AMD, the head merged onto current main, a world load.

AI use: Claude Code (Claude Opus 5.5) ran this and wrote the report; the diff was read for safety before it was built.

**@⁠throny** on GitHub · 2026-11-25 10:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7160410900) · edited 2026-11-25 11:12 UTC Test report for exact head `814d31a` (updated from `6979522`). **Tested** - Windows 11 Pro 10.0.26300, NVIDIA GeForce RTX 4080 (driver 610.88, 32-lane waves), Intel i9-12900K, 64 GB; Rust 1.100.0 MSVC; DXC 1.9.2602.17; tests in debug, title runs in release. - `cargo test --workspace --no-fail-fast -- --test-threads=4` on `814d31a` as it is: **1235 passed, 2 failed, 46 ignored**; `SKIPPED`: 25 lines (no wave64 on this adapter, and the like). - Neither failure is from this PR: both fail the same way on `main` `9633138` (and in `main`'s CI): - `device_x::tests::pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa`: #2233 fixes it. - `pso::shader_cache_tests::rerouted_disk_entries_follow_the_direct_translator` - `scripts/smoke.ps1`, the retail title, 60 s, release builds, `main` `9633138` first, then this head. Both runs started without the preload list newer builds leave behind (`used-pipelines.txt` in the DXIL cache): main: ``` xcl-smoke v1 commit: 963313835813f475037b3a9f5fcc3cb591696928 gpu: NVIDIA GeForce RTX 4080 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1561 (PresentX 1561) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14478 MB ``` PR: ``` xcl-smoke v1 commit: 814d31a88a8c9b29427a5b80f0f29770d940d7c7 gpu: NVIDIA GeForce RTX 4080 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1603 (PresentX 1603) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 14477 MB ``` **Not tested:** AMD, the head merged onto current `main`, a world load. AI use: Claude Code (Claude Opus 5.5) ran this and wrote the report; the diff was read for safety before it was built.
Author
Owner

@⁠Royalflamejlh on GitHub · 2026-11-25 12:56 UTC · original

@⁠raylitebull 814d31a fixes the empty library under vkd3d-proton. On Linux (Wine + vkd3d-proton) + NVIDIA, a run with no library on disk saved 6 generations. The run after it opened the last one at 4.9 s and loaded pipelines from it: it built 57 compute pipelines where the first run built 243.

Setup: Fedora 44, main f087b99 + #684 e56dbc3 + #2001 814d31a (local merge 93269d8), RTX 4070 12 GB (driver 615.71.09), Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch, release build, Series X profile, XCL_PSO_PRELOAD=0, WINEDEBUG=err+all,fixme-all. The first-run screens were completed once and there was no story progress; A was pressed when the title presented steadily (16.4 and 16.2 s). 1 run each of 100 s, in this order; the pso-library folder was moved aside before run 1.

run 1 (no library on disk) run 2
opened – gen-00000006 at 4.9 s
saved gen-00000001 to gen-00000006 (10, 2, 2, 5, 2 and 307 new pipelines) gen-00000007 (80 new)
compute pipelines built (one log line each) 243 57, all from 82.4 s
first library hit 76.0 s, a pipeline stored earlier in the run 4.9 s
last 2 s with a present 76.8 s 82.4 s

On 1f1d681 a run with no library on disk saved nothing (my earlier comment).

Not tested: whether loading from the library saves time or changes where the title stops (1 run each); the offloaded builds and the deferred compile; the suite at this head; Windows; AMD and Intel.

AI use: Claude Code (Claude Opus 5.5) ran the title and wrote this comment.

Posted without review by a person: the account owner was away and reads replies later.

**@⁠Royalflamejlh** on GitHub · 2026-11-25 12:56 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7163057252) @⁠raylitebull `814d31a` fixes the empty library under vkd3d-proton. On Linux (Wine + vkd3d-proton) + NVIDIA, a run with no library on disk saved 6 generations. The run after it opened the last one at 4.9 s and loaded pipelines from it: it built 57 compute pipelines where the first run built 243. **Setup:** Fedora 44, `main` `f087b99` + #684 `e56dbc3` + #2001 `814d31a` (local merge `93269d8`), RTX 4070 12 GB (driver 615.71.09), Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch, release build, Series X profile, `XCL_PSO_PRELOAD=0`, `WINEDEBUG=err+all,fixme-all`. The first-run screens were completed once and there was no story progress; A was pressed when the title presented steadily (16.4 and 16.2 s). 1 run each of 100 s, in this order; the `pso-library` folder was moved aside before run 1. | | run 1 (no library on disk) | run 2 | |---|---|---| | opened | – | `gen-00000006` at 4.9 s | | saved | `gen-00000001` to `gen-00000006` (10, 2, 2, 5, 2 and 307 new pipelines) | `gen-00000007` (80 new) | | compute pipelines built (one log line each) | 243 | 57, all from 82.4 s | | first library hit | 76.0 s, a pipeline stored earlier in the run | 4.9 s | | last 2 s with a present | 76.8 s | 82.4 s | On `1f1d681` a run with no library on disk saved nothing (my earlier comment). **Not tested:** whether loading from the library saves time or changes where the title stops (1 run each); the offloaded builds and the deferred compile; the suite at this head; Windows; AMD and Intel. **AI use:** Claude Code (Claude Opus 5.5) ran the title and wrote this comment. Posted without review by a person: the account owner was away and reads replies later.
Author
Owner

@⁠jeremymeseeks on GitHub · 2026-11-25 15:29 UTC · original

Retail title world load on native Windows, RTX 5070 Ti: 814d31a + #684 vs its base f087b998 + #684

Setup: Windows 10 22H2, Ryzen 7 9800X3D, 32 GB RAM, RTX 5070 Ti 16 GB, NVIDIA driver 621.01. Release build (cargo build --release -p xcl). #684 e56dbc3 merged into both sides, the same base Royalflamejlh used (local merges: base 08038f06, PR c976de10). XCL defaults; the only env vars were the ones scripts/smoke.ps1 sets (XCL_NETWORK=0, XCL_ACTIVITY=1). .\scripts\smoke.ps1 -Seconds 300, with A pressed by hand promptly at the title screen in both runs. Base ran first, then the PR. No pipeline library on disk before the PR run.

base f087b998 + #684 PR 814d31a + #684
exit 0x0 0x0
crashes / device removals 0 / 0 0 / 0
peak commit 32627 MB 33235 MB
frames 1295 1269
last 2 s window with presents ends at 62.3 s 60.0 s
watchdog / AV line in xcl.log none none
driver compile starts 70 93
gated compile finishes: count, summed wait, longest wait 12, 81 s, 42.7 s 26, 546 s, 197.2 s

Result:

  • No crash or device removal on either side. In both runs the title stops presenting at about 60 s and stays at 0 presents until the 300 s limit, without reaching the watchdog. That matches the RTX 3090 and RTX 4070 results above: on this card too, this PR doesn't change where the title stops.
  • The library works on Windows at 814d31a from an empty start. The PR run saved gen-00000001 to gen-00000007 (273, 2, 6, 330, 12, 1 and 1 new pipelines; 113 MiB), with 1 memory-mapped library hit at 58.2 s.
  • Longer build waits in the PR run. Its longest gated wait was 197.2 s: #639, a 421012 B compute PSO that finished at 209 s. Gated compile finishes summed to 546 s, against 81 s on the base. I haven't checked whether the "gated (waited …)" log line means the same thing in both builds, so this is a raw log count, not a conclusion.

Not tested: a second PR run that loads the saved library; repeat runs (one run each); XCL_PSO_PRELOAD=0; current main (the PR conflicts with main); AMD and Intel. The A press was manual, so its timing varies by a few seconds between runs.

AI use: Claude (Opus 5.5, claude.ai) planned the runs and wrote this comment from my run outputs (smoke manifests, report.json, xcl.log). I ran everything and checked the numbers.

**@⁠jeremymeseeks** on GitHub · 2026-11-25 15:29 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7166929280) **Retail title world load on native Windows, RTX 5070 Ti: `814d31a` + #684 vs its base `f087b998` + #684** **Setup:** Windows 10 22H2, Ryzen 7 9800X3D, 32 GB RAM, RTX 5070 Ti 16 GB, NVIDIA driver 621.01. Release build (`cargo build --release -p xcl`). #684 `e56dbc3` merged into both sides, the same base Royalflamejlh used (local merges: base `08038f06`, PR `c976de10`). XCL defaults; the only env vars were the ones `scripts/smoke.ps1` sets (`XCL_NETWORK=0`, `XCL_ACTIVITY=1`). `.\scripts\smoke.ps1 -Seconds 300`, with A pressed by hand promptly at the title screen in both runs. Base ran first, then the PR. No pipeline library on disk before the PR run. | | base `f087b998` + #684 | PR `814d31a` + #684 | |---|---|---| | exit | 0x0 | 0x0 | | crashes / device removals | 0 / 0 | 0 / 0 | | peak commit | 32627 MB | 33235 MB | | frames | 1295 | 1269 | | last 2 s window with presents ends at | 62.3 s | 60.0 s | | watchdog / AV line in xcl.log | none | none | | driver compile starts | 70 | 93 | | gated compile finishes: count, summed wait, longest wait | 12, 81 s, 42.7 s | 26, 546 s, 197.2 s | **Result:** - **No crash or device removal on either side.** In both runs the title stops presenting at about 60 s and stays at 0 presents until the 300 s limit, without reaching the watchdog. That matches the RTX 3090 and RTX 4070 results above: on this card too, this PR doesn't change where the title stops. - **The library works on Windows at `814d31a` from an empty start.** The PR run saved `gen-00000001` to `gen-00000007` (273, 2, 6, 330, 12, 1 and 1 new pipelines; 113 MiB), with 1 memory-mapped library hit at 58.2 s. - **Longer build waits in the PR run.** Its longest gated wait was 197.2 s: `#639`, a 421012 B compute PSO that finished at 209 s. Gated compile finishes summed to 546 s, against 81 s on the base. I haven't checked whether the "gated (waited …)" log line means the same thing in both builds, so this is a raw log count, not a conclusion. **Not tested:** a second PR run that loads the saved library; repeat runs (one run each); `XCL_PSO_PRELOAD=0`; current main (the PR conflicts with main); AMD and Intel. The A press was manual, so its timing varies by a few seconds between runs. **AI use:** Claude (Opus 5.5, claude.ai) planned the runs and wrote this comment from my run outputs (smoke manifests, report.json, xcl.log). I ran everything and checked the numbers.
Author
Owner

@⁠jeremymeseeks on GitHub · 2026-11-25 16:34 UTC · original

Follow-up: second PR run that loads the saved library (the "not tested" item above), RTX 5070 Ti, Windows

Correction to my comment above: the first PR run saved 20 library generations (gen-00000001 to gen-00000014, last file 130 MiB), not 7 / 113 MiB. My summary had cut the list off. The other numbers there are unchanged.

Setup: same machine, driver 621.01 and builds as above (base 08038f06 = f087b998 + #684, PR c976de10 = 814d31a + #684), release, .\scripts\smoke.ps1 -Seconds 300. This time A was scripted for both sides with XCL_PRESS_AT=20:A,25:A,30:A,35:A,40:A. Order: base, PR, base, PR. The library from the first PR run was left on disk; the second PR run also had what the first one added.

run build library at start last 2 s window with presents ends at frames peak commit driver compile starts gated finishes: count, summed wait, longest
A3 base – 70.0 s 1505 32279 MB 153 6, 215 s, 97.4 s
B2a PR gen-00000014 (130 MiB), opened at 2.2 s 66.0 s 1493 33510 MB 70 11, 293 s, 129.8 s
A4 base – 70.0 s 1529 33444 MB 168 6, 286 s, 117.5 s
B2b PR gen-0000001d (220 MiB), opened at 2.3 s 70.0 s 1537 33098 MB 14 5, 239 s, 193.4 s

All four: exit 0x0, 0 crashes, 0 device removals, no watchdog or AV line in 300 s.

Result:

  • The library loads and removes most driver compiles: 153 and 168 on the base, 70 with the first library and 14 with the second.
  • The stop point does not move. All four runs stop presenting at 66–70 s. Same-build variance with scripted input was about 8 s in my other runs today, so this is no difference.
  • B2b still had a 193 s gated wait with only 14 compiles. My guess, not checked: the title is blocked on a few pipelines that no run finishes before the 300 s limit, so they never reach the library. That would fit the RTX 3090 note above about compute binds waiting on a preload build that never finishes.
  • The last "memory-mapped pipeline library hits" line in each PR run says 500 (at 66.1 s and 68.2 s). I don't know whether that line is a running total or a milestone, so I am not giving a hit total.

Not tested: which pipelines the remaining 14 compiles are and whether they ever finish; a cold driver cache; XCL_PSO_PRELOAD=0; current main; AMD and Intel; more than one run pair per side.

AI use: Claude (Opus 5.5, claude.ai) planned the runs and wrote this comment from my run outputs (smoke manifests, xcl.log). I ran everything and checked the numbers.

**@⁠jeremymeseeks** on GitHub · 2026-11-25 16:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7168184480) **Follow-up: second PR run that loads the saved library (the "not tested" item above), RTX 5070 Ti, Windows** **Correction to my comment above:** the first PR run saved 20 library generations (`gen-00000001` to `gen-00000014`, last file 130 MiB), not 7 / 113 MiB. My summary had cut the list off. The other numbers there are unchanged. **Setup:** same machine, driver 621.01 and builds as above (base `08038f06` = `f087b998` + #684, PR `c976de10` = `814d31a` + #684), release, `.\scripts\smoke.ps1 -Seconds 300`. This time A was scripted for both sides with `XCL_PRESS_AT=20:A,25:A,30:A,35:A,40:A`. Order: base, PR, base, PR. The library from the first PR run was left on disk; the second PR run also had what the first one added. | run | build | library at start | last 2 s window with presents ends at | frames | peak commit | driver compile starts | gated finishes: count, summed wait, longest | |---|---|---|---|---|---|---|---| | A3 | base | – | 70.0 s | 1505 | 32279 MB | 153 | 6, 215 s, 97.4 s | | B2a | PR | `gen-00000014` (130 MiB), opened at 2.2 s | 66.0 s | 1493 | 33510 MB | 70 | 11, 293 s, 129.8 s | | A4 | base | – | 70.0 s | 1529 | 33444 MB | 168 | 6, 286 s, 117.5 s | | B2b | PR | `gen-0000001d` (220 MiB), opened at 2.3 s | 70.0 s | 1537 | 33098 MB | 14 | 5, 239 s, 193.4 s | All four: exit `0x0`, 0 crashes, 0 device removals, no watchdog or AV line in 300 s. **Result:** - **The library loads and removes most driver compiles:** 153 and 168 on the base, 70 with the first library and 14 with the second. - **The stop point does not move.** All four runs stop presenting at 66–70 s. Same-build variance with scripted input was about 8 s in my other runs today, so this is no difference. - **B2b still had a 193 s gated wait with only 14 compiles.** My guess, not checked: the title is blocked on a few pipelines that no run finishes before the 300 s limit, so they never reach the library. That would fit the RTX 3090 note above about compute binds waiting on a preload build that never finishes. - The last "memory-mapped pipeline library hits" line in each PR run says 500 (at 66.1 s and 68.2 s). I don't know whether that line is a running total or a milestone, so I am not giving a hit total. **Not tested:** which pipelines the remaining 14 compiles are and whether they ever finish; a cold driver cache; `XCL_PSO_PRELOAD=0`; current main; AMD and Intel; more than one run pair per side. **AI use:** Claude (Opus 5.5, claude.ai) planned the runs and wrote this comment from my run outputs (smoke manifests, xcl.log). I ran everything and checked the numbers.
Author
Owner

@⁠jeremymeseeks on GitHub · 2026-11-25 16:52 UTC · original

Addendum: third run with the library (B2c), and which pipelines were still compiled

Same build (c976de10 = 814d31a + #684), same settings and scripted input as B2 above; it opened gen-00000023 (243 MiB) from B2b. Exit 0x0, 0 crashes, 0 device removals, last 2 s window with presents ends at 68.0 s, 7 driver compile starts.

Compute pipelines with no driver blob (record, DXIL size, compile time, time queued before the compile started):

run record DXIL compile queued
B2b fcc06444… 1.17 MB 60.6 s 0
B2b 9e5896b2… 1.27 MB 70.6 s 46.0 s
B2b 84eee477… 1.30 MB 108.8 s 0
B2b 6c358c27… 1.47 MB 92.1 s 193.4 s
B2b c82ff5e4… 1.17 MB 51.4 s 0
B2b fbf10765… 1.02 MB unfinished at 300 s –
B2c fb1c6d2d… 1.47 MB 90.1 s 0
B2c fbf10765… 1.02 MB 38.1 s 0
B2c 2e1d03fb… 1.48 MB 93.6 s 86.3 s
B2c 75862c58… 1.16 MB 90.5 s 0
B2c 001714bf… 0.82 MB 25.1 s 0
B2c af40329f… 1.48 MB unfinished at 300 s –
B2c c0031f40… 1.12 MB unfinished at 300 s –

("queued" is the gated (waited … ms) value on the finish line; I read it as time before the compile started.)

Result:

  • Correction to my guess above: the B2b waits were not on pipelines that never finish. B2b finished 5 of its 6, and in B2c those 5 produced no compile line at all; the unfinished one was requested again and built in 38 s.
  • Each run gets past one batch and hits the next. B2c asked for 5 records that were not among B2b's six: 0.8–1.5 MB compute PSOs taking 25–94 s each on driver 621.01, at most two compiling at once. The stop stayed at 66–70 s in all three library runs.
  • So on this card the library moves the compile frontier forward each run, but the title still stops presenting at 66–70 s. My reading, not checked with a thread dump: it waits on the next compute pipeline that isn't built yet. How many runs it would take to cover world loading, I don't know.

Not tested: more library runs; more huge-compile slots (XCL_HUGE_PSO_WANTED_CONCURRENCY); whether "no compile line" means a library hit or that the title didn't ask for that pipeline in B2c (the hits line showed 500 in B2a and B2b; I don't know whether that is a total or a milestone).

AI use: Claude (Opus 5.5, claude.ai) wrote this from my xcl.log and smoke outputs. I ran everything and checked the numbers.

**@⁠jeremymeseeks** on GitHub · 2026-11-25 16:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7168672481) **Addendum: third run with the library (B2c), and which pipelines were still compiled** Same build (`c976de10` = `814d31a` + #684), same settings and scripted input as B2 above; it opened `gen-00000023` (243 MiB) from B2b. Exit `0x0`, 0 crashes, 0 device removals, last 2 s window with presents ends at **68.0 s**, 7 driver compile starts. Compute pipelines with no driver blob (record, DXIL size, compile time, time queued before the compile started): | run | record | DXIL | compile | queued | |---|---|---|---|---| | B2b | `fcc06444…` | 1.17 MB | 60.6 s | 0 | | B2b | `9e5896b2…` | 1.27 MB | 70.6 s | 46.0 s | | B2b | `84eee477…` | 1.30 MB | 108.8 s | 0 | | B2b | `6c358c27…` | 1.47 MB | 92.1 s | 193.4 s | | B2b | `c82ff5e4…` | 1.17 MB | 51.4 s | 0 | | B2b | `fbf10765…` | 1.02 MB | unfinished at 300 s | – | | B2c | `fb1c6d2d…` | 1.47 MB | 90.1 s | 0 | | B2c | `fbf10765…` | 1.02 MB | 38.1 s | 0 | | B2c | `2e1d03fb…` | 1.48 MB | 93.6 s | 86.3 s | | B2c | `75862c58…` | 1.16 MB | 90.5 s | 0 | | B2c | `001714bf…` | 0.82 MB | 25.1 s | 0 | | B2c | `af40329f…` | 1.48 MB | unfinished at 300 s | – | | B2c | `c0031f40…` | 1.12 MB | unfinished at 300 s | – | ("queued" is the `gated (waited … ms)` value on the finish line; I read it as time before the compile started.) **Result:** - **Correction to my guess above:** the B2b waits were not on pipelines that never finish. B2b finished 5 of its 6, and in B2c those 5 produced no compile line at all; the unfinished one was requested again and built in 38 s. - **Each run gets past one batch and hits the next.** B2c asked for 5 records that were not among B2b's six: 0.8–1.5 MB compute PSOs taking 25–94 s each on driver 621.01, at most two compiling at once. The stop stayed at 66–70 s in all three library runs. - So on this card the library moves the compile frontier forward each run, but the title still stops presenting at 66–70 s. My reading, not checked with a thread dump: it waits on the next compute pipeline that isn't built yet. How many runs it would take to cover world loading, I don't know. **Not tested:** more library runs; more huge-compile slots (`XCL_HUGE_PSO_WANTED_CONCURRENCY`); whether "no compile line" means a library hit or that the title didn't ask for that pipeline in B2c (the hits line showed 500 in B2a and B2b; I don't know whether that is a total or a milestone). **AI use:** Claude (Opus 5.5, claude.ai) wrote this from my xcl.log and smoke outputs. I ran everything and checked the numbers.
Author
Owner

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

Thanks @Royalflamejlh and @jeremymeseeks for confirming Wine .plib creation and the warm RTX 5070 Ti 153 -> 70 -> 14 -> 7 driver compile drop!

Rebased #2001 cleanly onto 728e2548 (008d9c1c):

  • Integrated #2080 (direct-dispatch-split): unified build_pieces into workers() via WorkerItem::Piece (urgent when parent is wanted, avoiding a duplicate thread pool) and wired pso_lib::try_load_compute + store_pipeline inside translated_compute_pso_once (preserving #1592 dred::label on library hits).
  • Integrated 625a0f36 (shared stand-ins): routed all paths (resolve, resolve_for_bind, resolve_if_ready, resolve_within including exhausted-frame-budget early returns, and resolve_spared) through p.stand(pso) so stand-in shell handles never reach the PC driver.
  • Integrated #2296 (drop_unstarted_job + PcCalls clamping): updated released(), workers(), and preload() to wake waiters and drop unstarted orphaned jobs cleanly outside locks.
  • Verified locally (cargo check --workspace --tests + 36/36 unit tests PASS): pso_async:: 24/24, pso_library:: 3/3, pso_lib::tests 2/2, compute_blob_tests 2/2, graphics_blob_tests 5/5.

Pushed 008d9c1c!

**@⁠raylitebull** on GitHub · 2026-11-25 18:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7170841562) Thanks `@Royalflamejlh` and `@jeremymeseeks` for confirming Wine `.plib` creation and the warm RTX 5070 Ti `153 -> 70 -> 14 -> 7` driver compile drop! Rebased `#2001` cleanly onto `728e2548` (`008d9c1c`): - **Integrated `#2080` (`direct-dispatch-split`):** unified `build_pieces` into `workers()` via `WorkerItem::Piece` (urgent when parent is wanted, avoiding a duplicate thread pool) and wired `pso_lib::try_load_compute` + `store_pipeline` inside `translated_compute_pso_once` (preserving `#1592` `dred::label` on library hits). - **Integrated `625a0f36` (shared stand-ins):** routed all paths (`resolve`, `resolve_for_bind`, `resolve_if_ready`, `resolve_within` including exhausted-frame-budget early returns, and `resolve_spared`) through `p.stand(pso)` so stand-in shell handles never reach the PC driver. - **Integrated `#2296` (`drop_unstarted_job` + `PcCalls` clamping):** updated `released()`, `workers()`, and `preload()` to wake waiters and drop unstarted orphaned jobs cleanly outside locks. - **Verified locally (`cargo check --workspace --tests` + `36/36` unit tests PASS):** `pso_async::` `24/24`, `pso_library::` `3/3`, `pso_lib::tests` `2/2`, `compute_blob_tests` `2/2`, `graphics_blob_tests` `5/5`. Pushed `008d9c1c`!
Author
Owner

@⁠jeremymeseeks on GitHub · 2026-11-25 20:19 UTC · original

World load on 008d9c1c (+ #684) vs its base 728e2548 (+ #684), RTX 5070 Ti

Setup: Windows 10 22H2, Ryzen 7 9800X3D, 32 GB, RTX 5070 Ti, NVIDIA 621.01. Retail title, XCL defaults (XCL_DIRECT_DXIL unset). scripts/smoke.ps1 -Seconds 300 -Title retail-worldload with XCL_PRESS_AT=20:A,25:A,30:A,35:A,40:A. Order A-B-A-B. A = 728e2548 + #684 (local 98f8b104), B = 008d9c1c + #684 (local fee6a08e). Library folder emptied before B1; B2 reuses B1's library.

run build last 2 s sample with presents frames peak commit removals / crashes driver compile starts
A1 base 80.0 s 1500 32213 MB 0 / 0 57
B1 PR, empty library 70.0 s 1533 32768 MB 0 / 0 82
A2 base 70.0 s 1501 33192 MB 0 / 0 128
B2 PR, B1's library 68.0 s 1471 32250 MB 0 / 0 62

Result

  • No regression: exit 0x0, no device removals, no crashes in any run.
  • World-load stop unchanged: 68–80 s in all four runs (my earlier same-build repeats spread 66–76 s).
  • Library across runs works on this head: B1 saved gen-00000001..gen-0000000e (119 MiB); B2 opened gen-0000000e at 2.2 s and logged memory-mapped pipeline library hits: 500 at 67.0 s. Of the 11 compute PSOs that took ≥10 s or never finished in B1, 8 have no compile line in B2 and 3 show driver blob supplied and 1–7 ms.
  • B2 then hit a different set: 9 compute PSOs, 0.97–1.55 MB DXIL, all driver blob absent, 35–76 s each, 2 still unfinished at 300 s, never more than 2 compiling at once. In B1 these 9 records appear only as [SHADER] cs load lines, with no compile. Same pattern as my B2b/B2c runs on the previous head.
  • Compile-start counts aren't a clean A/B metric here: the two identical base runs gave 57 and 128.
B2: compute PSOs that took ≥10 s
record DXIL started compile
bcca7412e6c66279 0.97 MB 4.6 s 35.4 s
b6dd852172e5f719 1.10 MB 40.0 s 45.4 s
33743bd6d1e45443 1.13 MB 76.0 s 42.2 s
8865dc610664a3a0 1.12 MB 118.1 s 41.6 s
81fe677790c1299a 1.55 MB 134.3 s 75.8 s
f1b22983d84270e4 1.29 MB 210.1 s 57.1 s
31b81a7b0427b16c 1.19 MB 220.0 s 42.0 s
edd47760cfa15446 1.22 MB 267.2 s unfinished at 300 s
ef008c0f04b6261a 1.23 MB 272.8 s unfinished at 300 s

Not tested: XCL_DIRECT_DXIL=1; a third library run on this head; XCL_PSO_LIBRARY=0; AMD / Intel; anything after world load.

Report written with Claude (Opus 5.5) from my own run logs; I ran the tests.

**@⁠jeremymeseeks** on GitHub · 2026-11-25 20:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7173493708) ### World load on `008d9c1c` (+ #684) vs its base `728e2548` (+ #684), RTX 5070 Ti **Setup:** Windows 10 22H2, Ryzen 7 9800X3D, 32 GB, RTX 5070 Ti, NVIDIA 621.01. Retail title, XCL defaults (`XCL_DIRECT_DXIL` unset). `scripts/smoke.ps1 -Seconds 300 -Title retail-worldload` with `XCL_PRESS_AT=20:A,25:A,30:A,35:A,40:A`. Order A-B-A-B. A = `728e2548` + #684 (local `98f8b104`), B = `008d9c1c` + #684 (local `fee6a08e`). Library folder emptied before B1; B2 reuses B1's library. | run | build | last 2 s sample with presents | frames | peak commit | removals / crashes | driver compile starts | |---|---|---|---|---|---|---| | A1 | base | 80.0 s | 1500 | 32213 MB | 0 / 0 | 57 | | B1 | PR, empty library | 70.0 s | 1533 | 32768 MB | 0 / 0 | 82 | | A2 | base | 70.0 s | 1501 | 33192 MB | 0 / 0 | 128 | | B2 | PR, B1's library | 68.0 s | 1471 | 32250 MB | 0 / 0 | 62 | **Result** - No regression: exit 0x0, no device removals, no crashes in any run. - World-load stop unchanged: 68–80 s in all four runs (my earlier same-build repeats spread 66–76 s). - Library across runs works on this head: B1 saved `gen-00000001`..`gen-0000000e` (119 MiB); B2 opened `gen-0000000e` at 2.2 s and logged `memory-mapped pipeline library hits: 500` at 67.0 s. Of the 11 compute PSOs that took ≥10 s or never finished in B1, 8 have no compile line in B2 and 3 show `driver blob supplied` and 1–7 ms. - B2 then hit a different set: 9 compute PSOs, 0.97–1.55 MB DXIL, all `driver blob absent`, 35–76 s each, 2 still unfinished at 300 s, never more than 2 compiling at once. In B1 these 9 records appear only as `[SHADER] cs` load lines, with no compile. Same pattern as my B2b/B2c runs on the previous head. - Compile-start counts aren't a clean A/B metric here: the two identical base runs gave 57 and 128. <details><summary>B2: compute PSOs that took ≥10 s</summary> | record | DXIL | started | compile | |---|---|---|---| | bcca7412e6c66279 | 0.97 MB | 4.6 s | 35.4 s | | b6dd852172e5f719 | 1.10 MB | 40.0 s | 45.4 s | | 33743bd6d1e45443 | 1.13 MB | 76.0 s | 42.2 s | | 8865dc610664a3a0 | 1.12 MB | 118.1 s | 41.6 s | | 81fe677790c1299a | 1.55 MB | 134.3 s | 75.8 s | | f1b22983d84270e4 | 1.29 MB | 210.1 s | 57.1 s | | 31b81a7b0427b16c | 1.19 MB | 220.0 s | 42.0 s | | edd47760cfa15446 | 1.22 MB | 267.2 s | unfinished at 300 s | | ef008c0f04b6261a | 1.23 MB | 272.8 s | unfinished at 300 s | </details> **Not tested:** `XCL_DIRECT_DXIL=1`; a third library run on this head; `XCL_PSO_LIBRARY=0`; AMD / Intel; anything after world load. Report written with Claude (Opus 5.5) from my own run logs; I ran the tests.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 07:05 UTC · original

Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current main on the new head — needs another rebase before it can be tested.

**@⁠DavidM1911** on GitHub · 2026-11-26 07:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#issuecomment-7185081253) Re-verification on RTX 3060 Ti (Windows 11): still a **merge conflict with current `main`** on the new head — needs another rebase before it can be tested.
Author
Owner

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

High merit but not merge-ready: very large runtime diff with failed Windows/description checks, no full workspace suite, no main/head smoke pair, and no runtime GPU validation. Default-on .plib path needs end-to-end cold/warm driver proof that stored libraries are safely loaded across compute, graphics, stream, and two-pass—not just helper/keying tests. PSO wait/lazy defer also needs title validation across draw, dispatch, and ExecuteIndirect. Rebase and provide required evidence before substantive merge review.

**@⁠bmjask** on GitHub · 2026-11-25 21:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/2001#pullrequestreview-6065128876) · **reviewed** High merit but not merge-ready: very large runtime diff with failed Windows/description checks, no full workspace suite, no main/head smoke pair, and no runtime GPU validation. Default-on .plib path needs end-to-end cold/warm driver proof that stored libraries are safely loaded across compute, graphics, stream, and two-pass—not just helper/keying tests. PSO wait/lazy defer also needs title validation across draw, dispatch, and ExecuteIndirect. Rebase and provide required evidence before substantive merge review.
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/hle/d3d12x/pso_async.rs
  • crates/xcl/src/hle/d3d12x/real.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2001/head:github-bot/gh-2001'
git switch 'github-bot/gh-2001'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2001'
git switch 'github-bot/gh-2001'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2001'
git switch 'github-bot/gh-2001'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2001'
git switch 'main'
git merge --squash 'github-bot/gh-2001'
git switch 'main'
git merge --ff-only 'github-bot/gh-2001'
git switch 'main'
git merge 'github-bot/gh-2001'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.