D3D12.X: bound driver PSO compile concurrency and surface stage progress (#156) #214

Open
github-bot wants to merge 1 commit from github-bot/gh-214 into main AGit
Owner

@⁠heretic1321 on GitHub · 2026-11-23 21:07 UTC · original
heretic1321:fix/nvidia-pso-stall → main · +379 −39 · 3 files · 1 commits · open

Mitigation and stage instrumentation for #156, rebased as a single commit onto upstream/main (47efa2e, head 96e68a4). Incorporates @woreksami's tested conflict resolution against #516, #634/#636, and #690 and fixes the rejected-cached-blob retry edge case.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs:
    • DriverCompileGuard bounding background (xcl-pso-* other than xcl-pso-urgent, covering both xcl-pso-N and #690's xcl-pso-pre-N) driver Create*PipelineState concurrency across all translated paths (CS around #634/#636's cached-blob lookup + retry, VS+PS around retry_without_rect_gs, MS-mesh/MS-cs, GS-mesh/GS-cs): BIG_COMPILES (1, >= XCL_BIG_PSO_KB, default 256 KiB) → 30 s-capped wait_for_commit() → driver_compiles() (XCL_DRIVER_COMPILE_THREADS, default 2 on 32-lane-only / NVIDIA, 4 on 64-lane). Title threads and xcl-pso-urgent bypass both semaphores and wait_for_commit().
    • If finish_pso rejects a cached compute blob (hr < 0 && cached.is_some()), guard.discard() drops the cached-size guard without incrementing DRIVER_COMPILING[1] or logging twice, and DriverCompileGuard::enter re-enters with dxil.len() before the cold retry so big shaders still respect BIG_COMPILES and wait_for_commit().
    • driver_compile_counts(), admission + compile slow logging (>= 2 s or XCL_TRACE_PSO_TIME=1), console topology/RTV/DSV translation in fallback_stream (subobjects 14/15/16) and translated_gs_pso, plus unit tests (big_compile_serialization_leaves_fast_lane_for_small_compiles, urgent_and_title_threads_are_exempt_from_background_slots).
  • crates/xcl/src/hle/d3d12x/pso_async.rs:
    • Lock-free O(1) counts() via atomic QUEUED + mark_enqueued/finish_pending/enqueue excluding dormant lazy stand-ins (preload keeps using #690's low-priority queue without inflating QUEUED), plus isolated unit test dormant_lazy_pipelines_are_not_counted_as_queued.
  • crates/xcl/src/hle/d3d12x/present.rs:
    • Keeps upstream/main's FPS window title (#516) and surfaces driver compile counts alongside DXC and queued counts (compiling shaders: N dxc, M done[, D driver (C done)][, Q pipelines queued][, F failed]).

Overlaps

  • #567 (bounds wait_for_commit to 5 s vs our 30 s cap).
  • #267, #533, #891 (bound title-thread wait durations; orthogonal to bounding worker driver compile concurrency).
  • #628 (prioritizes graphics over compute in pso_async's worker queue).

Tested

  • Linux host (no Windows, no GPU), Rust 1.95.0, head 96e68a4 on upstream/main 47efa2e:
    • AR_x86_64_pc_windows_msvc=llvm-ar cargo check --release --workspace --target x86_64-pc-windows-msvc — exit 0 (13.14s, 0 errors, 0 warnings).
    • AR_x86_64_pc_windows_msvc=llvm-ar cargo check --tests --workspace --target x86_64-pc-windows-msvc — exit 0 (8.48s, 0 errors, 0 warnings).
    • python3 scripts/pr_check.py --local verified all required sections and asset/model checks (failing only on the missing Windows xcl-smoke blocks).
  • Earlier community runs (on older commits, NOT covering 96e68a4):
    • @woreksami tested 960162e on Windows 11 + RTX 3060 8 GB (queue drained 0 driver (18 done), retail title advanced to setup/loading) and tested a local conflict resolution onto main 6025201 (cargo test --release -p xcl --lib: 666 passed, 0 failed, 21 ignored).
    • @mikebuckets171 tested 960162e via x86_64-pc-windows-gnullvm / Wine on macOS (dormant_lazy_pipelines_are_not_counted_as_queued passed).
    • @yous0serious (RTX 4090) and @Kalmarv (RTX 5070 Ti) tested bf2a27e; review points from both were incorporated in 960162e and retained here.

Regression run

  • Missing for head 96e68a4 (no Windows GPU host here; Windows testers are invited to run scripts/smoke.ps1 on main vs 96e68a4).

Not tested

  • Windows MSVC linking (lld-link / link.exe), cargo test --workspace execution, GPU tests, AMD / Intel hardware, and scripts/smoke.ps1 / retail title runs on 96e68a4.

AI use

  • T3 Code / Antigravity, Orchestrator (Neon) / gemini-pro-orchestrator-neon: rebased onto upstream/main (47efa2e), applied conflict resolution, added DriverCompileGuard::discard() for rejected-cached-blob retries, and ran Linux-to-x86_64-pc-windows-msvc cargo check and scripts/pr_check.py --local.
**@⁠heretic1321** on GitHub · 2026-11-23 21:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/214) `heretic1321:fix/nvidia-pso-stall` → `main` · +379 −39 · 3 files · 1 commits · open Mitigation and stage instrumentation for #156, rebased as a single commit onto `upstream/main` (`47efa2e`, head `96e68a4`). Incorporates `@woreksami`'s tested conflict resolution against `#516`, `#634`/`#636`, and `#690` and fixes the rejected-cached-blob retry edge case. **What is in it** - `crates/xcl/src/hle/d3d12x/real.rs`: - `DriverCompileGuard` bounding background (`xcl-pso-*` other than `xcl-pso-urgent`, covering both `xcl-pso-N` and `#690`'s `xcl-pso-pre-N`) driver `Create*PipelineState` concurrency across all translated paths (`CS` around `#634`/`#636`'s cached-blob lookup + retry, `VS+PS` around `retry_without_rect_gs`, `MS-mesh`/`MS-cs`, `GS-mesh`/`GS-cs`): `BIG_COMPILES` (1, `>= XCL_BIG_PSO_KB`, default `256` KiB) → 30 s-capped `wait_for_commit()` → `driver_compiles()` (`XCL_DRIVER_COMPILE_THREADS`, default `2` on 32-lane-only / NVIDIA, `4` on 64-lane). Title threads and `xcl-pso-urgent` bypass both semaphores and `wait_for_commit()`. - If `finish_pso` rejects a cached compute blob (`hr < 0 && cached.is_some()`), `guard.discard()` drops the cached-size guard without incrementing `DRIVER_COMPILING[1]` or logging twice, and `DriverCompileGuard::enter` re-enters with `dxil.len()` before the cold retry so big shaders still respect `BIG_COMPILES` and `wait_for_commit()`. - `driver_compile_counts()`, admission + compile slow logging (`>= 2 s` or `XCL_TRACE_PSO_TIME=1`), console topology/RTV/DSV translation in `fallback_stream` (subobjects `14`/`15`/`16`) and `translated_gs_pso`, plus unit tests (`big_compile_serialization_leaves_fast_lane_for_small_compiles`, `urgent_and_title_threads_are_exempt_from_background_slots`). - `crates/xcl/src/hle/d3d12x/pso_async.rs`: - Lock-free O(1) `counts()` via atomic `QUEUED` + `mark_enqueued`/`finish_pending`/`enqueue` excluding dormant lazy stand-ins (`preload` keeps using `#690`'s low-priority queue without inflating `QUEUED`), plus isolated unit test `dormant_lazy_pipelines_are_not_counted_as_queued`. - `crates/xcl/src/hle/d3d12x/present.rs`: - Keeps `upstream/main`'s `FPS` window title (`#516`) and surfaces driver compile counts alongside DXC and queued counts (`compiling shaders: N dxc, M done[, D driver (C done)][, Q pipelines queued][, F failed]`). **Overlaps** - `#567` (bounds `wait_for_commit` to 5 s vs our 30 s cap). - `#267`, `#533`, `#891` (bound title-thread wait durations; orthogonal to bounding worker driver compile concurrency). - `#628` (prioritizes graphics over compute in `pso_async`'s worker queue). **Tested** - Linux host (no Windows, no GPU), Rust `1.95.0`, head `96e68a4` on `upstream/main` `47efa2e`: - `AR_x86_64_pc_windows_msvc=llvm-ar cargo check --release --workspace --target x86_64-pc-windows-msvc` — exit 0 (`13.14s`, 0 errors, 0 warnings). - `AR_x86_64_pc_windows_msvc=llvm-ar cargo check --tests --workspace --target x86_64-pc-windows-msvc` — exit 0 (`8.48s`, 0 errors, 0 warnings). - `python3 scripts/pr_check.py --local` verified all required sections and asset/model checks (failing only on the missing Windows `xcl-smoke` blocks). - Earlier community runs (on older commits, NOT covering `96e68a4`): - `@woreksami` tested `960162e` on Windows 11 + RTX 3060 8 GB (queue drained `0 driver (18 done)`, retail title advanced to setup/loading) and tested a local conflict resolution onto `main` `6025201` (`cargo test --release -p xcl --lib`: 666 passed, 0 failed, 21 ignored). - `@mikebuckets171` tested `960162e` via `x86_64-pc-windows-gnullvm` / Wine on macOS (`dormant_lazy_pipelines_are_not_counted_as_queued` passed). - `@yous0serious` (RTX 4090) and `@Kalmarv` (RTX 5070 Ti) tested `bf2a27e`; review points from both were incorporated in `960162e` and retained here. **Regression run** - Missing for head `96e68a4` (no Windows GPU host here; Windows testers are invited to run `scripts/smoke.ps1` on `main` vs `96e68a4`). **Not tested** - Windows MSVC linking (`lld-link` / `link.exe`), `cargo test --workspace` execution, GPU tests, AMD / Intel hardware, and `scripts/smoke.ps1` / retail title runs on `96e68a4`. **AI use** - `T3 Code / Antigravity, Orchestrator (Neon) / gemini-pro-orchestrator-neon`: rebased onto `upstream/main` (`47efa2e`), applied conflict resolution, added `DriverCompileGuard::discard()` for rejected-cached-blob retries, and ran Linux-to-`x86_64-pc-windows-msvc` `cargo check` and `scripts/pr_check.py --local`.
Part of #156. Bounds background driver pipeline compilation concurrency (1 big >= XCL_BIG_PSO_KB behind free-commit wait capped at 30 s, then 2 on wave32-only / 4 on wave64 via XCL_DRIVER_COMPILE_THREADS) across compute, graphics, MS, and GS paths while keeping title threads and xcl-pso-urgent exempt. Re-enters the guard on cold retry if a cached compute blob is rejected, fixes pso_async::counts() to exclude dormant lazy stand-ins, translates GS/fallback stream formats and topologies, and surfaces driver compile progress in the window title.

Assisted-by: T3 Code / Antigravity (gemini-pro-orchestrator-neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:15:43 +00:00
Author
Owner

@⁠yous0serious on GitHub · 2026-11-23 21:30 UTC · original

Tested on Windows + NVIDIA (RTX 4090)

The PR says it was never built or run on Windows, so here is a Windows / NVIDIA run. No retail game here, so the measurement plan above (thread dumps, XCL_TRACE_PSO_TIME) is not covered – only build, test suite and the synthetic GPU experiments.

Setup: Windows 11, i7-13700KF, RTX 4090 (driver 32.0.16.2101, wave32 only), Rust 1.100 MSVC, Agility SDK 1.620.2, Windows SDK DXC 1.8.2502 (and DXC 1.9.2609 for E2).

what result
cargo build --release --workspace (MSVC link) ok, no new warnings
cargo test --workspace --release -- --test-threads=4, branch as is (bf2a27e) 592 passed, 0 failed (2 SKIPPED … no wave64)
same, branch merged into current main (af20b4b) merges without conflicts; 631 passed, 0 failed, e2e test title included
new tests pso_async::tests::dormant_lazy_pipelines_are_not_counted_as_queued, queue_tests::big_compile_serialization_leaves_fast_lane_for_small_compiles pass (3 runs)
aperture_tests GPU tests (from #187) 3 / 3 pass

E2 (e2_window_compile_time, 700 blocks, 19 601 instructions, median of 3):

form DXIL DXC 1.8.2502 DXC 1.9.2609 driver (3 runs, sorted)
1 window 190 KB 3.80 s 3.49 s 0.00, 0.00, 3.7–3.8 s
4 windows, switch 512 KB 54.2 s 44.2 s 0.00, 0.00, 7.9 s
4 windows, heap (#187) 238 KB 4.6 s 4.0 s 0.00, 0.00, 1.2–1.4 s

On this NVIDIA card the DXC step dominates, not the driver: the heap windows cut DXC ~12× and the driver's one cold compile ~6× against the switch form. Two of three driver compiles per form return in < 10 ms despite the random literal (the driver's cache, presumably) – the test prints them sorted, so only the cold one is meaningful. DXC 1.9 vs the SDK's 1.8 is only 10–18 % here (the big gap in #156 was against 1.7). E1b could not run (no debug layer through the Agility factory here, 0x887A002D).

One thing from reading the code (not measured – no game)

Title-thread compiles now wait on the background slots. Before this PR only xcl-pso-N workers took BIG_COMPILES (big compute only); a compile on the title's own thread (dev_create_*_pso → dxc::urgent(…) when there is no stand-in) or on xcl-pso-urgent (pso_async::resolve_wait, a bind waiting for its pipeline) went straight to the driver. With DriverCompileGuard::enter every translated compile takes a driver_compiles() slot (2 on NVIDIA), and a big one BIG_COMPILES (1) first. Up to cores - 1 workers wait on the same Condvar (notify_one, no order or priority), so a title thread that blocks for one pipeline can wait behind several unrelated background compiles – and behind a big one holding BIG_COMPILES through up to 30 s of wait_for_commit plus its own driver compile. Letting threads that are not xcl-pso-N workers bypass the slots (or giving them a reserved lane) would keep the bound on background work without stalling the title. wait_for_commit already exempts xcl-pso-urgent; the slots don't.

Minor: dormant_lazy_pipelines_are_not_counted_as_queued compares the global QUEUED before / after while other lib tests may queue pipelines in parallel – passed 3 / 3 here, but it could flake.

AI-assisted (GitHub Copilot); runs and numbers are from my machine.

**@⁠yous0serious** on GitHub · 2026-11-23 21:30 UTC · [original](https://github.com/xcl-dev/xcl/pull/214#issuecomment-7114561852) ## Tested on Windows + NVIDIA (RTX 4090) The PR says it was never built or run on Windows, so here is a Windows / NVIDIA run. No retail game here, so the measurement plan above (thread dumps, `XCL_TRACE_PSO_TIME`) is **not** covered – only build, test suite and the synthetic GPU experiments. **Setup:** Windows 11, i7-13700KF, RTX 4090 (driver 32.0.16.2101, wave32 only), Rust 1.100 MSVC, Agility SDK 1.620.2, Windows SDK DXC 1.8.2502 (and DXC 1.9.2609 for E2). | what | result | |---|---| | `cargo build --release --workspace` (MSVC link) | ok, no new warnings | | `cargo test --workspace --release -- --test-threads=4`, branch as is (`bf2a27e`) | **592 passed, 0 failed** (2 `SKIPPED … no wave64`) | | same, branch merged into current `main` (`af20b4b`) | merges without conflicts; **631 passed, 0 failed**, e2e test title included | | new tests `pso_async::tests::dormant_lazy_pipelines_are_not_counted_as_queued`, `queue_tests::big_compile_serialization_leaves_fast_lane_for_small_compiles` | pass (3 runs) | | `aperture_tests` GPU tests (from #187) | 3 / 3 pass | **E2 (`e2_window_compile_time`, 700 blocks, 19 601 instructions, median of 3):** | form | DXIL | DXC 1.8.2502 | DXC 1.9.2609 | driver (3 runs, sorted) | |---|---:|---:|---:|---| | 1 window | 190 KB | 3.80 s | 3.49 s | 0.00, 0.00, 3.7–3.8 s | | 4 windows, `switch` | 512 KB | **54.2 s** | **44.2 s** | 0.00, 0.00, 7.9 s | | 4 windows, heap (#187) | 238 KB | 4.6 s | 4.0 s | 0.00, 0.00, 1.2–1.4 s | On this NVIDIA card the DXC step dominates, not the driver: the heap windows cut DXC ~12× and the driver's one cold compile ~6× against the `switch` form. Two of three driver compiles per form return in < 10 ms despite the random literal (the driver's cache, presumably) – the test prints them sorted, so only the cold one is meaningful. DXC 1.9 vs the SDK's 1.8 is only 10–18 % here (the big gap in #156 was against 1.7). E1b could not run (no debug layer through the Agility factory here, `0x887A002D`). ## One thing from reading the code (not measured – no game) **Title-thread compiles now wait on the background slots.** Before this PR only `xcl-pso-N` workers took `BIG_COMPILES` (big compute only); a compile on the title's own thread (`dev_create_*_pso` → `dxc::urgent(…)` when there is no stand-in) or on `xcl-pso-urgent` (`pso_async::resolve_wait`, a bind waiting for its pipeline) went straight to the driver. With `DriverCompileGuard::enter` every translated compile takes a `driver_compiles()` slot (2 on NVIDIA), and a big one `BIG_COMPILES` (1) first. Up to `cores - 1` workers wait on the same `Condvar` (`notify_one`, no order or priority), so a title thread that blocks for one pipeline can wait behind several unrelated background compiles – and behind a big one holding `BIG_COMPILES` through up to 30 s of `wait_for_commit` plus its own driver compile. Letting threads that are not `xcl-pso-N` workers bypass the slots (or giving them a reserved lane) would keep the bound on background work without stalling the title. `wait_for_commit` already exempts `xcl-pso-urgent`; the slots don't. Minor: `dormant_lazy_pipelines_are_not_counted_as_queued` compares the global `QUEUED` before / after while other lib tests may queue pipelines in parallel – passed 3 / 3 here, but it could flake. AI-assisted (GitHub Copilot); runs and numbers are from my machine.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-23 21:52 UTC · original

Tested on an RTX 5070 Ti, merged onto main. The PR fixes two things that fail on main, and it no longer merges. Three notes follow.

What it fixes, shown on main:

  • The PR's dormant-count test fails on main and passes on the merge.
  • A native PSO test with stream stand-ins: main returns E_INVALIDARG for topology 19, RTV format 116, DSV format 118 and the three together. The merge creates all four. A control with PC formats succeeds on both.

Notes:

  1. The size threshold depends on the DXC version. At the default 256 KiB (real.rs:3071), all three E2 forms below take the large-pipeline slot with the SDK's DXC 1.7. With DXC 1.9 only the four-window switch form does, because 1.9's DXIL is 2–4× smaller. The same thing happened to #156's F case, which shrank from 633 KB to 235 KB.

  2. The wait for a slot isn't timed. The compile trace starts after both semaphores are taken (real.rs:3208). With the two small slots held, an xcl-pso-urgent thread waited 251 ms to get in, and its compile timer then read 300 ns. Timing the admission wait separately would show that part of a bind stall (#156).

  3. Rebase.

    • On main 7a033c8 the stack conflicts in real.rs.
    • Cherry-picking bf2a27e (+282 / −29) on its own also conflicts in pso_async.rs.
    • The stack carries #187 at 8c0346d, behind its current c74b03a.

    It might go in more easily as three PRs:

    • driver limits, commit wait and timing, keeping main's rect-GS retry inside the guard;
    • the queued-count accounting and its test, on main's submit_as / resolve_wait;
    • the mesh / GS deferral and stream stand-in format conversion, with the native PSO test. Main already converts graphics stand-in topology.

E2 (from #187) at 700 blocks / 19,601 instructions. Each cell is DXIL bytes, median DXC seconds, and the range of three driver times in seconds:

E2 form SDK DXC 1.7.2308.16 DXC 1.9.2602.17
one window 695,172 / 4.43 / 0.05–6.62 190,328 / 3.97 / 0.02–2.99
four, switch 1,035,432 / 6.90 / 0.11–57.76 512,328 / 61.37 / 0.06–59.34
four, heap 807,024 / 4.85 / 0.04–6.97 237,660 / 4.84 / 0.02–3.50

Tested

  • Windows 11, RTX 5070 Ti (NVIDIA 610.74), Rust 1.99.0, release, run serially. Counts are passed / failed / ignored:
Revision SDK DXC DXC 1.9
head bf2a27e 556 / 0 / 21 556 / 0 / 21
main 60565c4 611 / 0 / 20 —
merge onto 60565c4 620 / 0 / 22 620 / 0 / 22
  • e2_window_compile_time (ignored bench) on the same merge.
  • 7a033c8: a merge check only.

Not tested

  • A retail load, peak commit, the low-commit timeout.
  • AMD.
  • Driver cache state was not controlled.

🤖 GPT-6.2 Astra, Claude Opus 5.5

**@⁠Kalmarv** on GitHub · 2026-11-23 21:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/214#issuecomment-7115023208) Tested on an RTX 5070 Ti, merged onto `main`. **The PR fixes two things that fail on `main`, and it no longer merges.** Three notes follow. **What it fixes, shown on `main`:** - The PR's dormant-count test fails on `main` and passes on the merge. - A native PSO test with stream stand-ins: `main` returns `E_INVALIDARG` for topology 19, RTV format 116, DSV format 118 and the three together. The merge creates all four. A control with PC formats succeeds on both. **Notes:** 1. **The size threshold depends on the DXC version.** At the default 256 KiB (`real.rs:3071`), all three E2 forms below take the large-pipeline slot with the SDK's DXC 1.7. With DXC 1.9 only the four-window switch form does, because 1.9's DXIL is 2–4× smaller. The same thing happened to #156's F case, which shrank from 633 KB to 235 KB. 2. **The wait for a slot isn't timed.** The compile trace starts after both semaphores are taken (`real.rs:3208`). With the two small slots held, an `xcl-pso-urgent` thread waited **251 ms** to get in, and its compile timer then read 300 ns. Timing the admission wait separately would show that part of a bind stall (#156). 3. **Rebase.** - On `main` `7a033c8` the stack conflicts in `real.rs`. - Cherry-picking `bf2a27e` (+282 / −29) on its own also conflicts in `pso_async.rs`. - The stack carries #187 at `8c0346d`, behind its current `c74b03a`. It might go in more easily as three PRs: - driver limits, commit wait and timing, keeping main's rect-GS retry inside the guard; - the queued-count accounting and its test, on main's `submit_as` / `resolve_wait`; - the mesh / GS deferral and stream stand-in format conversion, with the native PSO test. Main already converts graphics stand-in topology. E2 (from #187) at 700 blocks / 19,601 instructions. Each cell is DXIL bytes, median DXC seconds, and the range of three driver times in seconds: | E2 form | SDK DXC 1.7.2308.16 | DXC 1.9.2602.17 | |---|---:|---:| | one window | 695,172 / 4.43 / 0.05–6.62 | 190,328 / 3.97 / 0.02–2.99 | | four, switch | 1,035,432 / 6.90 / 0.11–57.76 | 512,328 / 61.37 / 0.06–59.34 | | four, heap | 807,024 / 4.85 / 0.04–6.97 | 237,660 / 4.84 / 0.02–3.50 | ### Tested - Windows 11, RTX 5070 Ti (NVIDIA 610.74), Rust 1.99.0, release, run serially. Counts are passed / failed / ignored: | Revision | SDK DXC | DXC 1.9 | |---|---:|---:| | head `bf2a27e` | 556 / 0 / 21 | 556 / 0 / 21 | | `main` `60565c4` | 611 / 0 / 20 | — | | merge onto `60565c4` | 620 / 0 / 22 | 620 / 0 / 22 | - `e2_window_compile_time` (ignored bench) on the same merge. - `7a033c8`: a merge check only. ### Not tested - A retail load, peak commit, the low-commit timeout. - AMD. - Driver cache state was not controlled. 🤖 GPT-6.2 Astra, Claude Opus 5.5
Author
Owner

@⁠heretic1321 on GitHub · 2026-11-24 00:02 UTC · original

Ready for review at 960162e, on current upstream/main 4017f8f with no stacked PRs.

Review points, one by one

  1. Title / xcl-pso-urgent queueing behind background work — fixed by a reserved lane. is_background_pso_worker_name() recognises xcl-pso-N only; those take BIG_COMPILES → bounded commit wait → driver slot. Title threads and xcl-pso-urgent bypass all three and only track/log. Unit test urgent_and_title_threads_are_exempt_from_background_slots saturates both semaphores and asserts a caller thread and a spawned urgent thread enter immediately.
  2. Admission wait untimed — now timed separately from the compile, with lane=bg|urgent, and slow-logged at the same 2 s threshold. wait_for_commit keeps its 30 s cap and its urgent exemption.
  3. Flaky global-counter test — mark_enqueued/finish_pending take a local counter; the assertion no longer reads global QUEUED.
  4. DXC-version-dependent threshold — XCL_BIG_PSO_KB remains the knob; noted in the body for DXC 1.9's smaller DXIL.
  5. Split — yes, it splits cleanly into the three you named, in that order, with no cross-dependencies: (a) driver limits + commit cap + admission timing + window title, (b) QUEUED accounting + its isolated test, (c) fallback_stream 14/15/16 + translated_gs_pso format conversion + the native PSO test. Say which you want and I'll post (a) first and stack the rest, or keep one commit if you prefer to review it whole.

Still missing to merge: the two xcl-smoke blocks (main and 960162e) — no Windows host here. @⁠yous0serious @⁠Kalmarv you both ran this branch already; would one of you do the smoke pair on 960162e against plain main, same package and duration, and paste both blocks? XCL_DRIVER_COMPILE_THREADS=2 is the default on NVIDIA; an extra run at =1 would also tell us whether 2 is the right default.

**@⁠heretic1321** on GitHub · 2026-11-24 00:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/214#issuecomment-7117630020) Ready for review at `960162e`, on current `upstream/main` `4017f8f` with no stacked PRs. **Review points, one by one** 1. **Title / `xcl-pso-urgent` queueing behind background work** — fixed by a reserved lane. `is_background_pso_worker_name()` recognises `xcl-pso-N` only; those take `BIG_COMPILES` → bounded commit wait → driver slot. Title threads and `xcl-pso-urgent` bypass all three and only track/log. Unit test `urgent_and_title_threads_are_exempt_from_background_slots` saturates both semaphores and asserts a caller thread and a spawned urgent thread enter immediately. 2. **Admission wait untimed** — now timed separately from the compile, with `lane=bg|urgent`, and slow-logged at the same 2 s threshold. `wait_for_commit` keeps its 30 s cap and its urgent exemption. 3. **Flaky global-counter test** — `mark_enqueued`/`finish_pending` take a local counter; the assertion no longer reads global `QUEUED`. 4. **DXC-version-dependent threshold** — `XCL_BIG_PSO_KB` remains the knob; noted in the body for DXC 1.9's smaller DXIL. 5. **Split** — yes, it splits cleanly into the three you named, in that order, with no cross-dependencies: (a) driver limits + commit cap + admission timing + window title, (b) `QUEUED` accounting + its isolated test, (c) `fallback_stream` 14/15/16 + `translated_gs_pso` format conversion + the native PSO test. Say which you want and I'll post (a) first and stack the rest, or keep one commit if you prefer to review it whole. **Still missing to merge:** the two `xcl-smoke` blocks (main and `960162e`) — no Windows host here. @⁠yous0serious @⁠Kalmarv you both ran this branch already; would one of you do the smoke pair on `960162e` against plain `main`, same package and duration, and paste both blocks? `XCL_DRIVER_COMPILE_THREADS=2` is the default on NVIDIA; an extra run at `=1` would also tell us whether 2 is the right default.
Author
Owner

@⁠woreksami on GitHub · 2026-11-24 01:39 UTC · original

Test report on NVIDIA Ampere 8 GB, with the retail title from #156.

Tested

  • NVIDIA GeForce RTX 3060 8 GB, driver 610.88, 32-lane waves · Intel i9-14900K · 32 GB · Windows 11 (26200) · rustc 1.99.1 · release build · DXC from SDK 10.0.26100
  • The newer retail title from the README (file sizes checked against a manifest), XCL_NETWORK=0
  • main 2b4bb43 without this PR, 240 s: the window title stayed at 0 running, 2 done, 58739 pipelines queued for the whole run (81,217 draws, no crash).
  • main 2b4bb43 + this PR at 960162e: the queue drained (0 driver (18 done), nothing queued at ~200 s) and the title went on to the account picker, its setup screens and its loading screen. That run ended at ~353 s at #232's watchdog.
  • main a6f5f7a + this PR (960162e) + #267 (043d1f7), with XCL_PSO_WAIT_MS=150 and XCL_DXC_THREADS=4: 8,100 presents in ~370 s, 30.0 fps for the first 240 s (menus and setup), 4.9–7.8 fps on the loading screen, then 22–26 fps; no crash. The run was ended by an external watcher of mine when free RAM fell under 3 GB, not by XCL.
  • cargo test --release -p xcl --lib on the merged tree: 642 passed, 0 failed, 21 ignored.

Not tested

  • The whole workspace suite and scripts/smoke.ps1; AMD; this PR without the XCL_DXC_THREADS=4 cap on the long run (31 default threads on this CPU ran the machine out of RAM earlier).

AI use

  • Claude Code with Claude Opus 5.5: built the branches, ran the title, read the logs and wrote this report from those runs.
**@⁠woreksami** on GitHub · 2026-11-24 01:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/214#issuecomment-7119311543) Test report on NVIDIA Ampere 8 GB, with the retail title from #156. **Tested** - NVIDIA GeForce RTX 3060 8 GB, driver 610.88, 32-lane waves · Intel i9-14900K · 32 GB · Windows 11 (26200) · rustc 1.99.1 · release build · DXC from SDK 10.0.26100 - The newer retail title from the README (file sizes checked against a manifest), `XCL_NETWORK=0` - `main` 2b4bb43 without this PR, 240 s: the window title stayed at `0 running, 2 done, 58739 pipelines queued` for the whole run (81,217 draws, no crash). - `main` 2b4bb43 + this PR at 960162e: the queue drained (`0 driver (18 done)`, nothing queued at ~200 s) and the title went on to the account picker, its setup screens and its loading screen. That run ended at ~353 s at #232's watchdog. - `main` a6f5f7a + this PR (960162e) + #267 (043d1f7), with `XCL_PSO_WAIT_MS=150` and `XCL_DXC_THREADS=4`: 8,100 presents in ~370 s, 30.0 fps for the first 240 s (menus and setup), 4.9–7.8 fps on the loading screen, then 22–26 fps; no crash. The run was ended by an external watcher of mine when free RAM fell under 3 GB, not by XCL. - `cargo test --release -p xcl --lib` on the merged tree: 642 passed, 0 failed, 21 ignored. **Not tested** - The whole workspace suite and `scripts/smoke.ps1`; AMD; this PR without the `XCL_DXC_THREADS=4` cap on the long run (31 default threads on this CPU ran the machine out of RAM earlier). **AI use** - Claude Code with Claude Opus 5.5: built the branches, ran the title, read the logs and wrote this report from those runs.
Author
Owner

@⁠woreksami on GitHub · 2026-11-24 05:14 UTC · original

@⁠heretic1321 this now conflicts with main (#516's FPS window title in present.rs; #634 / #636's driver-blob cache around the compute PSO compile in real.rs; #690 in pso_async.rs). In case it saves you time, here is a resolution I tested; nothing is pushed anywhere.

What it does

  • present.rs: main's title with this PR's driver counter: compiling shaders: N dxc, M done[, D driver (C done)]….
  • real.rs, compute PSO: keeps main's in-memory/on-disk driver blob (compute_blob, driver_cache) and its retry without the blob, and wraps both compiles in DriverCompileGuard. A pipeline with a cached blob enters with size 0, so it is not a big compile, as main had it (big && cached.is_none()). guard.finish(hr) takes the final hr after the retry.
  • pso_async.rs: git put #690's else if used::known(key) preload branch into this PR's new enqueue(), where key is not in scope; it is moved back to submit_as after if send { enqueue(p); }. The new_pending test helper gets #690's key / used fields.

Tested

  • main 6025201 + this PR (960162e), merged as below: cargo test --release -p xcl --lib: 666 passed, 0 failed, 21 ignored.
  • Windows 11 (26200), RTX 3060 8 GB, driver 610.88, i9-14900K, 32 GB.
  • Earlier today, the same resolution in a tree with #267, #456, #468, #503 and #572 as well ran the newer retail title from the README at 29.8 fps after 26 s, window title showing the driver counter, no crash.

Not tested

  • This merge alone with the title, scripts/smoke.ps1, the workspace suite. A cached blob the driver refuses is recompiled inside the same guard entered with size 0 (not as a big compile): rare, but noted.
Resolution (git show --remerge-diff of the merge)
diff --git a/crates/xcl/src/hle/d3d12x/present.rs b/crates/xcl/src/hle/d3d12x/present.rs
remerge CONFLICT (content): Merge conflict in crates/xcl/src/hle/d3d12x/present.rs
index 23e1244..8ba22a7 100644
--- a/crates/xcl/src/hle/d3d12x/present.rs
+++ b/crates/xcl/src/hle/d3d12x/present.rs
@@ -344,7 +344,6 @@ fn window_name() -> String {
 /// the XCL window's timer for `show_compiling`
 const COMPILE_TIMER: usize = 0x5C0;
 
-<<<<<<< 6025201 (Merge pull request #771 from gefydev/readme/discord-invite)
 struct FrameRate {
     sampled_at: Instant,
     presented: u64,
@@ -371,16 +370,10 @@ impl FrameRate {
     }
 }
 
-/// While XCL compiles shaders (DXC, programs the disk cache did not have – the title draws
+/// While XCL compiles shaders (DXC or the GPU driver's pipeline compiler, programs the disk cache did not have – the title draws
 /// nothing with those pipelines meanwhile: after an XCL update the screen stays black while
 /// thousands recompile), the window's title says so:
-/// "XCL – <game> | N FPS | compiling shaders: N running, M done[, Q pipelines queued][, F failed]".
-=======
-/// While XCL compiles shaders (DXC or the GPU driver's pipeline compiler – the title draws
-/// nothing with those pipelines meanwhile: after an XCL update the screen stays black while
-/// thousands recompile), the window's title says so:
-/// "XCL – <game> | compiling shaders: N dxc, M done[, D driver (C done)][, Q pipelines queued][, F failed]".
->>>>>>> 960162e (D3D12.X: bound driver PSO compile concurrency and surface stage progress)
+/// "XCL – <game> | N FPS | compiling shaders: N dxc, M done[, D driver (C done)][, Q pipelines queued][, F failed]".
 /// It stays 2 s after the last compile (compiles in the title's own calls come one by one),
 /// then only the game name and presented frame rate remain.
 unsafe fn show_compiling(hwnd: HWND) {
@@ -414,11 +407,7 @@ unsafe fn show_compiling(hwnd: HWND) {
         };
         let queued = if queued > 0 { format!(", {queued} pipelines queued") } else { String::new() };
         let failed = if failed > 0 { format!(", {failed} failed") } else { String::new() };
-<<<<<<< 6025201 (Merge pull request #771 from gefydev/readme/discord-invite)
-        format!("{title} | compiling shaders: {running} running, {done} done{queued}{failed}")
-=======
-        format!("XCL – {title} | compiling shaders: {running} dxc, {done} done{driver}{queued}{failed}")
->>>>>>> 960162e (D3D12.X: bound driver PSO compile concurrency and surface stage progress)
+        format!("{title} | compiling shaders: {running} dxc, {done} done{driver}{queued}{failed}")
     } else {
         title
     };
diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs
index df2a6d7..e14357a 100644
--- a/crates/xcl/src/hle/d3d12x/pso_async.rs
+++ b/crates/xcl/src/hle/d3d12x/pso_async.rs
@@ -152,6 +152,11 @@ fn submit_as(standin: usize, compute: bool, job: Job, send: bool, key: u64) {
     });
     if send {
         enqueue(p);
+    } else if used::known(key) {
+        if let Some(q) = preload() {
+            q.list.lock().unwrap().push_back(p);
+            q.cv.notify_one();
+        }
     }
 }
 
@@ -173,11 +178,6 @@ fn mark_enqueued(p: &Pending, queued: &AtomicUsize) -> bool {
 fn enqueue(p: Arc<Pending>) {
     if mark_enqueued(&p, &QUEUED) {
         let _ = queue().lock().unwrap().send(p);
-    } else if used::known(key) {
-        if let Some(q) = preload() {
-            q.list.lock().unwrap().push_back(p);
-            q.cv.notify_one();
-        }
     }
 }
 
@@ -434,6 +434,8 @@ mod tests {
             done: Mutex::new(false),
             cv: Condvar::new(),
             compute,
+            key: 0,
+            used: Default::default(),
             orphan: Default::default(),
         }
     }
diff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs
remerge CONFLICT (content): Merge conflict in crates/xcl/src/hle/d3d12x/real.rs
index c48b367..04938b3 100644
--- a/crates/xcl/src/hle/d3d12x/real.rs
+++ b/crates/xcl/src/hle/d3d12x/real.rs
@@ -3509,7 +3509,6 @@ unsafe fn translated_compute_pso(this: *mut c_void, f: PsoFn, desc: *const c_voi
     copy.pRootSignature = std::mem::transmute::<*mut c_void, std::mem::ManuallyDrop<Option<ID3D12RootSignature>>>(rs);
     copy.CS = bytecode(&dxil);
     copy.CachedPSO = D3D12_CACHED_PIPELINE_STATE::default();
-<<<<<<< 6025201 (Merge pull request #771 from gefydev/readme/discord-invite)
     // A program built again gets the driver's own result of its first build: a retail title
     // made 14 big compute pipelines twice while loading, 13 - 30 s each the second time.
     let key = compute_blob_key(&dxil, rs as usize, copy.Flags.0);
@@ -3524,12 +3523,9 @@ unsafe fn translated_compute_pso(this: *mut c_void, f: PsoFn, desc: *const c_voi
         copy.CachedPSO = D3D12_CACHED_PIPELINE_STATE { pCachedBlob: b.as_ptr() as *const c_void, CachedBlobSizeInBytes: b.len() };
     }
     let started = std::time::Instant::now();
-    // in the background, one at a time and within the commit left (each ~1.5 GB in the driver)
-    let _slot = (big && cached.is_none() && std::thread::current().name().is_some_and(|n| n.starts_with("xcl-pso"))).then(|| {
-        let slot = BIG_COMPILES.acquire();
-        wait_for_commit();
-        slot
-    });
+    // #214's guard: background-only, one big compile at a time within the commit left, and the
+    // driver's own concurrency cap; a pipeline with the driver's cached blob is not big (as before)
+    let guard = DriverCompileGuard::enter(this, if cached.is_some() { 0 } else { dxil.len() }, "CS");
     let mut hr = finish_pso(this, f, &copy as *const _ as *const c_void, riid, ppv);
     if hr < 0 && cached.is_some() {
         // a blob the driver does not take (another root signature at the same address…): compiled
@@ -3540,6 +3536,7 @@ unsafe fn translated_compute_pso(this: *mut c_void, f: PsoFn, desc: *const c_voi
         copy.CachedPSO = D3D12_CACHED_PIPELINE_STATE::default();
         hr = finish_pso(this, f, &copy as *const _ as *const c_void, riid, ppv);
     }
+    guard.finish(hr);
     let reused = hr >= 0 && cached.is_some() && copy.CachedPSO.CachedBlobSizeInBytes != 0;
     if hr >= 0 && !reused {
         keep_compute_blob(key, *ppv, dxil.len());
@@ -3549,11 +3546,6 @@ unsafe fn translated_compute_pso(this: *mut c_void, f: PsoFn, desc: *const c_voi
     } else if reused && from_disk {
         driver_cache::note(true, None);
     }
-=======
-    let guard = DriverCompileGuard::enter(this, dxil.len(), "CS");
-    let hr = finish_pso(this, f, &copy as *const _ as *const c_void, riid, ppv);
-    guard.finish(hr);
->>>>>>> 960162e (D3D12.X: bound driver PSO compile concurrency and surface stage progress)
     if hr < 0 {
         note_translation_error(format!("the driver rejected the compute PSO with the translated CS ({hr:#x})"));
         return Some(Err(()));

AI use: Claude Code with Claude Opus 5.5 resolved the conflicts, ran the tests and wrote this comment.

**@⁠woreksami** on GitHub · 2026-11-24 05:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/214#issuecomment-7122763090) @⁠heretic1321 this now conflicts with `main` (#516's FPS window title in `present.rs`; #634 / #636's driver-blob cache around the compute PSO compile in `real.rs`; #690 in `pso_async.rs`). In case it saves you time, here is a resolution I tested; nothing is pushed anywhere. **What it does** - `present.rs`: `main`'s title with this PR's driver counter: `compiling shaders: N dxc, M done[, D driver (C done)]…`. - `real.rs`, compute PSO: keeps `main`'s in-memory/on-disk driver blob (`compute_blob`, `driver_cache`) and its retry without the blob, and wraps both compiles in `DriverCompileGuard`. A pipeline with a cached blob enters with size 0, so it is not a big compile, as `main` had it (`big && cached.is_none()`). `guard.finish(hr)` takes the final `hr` after the retry. - `pso_async.rs`: git put #690's `else if used::known(key)` preload branch into this PR's new `enqueue()`, where `key` is not in scope; it is moved back to `submit_as` after `if send { enqueue(p); }`. The `new_pending` test helper gets #690's `key` / `used` fields. **Tested** - `main` 6025201 + this PR (960162e), merged as below: `cargo test --release -p xcl --lib`: 666 passed, 0 failed, 21 ignored. - Windows 11 (26200), RTX 3060 8 GB, driver 610.88, i9-14900K, 32 GB. - Earlier today, the same resolution in a tree with #267, #456, #468, #503 and #572 as well ran the newer retail title from the README at 29.8 fps after 26 s, window title showing the driver counter, no crash. **Not tested** - This merge alone with the title, `scripts/smoke.ps1`, the workspace suite. A cached blob the driver refuses is recompiled inside the same guard entered with size 0 (not as a big compile): rare, but noted. <details><summary>Resolution (<code>git show --remerge-diff</code> of the merge)</summary> ```diff diff --git a/crates/xcl/src/hle/d3d12x/present.rs b/crates/xcl/src/hle/d3d12x/present.rs remerge CONFLICT (content): Merge conflict in crates/xcl/src/hle/d3d12x/present.rs index 23e1244..8ba22a7 100644 --- a/crates/xcl/src/hle/d3d12x/present.rs +++ b/crates/xcl/src/hle/d3d12x/present.rs @@ -344,7 +344,6 @@ fn window_name() -> String { /// the XCL window's timer for `show_compiling` const COMPILE_TIMER: usize = 0x5C0; -<<<<<<< 6025201 (Merge pull request #771 from gefydev/readme/discord-invite) struct FrameRate { sampled_at: Instant, presented: u64, @@ -371,16 +370,10 @@ impl FrameRate { } } -/// While XCL compiles shaders (DXC, programs the disk cache did not have – the title draws +/// While XCL compiles shaders (DXC or the GPU driver's pipeline compiler, programs the disk cache did not have – the title draws /// nothing with those pipelines meanwhile: after an XCL update the screen stays black while /// thousands recompile), the window's title says so: -/// "XCL – <game> | N FPS | compiling shaders: N running, M done[, Q pipelines queued][, F failed]". -======= -/// While XCL compiles shaders (DXC or the GPU driver's pipeline compiler – the title draws -/// nothing with those pipelines meanwhile: after an XCL update the screen stays black while -/// thousands recompile), the window's title says so: -/// "XCL – <game> | compiling shaders: N dxc, M done[, D driver (C done)][, Q pipelines queued][, F failed]". ->>>>>>> 960162e (D3D12.X: bound driver PSO compile concurrency and surface stage progress) +/// "XCL – <game> | N FPS | compiling shaders: N dxc, M done[, D driver (C done)][, Q pipelines queued][, F failed]". /// It stays 2 s after the last compile (compiles in the title's own calls come one by one), /// then only the game name and presented frame rate remain. unsafe fn show_compiling(hwnd: HWND) { @@ -414,11 +407,7 @@ unsafe fn show_compiling(hwnd: HWND) { }; let queued = if queued > 0 { format!(", {queued} pipelines queued") } else { String::new() }; let failed = if failed > 0 { format!(", {failed} failed") } else { String::new() }; -<<<<<<< 6025201 (Merge pull request #771 from gefydev/readme/discord-invite) - format!("{title} | compiling shaders: {running} running, {done} done{queued}{failed}") -======= - format!("XCL – {title} | compiling shaders: {running} dxc, {done} done{driver}{queued}{failed}") ->>>>>>> 960162e (D3D12.X: bound driver PSO compile concurrency and surface stage progress) + format!("{title} | compiling shaders: {running} dxc, {done} done{driver}{queued}{failed}") } else { title }; diff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs index df2a6d7..e14357a 100644 --- a/crates/xcl/src/hle/d3d12x/pso_async.rs +++ b/crates/xcl/src/hle/d3d12x/pso_async.rs @@ -152,6 +152,11 @@ fn submit_as(standin: usize, compute: bool, job: Job, send: bool, key: u64) { }); if send { enqueue(p); + } else if used::known(key) { + if let Some(q) = preload() { + q.list.lock().unwrap().push_back(p); + q.cv.notify_one(); + } } } @@ -173,11 +178,6 @@ fn mark_enqueued(p: &Pending, queued: &AtomicUsize) -> bool { fn enqueue(p: Arc<Pending>) { if mark_enqueued(&p, &QUEUED) { let _ = queue().lock().unwrap().send(p); - } else if used::known(key) { - if let Some(q) = preload() { - q.list.lock().unwrap().push_back(p); - q.cv.notify_one(); - } } } @@ -434,6 +434,8 @@ mod tests { done: Mutex::new(false), cv: Condvar::new(), compute, + key: 0, + used: Default::default(), orphan: Default::default(), } } diff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs remerge CONFLICT (content): Merge conflict in crates/xcl/src/hle/d3d12x/real.rs index c48b367..04938b3 100644 --- a/crates/xcl/src/hle/d3d12x/real.rs +++ b/crates/xcl/src/hle/d3d12x/real.rs @@ -3509,7 +3509,6 @@ unsafe fn translated_compute_pso(this: *mut c_void, f: PsoFn, desc: *const c_voi copy.pRootSignature = std::mem::transmute::<*mut c_void, std::mem::ManuallyDrop<Option<ID3D12RootSignature>>>(rs); copy.CS = bytecode(&dxil); copy.CachedPSO = D3D12_CACHED_PIPELINE_STATE::default(); -<<<<<<< 6025201 (Merge pull request #771 from gefydev/readme/discord-invite) // A program built again gets the driver's own result of its first build: a retail title // made 14 big compute pipelines twice while loading, 13 - 30 s each the second time. let key = compute_blob_key(&dxil, rs as usize, copy.Flags.0); @@ -3524,12 +3523,9 @@ unsafe fn translated_compute_pso(this: *mut c_void, f: PsoFn, desc: *const c_voi copy.CachedPSO = D3D12_CACHED_PIPELINE_STATE { pCachedBlob: b.as_ptr() as *const c_void, CachedBlobSizeInBytes: b.len() }; } let started = std::time::Instant::now(); - // in the background, one at a time and within the commit left (each ~1.5 GB in the driver) - let _slot = (big && cached.is_none() && std::thread::current().name().is_some_and(|n| n.starts_with("xcl-pso"))).then(|| { - let slot = BIG_COMPILES.acquire(); - wait_for_commit(); - slot - }); + // #214's guard: background-only, one big compile at a time within the commit left, and the + // driver's own concurrency cap; a pipeline with the driver's cached blob is not big (as before) + let guard = DriverCompileGuard::enter(this, if cached.is_some() { 0 } else { dxil.len() }, "CS"); let mut hr = finish_pso(this, f, &copy as *const _ as *const c_void, riid, ppv); if hr < 0 && cached.is_some() { // a blob the driver does not take (another root signature at the same address…): compiled @@ -3540,6 +3536,7 @@ unsafe fn translated_compute_pso(this: *mut c_void, f: PsoFn, desc: *const c_voi copy.CachedPSO = D3D12_CACHED_PIPELINE_STATE::default(); hr = finish_pso(this, f, &copy as *const _ as *const c_void, riid, ppv); } + guard.finish(hr); let reused = hr >= 0 && cached.is_some() && copy.CachedPSO.CachedBlobSizeInBytes != 0; if hr >= 0 && !reused { keep_compute_blob(key, *ppv, dxil.len()); @@ -3549,11 +3546,6 @@ unsafe fn translated_compute_pso(this: *mut c_void, f: PsoFn, desc: *const c_voi } else if reused && from_disk { driver_cache::note(true, None); } -======= - let guard = DriverCompileGuard::enter(this, dxil.len(), "CS"); - let hr = finish_pso(this, f, &copy as *const _ as *const c_void, riid, ppv); - guard.finish(hr); ->>>>>>> 960162e (D3D12.X: bound driver PSO compile concurrency and surface stage progress) if hr < 0 { note_translation_error(format!("the driver rejected the compute PSO with the translated CS ({hr:#x})")); return Some(Err(())); ``` </details> AI use: Claude Code with Claude Opus 5.5 resolved the conflicts, ran the tests and wrote this comment.
Author
Owner

@⁠mikebuckets171 on GitHub · 2026-11-24 06:22 UTC · original

A macOS/Wine check of this head, from the bench described in #258 (M5 Pro, 48 GB, CrossOver 26 + D3DMetal 3.0, DXC 1.9.2609, Wine, no Windows machine here) — and the reason I came: I had written the same fix you have here.

I was preparing a patch for the window title's "N pipelines queued" figure, because pso_async::counts()'s third number is every PENDING entry whose done is false — which includes the lazy stand-ins submit_lazy inserts with sent = false and only sends to the workers at their first resolve. A title that creates thousands of pipelines and never binds most of them therefore showed a large "queued" number next to the compile progress, in the one message that exists to explain a black screen. Then I read this PR: QUEUED with mark_enqueued / finish_pending, and the comment "excludes dormant lazy stand-ins" — that is the fix, done properly and with a test, so my patch is withdrawn and nothing of mine is needed here.

What I ran on this host, on your head 960162e (your commits on your base 4017f8f; note it is not mergeable against current main beaa245 at the moment, so these counts describe your head as it is, not a rebased version):

  • Cross-build for the Wine target, which is what a macOS/Linux host compiles with: cargo build --workspace --target x86_64-pc-windows-gnullvm (LLVM-MinGW 20261117 as the linker) — green, 17 s, one warning the Windows build already prints. cargo test --no-run --release → 16 test executables. Nothing in your diff needs an MSVC-only construct.
  • Your new test, run under Wine in the CrossOver bottle: hle::d3d12x::pso_async::tests::dormant_lazy_pipelines_are_not_counted_as_queued → passed (0 failed). So the accounting you added is correct on a host that is not Windows, which is the part I could check.
  • The whole lib unit binary under Wine on this host: 184 tests started, 144 passed, 13 failed, 0 skipped before a 300 s cap — the run does not finish here because some GPU tests hang on D3DMetal (157 of the 184 reached an outcome). The 13 failures are the gpu_*_f64 family plus gpu_atomic_fcmpswap_x2, gpu_atomic_fmin_fmax_x2, gpu_clamp_and_omod_per_instruction, gpu_bvh64_intersect_ray_across_memory_windows_and_grazing, gpu_memory_windows_above_4_gib: measured today on the same host with the same binary built from main and from two other heads, it gives 14 failures from the same families, so they belong to the host and not to this PR.

If it is useful as this PR stands: I can also run your head against main here and post a 60–90 s pair from a host where this title really draws frames (Ahmet's Mac port, cherry-picked), which is the one regression signal no Windows machine in this thread can produce. Say the word.

**@⁠mikebuckets171** on GitHub · 2026-11-24 06:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/214#issuecomment-7123871196) A macOS/Wine check of this head, from the bench described in #258 (M5 Pro, 48 GB, CrossOver 26 + D3DMetal 3.0, DXC 1.9.2609, Wine, no Windows machine here) — and the reason I came: I had written the same fix you have here. I was preparing a patch for the window title's "N pipelines queued" figure, because `pso_async::counts()`'s third number is every `PENDING` entry whose `done` is false — which includes the lazy stand-ins `submit_lazy` inserts with `sent = false` and only sends to the workers at their first `resolve`. A title that creates thousands of pipelines and never binds most of them therefore showed a large "queued" number next to the compile progress, in the one message that exists to explain a black screen. Then I read this PR: `QUEUED` with `mark_enqueued` / `finish_pending`, and the comment "excludes dormant lazy stand-ins" — that is the fix, done properly and with a test, so **my patch is withdrawn** and nothing of mine is needed here. What I ran on this host, on your head `960162e` (your commits on your base `4017f8f`; note it is not mergeable against current `main` `beaa245` at the moment, so these counts describe your head as it is, not a rebased version): - Cross-build for the Wine target, which is what a macOS/Linux host compiles with: `cargo build --workspace --target x86_64-pc-windows-gnullvm` (LLVM-MinGW 20261117 as the linker) — **green, 17 s**, one warning the Windows build already prints. `cargo test --no-run --release` → **16 test executables**. Nothing in your diff needs an MSVC-only construct. - Your new test, run under Wine in the CrossOver bottle: `hle::d3d12x::pso_async::tests::dormant_lazy_pipelines_are_not_counted_as_queued` → **passed** (0 failed). So the accounting you added is correct on a host that is not Windows, which is the part I could check. - The whole lib unit binary under Wine on this host: 184 tests started, **144 passed, 13 failed, 0 skipped** before a 300 s cap — the run does not finish here because some GPU tests hang on D3DMetal (157 of the 184 reached an outcome). The 13 failures are the `gpu_*_f64` family plus `gpu_atomic_fcmpswap_x2`, `gpu_atomic_fmin_fmax_x2`, `gpu_clamp_and_omod_per_instruction`, `gpu_bvh64_intersect_ray_across_memory_windows_and_grazing`, `gpu_memory_windows_above_4_gib`: measured today on the same host with the same binary built from `main` and from two other heads, it gives 14 failures from the same families, so they belong to the host and not to this PR. If it is useful as this PR stands: I can also run your head against `main` here and post a 60–90 s pair from a host where this title really draws frames (Ahmet's Mac port, cherry-picked), which is the one regression signal no Windows machine in this thread can produce. Say the word.
Author
Owner

@⁠heretic1321 on GitHub · 2026-11-24 09:46 UTC · original

Rebased cleanly onto upstream/main (6bac4b4) at 8e32beaf0c6c2d53c77df637a2cf02070f42f594 (0 errors, 0 warnings on AR_x86_64_pc_windows_msvc=llvm-ar cargo check --release --workspace and --tests).

Thank you @⁠woreksami and @⁠mikebuckets171 for the runs and detailed notes:

  • @⁠woreksami (conflict resolution + rejected-blob edge case): Applied your conflict resolution across present.rs (#516 FPS window title), pso_async.rs (#690 preload in submit_as + new_pending fields), and real.rs (#634/#636 compute_blob + driver_cache). Also fixed the edge case you flagged: if finish_pso rejects a cached blob (hr < 0 && cached.is_some()), guard.discard() drops the size-0 guard without incrementing DRIVER_COMPILING[1] or logging, and DriverCompileGuard::enter(this, dxil.len(), "CS") re-enters with the full DXIL size before the cold retry so big shaders still take BIG_COMPILES + wait_for_commit().
  • @⁠mikebuckets171 (Wine cross-check + pso_async::counts()): Thanks for checking 960162e under Wine and withdrawing the duplicate patch. Note that is_background_pso_worker_name (starts_with("xcl-pso-") && != "xcl-pso-urgent") also covers #690's new xcl-pso-pre-N preload threads (covered by a unit assertion) while leaving title threads and xcl-pso-urgent exempt. If you're able to run a 60–90 s macOS/Wine comparison on 8e32bea vs main, that signal would be very welcome too.

What is still needed to merge: a Windows scripts/smoke.ps1 pair (main vs 8e32bea) and a full Windows cargo test --workspace -- --test-threads=4 run on 8e32bea (no Windows GPU host here). If anyone on Windows can run 8e32bea against main 6bac4b4 and paste both xcl-smoke blocks, we can add them directly under Regression run.

**@⁠heretic1321** on GitHub · 2026-11-24 09:46 UTC · [original](https://github.com/xcl-dev/xcl/pull/214#issuecomment-7127869027) Rebased cleanly onto `upstream/main` (`6bac4b4`) at `8e32beaf0c6c2d53c77df637a2cf02070f42f594` (0 errors, 0 warnings on `AR_x86_64_pc_windows_msvc=llvm-ar cargo check --release --workspace` and `--tests`). Thank you @⁠woreksami and @⁠mikebuckets171 for the runs and detailed notes: - **@⁠woreksami (conflict resolution + rejected-blob edge case):** Applied your conflict resolution across `present.rs` (`#516` FPS window title), `pso_async.rs` (`#690` `preload` in `submit_as` + `new_pending` fields), and `real.rs` (`#634`/`#636` `compute_blob` + `driver_cache`). Also fixed the edge case you flagged: if `finish_pso` rejects a cached blob (`hr < 0 && cached.is_some()`), `guard.discard()` drops the size-0 guard without incrementing `DRIVER_COMPILING[1]` or logging, and `DriverCompileGuard::enter(this, dxil.len(), "CS")` re-enters with the full DXIL size before the cold retry so big shaders still take `BIG_COMPILES` + `wait_for_commit()`. - **@⁠mikebuckets171 (Wine cross-check + `pso_async::counts()`):** Thanks for checking `960162e` under Wine and withdrawing the duplicate patch. Note that `is_background_pso_worker_name` (`starts_with("xcl-pso-") && != "xcl-pso-urgent"`) also covers `#690`'s new `xcl-pso-pre-N` preload threads (covered by a unit assertion) while leaving title threads and `xcl-pso-urgent` exempt. If you're able to run a 60–90 s macOS/Wine comparison on `8e32bea` vs `main`, that signal would be very welcome too. **What is still needed to merge:** a Windows `scripts/smoke.ps1` pair (`main` vs `8e32bea`) and a full Windows `cargo test --workspace -- --test-threads=4` run on `8e32bea` (no Windows GPU host here). If anyone on Windows can run `8e32bea` against `main` `6bac4b4` and paste both `xcl-smoke` blocks, we can add them directly under **Regression run**.
Author
Owner

@⁠heretic1321 on GitHub · 2026-11-24 12:01 UTC · original

Rebased again onto upstream/main 47efa2e (head 96e68a4), because the branch had drifted 34 commits and Pending gained a new field on main.

  • cargo check --release --workspace and --tests, x86_64-pc-windows-msvc: 0 errors, 0 warnings on the new head
  • PR description is red only on the two xcl-smoke blocks, as before

The CI run on 96e68a4 is sitting in action_required (fork workflow approval) — it needs a maintainer to approve it before it can report anything. Windows/GPU testers are still wanted for scripts/smoke.ps1 on main vs 96e68a4.

**@⁠heretic1321** on GitHub · 2026-11-24 12:01 UTC · [original](https://github.com/xcl-dev/xcl/pull/214#issuecomment-7130858023) Rebased again onto `upstream/main` `47efa2e` (head `96e68a4`), because the branch had drifted 34 commits and `Pending` gained a new field on `main`. - `cargo check --release --workspace` and `--tests`, `x86_64-pc-windows-msvc`: 0 errors, 0 warnings on the new head - `PR description` is red only on the two `xcl-smoke` blocks, as before The `CI` run on `96e68a4` is sitting in `action_required` (fork workflow approval) — it needs a maintainer to approve it before it can report anything. Windows/GPU testers are still wanted for `scripts/smoke.ps1` on `main` vs `96e68a4`.
Author
Owner

@⁠Toons29 on GitHub · 2026-11-25 02:52 UTC · original

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

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: 96e68a46b2b2b5bca88a24bb4b60ba9ea18406c3
gpu: AMD Radeon RX 9070
title: game.exe
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: 14812 MB

Against the limits in CONTRIBUTING.md: 101 % of main's frames, 100 % 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; I checked the blocks before posting.

**@⁠Toons29** on GitHub · 2026-11-25 02:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/214#issuecomment-7151307740) Regression run of `96e68a46` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: 96e68a46b2b2b5bca88a24bb4b60ba9ea18406c3 gpu: AMD Radeon RX 9070 title: game.exe 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: 14812 MB ``` Against the limits in CONTRIBUTING.md: 101 % of `main`'s frames, 100 % 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`; I checked the blocks before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 15:19 UTC · original

Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

**@⁠DavidM1911** on GitHub · 2026-11-25 15:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/214#issuecomment-7166669781) Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
Author
Owner

@⁠GodlyBDS on GitHub · 2026-11-26 04:04 UTC · original

Independent confirmation of the status-reporting gap on a newer build. On RTX 3090 Ti / NVIDIA 621.40 / Windows 10, e877812e from #2624 displayed 0 running, 602 done for an extended interval. During that same interval the recording thread passed repeatedly through nvgpucomp64.dll and the native PSO log showed distinct cold compute builds completing every 15–25 seconds. The on-disk native cache continued to grow while the title-bar counters stayed constant.

The current title-bar code reads dxc::compile_counts(). Reading an independent native-driver counter alongside DXC would make an active compile distinguishable from a frozen application in this case. The diagnostic part of this PR covers that distinction. I have only verified the problem on the newer build and have not applied this PR. The measured foreground interval and its relation to world loading are recorded in the #2624 report.

AI use: OpenAI Codex (GPT-6) correlated the display and native compilation logs.

**@⁠GodlyBDS** on GitHub · 2026-11-26 04:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/214#issuecomment-7182270305) Independent confirmation of the status-reporting gap on a newer build. On RTX 3090 Ti / NVIDIA 621.40 / Windows 10, `e877812e` from #2624 displayed `0 running, 602 done` for an extended interval. During that same interval the recording thread passed repeatedly through `nvgpucomp64.dll` and the native PSO log showed distinct cold compute builds completing every 15–25 seconds. The on-disk native cache continued to grow while the title-bar counters stayed constant. The current title-bar code reads `dxc::compile_counts()`. Reading an independent native-driver counter alongside DXC would make an active compile distinguishable from a frozen application in this case. The diagnostic part of this PR covers that distinction. I have only verified the problem on the newer build and have not applied this PR. The measured foreground interval and its relation to world loading are recorded in [the #2624 report](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2624). AI use: OpenAI Codex (GPT-6) correlated the display and native compilation logs.
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/214/head:github-bot/gh-214'
git switch 'github-bot/gh-214'

Merge

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