GPU: retry pipeline cache saves after write failures #72

Open
FIocker wants to merge 1 commit from upstream-pr/72 into main
FIocker commented 2026-11-24 00:13:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by FIocker on 2026-11-24T00:13:02Z.


Keep new pipeline entries eligible for persistence until both the library blob and the early-start list have been written. A temporary write or replacement failure now retries at the next save. Serialize save attempts and use a unique temporary file for each publication.

The new filesystem tests cover concurrent complete writes and temporary-file cleanup when replacement fails. They use synthetic bytes and do not create a GPU device.

Validation on x64 Windows: cargo check -p victory-gpu, cargo clippy -p victory-gpu --tests -- -D warnings, cargo test -p victory-gpu atomic_writes, cargo test -p victory-pipeline, and the asset policy check passed.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6571591474 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/72). Originally posted by [FIocker](https://github.com/FIocker) on 2026-11-24T00:13:02Z. --- Keep new pipeline entries eligible for persistence until both the library blob and the early-start list have been written. A temporary write or replacement failure now retries at the next save. Serialize save attempts and use a unique temporary file for each publication. The new filesystem tests cover concurrent complete writes and temporary-file cleanup when replacement fails. They use synthetic bytes and do not create a GPU device. Validation on x64 Windows: `cargo check -p victory-gpu`, `cargo clippy -p victory-gpu --tests -- -D warnings`, `cargo test -p victory-gpu atomic_writes`, `cargo test -p victory-pipeline`, and the asset policy check passed.
DaviTostes commented 2026-11-24 06:54:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T00:56:10Z.


Tested 521cecc under Wine 11.22 + vkd3d-proton 3.1 on Arch Linux x86_64 (AMD RX 9060 XT, RADV 26.3.1), Windows build with cargo xwin ... --target x86_64-pc-windows-msvc:

  • victory_gpu: 37 passed, 4 failed. Three are the usual environment-only ones; the fourth is this PR's new test pipeline::library::tests::concurrent_atomic_writes_publish_one_complete_file:
    thread '<unnamed>' panicked at crates/victory-gpu/src/pipeline/library.rs:288:65:
    called `Result::unwrap()` on an `Err` value: Os { code: 5, kind: PermissionDenied, message: "Access denied." }
    
    i.e. concurrent MoveFileEx-style replace on the same destination returns ACCESS_DENIED under Wine. The other new test (failed_atomic_writes_remove_their_temporary_file) passes.
  • This is likely Wine's rename/sharing emulation rather than your code, but since the PR is about retrying failed cache saves, it is worth confirming on Windows that eight writers publishing the same file do not hit ACCESS_DENIED there — if they can, the retry should treat it as retryable, which this test asserts by .unwrap()-ing the write instead of letting the production path retry.

No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7118587036 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/72#issuecomment-7118587036). Originally posted by [DaviTostes](https://github.com/DaviTostes) on 2026-11-24T00:56:10Z. --- Tested `521cecc` under **Wine 11.22 + vkd3d-proton 3.1** on Arch Linux x86_64 (AMD RX 9060 XT, RADV 26.3.1), Windows build with `cargo xwin ... --target x86_64-pc-windows-msvc`: - `victory_gpu`: **37 passed, 4 failed**. Three are the usual environment-only ones; the fourth is this PR's new test `pipeline::library::tests::concurrent_atomic_writes_publish_one_complete_file`: ``` thread '<unnamed>' panicked at crates/victory-gpu/src/pipeline/library.rs:288:65: called `Result::unwrap()` on an `Err` value: Os { code: 5, kind: PermissionDenied, message: "Access denied." } ``` i.e. concurrent `MoveFileEx`-style replace on the same destination returns `ACCESS_DENIED` under Wine. The other new test (`failed_atomic_writes_remove_their_temporary_file`) passes. - This is likely Wine's rename/sharing emulation rather than your code, but since the PR is about retrying failed cache saves, it is worth confirming on Windows that eight writers publishing the same file do not hit `ACCESS_DENIED` there — if they can, the retry should treat it as retryable, which this test asserts by `.unwrap()`-ing the write instead of letting the production path retry. No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).
Exorion1er commented 2026-11-24 10:03:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Exorion1er on 2026-11-24T09:33:24Z.


#640 changes the same function in pipeline/library.rs for the same failure: it keeps the lock across both writes and re-marks after a failed save. This PR does that and also:

  • gives each temp file a unique name (pid plus counter) and removes it when the write or rename fails
  • uses saturating_sub where #640 does added -= added
  • has two tests (concurrent writes, temp-file cleanup), where #640 has none

Both merge cleanly but edit the same lines, so only one can land. This one looks like the fuller fix.

Checked by reading both diffs. AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7127576400 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/72#issuecomment-7127576400). Originally posted by [Exorion1er](https://github.com/Exorion1er) on 2026-11-24T09:33:24Z. --- #640 changes the same function in `pipeline/library.rs` for the same failure: it keeps the lock across both writes and re-marks after a failed save. This PR does that and also: - gives each temp file a unique name (pid plus counter) and removes it when the write or rename fails - uses `saturating_sub` where #640 does `added -= added` - has two tests (concurrent writes, temp-file cleanup), where #640 has none Both merge cleanly but edit the same lines, so only one can land. This one looks like the fuller fix. Checked by reading both diffs. AI-assisted (Claude Code).
acetonahard-code commented 2026-11-24 21:28:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by acetonahard-code on 2026-11-24T21:13:08Z.


As already noted in the comments here, this overlaps #640. They conflict in library.rs.

Tested on Windows 11, RTX 4070 SUPER (driver 621.14), with the repo toolchain, merged into current main (ffe310e):

cargo test -p victory-gpu passed failed ignored
main 50 0 1
main + this PR 52 0 1
main, --all-features 53 0 -
main + this PR, --all-features 55 0 -
  • The 2 new tests pass.
  • No GPU test skipped for lack of a device.
  • cargo clippy --all-targets -- -D warnings, with and without --all-features: clean.
  • Minor: cargo fmt --check would rewrap 2 blocks this PR adds (library.rs). main isn't rustfmt-clean either, so take it or leave it.

I didn't test with game data.


Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7144636704 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/72#issuecomment-7144636704). Originally posted by [acetonahard-code](https://github.com/acetonahard-code) on 2026-11-24T21:13:08Z. --- As already noted in the comments here, this overlaps #640. They conflict in `library.rs`. Tested on Windows 11, RTX 4070 SUPER (driver 621.14), with the repo toolchain, merged into current `main` (ffe310e): | `cargo test -p victory-gpu` | passed | failed | ignored | |---|---|---|---| | `main` | 50 | 0 | 1 | | `main` + this PR | 52 | 0 | 1 | | `main`, `--all-features` | 53 | 0 | - | | `main` + this PR, `--all-features` | 55 | 0 | - | - The 2 new tests pass. - No GPU test skipped for lack of a device. - `cargo clippy --all-targets -- -D warnings`, with and without `--all-features`: clean. - Minor: `cargo fmt --check` would rewrap 2 blocks this PR adds (`library.rs`). `main` isn't rustfmt-clean either, so take it or leave it. I didn't test with game data. --- <sub>Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.</sub>
Marvisak commented 2026-11-25 01:07:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:15:08Z.


Automated triage for the maintainers.

Needs rebase. This PR does not merge cleanly into current main (ac2525d). Conflicting files: crates/victory-gpu/src/pipeline/library.rs.

The content has not been reviewed yet; it will be once the branch is rebased onto main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148312463 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/72#issuecomment-7148312463). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:15:08Z. --- <!-- victory-triage v1 head=521ceccd781e95d36a74ad196920104bf424ed00 verdict=needs-rebase at=2026-11-25T00:13:20Z --> Automated triage for the maintainers. **Needs rebase.** This PR does not merge cleanly into current `main` (ac2525d). Conflicting files: `crates/victory-gpu/src/pipeline/library.rs`. The content has not been reviewed yet; it will be once the branch is rebased onto `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/72:upstream-pr/72'
git switch 'upstream-pr/72'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/72'
git switch 'upstream-pr/72'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/72'
git switch 'upstream-pr/72'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/72'
git switch 'main'
git merge --squash 'upstream-pr/72'
git switch 'main'
git merge --ff-only 'upstream-pr/72'
git switch 'main'
git merge 'upstream-pr/72'
git push origin 'main'
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!72
No description provided.