Shaders: share verified compute blobs across preparation worker counts #3086
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3086"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-11-28T02:42:35Z.
The launch pass keeps a receipt of the compute blobs it validated on this adapter and driver (
warm_blobs::Verified), so a later launch takes them without validating them again. The receipt's file name hashedXCL_PRECOMPILE_SLICE, the worker'si/count, into its key. A launch with another worker count (another machine, a differentXCL_PREPARE_WORKERS, or the count #2705's fix changes) found none of its receipts and validated every blob again.This keeps one receipt per native identity (
verified-compute-v2-<native>.bin), imports the v1 files of every slice of the same identity once, merges concurrent writers under a lock file before it replaces the receipt, and saves every 64 new entries so an interrupted pass keeps what it validated (a failed save is tried again after 64 more).What is in it
crates/xcl/src/shaders/warm_blobs.rs: the v2 receipt, the v1 import, the locked merge and the checkpoints; a test with two workers opened before either writes, a v1 slice file to import, another device's identity, and the checkpoint a dropped worker leaves.README.md: one line.Tested
x86_64-pc-windows-gnu:cargo test -p xcl --lib warm_blobs -- --test-threads=4atfdbac840: 3 passed, 0 failed, 0 ignored (1408 filtered out), witha_failed_checkpoint_is_tried_again_after_64_more_entriesRegression run
scripts/smoke.ps1needs Windows (see Not tested).Not tested
scripts/smoke.ps1onmainand on this head; a launch with and without it, to count the validations it saves.AI use
Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-28T03:10:37Z.
I checked the checkpoint failure path at head
f147360fwith a deterministic Windows Rust probe. It uses the exact receipt open/record/save/flush/merge methods, real per-receipt file locking and disk reads, and a mocked final writer that either succeeds or persistently fails. Each arm records 1,024 distinct synthetic keys.After the first failed checkpoint, the dirty count remains at or above the threshold, so every subsequent record serializes and retries while taking the locks. When the writer was restored, an explicit final save succeeded and all keys, including the last, were present on reopen in both arms.
This is failure-path amplification, not observed title timing or evidence of data loss in the successful final-save control. A separate next-attempt threshold or backoff could bound retries while keeping unsaved entries dirty and preserving the final save; any change needs to retain recovery semantics. The final replacement failure was injected in the probe, not produced by a real filesystem failure.
AI use: OpenAI Codex with GPT-6.2 Astra built and ran the probe; Codex reviewed and prepared this report.
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-28T03:14:59Z.
Windows run (listed under Not tested): the whole suite passes. The new test passes 40 of 40, and it catches each part of the change when that part is removed.
Tested:
f147360(its base is currentmain753e8b1, so head = merged). RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug.cargo test --workspace --no-fail-fast -- --test-threads=4SKIPPEDlines (no wave64, refused per-lane f16/f32 forms,heap_window_out_of_memory_falls_back_to_the_switch_form)warm_blobstests alone, 40 runs each;shaders::(41 tests) at--test-threads=8, 40 runsScratch mutations, 10 runs of each test (
warm_receipt_matches_only_the_validated_blob_and_layoutpasses under all four):workers_reuse_previous_slices_and_merge_concurrent_checkpointsmerge_and_savedoes not read the saved receipt before writingmerged.contains(&[2, i, 0]) && merged.contains(&[3, i, 0]))lock.lock()removedcontains(&[4, 63, 0]))a.contains(&first))So on Windows the lock holds between two handles in one process, and the replace under it works.
Not tested: a launch with and without the change (no title here), a release build.
AI use: Claude Code (Claude Opus 5.5) ran the tests and the scratch mutations and wrote this report.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-11-28T03:16:10Z.
Confirmed and fixed in
fdbac840(squashed into the PR's commit): after a failed checkpoint,recordtries again only once 64 more entries are unsaved (Entries::failed_at), and a successful save clears it. The finalsavestill writes whatever is unsaved.New test
a_failed_checkpoint_is_tried_again_after_64_more_entries: a directory sits where the receipt goes, so its replacement fails; after 100 records the only attempt was at 64; with the directory gone, the next attempt at 128 saves all of them. With the oldunsaved >= 64it fails (left: 100, right: 64: an attempt on every record from 64 on).cargo test -p xcl --lib warm_blobs -- --test-threads=4under Wine 11.21 (Linux, no GPU, Rust 1.98.0, release): 3 passed, 0 failed.AI use: Claude Code (Claude Opus 5.5) wrote the fix and the test, ran them and wrote this reply.
Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-28T03:24:50Z.
I retested the checkpoint retry fix with a real Windows replacement failure, comparing original
f147360fand updatedfdbac840. The probe uses each revision's exact receipt methods and production temp-create/write/rename/cleanup path, with two test-only counters.Each run seeded one key, then held the existing receipt open with read/write sharing but without delete sharing while recording 1,024 new keys. Under that lock:
Healthy controls were 16 attempts / 209,408 bytes on both revisions. The locked on-disk receipt remained at its seeded key; after closing the handle and explicitly saving, all 1,025 exact keys were present on reopen in both cases.
This verifies bounded checkpoint retries and eventual explicit-save recovery under the tested sharing violation. It does not measure retail startup time or other filesystem failure modes.
AI use: OpenAI Codex with GPT-6.2 Astra ran the tests; Codex reviewed and prepared this report.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T03:34:04Z.
Independent Windows check of #3086 head
fdbac840, completed as the PR merged. Windows 11 build 26300, RTX 3080 Ti (driver 621.35), rustc 1.99.1 MSVC, DXC/DXIL 1.8.2502.11.Tested
cargo build --offline --locked -j 4 --workspace: passed.cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4: 1,513 passed, 1 failed, 47 ignored, with 25SKIPPEDGPU notices. All threeshaders::warm_blobs::testspassed, including the new failed-checkpoint retry test.gpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk(cached_only console_mesh hit: "DXIL not compiled yet"). I ran that fully qualified test alone on the PR's untouched parent753e8b1a: 0 passed, 1 failed, 0 ignored, with the same error. The full-suite failure is therefore not introduced by this PR.Regression run
Clean
cargo build --release --offline --locked -j 4 -p xclbuilds, same local title, adapter,XCL_PREPARE=0,XCL_ADAPTER=nvidia, and 60-second duration in both runs. These are the blocks printed byscripts/smoke.ps1:The pair is a runtime regression check, not a measurement of this PR's startup saving:
XCL_PREPARE=0bypassed shader preparation, and the two commits include other upstream changes. No input was supplied, so progress beyond the initial screens was not verified. I did not run a prepared title launch or measure receipt reuse across different worker counts on this hardware.AI use: Codex (GPT-6.2 Sol) ran the builds, suite, parent control and paired smoke, checked the outputs, and drafted this report.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-28T03:35:36Z.
Tested — post-merge verification of the final PR head
I reran the pinned CPU test executable for
fdbac840ba68b1706136564fbcfa8ddffb1d5b8don native Windows 11 25H2 build 26200.9974, AMD Ryzen 7 3800X, Rust 1.100.1 MSVC x64 debug. The binary used the verified Git archive with a private test fixture appended to the unchanged production module.warm_blobs.rshas the same Git blob in merge commite429936c10a5b8aa09470ff99dfc8c8d3d8c56fd. The executable was built from the PR head.<libtest.exe> --exact shaders::warm_blobs::cross_process_probe::native_receipt_child --nocapture --test-threads=1ran as two writers and a fresh reader. Both writer PIDs opened empty snapshots before the harness released them. Each recorded 65 disjoint keys, with zero unsaved entries after its automatic 64-key checkpoint and again after its final explicit save. The reader found the exact 130-key union and zero keys for a second synthetic identity. A separate parse checked 130 unique rows in the 3,128-byte receipt.<libtest.exe> --exact shaders::warm_blobs::tests::workers_reuse_previous_slices_and_merge_concurrent_checkpoints --nocapture --test-threads=1passed as the stock merge control.4 passed, 0 failed, 0 ignored, 0 runtime skips. All four native processes and the harness exited 0.
Not tested
Simultaneous lock contention, forced write failure, real driver identities, GPU execution, retail launch, performance, and the full workspace suite.
AI use
T3 Code through the Codex harness (
gpt-6.2-sol) verified the source and executable, ran the native processes, checked the receipt and wrote this report.