D3D12.X: a worker waiting for a big compile turn leaves the queue to a helper #2618

Closed
KOLESNiii wants to merge 1 commit from upstream-pr/2628 into main
KOLESNiii commented 2026-11-26 03:10:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-26T03:10:35Z.


A huge driver compile on an xcl-pso worker waits in big_compile_turn for one of the few slots (one at a time by default, 3 GB of free commit each), and it keeps its worker thread while it waits. When the retail title of #505 starts its world, every worker takes one of the title's huge compute programs and waits there, with only one or two of them compiling, so the rest of the queue has no worker. With this change, a pool thread that has to wait gets a helper thread in its place (a helper that parks too gets one of its own, up to 4 helpers per worker), so as many threads as the pool has keep serving the queue. A helper leaves once a parked thread is back. The slots and the commit check are unchanged, so no more driver compiles run at once than before. This is not "more workers" in the sense #2088 warns against.

On the retail title of #505, this does not measurably speed up pipeline builds on my machine (see Tested): the PR fixes the stall that the test reproduces, not the title's long wait for frames.

Part of #1269, #2088 (scheduling).

What is in it

  • crates/xcl/src/hle/d3d12x/pso_async.rs:
    • The queue is one Mutex + Condvar holding the work and the counts of parked workers and helpers, instead of an mpsc channel. Nobody holds the lock while waiting for work.
    • parked() returns a guard. On a pool worker it counts the worker as parked and starts a helper (xcl-pso-h{n}, numbered in start order) while there are fewer helpers than parked threads (workers and helpers), up to MOST_HELPERS_PER_WORKER (4) × the pool size. Off the pool, it does nothing.
    • A helper leaves when there are more helpers than parked threads. That check and a thread's parking happen under the same lock, and a thread that comes back wakes the idle helpers only when one can leave.
    • Two tests:
      • workers_parked_for_big_compiles_leave_the_queue_to_helpers: parks every worker and as many helpers, checks that a job queued behind them still runs, and that the counts return to 0 with no new work; twice. Without the change, that job never runs; with the helpers capped at the pool size, it fails too.
      • parked_outside_the_pool_starts_no_helper.
  • crates/xcl/src/hle/d3d12x/real.rs: big_compile_turn takes the guard before its first wait (outside the slots' lock) and holds it until it gets its slot.

Tested

  • RTX 2070 SUPER 8 GB (Turing, wave32 only), driver 32.0.16.2140; Ryzen 5 3600XT (6 cores / 12 threads); 32 GB RAM; Windows 11 build 26300; rustc 1.100.0; DXC 1.9.2609.5.
  • cargo test --workspace -- --test-threads=4 on 8cdbc6c (the same tree as the head 16bf648, which only changes the commit message): 1431 passed, 0 failed, 47 ignored; 25 SKIPPED checks: 21 "no wave64", 3 f16 per-lane forms refused (#1426), 1 "no heap windows"
  • cargo test -p xcl --lib parked, 30 runs with XCL_DXC_THREADS 1, 2 and 3: 0 failures.
  • Retail title of #505 (1.0.2.1), cold, release build, A/B of main 08db802 and 8cdbc6c:
    • Setup:

      • a fresh empty XCL_DXIL_CACHE
      • the NVIDIA / D3D12 implicit shader caches off (a local experiment-only ShaderCacheControl call, the same in both trees, not in this PR)
      • XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_PSO_TRACE=1
      • 780 s runs, the game started by hand
    • Results, one run each, from xcl.log. The world load started at 314 s in the main run and at 184 s in this PR's, so the main log covers only 464 s after it, and the table stops at 420 s:

      pipelines built after the world load starts main this PR
      first 60 s 101 93
      first 180 s 187 185
      first 300 s 267 280
      first 420 s 342 336
      builds on the title's threads (whole run) 120, 271 s 129, 272 s
      helpers started – 32 or more
      peak commit 31.5 GB 30.6 GB
      exit / device removal / crash 0 / none / none 0 / none / none
    • Helpers start, but the build rate is the same within run-to-run noise. Frames do not come back after the world load in either run. Most of the title's own waiting is graphics pipelines built at a draw's first bind, which #1798 addresses. An earlier A/B of the first version of this PR (helpers capped at the pool size) showed +7 % builds over 600 s; that window does not fit both runs here, and with one run each it may have been noise.

Regression run

main:

xcl-smoke v1
commit: 08db8020d323bf478964fcc586152cce54959cfc
gpu: NVIDIA GeForce RTX 2070 SUPER
title: 3c290c16
seconds: 120
exit: 0x0
frames shown: 3272 (PresentX 3273)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 16721 MB

This PR:

xcl-smoke v1
commit: 16bf648b61df518d8559f2d887f1e74e6e8d37db
gpu: NVIDIA GeForce RTX 2070 SUPER
title: 3c290c16
seconds: 120
exit: 0x0
frames shown: 3263 (PresentX 3263)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17390 MB

Not tested

  • The smoke title does not reach a big compile: no helper was started in its 120 s, so the smoke run covers only the code paths that are unchanged.
  • One cold run per tree, with the world load started at different times; warm caches or after an offline precompile; AMD; wave64 GPUs.
  • main has moved by 17 commits since 08db802. The PR merges into it without conflicts, but it was not rebased or rerun on it.

AI use

  • Claude Code with Claude Opus 5.5:
    • found the stall in a Tracy trace
    • wrote the change, the tests and this description
    • ran the suite, the smoke runs and the A/B runs
  • I started the game in each A/B run.

🤖 Generated with Claude Code

https://claude.ai/code/session_015csBcd63KUE2T1kW2P15nC

<!-- greyfinch-sync:ivall/xcl:issue:5503287540 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2628). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-26T03:10:35Z. --- A huge driver compile on an `xcl-pso` worker waits in `big_compile_turn` for one of the few slots (one at a time by default, 3 GB of free commit each), and it keeps its worker thread while it waits. When the retail title of #505 starts its world, every worker takes one of the title's huge compute programs and waits there, with only one or two of them compiling, so the rest of the queue has no worker. With this change, a pool thread that has to wait gets a helper thread in its place (a helper that parks too gets one of its own, up to 4 helpers per worker), so as many threads as the pool has keep serving the queue. A helper leaves once a parked thread is back. The slots and the commit check are unchanged, so no more driver compiles run at once than before. This is not "more workers" in the sense #2088 warns against. On the retail title of #505, this does not measurably speed up pipeline builds on my machine (see **Tested**): the PR fixes the stall that the test reproduces, not the title's long wait for frames. Part of #1269, #2088 (scheduling). **What is in it** - `crates/xcl/src/hle/d3d12x/pso_async.rs`: - The queue is one `Mutex` + `Condvar` holding the work and the counts of parked workers and helpers, instead of an `mpsc` channel. Nobody holds the lock while waiting for work. - `parked()` returns a guard. On a pool worker it counts the worker as parked and starts a helper (`xcl-pso-h{n}`, numbered in start order) while there are fewer helpers than parked threads (workers and helpers), up to `MOST_HELPERS_PER_WORKER` (4) × the pool size. Off the pool, it does nothing. - A helper leaves when there are more helpers than parked threads. That check and a thread's parking happen under the same lock, and a thread that comes back wakes the idle helpers only when one can leave. - Two tests: - `workers_parked_for_big_compiles_leave_the_queue_to_helpers`: parks every worker and as many helpers, checks that a job queued behind them still runs, and that the counts return to 0 with no new work; twice. Without the change, that job never runs; with the helpers capped at the pool size, it fails too. - `parked_outside_the_pool_starts_no_helper`. - `crates/xcl/src/hle/d3d12x/real.rs`: `big_compile_turn` takes the guard before its first wait (outside the slots' lock) and holds it until it gets its slot. **Tested** - RTX 2070 SUPER 8 GB (Turing, wave32 only), driver 32.0.16.2140; Ryzen 5 3600XT (6 cores / 12 threads); 32 GB RAM; Windows 11 build 26300; rustc 1.100.0; DXC 1.9.2609.5. - `cargo test --workspace -- --test-threads=4` on `8cdbc6c` (the same tree as the head `16bf648`, which only changes the commit message): 1431 passed, 0 failed, 47 ignored; 25 `SKIPPED` checks: 21 "no wave64", 3 f16 per-lane forms refused (#1426), 1 "no heap windows" - `cargo test -p xcl --lib parked`, 30 runs with `XCL_DXC_THREADS` 1, 2 and 3: 0 failures. - Retail title of #505 (1.0.2.1), cold, release build, A/B of `main` `08db802` and `8cdbc6c`: - Setup: - a fresh empty `XCL_DXIL_CACHE` - the NVIDIA / D3D12 implicit shader caches off (a local experiment-only `ShaderCacheControl` call, the same in both trees, not in this PR) - `XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_PSO_TRACE=1` - 780 s runs, the game started by hand - Results, one run each, from `xcl.log`. The world load started at 314 s in the `main` run and at 184 s in this PR's, so the `main` log covers only 464 s after it, and the table stops at 420 s: | pipelines built after the world load starts | `main` | this PR | |---|---|---| | first 60 s | 101 | 93 | | first 180 s | 187 | 185 | | first 300 s | 267 | 280 | | first 420 s | 342 | 336 | | builds on the title's threads (whole run) | 120, 271 s | 129, 272 s | | helpers started | – | 32 or more | | peak commit | 31.5 GB | 30.6 GB | | exit / device removal / crash | 0 / none / none | 0 / none / none | - Helpers start, but the build rate is the same within run-to-run noise. Frames do not come back after the world load in either run. Most of the title's own waiting is graphics pipelines built at a draw's first bind, which #1798 addresses. An earlier A/B of the first version of this PR (helpers capped at the pool size) showed +7 % builds over 600 s; that window does not fit both runs here, and with one run each it may have been noise. **Regression run** `main`: ``` xcl-smoke v1 commit: 08db8020d323bf478964fcc586152cce54959cfc gpu: NVIDIA GeForce RTX 2070 SUPER title: 3c290c16 seconds: 120 exit: 0x0 frames shown: 3272 (PresentX 3273) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 16721 MB ``` This PR: ``` xcl-smoke v1 commit: 16bf648b61df518d8559f2d887f1e74e6e8d37db gpu: NVIDIA GeForce RTX 2070 SUPER title: 3c290c16 seconds: 120 exit: 0x0 frames shown: 3263 (PresentX 3263) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17390 MB ``` **Not tested** - The smoke title does not reach a big compile: no helper was started in its 120 s, so the smoke run covers only the code paths that are unchanged. - One cold run per tree, with the world load started at different times; warm caches or after an offline precompile; AMD; wave64 GPUs. - `main` has moved by 17 commits since `08db802`. The PR merges into it without conflicts, but it was not rebased or rerun on it. **AI use** - Claude Code with Claude Opus 5.5: - found the stall in a Tracy trace - wrote the change, the tests and this description - ran the suite, the smoke runs and the A/B runs - I started the game in each A/B run. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015csBcd63KUE2T1kW2P15nC
GodlyBDS commented 2026-11-26 04:07:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by GodlyBDS on 2026-11-26T03:25:56Z.


Independent Ampere trace relevant to the worker-gate change. RTX 3090 Ti, driver 621.40, Windows 10, 32 GiB RAM. This was e877812e from #2624 with the local Windows startup compatibility fixes, four named PSO workers, XCL_HUGE_PSO_CONCURRENCY=1, and on-demand compilation. I have not applied #2628 to this run.

For 31 gated compute compiles completing from 225 to 380 s, the median recorded gate wait was 10.441 s and the median time in the driver was 4.941 s. The longest recorded gate wait was 47.588 s, followed by 5.006 s of native compilation. Correlating the driver starts with their measured gate durations shows three of the four PSO workers waiting at the gate concurrently. The 435.403 s summed across workers is overlapping time, not wall time.

The title stopped presenting for this interval while compiles continued to finish. The trace establishes substantial worker occupancy at the gate on Ampere under the conservative compile limit. It does not establish how much of the Present gap a helper would remove. The experiment was left running while the queue progressed.

AI use: OpenAI Codex (GPT-6) correlated the log events and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7181713792 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2628#issuecomment-7181713792). Originally posted by [GodlyBDS](https://github.com/GodlyBDS) on 2026-11-26T03:25:56Z. --- Independent Ampere trace relevant to the worker-gate change. RTX 3090 Ti, driver 621.40, Windows 10, 32 GiB RAM. This was `e877812e` from #2624 with the local Windows startup compatibility fixes, four named PSO workers, `XCL_HUGE_PSO_CONCURRENCY=1`, and on-demand compilation. **I have not applied #2628 to this run.** For 31 gated compute compiles completing from 225 to 380 s, the median recorded gate wait was **10.441 s** and the median time in the driver was **4.941 s**. The longest recorded gate wait was **47.588 s**, followed by **5.006 s** of native compilation. Correlating the driver starts with their measured gate durations shows **three of the four** PSO workers waiting at the gate concurrently. The 435.403 s summed across workers is overlapping time, not wall time. The title stopped presenting for this interval while compiles continued to finish. The trace establishes substantial worker occupancy at the gate on Ampere under the conservative compile limit. It does not establish how much of the Present gap a helper would remove. The experiment was left running while the queue progressed. AI use: OpenAI Codex (GPT-6) correlated the log events and drafted this report.
pickles976 commented 2026-11-26 04:07:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-26T03:26:38Z.


Wine 11.0, XCL_DXC_THREADS=2, exact head 3693d9efe41c7f69b4f4d9a04b98c66ab6a94b7d, Windows-target cargo test --locked --target x86_64-pc-windows-msvc -p xcl --lib parked -- --nocapture --test-threads=1: 3 pass, 1 fail. workers_parked_for_big_compiles_leave_the_queue_to_helpers starts two helpers and executes the queued job, but pso_async.rs:1175 observes PARKED=2 immediately after releasing the workers, before they finish, and asserts PARKED==0. The test waits only while HELPERS > PARKED (:1172), which is false when both equal 2. This is a test synchronization race, not evidence that the queue helper failed.

Test-only diagnostic: replace the wait condition with (PARKED.load(Acquire) != 0 || HELPERS.load(Acquire) != 0) under the existing 10 s deadline, then assert both zero. The focused test passed 1/1 in 0.26 s after this change; the temporary edit was restored. Please make that bounded wait in the PR test so a slower scheduler is not a false negative. Local logs: .compat-xcl/logs/verify-pr2628-wine-two-worker-helper{,-wait-fix}.log (not attached). No actual large driver compile or retail title was exercised; your reported ~1.1 GB higher smoke peak commit makes this unsuitable as a 16 GiB RAM reduction without a guarded A/B.

<!-- greyfinch-sync:ivall/xcl:comment:7181723939 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2628#issuecomment-7181723939). Originally posted by [pickles976](https://github.com/pickles976) on 2026-11-26T03:26:38Z. --- Wine 11.0, `XCL_DXC_THREADS=2`, exact head `3693d9efe41c7f69b4f4d9a04b98c66ab6a94b7d`, Windows-target `cargo test --locked --target x86_64-pc-windows-msvc -p xcl --lib parked -- --nocapture --test-threads=1`: **3 pass, 1 fail**. `workers_parked_for_big_compiles_leave_the_queue_to_helpers` starts two helpers and executes the queued job, but `pso_async.rs:1175` observes `PARKED=2` immediately after releasing the workers, before they finish, and asserts `PARKED==0`. The test waits only while `HELPERS > PARKED` (`:1172`), which is false when both equal 2. This is a test synchronization race, not evidence that the queue helper failed. Test-only diagnostic: replace the wait condition with `(PARKED.load(Acquire) != 0 || HELPERS.load(Acquire) != 0)` under the existing 10 s deadline, then assert both zero. The focused test passed **1/1 in 0.26 s** after this change; the temporary edit was restored. Please make that bounded wait in the PR test so a slower scheduler is not a false negative. Local logs: `.compat-xcl/logs/verify-pr2628-wine-two-worker-helper{,-wait-fix}.log` (not attached). No actual large driver compile or retail title was exercised; your reported ~1.1 GB higher smoke peak commit makes this unsuitable as a 16 GiB RAM reduction without a guarded A/B.
luckyteagirl commented 2026-11-26 05:52:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T05:52:04Z.

Review: COMMENTED


Could helper retirement and park admission use one synchronized state? A retiring helper can read HELPERS=1 and PARKED=0, then pause before its CAS. The worker can park again, increment PARKED to 1, see HELPERS=1, and start no replacement. The helper's CAS from 1 to 0 then succeeds and it exits. With XCL_DXC_THREADS=1, the final state is one parked worker and no helper, so a queued small build is unserved until the big-compile wait ends. This is a sequentially consistent interleaving; stronger atomic ordering alone would not close it. A controlled retirement/new-park overlap should assert a helper remains available for a later job. Exact-head source review at 3693d9efe41c7f69b4f4d9a04b98c66ab6a94b7d; no live stall reproduction. AI-assisted review with Codex.

<!-- greyfinch-sync:ivall/xcl:review:6069174443 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2628#pullrequestreview-6069174443). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T05:52:04Z. **Review:** COMMENTED --- Could helper retirement and park admission use one synchronized state? A retiring helper can read `HELPERS=1` and `PARKED=0`, then pause before its CAS. The worker can park again, increment `PARKED` to 1, see `HELPERS=1`, and start no replacement. The helper's CAS from 1 to 0 then succeeds and it exits. With `XCL_DXC_THREADS=1`, the final state is one parked worker and no helper, so a queued small build is unserved until the big-compile wait ends. This is a sequentially consistent interleaving; stronger atomic ordering alone would not close it. A controlled retirement/new-park overlap should assert a helper remains available for a later job. Exact-head source review at `3693d9efe41c7f69b4f4d9a04b98c66ab6a94b7d`; no live stall reproduction. AI-assisted review with Codex.
KDenKC commented 2026-11-26 07:03:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-26T06:06:49Z.


Source review of head 3693d9ef, no run. One small thing about helper retirement in serve (pso_async.rs):

A base worker waits with rx.lock().unwrap().recv(), so an idle one keeps the INBOX mutex for as long as the queue is empty. A helper that wants to time out and reach retire_helper() first needs that mutex for its recv_timeout(250 ms). While a worker that came back from its turn is idle in recv(), the helpers block on lock() instead, and they only retire once new work wakes that worker. Building is unaffected; the helpers' threads (64 MiB stack reservations) just linger through idle periods. Taking work with try_recv / recv_timeout on the base workers too, or a Condvar queue instead of Mutex<Receiver>, would let them leave on time.

Not tested: no build or run of this head on our side.

AI use: Gemini (Antigravity) flagged it in a first-pass review; Claude Code (Claude Opus 5.5) checked it against the source at 3693d9ef and wrote this.

<!-- greyfinch-sync:ivall/xcl:comment:7184104546 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2628#issuecomment-7184104546). Originally posted by [KDenKC](https://github.com/KDenKC) on 2026-11-26T06:06:49Z. --- Source review of head `3693d9ef`, no run. One small thing about helper retirement in `serve` (`pso_async.rs`): A base worker waits with `rx.lock().unwrap().recv()`, so an idle one keeps the `INBOX` mutex for as long as the queue is empty. A helper that wants to time out and reach `retire_helper()` first needs that mutex for its `recv_timeout(250 ms)`. While a worker that came back from its turn is idle in `recv()`, the helpers block on `lock()` instead, and they only retire once new work wakes that worker. Building is unaffected; the helpers' threads (64 MiB stack reservations) just linger through idle periods. Taking work with `try_recv` / `recv_timeout` on the base workers too, or a `Condvar` queue instead of `Mutex<Receiver>`, would let them leave on time. Not tested: no build or run of this head on our side. AI use: Gemini (Antigravity) flagged it in a first-pass review; Claude Code (Claude Opus 5.5) checked it against the source at `3693d9ef` and wrote this.
KOLESNiii commented 2026-11-26 13:05:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-26T12:09:42Z.


@GodlyBDS Thanks for the Ampere trace. Three of four workers waiting at the gate at the same time, with a median gate wait of 10.4 s against 4.9 s in the driver, is the case this PR is for. As you say, it doesn't show how much of the Present gap a helper would close; on Turing most of what is left is the graphics pipelines built at first bind (#1798).

AI use: Claude Code (Claude Opus 5.5) drafted this reply.

<!-- greyfinch-sync:ivall/xcl:comment:7191644397 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2628#issuecomment-7191644397). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-26T12:09:42Z. --- @GodlyBDS Thanks for the Ampere trace. Three of four workers waiting at the gate at the same time, with a median gate wait of 10.4 s against 4.9 s in the driver, is the case this PR is for. As you say, it doesn't show how much of the Present gap a helper would close; on Turing most of what is left is the graphics pipelines built at first bind (#1798). AI use: Claude Code (Claude Opus 5.5) drafted this reply.
KOLESNiii commented 2026-11-26 13:05:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-26T12:09:44Z.


@pickles976 Thanks, confirmed and fixed in 8b15bae. The test now waits until both counts are 0 (same 10 s limit) and then checks both. I also ran cargo test -p xcl --lib parked 30 times with XCL_DXC_THREADS 1, 2 and 3: 0 failures (RTX 2070 SUPER, Windows 11 26300). About peak commit: the smoke run on the new head peaked at 17338 MB, against 17249 MB on main (one run each). The smoke title doesn't reach a big compile, though, so this says nothing about commit while helpers are running.

AI use: Claude Code (Claude Opus 5.5) wrote the fix and this reply.

<!-- greyfinch-sync:ivall/xcl:comment:7191644857 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2628#issuecomment-7191644857). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-26T12:09:44Z. --- @pickles976 Thanks, confirmed and fixed in `8b15bae`. The test now waits until both counts are 0 (same 10 s limit) and then checks both. I also ran `cargo test -p xcl --lib parked` 30 times with `XCL_DXC_THREADS` 1, 2 and 3: 0 failures (RTX 2070 SUPER, Windows 11 26300). About peak commit: the smoke run on the new head peaked at 17338 MB, against 17249 MB on `main` (one run each). The smoke title doesn't reach a big compile, though, so this says nothing about commit while helpers are running. AI use: Claude Code (Claude Opus 5.5) wrote the fix and this reply.
KOLESNiii commented 2026-11-26 13:05:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-26T12:09:45Z.


@KDenKC Right, an idle base worker in recv() kept the lock, so the helpers couldn't get to their timeout. Fixed in 8b15bae: the queue is now one Mutex + Condvar instead of Mutex<Receiver>, so nobody holds the lock while waiting, and a worker that comes back from its turn wakes the idle helpers, which then leave. The test now also checks that the helpers leave with no new work queued.

AI use: Claude Code (Claude Opus 5.5) wrote the fix and this reply.

<!-- greyfinch-sync:ivall/xcl:comment:7191645445 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2628#issuecomment-7191645445). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-26T12:09:45Z. --- @KDenKC Right, an idle base worker in `recv()` kept the lock, so the helpers couldn't get to their timeout. Fixed in `8b15bae`: the queue is now one `Mutex` + `Condvar` instead of `Mutex<Receiver>`, so nobody holds the lock while waiting, and a worker that comes back from its turn wakes the idle helpers, which then leave. The test now also checks that the helpers leave with no new work queued. AI use: Claude Code (Claude Opus 5.5) wrote the fix and this reply.
KOLESNiii commented 2026-11-26 13:05:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-26T12:09:47Z.


@luckyteagirl Agreed, that interleaving was real. Fixed in 8b15bae: the work, the parked count and the helper count are now under the queue's one lock, so a helper deciding to leave and a worker parking can't overlap. The interleaving can't be forced in a test now that both steps are under the same lock. Instead, the test parks every worker twice, and the second time checks that helpers are started again and that a job queued behind the parked workers still runs.

AI use: Claude Code (Claude Opus 5.5) wrote the fix and this reply.

<!-- greyfinch-sync:ivall/xcl:comment:7191646067 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2628#issuecomment-7191646067). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-26T12:09:47Z. --- @luckyteagirl Agreed, that interleaving was real. Fixed in `8b15bae`: the work, the parked count and the helper count are now under the queue's one lock, so a helper deciding to leave and a worker parking can't overlap. The interleaving can't be forced in a test now that both steps are under the same lock. Instead, the test parks every worker twice, and the second time checks that helpers are started again and that a job queued behind the parked workers still runs. AI use: Claude Code (Claude Opus 5.5) wrote the fix and this reply.
thehollowedone commented 2026-11-26 14:03:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-26T13:55:55Z.


Independent Windows/NVIDIA check of PR head 8b15bae against main b49be18. Windows 11 build 26300, RTX 3080 Ti (621.35), Ryzen 7 9800X3D, rustc 1.99.1 MSVC.

  • cargo build --offline --locked --workspace: passed.
  • cargo test --offline --locked -p xcl --lib parked -- --test-threads=1: 4 passed, 0 failed, 0 ignored with XCL_DXC_THREADS=1. I then repeated that command in 30 fresh processes, 10 each with XCL_DXC_THREADS=1, 2, and 3: all 30 passed. The filter includes the two PSO helper tests and two sparse tests.
  • cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4: 1,431 passed, 0 failed, 47 ignored across 37 test targets. The passed count includes 25 explicit GPU skip notices: 21 no wave64, 3 refused per-lane cases, 1 no heap windows.

The focused test exercised queue handoff and helper retirement under synthetic waits. I did not measure a cold title run, NVIDIA driver compilation time, peak commit with helpers active, or AMD/wave64 behavior. The PR's title A/B predates this queue revision, and its smoke title did not start a helper, so the runtime benefit still needs an exact-head run that reaches the big-compile wait.

AI use: Codex (GPT-6.2 Sol) checked the changed queue and gate paths, ran the tests, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7194037156 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2628#issuecomment-7194037156). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-26T13:55:55Z. --- Independent Windows/NVIDIA check of [PR head `8b15bae`](https://github.com/xcl-dev/xcl/commit/8b15baee713b9403d2fd64b1d6af04c02e1822b9) against [`main` `b49be18`](https://github.com/xcl-dev/xcl/commit/b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7). Windows 11 build 26300, RTX 3080 Ti (621.35), Ryzen 7 9800X3D, rustc 1.99.1 MSVC. - `cargo build --offline --locked --workspace`: passed. - `cargo test --offline --locked -p xcl --lib parked -- --test-threads=1`: 4 passed, 0 failed, 0 ignored with `XCL_DXC_THREADS=1`. I then repeated that command in 30 fresh processes, 10 each with `XCL_DXC_THREADS=1`, `2`, and `3`: all 30 passed. The filter includes the two PSO helper tests and two sparse tests. - `cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4`: 1,431 passed, 0 failed, 47 ignored across 37 test targets. The passed count includes 25 explicit GPU skip notices: 21 no wave64, 3 refused per-lane cases, 1 no heap windows. The focused test exercised queue handoff and helper retirement under synthetic waits. I did not measure a cold title run, NVIDIA driver compilation time, peak commit with helpers active, or AMD/wave64 behavior. The PR's title A/B predates this queue revision, and its smoke title did not start a helper, so the runtime benefit still needs an exact-head run that reaches the big-compile wait. AI use: Codex (GPT-6.2 Sol) checked the changed queue and gate paths, ran the tests, and drafted this report.
KDenKC commented 2026-11-26 16:31:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-26T16:31:50Z.


Checked at 16bf648b: serve now waits on a Condvar over the shared queue, and a helper retires as soon as it holds the lock with more helpers than parked workers (pso_async.rs:~330-346). An idle base worker no longer blocks it. Thanks @KOLESNiii.

AI use: Claude Code (Claude Opus 5.5) checked the source at that head and wrote this.

<!-- greyfinch-sync:ivall/xcl:comment:7197765650 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2628#issuecomment-7197765650). Originally posted by [KDenKC](https://github.com/KDenKC) on 2026-11-26T16:31:50Z. --- Checked at `16bf648b`: `serve` now waits on a `Condvar` over the shared queue, and a helper retires as soon as it holds the lock with more helpers than parked workers (`pso_async.rs:~330-346`). An idle base worker no longer blocks it. Thanks @KOLESNiii. AI use: Claude Code (Claude Opus 5.5) checked the source at that head and wrote this.
KOLESNiii commented 2026-11-26 16:45:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-26T16:45:03Z.


Updated to 16bf648, after a review of the previous head (8b15bae):

  • Helpers could park too, and the queue stalled again. A helper that took a huge compute program waited for a turn like any worker, and new helpers started only while helpers < min(parked, pool size). With 2n huge programs ahead of the graphics pipelines, the queue had no free thread left, just n jobs later than before. Helpers now start while there are fewer helpers than parked threads (workers and helpers), up to 4 × the pool size. The test now parks every worker and as many helpers; with the old cap, its job is never built.
  • big_compile_turn starts the helper with the slots' lock released, not while holding it.
  • Helper threads are numbered in start order, so two can no longer share a name.
  • A thread that comes back wakes the pool only when a helper can leave.

Retail A/B, the new head against main 08db802 (RTX 2070 SUPER, cold, one run each, details in the description): helpers start (32 or more), but the pipelines built after the world load match main's, 336 against 342 in the first 420 s. Frames do not come back in either run. I removed the +7 % claim of the first version: that window does not fit both runs here, and with one run each it may have been noise. What this PR fixes is the stall the test reproduces; the title's long wait is mostly graphics pipelines built at first bind (#1798).

Tests on 8cdbc6c (same tree as 16bf648): cargo test --workspace -- --test-threads=4 1431 passed, 0 failed, 47 ignored, 25 SKIPPED; cargo test -p xcl --lib parked 30 runs with XCL_DXC_THREADS 1–3, 0 failures. The smoke runs (main and 16bf648) are in the description.

AI use: Claude Code (Claude Opus 5.5) did the review, wrote the fixes and this comment, and ran the tests, smoke runs and A/B; I started the game in each A/B run.

<!-- greyfinch-sync:ivall/xcl:comment:7198047544 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2628#issuecomment-7198047544). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-26T16:45:03Z. --- Updated to `16bf648`, after a review of the previous head (`8b15bae`): - **Helpers could park too, and the queue stalled again.** A helper that took a huge compute program waited for a turn like any worker, and new helpers started only while `helpers < min(parked, pool size)`. With 2n huge programs ahead of the graphics pipelines, the queue had no free thread left, just n jobs later than before. Helpers now start while there are fewer helpers than parked threads (workers and helpers), up to 4 × the pool size. The test now parks every worker and as many helpers; with the old cap, its job is never built. - `big_compile_turn` starts the helper with the slots' lock released, not while holding it. - Helper threads are numbered in start order, so two can no longer share a name. - A thread that comes back wakes the pool only when a helper can leave. **Retail A/B, the new head against `main` `08db802`** (RTX 2070 SUPER, cold, one run each, details in the description): helpers start (32 or more), but the pipelines built after the world load match `main`'s, 336 against 342 in the first 420 s. Frames do not come back in either run. I removed the +7 % claim of the first version: that window does not fit both runs here, and with one run each it may have been noise. What this PR fixes is the stall the test reproduces; the title's long wait is mostly graphics pipelines built at first bind (#1798). Tests on `8cdbc6c` (same tree as `16bf648`): `cargo test --workspace -- --test-threads=4` 1431 passed, 0 failed, 47 ignored, 25 `SKIPPED`; `cargo test -p xcl --lib parked` 30 runs with `XCL_DXC_THREADS` 1–3, 0 failures. The smoke runs (`main` and `16bf648`) are in the description. AI use: Claude Code (Claude Opus 5.5) did the review, wrote the fixes and this comment, and ran the tests, smoke runs and A/B; I started the game in each A/B run.
Decodere commented 2026-11-26 17:10:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-26T17:10:52Z.


Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2628 updated head 16bf648b61df518d8559f2d887f1e74e6e8d37db (exact parent & merge-base 08db8020d323bf478964fcc586152cce54959cfc). Measurements and targeted test results only; not a full source review.

Setup

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6 cores / 12 threads), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200
  • Toolchain / caches: rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2609.5, release builds, warm DXIL/pipeline caches, quiet machine (zero concurrent builds/tests during timed runs)
  • Workload: Retail workload title: 29640639 via scripts/smoke.ps1 -Seconds 60 (XCL_NETWORK=0, default flags, no input)

Targeted RTX 4060 release unit & GPU tests (16bf648b)

  • cargo test --release -p xcl --lib parked -- --nocapture across XCL_DXC_THREADS=1, 2, and 3 (3 consecutive runs per setting = 9/9 passes, covering parked_outside_the_pool_starts_no_helper, workers_parked_for_big_compiles_leave_the_queue_to_helpers, and both sparse::tests::flush_parked_* tests):
    • XCL_DXC_THREADS=1: 4 passed, 0 failed, 0 ignored × 3 (0.28 s / 0.28 s / 0.28 s, 0 SKIPPED).
    • XCL_DXC_THREADS=2: 4 passed, 0 failed, 0 ignored × 3 (0.27 s / 0.27 s / 0.28 s, 0 SKIPPED).
    • XCL_DXC_THREADS=3: 4 passed, 0 failed, 0 ignored × 3 (0.27 s / 0.27 s / 0.27 s, 0 SKIPPED).
  • cargo test --release -p xcl --lib hle::d3d12x::pso_async:: (3 consecutive parallel passes): 16 passed, 0 failed, 0 ignored on all 3 passes (1.01 s / 0.71 s / 0.71 s, 0 SKIPPED).
  • cargo test --release -p xcl --lib hle::d3d12x::real::big_compile_tests::: 11 passed, 0 failed, 0 ignored (0.27 s, 0 SKIPPED).

Paired 60 s RTX 4060 smoke (exact parent 08db8020 vs 16bf648b)

Both runs completed cleanly at steady 60/2 s pacing with 0 device removals and 0 crashes (16bf648b vs 08db8020 xcl.log: 6,116 MB peak/end local VRAM on both, 4,651 MB vs 4,683 MB end non-local VRAM, 19,387 vs 19,507 translated draws / 1,024 dispatches with 0 skipped, 128 pipelines built ahead on warm cache).

Exact parent (08db8020):

xcl-smoke v1
commit: 08db8020d323bf478964fcc586152cce54959cfc
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1588 (PresentX 1588)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14000 MB

PR #2628 head (16bf648b):

xcl-smoke v1
commit: 16bf648b61df518d8559f2d887f1e74e6e8d37db
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1583 (PresentX 1583)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13984 MB

Limits of coverage

  • Full workspace test suite was not run on 16bf648b (only the 9 parked passes across XCL_DXC_THREADS=1,2,3, 3 parallel passes of hle::d3d12x::pso_async::, big_compile_tests::, release build, and exact-parent paired 60 s smokes).
  • The 60 s smoke ran with warm DXIL/pipeline caches, so live helper spawning under cold multi-minute giant compute PSO compiles was not triggered during the smoke; worker/helper handoff and non-parking behavior were exercised by the targeted pso_async unit tests across XCL_DXC_THREADS=1,2,3.
  • Single discrete NVIDIA 8 GB GPU (RTX 4060) on native Windows 11; no AMD, Intel, or Wine/Linux run on this host.

AI use

Ran the targeted release tests across XCL_DXC_THREADS=1,2,3, release build, and exact-parent paired quiet 60 s smoke runs with assistance from Google Antigravity (Gemini 4 Neon); all test counts, timings, memory figures, and smoke blocks were extracted directly from cargo test, xcl.log, and scripts/smoke.ps1 outputs.

<!-- greyfinch-sync:ivall/xcl:comment:7198613925 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2628#issuecomment-7198613925). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-26T17:10:52Z. --- **Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2628 updated head `16bf648b61df518d8559f2d887f1e74e6e8d37db`** (exact parent & merge-base `08db8020d323bf478964fcc586152cce54959cfc`). Measurements and targeted test results only; not a full source review. ### Setup - **GPU:** NVIDIA GeForce RTX 4060 (8 GB / `7956 MiB` reported by D3D12), driver `32.0.16.2114` (NVIDIA `621.14`, WDDM 3.2) - **CPU / RAM / OS:** Intel Core i5-11400F (6 cores / 12 threads), 32 GB RAM (`31.9 GiB` usable), Windows 11 Home `26200` - **Toolchain / caches:** `rustc 1.100.0 (0ef1bc386 2026-11-09)`, DXC `1.9.2609.5`, release builds, warm DXIL/pipeline caches, quiet machine (zero concurrent builds/tests during timed runs) - **Workload:** Retail workload `title: 29640639` via `scripts/smoke.ps1 -Seconds 60` (`XCL_NETWORK=0`, default flags, no input) ### Targeted RTX 4060 release unit & GPU tests (`16bf648b`) - `cargo test --release -p xcl --lib parked -- --nocapture` across `XCL_DXC_THREADS=1`, `2`, and `3` (3 consecutive runs per setting = **9/9 passes**, covering `parked_outside_the_pool_starts_no_helper`, `workers_parked_for_big_compiles_leave_the_queue_to_helpers`, and both `sparse::tests::flush_parked_*` tests): - `XCL_DXC_THREADS=1`: **4 passed, 0 failed, 0 ignored** × 3 (`0.28 s` / `0.28 s` / `0.28 s`, `0` `SKIPPED`). - `XCL_DXC_THREADS=2`: **4 passed, 0 failed, 0 ignored** × 3 (`0.27 s` / `0.27 s` / `0.28 s`, `0` `SKIPPED`). - `XCL_DXC_THREADS=3`: **4 passed, 0 failed, 0 ignored** × 3 (`0.27 s` / `0.27 s` / `0.27 s`, `0` `SKIPPED`). - `cargo test --release -p xcl --lib hle::d3d12x::pso_async::` (3 consecutive parallel passes): **16 passed, 0 failed, 0 ignored** on all 3 passes (`1.01 s` / `0.71 s` / `0.71 s`, `0` `SKIPPED`). - `cargo test --release -p xcl --lib hle::d3d12x::real::big_compile_tests::`: **11 passed, 0 failed, 0 ignored** (`0.27 s`, `0` `SKIPPED`). ### Paired 60 s RTX 4060 smoke (exact parent `08db8020` vs `16bf648b`) Both runs completed cleanly at steady 60/2 s pacing with `0` device removals and `0` crashes (`16bf648b` vs `08db8020` `xcl.log`: `6,116 MB` peak/end local VRAM on both, `4,651 MB` vs `4,683 MB` end non-local VRAM, `19,387` vs `19,507` translated draws / `1,024` dispatches with `0` skipped, `128` pipelines built ahead on warm cache). Exact parent (`08db8020`): ``` xcl-smoke v1 commit: 08db8020d323bf478964fcc586152cce54959cfc gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1588 (PresentX 1588) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14000 MB ``` PR #2628 head (`16bf648b`): ``` xcl-smoke v1 commit: 16bf648b61df518d8559f2d887f1e74e6e8d37db gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1583 (PresentX 1583) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13984 MB ``` ### Limits of coverage - Full workspace test suite was not run on `16bf648b` (only the 9 `parked` passes across `XCL_DXC_THREADS=1,2,3`, 3 parallel passes of `hle::d3d12x::pso_async::`, `big_compile_tests::`, release build, and exact-parent paired 60 s smokes). - The 60 s smoke ran with warm DXIL/pipeline caches, so live helper spawning under cold multi-minute giant compute PSO compiles was not triggered during the smoke; worker/helper handoff and non-parking behavior were exercised by the targeted `pso_async` unit tests across `XCL_DXC_THREADS=1,2,3`. - Single discrete NVIDIA 8 GB GPU (`RTX 4060`) on native Windows 11; no AMD, Intel, or Wine/Linux run on this host. ### AI use Ran the targeted release tests across `XCL_DXC_THREADS=1,2,3`, release build, and exact-parent paired quiet 60 s smoke runs with assistance from Google Antigravity (Gemini 4 Neon); all test counts, timings, memory figures, and smoke blocks were extracted directly from `cargo test`, `xcl.log`, and `scripts/smoke.ps1` outputs.
KOLESNiii commented 2026-11-28 13:09:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T13:09:37Z.


Already PR'd into main (with no attribution... :( )

<!-- greyfinch-sync:ivall/xcl:comment:7239736416 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2628#issuecomment-7239736416). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-28T13:09:37Z. --- Already PR'd into main (with no attribution... :( )

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2618
No description provided.