Shaders: split compute pieces share one pool of piece builders #2931

Open
KOLESNiii wants to merge 1 commit from upstream-pr/2931 into main
KOLESNiii commented 2026-11-27 00:44:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-27T00:44:08Z.


--pipelines and startup preparation build split compute programs' pieces on helper threads. On main e429936c the pass's pipelines are made in make_pipelines, after the shader workers, by up to XCL_PIPELINE_THREADS workers; each starts its own group of up to XCL_PIPELINE_THREADS helpers for a split program, and they all wait at the same 4-slot running gate: up to 16 helpers for 4 driver slots at the default. Each helper reads its piece's driver blob (driver_cache::load, a full fs::read) before the gate, so on a warm run every waiting helper holds a blob in memory.

This PR starts XCL_PIPELINE_THREADS piece builders once per make_pipelines, and the pieces of every split program go through them. The native-create limit is unchanged, and at most XCL_PIPELINE_THREADS pieces have read their blob at a time. A program's worker still waits for its own pieces, so progress reporting and the summary counters behave as before. Rebased onto main e429936c: the first revision started the builders in precompile, which on today's main returns before any pipeline is made, so they moved to make_pipelines (the commit message says more). The 68 helpers in the first revision's description were before main moved pipeline creation out of the shader workers.

Part of #2880. Whether the old scheme costs anything measurable is the open question in #2880, and this PR is mainly there so it can be measured A/B against main. If it only changes thread counts, it may not be worth merging.

What is in it

  • crates/xcl/src/shaders.rs: PieceQueue / PieceJob, Pipelines::{queue_pieces, build_pieces, open_pieces, close_pieces, make_chain_pieces}; make_pipelines starts the builders and closes the queue once its jobs have returned (also when one panics). make called outside it (tests, a single worker) keeps its own per-program helpers.
  • A queued piece counts as done when it is dropped, and the last builder to exit drops what is still queued, so builders that all panic cannot leave a worker waiting (review by luckyteagirl).
  • A GPU test, split_programs_share_the_piece_builders: four three-piece programs on two builders. Every piece is cached when make returns, the queue drains, the builders exit and the gate count returns to 0. A second test, split_program_returns_when_every_piece_builder_panics, has two builders panic with three pieces queued. A third, offline_pipeline_jobs_hand_their_pieces_to_the_piece_builders, runs make_pipelines with panicking builders and checks it returns with the queue drained and closed.

Testing wanted: please post baseline figures, not only the smoke run

The standard smoke run is useful as a regression check, but it doesn't reach what this PR changes. What's needed is the profile from the #2880 comment, run on main and on this PR's head with everything else held constant:

  • Adapter: wave32-only (NVIDIA, Intel, or AMD with XCL_SPLIT_WAVE64=1). Give the GPU, driver, CPU and RAM.
  • Env, fixed for all runs: XCL_DXC_THREADS (same value throughout, e.g. 15), XCL_PIPELINE_THREADS=4, default XCL_PIPELINE_MAX_KB, a dedicated XCL_DXIL_CACHE, a release build.
  • Command: xcl shaders <pack> --precompile --only cs --pipelines, on a pack whose split compute programs: N (M pieces) line shows at least a few hundred pieces.
  • Cache states, 3 runs each, for each build:
    1. driver-cold: warm DXIL cache, with %XCL_DXIL_CACHE%\driver and the driver's shader cache (NVIDIA\DXCache / D3DSCache) deleted before each run
    2. warm: rerun without deleting anything. Here the blob read before the gate matters.
    3. optional fully cold: empty XCL_DXIL_CACHE
  • Record: the time … s line; the pipelines made / refused / loaded from the driver cache and split compute programs lines; peak live threads and total threads created (WPR, or a ≤10 ms sampler; sampled peaks miss short-lived helpers); process peak commit (PeakPagefileUsage, or a ≤50 ms PrivateMemorySize64 sampler).
  • Equivalence: the same set of file names in %XCL_DXIL_CACHE%\driver and the same made / refused / reused counts on both builds.

Tested

  • RTX 2070 SUPER (wave32 only), Windows 11 26300, stable MSVC Rust, debug, at b41e4b76.
  • cargo test --workspace -- --test-threads=4: 2129 passed, 9 failed, 48 ignored; 25 SKIPPED (21 no wave64, 3 #1426, 1 no heap windows). The 9 failures are #3093's and fail the same on main e429936c (2126 passed, 9 failed, 48 ignored), same skips.
  • With main's make_pipelines (no builders) and the rest of b41e4b76, offline_pipeline_jobs_hand_their_pieces_to_the_piece_builders fails.

Regression run
RTX 2070 SUPER, the retail game, 60 s, XCL_PRESS_AT=25:A, XCL_PREPARE=0 (no startup preparation) on both, release builds, one after the other in one queue job; each run starts from the DXIL cache the run before it left. Startup preparation is skipped, so this does not reach split programs (the logs show 0 programs split during the runs): it is a regression check.

xcl-smoke v1
commit: e429936c10a5b8aa09470ff99dfc8c8d3d8c56fd
gpu: NVIDIA GeForce RTX 2070 SUPER
title: retail game
seconds: 60
exit: 0x0
frames shown: 1045 (PresentX 1046)
presents per 2 s (last 3): 29 27 48
device removals: 0
crashes: 0
peak commit: 15673 MB
xcl-smoke v1
commit: b41e4b7680837dc2aec72170f6d8d6313ae90f54
gpu: NVIDIA GeForce RTX 2070 SUPER
title: retail game
seconds: 60
exit: 0x0
frames shown: 1389 (PresentX 1389)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 15294 MB

Not tested

  • the #2880 profile above, on any adapter (no figures yet)
  • AMD / Intel; startup preparation through xcl run with a split-heavy title
  • cancellation during preparation: builders finish the queued pieces as the per-program helpers did; #2830 is separate

AI use

  • Claude Code with Claude Opus 5.5 wrote the code, the tests and this description, ported it onto main e429936c and ran the tests. The author reviewed them.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5519222717 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2931). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-27T00:44:08Z. --- `--pipelines` and startup preparation build split compute programs' pieces on helper threads. On `main` e429936c the pass's pipelines are made in `make_pipelines`, after the shader workers, by up to `XCL_PIPELINE_THREADS` workers; each starts its own group of up to `XCL_PIPELINE_THREADS` helpers for a split program, and they all wait at the same 4-slot `running` gate: up to 16 helpers for 4 driver slots at the default. Each helper reads its piece's driver blob (`driver_cache::load`, a full `fs::read`) **before** the gate, so on a warm run every waiting helper holds a blob in memory. This PR starts `XCL_PIPELINE_THREADS` piece builders once per `make_pipelines`, and the pieces of every split program go through them. The native-create limit is unchanged, and at most `XCL_PIPELINE_THREADS` pieces have read their blob at a time. A program's worker still waits for its own pieces, so progress reporting and the summary counters behave as before. Rebased onto `main` e429936c: the first revision started the builders in `precompile`, which on today's `main` returns before any pipeline is made, so they moved to `make_pipelines` (the commit message says more). The 68 helpers in the first revision's description were before `main` moved pipeline creation out of the shader workers. Part of #2880. **Whether the old scheme costs anything measurable is the open question in #2880, and this PR is mainly there so it can be measured A/B against `main`.** If it only changes thread counts, it may not be worth merging. **What is in it** - `crates/xcl/src/shaders.rs`: `PieceQueue` / `PieceJob`, `Pipelines::{queue_pieces, build_pieces, open_pieces, close_pieces, make_chain_pieces}`; `make_pipelines` starts the builders and closes the queue once its jobs have returned (also when one panics). `make` called outside it (tests, a single worker) keeps its own per-program helpers. - A queued piece counts as done when it is dropped, and the last builder to exit drops what is still queued, so builders that all panic cannot leave a worker waiting (review by luckyteagirl). - A GPU test, `split_programs_share_the_piece_builders`: four three-piece programs on two builders. Every piece is cached when `make` returns, the queue drains, the builders exit and the gate count returns to 0. A second test, `split_program_returns_when_every_piece_builder_panics`, has two builders panic with three pieces queued. A third, `offline_pipeline_jobs_hand_their_pieces_to_the_piece_builders`, runs `make_pipelines` with panicking builders and checks it returns with the queue drained and closed. **Testing wanted: please post baseline figures, not only the smoke run** The standard smoke run is useful as a regression check, but it doesn't reach what this PR changes. What's needed is the profile from [the #2880 comment](https://github.com/xcl-dev/xcl/issues/2880#issuecomment-7206472180), run on `main` **and** on this PR's head with everything else held constant: - **Adapter:** wave32-only (NVIDIA, Intel, or AMD with `XCL_SPLIT_WAVE64=1`). Give the GPU, driver, CPU and RAM. - **Env, fixed for all runs:** `XCL_DXC_THREADS` (same value throughout, e.g. 15), `XCL_PIPELINE_THREADS=4`, default `XCL_PIPELINE_MAX_KB`, a dedicated `XCL_DXIL_CACHE`, a release build. - **Command:** `xcl shaders <pack> --precompile --only cs --pipelines`, on a pack whose `split compute programs: N (M pieces)` line shows at least a few hundred pieces. - **Cache states, 3 runs each, for each build:** 1. *driver-cold*: warm DXIL cache, with `%XCL_DXIL_CACHE%\driver` and the driver's shader cache (`NVIDIA\DXCache` / `D3DSCache`) deleted before each run 2. *warm*: rerun without deleting anything. Here the blob read before the gate matters. 3. optional *fully cold*: empty `XCL_DXIL_CACHE` - **Record:** the `time … s` line; the `pipelines made / refused / loaded from the driver cache` and `split compute programs` lines; peak live threads and **total threads created** (WPR, or a ≤10 ms sampler; sampled peaks miss short-lived helpers); process peak commit (PeakPagefileUsage, or a ≤50 ms `PrivateMemorySize64` sampler). - **Equivalence:** the same set of file names in `%XCL_DXIL_CACHE%\driver` and the same made / refused / reused counts on both builds. **Tested** - RTX 2070 SUPER (wave32 only), Windows 11 26300, stable MSVC Rust, debug, at b41e4b76. - `cargo test --workspace -- --test-threads=4`: 2129 passed, 9 failed, 48 ignored; 25 `SKIPPED` (21 no wave64, 3 #1426, 1 no heap windows). The 9 failures are #3093's and fail the same on `main` e429936c (2126 passed, 9 failed, 48 ignored), same skips. - With `main`'s `make_pipelines` (no builders) and the rest of b41e4b76, `offline_pipeline_jobs_hand_their_pieces_to_the_piece_builders` fails. **Regression run** RTX 2070 SUPER, the retail game, 60 s, `XCL_PRESS_AT=25:A`, `XCL_PREPARE=0` (no startup preparation) on both, release builds, one after the other in one queue job; each run starts from the DXIL cache the run before it left. Startup preparation is skipped, so this does not reach split programs (the logs show 0 programs split during the runs): it is a regression check. ``` xcl-smoke v1 commit: e429936c10a5b8aa09470ff99dfc8c8d3d8c56fd gpu: NVIDIA GeForce RTX 2070 SUPER title: retail game seconds: 60 exit: 0x0 frames shown: 1045 (PresentX 1046) presents per 2 s (last 3): 29 27 48 device removals: 0 crashes: 0 peak commit: 15673 MB ``` ``` xcl-smoke v1 commit: b41e4b7680837dc2aec72170f6d8d6313ae90f54 gpu: NVIDIA GeForce RTX 2070 SUPER title: retail game seconds: 60 exit: 0x0 frames shown: 1389 (PresentX 1389) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 15294 MB ``` **Not tested** - the #2880 profile above, on any adapter (no figures yet) - AMD / Intel; startup preparation through `xcl run` with a split-heavy title - cancellation during preparation: builders finish the queued pieces as the per-program helpers did; #2830 is separate **AI use** - Claude Code with Claude Opus 5.5 wrote the code, the tests and this description, ported it onto `main` e429936c and ran the tests. The author reviewed them. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ettehn commented 2026-11-27 00:50:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ettehn on 2026-11-27T00:50:15Z.


Paired offline benchmark for #2880 on RTX 5070 Ti Laptop 12 GiB (621.24), Ryzen 9 8945HX, 31.8 GiB usable RAM, Windows 11 26200.9974, Rust 1.97.1 MSVC, DXC/DXIL 1.8.2502.11. Clean release builds of 8b957bec6f82495aec940944c6bf47faa02db590 and 093a5fcdc2d8db1358c78e0074567960e1e1560e.

Synthetic RPF9 with 160 variants of the existing wave32 split compute fixture. xcl shaders <pack> --precompile --only cs --pipelines --windows 1, XCL_DIRECT_DXIL=1, XCL_DIRECT_SPLIT_INSTRUCTIONS=12, XCL_DXC_THREADS=15, XCL_PIPELINE_THREADS=4, default size cap. Three cold/warm pairs per build, interleaved base/head/head/base/base/head. Each pair started with an identical copy of the translation cache and an empty XCL driver folder. I left the NVIDIA system cache in place, so the XCL-cold rows are not a driver-cold comparison.

Cache / build Median wall s Peak live threads, sampled range Distinct thread IDs seen, range Median peak process commit (MiB)
XCL-cold / base 0.771 99 672 112.61
XCL-cold / head 0.730 35 36 100.82
Warm / base 0.441 99–101 573–607 150.47
Warm / head 0.471 35 36 141.71

Thread snapshots: median interval 4.17–4.57 ms across runs, maximum 5.95 ms. IDs seen are a lower bound, not an ETW thread-create total. Peak commit is the Windows PeakPagefileUsage counter. All 12 runs made 800 pieces, refused 0, and ended with the identical set of 800 .pso filenames. XCL reported 0 cache loads on the first run of each pair and 800 on the warm run. The first base XCL-cold run was an outlier at 5.669 s and 278.62 MiB, so I would not infer a cold-time change from this setup. The repeatable difference is thread count, with warm wall time slightly higher on this short fixture. A retail title, a cold NVIDIA cache and full workspace tests were outside this run. OpenAI Codex (6.2sol) assisted with verification.

<!-- greyfinch-sync:ivall/xcl:comment:7206793536 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2931#issuecomment-7206793536). Originally posted by [ettehn](https://github.com/ettehn) on 2026-11-27T00:50:15Z. --- Paired offline benchmark for #2880 on RTX 5070 Ti Laptop 12 GiB (621.24), Ryzen 9 8945HX, 31.8 GiB usable RAM, Windows 11 26200.9974, Rust 1.97.1 MSVC, DXC/DXIL 1.8.2502.11. Clean release builds of `8b957bec6f82495aec940944c6bf47faa02db590` and `093a5fcdc2d8db1358c78e0074567960e1e1560e`. Synthetic RPF9 with 160 variants of the existing wave32 split compute fixture. `xcl shaders <pack> --precompile --only cs --pipelines --windows 1`, `XCL_DIRECT_DXIL=1`, `XCL_DIRECT_SPLIT_INSTRUCTIONS=12`, `XCL_DXC_THREADS=15`, `XCL_PIPELINE_THREADS=4`, default size cap. Three cold/warm pairs per build, interleaved base/head/head/base/base/head. Each pair started with an identical copy of the translation cache and an empty XCL `driver` folder. I left the NVIDIA system cache in place, so the XCL-cold rows are not a driver-cold comparison. | Cache / build | Median wall s | Peak live threads, sampled range | Distinct thread IDs seen, range | Median peak process commit (MiB) | | --- | ---: | ---: | ---: | ---: | | XCL-cold / base | 0.771 | 99 | 672 | 112.61 | | XCL-cold / head | 0.730 | 35 | 36 | 100.82 | | Warm / base | 0.441 | 99–101 | 573–607 | 150.47 | | Warm / head | 0.471 | 35 | 36 | 141.71 | Thread snapshots: median interval 4.17–4.57 ms across runs, maximum 5.95 ms. IDs seen are a lower bound, not an ETW thread-create total. Peak commit is the Windows `PeakPagefileUsage` counter. All 12 runs made 800 pieces, refused 0, and ended with the identical set of 800 `.pso` filenames. XCL reported 0 cache loads on the first run of each pair and 800 on the warm run. The first base XCL-cold run was an outlier at 5.669 s and 278.62 MiB, so I would not infer a cold-time change from this setup. The repeatable difference is thread count, with warm wall time slightly higher on this short fixture. A retail title, a cold NVIDIA cache and full workspace tests were outside this run. OpenAI Codex (6.2sol) assisted with verification.
KOLESNiii commented 2026-11-27 01:25:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-27T01:25:31Z.


Thank you @ettehn, a paired, interleaved A/B with matched cache states is exactly what this needed. I've written up what it shows, together with the two runs on #2880, in this comment. In short: thread starts per pass go from about 640 to 4 and peak commit drops about 10 MiB, consistent with thread stacks. Cold time doesn't change, because the 4-slot gate is the limit. The small warm slowdown may come from this PR dropping the blob read-ahead that the waiting helpers gave main. I'll try a 2 × XCL_PIPELINE_THREADS builder variant to check that.

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

<!-- greyfinch-sync:ivall/xcl:comment:7207276633 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2931#issuecomment-7207276633). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-27T01:25:31Z. --- Thank you @ettehn, a paired, interleaved A/B with matched cache states is exactly what this needed. I've written up what it shows, together with the two runs on #2880, in [this comment](https://github.com/xcl-dev/xcl/issues/2880#issuecomment-7207274967). In short: thread starts per pass go from about 640 to 4 and peak commit drops about 10 MiB, consistent with thread stacks. Cold time doesn't change, because the 4-slot gate is the limit. The small warm slowdown may come from this PR dropping the blob read-ahead that the waiting helpers gave `main`. I'll try a `2 × XCL_PIPELINE_THREADS` builder variant to check that. AI use: Claude Code (Claude Opus 5.5) drafted this comment.
SzczepanGrela commented 2026-11-27 02:57:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SzczepanGrela on 2026-11-27T02:57:12Z.


AMD/RADV/Wine functional coverage at 093a5fcd. The requested performance comparison remains unmeasured here.

Tested

  • Head 093a5fcdc2d8db1358c78e0074567960e1e1560e and main 8b957bec6f82495aec940944c6bf47faa02db590, Windows GNU release executables. Separate source copies with local test-only observations/profile fixture; original assertions unchanged.
  • RX 9070 16 GB, RADV GFX1201, Mesa 26.3.1-arch3.5; Ryzen 7 7700, CachyOS 7.3.0-5-cachyos. GE-Proton11-12 / Wine 11.0 Staging, native D3D12 through vkd3d-proton 8293130ebe370b1+ (local asserts-disabled build). Rust 1.97.1, DXC/DXIL 1.9.2602.17.
  • Build: cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run --message-format=json-render-diagnostics.
  • Run each executable through Wine with pipeline_cap_tests --nocapture --test-threads=1, then --test-threads=4. Main: 3 passed, 0 failed each; head: 4 passed, 0 failed each. 0 ignored, 0 skipped.
  • The new split_programs_share_the_piece_builders passes at both thread counts: four programs, three distinct DXIL pieces each, two shared builders, twelve PSOs made, zero refused. Its original assertions confirm all piece blobs exist when make returns, the queue drains, builders exit and the running gate returns to zero. This tests native PSO creation/cache completion, not execution of those twelve shaders. The existing stale-cap test's separate GPU dispatch returns word 0 = 42 on both sources.

A local precompile pilot with four owned guarded-add programs produced 28 SDK-validated wave32 DXIL pieces. With matched warm translation caches, empty private driver caches, XCL_DXC_THREADS=15, XCL_PIPELINE_THREADS=4, XCL_DIRECT_DXIL=1, XCL_SPLIT_WAVE64=1 and split limit 12, both main and head processes exited with code 5 before the pipeline counters/libtest summary or profile file. No root cause was established. The larger benchmark was not started, so there are no comparable timing, thread-count or peak-commit figures from this attempt.

Not tested

The requested bulk cold/warm performance comparison, execution of the queued twelve-piece fixture, native Windows, other GPUs, the full suite, startup cancellation, retail workloads or scripts/smoke.ps1. These results do not establish a performance or memory benefit.

AI use

OpenAI Codex (GPT-6; exact serving variant not exposed) ran the comparisons, prepared the local test-only observations/pilot, independently checked sources and raw results, and drafted this report. Publication authorized by the account owner.

<!-- greyfinch-sync:ivall/xcl:comment:7208574450 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2931#issuecomment-7208574450). Originally posted by [SzczepanGrela](https://github.com/SzczepanGrela) on 2026-11-27T02:57:12Z. --- AMD/RADV/Wine functional coverage at `093a5fcd`. The requested performance comparison remains unmeasured here. **Tested** - Head `093a5fcdc2d8db1358c78e0074567960e1e1560e` and main `8b957bec6f82495aec940944c6bf47faa02db590`, Windows GNU release executables. Separate source copies with local test-only observations/profile fixture; original assertions unchanged. - RX 9070 16 GB, RADV GFX1201, Mesa `26.3.1-arch3.5`; Ryzen 7 7700, CachyOS `7.3.0-5-cachyos`. GE-Proton11-12 / Wine 11.0 Staging, native D3D12 through vkd3d-proton `8293130ebe370b1+` (local asserts-disabled build). Rust `1.97.1`, DXC/DXIL `1.9.2602.17`. - Build: `cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run --message-format=json-render-diagnostics`. - Run each executable through Wine with `pipeline_cap_tests --nocapture --test-threads=1`, then `--test-threads=4`. Main: **3 passed, 0 failed** each; head: **4 passed, 0 failed** each. **0 ignored, 0 skipped**. - The new `split_programs_share_the_piece_builders` passes at both thread counts: four programs, three distinct DXIL pieces each, two shared builders, twelve PSOs made, zero refused. Its original assertions confirm all piece blobs exist when `make` returns, the queue drains, builders exit and the running gate returns to zero. This tests native PSO creation/cache completion, not execution of those twelve shaders. The existing stale-cap test's separate GPU dispatch returns word 0 = 42 on both sources. A local precompile pilot with four owned guarded-add programs produced 28 SDK-validated wave32 DXIL pieces. With matched warm translation caches, empty private driver caches, `XCL_DXC_THREADS=15`, `XCL_PIPELINE_THREADS=4`, `XCL_DIRECT_DXIL=1`, `XCL_SPLIT_WAVE64=1` and split limit 12, both main and head processes exited with code 5 before the pipeline counters/libtest summary or profile file. No root cause was established. The larger benchmark was not started, so there are no comparable timing, thread-count or peak-commit figures from this attempt. **Not tested** The requested bulk cold/warm performance comparison, execution of the queued twelve-piece fixture, native Windows, other GPUs, the full suite, startup cancellation, retail workloads or `scripts/smoke.ps1`. These results do not establish a performance or memory benefit. **AI use** OpenAI Codex (GPT-6; exact serving variant not exposed) ran the comparisons, prepared the local test-only observations/pilot, independently checked sources and raw results, and drafted this report. Publication authorized by the account owner.
luckyteagirl commented 2026-11-27 05:44:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-27T05:44:56Z.

Review: COMMENTED


If every piece builder panics, precompilation can hang before it reports the failure. The Built guard decrements the count only for the job that started. Jobs still queued keep their producer waiting in queue_pieces, and the coordinator joins producers before closing the pool. I ran an isolated Windows harness with the exact queue methods and the same join order, using two builders and three jobs. The control completed. When the build stub panicked in both builders, the coordinator was still blocked after two seconds and I stopped the fixture. Could the pool wake its producers with a failure and shut down when a builder exits unexpectedly? Queue and builder loop · Shutdown order

The regression test has a related teardown issue. It unwraps each producer's join result before closing the pool, so a failed assertion can leave the scoped threads waiting indefinitely. Collecting the join results and closing the pool before propagating errors would let that test report the assertion. Test teardown

AI use: OpenAI Codex (GPT-6.2 Sol) reviewed the source, ran the CPU-only fault-injection harness, and drafted this comment. No title, GPU, or full suite was run.

<!-- greyfinch-sync:ivall/xcl:review:6083978750 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2931#pullrequestreview-6083978750). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-27T05:44:56Z. **Review:** COMMENTED --- If every piece builder panics, precompilation can hang before it reports the failure. The `Built` guard decrements the count only for the job that started. Jobs still queued keep their producer waiting in `queue_pieces`, and the coordinator joins producers before closing the pool. I ran an isolated Windows harness with the exact queue methods and the same join order, using two builders and three jobs. The control completed. When the build stub panicked in both builders, the coordinator was still blocked after two seconds and I stopped the fixture. Could the pool wake its producers with a failure and shut down when a builder exits unexpectedly? [Queue and builder loop](https://github.com/xcl-dev/xcl/blob/093a5fcdc2d8db1358c78e0074567960e1e1560e/crates/xcl/src/shaders.rs#L1589-L1640) · [Shutdown order](https://github.com/xcl-dev/xcl/blob/093a5fcdc2d8db1358c78e0074567960e1e1560e/crates/xcl/src/shaders.rs#L1979-L1984) The regression test has a related teardown issue. It unwraps each producer's join result before closing the pool, so a failed assertion can leave the scoped threads waiting indefinitely. Collecting the join results and closing the pool before propagating errors would let that test report the assertion. [Test teardown](https://github.com/xcl-dev/xcl/blob/093a5fcdc2d8db1358c78e0074567960e1e1560e/crates/xcl/src/shaders.rs#L1496-L1500) AI use: OpenAI Codex (GPT-6.2 Sol) reviewed the source, ran the CPU-only fault-injection harness, and drafted this comment. No title, GPU, or full suite was run.
JJAutoCompare commented 2026-11-27 11:03:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-27T11:03:11Z.


Tested

Clean 093a5fcdc2d8db1358c78e0074567960e1e1560e on Windows 11 build 26200.9974, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust 1.100.0 MSVC, DXC/DXIL 1.9.2602.17, debug. Built with cargo test --offline --locked -j 2 -p xcl --lib --test gpu_compute_e2e --no-run --message-format=json-render-diagnostics. Reran these synthetic groups with XCL_ADAPTER=A770 and --test-threads=1 --nocapture:

  • Exact shaders::pipeline_cap_tests::split_programs_share_the_piece_builders (1 pass). Four callers shared two spawned and joined builders. All 12 piece blobs were present on return, zero refused, and the queue and gate drained.
  • Exact offline_split_compute_pipeline_is_reused_by_a_second_process (1 pass). A warm process reused the cached pieces. Corrupting one piece rebuilt that piece and preserved reuse of the others.
  • gpu::dxil::module::split::tests::dispatch_chain_payload_ (2 passes). Synthetic GPU readback agreed with the expected dispatch-chain order and payload.

Four passed, zero failed, ignored, or skipped. Each group used the shared Arc mutex. The pinned executables matched before, under, and after the lock.

Not tested

Arc performance, peak native calls, cancellation and panic handling, the full workspace, and retail smoke.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the fixtures and independently reran the four checks above.


Tested — follow-up at 1625b9df91f6bef6f2b98d27a492a9b8cdae59f8

Native Windows 11 build 26200.9974, Ryzen 7 3800X, Intel Arc A770 (PCI 8086:56a0, driver 32.0.101.9175), Rust 1.100.1 MSVC debug, DXC/DXIL 1.9.2602.17 for the sharing test. I reran the pinned stock libtest with XCL_ADAPTER=A770 under the shared Arc mutex. Both native processes and the wrapper exited 0. The executable hash matched before, during and after the lock.

I used <libtest.exe> --exact <test> --nocapture --test-threads=1 for each fixture.

  • shaders::pipeline_cap_tests::split_program_returns_when_every_piece_builder_panics injected two builder panics. The producer returned within the fixture's 30-second limit, both joins reported the expected panics, and the queue was empty with zero live builders.
  • shaders::pipeline_cap_tests::split_programs_share_the_piece_builders used two builders for four three-piece programs. All 12 cache blobs were nonempty at the producers' returns. The fixture recorded 12 pieces made and zero refused, drained the queue, joined the builders and returned the pipeline admission count to zero.

2 passed, 0 failed, 0 ignored, 0 runtime skips.

Not tested

Production precompile panic propagation, shader dispatch or readback, peak concurrent native creates, startup performance or cancellation, retail smoke, and the full suite.

AI use

T3 Code through the Codex harness (gpt-6.2-sol) verified provenance and adapter selection, ran the stock fixtures and wrote this follow-up.

<!-- greyfinch-sync:ivall/xcl:comment:7216621770 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2931#issuecomment-7216621770). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-27T11:03:11Z. --- **Tested** Clean `093a5fcdc2d8db1358c78e0074567960e1e1560e` on Windows 11 build 26200.9974, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust 1.100.0 MSVC, DXC/DXIL 1.9.2602.17, debug. Built with `cargo test --offline --locked -j 2 -p xcl --lib --test gpu_compute_e2e --no-run --message-format=json-render-diagnostics`. Reran these synthetic groups with `XCL_ADAPTER=A770` and `--test-threads=1 --nocapture`: - Exact `shaders::pipeline_cap_tests::split_programs_share_the_piece_builders` (1 pass). Four callers shared two spawned and joined builders. All 12 piece blobs were present on return, zero refused, and the queue and gate drained. - Exact `offline_split_compute_pipeline_is_reused_by_a_second_process` (1 pass). A warm process reused the cached pieces. Corrupting one piece rebuilt that piece and preserved reuse of the others. - `gpu::dxil::module::split::tests::dispatch_chain_payload_` (2 passes). Synthetic GPU readback agreed with the expected dispatch-chain order and payload. Four passed, zero failed, ignored, or skipped. Each group used the shared Arc mutex. The pinned executables matched before, under, and after the lock. **Not tested** Arc performance, peak native calls, cancellation and panic handling, the full workspace, and retail smoke. **AI use** T3 Code / Codex (`gpt-6.2-sol`) ran the fixtures and independently reran the four checks above. --- **Tested — follow-up at `1625b9df91f6bef6f2b98d27a492a9b8cdae59f8`** Native Windows 11 build 26200.9974, Ryzen 7 3800X, Intel Arc A770 (PCI `8086:56a0`, driver `32.0.101.9175`), Rust 1.100.1 MSVC debug, DXC/DXIL 1.9.2602.17 for the sharing test. I reran the pinned stock libtest with `XCL_ADAPTER=A770` under the shared Arc mutex. Both native processes and the wrapper exited 0. The executable hash matched before, during and after the lock. I used `<libtest.exe> --exact <test> --nocapture --test-threads=1` for each fixture. - `shaders::pipeline_cap_tests::split_program_returns_when_every_piece_builder_panics` injected two builder panics. The producer returned within the fixture's 30-second limit, both joins reported the expected panics, and the queue was empty with zero live builders. - `shaders::pipeline_cap_tests::split_programs_share_the_piece_builders` used two builders for four three-piece programs. All 12 cache blobs were nonempty at the producers' returns. The fixture recorded 12 pieces made and zero refused, drained the queue, joined the builders and returned the pipeline admission count to zero. **2 passed, 0 failed, 0 ignored, 0 runtime skips.** **Not tested** Production `precompile` panic propagation, shader dispatch or readback, peak concurrent native creates, startup performance or cancellation, retail smoke, and the full suite. **AI use** T3 Code through the Codex harness (`gpt-6.2-sol`) verified provenance and adapter selection, ran the stock fixtures and wrote this follow-up.
KOLESNiii commented 2026-11-27 12:59:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-27T12:59:07Z.


Thanks @luckyteagirl, both points were right. Fixed in 1625b9df (squashed into the PR's commit):

  • All builders panic: a queued PieceJob now counts itself as done when it is dropped: built, its build panicked, or discarded. builders counts live builders, and the last one to exit (panicking included) drops whatever is still queued, which releases the waiting workers. Programs queued after that build their own pieces as make does outside precompile, and the builders' panic reaches precompile when its scope ends instead of hanging it. New test split_program_returns_when_every_piece_builder_panics: two panicking builders, three pieces, plain threads with a 30 s timeout so a hang fails rather than blocks. It passes at 1625b9df; with the last builder's drain disabled it fails at the timeout ("make still waits for pieces after every builder panicked").
  • Test teardown: split_programs_share_the_piece_builders collects the worker results, closes the pool, then propagates a panic.

RTX 2070 SUPER, Windows 11 26300, debug: cargo test --workspace -- --test-threads=4 at 1625b9df: 1448 passed, 0 failed, 47 ignored.

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

<!-- greyfinch-sync:ivall/xcl:comment:7218916208 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2931#issuecomment-7218916208). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-27T12:59:07Z. --- Thanks @luckyteagirl, both points were right. Fixed in 1625b9df (squashed into the PR's commit): - **All builders panic:** a queued `PieceJob` now counts itself as done when it is dropped: built, its build panicked, or discarded. `builders` counts live builders, and the last one to exit (panicking included) drops whatever is still queued, which releases the waiting workers. Programs queued after that build their own pieces as `make` does outside `precompile`, and the builders' panic reaches `precompile` when its scope ends instead of hanging it. New test `split_program_returns_when_every_piece_builder_panics`: two panicking builders, three pieces, plain threads with a 30 s timeout so a hang fails rather than blocks. It passes at 1625b9df; with the last builder's drain disabled it fails at the timeout ("make still waits for pieces after every builder panicked"). - **Test teardown:** `split_programs_share_the_piece_builders` collects the worker results, closes the pool, then propagates a panic. RTX 2070 SUPER, Windows 11 26300, debug: `cargo test --workspace -- --test-threads=4` at 1625b9df: 1448 passed, 0 failed, 47 ignored. AI use: Claude Code (Claude Opus 5.5) wrote the fix, the test and this reply.
KOLESNiii commented 2026-11-28 13:24:29 +00:00 (Migrated from github.com)

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


Help wanted: a full --pipelines pass on a split-heavy pack (several hours here, so I am asking rather than tying up my machine).

b41e4b76 ports this PR onto main e429936c. main now builds the pass's pipelines after the shader workers finish, in make_pipelines, so the shared piece builders moved there. On main each of the XCL_PIPELINE_THREADS workers starts up to XCL_PIPELINE_THREADS helpers for a split program (16 waiting helpers at the default 4, each holding its driver blob); with this PR there are at most 4. On my RTX 2070 SUPER (debug) the whole suite gives 2129 passed, 9 failed, 48 ignored, 25 SKIPPED; the 9 are #3093's and fail the same on main e429936c. The new test fails with main's make_pipelines. Nothing heavy has run.

Programs split on GPUs with 32-lane waves (NVIDIA, Intel). If you have one and a title's shader pack, please run, on main e429936c and on b41e4b76, each from an empty XCL_DXIL_CACHE:

$env:XCL_DXIL_CACHE = '<empty folder>'   # one fresh folder per build
xcl shaders '<pack>' --precompile --only cs --pipelines

and post the summary lines (split programs / pieces, pipelines made / refused / reused, time), the peak commit or working set of xcl.exe (Task Manager or Get-Process xcl | select PeakWorkingSet64,PeakPagedMemorySize64), and GPU, driver and commit. That answers the open question in #2880.

— Claude Code (Claude Opus 5.5), on behalf of the PR author

<!-- greyfinch-sync:ivall/xcl:comment:7239913725 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2931#issuecomment-7239913725). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-28T13:24:29Z. --- **Help wanted: a full `--pipelines` pass on a split-heavy pack** (several hours here, so I am asking rather than tying up my machine). `b41e4b76` ports this PR onto `main` `e429936c`. `main` now builds the pass's pipelines after the shader workers finish, in `make_pipelines`, so the shared piece builders moved there. On `main` each of the `XCL_PIPELINE_THREADS` workers starts up to `XCL_PIPELINE_THREADS` helpers for a split program (16 waiting helpers at the default 4, each holding its driver blob); with this PR there are at most 4. On my RTX 2070 SUPER (debug) the whole suite gives 2129 passed, 9 failed, 48 ignored, 25 SKIPPED; the 9 are #3093's and fail the same on `main` `e429936c`. The new test fails with `main`'s `make_pipelines`. Nothing heavy has run. Programs split on GPUs with 32-lane waves (NVIDIA, Intel). If you have one and a title's shader pack, please run, on `main` `e429936c` and on `b41e4b76`, each from an empty `XCL_DXIL_CACHE`: ```powershell $env:XCL_DXIL_CACHE = '<empty folder>' # one fresh folder per build xcl shaders '<pack>' --precompile --only cs --pipelines ``` and post the summary lines (split programs / pieces, pipelines made / refused / reused, time), the peak commit or working set of `xcl.exe` (Task Manager or `Get-Process xcl | select PeakWorkingSet64,PeakPagedMemorySize64`), and GPU, driver and commit. That answers the open question in #2880. — Claude Code (Claude Opus 5.5), on behalf of the PR author
Foniass commented 2026-12-01 09:11:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:11:51Z.


Triage (#1607) – head adaa3a2

No open or merged PR makes this change. On main, Pipelines::make_chain_pieces (shaders.rs) still starts up to most scoped helper threads for every split program (#2880).
No problems found in the diff. A PieceJob counts itself done on drop, so a panicking or exiting builder cannot leave a program's worker waiting. make_pipelines closes the pool before it re-raises a job's panic, and queue_pieces falls back to the old helpers when no builders run.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7306351798 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2931#issuecomment-7306351798). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T09:11:51Z. --- **Triage (#1607)** – head adaa3a2 No open or merged PR makes this change. On main, `Pipelines::make_chain_pieces` (shaders.rs) still starts up to `most` scoped helper threads for every split program (#2880). No problems found in the diff. A `PieceJob` counts itself done on drop, so a panicking or exiting builder cannot leave a program's worker waiting. `make_pipelines` closes the pool before it re-raises a job's panic, and `queue_pieces` falls back to the old helpers when no builders run. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
KOLESNiii commented 2026-12-02 14:42:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-12-02T14:42:38Z.


Thanks for the triage. Rebased onto main df0cfef6. The shaders.rs conflict was in the tests only: main added a_split_programs_chain_is_prepared_only_without_its_whole and startup_preparation_builds_a_split_programs_whole_and_no_chain where this PR adds split_programs_share_the_piece_builders, and all of them are kept. New head d8b6bcb0; suite and smoke are queued again.

— Claude Code (Claude Opus 5.5), on behalf of the PR author

<!-- greyfinch-sync:ivall/xcl:comment:7349006812 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2931#issuecomment-7349006812). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-12-02T14:42:38Z. --- Thanks for the triage. Rebased onto `main` df0cfef6. The `shaders.rs` conflict was in the tests only: `main` added `a_split_programs_chain_is_prepared_only_without_its_whole` and `startup_preparation_builds_a_split_programs_whole_and_no_chain` where this PR adds `split_programs_share_the_piece_builders`, and all of them are kept. New head `d8b6bcb0`; suite and smoke are queued again. — Claude Code (Claude Opus 5.5), on behalf of the PR author
Foniass commented 2026-12-02 14:45:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T14:45:10Z.


Follow-up review (head d8b6bcb0, since adaa3a2, diff read, not a merge-check; checks red):

  • Earlier points: unchanged; this push is a rebase onto the current main, with the test context moved where main changed around it.

New: none.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7349077744 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2931#issuecomment-7349077744). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T14:45:10Z. --- Follow-up review (head d8b6bcb0, since adaa3a2, diff read, not a merge-check; checks red): - **Earlier points:** unchanged; this push is a rebase onto the current `main`, with the test context moved where `main` changed around it. New: none. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2931:upstream-pr/2931'
git switch 'upstream-pr/2931'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2931'
git switch 'upstream-pr/2931'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2931'
git switch 'upstream-pr/2931'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2931'
git switch 'main'
git merge --squash 'upstream-pr/2931'
git switch 'main'
git merge --ff-only 'upstream-pr/2931'
git switch 'main'
git merge 'upstream-pr/2931'
git push origin 'main'
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!2931
No description provided.