Skip to content

Tests: serialise the stale-blob pipeline test with library builds - #3183

Open
tiagonleal wants to merge 1 commit into
xcl-dev:mainfrom
tiagonleal:tests/pipeline-library-shared-state
Open

tiagonleal wants to merge 1 commit into
xcl-dev:mainfrom
tiagonleal:tests/pipeline-library-shared-state

Conversation

@tiagonleal

@tiagonleal tiagonleal commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Part of #3180. #3221 (merged on 29 Nov) already serialises the tests this PR used to lock and made the lock poison-tolerant, so those parts are dropped. The branch is now one commit of two lines.

What is left: a_stale_blob_the_driver_takes_is_made_with_one_create_and_replaced makes two pipelines through Pipelines::make_with_cache_path, and every successful make reaches pipeline_library::store. The test did not hold BUILD_TEST. When it overlaps a locked test that has a library build active, its pipeline lands in that test's library and the entry count is one too high. This is the class of intermittent failure listed in #3180.

It is the only test in the lib test binary that reaches store without the lock. I checked this by reading the callers of the make* functions: the other makes are in tests that already hold BUILD_TEST, the pipeline_library tests that do not lock use NativeLibrary directly, and the two-pass test in real.rs returns before store.

What is in it

  • shaders.rs: that test takes BUILD_TEST (poison-tolerant, as the other tests do) at its start
  • +2/-0, one file, inside #[cfg(test)]

Tested

  • Windows 11 Pro 10.0.26300, NVIDIA GeForce RTX 5070 Ti 16 GB (driver 617.42), AMD Ryzen 7 9800X3D, 32 GB RAM, rustc 1.100.0, debug
  • cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 on head c3d1bd7d: 2841 passed, 0 failed, 51 ignored (24 SKIPPED lines: 22 no wave64, 2 no heap windows; the same 24 in both logs). main f97120dc on the same machine: 2841 passed, 0 failed, 51 ignored.

Regression run
scripts/smoke.ps1 -Seconds 60 -Title 9cc6a39e (a retail title), release builds of both commits, main f97120dc and this PR's head c3d1bd7d, one run each. A second run of main after the PR runs gave 1680 frames.

main (f97120dc):

xcl-smoke v1
commit: f97120dc196ca05e7f47e919d3675f7d5a2b478a
gpu: NVIDIA GeForce RTX 5070 Ti
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1635 (PresentX 1635)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15366 MB

This PR (c3d1bd7d):

xcl-smoke v1
commit: c3d1bd7d554ade974f47981d17d1160d3c3a250d
gpu: NVIDIA GeForce RTX 5070 Ti
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1659 (PresentX 1659)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15789 MB

Not tested

  • No test that fails without the change. It needs two tests to overlap in time on a GPU, which I cannot reproduce on demand.
  • AMD.
  • The retail title beyond the 60 s smoke. The diff is test-only (inside #[cfg(test)]) in a runtime file.

AI use

  • Claude Code with Claude Opus 5.5 wrote the change and Claude Fable 5.2 directed the diagnosis, ran the tests and wrote this description.

@andrewDoing

Copy link
Copy Markdown
Contributor

I reproduced the builder's 4 instead of 2 failure on Windows WARP and verified this PR's exact diff applies cleanly to merged main beeb81be. The #3219 hosted run saw 4, and its base run saw 3; both then failed the same three tests on the poisoned lock.

I selected the real builder_deduplicates_names_and_atomically_replaces_output and split_compute_program_prebuilds_and_caches_chain_pieces tests. A test-only handshake paused the owner after it opened its replacement library and let the split test reach its first pipeline builds. All waits were bounded. Each row used a fresh process, Ryzen 7 5700X3D, Windows 11, WARP software adapter, debug MSVC. No skips.

Revision Serial control Deliberately overlapping replacement and split build
Main beeb81be 2 passed 1 passed, builder failed with 4 entries instead of 2
Same main + #3183 diff from 78477c1b 2 passed 2 passed; the competing test observed the held BUILD_TEST guard before continuing

The stock overlap added exactly d64e5342b8bdf90a-cd4-0.chain.pso and dc6482d7869677a9-d50-0.chain.pso to the owner's library. With the guard applied, the schedule released the owner after observing that the waiter could not yet take the lock; the owner verified its two entries and the split test then finished. This supports the existing fix for this pair. No retail run or hardware-GPU result is claimed.

AI assistance: OpenAI Codex (GPT-6) prepared and ran the bounded schedule and drafted this note.

@thehollowedone

Copy link
Copy Markdown
Contributor

Independent Windows/NVIDIA check of #3183 head 78477c1b, with db3921dc as its exact parent. Windows 11 build 26300, RTX 3080 Ti / NVIDIA 621.35, Ryzen 7 9800X3D, rustc 1.99.1 MSVC. I built the clean head first so the e2e title and DLL existed.

  • cargo build --offline --locked -j 4 --workspace: passed.
  • cargo test --offline --locked -j 4 -p xcl --lib shaders:: -- --test-threads=16: 53 passed, 0 failed, 0 ignored, 0 skips. This includes the builder test and both newly guarded shader tests.
  • cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4: 2,144 passed, 1 failed, 48 ignored across 39 test targets, with 25 explicit GPU SKIPPED notices counted among passes. All five e2e tests passed. The sole failure was console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk (DXIL not compiled yet). I reran that test on the clean exact parent: 0 passed, 1 failed, 0 ignored, with the same error. The full local suite is therefore not green; this failure predates the PR.

I reviewed the test-only diff (6 added and 4 removed lines). The affected callers take BUILD_TEST before entering the process-global pipeline-library build; I found no reverse lock acquisition in these paths. The poison recovery prevents one assertion failure from cascading through the other library tests. This review and run do not measure retail startup or AMD/Intel behavior. The PR's hosted Windows and description checks are green.

AI use: Codex (GPT-6.2 Sol) reviewed the diff, checked the lock paths and ran these tests.

@tiagonleal

Copy link
Copy Markdown
Contributor Author

@thehollowedone @andrewDoing thanks for both checks. The four tests this PR fixes went red again today on three CI runs of PRs that do not touch shader code: 46257764057 (#3190), 46260503226 (#570) and 46265260479 (#2858). Each time builder_deduplicates_names_and_atomically_replaces_output failed first and the other three followed.

This PR still merges into main without conflict and its checks are green, but the queue in #3041 shows it with no merge-check, because it only counts comments in the merge-check format with a verdict: line. If either of you is willing to repost your result in that format, that would let it move.

  • Tiago

@tiagonleal
tiagonleal force-pushed the tests/pipeline-library-shared-state branch from 78477c1 to c74fcaa Compare November 29, 2026 22:55
@tiagonleal tiagonleal changed the title Tests: pipeline library tests no longer share a build with two shader tests Tests: serialise the stale-blob pipeline test with library builds Nov 29, 2026
@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 29, 2026
a_stale_blob_the_driver_takes_is_made_with_one_create_and_replaced
makes two pipelines through Pipelines::make_with_cache_path, and every
successful make reaches pipeline_library::store. It did not hold
BUILD_TEST, so when it ran while a locked test had a build active
(between begin and finish), its pipeline was stored into that test's
library and the entry count came out one higher than asserted (xcl-dev#3180).

It is the only test in the lib binary that reaches store without the
lock: the other makes are in tests that already hold it, the
pipeline_library tests that do not lock use NativeLibrary directly,
and the real.rs two-pass test returns before store.
@tiagonleal
tiagonleal force-pushed the tests/pipeline-library-shared-state branch from c74fcaa to c3d1bd7 Compare November 30, 2026 04:41
@BBareth

BBareth commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

merge-check claim
head: c3d1bd7

@github-actions github-actions Bot added needs-1st-check Passes gates; needs first independent merge-check (#3041) needs:amd-test Needs a test report or merge-check on an AMD GPU needs:nvidia-test Needs a test report or merge-check on an NVIDIA GPU labels Nov 30, 2026
@BBareth

BBareth commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

merge-check
base: 86e86fc
head: c3d1bd7
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2889 passed, 0 failed, 51 ignored; 28 SKIPPED lines, as on the base; failing: none. The base alone, same run: 2889 passed, 0 failed, 51 ignored, 28 SKIPPED lines (22 no wave64, 2 no heap windows, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 cannot disable the driver cache). shaders::pipeline_cap_tests::a_stale_blob_the_driver_takes_is_made_with_one_create_and_replaced ran and passed.
review: no blocking finding; test-only, one file (+2/-0), read. The test takes pipeline_library::BUILD_TEST at its start, poison-tolerant like the tests that already hold it, and it takes no other test lock before it, so it adds no lock-order pair. I did not re-check the description's statement that this is the only test reaching store without the lock. The miscount this is for did not occur on the base in this run, so the run shows no regression, not the fix. No runtime code changes.
performance: none: tests only (one more test serialised with the library-build tests).
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.

@github-actions github-actions Bot added needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) and removed needs-1st-check Passes gates; needs first independent merge-check (#3041) needs:nvidia-test Needs a test report or merge-check on an NVIDIA GPU labels Nov 30, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head c3d1bd7

#3221 (merged) serialised the other pipeline-library tests with BUILD_TEST; on main a_stale_blob_the_driver_takes_is_made_with_one_create_and_replaced in shaders.rs still does not take it, and this PR adds exactly that lock. #3190 and #3472 (same issue #3180) lock other tests in alloc_pool.rs / list_x.rs, not this one.
No problems found in the diff.
Recommendation: keep open.

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

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

merge-check
base: 493dbd3
head: c3d1bd7
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2900 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (+2, inside #[cfg(test)] in shaders.rs). a_stale_blob_the_driver_takes_is_made_with_one_create_and_replaced (~2207) now takes pipeline_library::BUILD_TEST (poison-tolerant), because its two Pipelines::make_with_cache_path calls reach pipeline_library::store and can land in another test's active library build, making that test's entry count one too high (#3180). I checked the other callers that reach store: the remaining tests either hold BUILD_TEST already (after #3221) or use NativeLibrary directly. Fine: nothing outside the test changes, and the lock matches the one the pipeline_library tests take (pipeline_library.rs ~156). No smoke run here: test-only.
performance: no smoke run (the default path doesn't reach this change); not measured. Test-only: no runtime path changes.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

@github-actions github-actions Bot added ready-to-merge Has 2 independent safe merge-checks on current head (#3041) and removed needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) needs:amd-test Needs a test report or merge-check on an AMD GPU labels Dec 1, 2026
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) ready-to-merge Has 2 independent safe merge-checks on current head (#3041)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants