Shaders: keep pipeline libraries across changes and every runtime build #3633
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3633"
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 Kalmarv on 2026-12-02T02:30:52Z.
Prepared native pipeline libraries were thrown away whole whenever anything in their receipt changed: a translator source byte, a setting, the pipeline layout, the staged corpus, or the memory-window count. Nothing the title built while it ran was kept, so a title rebuilt the same pipelines in the driver every run. On a retail title with a prepared library (240 s run, RTX 5070 Ti, 16 windows), 144 driver builds took over a second each (690 s total), and 1 130 of the 1 739 drawn pipelines were in no staged corpus (same shaders, other blend or depth state), so they were rebuilt on every run.
A library entry's name is already the hash of the exact translated DXIL and state it was built from (
driver_cache::graphics_name,name_for_root_node), and runtime and preparation store and load through the same names. A changed input can only make a name miss, never load the wrong pipeline, so the receipt need not discard the library. This PR keeps the libraries and builds only what is missing:.xcl\pso-corpuslive under<game>\.xcl\pipeline-libraries\<windows>\(4,8,16-heap, ...), so layouts coexist;layout_namestrips bothHEAP_WINDOWSandHEAP_FLATso16 | HEAP_WINDOWS | HEAP_FLATstays16-heaprather than528-heap. The receipt (v4) keys on the driver and tracksgraphics_preparedandcompute_preparedseparately, with semantic settings split into graphics-only (XCL_DEBUG_LOD0,XCL_DEBUG_MAGENTA,XCL_DEBUG_NO_CULL,XCL_DEBUG_NO_STENCIL,XCL_DEBUG_PS_EXPR,XCL_DEBUG_PS_SUB,XCL_PIXEL), compute-only (XCL_DEBUG_CS_SUB,XCL_DIRECT_SPLIT_INSTRUCTIONS,XCL_HEAP_FLAT,XCL_HW_RT_TRAVERSE,XCL_PER_LANE,XCL_PER_LANE_MAX_INSTS), and shared switches. Corpus, translation, settings, and layout changes only mark the affected stage(s) stale: preparation skips any stage already current on disk (leaving its.plibuntouched) and only rebuilds stale/absent stages (importing unchanged names from the previous library, falling back once to legacy.xcl\pso-corpus\{compute,graphics}.plibon first upgrade).xcl cache statusreports per-stage state. A corpus without anidentityfile uses a deterministic content-derived fallback identity from its staged files so it still publishes a reusable receipt while different corpora never collide. Staged recipes build for the runtime layout (includingHEAP_FLATfor compute whenXCL_HEAP_FLAT=1, while passing the stripped window count to the graphics worker).XCL_PREPARE_CACHE_ONLY=1still refuses absent, stale, mismatched-driver, or unsupported-device prepared libraries and names what changed, while non-cache-only runs skip mismatched prepared libraries and still openruntime.plib.runtime.plibin XCL's per-title data folder keeps every pipeline built at runtime. Graphics (trackingdropped_rect_gsexplicitly soretry_without_rect_gsfallbacks are skipped whilefrom_previouslibrary hits remain storable during incremental preparation), graphics streams (which previously had no library lookup or store), both passes of two-pass pipelines (stored only once both passes succeed so a failing compute pass never leaves an orphaned mesh entry), and compute are stored in<XCL_DATA_ROOT | %LOCALAPPDATA%\XCL>\<title>\pipeline-libraries\<windows>\runtime.plib— never inside the game folder, so title folders stay read-only/untouched andscripts/smoke.ps1A/B runs stay isolated. It is flushed atomically every 30 s while it grows (paced by size) and at shutdown (bounded to 5 s in bothWM_CLOSEandend_title, setting a shutdown stop flag for the periodic flusher and always returning the periodic flusher's thread ID alongside any timed-out end-flush thread ID soend_titlenever suspends a flush thread while it may hold the process heap or D3D12 lock duringdrain_gpuandlog::flush) under a dedicatedflush_lockheld end-to-end acrossadded.swap(0)+ fallibletry_reserve_exactSerialize()(returningE_OUTOFMEMORYinstead of aborting the process under tight commit) +write_atomic(), without holding any load-blocking lock during serialization or disk I/O. Startup cleans up stale dead-PIDruntime.tmp*files, and persistent write failures stop retrying after 3 consecutive errors (or immediately onERROR_WRITE_PROTECT). D3D12 retains the opened bytes in RAM and each flush serializes a temporary copy (~1–2x the file size in commit);XCL_RUNTIME_LIBRARY_MBdefaults to2048MiB (0disablesruntime.plib) and is enforced on both store/save and load viatry_reserve_fastheld understore_lock.read()plus exactstore_lock.write()checks against an admission ceiling (cap - 2 MiBwith64 KiBper-entry overhead) so D3D12 metadata/subobject overhead cannot push a flush overcap, without latching full on a single unreadable or oversized blob. A siblingruntime.stamprecords per-build byte counts (<layout:translation:settings> <bytes>) so under-cap libraries and full libraries built mostly by the current build survive unchanged while a full library carrying more than half older-build bytes resets fresh. Allruntime.plibread paths (activate,warm_library::inspect,warm_library::publish_stages) shareread_runtime_file, which skips the file at zero cap, rejects oversized files from the opened handle's metadata before reading, and bounds reads withRead::take(cap + 1)if a file grows concurrently;warm_library::statusinspects metadata only.XCL_ONE_BUILD_WAIT_S, default 60 s) and then reuse its cached driver blob directly from the library (Loaded::Blob) to create a distinct COM object without recompiling, even for small shaders belowCOMPUTE_BLOB_MIN_DXIL(16 KiB).ComputeBuild::CachedWholeprobes, chained two-pass compute passes, and full runtime libraries skipone_build;finish_two_passreleases the meshone_buildflight (viarelease_deferred()) and compile slot before entering computeone_buildwhile deferringstore(&mesh_pso)until the compute pass also succeeds;big_compile_turnreleases anyone_buildflight owned by a background worker when it parks; normal-priority callers take over a flight held by a below-normal preload worker immediately rather than waiting behindTHREAD_PRIORITY_LOWESTbackground work; and if a holder finishes without storing a usable entry inruntime.plib(e.g.dropped_rect_gs,hr < 0, unreadable blob,UnusableExisting,TransientError, or over-cap), all waiters wake immediately and build in parallel instead of serializing on a miss.Loaded::Pipeline); later lookups read its cached blob through the adoption-awarereal::read_pso_cached_blobhelper (Loaded::Blob) so callers build a distinct COM object without recompiling even after the first object's vtable was swapped byadopt. TransientStorePipelineerrors stay retryable andE_INVALIDARGafter a failed load is not marked handed out.Pipelines:log line counts prepared / runtime library / blob / built / built after a refused blob per kind (classifyinggraphics stream*labels underStreamand not counting failed fresh builds asBuilt). Refused blobs log their HRESULT.XCL_PIPELINE_MEASURE=1marks any run that built in the driver as invalid.XCL_RDNA_FLOAT,XCL_WATERFALL_COLLAPSE,XCL_PER_LANE_MAX_INSTS, andXCL_HW_RT_TRAVERSEjoin the settings key (alongsideXCL_WAVE64_IDIOMSfrommain). The v1/v2 receipt migration and legacy identities are removed; old.plibfiles in.xcl\pso-corpus\are imported once on first preparation for a layout and can be deleted afterward.Why this is one PR (3 240 insertions / 509 deletions including ~1 300 lines of unit tests): keeping prepared libraries alone still leaves every unrecorded pipeline to rebuild every run; the runtime library deadlocks without hand-out-once, double-compiles concurrently without
one_build+Loaded::Blob, and cannot be verified without thePipelines:accounting.What is in it
crates/xcl/src/shaders/warm_library.rs: layout-scoped prepared folders (layout_namestripsHEAP_WINDOWS | HEAP_FLAT;window_counthelper;runtime_windowsdelegates torecomp::pso::windows_for), legacy.xcl/pso-corpus/*.plibfallback import (previous_library), per-titledata_dirpath forruntime.plib, v4 receipt with independentgraphics_prepared/compute_prepared(and deterministic content-derived fallback identity when a staged corpus has noidentityfile),StageState/CurrentStages/current_stages/publish_stagespreserving untouched current.plibfiles,Library::{Current, Stale, Absent}, capped runtime reads ininspect/publish_stages, metadata-only per-stagestatuscrates/xcl/src/shaders/pso_corpus.rs: prepare staged recipes for the runtime layout into its library folder, skipping already-current graphics or compute stages in 0 s viawarm_library::current_stages, passing strippedwindow_count(windows)to the graphics worker andwarm_library::previous_libraryon first upgrade, and publishing only rebuilt stages viawarm_library::publish_stagescrates/xcl/src/shaders.rs:prepare_for_launchlibrary reuse,XCL_PIPELINE_LIBRARY_PREVIOUSviawarm_library::previous_library,cache_only_missreasons,xcl cache status, graphics/compute/shared split insemantic_pipeline_setting(warm_graphics_settings_key,warm_compute_settings_key,warm_settings_key)crates/xcl/src/shaders/pipeline_library.rs:runtime.plibactivation indata_dir, non-fatal driver mismatch fallback (unlessXCL_PREPARE_CACHE_ONLY=1with prepared libraries), shared cappedread_runtime_file, fallibletry_reserve_exactNativeLibrary::serialize, adoption-awareread_cached_blob/cached_blob_size, atomic fast-path + exact write-lock cap enforcement (2048MiB default, single unreadable/oversized blob skips without latching full), per-build byte accounting inruntime.stampwith auto-reset when a full library is majority older-build, retryable transientStorePipelineerrors and failed-loadE_INVALIDARGhandling,Loaded::{Pipeline, Blob},flush_lock-serializedflush_runtimeand boundedflush_runtime_timeout(with shutdown flag and always-excluded periodic flusher TID) + persistent-error stop + dead-PIDruntime.tmp*cleanup, park-releasing / priority-aware / parallel-unshared-wakeupone_build, unit testscrates/xcl/src/shaders/pipeline_stats.rs(new): per-kind counts (graphics stream*->Stream, failed fresh builds excluded),Pipelines:summary,XCL_PIPELINE_MEASURE=1, refused-blob HRESULT loggingcrates/xcl/src/hle/d3d12x/real.rs:pub(crate)adoption-awareread_pso_cached_blob/pso_cached_blob_size, explicitdropped_rect_gsflag inGraphicsPsoBuild,one_build(skippingComputeBuild::CachedWholeand chained two-pass compute, releasing meshone_buildviarelease_deferred()+ compile slot before computeone_buildwhile storingmesh_psoonly after compute succeeds, releasing heldone_buildonbig_compile_turnpark),Loaded::{Pipeline, Blob}integration across compute / graphics / graphics stream / two-pass, runtime store, boundedflush_runtime_timeout(5 s)inend_title, driver compile countingcrates/xcl/src/hle/d3d12x/present.rs: boundedflush_runtime_timeout(5 s)onWM_CLOSEcrates/xcl/src/launcher.rs,crates/xcl/src/state.rs:title_data_dirhelper forxcl cache statusand sharedprocess_is_runningfor stale temp cleanupcrates/xcl/build.rs,crates/xcl/src/gpu/recomp/pso.rs: legacy v1/v2 receipt identities removedREADME.md: prepared vs runtime library locations, legacy.xcl\pso-corpus\*.plibone-time import, RAM/commit cost,XCL_RUNTIME_LIBRARY_MB(2048MiB default, store/save + load enforcement), and accounting knobsTested
cargo build --release -p xcl: ok, 39 warnings (matchesmain5eaadb54cbaseline)..\scripts\test.ps1(cargo build --workspace,cargo bench -p xcl --bench '*' -- --test,cargo test --workspace -- --test-threads=4) on5894838c8: 3002 passed, 0 failed, 52 ignored; 24SKIPPEDGPU tests (22no wave64, 2no heap windows).gpu_two_pass_cache_e2e::two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobsande2e(verifying the game folder stays untouched) both passed.each_memory_layout_has_its_own_folder(assertinglayout_name(16 | HEAP_WINDOWS | HEAP_FLAT) == "16-heap"andwindow_count == 16);warm_settings_separate_graphics_and_compute_flags;stage_freshness_tracks_graphics_and_compute_settings_independently;skipping_current_stage_preserves_untouched_library_file;try_alloc_zeroed_returns_oom_instead_of_aborting;one_build_wakes_waiters_in_parallel_when_holder_does_not_store;one_build_normal_priority_does_not_wait_on_low_priority_holder;identityless_corpus_uses_content_fallback_identity_and_detects_changes;dropped_rect_gs_build_is_not_stored_under_rect_gs_library_name;cache_only_fails_without_library_support_and_one_build_skips_when_full;full_runtime_library_resets_only_when_build_stamp_changed(covering both majority-old reset and majority-current keep);with_name_and_store_runtime_hand_out_pipeline_once_then_cached_blob(exercises realreal::adoptbefore second lookup);store_pipeline_does_not_hold_public_refcount_and_adopted_release_reloads_blob;activation_driver_mismatch_warns_and_continues_unless_cache_only;previous_library_prefers_layout_folder_and_falls_back_to_legacy_corpus;two_pass_releases_compile_slot_before_one_build_wait;one_build_releases_when_holder_parks_and_does_not_clobber_new_holder;flush_runtime_timeout_returns_within_budget_when_blocked;store_runtime_retries_after_transient_error_and_does_not_mark_failed_load_handed;cap_reservation_prevents_concurrent_overflow_and_oversized_entry_does_not_latch_full(including 4-thread concurrent store race near tight cap);store_and_flush_enforce_cap_and_preserve_reloadable_library;read_runtime_file_enforces_zero_cap_exact_cap_over_cap_and_growth;status_reports_sizes_from_metadata;flush_runtime_orders_concurrent_flushes_does_not_block_loads_and_stops_on_errors;cleanup_stale_runtime_temps_removes_dead_pid_temps_only;parse_runtime_cap_handles_defaults_zero_and_overflow;kind_of("graphics stream*")->Kind::Streamand failed fresh builds excluded;ComputeBuild::CachedWholeskippingone_build.ea3b5e4d, 60 s runs, fresh isolatedXCL_DATA_ROOTandXCL_DXIL_CACHE, 4 windows, no staged corpus): cold run wrote24.8 MB(24 811 070B)runtime.plib+ per-buildruntime.stamp(24 811 070B attributed to current build;3 903graphics +280compute =4 183pipelines) under<XCL_DATA_ROOT>\<title>\pipeline-libraries\4\with<game>\.xclunchanged; warm repeat in the same isolated data folder served3 903graphics +98compute (4 001total,0 msbind waits) fromruntime.plib, updatedruntime.plibandruntime.stampto24 953 778B, with1 705frames shown (60 61 60),15 093 MBpeak commit,0device removals, and0crashes (<game>\.xclunchanged).Regression run
Both 60 s runs used fresh, isolated
XCL_DATA_ROOTandXCL_DXIL_CACHEfolders on the same retail title (ea3b5e4d) and left the game folder untouched:Note on memory:
runtime.plibstays mapped in RAM for the life of the device and each flush serializes a temporary copy, so longer sessions with larger runtime libraries increase peak commit by roughly 1–2x the size ofruntime.plib(bounded on both write and load byXCL_RUNTIME_LIBRARY_MB, 2048 MiB default; serialization allocates fallibly viatry_reserve_exact).Not tested
no wave64, 2no heap windows).XCL_HEAP_FLAT=1on a full retail corpus (stage skipping,layout_namestrippingHEAP_FLAT, and graphics/compute setting isolation are covered by unit tests; the smoke runs had no staged corpus and used 4 windows).ExitProcessdoes not trigger the shutdown flush (the periodic flush covers those).AI use
origin/main(5eaadb54c), addressed all review findings and fixed the 16-heapHEAP_FLATlayout-naming / per-stage cache-busting bug (v4 receipt with independent graphics/compute freshness, graphics/compute semantic settings split, 0 s stage skipping inprepare_corpus, per-stagexcl cache status,layout_namestrippingHEAP_WINDOWS | HEAP_FLAT, per-titledata_dirstorage, non-blockingflush_lock+ fallibletry_reserve_exactNativeLibrary::serialize+ bounded 5 s shutdown flush + stale temp cleanup + persistent error stop, adoption-awareread_pso_cached_blob, non-fatal activation driver mismatch fallback, explicitdropped_rect_gsflag, identity-less corpus fallback identity, legacy.xcl/pso-corpus/*.plibone-time import,finish_two_passearlyrelease_deferred()+ post-compute paired mesh store +big_compile_turnpark release + priority-aware and parallel-unshared-wakeupone_build, retryable transientStorePipelineerrors and failed-loadE_INVALIDARGhandling, atomic fast-path + exact write-lock cap enforcement at2048MiB default, per-build byte accounting inruntime.stampwith majority-stale full-library auto-reset, shared cappedread_runtime_fileand metadata-onlywarm_library::status), added unit tests, ran the full test suite and isolated smoke pair on the hardware named, and updated this description.Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T08:40:05Z.
Diff review (head
05c33e918, read-only code review — not a#3041merge-check):Layout-scoped library folders, stale-vs-absent receipts, incremental
from_previousimport, and single-flightone_buildare solid steps toward eliminating cold PSO stalls. A full line-by-line review of the diff surfaced 4 concrete bugs worth addressing before merge:Writes
<game>\.xcl\pipeline-libraries\<windows>\runtime.plibdirectly into the title directory on every run (includingXCL_PREPARE=0andscripts/smoke.ps1) (crates/xcl/src/vfs.rs:315-316,crates/xcl/src/host.rs:279-280,crates/xcl/src/shaders/pipeline_library.rs:72-86):Exempting
<game>\.xclasTarget::Passand unconditionally activatingruntime.plibthere mutates the title folder on any run that compiles a PSO and runs >30 s or exits viaWM_CLOSE/end_title. This breaks the untouched/read-only title-folder invariant (tests/e2e.rs:202, read-only mounts) and contaminatesscripts/smoke.ps1A/B runs (which isolateXCL_DATA_ROOTandXCL_DXIL_CACHE, not<game>\.xcl). Keepingruntime.plibunder XCL's per-title data or cache directory (while keeping<game>\.xclread-only for title runs) avoids both issues.flush_runtime()dropsruntime.gatebeforewrite_atomic, creating an exit data-loss / out-of-order overwrite race (crates/xcl/src/shaders/pipeline_library.rs:135-145):xcl-pipeline-libraryswapsadded -> 0and is mid-write_atomic(writing hundreds of MB) whenWM_CLOSE(present.rs:741) orend_title(real.rs:4887) callsflush_runtime(), the caller seesadded == 0, returns immediately, and callsExitProcess, terminating the write mid-flight and leaving an orphaned.tmpfile.S2and finishesMoveFileExWbefore an in-flight older snapshotS1finisheswrite_atomic,S1overwritesS2(or fails withERROR_ACCESS_DENIED).Guarding
flush_runtime()end-to-end with a dedicatedflush_lock: Mutex<()>(separate fromruntime.gateso loads/stores do not block on disk I/O) fixes both races.ComputeBuild::CachedWholeblocks up to 60 s inone_buildinstead of falling back todispatch_chain::build(crates/xcl/src/hle/d3d12x/real.rs:6380):compute_container(..., ComputeBuild::CachedWhole)is used as a non-blocking cache probe before falling back to split dispatch-chain pieces (real.rs:6195-6201). Callingone_build(&library_name)unconditionally whenever!ppv.is_null()causes the title thread to stall up to 60 s behind an asyncxcl-pso-wholecompile instead of immediately building/using the chain. Skippingone_buildwhenmode == ComputeBuild::CachedWholepreserves non-blocking fallback.pipeline_stats::kind_ofmisclassifies"graphics stream"labels asKind::Graphicsinstead ofKind::Stream(crates/xcl/src/shaders/pipeline_stats.rs:36-38):create_graphics_stream_cachedpasses"graphics stream","graphics stream retry", and"graphics stream without rect GS". Becausekind_oftestslabel.starts_with("graphics")before falling through toStream, fresh graphics-stream builds are counted underKind::Graphicswhileload_streamcounts library hits underKind::Stream. Checkinglabel.starts_with("graphics stream")first aligns both paths.Additional medium/minor observations:
finish_two_pass(real.rs:9481) holdsone_buildon the mesh PSO key but not oncompute_pso(tp.cs), allowing distinct(MS/GS, PS)pairs sharing the sametp.csto compile it concurrently.store_runtimeinsertsnameintoactive.handed(pipeline_library.rs:196), so a waiter woken fromone_buildis refused bywith_name(pipeline_library.rs:171) and falls back toCOMPUTE_BLOBS/GRAPHICS_BLOBS— which do not cache shaders belowCOMPUTE_BLOB_MIN_DXIL(16 KiB), causing duplicate compiles after waiting.pipeline_library.rs:85callsstart_counting()before checkinglet Some(ready) = ready else { return Ok(()) }, spawning a permanent background thread even in tests/no-game runs;pipeline_library.rs:50(parse::<u64>() << 20) can overflow on huge env values (saturating_mul(1 << 20)is safer);pipeline_stats.rs:66counts failed fresh builds ((false, Some(hr))) asSource::Built.AI use: Antigravity (Gemini 4 Neon) audited the full diff against
mainand drafted this review.Imported from ivall/xcl. Originally posted by Gevroska on 2026-12-02T08:58:00Z.
merge-check
base:
1c8b551475head:
05c33e918bmerge: clean (7ff2d960)
build: cargo build --workspace passed. Release builds of main and the merge also passed.
tests: I reran the full workspace suite on the RTX 3080. It finished with 2,909 passed, 1 failed and 51 ignored. The log also recorded 28 runtime skips and eight notices for skipped optional retail game sample checks. All 17 focused library, receipt, counter and VFS checks passed. Both link tests previously reported failing with DXC 1.7 passed here with DXC 1.9.2609.
The failure was in gpu_two_pass_cache_e2e. The stale-mesh case rejected the stale blob and rebuilt the pipeline as expected. After releasing the pipeline objects, the test found one live two-pass state where it expected zero. I reran that test in isolation on both the merge and the pinned main revision. It passed both times, so the cause of the full-suite failure remains open.
review: Source review identified a write-ordering issue. The periodic flush clears the dirty count before it finishes publishing. Shutdown can see that cleared count while a write is in flight, and an older snapshot can finish publishing after a newer one. I didn’t observe a lost write in the startup runs.
performance: I ran four 60-second retail game startups in order: main cold, main repeat, merge cold, merge repeat. Each revision had its own XCL cache and all four runs shared the NVIDIA driver cache. On the merge, the repeat recorded 4,056 runtime-library hits. Driver calls with a recorded return fell from 4,120 to 268, compared with 4,100 to 4,323 on main. Frames shown were 1,104 / 1,077 on main and 1,151 / 1,015 on the merge. All four runs reached the same profile prompt and exited cleanly with zero device removals. This confirms pipeline reuse during startup. The runs did not reach gameplay.
verdict: not yet. The write-ordering issue remains open, and the two-pass release assertion failed once in the full suite. I’ll rerun the full suite on the next revision that addresses either issue and check the same assertion under the original conditions.
hardware / tool and model: RTX 3080 (driver 32.0.16.1692), Ryzen 7 5700X, Windows 11 25H2 build 26200.9457, Rust 1.100.0 MSVC, DXC 1.9.2609. OpenAI Codex GPT-6.2 Sol ran the tests. Independent Codex agents checked the source and run evidence. Their exact models were not recorded. GPT-6.2 Astra drafted this comment.
I reviewed and approved this comment before posting.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T08:58:59Z.
Review (head
05c33e91, diff read, not a merge-check):activate(shaders/pipeline_library.rs~73) turns onruntime.plibfor every title, also withXCL_PREPARE=0and with no corpus, andvfs.rs~314 /host.rs~279 make<game>\.xcla pass-through, so the title's process writes<game>\.xcl\pipeline-libraries\<windows>\runtime.plib. README ~109, ~125 and ~350 still say the game folder is never modified. The e2e "game folder untouched" check does not catch it, because the test title never reaches a flush. On a read-only game folder, every period serializes the whole library and logs a failed write, sinceaddedis put back on error (~150).scripts/smoke.ps1does not isolate this folder either, so the PR's smoke run started warm (as the description says) and main's did not.runtime.plib. Each translator or setting change renames the pipelines, so a new copy of the title's whole set is added after each change. The file is read whole and kept in RAM for the process (open_sharedkeeps the bytes), and each flush makes another full copy (serialize, ~141). The PR's own smoke run shows peak commit +1050 MB with a 451 MB library, not "about the size of the library". The 4096 MB cap (~49) allows several GB of extra commit before the library is thrown away whole. Old libraries in.xcl\pso-corpus\are never removed.end_titleorWM_CLOSEcallsflush_runtimewhile the background thread is writing, it seesadded == 0(~139) and returns, and the process exits mid-write. That run's new pipelines are lost, and a full-sizeruntime.tmp<pid>-<n>stays next to the library. A kill or crash during a write leaves the same file. Nothing cleans these up.one_builddoes not do what the description says.store_runtimemarks the name as handed out (~196), so a thread woken inone_buildis refused bywith_name(~171) and never loads from the runtime library. It builds again fromGRAPHICS_BLOBS/COMPUTE_BLOBS, which keep no blob underCOMPUTE_BLOB_MIN_DXIL(real.rs~7579). Small pipelines are therefore still built twice, only one after the other now. TheCachedWholeprobe (real.rs~6197 → ~6380) also takesone_build, so it can wait up to 60 s behind another thread's whole build instead of falling back to the chain at once. None ofwith_name/store_runtime/one_build/flush_runtimehas a test; the new tests only check D3D12's own library behaviour.flush_runtimeholdsgate.write()while it serializes hundreds of MB (~140), so every title thread that wants a pipeline from the runtime library waits for it, every 30–60 s. D3D12 synchronizesSerializeandStorePipelineitself; only concurrent loads of one name need the caller's lock, andnames[slot]already provides it.kind_of(pipeline_stats.rs~37) maps the"graphics stream…"labels toKind::Graphics, but runtime-library hits of the same pipelines count asKind::Stream, so thePipelines:line splits one kind across two rows. Also on scope: ~1100 changed lines, and the settings-key additions, the removal of the legacy migration and the stats/measure mode each stand on their own (CONTRIBUTING puts diagnostics in their own PR).Fine: names are hashes of the exact DXIL and state, and D3D12 checks the desc on load, so a stale entry can only miss. A
StorePipelineE_INVALIDARGfor a name that is already kept is handled. A runtime library from another driver starts empty. The per-name lock on loads covers the one case where D3D12 is not thread-safe. #3670 touches other functions and merges cleanly. The conflict with #3655 is one line of the settings list inshaders.rs~38 (keep both names).AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T10:40:57Z.
merge-check
base:
1c8b551475head:
05c33e918bmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2910 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 by one reviewer at this same head; the review is at https://github.com/xcl-dev/xcl/pull/3633#issuecomment-7340197023 and its findings stand. Most serious: every run now writes
runtime.plibinto<game>\.xcl(the README says the game folder is never modified), and the library only grows (peak commit +1050 MB).performance: 60 s smoke of a retail title, main
1c8b5514vs this merge (05c33e91): 1652 -> 1684 frames shown (101 %; last presents per 2 s: 60 60 61), peak commit 18228 -> 19477 MB, 0 device removals, 0 crashes.verdict: not yet: every run now writes
runtime.plibinto<game>\.xcl(the README says the game folder is never modified), and the library only grows (peak commit +1050 MB) (see the review)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.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T14:29:05Z.
Rebased onto
main(5eaadb54c, resolving the one-lineshaders.rsconflict with #3655 by keeping bothXCL_WAVE64_IDIOMSand the three added translation settings) and pushed034e7146aaddressing every concrete finding from @Decodere, @Gevroska, and @Foniass:<game>\.xcl/ untouched game folder (@Decodere, @Foniass): movedruntime.plibinto XCL's per-title data folder (<XCL_DATA_ROOT | %LOCALAPPDATA%\XCL>\<title>\pipeline-libraries\<windows>\runtime.plib), reverted bothcrates/xcl/src/vfs.rsandcrates/xcl/src/host.rs(removing the<game>\.xclTarget::PassVFS exemption), and updatedxcl cache statusandREADME.md. Verified<game>\.xclstays byte-for-byte/timestamp-unchanged across both cold and warm retail runs, andscripts/smoke.ps1runs are cleanly isolated viaXCL_DATA_ROOT.flush_runtime()exit data-loss, write ordering, load blocking, stale temps, and persistent write errors (@Decodere, @Gevroska, @Foniass):flush_lock: Mutex<FlushState>held end-to-end acrossadded.swap(0)+Serialize()+write_atomic(), soWM_CLOSE/end_titlewait for any in-flight flush to finish and older snapshots cannot overwrite newer ones.runtime.gate:flush_runtime()no longer blocks pipeline loads (with_name) during serialization or disk I/O (concurrentStorePipelinesize growth retriesSerialize()without blocking loads).cleanup_stale_runtime_temps) for dead-PIDruntime.tmp*files.ERROR_WRITE_PROTECT).ComputeBuild::CachedWholenon-blocking probe (@Decodere, @Foniass): skippedone_buildwhenmode == ComputeBuild::CachedWhole(and for chained two-pass compute passes) so fallback todispatch_chain::buildnever stalls behind an async whole-form compile. Also addedone_buildon the sharedtp.cscompute pass infinish_two_passwhen unchained.store_runtime/handedvsone_builddouble-compile +pipeline_stats+ startup/cap cleanup (@Decodere, @Foniass):load_compute/load_graphics/load_streamnow returnLoaded::Pipelineon the first hand-out andLoaded::Blob(extracted viaGetCachedBlob()from the library entry) on subsequent lookups, so wokenone_buildwaiters and repeat requests create a distinct COM object from the cached blob without recompiling — including small<16 KiBshaders belowCOMPUTE_BLOB_MIN_DXIL— and first hits no longer eagerly copy blobs intoCOMPUTE_BLOBS/GRAPHICS_BLOBS.pipeline_stats::kind_ofto checklabel.starts_with("graphics stream")before"graphics"so graphics streams count underKind::Stream, and stopped counting failed fresh builds asSource::Built.start_counting()afterlet Some(ready) = ready else { return Ok(()) }+ driver check; usedsaturating_mul(1 << 20)inparse_runtime_cap; lowered defaultXCL_RUNTIME_LIBRARY_MBfrom4096to1024MiB (0disablesruntime.plib) and documented the ~1–2x RAM/commit overhead honestly inREADME.mdand the PR description.with_name,store_runtime,one_build,flush_runtime(ordering, non-blocking loads, persistent write error stop),cleanup_stale_runtime_temps,parse_runtime_cap,kind_of("graphics stream*"), failed fresh builds,CachedWholeskippingone_build, andruntime_directory. On034e7146a(RTX 5070 Ti, DXC 1.9.2609.5):cargo build --release -p xclclean at 39 warnings;.\scripts\test.ps1passed with2981 passed, 0 failed, 52 ignored, 24 SKIPPED(includinggpu_two_pass_cache_e2eande2e); fresh isolated 60 s smoke pair (main5eaadb54cvs034e7146a) updated in the PR description (1666 -> 1678frames,15570 -> 15612MB peak commit, 0 device removals, 0 crashes), plus a warm repeat in the same isolated data folder confirming 4 103 runtime-library hits.AI use: Antigravity (Gemini 4 Neon) implemented these fixes, ran the suite and smoke pair, and drafted this reply.
Imported from ivall/xcl. Originally posted by Gevroska on 2026-12-02T15:26:37Z.
I checked the runtime-library size cap on
034e7146. With preparation disabled, activation reads the wholeruntime.plibbeforeopen_runtimechecks the cap. A zero cap or an oversized file therefore still incurs the read and temporary allocation. Prepared-library inspection and publication also read the payload before that check. The status query goes through inspection just to report the file size. Activation · Inspection and status · PublicationCould the read paths share a check that skips the payload entirely at zero cap, rejects oversized files using metadata from the opened handle, and bounds the read in case the file grows? Status could get the size from metadata alone. I’d cover three boundaries in a focused test: zero cap, a file exactly at the cap, and one byte over.
I verified the ordering in source. I haven’t measured peak memory or startup time on this revision. OpenAI Codex GPT-6.2 Sol reviewed the code, an independent Codex agent checked the call sites, and GPT-6.2 Astra drafted this comment.
I reviewed and approved this comment before posting.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T16:02:51Z.
Good catch, @Gevroska — pushed
ae8b643f1addressing all four points:pipeline_library::read_runtime_file/read_runtime_file_capped):activate(when preparation is disabled),warm_library::inspect, andwarm_library::publishnow all go through the same helper, which:Noneimmediately whencap == 0without opening or readingruntime.plib,file.metadata()on the opened handle and rejects empty orlen > capfiles before allocating or reading payload bytes, andRead::take(cap.saturating_add(1))(withtry_reserve_exact) so concurrent growth past the cap stops atcap + 1bytes and is rejected cleanly.warm_library::status: factored the receipt/state check (prepared_state) sostatuschecksgraphics.plib,compute.plib, andruntime.plibviastd::fs::metadataalone without reading any payloads.read_runtime_file_enforces_zero_cap_exact_cap_over_cap_and_growth(zero cap, exact cap, cap + 1, empty file, and boundedcap + 1read on a growing cursor) andstatus_reports_sizes_from_metadata(holding exclusiveshare_mode(0)locks on all three.plibfiles so any payload open/read fails).ae8b643f1(RTX 5070 Ti, DXC 1.9.2609.5):cargo build --release -p xclclean at 39 warnings;.\scripts\test.ps1passed with2983 passed, 0 failed, 52 ignored, 24 SKIPPED; fresh isolated 60 s smoke pair (main5eaadb54cvsae8b643f1) updated in the PR description (1652 -> 1662frames,15609 -> 16020MB peak commit, 0 device removals, 0 crashes,<game>\.xclunchanged), plus a warm repeat confirming875/875runtime-library hits with 0 bind waits.AI use: Antigravity (Gemini 4 Neon) implemented these fixes, ran the suite and smoke pair, and drafted this reply.
Imported from ivall/xcl. Originally posted by throny on 2026-12-02T16:19:27Z.
Test report for #3633 at head
034e7146a, rebased on main5eaadb54c.Tested
XCL_RESIDENCY_PRIORITY=1:runtime.plibworks as described: run 1 kept ~2,800 runtime pipelines (1.1 GB file).Not tested
XCL_PREPARE_CACHE_ONLY; prepared corpus libraries.AI use
Update: head
ae8b643f1(same hardware and settings, one 300 s run)runtime.plibfrom the two runs above had grown to 1,117,037,578 bytes in one 900 s run. At start this head loggedis over XCL_RUNTIME_LIBRARY_MB; starting it again. It then kept 8,913 pipelines (1,010,575,948 bytes) within 170 s. The cap is checked only when the file is read, not while it grows, so on this title the library goes over 1 GiB within one longer run and is discarded on every start after that. One way to fix it: stop adding to the library at the cap, or keep the file under the cap when flushing, rather than dropping it at load. Alternatively, a larger default.Update: head
d9979794c(same setup, one 300 s run, 476)activated prepared PSOsonly came at 286 s. Between 475 and this run, six other builds ran on this machine, and the NVIDIA driver cache is now capped at 10 GB, so the driver had probably evicted them. Those pipelines are all inruntime.plibalready, but the preparation workers don't seem to look there. If they could, a restart after other builds would be quick, which is the case this PR is after.Imported from ivall/xcl. Originally posted by Gevroska on 2026-12-02T16:44:15Z.
Thanks for the update. I checked
ae8b643fon Windows using the exact reader and file-size helper from that revision. All seven focused tests passed.With the cap set to zero, the reader consumed zero bytes. A 32-byte file was accepted at a 32-byte cap and rejected at 31. In the case where the input grew beyond its initial size, the reader consumed 17 bytes at a 16-byte cap, returned
OverCap, and retained no payload. With an exclusive Windows handle blocking payload reads, the status helper still reported the correct 32-byte size.I also checked that direct activation, warm-library inspection and publication all use the capped reader. This addresses my earlier concern about reading the whole file before applying the cap. I haven’t rerun the full workspace suite or measured startup time on this revision.
OpenAI Codex GPT-6.2 Sol ran the tests. An independent Codex agent verified the extracted code and all seven outcomes. GPT-6.2 Astra drafted this comment.
I reviewed and approved this comment before posting.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T16:50:28Z.
Thank you for catching that, @throny — pushed
d9979794cwith both fixes (keeping @Gevroska's capped reader and metadata-onlystatusintact):XCL_RUNTIME_LIBRARY_MBraised from1024MiB to2048MiB so longer world runs (~1.12 GB at 900 s) fit comfortably while remaining bounded.Runtimenow tracks its configuredcapand a latchedfullflag. Once within 16 MiB ofcap,store_runtimeserializes additions understore_lock.write()and checksGetSerializedSize() + estimated_store_bytes(name, pipeline) <= cap; when full, it latchesfulland stops adding further pipelines so the in-memory library stays<= capand flushes cleanly.flush_runtime_onalso checksGetSerializedSize() <= capbefore serializing andbytes.len() <= capbefore callingwrite_atomic, so an over-cap snapshot can never overwrite an existing valid<= capruntime.plibon disk.XCL_RUNTIME_LIBRARY_MBbelow an existing on-disk file still rejects it on load viaread_runtime_fileas before.d9979794c, RTX 5070 Ti, DXC 1.9.2609.5):store_and_flush_enforce_cap_and_preserve_reloadable_libraryverifying store stops at cap, flushes<= cap, reloads cleanly on next startup at the same cap, still rejects when the cap is lowered, andflush_runtime_onnever overwrites an existing<= capfile with an over-cap library.cargo build --release -p xcl: ok, 39 warnings (matchesmain5eaadb54c)..\scripts\test.ps1:2984 passed, 0 failed, 52 ignored, 24 SKIPPED(22no wave64, 2no heap windows).d9979794cupdated in the PR description (1652 -> 1707frames,15609 -> 16214MB peak commit, 0 device removals, 0 crashes,<game>\.xclunchanged), plus a warm repeat confirming 2 133 runtime-library hits (0 compute pipelines rebuilt) and 15 324 MB peak commit.AI use: Antigravity (Gemini 4 Neon) implemented these fixes, ran the suite and smoke runs, and drafted this reply.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:53:45Z.
Review: COMMENTED
Review of
d9979794: 6 finding(s) (1 critical, 3 high, 2 medium), most severe first.crates/xcl/src/shaders/pipeline_library.rs:314: The newread_cached_blobcallspipeline.GetCachedBlob()through the windows-rs PC vtable, but on the hand-out-once path the object is the one handed out earlier, which the title-facing create path has since adopted, swapping its vtab.... (inline)crates/xcl/src/shaders/pipeline_library.rs:198:warm_library::reusenow stores READY on every preparation, including titles with no corpus or with Stale/Absent libraries, soactivate's hard Err ondriver != ready.drivernow fails device creation (real.rs:1025 uses?) for any t.... (inline)crates/xcl/src/shaders/warm_library.rs:97: A corpus with noidentityfile now getscorpus: [0; 32]. (inline)crates/xcl/src/hle/d3d12x/real.rs:9627:finish_two_passtakes the mesh pass's gated compile slot (take_cold_slot, held untildrop(slot)) before it blocks inone_build(&compute_name), but the thread holding that compute name incompute_containerneeds a slot from the .... (inline)crates/xcl/src/shaders/pso_corpus.rs:1643: see below.crates/xcl/src/shaders/pipeline_library.rs:359:store_runtimeputs the name intoknownbefore the store succeeds and never takes it out on failure, and it treats E_INVALIDARG from StorePipeline as "kept already" even when that run's load of the name failed. (inline)On lines outside the diff:
crates/xcl/src/shaders/pso_corpus.rs:1643: Prepared libraries move from.xcl/pso-corpus/to.xcl/pipeline-libraries/<windows>/, and the oldcompute.plib/graphics.plibare no longer passed asprevioustopipeline_library::begin, so every existing prepared title rebuilds its whole corpus on upgrade even though entries are name-addressed and safe to import. A user with a fully prepared title (hundreds of driver builds, over 10 minutes) upgrades, the first launch finds no receipt in the new folder, reports Absent, and rebuilds everything. Passing the legacy files aspreviouswould import every unchanged name.These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:53:45Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 314Critical: The new
read_cached_blobcallspipeline.GetCachedBlob()through the windows-rs PC vtable, but on the hand-out-once path the object is the one handed out earlier, which the title-facing create path has since adopted, swapping its vtable pointer for XCL's ext class.real::read_pso_cached_blobexists for exactly this and callsorig_fn(pso, slot_of(pso, "GetCachedBlob"))on adopted objects. If a title creates the same compute or graphics pipeline twice, the firstwith_namehands out object X, which gets adopted. The secondwith_nameloads X again (D3D12 returns the same object) and calls GetCachedBlob at the PC slot index on the ext vtable, which is the wrong method or XCL's hook. The result is garbage, a crash, or a None blob that forces a full driver recompile. Usingread_pso_cached_blobwould fix it, and the unit test never adopts its objects, so it can't catch this.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:53:45Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 198High:
warm_library::reusenow stores READY on every preparation, including titles with no corpus or with Stale/Absent libraries, soactivate's hard Err ondriver != ready.drivernow fails device creation (real.rs:1025 uses?) for any title whose runtime adapter differs from the one preparation picked. Preparation takescandidates(...).next()for its driver identity. If at runtime the first candidate failscreate_device(12_0)and the loop moves to the next adapter (or falls back to Auto/WARP), the driver identity differs,activatereturns Err, and the title can't start, even with no prepared libraries at all. Before, that error was only possible when the libraries were Current. Treating a driver mismatch as "no libraries" (log and continue) would avoid it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:53:45Z.
Code review location:
crates/xcl/src/shaders/warm_library.rs; line 97High: A corpus with no
identityfile now getscorpus: [0; 32]. Before,expected()andexpected_for_adapter()returned None, so such a corpus was never reusable andpublishwrote no receipt. Nowpublishwrites a receipt with a zero corpus, and every later identity-less corpus matches it as Library::Current. If you stage a corpus without an identity file, launch once (receipt written with corpus 0), then restage it with more recipes still without an identity,prepare_for_launchsees Current, skips preparation and reports all recipes complete. The new pipelines are never prepared, and XCL_PREPARE_CACHE_ONLY=1 lets the launch through anyway. Keeping "no identity" as not reusable would fix it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:53:45Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 9627High:
finish_two_passtakes the mesh pass's gated compile slot (take_cold_slot, held untildrop(slot)) before it blocks inone_build(&compute_name), but the thread holding that compute name incompute_containerneeds a slot from the same pool to finish. Onxcl-psoworkers, several two-pass pipelines that share onetp.cshold the medium or huge slots while waiting on compute name C, and the thread building C waits indriver_compile_identifiedfor a slot. Nobody progresses until XCL_ONE_BUILD_WAIT_S (60 s) runs out, then every waiter builds C itself: a 60 s stall followed by the duplicate compileone_buildis meant to prevent. Waiting onone_buildbefore taking the slot would avoid the deadlock.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:53:45Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 359Medium:
store_runtimeputs the name intoknownbefore the store succeeds and never takes it out on failure, and it treats E_INVALIDARG from StorePipeline as "kept already" even when that run's load of the name failed. A transient StorePipeline error (e.g. E_OUTOFMEMORY) leaves the name inknown, so it's never stored for the rest of the run and is rebuilt next launch. An entry whose load keeps failing (desc mismatch) hits E_INVALIDARG on store, is counted as kept, and is never replaced, so that pipeline is rebuilt in the driver every run.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:53:48Z.
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T17:03:02Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 4900High:
end_titlenow runsflush_runtime(wait forflush_lock, serialize up to 2 GiB, write withsync_all) inside the 15 s end watchdog and beforesuspend_other_threads, fence signalling anddrain_gpu, so a large flush can use the whole budget and skip the device-hang mitigation. If runtime.plib is ~1.5 GB on a slow disk, or the periodic flusher is mid-write, end_title waits, then serializes and fsyncs for more than 15 s.xcl-end-watchdogthen callsend_process_nowbefore the title's threads are suspended and its fences signalled (the end-of-run device hang that ordering exists to prevent), leaving the temp file half-written. On WM_CLOSE the window shows Not Responding meanwhile. Flushing after the hang mitigation, or bounding the flush by the remaining budget, would avoid it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T17:03:02Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 6406High:
one_buildis taken beforedriver_compile_identified's compile gate, so a background xcl-pso worker that holds a name while parked inbig_compile_turn(waiting for commit headroom or a slot) blocks a title thread's synchronous create of the same pipeline for up to XCL_ONE_BUILD_WAIT_S (60 s). If a pso_async worker starts an ahead or unwanted build of compute X, takesone_build(X)and then waits at the gate for commit headroom (the code notes gate waits of 129 s), the title thread's CreateComputePipelineState for X sits inOneBuildFlights::enterfor 60 s before compiling. Before this PR it compiled X at once, ungated. Takingone_buildafter the gate, or letting a title thread jump ahead of a parked background holder, would avoid the minute-long stall.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T17:03:02Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 388High: Not certain about this one, because it depends on whether D3D12 counts the library's reference publicly:
store_runtimeStorePipelines every runtime-built pipeline into runtime.plib, which keeps a reference for the process lifetime, sopso_release'sn == 0path (forget_pso, the TWO_PASS compute-pass drop,pso_async::releasedfor stand-ins) may never run for those pipelines. The code's own comment ("a load may give back the very object stored") says the library holds it. In a streaming title that creates and releases pipelines as it loads areas, the title's last Release would return 1, not 0. TRANSLATED_GRAPHICS, PSO_RS, dispatch chains and TWO_PASS entries (with their compute passes) then accumulate, and memory grows over a long session. Running the cleanup when the title's own count reaches 0 (tracked separately), not the COM count, would avoid depending on it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T17:03:02Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 446Medium: The cap is only enforced per pipeline within NEAR_CAP_MARGIN (16 MiB) of it, and the read-lock path stores with no size check, so a large or concurrent store can push the library past the cap.
flush_runtime_onthen setsdisabledfor good, and every pipeline added since the last flush is never written. With the library at 2031 MiB of a 2048 MiB cap (17 MiB left, more than the margin), two threads storing 12 MiB compute blobs at once take it to ~2055 MiB, so the next flush seescurrent > cap, marks it full, disables it, and the pipelines from the last 30 s+ are lost. Writing what fits (or checking size on every store) would keep them.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T17:03:02Z.
Review: COMMENTED
Review of
d9979794: 5 finding(s) (3 high, 2 medium), most severe first.Correction: my previous review on this PR was written against
ae8b643f, but it was attached tod9979794by mistake because the PR was force-pushed while that review was running. This review is the one actually done atd9979794. Still present from the earlier one:activate's hard error on a driver mismatch now fails device creation for any title that ran preparation, not only titles with a prepared corpus (pipeline_library.rs~213), and the two-pass mesh pass holding a compile slot while it waits on the compute pass'sone_build(real.rs~9627). The other earlier findings (the adopted-object GetCachedBlob, the zero-identity corpus, the legacy-path migration,store_runtime'sknownon failure) weren't flagged at this head and may have been addressed. New at this head:crates/xcl/src/hle/d3d12x/real.rs:4900:end_titlenow runsflush_runtime(wait forflush_lock, serialize up to 2 GiB, write withsync_all) inside the 15 s end watchdog and beforesuspend_other_threads, fence signalling anddrain_gpu, so a large flush can use the wh.... (inline)crates/xcl/src/hle/d3d12x/real.rs:6406:one_buildis taken beforedriver_compile_identified's compile gate, so a background xcl-pso worker that holds a name while parked inbig_compile_turn(waiting for commit headroom or a slot) blocks a title thread's synchronous creat.... (inline)crates/xcl/src/shaders/pipeline_library.rs:388: Not certain about this one, because it depends on whether D3D12 counts the library's reference publicly:store_runtimeStorePipelines every runtime-built pipeline into runtime.plib, which keeps a reference for the process lifetime, so .... (inline)crates/xcl/src/shaders/pipeline_library.rs:446: The cap is only enforced per pipeline within NEAR_CAP_MARGIN (16 MiB) of it, and the read-lock path stores with no size check, so a large or concurrent store can push the library past the cap. (inline)crates/xcl/src/shaders/pipeline_library.rs:376: Incan_store_locked, a GetCachedBlob failure for a single pipeline callsmark_full(), latching the whole runtime library as full for the rest of the process even though it's under the cap. (inline)These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T17:03:03Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 376Medium: In
can_store_locked, a GetCachedBlob failure for a single pipeline callsmark_full(), latching the whole runtime library as full for the rest of the process even though it's under the cap. Near the cap, one pipeline whose GetCachedBlob fails (an error or empty blob for that PSO) makesestimated_store_bytesreturn None,fullis set, and every laterstore_runtimereturns early, with tens of MiB still free. Skipping just that pipeline would avoid it.Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T17:27:27Z.
Thanks @bmjask for both thorough reviews! I verified every finding from both passes (reviews
6155295007and6155457233) against the code and real D3D12, and pusheda2eaffc4faddressing all real issues (cc @Prime1997):First review (
6155295007)pipeline_library.rsread_cached_blob/cached_blob_sizeon adopted PSOs): Fixed. Exposedpub(crate) unsafe fn read_pso_cached_blobandpso_cached_blob_sizeincrates/xcl/src/hle/d3d12x/real.rs(sharing a single adoption-awareget_pso_cached_blobhelper that usesorig_fn(pso, slot_of(pso, "GetCachedBlob"))whenis_adopted(pso)is true and the PC vtable otherwise) and routed bothread_cached_blobandcached_blob_sizethrough them. Updatedwith_name_and_store_runtime_hand_out_pipeline_once_then_cached_blobto callreal::adopt(..., Kind::PipelineState)before the second lookup.pipeline_library.rsactivatehardErron driver mismatch): Fixed. Addedcheck_activation_driver: when the runtime adapter/driver differs or is unavailable,activatenow logs a warning and returnsOk(())without libraries so device creation succeeds (only returningErrwhenXCL_PREPARE_CACHE_ONLY=1with prepared libraries present). Covered byactivation_driver_mismatch_warns_and_continues_unless_cache_only.warm_library.rsidentity-less corpus[0; 32]): Fixed. Removed the[0; 32]fallback:prepared_statenow marks a corpus without anidentityfile asLibrary::Stale, andpublishskips writing (and removes any existing)receipt.jsonwhile still populatingREADYfor the current launch. Covered byidentityless_corpus_is_never_current_and_writes_no_receipt.real.rsfinish_two_passcompile slot held acrossone_build(&compute_name)): Fixed.finish_two_passnow releases the mesh pass'sSlotGuard(slot.take()) after the mesh pass completes and before enteringone_build(&compute_name)(re-acquiring a slot only if the compute pass misses caches). Covered bytwo_pass_releases_compile_slot_before_one_build_wait.pso_corpus.rs/warm_library.rslegacy.xcl/pso-corpus/{compute,graphics}.plibimport): Fixed. Addedwarm_library::previous_library, falling back to.xcl/pso-corpus/{compute,graphics}.plibwhen the new layout folder has no library yet, and wired it into both computepipeline_library::beginand graphicsXCL_PIPELINE_LIBRARY_PREVIOUS(and updatedREADME.md). Covered byprevious_library_prefers_layout_folder_and_falls_back_to_legacy_corpus.pipeline_library.rsstore_runtimeinserting intoknownbefore store / failed-loadE_INVALIDARG): Fixed.store_runtimenow checksknown.containsunder_same_nameand only records the outcome afterStorePipeline: transient errors (e.g.E_OUTOFMEMORY) leave the name out ofknownandhandedso later calls can retry, andE_INVALIDARGon a name whosewith_nameload failed in this run (load_missed) stops retrying without marking ithanded. Covered bystore_runtime_retries_after_transient_error_and_does_not_mark_failed_load_handed.Second review (
6155457233)real.rsend_titleunboundedflush_runtimeinside 15 s watchdog): Fixed. Addedpipeline_library::flush_runtime_timeout(Duration::from_secs(5))(fast-path returns immediately whenflush_lock.try_lock()sees nothing pending or disabled, otherwise runs on"xcl-plib-end-flush"bounded to 5 s) sosuspend_other_threads, fence signalling, anddrain_gpualways retain >= 10 s of the 15 s watchdog while keeping the previous on-diskruntime.plibintact on timeout. Covered byflush_runtime_timeout_returns_within_budget_when_blocked.real.rsone_buildheld while parked inbig_compile_turn): Fixed.OneBuildFlightsnow tracks(ThreadId, flight_id)per in-flight name andbig_compile_turncallspipeline_library::release_one_build_on_park()the moment a worker parks (if parked.is_none()), immediately waking any ungated title thread waiting on that name while keeping the parked guard's laterDropsafe against clobbering the new holder. Covered byone_build_releases_when_holder_parks_and_does_not_clobber_new_holder.StorePipelineCOM refcount vspso_releasen == 0): Verified empirically on Windows 11 D3D12 (RTX 5070 Ti, driver 610.74) — not a bug:ID3D12PipelineLibrary::StorePipelineholds an internal reference and does not increment the public COM refcount (before_store=1,after_store=1, finalRelease()returns0while the library is still alive; same1 -> 0for PSOs loaded from a reopened/prepared library), sopso_release'sn == 0cleanup (forget_pso,TWO_PASSdrop,pso_async::released) still runs normally. Addedstore_pipeline_does_not_hold_public_refcount_and_adopted_release_reloads_blobto lock in both the refcount behavior and that an adopted PSO released to0still yieldsLoaded::Blobon a laterwith_namelookup.pipeline_library.rscap enforcement outsideNEAR_CAP_MARGIN/ concurrent read-lock stores): Fixed.store_runtimenow computesestimated_store_bytesup front and uses an atomicRuntime::estimated_sizereservation (try_reserve_fast) that only allows the read-lock path while the cumulative estimate stays<= cap - NEAR_CAP_MARGIN; any large pipeline or concurrent burst crossing that threshold serializes throughstore_lock.write(), refreshesestimated_size = library.serialized_size(), and checks exactcurrent + est <= capbefore storing. Oversized single entries (est > NEAR_CAP_MARGIN) skip without latchingfull. Covered bycap_reservation_prevents_concurrent_overflow_and_oversized_entry_does_not_latch_full.pipeline_library.rscan_store_lockedlatchingmark_full()on a singleGetCachedBlobfailure): Fixed. Ifestimated_store_bytesreturnsNone,store_runtimeskips only that pipeline and does not callmark_full().Verification on
a2eaffc4f(RTX 5070 Ti, driver 610.74, Windows 11 26200, rustc 1.99.0, DXC 1.9.2609.5)cargo build --release -p xcl: ok, 39 warnings (matchesorigin/main5eaadb54c)..\scripts\test.ps1: 2993 passed, 0 failed, 52 ignored, 24 SKIPPED (22no wave64, 2no heap windows), including all new unit tests andgpu_two_pass_cache_e2e.ea3b5e4d(PR description updated with the fresha2eaffc4fxcl-smoke v1block): cold1704frames (60 60 60,15708 MBpeak commit,15.6 MBruntime.plib, 0 removals, 0 crashes,<game>\.xclunchanged); warm repeat1707frames (60 60 60,15121 MBpeak commit, 3 930 graphics + 98 compute served fromruntime.plib, 0 ms bind waits, 0 removals, 0 crashes,<game>\.xclunchanged).(Fixes and verification by Antigravity, Gemini 4 Neon.)
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T17:49:10Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 4902Critical: When the 5 s shutdown flush times out, its xcl-plib-end-flush thread may still be inside GetSerializedSize/Serialize, a multi-GB
vec!allocation, orwrite_atomic, andsuspend_other_threadsthen suspends it like any other thread while it may hold the process heap lock or D3D12's library lock. With a large runtime.plib (hundreds of MB to 2 GB) or a slow disk, the flush takes over 5 s, end_title moves on, and the flush thread is suspended inside HeapAlloc or the D3D12 serialize lock.drain_gpuorlog::flushthen block on that lock, and the process hangs until the 15 s watchdog callsend_process_now, so the final log and report are lost. Excluding the flush thread from suspension (and abandoning its temp file), or not starting the flush when it can't finish in the budget, would avoid it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T17:49:10Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 578High: A fast-path size reservation is made before taking the store read lock, and the write-lock path then sets
estimated_sizeto the exact current size, which wipes out reservations already granted to other threads, so the guarantee against concurrent overflow doesn't hold. Near the cap, thread X winstry_reserve_fast(estimated_size += est) and blocks onstore_lock.read()while Y holdsstore_lock.write(). Incan_store_lockedand after its store, Y setsestimated_size = serialized_size(), so X's est disappears. X then stores, and more threads passtry_reserve_fastagainst the undercount. Their combined stores go past the cap, and the nextflush_runtime_onsees current > cap, setsdisabled = true, and every pipeline added since the last flush is lost for the session. Adding outstanding reservations back when resettingestimated_sizewould keep it correct.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T17:49:10Z.
Code review location:
crates/xcl/src/hle/d3d12x/present.rs; line 741Medium: WM_CLOSE calls
flush_runtime()with no time limit on the window thread before ExitProcess, unlike end_title's 5 s limit. If the user closes the window while the periodic flusher holdsflush_lockfor a 2 GB serialize, or runtime.plib has grown a lot, the window procedure blocks for the whole serialize, fsync and MoveFileEx, so Windows shows the window as not responding for many seconds, or indefinitely on a stuck disk. Using the same bounded flush as end_title would fix it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T17:49:10Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 221Medium: When the prepared libraries' driver identity differs from the runtime device's (not cache-only),
activatereturns beforeopen_runtime, so runtime.plib is dropped too, although it lives in the per-title data folder andopen_sharedalready rejects one from another driver. If preparation resolves the adapter (configauto/ XCL_ADAPTER) to a different adapter or driver identity than the device actually created (a hybrid-GPU laptop, a driver update between preparation and launch),activatelogs "continuing without pipeline libraries" and never opens runtime.plib. Every pipeline the title builds that run is then neither loaded nor kept, on every launch while the mismatch lasts. Opening the runtime library independently of the prepared ones would keep it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T17:49:10Z.
Review: COMMENTED
Review of
a2eaffc4: 4 finding(s) (1 critical, 1 high, 2 medium), most severe first.Re-review at
a2eaffc4. The 60 s stall fromone_buildbeing taken before the compile gate, and the two-pass slot/one_builddeadlock, are no longer flagged. The end-of-title flush now has a 5 s limit, and cap enforcement was reworked, but both still have problems (first two below). Theactivatedriver-mismatch error no longer fails device creation, but it now drops the runtime library too (last item).crates/xcl/src/hle/d3d12x/real.rs:4902: When the 5 s shutdown flush times out, its xcl-plib-end-flush thread may still be inside GetSerializedSize/Serialize, a multi-GBvec!allocation, orwrite_atomic, andsuspend_other_threadsthen suspends it like any other thread whi.... (inline)crates/xcl/src/shaders/pipeline_library.rs:578: A fast-path size reservation is made before taking the store read lock, and the write-lock path then setsestimated_sizeto the exact current size, which wipes out reservations already granted to other threads, so the guarantee against.... (inline)crates/xcl/src/hle/d3d12x/present.rs:741: WM_CLOSE callsflush_runtime()with no time limit on the window thread before ExitProcess, unlike end_title's 5 s limit. (inline)crates/xcl/src/shaders/pipeline_library.rs:221: When the prepared libraries' driver identity differs from the runtime device's (not cache-only),activatereturns beforeopen_runtime, so runtime.plib is dropped too, although it lives in the per-title data folder andopen_shareda.... (inline)These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T18:01:40Z.
Thanks @bmjask for the re-review! All 4 findings from review
6155986550are fixed in13e9c7091(cc @Prime1997):real.rsend_titlesuspending a timed-out flush thread): Fixed.flush_runtime_timeoutnow returns the live OS thread IDs ofxcl-plib-end-flushandxcl-pipeline-library(PERIODIC_FLUSH_TID) when the 5 s budget expires, andsuspend_other_threadsexcludes those threads alongsidexcl-end-watchdogso a still-running serialize/alloc/write thread is never suspended while holding the process heap lock or D3D12 library lock (neither thread touches title fences, command allocators, or GPU queues; any abandoned temp file is cleaned up on the next launch). Updatedflush_runtime_timeout_returns_within_budget_when_blockedto verify the returned live thread ID.pipeline_library.rstry_reserve_fastreservation wiped by concurrentstore_lock.write()reset): Fixed.store_runtimenow acquiresstore_lock.read()before callingtry_reserve_fast(est)and holds it acrossStorePipeline, dropping the read guard only if it falls through tostore_lock.write(). Because no thread can hold an unstored fast-path reservation oncestore_lock.write()is acquired, resettingestimated_sizetolibrary.serialized_size()under the write lock is exact and can never wipe another thread's reservation. Expandedcap_reservation_prevents_concurrent_overflow_and_oversized_entry_does_not_latch_fullwith a 4-thread concurrent store test against a tight cap.present.rsWM_CLOSEunboundedflush_runtime): Fixed.WM_CLOSEnow callsflush_runtime_timeout(Duration::from_secs(5)), matchingend_title.pipeline_library.rsactivatedroppingruntime.plibon prepared driver mismatch): Fixed. Extractedopen_active_for_device: whencheck_activation_driversees a prepared-cache driver mismatch (and notXCL_PREPARE_CACHE_ONLY=1with prepared libraries), it skips openingready.graphics/ready.computeand still opensruntime.plibfor the runtime device (whereopen_sharedalready validates/resets against the runtime driver). Expandedactivation_driver_mismatch_warns_and_continues_unless_cache_onlyto verifygraphics/computeare skipped whileruntimeis opened.Verification on
13e9c7091(RTX 5070 Ti, driver 610.74, Windows 11 26200, rustc 1.99.0, DXC 1.9.2609.5)cargo build --release -p xcl: ok, 39 warnings (matchesorigin/main5eaadb54c)..\scripts\test.ps1: 2993 passed, 0 failed, 52 ignored, 24 SKIPPED (22no wave64, 2no heap windows), including all updated unit tests andgpu_two_pass_cache_e2e.ea3b5e4d(PR description updated with the fresh13e9c7091xcl-smoke v1block): cold1709frames (60 60 61,15739 MBpeak commit,15.6 MBruntime.plib, 0 removals, 0 crashes,<game>\.xclunchanged); warm repeat1710frames (61 60 60,14996 MBpeak commit, 3 928 graphics + 98 compute served fromruntime.plib, 0 ms bind waits, 0 removals, 0 crashes,<game>\.xclunchanged).(Fixes and verification by Antigravity, Gemini 4 Neon.)
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T18:17:25Z.
Review: COMMENTED
Review of
13e9c709: 5 finding(s) (2 high, 3 medium), most severe first.Re-review at
13e9c709. None of the four findings from thea2eaffc4review (flush thread suspended after the 5 s shutdown timeout, fast-path reservations wiped by the write-lock path, unbounded WM_CLOSE flush,activatedropping runtime.plib on a driver mismatch) was flagged again at this head, so they may be addressed. Please confirm. The findings below are new.crates/xcl/src/hle/d3d12x/real.rs:8316: see below.crates/xcl/src/shaders/pipeline_library.rs:349: If the real serialized size goes past the cap after a store whose size was underestimated,flush_runtime_ondisables writes for the session and drops every pipeline added since the last flush, and this repeats on every launch. (inline)crates/xcl/src/shaders/pipeline_library.rs:235: On a device without pipeline-library support,open_active_for_devicereturns Ok(None) even with XCL_PREPARE_CACHE_ONLY=1 and prepared libraries present. (inline)crates/xcl/src/shaders/pipeline_library.rs:738:one_buildserializes same-name builds whenever a runtime library exists, even when the holder's result can't land in it (the runtime isfull, the store was skipped, or StorePipeline failed). (inline)crates/xcl/src/shaders/pipeline_library.rs:188: runtime.plib never evicts. (inline)On lines outside the diff:
crates/xcl/src/hle/d3d12x/real.rs:8316:translated_graphics_pso_oncestores the built pipeline in runtime.plib under the with-rect-GS name even whenretry_without_rect_gsdropped the GS, so the entry describes a different pipeline than its name.cache_eligiblealready keeps this PSO out of the RAM/disk blob caches, but this store only checkscacheable && hr >= 0. Later lookups in the same run hand the GS-less blob to a desc with the GS: the driver refuses it and the pipeline is rebuilt, or, if the driver doesn't check the GS, it's a wrong-pipeline hit. In later runs, LoadPipeline with the GS desc misses, StorePipeline returns E_INVALIDARG, and the entry stays dead and is rebuilt on every run. The stream path already leaves rect_gs out oflibrary_name. Skipping the store whendropped_rect_gs(or!build.cache_eligible && !reused) would fix it.These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T18:17:25Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 349High: If the real serialized size goes past the cap after a store whose size was underestimated,
flush_runtime_ondisables writes for the session and drops every pipeline added since the last flush, and this repeats on every launch. Near the cap, the slow path admits a store using the estimate (blob + name + 4096). The real entry also carries the root signature, input layout and desc subobjects, soserialized_sizeends up slightly over the cap. The next flush seescurrent > runtime.cap, setsdisabled = trueand writes nothing. The next launch reopens the same file just under the cap, rebuilds the same pipelines, overshoots again and loses them again. Flushing what fits (or stopping admission with a margin) instead of disabling would avoid it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T18:17:25Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 235Medium: On a device without pipeline-library support,
open_active_for_devicereturns Ok(None) even with XCL_PREPARE_CACHE_ONLY=1 and prepared libraries present. The oldactivatereturned an error here. Cache-only promises a run with nothing to build, but now the launch carries on, logs an info line, and builds every pipeline in the driver, so a measured cache-only run silently measures cold builds.check_activation_drivercovers only the driver-mismatch case, so nothing else restores the guard.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T18:17:25Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 738Medium:
one_buildserializes same-name builds whenever a runtime library exists, even when the holder's result can't land in it (the runtime isfull, the store was skipped, or StorePipeline failed). Each waiter then wakes, misses inwith_name, takes the flight and does its own full compile while the rest keep waiting. With runtime.plib at XCL_RUNTIME_LIBRARY_MB, N threads requesting the same pipeline (e.g. a small compute shader with no RAM blob) compile one after another instead of in parallel, stalling title threads for up to N compile times. Skippingone_buildwhenruntime.fullis set, or letting a waiter that misses build without taking the flight, would avoid it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T18:17:25Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 188Medium: runtime.plib never evicts. Entries whose names changed (after translator or setting changes, which the PR says happen routinely) stay forever, so the file eventually reaches the 2048 MiB cap,
fullis set at open, and from then on no new pipeline is kept: every new pipeline is rebuilt on every run, while each launch still loads the full 2 GiB of mostly dead entries into RAM. The README says not to delete these folders, so the user has no way out. Rebuilding the file from the names hit in the last run when it nears the cap, or starting fresh when the translator identity changes, would keep it useful.Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T18:35:28Z.
Thanks @bmjask for another sharp pass! All 5 findings from review
6156309868are fixed in69c106e0c(cc @Prime1997):real.rstranslated_graphics_pso_oncestoringretry_without_rect_gsfallback under with-rect-GS name): Fixed. Addedgraphics_build_storable_in_library(cacheable, &build)checkingcacheable && build.hr >= 0 && (build.cache_eligible || build.reused)so a fallback build whose generated rect-list GS was dropped (cache_eligible: false, reused: false) is not stored under the with-rect-GS library name. Covered bydropped_rect_gs_build_is_not_stored_under_rect_gs_library_name.pipeline_library.rsunderestimated store overshootingcapand disabling flushes): Fixed. IncreasedENTRY_OVERHEADto64 KiB(covering root signature, input layout, and desc subobjects) and addedadmit_cap(cap)(cap - 2 MiBheadroom for real caps>= 16 MiB) used byopen_runtime,try_reserve_fast,can_store_locked, and post-storeafter >= admit_cap, whileflush_runtime_onenforces<= cap, so minor D3D12 subobject/directory growth on the final admitted store stays withincapand never tripsdisabled.pipeline_library.rsopen_active_for_devicereturningOk(None)without pipeline-library support underXCL_PREPARE_CACHE_ONLY=1): Fixed. Addedcheck_library_support: when!NativeLibrary::supported(device)andcache_only && has_prepared,open_active_for_devicenow returnsErr("Pipeline library: the device does not support pipeline libraries"). Covered bycache_only_fails_without_library_support_and_one_build_skips_when_full.pipeline_library.rsone_buildserializing whenruntime.fullis set): Fixed.one_buildnow checksshould_use_one_buildand skips waiting onceruntime.fullis set so concurrent builds are not needlessly serialized when results cannot land inruntime.plib. Covered bycache_only_fails_without_library_support_and_one_build_skips_when_full.pipeline_library.rsruntime.plibnever evicting stale entries +README.md): Fixed. Added a siblingruntime.stamp(layout:translation:settings) written alongsideruntime.plibindata_dirwhen a fresh library is flushed: under-cap libraries and same-build full libraries are kept unchanged, while a full library (>= admit_cap) carrying entries from an older build or settings automatically starts fresh (should_reset_full_runtime). Also clarified inREADME.mdthat deletingruntime.plibunder the per-title data folder is always safe (only<game>\.xcl\pipeline-libraries\should not be deleted for a clean run). Covered byfull_runtime_library_resets_only_when_build_stamp_changed.Verification on
69c106e0c(RTX 5070 Ti, driver 610.74, Windows 11 26200, rustc 1.99.0, DXC 1.9.2609.5)cargo build --release -p xcl: ok, 39 warnings (matchesorigin/main5eaadb54c)..\scripts\test.ps1: 2996 passed, 0 failed, 52 ignored, 24 SKIPPED (22no wave64, 2no heap windows), including all new unit tests andgpu_two_pass_cache_e2e.ea3b5e4d(PR description updated with the fresh69c106e0cxcl-smoke v1block): cold1711frames (60 60 61,16211 MBpeak commit,133.4 MBruntime.plib+50 Bruntime.stampindata_dir, 0 removals, 0 crashes,<game>\.xclunchanged); warm repeat1710frames (60 60 60,15285 MBpeak commit, 2 752 graphics + 237 compute served fromruntime.plib, 0 ms bind waits, 0 removals, 0 crashes,<game>\.xclunchanged).(Fixes and verification by Antigravity, Gemini 4 Neon.)
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T18:49:27Z.
Code review location:
crates/xcl/src/shaders/warm_library.rs; line 259High: If the staged corpus has no identity file,
publish()deletes receipt.json, so on the next launchprepared_state()finds no receipt and reports the libraries Absent. The just-prepared graphics.plib/compute.plib are never used, and full preparation runs again on every launch. For a title whose .xcl/pso-corpus has no identity file, launch 1 prepares and publishes with no receipt. Launch 2 getsread(dir) == None, soLibrary::Absent("no prepared libraries")triggersdiscover(), and preparation (graphics worker, every recipe translated) starts over. This repeats on every launch and never reaches Current. With XCL_PREPARE_CACHE_ONLY=1 the title is refused with 'no native pipeline libraries' even right after a successful preparation. Writing a receipt keyed on a fallback identity (or keeping the old one) would let the result be used.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T18:49:27Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 9578Medium: In
finish_two_pass, the mesh pass'sone_buildguard lives until the function returns, so it stays held while the thread waits up to 60 s for the shared compute pass'sone_buildand then builds the compute pass, even though the mesh pipeline is already built. It isn't stored in runtime.plib until the end. With threads A and B creating the same two-pass pipeline M, A builds the mesh and waits onone_build(C), held by thread D. B waits onone_build(M)for the whole compute wait plus compile, with M's mesh blob already in hand. If A parks intake_cold_slotfor the compute pass,release_one_build_on_parkdrops the mesh flight too: B wakes, finds no M in the library and compiles the mesh pass again, the double compileone_buildis meant to prevent. Storing the mesh and dropping its guard before entering the compute pass would fix both.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T18:49:27Z.
Review: COMMENTED
Review of
69c106e0: 2 finding(s) (1 high, 1 medium), most severe first.Re-review at
69c106e0. None of the five findings from the13e9c709review (runtime.plib store after the rect GS is dropped, flush disabling writes after an underestimated store, the cache-only guard on devices without library support,one_buildserializing when the runtime is full, runtime.plib never evicting) was flagged again at this head, so they may be addressed. Please confirm. The two findings below are new.crates/xcl/src/shaders/warm_library.rs:259: If the staged corpus has no identity file,publish()deletes receipt.json, so on the next launchprepared_state()finds no receipt and reports the libraries Absent. (inline)crates/xcl/src/hle/d3d12x/real.rs:9578: Infinish_two_pass, the mesh pass'sone_buildguard lives until the function returns, so it stays held while the thread waits up to 60 s for the shared compute pass'sone_buildand then builds the compute pass, even though the mesh.... (inline)These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T19:09:04Z.
Thanks @bmjask! Both findings from review
6156821596are fixed ine39ea9ffd(cc @Prime1997):warm_library.rsidentity-less corpus deletingreceipt.jsonand rebuilding every launch): Fixed. Addedcorpus_identity(corpus)incrates/xcl/src/shaders/warm_library.rs(usingCorpus::directory()frompso_corpus.rs): when theidentityfile is absent, it computes a deterministic 32-byte content fallback identity over the corpus counts,windows,graphics.bin, and sortedcompute/*files.publish()now always writes a validreceipt.json, so an unchanged identity-less corpus hitsLibrary::Current(including underXCL_PREPARE_CACHE_ONLY=1), while any changed corpus or[0; 32]receipt producesLibrary::Stale("corpus changed"). Covered byidentityless_corpus_uses_content_fallback_identity_and_detects_changes.real.rsfinish_two_passholding meshone_buildacross compute pass): Fixed.finish_two_passnow storesmesh_psointo the pipeline library and dropsmesh_one_buildright after the mesh pass completes (beforeslot.take()and before enteringone_build(&compute_name)ortake_cold_slotfor the compute pass), so threads waiting on the mesh name reuse it immediately and a compile-gate park in the compute pass cannot prematurely drop an unstored mesh flight.Verification on
e39ea9ffd(RTX 5070 Ti, driver 610.74, Windows 11 26200, rustc 1.99.0, DXC 1.9.2609.5)cargo build --release -p xcl: ok, 39 warnings (matchesorigin/main5eaadb54c)..\scripts\test.ps1: 2996 passed, 0 failed, 52 ignored, 24 SKIPPED (22no wave64, 2no heap windows), includingidentityless_corpus_uses_content_fallback_identity_and_detects_changesandgpu_two_pass_cache_e2e.ea3b5e4d(PR description updated with the freshe39ea9ffdxcl-smoke v1block): cold1706frames (60 60 61,16199 MBpeak commit,132.6 MBruntime.plib+50 Bruntime.stampindata_dir, 0 removals, 0 crashes,<game>\.xclunchanged); warm repeat1718frames (60 60 60,15380 MBpeak commit, 1 262 graphics + 487 compute served fromruntime.plib, 0 ms bind waits, 0 removals, 0 crashes,<game>\.xclunchanged).(Fixes and verification by Antigravity, Gemini 4 Neon.)
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T19:21:36Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 8336High: The new
graphics_build_storable_in_librarycheck needscache_eligible || reused, but a library hit is built withreused: false, cache_eligible: false(line 8296), so graphics pipelines imported from the previous library during preparation are no longer stored in the new graphics.plib. In an incremental preparation after a translator or settings change,prepare_graphics->translated_graphics_pso_once->load_graphicshitsfrom_previousand returnsLoaded::Pipeline, and the store is skipped (on main,cacheable && hr >= 0stored it).finish()then writes a graphics library holding only the newly built pipelines, so every unchanged graphics pipeline is lost and rebuilt by the next preparation or at runtime. Each preparation drops what the previous one imported. The stream and two-pass paths still store library hits, so only plain graphics is affected. Treating a library hit as storable (or marking itreused) would fix it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T19:21:36Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 233Medium:
runtime.stampis written only when the library starts fresh or has no stamp, so it records the build that created runtime.plib, not the builds that filled it, andshould_reset_full_runtimethen throws away full libraries filled entirely by the current build. Build A creates runtime.plib (stamp A). The user updates to build B and plays until the library reaches the cap, so every new entry is a B pipeline. On B's next launch the saved stamp A differs from B,open_runtimelogs 'contains entries from an older build' and starts empty, and up to 2 GiB of valid B pipelines are rebuilt. Updating the stamp whenever a flush writes entries would keep it accurate.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T19:21:36Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 499Medium: When the
try_locksucceeds andadded == 0, or the end flush finishes within the timeout,flush_runtime_timeoutreturns[0, 0], so the periodic xcl-pipeline-library thread isn't excluded fromsuspend_other_threadseven though it can start a flush right after the check. Inend_title, a title thread stores one more pipeline just after the check, and the periodic thread's 30 s tick startsSerialize(allocating up to 2 GiB and holding the D3D12 library lock).suspend_other_threadssuspends it while it holds the heap lock, anddrain_gpu/log::flushhang until the 15 s watchdog aborts the process: the freeze the keep-list was added to prevent. Always excluding the periodic thread, or stopping it before the final flush, would close it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T19:21:36Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 803Medium:
one_buildmakes a title thread wait up to 60 s (XCL_ONE_BUILD_WAIT_S) for any other thread building the same name, including a pso_async preload worker at THREAD_PRIORITY_LOWEST, and the flight is released only if that worker parks inbig_compile_turn. If a preload worker that already has a slot starts a 20–30 s compute or mesh compile of X at lowest priority, it never parks. When the render thread then creates X, it blocks inFLIGHTS.enterfor up to 60 s and then builds X anyway, where before it compiled at normal priority straight away. Not waiting on low-priority holders (or boosting the holder while a title thread waits) would avoid the stall.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T19:21:36Z.
Review: COMMENTED
Review of
e39ea9ff: 4 finding(s) (1 high, 3 medium), most severe first.Re-review at
e39ea9ff. The two findings from the69c106e0review (receipt deleted for an identity-less corpus, the two-pass mesh guard held across the compute wait) weren't flagged again at this head, so they may be addressed. The first item below looks like a regression introduced by the new storability check.crates/xcl/src/hle/d3d12x/real.rs:8336: The newgraphics_build_storable_in_librarycheck needscache_eligible || reused, but a library hit is built withreused: false, cache_eligible: false(line 8296), so graphics pipelines imported from the previous library during prep.... (inline)crates/xcl/src/shaders/pipeline_library.rs:233:runtime.stampis written only when the library starts fresh or has no stamp, so it records the build that created runtime.plib, not the builds that filled it, andshould_reset_full_runtimethen throws away full libraries filled entir.... (inline)crates/xcl/src/shaders/pipeline_library.rs:499: When thetry_locksucceeds andadded == 0, or the end flush finishes within the timeout,flush_runtime_timeoutreturns[0, 0], so the periodic xcl-pipeline-library thread isn't excluded fromsuspend_other_threadseven though it.... (inline)crates/xcl/src/shaders/pipeline_library.rs:803:one_buildmakes a title thread wait up to 60 s (XCL_ONE_BUILD_WAIT_S) for any other thread building the same name, including a pso_async preload worker at THREAD_PRIORITY_LOWEST, and the flight is released only if that worker parks in .... (inline)These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T20:04:42Z.
Thanks for the thorough re-review @bmjask (cc @Prime1997) — all four findings from the
e39ea9ffreview are fixed in7b4b8ad0b:graphics_build_storable_in_libraryskippingfrom_previouslibrary hits during incremental preparation (real.rs): Added an explicitdropped_rect_gs: boolfield toGraphicsPsoBuild(setfalseon cached reuse andlibrary_psohits, and set fromretry_without_rect_gson cold/retry builds) and simplifiedgraphics_build_storable_in_librarytocacheable && build.hr >= 0 && !build.dropped_rect_gs. Library hits imported from the previous library now remain storable into the newgraphics.plib, while dropped-rect-GS fallbacks stay excluded. Extendeddropped_rect_gs_build_is_not_stored_under_rect_gs_library_nameto assert both cases.runtime.stampstuck on the initial creating build (pipeline_library.rs): Addedneeds_stamp_write(started_fresh, saved_stamp, current_stamp)(started_fresh || saved_stamp.map(str::trim) != Some(current_stamp)) and used it forwrite_stampinopen_runtime. When an under-capruntime.plibis opened and receives new pipelines under a newer build/settings, the flush now refreshesruntime.stampto the current build so a library filled under the new build is kept instead of reset on the next launch. Added unit assertions infull_runtime_library_resets_only_when_build_stamp_changed.xcl-pipeline-libraryflusher not excluded fromsuspend_other_threadson fast-path or timely finish (pipeline_library.rs): AddedSHUTTING_DOWN: AtomicBoolchecked before flushing instart_counting(), and updatedflush_runtime_timeoutto setSHUTTING_DOWN = trueand always returnPERIODIC_FLUSH_TIDin slot[1](even whenadded == 0or the end-flush helper finishes within the timeout), soend_titlenever suspends the periodic flusher while it could hold the process heap or D3D12 lock.THREAD_PRIORITY_LOWESTpreload worker inone_build(pipeline_library.rs): Recorded holder priority (low_priority: boolviaGetThreadPriority(GetCurrentThread()) < THREAD_PRIORITY_NORMAL) inOneBuildFlightsand addedenter_with_priority: normal-priority callers take over a flight held by a low-priority preload worker immediately instead of waiting, while still deduplicating concurrent normal-priority builds and preventing low-priority workers from racing each other; dropping a superseded low-priority guard checks its flight ID and never removes the normal-priority holder's entry. Covered byone_build_normal_priority_does_not_wait_on_low_priority_holder.Re-verification on
7b4b8ad0bbba760199c7e9a2957834161630a74d(RTX 5070 Ti, driver 610.74, Ryzen 9 9950X, Windows 11 Build 26200, rustc 1.99.0, DXC 1.9.2609.5):cargo build --release -p xcl: ok, 39 warnings (matchesmain5eaadb54cbaseline)..\scripts\test.ps1: 2997 passed, 0 failed, 52 ignored, 24SKIPPED(22no wave64, 2no heap windows).ea3b5e4d, freshXCL_DATA_ROOT+XCL_DXIL_CACHE,<game>\.xclunchanged):1589frames (60 60 60),15674 MBpeak commit,0device removals,0crashes,exit: 0x0; wrote16.9 MBruntime.plib+50 Bruntime.stamp(3 932graphics +212compute =4 144pipelines).1676frames (60 61 60),14687 MBpeak commit,0device removals,0crashes,exit: 0x0; served3 932graphics +98compute (4 030total,0compute built,0 msbind waits) fromruntime.plib.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:16:43Z.
Review: COMMENTED
Review of
7b4b8ad0: 4 finding(s) (1 critical, 3 medium), most severe first.Re-review at
7b4b8ad0. Of the four findings one39ea9ff, the regression that dropped library-hit graphics pipelines during preparation, the shutdown-suspend gap for the periodic flusher, and the low-priorityone_buildholder weren't flagged again. Theruntime.stampfix overcorrects (second item below). The first item widens the earlier 'one_build serializes when the runtime is full' finding from13e9c709to every build that isn't stored.crates/xcl/src/shaders/pipeline_library.rs:1031:NativeLibrary::serializeallocatesvec![0; GetSerializedSize()]with an infallible allocation on the periodic flusher thread, for a library of up to 2 GiB, so if commit is short Rust aborts the whole title process. (inline)crates/xcl/src/shaders/pipeline_library.rs:454: Every successful flush now rewritesruntime.stampto the current build, so a library filled mostly by older builds is labelled current as soon as one entry is added and is never reset. (inline)crates/xcl/src/hle/d3d12x/real.rs:8274:one_buildmakes every concurrent creator of a name wait for the holder's build even when that build will never be stored in runtime.plib, so the waiter wakes, misses the library and builds the same pipeline again, and N callers build o.... (inline)crates/xcl/src/hle/d3d12x/real.rs:9692: The two-pass mesh pipeline is now stored in the library (preparation BUILD or runtime.plib) before the compute pass is built, so the old guarantee that a mesh entry exists only if its compute pass succeeded is gone. (inline)These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:16:44Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 1031Critical:
NativeLibrary::serializeallocatesvec![0; GetSerializedSize()]with an infallible allocation on the periodic flusher thread, for a library of up to 2 GiB, so if commit is short Rust aborts the whole title process. Only the read path was made fallible (try_reserve_exact). A title near its commit limit with a 1.8 GiB runtime.plib hits the 30 s periodicflush_runtime, the 1.8 GiB zeroed Vec fails, andhandle_alloc_erroraborts the game mid-session, on top of the 1.8 GiB D3D12 already holds for the opened library. Usingtry_reserve_exacthere too and skipping the flush on failure would avoid it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:16:44Z.
Code review location:
crates/xcl/src/shaders/pipeline_library.rs; line 454Medium: Every successful flush now rewrites
runtime.stampto the current build, so a library filled mostly by older builds is labelled current as soon as one entry is added and is never reset. Build v1 fills runtime.plib to 1.95 GiB. After an update to v2, one run adds 50 MiB, the flush writes stamp=v2, and the library is full. Every later v2 launch sees full with a matching stamp, soshould_reset_full_runtimeis false andfulllatches. No new pipeline is stored again (andone_buildturns off), although ~97% of the entries are dead v1 names. Recording the share of entries per build (or the stamp of the oldest data still present), rather than the last writer, would make the reset decision correct both ways.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:16:44Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 8274Medium:
one_buildmakes every concurrent creator of a name wait for the holder's build even when that build will never be stored in runtime.plib, so the waiter wakes, misses the library and builds the same pipeline again, and N callers build one after another instead of in parallel. This happens for a rect-list PSO whereretry_without_rect_gsdrops the GS (graphics_build_storable_in_libraryis false), a failed build (hr < 0),estimated_store_bytesreturning None, and TransientError/UnusableExisting. A second thread waits through the first thread's whole 4–6 s build (up to XCL_ONE_BUILD_WAIT_S = 60 s), then compiles it itself. Waking waiters with 'not stored, build now' when the holder knows its result won't be stored would restore the parallelism.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:16:44Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 9692Medium: The two-pass mesh pipeline is now stored in the library (preparation BUILD or runtime.plib) before the compute pass is built, so the old guarantee that a mesh entry exists only if its compute pass succeeded is gone. When the driver rejects the compute pass (hc < 0),
finish_two_passreturns E_INVALIDARG, but the mesh entry is already in graphics.plib.pending or runtime.plib and marked handed. Preparation publishes an entry for a pipeline that can't be created, runtime.plib spends capped space on pipelines that always fail, and later requests load the mesh blob and fail again at the compute pass. Storing the mesh only after the compute pass succeeds would keep them paired.Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T20:58:24Z.
Thanks for the sharp review @bmjask (cc @Prime1997) — all four findings from the
7b4b8ad0review are fixed inc301772a1:vec![0; GetSerializedSize()]allocation inNativeLibrary::serialize(pipeline_library.rs): Replaced with a fallibletry_alloc_zeroed(size)helper usingVec::try_reserve_exactthat returnsErr(E_OUTOFMEMORY)instead of aborting the process under tight commit;flush_runtime_onlogs a warning, restoresadded, and skips the flush (stopping afterMAX_FLUSH_FAILURES). Added unit testtry_alloc_zeroed_returns_oom_instead_of_aborting.runtime.stampoverwriting stamp with last writer (pipeline_library.rs): Changedruntime.stampto record per-build byte counts (<stamp> <bytes>per line, backwards-compatible with single-stamp files) updated fromnew_size.saturating_sub(prev_size)on each successful flush underflush_lock.should_reset_full_runtimenow resets a full library when the current build owns less than half ofexisting_len— so v1 filling 1.95 GiB + v2 adding 50 MiB resets fresh on v2, while v1 creating 10 MiB + v2 filling 2.04 GiB is kept on v2. Verified infull_runtime_library_resets_only_when_build_stamp_changedand on the live retail smoke (runtime.stamptracked16 124 048B cold ->17 534 786B warm).one_buildserializing concurrent waiters when the holder won't store intoruntime.plib(pipeline_library.rs):Active::store_runtimenow returnsbool(trueiff usable inruntime.library),with_nameandstore_runtimenotifyFLIGHTS.mark_stored/FLIGHTS.mark_not_stored, andOneBuildGuard::dropmarks a flight unshared if it finishes without a library hit or successful store (dropped_rect_gs,hr < 0, unreadable blob,UnusableExisting,TransientError, or over-cap). All waiting threads wake immediately withflight: Noneand build in parallel instead of serializing one after another, while a subsequent successful store clears the unstorable mark. Covered byone_build_wakes_waiters_in_parallel_when_holder_does_not_store.mesh_psostored before compute pass succeeds (real.rs,pipeline_library.rs):finish_two_passnow releasesmesh_one_buildearly viaOneBuild::release_deferred()(waking mesh waiters without marking unstorable whileGRAPHICS_BLOBSalready holds the mesh blob in RAM) and dropsslotbefore computeone_build, while deferringpipeline_library::store(mesh_name, &mesh_pso)until after the compute pass succeeds (hc >= 0 && !compute.is_null()), keeping prepared and runtime libraries paired.Re-verification on
c301772a11027c141c797184f7f9a5168f7311d3(RTX 5070 Ti, driver 610.74, Ryzen 9 9950X, Windows 11 Build 26200, rustc 1.99.0, DXC 1.9.2609.5):cargo build --release -p xcl: ok, 39 warnings (matchesmain5eaadb54cbaseline)..\scripts\test.ps1: 2999 passed, 0 failed, 52 ignored, 24SKIPPED(22no wave64, 2no heap windows).ea3b5e4d, freshXCL_DATA_ROOT+XCL_DXIL_CACHE,<game>\.xclunchanged):1418frames (50 54 53),15645 MBpeak commit,0device removals,0crashes,exit: 0x0; wrote16.1 MB(16 124 048B)runtime.plib+ matchingruntime.stamp(3 934graphics +205compute =4 139pipelines).1653frames (60 60 60),14668 MBpeak commit,0device removals,0crashes,exit: 0x0; served3 932graphics +195compute (4 127total,0 msbind waits) fromruntime.plib, updatingruntime.plibandruntime.stampto17 534 786B.Imported from ivall/xcl. Originally posted by jsalzy on 2026-12-02T23:48:35Z.
merge-check claim
head:
5894838c8bImported from ivall/xcl. Originally posted by jsalzy on 2026-12-02T23:57:56Z.
merge-check
base:
078358ahead:
5894838merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3034 passed, 0 failed, 52 ignored; SKIPPED: 25 (22 no wave64 on this GPU; 2 no heap windows (opt-in XCL_HEAP_WINDOWS=1); 1 driver cache cannot be disabled without Windows Developer Mode); failing: none
title run: not run
review: read real.rs, launcher.rs, present.rs, state.rs, gpu/recomp/pso.rs, build.rs and pipeline_library.rs's runtime path (activate, store, flush, cap, one_build, temp cleanup); warm_library.rs and pso_corpus.rs read for their publish and file handling, not line by line. No defect found in those. build.rs only drops the two legacy cache IDs (-5 lines). store cannot fail at run time (no build active -> store_runtime), so finish_two_pass's E_INVALIDARG returns apply only while a library is being prepared, as on main. one_build waits up to 60 s (XCL_ONE_BUILD_WAIT_S) for another thread's build of the same pipeline, is released when its holder parks in the compile gate, and is off once the runtime library is full; enter_two_pass_compute_one_build drops the mesh compile slot before waiting (tested). File writes and deletes stay in XCL's own folders: runtime.plib now lives in the per-title data folder, cleanup_stale_runtime_temps removes only runtime.tmp- files of processes no longer running, publish removes its own .plib.pending files, and the tests use %TEMP%. end_title and window close flush with a 5 s budget and keep the flush threads unsuspended. The new pipeline-library tests ran and passed (none skipped); no new compiler warnings. No duplicate: no other PR adds a runtime library, its cap or single-flight builds; #3158 and #3467 (both open) edit the same code and may conflict with it.
performance: on by default: every run reads runtime.plib (up to XCL_RUNTIME_LIBRARY_MB, 2048 MiB) into memory and keeps it, and while it grows it is serialized whole and rewritten every 30 s plus one more 30 s per 256 MB (throny's runs reached ~1.1 GB in 900 s), which costs commit and disk writes on machines near their commit limit, against fewer driver rebuilds (690 s of builds in the description's 240 s run). Exit and window close can take up to 5 s longer for the last flush. Not measured here.
verdict: safe to merge
hardware / tool and model: RTX 4070 SUPER 12 GB (621.24 / 32.0.16.2124), Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 25H2 26200.9974, Rust 1.100.0, debug / Claude app (Claude Opus 5.5): merge, build and suite run on this PC with git and cargo only; diff review by Claude Opus 5.5.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T04:22:16Z.
merge-check
base:
078358a058head:
5894838c8bmerge: clean
build: ok
tests: 3034 passed, 0 failed, 52 ignored; 28 skipped, the same as on main
review: 4 medium, 1 nit (below)
performance: 60 s smoke run: 1669 → 1672 frames (100 % of main), peak commit 17577 → 18436 MB, no device removal, no crash
title run: retail title on the RTX 5070 Ti (driver 621.14), into the world by scripted presses: 228 s there, 0 device removals, 0 crashes, 3.3 presents/s; run with
XCL_SKIP_CS=95cc13288a27a96e(the NVIDIA hang at the end of loading, #3541) and NVIDIA's 2048 MB shader heap (#2590)verdict: safe to merge: no blocking finding (the points below are medium or nits), the suite passes and the smoke run is clean
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
In short: Keeps prepared pipeline libraries per memory layout with separate graphics and compute freshness. It also adds runtime.plib in XCL's per-title data folder, which keeps every pipeline built at runtime, with one build per name at a time, pipeline objects handed out once and reused through their cached blob, a 2048 MiB cap, and a Pipelines: stats line. By reading, the earlier blocking points are fixed (no writes into the game folder, ordered flushes and temp cleanup, one_build reuse, loads not blocked by serialization), and nothing in the code blocks it. What is left is the default-on memory cost and the size.
Medium
Nit
Checked and fine
How this was tested
078358a0, thencargo build --workspaceandcargo test --workspace --no-fail-fast -- --test-threads=4.scripts/smoke.ps1: 60 s of a retail title on main078358a0and on this merge; presents per 2 s at the end: 60 60 60.XCL_RUN_SECONDS=300and scripted A presses counted from the first frame (XCL_PRESS_BASE=frame, #3712) into the world from an existing save; time in the world is counted from the first in-world draw call to the end of the run.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by throny on 2026-12-03T06:23:38Z.
Merge check: safe (head
5894838c8, merged onto main16c2fd082)RTX 4080 (driver 621.40), i9-12900K, Windows 11 26300, release build
cargo test --workspace -- --test-threads=4: 3040 passed, 0 failed, 56 ignored; 25 SKIPPED lines, no test binary ended abnormallyretail title, 300 s world run: reached the world, no device removal, no crash, first frame 10.17 s, 2.90 presents/s (main 2.88 on the run before), 0 Aftermath dumps
diff scanned; build.rs only drops the two legacy id constants
warm second start (same build, libraries from the first run): activated the runtime library, no device removal, no crash, first frame 8.22 s (cold 10.17 s), 2.88 presents/s, 0 Aftermath dumps; the runtime library was about 1.19 GB at its save after 160 s
Not tested: AMD/Intel cards; a start that hits the size cap.
AI use: Claude Code (Claude Opus 5.5) ran the checks and wrote this comment.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.