Repository navigation
Conversation
Converting a serialized library from Vec<u8> to Arc<[u8]> allocates and copies its whole payload. Keep the original allocation in Arc<Vec<u8>> through validation, publication and runtime ownership instead. Test the allocation identity and load a pipeline after the other buffer owners have been dropped. The test fails on the original implementation.
43b32ac to
00b4e95
Compare
|
No open or merged PR makes this change, and main still stores the library as AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
Review (head 00b4e95, diff read, not a merge-check; draft, conflicts with main,
Fine: AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
Loading a native pipeline library currently reads a
Vec<u8>and copies the entire payload intoArc<[u8]>. Retain the original allocation inArc<Vec<u8>>instead, reducing temporary CPU memory and copy work during preparation and warm startup. The library still owns the bytes for its full COM lifetime.What is in it
pipeline_libraryandwarm_library; keep the file format and driver validation unchanged.Tested
Rebase validation (2026-11-29)
00b4e95ec249fa4fc3253a28cd72bbf9dbcda316, rebased onto maind8bd9a38204667f3ca7dd9eeffcc2f1c937b07b0. Same Windows PC/toolchain as below.cargo build --workspace --jobs 2: passed.cargo test -p xcl --lib shaders::pipeline_library::tests --jobs 2 -- --test-threads=1 --nocapture: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 2502 filtered out; finished in 4.54s Explicit SKIPPED: 0.cargo test -p xcl --lib shaders::warm_library::tests --jobs 2 -- --test-threads=1 --nocapture: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 2505 filtered out; finished in 0.29s Explicit SKIPPED: 0.git diff --check: passed. Full workspace suite, performance measurements and paired retail smoke were not rerun on this rebased head; earlier results below apply only to their named revisions.Earlier revision results (historical; not the rebased head)
43b32ac33dbbbafed74be95f244aef54b3eaaf2a:cargo build --workspace --jobs 2passed.cargo test --workspace --no-fail-fast --jobs 2 -- --test-threads=4 --nocapture: 2,132 passed, 9 failed, 48 ignored. Unchanged maine13d6250432d486502971781e9589a330e548d24, same commands: 2,131 passed, 9 failed, 48 ignored; the same nine tests failed. This is not a clean full-suite result.cargo bench -p xcl --bench '*' --jobs 2 -- --test: all four optimized benchmark targets completed their smoke cases successfully (not a timing comparison).cargo test -p xcl --lib shaders:: --jobs 2 -- --test-threads=1 --nocapture: 54 passed, 0 failed, 0 ignored, including two early-return skips (missing sample RPF / Developer Mode). The new allocation/lifetime test passed on the GPU; against the original implementation it failed atretain the original allocation(0 passed, 1 failed).XCL_SAMPLE_*inputs are unset; sample-dependent early returns are not coverage.std::fs::readplus shared-buffer construction, two runs of nine alternating pairs per size (rustc -O, median):This measures synthetic file loading and ownership transfer, not driver compilation, game loading, FPS, process commit or VRAM. Byte equality was checked outside the timer.
Failures reproduced on unchanged main
gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1gpu::dxil::module::split::tests::dispatch_chain_oversized_loop_matches_wholegpu::dxil::module::split::tests::dispatch_chain_wave32_live_loopsgpu::dxil::module::split::tests::dispatch_chain_wave64_live_loops_and_exchangegpu::dxil::msaa_tests::direct_msaa_loads_precede_get_dimensionsgpu::recomp::heap_window_tests::gpu_heap_flat_reads_match_guarded_and_root_outputgpu::recomp::tests::gpu_compute_mode_dispatch_abitest_title_runs_and_game_folder_is_untouchedtwo_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobsThe test-title failure reports a post-Wait32/64 write mismatch; the two-pass cache test reports retained two-pass state. The shader failures are also present without this change.
Standalone benchmark reproduction
Save as
library-buffer-probe.rs, compile withrustc -O --edition=2021 library-buffer-probe.rs, then run twice. Peak values count incremental live Rust allocator requests, excluding the existing comparison fixture. The buffers are synthetic, not serialized driver libraries; driver parsing is covered by the GPU tests rather than this benchmark.Regression run
Not run: no retail title is available on this machine. Draft pending paired
scripts/smoke.ps1runs on main and this exact PR head.Not tested
AI use
This PR was created with AI assistance from OpenAI Codex (GPT-6).