perf(pipeline): speed up cached pipeline loading while preserving cache reuse #481
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/gamingwithhomie--larp!481
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-481"
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?
@ZerefDragnee1l on GitHub · 2026-12-06 01:24 UTC · original
ZerefDragnee1l:perf/cached-pipeline-load-speed→main· +2160 −547 · 6 files · 2 commits · openSplits the cached pipeline loading and creation optimizations out of #408 onto current
main(preserving #376Store/WindowsIdentityscoping and zero cache invalidation).Summary
shader_cache.rsandcrates/larp-shader/src/**are untouched, andGraphicsState::describe_cached()is unit-tested to match the exact legacydescribe()format byte-for-byte so existing on-disk PSO blobs andcreated-pipelines.binkeys stay 100% valid.blobs.rs,created.rs,make.rs):Storedisk index scanning (00..ffshardedRwLock<HashSet<[u8; 16]>>scanned across up to 8 threads),created-shaders.binparallel BLAKE3 hashing, zero-copycreated-pipelines.binparsing (ListedRef), andquad-pipelines.txtloading.Pendingkeys in parallel and queues compute pipelines ahead of graphics pipelines in one batch.blobs-index.binsidecar (keyed by exe metadata,shader_replace::fingerprint, env toggles, and host caps + BLAKE3 footer) so warm runs skip queueing and translating already-cached non-compute graphics/mesh pipelines when their blobs are confirmed on disk. Wheneverblobs-index.binis absent, truncated, has a bad footer/digest, or carries a stale fingerprint (or when an entry's blob is missing from disk), startup fails open to an empty warm map and queues every pipeline normally.DISK/NOTEDdedup sets from startup catalog loading and removes redundant 10s sleep inpreload_done()viablobs::flush().blobs.rs,host.rs,pipeline.rs,shader_replace.rs):BlobBytes::Ownedslices&bytes[HEADER..]directly without an extraArc<[u8]>copy on warm loads (keeping BLAKE3 verification on by default;LARP_FAST_BLOB_READ=1opt-in).blobs::pass_over_if_on_disk(&name)check skips buildingD3D12_GRAPHICS_PIPELINE_STATE_DESC,Stream, label strings,build_stages, and COM root signatures when warming cached graphics/mesh blobs.RwLock, shares cachedArc<Plan>onTranslated, unifiesgfx10::decodeacrossstore_flags(), cachesof_builderspilled checks andHAS_HEAP, and avoids waking emptyDONE/ polling loops (DONE_WAITERS+DRAINED).Queue::bumpfixes and adds adaptive quiet window (400mswarm /3scold) before lifting menu input hold.Verification
git diff --check-> cleancargo check -p larp-> exited 0 (larp-gpucompiled with 0 warnings)cargo test -p larp-gpu --lib pipeline->16 passed; 0 failed; 2 ignored(native_windows_compute_blob_dispatchandcompare_listed_shader_resolutionignored by upstream#[ignore]attributes), includinggraphics_state_describe_cached_matches_legacy_format,warm_index_round_trip_and_fingerprint_mismatch, and caller-level fail-open testwarm_index_load_and_flush_fail_open_to_full_queue.@vanya890 on GitHub · 2026-12-06 01:37 UTC · original
The sidecar codec tests cover round-trip, fingerprint mismatch and corruption rejection. One important safety boundary is still worth pinning at the caller: when
blobs-index.binis absent, truncated, has a bad footer, or carries a stale fingerprint, does warm startup always fall back to the full legacy queue rather than skip any pipeline? Since the index can suppress queueing/translation for cached graphics and mesh PSOs, a focused fail-open test around the load/flush path would protect the optimization from ever turning an invalid sidecar into a missing pipeline at runtime.@ZerefDragnee1l on GitHub · 2026-12-06 01:44 UTC · original
Good catch — added caller-level fail-open coverage in commit
f447885.How
listed()fails openload_warm_index()returns an emptyHashMapwheneverblobs-index.bincannot be read ordecode_warm_index()rejects it (too short, badVICBIDX1magic, stale fingerprint, trailing BLAKE3 footer mismatch, or mismatched entry count).warm_map(or wheneveron_diskreturnsfalsefor a given blob key),try_warm_skip()leavespending.warmed == falseandplan_listed_queues()pushes every resolved graphics/mesh/quad-mask and compute pipeline onto the startup queues (identical to the legacy path). Compute pipelines are never skipped regardless ofwarm_map.save_warm_index()/write_warm_encoded()), a valid atomic write + rename replaces any corrupted on-diskblobs-index.binwithout leaving.tmpartifacts behind.Regression test & verification (
f447885)try_warm_skip,build_listed_entry,plan_listed_queues, andwrite_warm_encoded/write_warm_indexincrates/larp-gpu/src/pipeline/make.rs.warm_index_load_and_flush_fail_open_to_full_queueexercising realisticPendingpipelines (vertex+pixel,quad_of,mesh+pixel, andcompute) across:blobs-index.bin-> fails open to full legacy queue (3graphics +1compute,warmed == falsefor all).blobs-index.bin-> fails open to full legacy queue.blobs-index.binis cleanly replaced with valid contents and no leftover*.tmp.Ran after the final edit:
git diff --check-> cleancargo check -p larp-> exited 0 (0 warnings inlarp-gpu)cargo test -p larp-gpu --lib pipeline->16 passed; 0 failed; 2 ignored(native_windows_compute_blob_dispatchandcompare_listed_shader_resolutionrequire external GPU hardware / private cache dir).@christopear on GitHub · 2026-12-06 01:59 UTC · original
I ran the ignored
compare_listed_shader_resolutionbenchmark onf4478857with a populated cache under Proton Experimental (Windows MSVC release build). Five fresh processes, each using the test's original / cached / cached / original order. The stage and hash fingerprints matched on every pass.That's about 9.7× faster for this resolver, saving roughly 0.33 s in this measurement. The timer excludes reading the files and creating GPU pipelines. The regular
pipeline::filter also passed (15 passed, 2 ignored). I ran the populated-cache benchmark separately and left the native Windows GPU test alone.One integration detail if #435 also lands. A dry merge conflicted in
blobs.rsandmake.rs. Heretry_warm_skipcan skip scheduling a graphics key on a disk hit, while #435 decides to retain it during creation. A useful combined test would give both base and quad variants disk hits, mark just one wanted and verify that one is actually created and retained before first draw. Then swap which one is wanted.@ZerefDragnee1l on GitHub · 2026-12-06 02:02 UTC · original
Thanks for running the populated-cache
compare_listed_shader_resolutionbenchmark under Proton and flagging the #435 interaction!Agreed on the integration point with #435 (
LARP_KEEP_USED=1):try_warm_skip()runs independently on both the basePendingkey and itsPending::quad_ofvariant key inbuild_listed_entry(), combining #481 and #435 will needtry_warm_skip()(and thewarming/pass_over_if_on_disk()gate inPending::make()) to treat any key in #435's retained/wanted set (used-pipelines.txt) the same way compute pipelines are treated here—never warm-skipped and kept resident inself.made.blobs.rs/make.rsmerge conflict and add that exact combined base-vs-quad swap test (both on disk, mark only base wanted -> base queued & retained while quad skips, then swap so only quad is wanted).View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.