Repository navigation
Tests: serialise the pipeline tests that store into the library builder - #3221
Conversation
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>
Prime1997
left a comment
There was a problem hiding this comment.
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
2c003dd6ac4bde876cd6c24cadc479ffcfa8e039merged cleanly ontomain7db2f391, 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 plainmainthe same command failed the four pipeline-library tests in 2 of 3 runs. - Whole diff read, no finding. No runtime code changes.
- The
PR descriptioncheck 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
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 |
|
I checked the extra In a test instrumented to hold the replacement library open until the other test finished:
The stock measurement test skipped at cache preflight on both adapters. Forcing it past that check on WARP led to 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. |
Build and test (Windows, no GPU)fails at random on main: on beeb81b,shaders::pipeline_library::tests::builder_deduplicates_names_and_atomically_replaces_outputcounted 3 entries where it stored 2 (pipeline_library.rs:414). Three more tests then failed on the poisonedBUILD_TESTlock. 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 holdBUILD_TESTwhile they begin, store and finish, but three tests that make pipelines throughPipelinesdid 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 aftersplit_compute_program_prebuilds_and_caches_chain_piecesfinished.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_piecesandpso_measurement_compiles_an_exact_synthetic_recordholdBUILD_TEST.shaders.rs,shaders/pipeline_library.rs,shaders/warm_library.rs: everyBUILD_TESTholder 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
cargo test -p xcl --lib -- --test-threads=4(DXC 1.9.2609) at the head: 2455 passed, 0 failed, 29 ignored; 25 SKIPPED lines.XCL_ADAPTER=warp cargo test -p xcl --lib -- shaders:: --test-threads=4 --nocapture, 5 runs): the 6pipeline_libraryand 4pipeline_cap_teststests passed in all 5.pso_measurement_compiles_an_exact_synthetic_recordfails 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 downcold_publish_makes_an_unchanged_corpus_reusable, as it did with the lock alone.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
crates/xcl/src, so it needs thetest-onlylabel.Not tested
-p xcl --lib, the target the change touches).AI use
🤖 Generated with Claude Code