Shaders: under Wine the v1 receipt import lists the cache folder once #3506
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3506"
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 Royalflamejlh on 2026-11-30T03:58:00Z.
Edited 2026-12-02: head
11ceb6a2after bmjask's reviews (see Tested).Under Wine the launch pass's workers spent about 80 s before their first record listing the shader cache folder. When a worker's v2 receipt file is missing,
Verified::opentries 529 v1 file names one by one, and under Wine an open of a name that is not there lists the whole folder; the translated cache keeps its files in that same folder. The import now takes the v1 names from one listing and reads only the ones that exist. Part of #3067.What is in it
crates/xcl/src/shaders/warm_blobs.rs:legacy_nameslists the folder once;Verified::openskips a v1 name that is not in it. One new test of the listing; the existing import test (workers_reuse_previous_slices_and_merge_concurrent_checkpoints) covers that a v1 receipt is still imported.Tested
11ceb6a2(RTX 2070 SUPER 8 GB,cargo test --workspace -- --test-threads=4, debug, 1 run): 3,007 passed, 0 failed, 52 ignored.master71cae091, RTX 4060 Ti 16 GB (driver 615.71.09), rustc 1.98.0, release build forx86_64-pc-windows-gnu, head157fd72conmainf97120dc.11ceb6a2(2026-12-02;3824539frebased ontomain078358a0, no change), after bmjask's two reviews: a listing that fails, even part way, falls back to opening the 529 names; listed names are compared in lower case, as the open matched them.cargo test --lib --release -- warm_blobs driver_cache shaders::under Wine on the CPU only (lavapipe, no card): 119 passed, 1 failed (an_older_process_cannot_remove_a_replacement_blob, as onmain), 14 SKIPPED (no device). Each change has a test that fails without it.6588e5a0(2026-12-01): the listing is used only under Wine (under_wine()); Windows opens the 529 names asmaindoes.cargo test --lib -- warm_blobs driver_cache shaders::: 109 passed, 1 failed (an_older_process_cannot_remove_a_replacement_blob, which fails onmainunder Wine too), 2 SKIPPED. The timings below are from the head before it and are unchanged under Wine by the gate.cargo test -p xcl --lib --release -- warm_blobs: 4 passed, 0 failed.mainf97120dcwith other PRs merged (our Linux branch), 12 workers, 145,872 files in the cache folder: the pass reported 0 records checked from 156 s to about 236 s. In 10 s of that, about half of the workers' CPU samples (perf, 99 Hz) were inreaddir64and its callers, and in 6 s one worker opened the folder 78 times and read it through each time (16,970getdents64calls). After that phasereaddir64was 2 % of the samples.Verified::openalone on that folder, for a device with no receipt, in one process (a temporary timing test, not in the PR; 3 runs each, a title running beside it): 10.08, 9.29 and 9.30 s onmain9335bc0d; 2.45, 0.57 and 0.66 s with this change.Regression run
RTX 2070 SUPER 8 GB (driver 621.01), Ryzen 7 5700X3D, Windows 11 Pro 26200, release builds by
scripts/smoke.ps1, the same retail title for 60 s each.main:this PR's head:
Not tested
under_wine()) and opens the 529 names asmaindoes.AI use
perf,strace), wrote the change and the test, ran the tests above and wrote this description. Claude Opus 5.5 added the Wine gate. Claude Opus 5.5 made the changes after bmjask's reviews and their tests.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:03:13Z.
Review (head
157fd72c, diff read, not a merge-check; draft withPR descriptionred, so not built or run):legacy_names(warm_blobs.rs~65) now lists the whole cache folder (145k entries in the PR's measurement) on Windows too, where an open without a v2 receipt used to make 529 cheap failed opens; it runs once per worker process. Gating it withcrate::util::under_wine()as #3507 does, or measuring it on Windows, would settle it.Fine: a stale listing can't lose a receipt (nothing writes
verified-compute-v1-*any more), the same 529 names are tried, the union of the key sets doesn't depend on order, the existing import test still covers the v1 import, and the new listing test filters correctly.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 Royalflamejlh on 2026-12-01T08:25:57Z.
Thanks, that is right: the listing ran on every platform and was only measured under Wine. It is now gated with
under_wine()(head6588e5a0): Windows opens the 529 names asmaindoes, and the listing is used under Wine, where it measured 0.6 to 2.5 s against 9 to 10 s for the failed opens (3 runs each). The import test covers the listing path under Wine andmain's path on the Windows CI. The title says "under Wine" now.cargo test --lib -- warm_blobs driver_cache shaders::, RTX 4060 Ti under Wine: 109 passed, 1 failed (an_older_process_cannot_remove_a_replacement_blob, as onmainunder Wine), 2 SKIPPED. The Windows suite and the smoke pair are still owed.AI use: Claude Code. Claude Opus 5.5 checked the point and wrote the change; Claude Fable 5.2 ran the tests on the card and wrote this reply.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:36:43Z.
Re-review (head
6588e5a0, diff read, not a merge-check; draft,PR descriptionred). Follow-up to my review of157fd72c.legacy_namesnow runs only underunder_wine(); on Windows the import opens the same 529 v1 names in the same order as main (warm_blobs.rs~65-70).Fine: the listing test, and the existing import test still covers reading the v1 receipt.
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-01T10:05:12Z.
Triage (#1607) – head
6588e5aNo open or merged PR makes the same change. #3507 and #3556 are other Wine fixes for #3067 in different code (the driver blob cache lookups, and blob reuse in
build_with_blob). This one only touches the v1 receipt import inwarm_blobs.rs.The new loop reads the same 529 names plus the unsliced one as main does, and skips the ones missing from one listing only under
under_wine(). No problems found in the diff.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T09:14:35Z.
Code review location:
crates/xcl/src/shaders/warm_blobs.rs; line 48legacy_namesswallows listing errors (into_iter().flatten().flatten()), so a failed or cut-shortread_dirunder Wine becomes an empty or partial set, andopenthen skips v1 receipts that are really there. Ifread_dir(dir)fails once (access denied, sharing violation) orFindNextFileWfails partway (std's ReadDir treats that as the end), every v1 name not in the set is skipped and nothing is imported. The worker's first flush then writesverified-compute-v2-{native}.binwithout the v1 keys,read_keyssucceeds from then on, the v1 import never runs again, and every blob those receipts covered is re-validated on the temporary device. Before, one failed open only lost that one file. Returning None (fall back to probing) on any listing error would avoid losing them.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T09:14:35Z.
Code review location:
crates/xcl/src/shaders/warm_blobs.rs; line 68Not certain about this one: the presence check is an exact, case-sensitive OsString match, but the Windows open it replaces matches names case-insensitively. A v1 receipt stored with different case, e.g. after a case-only rename (vfs_hooks.rs notes Wine keeps the old name then) or copied in by a tool that changes case, would have been opened by
read_keyson the lower-caselegacy_pathbut is now skipped, and its keys are lost for good once v2 is written. Comparing ASCII-lowercased names would match the old behaviour.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T09:14:35Z.
Review: COMMENTED
Review of
6588e5a0: 2 finding(s). 2 are 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-02T14:12:37Z.
@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 Royalflamejlh on 2026-12-02T20:39:16Z.
Code review location:
crates/xcl/src/shaders/warm_blobs.rs; line 48Right.
legacy_namesnow returnsNonewhenread_dirfails or any entry does, and then the import opens the 529 names asmaindoes (warm_blobs.rs:47). A partial set is never used. The test now checks that a folder that cannot be listed givesNone. Headaf34f396.Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T20:39:18Z.
Code review location:
crates/xcl/src/shaders/warm_blobs.rs; line 68Not changed. The v1 names are XCL's own: one format string with lower-case hex makes them (
legacy_path,warm_blobs.rs:40), and only older builds wrote them, with that string. Nothing renames them. The case-only rename note invfs_hooks.rs(~774) is about renames inside the game folder. These receipts are indxc::cache_dir()(%LOCALAPPDATA%\xcl\dxil), outside it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:54:41Z.
Review: COMMENTED
Review of
af34f396: 1 finding(s) (1 medium), most severe first.crates/xcl/src/shaders/warm_blobs.rs:68: The new skip test is a case-sensitiveHashSet<OsString>lookup, but the open it replaces was case-insensitive under Wine (and on Windows), so a v1 receipt whose name on disk differs only in case is now silently skipped. (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:54:42Z.
Code review location:
crates/xcl/src/shaders/warm_blobs.rs; line 68Medium: The new skip test is a case-sensitive
HashSet<OsString>lookup, but the open it replaces was case-insensitive under Wine (and on Windows), so a v1 receipt whose name on disk differs only in case is now silently skipped. If a receipt is stored asverified-compute-v1-00AB...BIN(copied by a tool, restored from backup, or on a casefold/ciopfs mount),read_keysused to open it and import its keys. Nowpresent.containsmisses and the loopcontinues. The device's receipts are dropped, every compute blob is verified again, and the v2 file is written without the legacy keys, so they're lost for good. Comparing lowercased names (or falling back to the open on a miss) would keep the old behaviour.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T21:07:59Z.
Follow-up review of
af34f396, since6588e5a(code reading only, not a merge-check;PR descriptionred) · no new findingsIn short: The PR makes the v1 receipt import under Wine list the cache folder once instead of opening 529 names that are mostly missing. This push makes a listing that fails, even part way, fall back to opening all the names: a partial listing would skip receipts that are there, and the first v2 save would then lose them. That is the right choice, and the test now checks a missing folder gives
None. Nothing blocks it.Checked and fine
6588e5a0, unchanged): the listing runs only underunder_wine(). On Windows the import opens the same names in the same order as onmain.legacy_names(warm_blobs.rs~65) returnsNonewhenread_dirfails or any entry fails (collect::<io::Result<Vec<_>>>).under_wine().then(..).flatten()then givesNone, so every name is opened, as onmain.Nonefor a missing folder andSomeof the one v1 name for a folder holding a v1 receipt, a v2 receipt and a blob.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 Royalflamejlh on 2026-12-02T21:22:33Z.
Code review location:
crates/xcl/src/shaders/warm_blobs.rs; line 68Changed, so the open's match is kept:
legacy_namesnow lower-cases each name it lists (to_ascii_lowercase), and the names it is compared with are lower-case already (legacy_path). The test now also writes one receipt under an upper-case name and finds it. Head3824539f.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T21:24:30Z.
Follow-up review of
3824539f, sinceaf34f396(code reading only, not a merge-check;PR descriptionred) · no new findingsIn short: This push compares the listed v1 receipt names in lower case, as Wine's open matched them, so a receipt whose name was stored in another case is still imported. The test adds an upper-case receipt and checks it is found. Nothing blocks it.
Checked and fine
legacy_names(warm_blobs.rs~47) lowercases each name before filtering.legacy_pathmakes only lower-case names (verified-compute-v1-{key:016x}.bin), socontainsmatches.under_wine(), so Windows opens the names as onmain.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 Foniass on 2026-12-02T22:40:32Z.
Follow-up review of
11ceb6a2, since3824539f(code reading only, not a merge-check;PR descriptionred) · no new findingsIn short: This push only rebases onto
main:git range-diffshows the commit identical to3824539f. Nothing new, and nothing blocks it.Checked and fine
Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
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.