fix: a host pipeline library another setup rejects is kept beside the new one #392

Manually merged
github merged 2 commits from github-bot/gh-392 into main 2026-11-26 17:52:23 +00:00 AGit
Owner

@⁠Skyfrye on GitHub · 2026-11-26 15:42 UTC · original
Skyfrye:nep/pipeline-library-slots → main · +240 −33 · 1 files · 2 commits · merged 2026-11-26 17:51 UTC

Change

A host pipeline library that the host rejects is no longer replaced by an empty one. It is kept beside the new library as host-pipelines.other. The next start of the setup it belongs to loads it from there.

Why: two setups of the host on one machine, sharing the cache folder, rejected each other's library:

  • Diagnostics builds export D3D12SDKVersion/D3D12SDKPath (apps/victory/src/main.rs), so with a D3D12\ folder beside the executable they run on the redistributable D3D12 runtime (1.620).
  • Release builds run on the system's.
  • Loading a release build's library, the diagnostics build said "The blob provided was created for a different version of the driver, and must be re-created". The other way round: "The parameter is incorrect. (0x80070057)".
  • Same adapter, same driver. A release build with a D3D12\ folder beside it (nothing exported) loaded the library as usual.

With one file:

  • each start after the other setup's began with an empty library;
  • its first save, 20 s later, replaced the other setup's library;
  • the opening cutscene then made every pipeline anew.

In the runs of the title this fork works on, where diagnostics and release runs took turns, 10 of the last 40 starts on one day began empty this way. The worst: 1,750 to 2,700 pipelines being made and 0.1 to 1.5 fps for over two minutes of the opening cutscene. A run of the same build with its library loaded did not wait for pipelines there. The library lost was 703 MB.

What the change does (pipeline/library.rs, open_dir):

  • The library's file is tried first, as before.
  • If the host rejects it, host-pipelines.other is tried. When the host takes that one, the two files swap names: this run's saves replace its own library, and the rejected one stays for its setup.
  • When the host takes neither, the rejected library becomes host-pipelines.other, in place of an older one that this setup rejected too. This run's first save makes a new library file.
  • The cost is a second library file on disk, as large as the first, for a machine with two such setups.

VICTORY_LIBRARY_OTHER=0 keeps one file, as before.

Linked issue: none.

Verification

Windows 11 26300, Rust 1.98.1 (MSVC), RTX 5080, on upstream main at 84aa3c3 (rebased onto 8473267; no file of this PR changed in between), from third_party/victory:

cargo build --locked --release -p victory                                      -> Finished; the 2 warnings main has, no new one
VICTORY_D3D12_WARP=1 cargo test --locked -p victory-gpu --lib pipeline::library -> 6 passed

New tests:

  • setups_taking_turns_keep_each_others_library covers:

    • no file yet;
    • a setup's own library loading;
    • a second setup that takes neither file, which keeps the first one's;
    • the two taking turns, with the files swapping names each time;
    • a third setup, which keeps the most recent;
    • a setup whose library is only in the other file.

    The loader holds the mapped file open while the files are renamed, as the host's library does.

  • one_file_without_the_other covers VICTORY_LIBRARY_OTHER=0: the rejected file stays where it is, and the other file is not looked at.

Neither test builds without the change.

In the world, my copy of the game, Series X, release build of this PR on main at 84aa3c3, with #354, #381 and #382 stacked:

  • Before the start, the library's file (276,372,298 bytes, saved by a release run) was renamed to host-pipelines.other, and 64 KiB of X was put in its place.
  • The log:
    host pipeline library loaded bytes=276372298 mapped=true
    host pipeline library of this setup loaded from the other setup's file; the two files swapped names error="The parameter is incorrect. (0x80070057)"
    host pipeline library saved bytes=276377300 early=3544 made=1 loaded=3109 started_early=3110
    
  • Afterwards host-pipelines.bin held the 276 MB library, and host-pipelines.other held the 64 KiB.
  • The opening cutscene loaded 3,109 pipelines from the library and made 1.
  • I did not repeat this with a diagnostics build and its D3D12\ runtime. The unit test covers two setups taking turns.

Oracle and test data

No game file. The figures come from the logs of my own runs of my copy of the game.

Checklist

  • The PR covers a single reviewable behaviour: a rejected host pipeline library is kept for its setup instead of being replaced.
  • A test fails without this change and passes with it (the tests do not build without it).
  • The commands and results of each check are given above.
  • An unimplemented function returns an error (E_NOTIMPL), never a fake success. (Nothing unimplemented here.)
  • README: not touched.
  • No game, console or SDK file, no key, no dump, no download link.
  • Findings drawn from a title: pipeline counts and frame rates from run logs; no title code.
  • Code taken from another project: none.

AI assistance: written with Claude Code (Claude Opus 5.5): finding the cause in the run logs, the change, its tests, the game run and this description.

🤖 Generated with Claude Code

**@⁠Skyfrye** on GitHub · 2026-11-26 15:42 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/392) `Skyfrye:nep/pipeline-library-slots` → `main` · +240 −33 · 1 files · 2 commits · merged 2026-11-26 17:51 UTC ## Change A host pipeline library that the host rejects is no longer replaced by an empty one. It is kept beside the new library as `host-pipelines.other`. The next start of the setup it belongs to loads it from there. Why: two setups of the host on one machine, sharing the cache folder, rejected each other's library: - Diagnostics builds export `D3D12SDKVersion`/`D3D12SDKPath` (`apps/victory/src/main.rs`), so with a `D3D12\` folder beside the executable they run on the redistributable D3D12 runtime (1.620). - Release builds run on the system's. - Loading a release build's library, the diagnostics build said "The blob provided was created for a different version of the driver, and must be re-created". The other way round: "The parameter is incorrect. (0x80070057)". - Same adapter, same driver. A release build with a `D3D12\` folder beside it (nothing exported) loaded the library as usual. With one file: - each start after the other setup's began with an empty library; - its first save, 20 s later, replaced the other setup's library; - the opening cutscene then made every pipeline anew. In the runs of the title this fork works on, where diagnostics and release runs took turns, 10 of the last 40 starts on one day began empty this way. The worst: 1,750 to 2,700 pipelines being made and 0.1 to 1.5 fps for over two minutes of the opening cutscene. A run of the same build with its library loaded did not wait for pipelines there. The library lost was 703 MB. What the change does (`pipeline/library.rs`, `open_dir`): - The library's file is tried first, as before. - If the host rejects it, `host-pipelines.other` is tried. When the host takes that one, the two files swap names: this run's saves replace its own library, and the rejected one stays for its setup. - When the host takes neither, the rejected library becomes `host-pipelines.other`, in place of an older one that this setup rejected too. This run's first save makes a new library file. - The cost is a second library file on disk, as large as the first, for a machine with two such setups. `VICTORY_LIBRARY_OTHER=0` keeps one file, as before. Linked issue: none. ## Verification Windows 11 26300, Rust 1.98.1 (MSVC), RTX 5080, on upstream `main` at `84aa3c3` (rebased onto `8473267`; no file of this PR changed in between), from `third_party/victory`: ``` cargo build --locked --release -p victory -> Finished; the 2 warnings main has, no new one VICTORY_D3D12_WARP=1 cargo test --locked -p victory-gpu --lib pipeline::library -> 6 passed ``` New tests: - `setups_taking_turns_keep_each_others_library` covers: - no file yet; - a setup's own library loading; - a second setup that takes neither file, which keeps the first one's; - the two taking turns, with the files swapping names each time; - a third setup, which keeps the most recent; - a setup whose library is only in the other file. The loader holds the mapped file open while the files are renamed, as the host's library does. - `one_file_without_the_other` covers `VICTORY_LIBRARY_OTHER=0`: the rejected file stays where it is, and the other file is not looked at. Neither test builds without the change. In the world, my copy of the game, Series X, release build of this PR on `main` at `84aa3c3`, with #354, #381 and #382 stacked: - Before the start, the library's file (276,372,298 bytes, saved by a release run) was renamed to `host-pipelines.other`, and 64 KiB of `X` was put in its place. - The log: ``` host pipeline library loaded bytes=276372298 mapped=true host pipeline library of this setup loaded from the other setup's file; the two files swapped names error="The parameter is incorrect. (0x80070057)" host pipeline library saved bytes=276377300 early=3544 made=1 loaded=3109 started_early=3110 ``` - Afterwards `host-pipelines.bin` held the 276 MB library, and `host-pipelines.other` held the 64 KiB. - The opening cutscene loaded 3,109 pipelines from the library and made 1. - I did not repeat this with a diagnostics build and its `D3D12\` runtime. The unit test covers two setups taking turns. ## Oracle and test data No game file. The figures come from the logs of my own runs of my copy of the game. ## Checklist - [x] The PR covers a single reviewable behaviour: a rejected host pipeline library is kept for its setup instead of being replaced. - [x] A test fails without this change and passes with it (the tests do not build without it). - [x] The commands and results of each check are given above. - [x] An unimplemented function returns an error (`E_NOTIMPL`), never a fake success. (Nothing unimplemented here.) - [x] README: not touched. - [x] No game, console or SDK file, no key, no dump, no download link. - [x] Findings drawn from a title: pipeline counts and frame rates from run logs; no title code. - [x] Code taken from another project: none. AI assistance: written with Claude Code (Claude Opus 5.5): finding the cause in the run logs, the change, its tests, the game run and this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Two setups of the host sharing the cache folder rejected each other's
library ("created for a different version of the driver" one way, "the
parameter is incorrect" the other). Each start after the other setup's
began empty, and its first save replaced the other's library: the
opening cutscene then made every pipeline anew.

The rejected library's file now becomes host-pipelines.other. A start
whose library is rejected tries that file, and when the host takes it
the two files swap names. VICTORY_LIBRARY_OTHER=0 keeps one file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 15:44:27 +00:00
Author
Owner

@⁠Lewandox on GitHub · 2026-11-26 16:42 UTC · original · reviewed

Reviewed third_party/victory/crates/victory-gpu/src/pipeline/library.rs:

  • Overall design is very clean: Blob::at, VICTORY_LIBRARY_OTHER=0 opt-out, dropping the rejected Blob before renaming, and the two unit tests (setups_taking_turns_keep_each_others_library and one_file_without_the_other) cover the happy paths well.
  • One small edge case in the 3-step swap (open_dir):
    std::fs::rename(&path, &swap)
        .and_then(|()| std::fs::rename(&other_path, &path))
        .and_then(|()| std::fs::rename(&swap, &other_path))
    
    If step 2 (rename(&other_path, &path)) fails (e.g. transient AV/Wine lock on the mapped other_path), path has already been moved to host-pipelines.swap and isn't restored, leaving host-pipelines.swap stranded (and unlike NEXT_FILE in Blob::of, a leftover SWAP_FILE after a failed swap or mid-swap crash isn't recovered on the next start). Restoring rename(&swap, &path) on step-2 error (or recovering a leftover SWAP_FILE in open_dir when OTHER_FILE is missing) would make the swap resilient to partial failure.

Not a blocker for the normal case — CI is 4/4 green and the logic looks solid.

**@⁠Lewandox** on GitHub · 2026-11-26 16:42 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/392#pullrequestreview-6077729102) · **reviewed** Reviewed `third_party/victory/crates/victory-gpu/src/pipeline/library.rs`: - Overall design is very clean: `Blob::at`, `VICTORY_LIBRARY_OTHER=0` opt-out, dropping the rejected `Blob` before renaming, and the two unit tests (`setups_taking_turns_keep_each_others_library` and `one_file_without_the_other`) cover the happy paths well. - One small edge case in the 3-step swap (`open_dir`): ```rust std::fs::rename(&path, &swap) .and_then(|()| std::fs::rename(&other_path, &path)) .and_then(|()| std::fs::rename(&swap, &other_path)) ``` If step 2 (`rename(&other_path, &path)`) fails (e.g. transient AV/Wine lock on the mapped `other_path`), `path` has already been moved to `host-pipelines.swap` and isn't restored, leaving `host-pipelines.swap` stranded (and unlike `NEXT_FILE` in `Blob::of`, a leftover `SWAP_FILE` after a failed swap or mid-swap crash isn't recovered on the next start). Restoring `rename(&swap, &path)` on step-2 error (or recovering a leftover `SWAP_FILE` in `open_dir` when `OTHER_FILE` is missing) would make the swap resilient to partial failure. Not a blocker for the normal case — CI is 4/4 green and the logic looks solid.
github manually merged commit ba9437fb88 into main 2026-11-26 17:52:23 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.