Repository navigation
GPU: sweep cut pipeline-cache staging files - #2510
Ingenioeren wants to merge 2 commits into
Conversation
|
Automated triage for the maintainers. Merge candidate. Changed since the last review (new head
On your reply: thanks, this is the reduced version that was asked for. #2129 also clears staging files at load, by checking whether the writing process is still running, so the maintainer will pick one of the two. CI: Generated by Claude Code |
6638591 to
433ec5b
Compare
Since Marvisak#1660 each cache write stages in `<file>.tmp-<pid>-<n>`, and a write cut by an exit (TerminateProcess) leaves that file for good: no later run reuses the name and nothing removed it. `use_pipeline_cache()` sweeps the staging files of the three cache files: this process's at once, other processes' after 10 minutes untouched (the folder is shared and nothing stops a second instance). Only regular files named exactly `<cache file>.tmp-<digits>-<digits>` go. Part of Marvisak#2496: its other half (an exit save that waits for a running one) is Marvisak#2328. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
433ec5b to
1b6a079
Compare
|
Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed and verified 1b6a0795161ead0e1b6bd5f87b4a32d8ce6b6947 merged onto main (63bcca43) on Windows 11 x64 (cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed, 191 files ok; cargo clippy --locked -p victory-gpu --all-targets -- -D warnings: clean; cargo test --locked -p victory-gpu --lib pipeline::library::: 12 passed, 0 failed, including stale_staging_files_are_swept).
sweep_staging and staging_pid (crates/victory-gpu/src/pipeline/library.rs:59-87) cleanly restrict cleanup to immediate regular <cache-file>.tmp-<pid>-<n> staging files and ignore locked-file/directory errors so live reads and saves continue unaffected.
Two minor non-blocking notes:
use_pipeline_cache(library.rs:46-49) runssweep_stagingbeforeDIR.set(dir); guarding the sweep withDIR.get().is_none()would ensure a repeated call cannot sweep an active staging file of the currentpidwithout waitingSTAGING_KEPT.rustfmt --edition 2024 --checkflags the single-lineelse { return };andelse { continue };atlibrary.rs:60, 63.
|
Thanks for the review. Commit A Windows temp-directory probe reproduced the reported behavior on the previous head. A second initialization removed a same-process staging file. With this change, the initial sweep still removed the cut write, and both a live staging file and a file in a later ignored directory survived. All 12 pipeline-library tests passed with the PR applied to AI-assisted verification with OpenAI Codex. |
Dukestar69
left a comment
There was a problem hiding this comment.
LGTM — verified on Windows against origin/main (63bcca4).
- Sweeping
<file>.tmp-<pid>-<n>regular staging files for the three pipeline cache files (immediately for the current PID, after 10 minutes for other PIDs) cleans up leftovers from interrupted atomic writes without risking active writers or unrelated files/directories. cargo test -p victory-gpu --lib pipeline::library:: -- --test-threads=1: 12 passed, 0 failed (includingstale_staging_files_are_swept).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
What
use_pipeline_cache()incrates/victory-gpu/src/pipeline/library.rsnow sweeps stale staging files. Only regular files named exactly{host-pipelines.bin,early-pipelines.txt,prebuilt-pipelines.txt}.tmp-<digits>-<digits>are removed. This process's go at once, because none of its writes has started yet. Other processes' go once untouched for 10 minutes, because the folder is shared and nothing stops a second instance from writing in it.The earlier version also added a lock to
save(). Triage pointed out that #2328 (opened earlier) makes the same change and has tests for it, so that half is dropped here. This PR is now only the sweep.Why
Since #1660, each write stages in a unique
<file>.tmp-<pid>-<n>. A write cut by an exit (the exit save's early return,host_gpu_failed, a crash exit) leaves that file for good: no later run reuses the name, and nothing swept the folder. #2328 makes the normal exit wait for a running save, but crash andhost_gpu_failedexits can still cut a write, so a sweep is needed either way.On #2129: it also removes staging files at load, but decides by checking whether the writing process is still running. This version uses only the file name and age, so it needs no process query and also covers a reused pid. Either approach closes the gap; I'm happy to defer to whichever you prefer.
How tested
pipeline::library::tests::stale_staging_files_are_swept. It checks that own-pid and old foreign staging files are removed for all three cache files, and that a recent foreign one, the cache files themselves, near-miss names (.tmp-7,.tmp-7-x,other.bin.tmp-7-0) and a directory are kept. With the sweep disabled it fails (host-pipelines.bin.tmp-7-0 swept); with the fix it passes.main.cargo test --locked --offline -p victory-gpu: 196 passed, 0 failed, 1 ignored.cargo clippy --locked --offline -p victory-gpu --all-targets: no warnings.cargo run -p xtask -- policy --staged:asset policy: 1 files ok.Not tested: no game run.
Part of #2496 (the other half is #2328).
AI assistance: prepared with Claude Code, reviewed by Ingenioeren.
🤖 Generated with Claude Code