Skip to content

DirectStorage: keep unpacked file requests on disk (XCL_DSTORAGE_CACHE) - #2864

Open
ozimchuk wants to merge 1 commit into
xcl-dev:mainfrom
ozimchuk:dstorage-unpack-cache
Open

ozimchuk wants to merge 1 commit into
xcl-dev:mainfrom
ozimchuk:dstorage-unpack-cache

Conversation

@ozimchuk

@ozimchuk ozimchuk commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

A title streams the same compressed data again and again, within one run and in every later one, and XCL decodes it on the CPU each time (zlib, then BCPack). With XCL_DSTORAGE_CACHE=<folder>, XCL keeps the unpacked bytes of each decoded file request in that folder and reads them back the next time the same request comes. Off by default. Part of #2863.

A request counts as the same when it names the same file (the host file actually opened, after the VFS: its path, size and modification time), the same offset and source size, and the same decoding (zlib and BCPack bits, intermediate and destination sizes). Requests from memory sources and plain copies are not kept. A request on a closed file fails with E_FILE_HANDLE as before, kept bytes or not.

What is in it

  • crates/xcl/src/hle/dstorage/unpack_cache.rs (new):
    • One store per source file, named after the opened file's host path (GetFinalPathNameByHandleW), size and modification time: an append-only data file and an index of fixed 40-byte records, each with the entry's Adler-32.
    • On open, a record without all its bytes, or a record cut short, is dropped. On read, bytes that do not match their checksum are decoded again (counted as bad_entries).
    • A writer thread does the writes (at most 256 MiB queued), so a request never waits for the disk.
    • No eviction: entries stop at XCL_DSTORAGE_CACHE_MB (default 32,768).
    • A store is used by one process at a time: it holds an exclusive lock on its index file (File::try_lock) while open. Another process using the same folder decodes that file's requests as without the cache, and never waits for the lock.
    • Unit tests: found again in a later run and only for the same request; a changed source file and damaged bytes are not used; cut index and lost data are ignored; full cache; puts from 8 threads; a store held elsewhere is not used and loses no entries; Adler-32. In dstorage.rs: one guest name on two host files with the same size and time does not share unpacked bytes.
  • crates/xcl/src/hle/dstorage.rs: execute asks the cache before reading and decoding a file request, and gives it the result after. FileInner keeps the file's store. A closed file gets no cache entry (test: a_closed_file_is_not_answered_from_the_unpack_cache). report.json → dstorage.unpack_cache counts hits, stored entries, entries not stored (full or busy) and bad entries.
  • README.md: the three variables.

694 changed lines, about 280 of them unit tests. The cache cannot be split from its use in execute and still be testable in a run.

Tested

  • NVIDIA (32-lane waves), driver 595.99.02, Ryzen 5 9600X. Linux (Ubuntu 24.04) with Wine 11.21 + vkd3d-proton (dxil-spirv 694cc67), not Windows. Release build for x86_64-pc-windows-gnu, Rust 1.100.0.

  • cargo test -p xcl --lib --release -- --test-threads=4 (the test binary under Wine, with the relaxed vkd3d-proton from Linux (Wine + vkd3d-proton): a retail game reaches what main reaches on Windows; the obstacle is replaced vtables — proposal: proxies #175) on aea330e1, this PR's first head (before the Close fix): 1,312 passed, 12 failed, 27 ignored. 25 SKIPPED, mostly no wave64.

    • Ten of the failures also fail on main 8b957bec here: 8 test-data and validator cases in gpu::rdna2, gpu::dxil, gpu::recomp, plus bcpack::tests::fixtures_decode_to_their_lanes and device_x::tests::gpu_promoted_uav_clear_values_pass_create_committed_resource.
    • The other two, list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares and vram::tests::d32s8_targets_take_their_own_size_of_video_memory, pass when run alone.
    • main's own run hung twice in vram GPU tests after a GPU fault (1,305 passed and the same 10 failed before that). So I have no complete main count to compare with.
    • On this head (68cce725): hle::dstorage:: 40 passed, 0 failed (unpack_cache 7 of them). The Close test fails without its fix, the held-store test without the lock, and the two-host-files test without the host-path key.
  • A retail title, run on main b49be18 plus this commit, because 8b957bec's startup shader preparation (xcl run: prepare shaders in the game window before title execution #2555) takes longer than a run here. The DirectStorage code is identical between the two. A local counter timed the decode stages. Each run ends at ~95 s in main's own crash (XG CopyFromSubresource: retail title passes one argument more → memcpy AV in copy_from; then null write at game+0x23cf683 at end of loading #662; the same with the cache off).

    at 80 s cache off empty cache (first run) kept from an earlier run same, XCL_DSTORAGE_CACHE_VERIFY=0
    Series S: zlib + BCPack decode time 10.4 s (3.5 GB out) 9.3 s 0.1 s 0.1 s
    Series S: all DirectStorage request time 20.2 s 20.5 s 9.3 s 8.1 s
    Series S: answered from the cache – 4,606 (0.3 GB) 63,005 (3.8 GB) 64,786 (3.8 GB)
    Series X: zlib + BCPack decode time 13.7 s (4.4 GB out) 8.0 s (at 74 s) 0.3 s 0.3 s
    Series X: all DirectStorage request time 28.8 s 29.4 s (at 84 s) 15.9 s 13.3 s
    Series X: answered from the cache – 2,298 (0.2 GB, at 74 s) 84,294 (4.9 GB) 83,202 (4.8 GB)

    One run per cell. "Request time" sums the time requests spent on the queue's worker thread (read, decode, cache, copy). The first run costs about the same as no cache, since the writes go to a thread of their own. The read check costs 1.2–2.6 s per 3.8–4.9 GB read back. No entry failed it.
    Frames presented were about the same in all runs (title screens at 30 fps). No run had a device removal before the crash. Cache folder after one run: about 4–5 GB per console mode.

Regression run

  • scripts/smoke.ps1 unchanged, on Linux with PowerShell 7: -Xcl is a wrapper that runs xcl.exe run under Wine 11.21 + vkd3d-proton (dxil-spirv 694cc67, VKD3D_CONFIG=no_descriptor_heap). The same retail title for 60 s, the cache off (the default). -StartupTimeoutSeconds was large enough for xcl run: prepare shaders in the game window before title execution #2555's startup preparation, which had to finish once on main first (several hours here). Wine reports no committed memory, so peak commit reads 0 MB.
xcl-smoke v1
commit: 8b957bec6f82495aec940944c6bf47faa02db590
gpu: NVIDIA GeForce RTX 5060 Ti
title: retail title
seconds: 60
exit: 0x0
frames shown: 1572 (PresentX 1572)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB
xcl-smoke v1
commit: 68cce725538e9a5d6748e5e76eea221e1c4c15a2
gpu: NVIDIA GeForce RTX 5060 Ti
title: retail title
seconds: 60
exit: 0x0
frames shown: 1591 (PresentX 1591)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB
  • On Linux/Wine, the same script on main b49be18, with and without this commit and with the cache empty and full: four clean 60 s runs (1,573–1,612 frames, 60 presents per 2 s, no removals or crashes; Wine reports no commit). The full cache answered all 6,507 requests.

Not tested

  • Windows, AMD, and a run past the world load (main crashes before it here). The store lock only under Wine, and not with two real processes.
  • The size cap is counted per process: two processes with the same folder can together go past it.
  • XCL_DSTORAGE_PARALLEL_DECOMPRESS together with the cache: its requests do not use the cache.
  • A cache folder on a slow disk, and the cache when full over a long session.

AI use

  • Claude Code, Claude Opus 5.5 wrote the code, the tests and this description, and ran the tests and the runs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01H6JBZXaFw99FcnmUV1mPWj

AI-assisted.

@razormontana

Copy link
Copy Markdown
Contributor

Native Windows SATA validation for #2864

Clean PR head aea330e1b892a8a737fd247af2e3606406cfa64e on 8b957bec6f82495aec940944c6bf47faa02db590. The six cache fixtures passed, the opt-in file-request fallback wrote the expected synthetic payload on SATA, and both GPU cases reported in the Wine run passed together on this machine.

Tested

  • Windows 11 Pro 23H2 (22631.5335), Core i7-10700K, GeForce RTX 3070 8 GB, NVIDIA 617.42 (Windows driver 32.0.16.1742), Rust 1.100.0 x86_64-pc-windows-msvc and debug test binaries. Test files and the opt-in cache were on D: (SATA). XCL_ADAPTER=3070, XCL_NETWORK=0, and external sample variables unset.
  • cargo test --offline --locked -j 1 -p xcl --lib --no-run built successfully.
  • cargo test --offline --locked -j 1 -p xcl --lib hle::dstorage:: -- --test-threads=1 --nocapture reported 37 passed, 0 failed, 0 ignored, and 0 explicit skips with the cache unset and again with XCL_DSTORAGE_CACHE pointing to a fresh D: folder, XCL_DSTORAGE_CACHE_MB=64, and XCL_DSTORAGE_CACHE_VERIFY=1. The opt-in run's existing budget-fallback fixture delivered its 48 KiB synthetic zlib output. The resulting data file matched the expected payload hash, and the index held an 8-byte header and one 40-byte record.
  • cargo test --offline --locked -j 1 -p xcl --lib hle::dstorage::unpack_cache::tests:: -- --test-threads=4 reported 6 passed, 0 failed, 0 ignored, and 0 explicit skips in each of two focused runs. This covers reopening a store, source-size and request-key checks, checksum failures, truncated index and data recovery, a full cache, and all 400 writes from eight producers.
  • The two GPU fixtures ran together three times using the command below. Each run reported 2 passed, 0 failed, 0 ignored, and 0 explicit skips. The D32S8 fixture logged all 14 allocations and the command-list fixture logged both splits.
cargo test --offline --locked -j 1 -p xcl --lib -- --exact hle::d3d12x::list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares hle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memory --test-threads=4 --nocapture

Review observation

By inspection, file_close drops the source handle. A request with a memoized store and a matching cache hit could skip the live-handle check in execute. The file-read path returns E_FILE_HANDLE once the handle is closed. The committed fixtures leave this difference in Close behavior unverified. Close, cache lookup and source read

Not tested

Retail playback or smoke, sustained SATA throughput, warm cache hits through the file-request queue, Windows release builds, and the full-workspace or full-library scheduling conditions from the Wine report.

AI use

Codex GPT-6.2 inspected the source and fixtures, ran the tests, checked the stored synthetic output, and drafted this report.

@ozimchuk
ozimchuk force-pushed the dstorage-unpack-cache branch from aea330e to 723f5a1 Compare November 26, 2026 20:27
@ozimchuk

Copy link
Copy Markdown
Contributor Author

@razormontana thanks for the Windows run and the review.

You're right about Close. Once the store was set up, a request on a closed file could still be answered from the cache, where without it the request fails with E_FILE_HANDLE. In 723f5a19, unpack_cache_entry returns nothing for a closed file, so the request goes the usual way and fails as before. New test: a_closed_file_is_not_answered_from_the_unpack_cache. It fails without the fix and passes with it. All 38 hle::dstorage:: tests pass here (Linux, Wine, release).

One request, if you have the time: the PR can't be merged without scripts/smoke.ps1 blocks from Windows, and I only have Linux. Could you run it, with any title you have:

.\scripts\smoke.ps1 -Game <title folder> -StartupTimeoutSeconds <enough for the shader preparation>
  • once on main 8b957bec;
  • once on this PR's head 723f5a19, with the cache off (the default).

The same title and time for both. It would also be useful to run the PR's head twice more with $env:XCL_DSTORAGE_CACHE = 'D:\xcl-dscache', starting from an empty folder. The first run fills it and the second reads from it; report.json → dstorage.unpack_cache shows the hits. That part is optional.

On Linux/Wine, the same script on main b49be18, with and without this commit and with the cache empty and full, gave four clean 60 s runs (1,573–1,612 frames, 60 presents per 2 s, no removals or crashes; Wine reports no commit). The full cache answered all 6,507 requests.

AI-assisted. Claude Code, Claude Opus 5.5 made the fix and the test and wrote this reply.

@razormontana

razormontana commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

@ozimchuk, I confirmed the Close fix at 723f5a19cf3c371de71da06888302f43ab1dfb72. The live-handle check now precedes the per-file cache lookup. An already closed file falls through to the usual E_FILE_HANDLE path. Your update · Handle check · File-read path

Focused Windows tests

Windows 11 Pro 23H2 (22631.5335), i7-10700K, RTX 3070 8 GB on driver 617.42, Rust 1.100.0 x86_64-pc-windows-msvc, debug tests and D: SATA. Here is the command I ran.

cargo test --offline --locked -j 1 -p xcl --lib hle::dstorage:: -- --test-threads=1 --nocapture

Each run passed all 38 tests, including a_closed_file_is_not_answered_from_the_unpack_cache, with 0 failures, 0 ignored and 0 reported skips. I ran once with XCL_DSTORAGE_CACHE unset and once with a fresh D: cache (64 MiB, verification enabled). The opt-in run's stored 48 KiB matched the synthetic fixture payload.

Windows retail smoke

Clean release builds succeeded on 8b957bec6f82495aec940944c6bf47faa02db590 and 723f5a19cf3c371de71da06888302f43ab1dfb72. Both guarded cache-off scripts/smoke.ps1 attempts on main reached the 300 s shader preparation limit before the guest started. The second attempt was seeded with the first attempt's saved shader cache.

A third guarded main run used the stock script's 24-hour startup allowance with no local preparation deadline. I stopped it at the operator's request after 3 h 42 min, during shader preparation. The saved shader cache is available for a later run. The paired cache-off xcl-smoke blocks and optional retail cold/warm measurements remain pending.

AI use

Codex GPT-6.2 inspected the fix, ran the Windows tests and drafted this reply.

@Royalflamejlh

Copy link
Copy Markdown
Contributor

Under Wine + vkd3d-proton on an RTX 4070, at head 723f5a19, the cache stored 73,621 entries (4.9 GB) in one 120 s title run and answered 72,169 and 74,812 file requests (4.7 and 4.9 GB) in the next two runs with it, with 0 bad entries. In those two runs 90 % of the DirectStorage bytes had come 46 and 48 s after the press, against 50 and 54 s in the two runs without it, and the last presents came 4 to 8 s sooner after the press, after 5.2 GB read in all five runs.

Setup: main b49be18 + #684 (e56dbc3, which our runs need) + this pull request's commit cherry-picked (to keep out #2555's launch pass, as in the description), release, Wine 11.21 Staging + vkd3d-proton v3.1-90-g30b0eb9b (relaxed vtables from #175, a local dxil-spirv patch), RTX 4070 12 GB, driver 615.71.09. 120 s each, in table order, XCL_PSO_PRELOAD=0, A pressed once the title presented steadily (16.0–16.5 s; 14.5 s in run 5), the first-run screens completed once, no story progress. Runs with the cache: XCL_DSTORAGE_CACHE on a local disk folder, empty before run 1, XCL_DSTORAGE_CACHE_MB=8192.

Run Cache Hits Stored DirectStorage MB 90 % of it by Last 2 s with presents ends
1 on, empty folder 2,645 73,621 5,171 72 s 80.1 s
2 off — — 5,216 70 s 78.2 s
3 on 72,169 3,314 5,158 62 s 70.5 s
4 off — — 5,260 66 s 74.0 s
5 on 74,812 2,126 5,234 62 s 68.1 s
  • Hits and stored are report.json's dstorage.unpack_cache; MB is the sum of the 2 s activity lines' DirectStorage MB.
  • Two runs of each is few for a difference of 4 s. The peak rate (694–828 MB per 2 s) and the time half the bytes had come (44–48 s) did not separate the two.
  • The 38 hle::dstorage tests passed under Wine in 3 of 3 runs.

Not tested: Windows (razormontana's runs above; the smoke blocks are still pending there); XCL_DSTORAGE_CACHE_VERIFY=0; a cache at its size cap; a changed source file in the title; the smoke.ps1 blocks; the whole test suite.

AI use: Claude Code (Claude Opus 5.5) ran the title and the tests and wrote this comment.

Posted without review by a person: the account owner was away and reads replies later.

rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
@andrewDoing

Copy link
Copy Markdown

I checked overlapping Windows processes on head 723f5a19cf3c371de71da06888302f43ab1dfb72 using the PR's unmodified unpack-cache module inside a standalone synthetic harness (with logging and stats shims).

Two processes opened the same synthetic source and cache directory before either wrote. Each then stored a different request with a distinct 256-byte payload, with verification enabled; process B wrote after A finished. Both reported one stored request, but a fresh reader recovered only B's entry in 3/3 trials. When B opened after A's write, a fresh reader recovered both. Individual writes did not overlap in this test.

Each store captures its data and index ends when opened and appends at those per-process offsets. All payloads returned to the reader matched their expected bytes. This demonstrates a missed cache entry and possible repeat decode, not wrong returned data. No title, GPU workload, or retail timing was tested.

AI use: OpenAI Codex with GPT-6.2 Astra inspected the code and ran the synthetic controls; Codex coordinated and prepared this report.

@andrewDoing

Copy link
Copy Markdown

Follow-up to my overlapping-writer report: a local candidate uses a stable per-store sidecar lock for initialization/repair and paired appends, then refreshes physical file ends under the lock. In three synthetic overlapping-process trials it retained both entries; the sequential control and seven cache-module tests also passed, including a live reader retaining its earlier bytes after another writer appends.

An independent review found an important integration caveat: the current caller stores an open failure as OnceLock<Option<Store>>::None. If the initial open gives up because the sidecar is briefly busy, caching can remain disabled for that file handle's lifetime, and the current stores mutex is held during the wait. A candidate should either retry a transient busy result on a later request or deliberately document that lifetime behavior. Existing readers also do not discover another writer's new entries until reopening, and directory-wide capacity accounting remains a separate per-process issue. Older binaries that do not take the sidecar cannot coordinate with the new lock.

These are local synthetic tests and source review, not retail throughput or GTA VI measurements. AI use: OpenAI Codex with GPT-6.2 Astra implemented and independently reviewed the candidate; Codex coordinated and prepared this follow-up.

@andrewDoing

Copy link
Copy Markdown

Follow-up to the transient-open caveat: a revised local candidate leaves the per-file cache cell uninitialized when the initial sidecar lock is busy. That request falls back to normal decoding; a later request on the same file handle can retry. Permanent open failures retain the existing behavior.

In a caller-level synthetic test with a real held Windows sidecar lock, the first lookup did not initialize the cell. After releasing the lock, a second request on the same handle stored and read the expected 4,096 bytes. All 40 DirectStorage module tests passed, and 3/3 overlapping-process controls still retained both cache entries. An independent review found no lock-order blocker.

Lock acquisition on the initial caller is nonblocking; ordinary metadata/index I/O may still block. Directory-wide size accounting and coordination with older binaries remain separate limitations. Retail throughput and GTA VI were not tested.

AI use: OpenAI Codex with GPT-6.2 Astra implemented, tested and independently reviewed the local candidate; Codex coordinated and prepared this follow-up.

@ozimchuk
ozimchuk force-pushed the dstorage-unpack-cache branch from 723f5a1 to 224ed47 Compare November 27, 2026 04:36
@ozimchuk

Copy link
Copy Markdown
Contributor Author

@andrewDoing thanks, that's a real gap: each store appended at the file ends it saw when it opened, so a second process with the same folder could overwrite the first one's entry.

In 224ed47c (folded into the PR commit) I went for a smaller fix than coordinating the appends: a store is used by one process at a time. Opening a store takes an exclusive lock on its index file (File::try_lock, LockFileEx with fail-immediately on Windows) and keeps it while the store is open. A second process that finds the lock taken doesn't use that store: it logs this once and decodes that file's requests as without the cache. It never waits for the lock and never appends at ends it doesn't own. The store reads its index through the locked handle, and the writer thread drops its handle before a write counts as done.

New test: a_store_held_elsewhere_is_not_used_and_loses_no_entries. A second cache on the same folder (the lock is per handle, so this stands in for another process) is refused the store. The first keeps writing, and once it is gone both entries are found. It fails without the lock. All 39 hle::dstorage:: tests pass here (Linux, Wine, release).

Still as before: the size cap is counted per process, so two processes at once can together go past XCL_DSTORAGE_CACHE_MB. I've only tested the lock under Wine. If you can run your two-process harness on 224ed47c on Windows, that would cover the case I can't.

AI-assisted. Claude Code, Claude Opus 5.5 wrote the fix and the test and wrote this reply.

@ozimchuk
ozimchuk marked this pull request as ready for review November 27, 2026 05:31

@luckyteagirl luckyteagirl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unpack cache uses the guest path as its source identity. factory_open_file opens through VFS, so that path can resolve to a different host file after an install or overlay change. Cache::store then combines the original guest name with only the opened file's size and mtime. If two files share those metadata, the second file can receive decoded bytes from the first even with checksum verification enabled. I compiled the exact cache module and tested two distinct Windows files with matching size and mtime. After closing and reopening the cache under the same simulated guest name, the second file's request hit the first file's payload. Could the store key include the resolved identity of the opened file, with a regression covering two VFS sources for one guest path? VFS file opening · Store key

AI use: OpenAI Codex (GPT-6.2 Sol) reviewed the source, ran the synthetic Windows cache harness, and drafted this comment. The fixture seeds decoded bytes directly. It does not run the VFS, decoder, or a GPU workload.

A title streams the same compressed data again and again, in one run and in every
later one, and XCL decodes it on the CPU each time (zlib, then BCPack). With
XCL_DSTORAGE_CACHE=<folder> the unpacked bytes of a decoded file request are kept in
the folder and read back the next time the same request comes: same file (path, size,
modification time of the host file actually opened, after the VFS), offset, source
size and decoding. One store per source file (an append-only data file and an index of
fixed records, each with the entry's Adler-32); a record without all its bytes, a cut
record or bytes that do not match their checksum are not used. New entries are written
by a thread of their own (at most 256 MiB queued), so a request never waits for the
disk. No eviction: entries stop once the folder holds XCL_DSTORAGE_CACHE_MB (default
32,768). report.json counts hits and stored entries. XCL_DSTORAGE_CACHE_VERIFY=0 skips
the check on reads.

A store is used by one process at a time: it holds a lock on its index file while
open, and another process using the same folder decodes that file's requests as
without the cache instead of appending at file ends it does not own.

Assisted-by: Claude Code (Claude Opus 5.5)
@ozimchuk
ozimchuk force-pushed the dstorage-unpack-cache branch from 224ed47 to 68cce72 Compare November 27, 2026 06:14
@ozimchuk

Copy link
Copy Markdown
Contributor Author

@luckyteagirl thanks, you're right: the store was named after the guest path the title opened, and through the VFS that name can open a different host file (an overlay copy, another install). Two such files with the same size and mtime shared one store, and the Adler-32 couldn't catch it because it checks the stored bytes, not where they came from.

In 68cce725 (folded into the PR commit) the store is named after the file actually opened: Cache::store takes only the handle and hashes its GetFinalPathNameByHandleW path (the VFS doesn't hook it, so it's the host path after the overlay and any links) with the size and mtime as before. The guest path isn't part of the key any more, and the path isn't lowercased now, since a case-sensitive host folder can hold two files whose names differ only in case. I went with the final path rather than volume serial + file index: the 64-bit index isn't unique on ReFS (that needs FILE_ID_INFO), and some network shares and FAT don't keep it stable. Two files that exist at the same time never have the same final path, on any file system.

New test: one_guest_name_on_two_host_files_does_not_share_unpacked_bytes. One guest name is opened on two host files with different bytes and the same size and mtime (set with set_modified). The first run stores an entry for one of them. In a later run the same name opens the other file, and it must not get the first file's bytes. It fails without the fix (the second file gets the first one's payload) and passes with it. All 40 hle::dstorage:: tests pass here (Linux, Wine, release).

Stores written before this have different names, so they're just not used again. They still count toward XCL_DSTORAGE_CACHE_MB until the folder is cleared. Moving the game folder or changing its drive letter now means a cache miss, and the requests are decoded again. Still not covered: a file replaced in place at the same host path by different bytes with the same size and mtime. Size and mtime are the only change check, as before. I've only run this under Wine, not on Windows.

AI-assisted. Claude Code, Claude Opus 5.5 wrote the fix and the test and wrote this reply.

@JJAutoCompare

Copy link
Copy Markdown

Historical regression baseline

Tested clean 723f5a19cf3c371de71da06888302f43ab1dfb72 on Windows 11 build 26200.9974, Ryzen 7 3800X, Rust 1.100.0 MSVC debug. This is the earlier PR revision before the store-locking and resolved-file identity changes. Current head 68cce725538e9a5d6748e5e76eea221e1c4c15a2 was outside this run.

Built the synthetic probe with cargo build --offline -j 2 --manifest-path probe/Cargo.toml. Ran dstorage-cache-probe.exe <mode> <synthetic.zlib> in six fresh processes for cold/warm, reopen, disabled cache, blocked root, per-file store-open failure, and zero cap. It used XCL's DirectStorage factory, native Windows file queue and status-array ABI.

  • Across 12 requests, 11 completed with S_OK and matched all 49,152 output bytes and the 64-byte guard. The closed-file request after a proven warm hit returned E_FILE_HANDLE (0x89240017), left the entire buffer untouched and left cache counters unchanged.
  • Changing the request offset or the same-size file's mtime caused a miss and produced the expected updated bytes. The initial process ended with 3 hits and 3 stores, 147,456 bytes each. A new process read the prior entry, with 1 hit and 0 stores.
  • Disabled cache, blocked root, denied per-file store open and zero cap each decoded correctly. Zero cap incremented not_stored_full once.

Six process controls passed, with zero process failures or runtime skips. CPU/storage only. Store concurrency, resolved-file identity, injected writer failure, retail smoke and the full suite were outside this run.

AI use

T3 Code / Codex (gpt-6.2-sol) prepared the synthetic probe, ran and reproduced the controls, and wrote this report.

@ozimchuk

Copy link
Copy Markdown
Contributor Author

@JJAutoCompare thanks, the closed-file and zero-cap results on native Windows are the cases I couldn't cover under Wine.

Since 723f5a19 the head (68cce725) has had two changes, and so far I've only run them under Wine:

  • a store is held by one process at a time: an exclusive File::try_lock on its index, and a second process decodes without the cache;
  • the store is named after the opened host file (GetFinalPathNameByHandleW) with its size and mtime, instead of the guest path.

If your probe can run on 68cce725, these would be the useful ones on Windows:

  1. Two processes on one cache folder at the same time. The second should log once that the store is in use and still decode correctly, and the first one's entries should all be found afterwards.
  2. One guest path opened on two different host files with the same size and mtime. The second file must not get the first one's bytes.

AI-assisted. Claude Code, Claude Opus 5.5 wrote this reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants