GPU: the pipeline cache folder's stale staging files are swept at start #2512

Closed
oni-swr wants to merge 1 commit from upstream-pr/2514 into main
oni-swr commented 2026-11-25 15:08:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T15:08:37Z.


Part of #2496 (the stale staging-file sweep half only). The save() lock half is covered by #2328; this diff does not touch save(), so it stays disjoint from #2328, #2326 and #2327.

use_pipeline_cache() now removes the staging files a cut write_atomically() left behind:

  • Matches only regular files named exactly host-pipelines.bin.tmp-<digits>-<digits> or early-pipelines.txt.tmp-<digits>-<digits> (ASCII digits, non-empty). Checked with symlink_metadata(), so symlinks and directories are never followed or removed.
  • Own pid: removed at once. Other pids: removed only when the file is at least 10 minutes old, since the folder is shared. If the age is unknown (metadata error, or an mtime in the future) the file stays.
  • A missing folder or a failed delete is ignored and never fails use_pipeline_cache().

Tests (CPU only, VICTORY_D3D12_WARP=1):

  • Strict name parsing, including malformed .tmp-foo-1, empty parts, +, extra parts and non-ASCII digits.
  • The sweep removes the own pid's files and stale files of other pids, and keeps fresh ones, the real cache files, malformed names, a directory with a matching name (and its contents), and a future-dated file.
  • A missing folder is ignored. A symlink test runs on unix.

Checked: cargo test -p victory-gpu --locked --lib pipeline::library, cargo clippy -p victory-gpu --all-targets --locked and cargo xtask policy all pass. No game files, dumps, shader names or retail hashes were used.

AI-assisted: Claude Code (Claude Sonnet 5.5).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6607569868 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2514). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T15:08:37Z. --- Part of #2496 (the stale staging-file sweep half only). The `save()` lock half is covered by #2328; this diff does not touch `save()`, so it stays disjoint from #2328, #2326 and #2327. `use_pipeline_cache()` now removes the staging files a cut `write_atomically()` left behind: - Matches only regular files named exactly `host-pipelines.bin.tmp-<digits>-<digits>` or `early-pipelines.txt.tmp-<digits>-<digits>` (ASCII digits, non-empty). Checked with `symlink_metadata()`, so symlinks and directories are never followed or removed. - Own pid: removed at once. Other pids: removed only when the file is at least 10 minutes old, since the folder is shared. If the age is unknown (metadata error, or an mtime in the future) the file stays. - A missing folder or a failed delete is ignored and never fails `use_pipeline_cache()`. Tests (CPU only, `VICTORY_D3D12_WARP=1`): - Strict name parsing, including malformed `.tmp-foo-1`, empty parts, `+`, extra parts and non-ASCII digits. - The sweep removes the own pid's files and stale files of other pids, and keeps fresh ones, the real cache files, malformed names, a directory with a matching name (and its contents), and a future-dated file. - A missing folder is ignored. A symlink test runs on unix. Checked: `cargo test -p victory-gpu --locked --lib pipeline::library`, `cargo clippy -p victory-gpu --all-targets --locked` and `cargo xtask policy` all pass. No game files, dumps, shader names or retail hashes were used. AI-assisted: Claude Code (Claude Sonnet 5.5). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Marvisak commented 2026-11-25 16:09:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:55:20Z.


Automated triage for the maintainers. Proposed close as a duplicate of the earlier open #2510. #2510 adds the same sweep to use_pipeline_cache() in crates/victory-gpu/src/pipeline/library.rs, with the same name parsing and the same 10-minute rule for other processes' files, and it also adds the save() lock from #2496. This PR's staging_pid only matches host-pipelines.bin and early-pipelines.txt. On main, save() also writes prebuilt-pipelines.txt (PREBUILT_FILE) through write_atomically, so cut writes of that file would never be swept. #2510 covers that file too. CI (check) passes. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167431851 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2514#issuecomment-7167431851). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T15:55:20Z. --- <!-- victory-triage v1 head=4a0555e888918cafeb7ad09f80e3cf00bb4164fd verdict=proposed-close at=2026-11-25T15:55:09Z --> Automated triage for the maintainers. Proposed close as a duplicate of the earlier open #2510. #2510 adds the same sweep to `use_pipeline_cache()` in `crates/victory-gpu/src/pipeline/library.rs`, with the same name parsing and the same 10-minute rule for other processes' files, and it also adds the `save()` lock from #2496. This PR's `staging_pid` only matches `host-pipelines.bin` and `early-pipelines.txt`. On main, `save()` also writes `prebuilt-pipelines.txt` (`PREBUILT_FILE`) through `write_atomically`, so cut writes of that file would never be swept. #2510 covers that file too. CI (`check`) passes. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label. --- _Generated by [Claude Code](https://claude.ai/code)_
upstream-sync closed this pull request 2026-11-25 17:04:31 +00:00
oni-swr commented 2026-11-25 17:05:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T16:21:36Z.


Closing in favor of earlier #2510, which covers the same staging-file sweep (including prebuilt-pipelines.txt) and has been scoped to the sweep.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167843881 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2514#issuecomment-7167843881). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T16:21:36Z. --- Closing in favor of earlier #2510, which covers the same staging-file sweep (including prebuilt-pipelines.txt) and has been scoped to the sweep.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!2512
No description provided.