Skip to content

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

Merged
Prime1997 merged 1 commit into
xcl-dev:mainfrom
Kalmarv:followup/ci-pipeline-library-test
Nov 29, 2026
Merged

Prime1997 merged 1 commit into
xcl-dev:mainfrom
Kalmarv:followup/ci-pipeline-library-test

Conversation

@Kalmarv

@Kalmarv Kalmarv commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Build and test (Windows, no GPU) fails at random on main: on beeb81b, 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 beeb81b'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

shaders::pipeline_library keeps one process-wide builder: 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. When one of them ran beside
builder_deduplicates_names_and_atomically_replaces_output, its pipelines
landed in that test's library, and finish() counted 3 or 4 entries
against the 2 the test stored (pipeline_library.rs:414). The panic
poisoned BUILD_TEST, so the three tests waiting on it failed as well.
On CI (WARP, --test-threads=4) this happened on main beeb81b, right
after split_compute_program_prebuilds_and_caches_chain_pieces finished,
and passed on the same tree in another run.

stale_blob_cannot_bypass_the_offline_pipeline_cap,
split_compute_program_prebuilds_and_caches_chain_pieces and
pso_measurement_compiles_an_exact_synthetic_record now hold BUILD_TEST
as well, and every BUILD_TEST holder takes the lock even when it is
poisoned, so a test that panics while it holds it fails alone instead of
failing every test queued behind it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added area:shaders Shader cache, PSO compilation, pipeline libraries, precompilation gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) labels Nov 28, 2026

@Prime1997 Prime1997 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Foniass

Foniass commented Nov 29, 2026

Copy link
Copy Markdown
Contributor
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 3b6a91e fails on these same 4 pipeline_library / warm_library tests.

@andrewDoing

Copy link
Copy Markdown
Contributor

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 Tests: serialise the stale-blob pipeline test with library builds #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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:shaders Shader cache, PSO compilation, pipeline libraries, precompilation gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) test-only A maintainer reviewed the diff: tests only, no smoke run needed for this revision (CONTRIBUTING.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants