Skip to content

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

Open
fffluffy-dev wants to merge 1 commit into
fxceless:mainfrom
fffluffy-dev:gpu/pipeline-library-saves
Open

fffluffy-dev wants to merge 1 commit into
fxceless:mainfrom
fffluffy-dev:gpu/pipeline-library-saves

Conversation

@fffluffy-dev

Copy link
Copy Markdown

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 GPU: serialize pipeline library atomic writes with unique temp files 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.

…rary files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kaayzouee

Copy link
Copy Markdown

Duplicate of #164?

Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants