GPU: pipeline library saves run one at a time, with per-process temporary files #237

Open
github-bot wants to merge 1 commit from github-bot/gh-237 into main AGit
Owner

@⁠fffluffy-dev on GitHub · 2026-11-24 22:58 UTC · original
fffluffy-dev:gpu/pipeline-library-saves → main · +97 −12 · 1 files · 1 commits · open

Two saves of the pipeline library could run at once: the end-of-run save(true) and a pipeline worker's periodic save(false). Both wrote the same host-pipelines.tmp and early-pipelines.tmp, so one could truncate the file the other was about to rename over the library. Nothing keeps two runs off one cache folder either.

  • Saves run one at a time (one_save): a periodic save that finds one running is skipped; the end-of-run save waits for it. Same idea as Marvisak/VIctory#1660.
  • Temporary files are named for the process (.tmp-<pid>) and removed when a rename fails.
  • added is lowered by what was saved only after the rename succeeds. Before, it was zeroed before the rename, so a failed rename dropped those pipelines until another one was added.
  • The early list is written only when it changed (before: every save that added a pipeline rewrote it). A failed write marks it changed again.

Validation (cargo-xwin, x86_64-pc-windows-msvc, tests under Wine): cargo test -p victory-gpu 112 passed, 1 ignored, with two new tests (a_periodic_save_skips_a_running_one_and_an_end_of_run_save_waits, a_save_leaves_a_whole_file_and_no_temporary_one); clippy -D warnings clean with and without --all-features; cargo xtask policy ok. Not run against the title.

AI use: written with Claude Code (Claude Opus 5.5); reviewed and posted with my approval. No game files were used.

**@⁠fffluffy-dev** on GitHub · 2026-11-24 22:58 UTC · [original](https://github.com/fxceless/victory-fork/pull/237) `fffluffy-dev:gpu/pipeline-library-saves` → `main` · +97 −12 · 1 files · 1 commits · open Two saves of the pipeline library could run at once: the end-of-run `save(true)` and a pipeline worker's periodic `save(false)`. Both wrote the same `host-pipelines.tmp` and `early-pipelines.tmp`, so one could truncate the file the other was about to rename over the library. Nothing keeps two runs off one cache folder either. - Saves run one at a time (`one_save`): a periodic save that finds one running is skipped; the end-of-run save waits for it. Same idea as Marvisak/VIctory#1660. - Temporary files are named for the process (`.tmp-<pid>`) and removed when a rename fails. - `added` is lowered by what was saved only after the rename succeeds. Before, it was zeroed before the rename, so a failed rename dropped those pipelines until another one was added. - The early list is written only when it changed (before: every save that added a pipeline rewrote it). A failed write marks it changed again. Validation (cargo-xwin, x86_64-pc-windows-msvc, tests under Wine): `cargo test -p victory-gpu` 112 passed, 1 ignored, with two new tests (`a_periodic_save_skips_a_running_one_and_an_end_of_run_save_waits`, `a_save_leaves_a_whole_file_and_no_temporary_one`); clippy `-D warnings` clean with and without `--all-features`; `cargo xtask policy` ok. Not run against the title. **AI use:** written with Claude Code (Claude Opus 5.5); reviewed and posted with my approval. No game files were used.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:39:06 +00:00
Author
Owner

@⁠kaayzouee on GitHub · 2026-11-25 01:24 UTC · original

Duplicate of #164?

**@⁠kaayzouee** on GitHub · 2026-11-25 01:24 UTC · [original](https://github.com/fxceless/victory-fork/pull/237#issuecomment-7149519700) Duplicate of #164?
Author
Owner

@⁠BradRoland on GitHub · 2026-11-25 23:42 UTC · original

I tested recovery of the early-pipeline list on Windows with this change integrated onto 32b31f7. I used a real D3D12 pipeline library, preloaded one synthetic key, requested a second key, and kept early-pipelines.txt open without delete sharing during save(true). That prevented the rename and preserved the original list. After closing the handle I called save(true) again, without requesting any new pipelines.

On unmodified main, the second save still left only the original key on disk. With fb89610 it retained both keys. All seven pipeline-library tests passed on the default hardware path. The retry case also passed on WARP. This exercises failure and recovery through the public save path with an actual Windows sharing violation.

I published the regression test as a separate commit that applies cleanly to this PR head. It runs with cargo test --locked -p victory-gpu --lib --features diagnostics failed_early_list_replacement_is_retried_without_new_pipelines -- --nocapture. Regression test

**@⁠BradRoland** on GitHub · 2026-11-25 23:42 UTC · [original](https://github.com/fxceless/victory-fork/pull/237#issuecomment-7177944461) I tested recovery of the early-pipeline list on Windows with this change integrated onto `32b31f7`. I used a real D3D12 pipeline library, preloaded one synthetic key, requested a second key, and kept `early-pipelines.txt` open without delete sharing during `save(true)`. That prevented the rename and preserved the original list. After closing the handle I called `save(true)` again, without requesting any new pipelines. On unmodified main, the second save still left only the original key on disk. With `fb89610` it retained both keys. All seven pipeline-library tests passed on the default hardware path. The retry case also passed on WARP. This exercises failure and recovery through the public save path with an actual Windows sharing violation. I published the regression test as a separate commit that applies cleanly to this PR head. It runs with `cargo test --locked -p victory-gpu --lib --features diagnostics failed_early_list_replacement_is_retried_without_new_pipelines -- --nocapture`. [Regression test](https://github.com/BradRoland/victory-fork/commit/16c5c34417ddeb6bb0b293c415c126dd6c00bf86)
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/237/head:github-bot/gh-237'
git switch 'github-bot/gh-237'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-237'
git switch 'github-bot/gh-237'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-237'
git switch 'github-bot/gh-237'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-237'
git switch 'main'
git merge --squash 'github-bot/gh-237'
git switch 'main'
git merge --ff-only 'github-bot/gh-237'
git switch 'main'
git merge 'github-bot/gh-237'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.