Tests: serialise the pipeline tests that store into the library builder #3221

Merged
Kalmarv merged 1 commit from upstream-pr/3221 into main 2026-11-29 16:18:29 +00:00
Kalmarv commented 2026-11-28 21:28:19 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-28T21:28:19Z.


Build and test (Windows, no GPU) fails at random on main: on beeb81be, shaders::pipeline_library::tests::builder_deduplicates_names_and_atomically_replaces_output counted 3 entries where it stored 2 (pipeline_library.rs:414). Three more tests then failed on the poisoned BUILD_TEST lock. The same tree passed in another run.

Cause: the library builder is one per process, and while it is begun, every pipeline Pipelines::make* creates is stored into it (make_required → pipeline_library::store). The library tests hold BUILD_TEST while they begin, store and finish, but three tests that make pipelines through Pipelines did not take it. When one of them ran beside the builder test, its pipelines went into that test's library. On beeb81be's CI run, the failure came right after split_compute_program_prebuilds_and_caches_chain_pieces finished.

This is a test-only change: no runtime code changes.

What is in it

  • crates/xcl/src/shaders.rs: stale_blob_cannot_bypass_the_offline_pipeline_cap, split_compute_program_prebuilds_and_caches_chain_pieces and pso_measurement_compiles_an_exact_synthetic_record hold BUILD_TEST.
  • shaders.rs, shaders/pipeline_library.rs, shaders/warm_library.rs: every BUILD_TEST holder takes the lock even when it is poisoned. A test that panics while holding it then fails alone, instead of failing the tests queued behind it (on CI, one cause showed up as four failures).

Tested

  • RTX 5070 Ti (driver 610.74), Ryzen 9 9950X, Windows 11 Pro 26200, Rust 1.99.0, debug.
  • cargo test -p xcl --lib -- --test-threads=4 (DXC 1.9.2609) at the head: 2455 passed, 0 failed, 29 ignored; 25 SKIPPED lines.
  • On WARP as on CI (XCL_ADAPTER=warp cargo test -p xcl --lib -- shaders:: --test-threads=4 --nocapture, 5 runs): the 6 pipeline_library and 4 pipeline_cap_tests tests passed in all 5. pso_measurement_compiles_an_exact_synthetic_record fails on this machine's WARP, alone too (CreateComputePipelineState run 1: The parameter is incorrect), while it passes on CI's WARP. With the poison-tolerant lock, that failure no longer takes down cold_publish_makes_an_unchanged_corpus_reusable, as it did with the lock alone.
  • Not reproduced locally before the fix: 3 whole-lib runs on the GPU and 5 shaders:: runs on the GPU all passed on main's tree. The cause comes from the code path and CI's test order, not from a local failure.

Regression run

  • None: test-only diff (Tier 0). It touches files under crates/xcl/src, so it needs the test-only label.

Not tested

  • The full workspace suite (only -p xcl --lib, the target the change touches).
  • That CI stops failing: the failure is intermittent, so only repeated CI runs can show it.
  • Other tests outside these that create pipelines through the D3D12.X hooks while a build is begun: none were seen storing into the builder in an instrumented run, but they are not serialised.

AI use

  • Claude Code with Claude Opus 5.5: found the cause, wrote the change and this description, ran the tests.
  • Claude Code with Claude Fable 5: coordinated the work and read the change.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5544740950 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3221). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-28T21:28:19Z. --- `Build and test (Windows, no GPU)` fails at random on main: on beeb81be, `shaders::pipeline_library::tests::builder_deduplicates_names_and_atomically_replaces_output` counted 3 entries where it stored 2 (pipeline_library.rs:414). Three more tests then failed on the poisoned `BUILD_TEST` lock. The same tree passed in another run. Cause: the library builder is one per process, and while it is begun, every pipeline `Pipelines::make*` creates is stored into it (`make_required` → `pipeline_library::store`). The library tests hold `BUILD_TEST` while they begin, store and finish, but three tests that make pipelines through `Pipelines` did not take it. When one of them ran beside the builder test, its pipelines went into that test's library. On beeb81be's CI run, the failure came right after `split_compute_program_prebuilds_and_caches_chain_pieces` finished. This is a test-only change: no runtime code changes. **What is in it** - `crates/xcl/src/shaders.rs`: `stale_blob_cannot_bypass_the_offline_pipeline_cap`, `split_compute_program_prebuilds_and_caches_chain_pieces` and `pso_measurement_compiles_an_exact_synthetic_record` hold `BUILD_TEST`. - `shaders.rs`, `shaders/pipeline_library.rs`, `shaders/warm_library.rs`: every `BUILD_TEST` holder takes the lock even when it is poisoned. A test that panics while holding it then fails alone, instead of failing the tests queued behind it (on CI, one cause showed up as four failures). **Tested** - RTX 5070 Ti (driver 610.74), Ryzen 9 9950X, Windows 11 Pro 26200, Rust 1.99.0, debug. - `cargo test -p xcl --lib -- --test-threads=4` (DXC 1.9.2609) at the head: 2455 passed, 0 failed, 29 ignored; 25 SKIPPED lines. - On WARP as on CI (`XCL_ADAPTER=warp cargo test -p xcl --lib -- shaders:: --test-threads=4 --nocapture`, 5 runs): the 6 `pipeline_library` and 4 `pipeline_cap_tests` tests passed in all 5. `pso_measurement_compiles_an_exact_synthetic_record` fails on this machine's WARP, alone too (`CreateComputePipelineState run 1: The parameter is incorrect`), while it passes on CI's WARP. With the poison-tolerant lock, that failure no longer takes down `cold_publish_makes_an_unchanged_corpus_reusable`, as it did with the lock alone. - Not reproduced locally before the fix: 3 whole-lib runs on the GPU and 5 `shaders::` runs on the GPU all passed on main's tree. The cause comes from the code path and CI's test order, not from a local failure. **Regression run** - None: test-only diff (Tier 0). It touches files under `crates/xcl/src`, so it needs the `test-only` label. **Not tested** - The full workspace suite (only `-p xcl --lib`, the target the change touches). - That CI stops failing: the failure is intermittent, so only repeated CI runs can show it. - Other tests outside these that create pipelines through the D3D12.X hooks while a build is begun: none were seen storing into the builder in an instrumented run, but they are not serialised. **AI use** - Claude Code with Claude Opus 5.5: found the cause, wrote the change and this description, ran the tests. - Claude Code with Claude Fable 5: coordinated the work and read the change. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Prime1997 commented 2026-11-28 23:26:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-28T23:26:21Z.

Review: APPROVED


Approving on a merge-check run on an RTX 3060 Ti 8 GB (driver 32.0.16.1714, i5-10400, Windows 11 Pro 26200, Rust 1.100.0).

  • Head 2c003dd6ac4bde876cd6c24cadc479ffcfa8e039 merged cleanly onto main 7db2f391, and the workspace builds.
  • Test-only diff, so the touched tests were run instead of the whole suite: cargo test -p xcl --lib -- --test-threads=4 shaders:: three times on the merge gave 63 passed, 0 failed each time (1 SKIPPED: no Windows Developer Mode). On plain main the same command failed the four pipeline-library tests in 2 of 3 runs.
  • Whole diff read, no finding. No runtime code changes.
  • The PR description check is red on this head; that is about the description, not the diff.

AI use: Claude Code ran the builds, tests and smoke on Prime's PC and wrote this text. Approving is Prime's decision.

I use a temporary Discord to coordinate my work. Anyone helping test XCL or compare results is welcome. Test coordination on Discord

<!-- greyfinch-sync:ivall/xcl:review:6100534024 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3221#pullrequestreview-6100534024). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-11-28T23:26:21Z. **Review:** APPROVED --- Approving on a merge-check run on an RTX 3060 Ti 8 GB (driver 32.0.16.1714, i5-10400, Windows 11 Pro 26200, Rust 1.100.0). - Head `2c003dd6ac4bde876cd6c24cadc479ffcfa8e039` merged cleanly onto `main` `7db2f391`, and the workspace builds. - Test-only diff, so the touched tests were run instead of the whole suite: `cargo test -p xcl --lib -- --test-threads=4 shaders::` three times on the merge gave 63 passed, 0 failed each time (1 SKIPPED: no Windows Developer Mode). On plain `main` the same command failed the four pipeline-library tests in 2 of 3 runs. - Whole diff read, no finding. No runtime code changes. - The `PR description` check is red on this head; that is about the description, not the diff. AI use: Claude Code ran the builds, tests and smoke on Prime's PC and wrote this text. Approving is Prime's decision. I use a temporary Discord to coordinate my work. Anyone helping test XCL or compare results is welcome. [Test coordination on Discord](https://discord.gg/6B4TykyC4W)
Foniass commented 2026-11-29 14:57:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T14:57:43Z.


merge-check
base: d8bd9a38204667f3ca7dd9eeffcc2f1c937b07b0
head: 2c003dd6ac4bde876cd6c24cadc479ffcfa8e039
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2614 passed, 4 failed, 49 ignored; SKIPPED: 44; failing: gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3 (driver E_OUTOFMEMORY, same on base on this machine)
review: test-only (8 lines). It serialises the pipeline_library / warm_library tests that are flaky on CI (#3283, #3298, #3214 and others). It needs the test-only label.
performance: none (tests only)
verdict: safe to merge (with the test-only label)
hardware / tool and model: RTX 5070 Ti (driver 32.0.16.2114), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

Merge-check run and written with Claude Code (Claude Opus 5.5): a test merge onto the base above and the full suite on this machine. The 4 fuzz_validate_and_gpu_* failures happen on main on this machine too. Note: main's own CI run on 3b6a91ed fails on these same 4 pipeline_library / warm_library tests.

<!-- greyfinch-sync:ivall/xcl:comment:7257710413 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3221#issuecomment-7257710413). Originally posted by [Foniass](https://github.com/Foniass) on 2026-11-29T14:57:43Z. --- ```text merge-check base: d8bd9a38204667f3ca7dd9eeffcc2f1c937b07b0 head: 2c003dd6ac4bde876cd6c24cadc479ffcfa8e039 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2614 passed, 4 failed, 49 ignored; SKIPPED: 44; failing: gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3 (driver E_OUTOFMEMORY, same on base on this machine) review: test-only (8 lines). It serialises the pipeline_library / warm_library tests that are flaky on CI (#3283, #3298, #3214 and others). It needs the test-only label. performance: none (tests only) verdict: safe to merge (with the test-only label) hardware / tool and model: RTX 5070 Ti (driver 32.0.16.2114), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 ``` Merge-check run and written with Claude Code (Claude Opus 5.5): a test merge onto the base above and the full suite on this machine. The 4 `fuzz_validate_and_gpu_*` failures happen on main on this machine too. Note: main's own CI run on 3b6a91ed fails on these same 4 pipeline_library / warm_library tests.
andrewDoing commented 2026-11-29 15:12:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-29T15:12:40Z.


I checked the extra pso_measurement_compiles_an_exact_synthetic_record guard in 2c003dd6, compared with #3183. The measurement body uses CreateComputePipelineState directly. It does not call Pipelines::make_required, which inserts into the process-wide builder.

In a test instrumented to hold the replacement library open until the other test finished:

  • RTX 5070 / 616.92, measurement only unlocked: the synthetic measurement created its native compute PSO while replacement was open. The builder still finished with the expected two entries and both tests passed. This control bypassed the cache-disable preflight because Windows returned 0x887A002D, so it checks entry count and does not measure cache-off compile time.
  • WARP, split-shader test only unlocked: the builder received the two split .chain.pso keys and finished with four entries instead of two. Restoring the guard gave two passing tests with zero skips. This is the same contributor that #3183 already covers.

The stock measurement test skipped at cache preflight on both adapters. Forcing it past that check on WARP led to E_INVALIDARG at pipeline creation even when run by itself, so the successful measurement-overlap control is scoped to the native RTX adapter.

For the reproduced entry-count flake both PRs serialize the tested split-shader writer. I found no evidence that the extra measurement-test lock is needed for that count. This is the CI failure reported on the base of #3219 as well.

AI disclosure: OpenAI Codex (GPT-6.2 Sol) added the bounded test scheduling, ran these controls and drafted this comment.

<!-- greyfinch-sync:ivall/xcl:comment:7257907860 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3221#issuecomment-7257907860). Originally posted by [andrewDoing](https://github.com/andrewDoing) on 2026-11-29T15:12:40Z. --- I checked the extra `pso_measurement_compiles_an_exact_synthetic_record` guard in `2c003dd6`, compared with #3183. The measurement body uses `CreateComputePipelineState` directly. It does not call `Pipelines::make_required`, which inserts into the process-wide builder. In a test instrumented to hold the replacement library open until the other test finished: - **RTX 5070 / 616.92, measurement only unlocked:** the synthetic measurement created its native compute PSO while replacement was open. The builder still finished with the expected two entries and both tests passed. This control bypassed the cache-disable preflight because Windows returned `0x887A002D`, so it checks entry count and does not measure cache-off compile time. - **WARP, split-shader test only unlocked:** the builder received the two split `.chain.pso` keys and finished with four entries instead of two. Restoring the guard gave two passing tests with zero skips. This is the same contributor that #3183 already covers. The stock measurement test skipped at cache preflight on both adapters. Forcing it past that check on WARP led to `E_INVALIDARG` at pipeline creation even when run by itself, so the successful measurement-overlap control is scoped to the native RTX adapter. For the reproduced entry-count flake both PRs serialize the tested split-shader writer. I found no evidence that the extra measurement-test lock is needed for that count. This is the CI failure reported on the base of #3219 as well. AI disclosure: OpenAI Codex (GPT-6.2 Sol) added the bounded test scheduling, ran these controls and drafted this comment.
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!3221
No description provided.