Pipeline cache: save the early list when there is no host pipeline library (Wine/Proton) #259

Open
Ortomanic wants to merge 2 commits from upstream-pr/259 into main
Ortomanic commented 2026-11-24 23:02:01 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Ortomanic on 2026-11-24T23:02:01Z.


Changes

pipeline::library::save() returned before writing early-pipelines.txt when there was no host pipeline library. vkd3d-proton refuses the empty blob the library is created from (no host pipeline library: pipelines are not kept), so under Wine/Proton the list of pipelines a run drew with was never written. The next launch then started nothing during loading and found every pipeline at its first draw, in the world.

The early list is now saved whether or not a library exists. Nothing changes where a library is made.

This is separate from #147 (cache key, worker placement), #164 (save races) and #172 (skipped pipelines): none of them writes the list when the library is missing.

Validation

  • CachyOS, Wine 11.22, vkd3d-proton 3.1.r64, RTX 5080.
  • New test the_early_list_is_saved_with_or_without_a_library passes and fails with the old early return (run under Wine with the other pipeline:: tests, 12 passed).
  • In the title, with the list present and a warm translation cache: about 2,700 pipelines started at creation, 0 "being made" at world entry and no draw dropped for an unmade pipeline in the first minute (two launches). Without a list, the same build entered the world with 1,500 to 2,200 pending and dropped 21,000 to 127,000 draws in the first minute.
  • cargo clippy --workspace --all-targets --locked -- -D warnings for the Windows target, with and without --all-features, and cargo test -p victory-shader -p xtask pass on this branch (cross-compiled from Linux with the pinned toolchain).
  • Not run on Windows, where the library exists and this path is not taken.

AI-assisted patch with local build and runtime validation.

<!-- greyfinch-sync:fxceless/victory-fork:issue:5481790283 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/259). Originally posted by [Ortomanic](https://github.com/Ortomanic) on 2026-11-24T23:02:01Z. --- ## Changes `pipeline::library::save()` returned before writing `early-pipelines.txt` when there was no host pipeline library. vkd3d-proton refuses the empty blob the library is created from (`no host pipeline library: pipelines are not kept`), so under Wine/Proton the list of pipelines a run drew with was never written. The next launch then started nothing during loading and found every pipeline at its first draw, in the world. The early list is now saved whether or not a library exists. Nothing changes where a library is made. This is separate from #147 (cache key, worker placement), #164 (save races) and #172 (skipped pipelines): none of them writes the list when the library is missing. ## Validation - CachyOS, Wine 11.22, vkd3d-proton 3.1.r64, RTX 5080. - New test `the_early_list_is_saved_with_or_without_a_library` passes and fails with the old early return (run under Wine with the other `pipeline::` tests, 12 passed). - In the title, with the list present and a warm translation cache: about 2,700 pipelines started at creation, 0 "being made" at world entry and no draw dropped for an unmade pipeline in the first minute (two launches). Without a list, the same build entered the world with 1,500 to 2,200 pending and dropped 21,000 to 127,000 draws in the first minute. - `cargo clippy --workspace --all-targets --locked -- -D warnings` for the Windows target, with and without `--all-features`, and `cargo test -p victory-shader -p xtask` pass on this branch (cross-compiled from Linux with the pinned toolchain). - Not run on Windows, where the library exists and this path is not taken. AI-assisted patch with local build and runtime validation.
ErRusso commented 2026-11-24 23:41:33 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by ErRusso on 2026-11-24T23:41:33Z.

Review: APPROVED


Reviewed at dfbc779 against 2119b0e.

save() now writes early-pipelines.txt when no host library exists, which is the Wine/vkd3d-proton case; the library path is unchanged. save_soon() adds the missing periodic save after draws note new keys, with a 20 s throttle and a single background save.

Verified: the_early_list_is_saved_with_or_without_a_library passes under Wine. The new test exercises the no-library path and the author's title run shows the intended effect (0 pending at world entry vs 1,500–2,200 before).

LGTM.

<!-- greyfinch-sync:fxceless/victory-fork:review:6049210014 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/259#pullrequestreview-6049210014). Originally posted by [ErRusso](https://github.com/ErRusso) on 2026-11-24T23:41:33Z. **Review:** APPROVED --- Reviewed at `dfbc779` against `2119b0e`. `save()` now writes `early-pipelines.txt` when no host library exists, which is the Wine/vkd3d-proton case; the library path is unchanged. `save_soon()` adds the missing periodic save after draws note new keys, with a 20 s throttle and a single background save. Verified: `the_early_list_is_saved_with_or_without_a_library` passes under Wine. The new test exercises the no-library path and the author's title run shows the intended effect (0 pending at world entry vs 1,500–2,200 before). LGTM.
avt0m4t48 commented 2026-11-25 00:10:10 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-24T23:42:55Z.


I reproduced a retry gap on this exact head (dfbc779) with library() returning None. A source-built control writes the early list successfully. In the failure case, a directory at early-pipelines.txt makes the first rename fail. After removing that obstruction, calling save(true) again without another note_used() returns without saving the list.

The no-library path clears USED_CHANGED before publication, so no later sweep sees pending work unless a new pipeline key arrives. Restoring the bit when the write fails made the same filesystem probe pass. This is the no-library counterpart of the retry behavior discussed on #164. The driver boundary was simulated and the file operations were real.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7147713082 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/259#issuecomment-7147713082). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-24T23:42:55Z. --- I reproduced a retry gap on this exact head (`dfbc779`) with `library()` returning `None`. A source-built control writes the early list successfully. In the failure case, a directory at `early-pipelines.txt` makes the first rename fail. After removing that obstruction, calling `save(true)` again without another `note_used()` returns without saving the list. The no-library path clears `USED_CHANGED` before publication, so no later sweep sees pending work unless a new pipeline key arrives. Restoring the bit when the write fails made the same filesystem probe pass. This is the no-library counterpart of the retry behavior discussed on #164. The driver boundary was simulated and the file operations were real.
Filip722 commented 2026-11-25 03:06:35 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Filip722 on 2026-11-25T02:40:12Z.


On Bazzite 44 with the RTX 5060 Laptop GPU (8 GiB), I can confirm the missing-library case and a separate write-retry issue on this PR.

With this change alone, the focused early-list test passed under Proton. The rejected-blob → empty-library check failed, and a second request for the same synthetic mesh pipeline compiled it again. Applying Marvisak/VIctory#347’s null empty-blob argument made all three tests pass, including the application library’s per-pipeline load counter.

I also compared two no-input Series S menu launches per build, with matching cache/prefix seeds and each build retaining its own cache between starts. The control used our local display and physical-page test tree. It could not create the library, wrote no early list and started with zero keys on both launches. Adding this PR and the null-blob call saved four keys and an 824-byte library on the first launch. The second read four keys and reopened the library. All four reached the account picker.

A subsequent loading run from that menu cache recorded loaded=4, started_early=4, made=5, which verifies actual application-library hits across the restart on this GPU. It saved 1,218 distinct early keys. The next launch opened the 8,888-byte library and recorded 33 hits at the account picker. After confirming the picker on a further restart, the title reached loading artwork with 273 application-library hits from a 53,624-byte library. The host-memory pressure guard ended that run at 143 seconds. World rendering and load-time improvement remain unverified.

I reproduced a retry failure on public head dfbc779 by putting a directory at the early-list destination, noting one key, saving, removing the directory and saving again. The second save left the file missing (Windows error 2). With the dirty state restored on write failure, it saved the original key without another draw. The isolated regression passed, and the repository asset-policy check passed. Cherry-pick the focused retry fix and test.

NVIDIA 615.78.08, Proton Experimental 11.0-20261112, vkd3d-proton 3.2.0 ec20719452e916b, Windows MSVC release builds. OpenAI Codex (GPT-6.2-Sol) prepared the local integrations and retry fix, ran the tests and wrote this report.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7151023791 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/259#issuecomment-7151023791). Originally posted by [Filip722](https://github.com/Filip722) on 2026-11-25T02:40:12Z. --- On Bazzite 44 with the RTX 5060 Laptop GPU (8 GiB), I can confirm the missing-library case and a separate write-retry issue on this PR. With this change alone, the focused early-list test passed under Proton. The rejected-blob → empty-library check failed, and a second request for the same synthetic mesh pipeline compiled it again. Applying Marvisak/VIctory#347’s null empty-blob argument made all three tests pass, including the application library’s per-pipeline load counter. I also compared two no-input Series S menu launches per build, with matching cache/prefix seeds and each build retaining its own cache between starts. The control used our local display and physical-page test tree. It could not create the library, wrote no early list and started with zero keys on both launches. Adding this PR and the null-blob call saved **four keys and an 824-byte library** on the first launch. The second read four keys and reopened the library. All four reached the account picker. A subsequent loading run from that menu cache recorded **`loaded=4, started_early=4, made=5`**, which verifies actual application-library hits across the restart on this GPU. It saved 1,218 distinct early keys. The next launch opened the 8,888-byte library and recorded 33 hits at the account picker. After confirming the picker on a further restart, the title reached loading artwork with 273 application-library hits from a 53,624-byte library. The host-memory pressure guard ended that run at 143 seconds. World rendering and load-time improvement remain unverified. I reproduced a retry failure on public head `dfbc779` by putting a directory at the early-list destination, noting one key, saving, removing the directory and saving again. The second save left the file missing (Windows error 2). With the dirty state restored on write failure, it saved the original key without another draw. The isolated regression passed, and the repository asset-policy check passed. [Cherry-pick the focused retry fix and test](https://github.com/Filip722/VIctory/commit/6ca01748abf0daddf4c6ea804f932d9f85e8159d). NVIDIA 615.78.08, Proton Experimental 11.0-20261112, vkd3d-proton 3.2.0 `ec20719452e916b`, Windows MSVC release builds. OpenAI Codex (GPT-6.2-Sol) prepared the local integrations and retry fix, ran the tests and wrote this report.
ErRusso commented 2026-11-25 11:15:26 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by ErRusso on 2026-11-25T11:15:26Z.

Review: CHANGES_REQUESTED


Changing my approval after @avt0m4t48's and @Filip722's retry reports, which I confirmed in the code at dfbc779.

In pipeline::library::save() the no-library branch does:

} else if USED_CHANGED.swap(false, Ordering::Relaxed) {
    0
} else {
    return;
};
...
let written = library_written
    .and_then(|()| write_atomically(&dir.join(EARLY_FILE), used.join("\n").as_bytes()));

USED_CHANGED is cleared before write_atomically. If that write fails (a directory at early-pipelines.txt, a full disk, a transient lock), the dirty bit is already gone, so a later save(true) returns without writing the list until another pipeline key arrives. That is the retry gap both reports reproduced; the same applies to the library branch, whose serialise failure path also returns after the swap.

Please clear the flag only after a successful write, or restore it when written is Err (and when serialise fails), and add the regression test with an obstructed early-list path that @Filip722 linked (6ca01748). The rest of the PR is unchanged and the early-list behavior itself is still correct.

<!-- greyfinch-sync:fxceless/victory-fork:review:6056600315 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/259#pullrequestreview-6056600315). Originally posted by [ErRusso](https://github.com/ErRusso) on 2026-11-25T11:15:26Z. **Review:** CHANGES_REQUESTED --- Changing my approval after @avt0m4t48's and @Filip722's retry reports, which I confirmed in the code at `dfbc779`. In `pipeline::library::save()` the no-library branch does: ```rust } else if USED_CHANGED.swap(false, Ordering::Relaxed) { 0 } else { return; }; ... let written = library_written .and_then(|()| write_atomically(&dir.join(EARLY_FILE), used.join("\n").as_bytes())); ``` `USED_CHANGED` is cleared before `write_atomically`. If that write fails (a directory at `early-pipelines.txt`, a full disk, a transient lock), the dirty bit is already gone, so a later `save(true)` returns without writing the list until another pipeline key arrives. That is the retry gap both reports reproduced; the same applies to the library branch, whose `serialise` failure path also returns after the swap. Please clear the flag only after a successful write, or restore it when `written` is `Err` (and when `serialise` fails), and add the regression test with an obstructed early-list path that @Filip722 linked (`6ca01748`). The rest of the PR is unchanged and the early-list behavior itself is still correct.
ErRusso commented 2026-11-25 15:27:33 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by ErRusso on 2026-11-25T15:27:33Z.

Review: APPROVED


Tested the current head (9baa3ac) merged onto 0b0074e on the Wine-only path: no host pipeline library, so this PR's new branch is the one exercised.

Unit tests (counter Arch/Wine 11.22, RTX 4060, MSVC build, VICTORY_DXC set):

  • pipeline:: tests: 13 passed, 0 failed, including the_early_list_is_saved_with_or_without_a_library; three parallel runs identical.
  • Full victory-gpu --lib: 183 passed, 4 failed. The four are the base's environmental failures under Wine: profile::tests::deep_stacks_are_cut_not_lost, the_sampler_finds_threads_and_writes_its_files, time_goes_to_the_function_that_spent_it, and drvwatch::tests::the_system_takes_the_subscription (no event-log subscription). No new failures from this PR.

Runtime (Proton Experimental experimental-11.0-20261112, vkd3d-proton, fresh cache, VICTORY_CACHE_DIR, no scripted input):

  • First launch: early-pipelines.txt written, 35,078 bytes. Save line: bytes=0 early=1063 made=382 loaded=0 started_early=0. Before this PR the no-library path wrote nothing.
  • Second launch on that cache: title pipelines to start early pipelines=1063; 835 pipelines were being made 5 s in and 750 at 10 s, with 0 draws dropped waiting for a pipeline. 246 were still being made at 150 s.
  • Third launch (300 s): saves show bytes=0 early=1191...1292 made=... loaded=0 started_early=1067 — 1,067 pipelines started at creation from the list. loaded=0 confirms the host library path is still absent here, as expected.

Retry fix: the directory-obstruction regression passes; the dirty flag is restored on write failure and the retry writes the original key without a new note_used().

Out of scope and confirmed unchanged: Marvisak/VIctory#347's null empty-blob argument; library creation still fails under this vkd3d-proton. Approved for the list-saving fix.

<!-- greyfinch-sync:fxceless/victory-fork:review:6060486635 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/259#pullrequestreview-6060486635). Originally posted by [ErRusso](https://github.com/ErRusso) on 2026-11-25T15:27:33Z. **Review:** APPROVED --- Tested the current head (`9baa3ac`) merged onto `0b0074e` on the Wine-only path: no host pipeline library, so this PR's new branch is the one exercised. **Unit tests** (counter Arch/Wine 11.22, RTX 4060, MSVC build, `VICTORY_DXC` set): - `pipeline::` tests: 13 passed, 0 failed, including `the_early_list_is_saved_with_or_without_a_library`; three parallel runs identical. - Full `victory-gpu --lib`: 183 passed, 4 failed. The four are the base's environmental failures under Wine: `profile::tests::deep_stacks_are_cut_not_lost`, `the_sampler_finds_threads_and_writes_its_files`, `time_goes_to_the_function_that_spent_it`, and `drvwatch::tests::the_system_takes_the_subscription` (no event-log subscription). No new failures from this PR. **Runtime** (Proton Experimental `experimental-11.0-20261112`, vkd3d-proton, fresh cache, `VICTORY_CACHE_DIR`, no scripted input): - First launch: `early-pipelines.txt` written, 35,078 bytes. Save line: `bytes=0 early=1063 made=382 loaded=0 started_early=0`. Before this PR the no-library path wrote nothing. - Second launch on that cache: `title pipelines to start early pipelines=1063`; 835 pipelines were being made 5 s in and 750 at 10 s, with **0 draws dropped** waiting for a pipeline. 246 were still being made at 150 s. - Third launch (300 s): saves show `bytes=0 early=1191...1292 made=... loaded=0 started_early=1067` — 1,067 pipelines started at creation from the list. `loaded=0` confirms the host library path is still absent here, as expected. **Retry fix:** the directory-obstruction regression passes; the dirty flag is restored on write failure and the retry writes the original key without a new `note_used()`. Out of scope and confirmed unchanged: Marvisak/VIctory#347's null empty-blob argument; library creation still fails under this vkd3d-proton. Approved for the list-saving fix.
Ortomanic commented 2026-11-25 16:12:50 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Ortomanic on 2026-11-25T15:11:06Z.


Thanks @avt0m4t48, @Filip722 and @ErRusso. The retry gap is fixed on this branch.

  • Fix: 9baa3ac is a cherry-pick of @Filip722's 6ca0174 (authorship kept). The dirty flag is now taken together with the key snapshot, after the library branch, and set again when the write fails. A failed serialise returns before the flag is taken, so that path keeps it too, which covers the second case in the review.
  • Regression test: the same commit changes the_early_list_is_saved_with_or_without_a_library to put a directory at early-pipelines.txt, save, remove it and save again without another note_used().
    • Under Wine 11.22: passes, with the other pipeline:: tests (11 on the branch, 12 on the tree merged with 0b0074e).
    • With the restore line taken out it fails at the second read, so the test does guard the fix.
  • Current main: merges cleanly with 0b0074e; cargo test -p victory-shader -p xtask passes on the merged tree. Clippy with -D warnings passes on the branch in both feature sets; on the merged tree it fails only with the errors 0b0074e has on its own (#982, #841).

Not done here: the null empty-blob argument from Marvisak/VIctory#347 that @Filip722 tested alongside. That makes the library itself work under vkd3d-proton, which is a larger change than this PR's "save the list when there is no library"; I would rather it went in on its own. The head was not rebased.

AI-assisted (Claude Code); built and tested locally on CachyOS, Wine 11.22, RTX 5080.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7166437407 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/259#issuecomment-7166437407). Originally posted by [Ortomanic](https://github.com/Ortomanic) on 2026-11-25T15:11:06Z. --- Thanks @avt0m4t48, @Filip722 and @ErRusso. The retry gap is fixed on this branch. - **Fix:** `9baa3ac` is a cherry-pick of @Filip722's `6ca0174` (authorship kept). The dirty flag is now taken together with the key snapshot, after the library branch, and set again when the write fails. A failed `serialise` returns before the flag is taken, so that path keeps it too, which covers the second case in the review. - **Regression test:** the same commit changes `the_early_list_is_saved_with_or_without_a_library` to put a directory at `early-pipelines.txt`, save, remove it and save again without another `note_used()`. - Under Wine 11.22: passes, with the other `pipeline::` tests (11 on the branch, 12 on the tree merged with `0b0074e`). - With the restore line taken out it fails at the second read, so the test does guard the fix. - **Current main:** merges cleanly with `0b0074e`; `cargo test -p victory-shader -p xtask` passes on the merged tree. Clippy with `-D warnings` passes on the branch in both feature sets; on the merged tree it fails only with the errors `0b0074e` has on its own (#982, #841). Not done here: the null empty-blob argument from Marvisak/VIctory#347 that @Filip722 tested alongside. That makes the library itself work under vkd3d-proton, which is a larger change than this PR's "save the list when there is no library"; I would rather it went in on its own. The head was not rebased. AI-assisted (Claude Code); built and tested locally on CachyOS, Wine 11.22, RTX 5080.
Filip722 commented 2026-11-27 10:52:22 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Filip722 on 2026-11-27T10:52:22Z.


The retry case on the current head is covered by the existing fixture. I checked a separate case where the native cache was serialized but neither its main path nor its fallback path could accept the rename. The early list path was writable. On a test-only build of this PR, the native error was returned correctly, but the early list still held its old contents.

The source-only follow-up below attempts the early-list write even when native publication fails. The native error still propagates and an empty snapshot preserves the existing list on that failure path. The new fixture uses real filesystem renames. It failed on the test-only control and passed with this change. The existing early-list write-retry fixture also passed. Both ran as Windows MSVC tests under GE-Proton11-14 on Bazzite 44. Asset policy passed for 169 files.

Follow-up on top of this PR · Fix commit

Assisted by Codex (GPT-6.2-Sol High).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7216407441 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/259#issuecomment-7216407441). Originally posted by [Filip722](https://github.com/Filip722) on 2026-11-27T10:52:22Z. --- The retry case on the current head is covered by the existing fixture. I checked a separate case where the native cache was serialized but neither its main path nor its fallback path could accept the rename. The early list path was writable. On a test-only build of this PR, the native error was returned correctly, but the early list still held its old contents. The source-only follow-up below attempts the early-list write even when native publication fails. The native error still propagates and an empty snapshot preserves the existing list on that failure path. The new fixture uses real filesystem renames. It failed on the test-only control and passed with this change. The existing early-list write-retry fixture also passed. Both ran as Windows MSVC tests under GE-Proton11-14 on Bazzite 44. Asset policy passed for 169 files. [Follow-up on top of this PR](https://github.com/Filip722/victory-fork/compare/9baa3ac42681f362da5de2232c1b90aff4647b11...review/259-early-native-publish) · [Fix commit](https://github.com/Filip722/victory-fork/commit/2308653bdeaeaa68aaaefd027a6416eeddf9d04d) Assisted by Codex (GPT-6.2-Sol High).
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/259:upstream-pr/259'
git switch 'upstream-pr/259'

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/259'
git switch 'upstream-pr/259'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/259'
git switch 'upstream-pr/259'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/259'
git switch 'main'
git merge --squash 'upstream-pr/259'
git switch 'main'
git merge --ff-only 'upstream-pr/259'
git switch 'main'
git merge 'upstream-pr/259'
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
fxceless/victory-fork!259
No description provided.