DirectStorage: reuse small sequential file input buffers #2520
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2530"
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 razormontana on 2026-11-25T21:47:21Z.
Part of #1833. The default DirectStorage worker allocates and zeroes an input buffer for every file request. A worker now retains up to 64 KiB of initialized input storage and reuses it across requests. Larger reads use a temporary buffer.
What is in it
crates/xcl/src/hle/dstorage.rskeeps a worker-local buffer and passes the exact bytes of each successful read to the existing decode and delivery paths. The opt-in decompression pool uses its existing staging budget.crates/xcl/src/hle/dstorage/parallel_tests.rschecks allocation reuse at the high-water size, reads beyond the cache size, and FIFO status and destination bytes after a short read.Tested
73643dae7e179eb0dfc2c27d3503aff7e2351f34.cargo test --offline --locked -j 2 -p xcl --lib hle::dstorage:: -- --test-threads=1 --nocapturepassed 34 tests with zero failures, ignored tests, or skips both with default settings and withXCL_DSTORAGE_PARALLEL_DECOMPRESS=1. With the new tests and the old allocation path, the high-water assertion failed and the short-read compatibility case passed.cargo build --offline --locked --workspaceandcargo build --offline --locked --release --workspacesucceeded. The debugcargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-outputrun withXCL_ADAPTER=3070reported 1,426 passed, 0 failed and 46 ignored across 37 targets. The pass count includes 26SKIPPEDnotices (21 native-wave64 checks, 3 unsupported per-lane forms, 1 reserved cube with mips and 1 heap-window check).Regression run
Both clean release builds ran
scripts/smoke.ps1 -Game <folder> -Seconds 60on the same retail title in the Series S profile on the RTX 3070. They usedXCL_DIRECT_DXIL=1, networking off and identical starting copies of XCL's warmed cache. NVIDIA's driver cache settings were left at their defaults.Main
Candidate
Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T22:08:25Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by xpatfussy69x on 2026-11-25T22:40:48Z.
Test run on exact head
73643da(73643dae7e179eb0dfc2c27d3503aff7e2351f34, on its base6d12f58), clean tree.Tested
cargo test --workspace -- --test-threads=4: 1426 passed, 0 failed, 46 ignoredV_MUL_F16/V_PK_MUL_F16/V_CVT_F16_F32(onmaintoo)cargo test -p xcl --lib sequential: 4 passed, 0 failedsequential_file_input_reuses_its_high_water_allocation: okan_oversized_sequential_file_input_does_not_grow_the_cache: oksequential_short_read_preserves_destination_and_the_next_request_completes: okRegression run (60 s, default settings, a retail title)
main:
this PR:
No crash or device removal; frames 104 % of
main's, peak commit 100 %.Not tested
main(tested on its own base; it merges intoe1d84b7without conflicts)AI use
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T23:27:18Z.
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.Targeted run of the DirectStorage sequential/reuse tests: 6 passed, so the reused buffer path is covered on the Wine lane too.
Not tested: retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-25T23:32:10Z.
Independent AMD RDNA4 (native wave64) verification of exact PR head
73643dae7e179eb0dfc2c27d3503aff7e2351f34on Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver32.0.31044.16, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC1.9.2602.17).Tested
cargo build --workspace(debug): passed (0errors).cargo test --workspace --no-fail-fast -- --test-threads=4:1424 passed, 2 failed, 46 ignored(8 SKIPPED: 6 per-lane DXIL forms refused by host adapter/driver, 1heap_window_out_of_memory_falls_back_to_the_switch_formno heap windows, 1pso_measurement_compiles_an_exact_synthetic_recordWindows Developer Mode off).hle::dstorage::parallel::tests::an_oversized_sequential_file_input_does_not_grow_the_cachehle::dstorage::parallel::tests::sequential_file_input_reuses_its_high_water_allocationhle::dstorage::parallel::tests::sequential_short_read_preserves_destination_and_the_next_request_completesgpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1andfuzz_validate_and_gpu_3) are pre-existing on unmodifiedmainon this RX 9060 XT / driver32.0.31044.16.cargo build --release -p xcl+ 60 s retail-title smoke test (scripts/smoke.ps1, offline):(Compare against
main08db8020on this machine:1553 frames, 13966 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T03:31:24Z.
Independent desktop NVIDIA verification of PR #2530 at head
73643dae7e179eb0dfc2c27d3503aff7e2351f34(1commit; exact parent & merge-base:6d12f58a229bc73889878a448c64dc3af25eeba0, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
73643dae)cargo test --release -p xcl --lib sequential_file_input_reuses_its_high_water_allocation -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1326 filtered out× 3 (0.02s× 3,0skipped)cargo test --release -p xcl --lib an_oversized_sequential_file_input_does_not_grow_the_cache -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1326 filtered out× 3 (0.02s× 3,0skipped)cargo test --release -p xcl --lib sequential_short_read_preserves_destination_and_the_next_request_completes -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1326 filtered out× 3 (0.02s× 3,0skipped)cargo test --release -p xcl --lib hle::dstorage:: -- --test-threads=1(3 consecutive runs)34 passed; 0 failed; 0 ignored; 1293 filtered out× 3 (0.12s× 3,0skipped)cargo build --release -p xcl1m 11s, exit0,0new warnings)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
6d12f58a229bc73889878a448c64dc3af25eeba0, cached baseline on the same machine):PR #2530 (
73643dae7e179eb0dfc2c27d3503aff7e2351f34):Runtime log observations (
xcl.log)9223log lines,0[ERROR]/ device-removal / panic lines.19552 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample14015 MB committed by the process; video memory 6115 MB local, 4686 MB non-local.Limits of coverage
3/3each) andhle::dstorage::(34/34× 3).title: 29640639confirms zero runtime regression in DirectStorage streaming (frame-count delta vs. cached parent reflects single-run startup variance, not this PR); heap allocation rate savings under sustained sequential small-read workloads were not separately profiled.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T03:16:27Z.
merge-check claim
head:
73643dae7eImported from ivall/xcl. Originally posted by throny on 2026-11-28T03:30:25Z.
merge-check
base:
753e8b1ahead:
73643dae7emerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1515 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1512 passed, 0 failed, 47 ignored
review: none. Only the sequential worker gets a reuse buffer (the parallel path passes none); it is a local buffer per worker and is borrowed only inside one synchronous execute, so no request in flight can see it. Only the bytes just read are exposed, and for uncompressed copies main already forces the destination length to the source length, so the buffer's old tail is never copied to the title. The cap is 64 KiB.
performance: removes one allocation and zeroing per small read; keeps at most 64 KiB per sequential queue; not on the frame path (reasoned).
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T13:16:53Z.
merge-check
base: e13d6250
head: 73643dae
merge: clean, noncommitting merge on the exact base above;
git diff --checkcleanbuild:
cargo build --offline --locked -j 4 --workspacepassed on the merged treetests:
cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4on the merged tree: 2,132 passed, 11 failed, 48 ignored, 25 GPU skip notices across 39 targets. Exact-main control with the same command: 2,129 passed, the same 11 failed, 48 ignored, 25 skip notices across 39 targets. All three new DirectStorage tests passed; no failure was introduced by the merge in this paired run. The eleven existing failures are in DXIL/MSAA, GPU recompilation, and e2e tests, not DirectStorage. An earlier merged run had two additional transient failures; both passed alone, and neither recurred in the matched latest-base pair.review: no actionable blocker in the full three-file diff. Each sequential worker retains at most 64 KiB of input storage; a short read exits before decode or destination delivery. Parallel workers keep their existing staging path and FIFO status behavior. The PR already includes clean-commit paired smoke blocks and its own allocation probe.
performance: local benchmark and retail world-load timing not run for this check. The code avoids repeated allocation and zeroing for successful small sequential reads; the PR author's measured probe and smoke are in the description.
verdict: safe to merge from this independent merge, build, test, and code check; the unrelated baseline failures and normal CI/maintainer gates remain visible.
Hardware: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, DXC 1.8.2502.11. AI use: Codex (GPT-6.2 Sol) ran the merge/build/suites and reviewed the diff; Codex (GPT-6.2 Astra) independently reviewed the DirectStorage ownership and ordering.