GPU: save early pipeline list without re-serialising the library #3181

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

@⁠fuzeofficlal on GitHub · 2026-11-26 11:21 UTC · original
fuzeofficlal:fix/gpu-early-pipeline-save-no-serialize → main · +148 −28 · 1 files · 1 commits · open

Summary

pipeline::library::save previously checked l.added == 0 && !l.prebuilt_changed && !USED_CHANGED.swap(false, Ordering::Relaxed) under library.state, and then unconditionally called GetSerializedSize(), allocated a buffer, called ID3D12PipelineLibrary1::Serialize(), and rewrote host-pipelines.bin even when added == 0 and only early-pipelines.txt (USED_CHANGED) had changed. In addition, if zeroed(size) or Serialize() failed and returned early, USED_CHANGED had already been cleared so the early-pipelines.txt update was lost.

Fix

  • Check l.added > 0 || l.prebuilt_changed and release library.state before calling a helper save_files.
  • Handle USED_CHANGED independently by writing early-pipelines.txt without serializing or rewriting host-pipelines.bin when the library itself has no new pipelines; restore USED_CHANGED = true if creating the directory or writing early-pipelines.txt fails so a later save retries.
  • Only lock and serialize the host pipeline library when library_changed is true, keeping early-pipelines.txt intact even if serialization fails or runs out of memory.

Verification

Added three deterministic unit tests in crates/victory-gpu/src/pipeline/library.rs:

  • saving_only_the_early_list_skips_the_library
  • saving_the_early_list_survives_failed_serialization
  • saving_the_early_list_retries_after_an_io_error

Ran:

  • cargo test --locked -p victory-gpu pipeline::library -- --test-threads=1: 14 passed, 0 failed
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings (default and --no-default-features): clean
  • cargo test -p xtask --locked policy::tests::repository_passes_policy: passed
**@⁠fuzeofficlal** on GitHub · 2026-11-26 11:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/3181) `fuzeofficlal:fix/gpu-early-pipeline-save-no-serialize` → `main` · +148 −28 · 1 files · 1 commits · open ### Summary `pipeline::library::save` previously checked `l.added == 0 && !l.prebuilt_changed && !USED_CHANGED.swap(false, Ordering::Relaxed)` under `library.state`, and then unconditionally called `GetSerializedSize()`, allocated a buffer, called `ID3D12PipelineLibrary1::Serialize()`, and rewrote `host-pipelines.bin` even when `added == 0` and only `early-pipelines.txt` (`USED_CHANGED`) had changed. In addition, if `zeroed(size)` or `Serialize()` failed and returned early, `USED_CHANGED` had already been cleared so the `early-pipelines.txt` update was lost. ### Fix - Check `l.added > 0 || l.prebuilt_changed` and release `library.state` before calling a helper `save_files`. - Handle `USED_CHANGED` independently by writing `early-pipelines.txt` without serializing or rewriting `host-pipelines.bin` when the library itself has no new pipelines; restore `USED_CHANGED = true` if creating the directory or writing `early-pipelines.txt` fails so a later save retries. - Only lock and serialize the host pipeline library when `library_changed` is true, keeping `early-pipelines.txt` intact even if serialization fails or runs out of memory. ### Verification Added three deterministic unit tests in `crates/victory-gpu/src/pipeline/library.rs`: - `saving_only_the_early_list_skips_the_library` - `saving_the_early_list_survives_failed_serialization` - `saving_the_early_list_retries_after_an_io_error` Ran: - `cargo test --locked -p victory-gpu pipeline::library -- --test-threads=1`: 14 passed, 0 failed - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` (default and `--no-default-features`): clean - `cargo test -p xtask --locked policy::tests::repository_passes_policy`: passed
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:33:01 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 11:26 UTC · original · approved these changes

Verified on RTX 5090 against origin/main (63bcca4):

  • cargo test -p victory-gpu --lib pipeline::library:: -- --test-threads=1: 14/14 passed (including saving_only_the_early_list_skips_the_library, saving_the_early_list_retries_after_an_io_error, and saving_the_early_list_survives_failed_serialization).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Cleanly saves the early pipeline list independently without re-serializing the full pipeline library.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 11:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/3181#pullrequestreview-6073343889) · **approved these changes** Verified on RTX 5090 against `origin/main` (`63bcca4`): - `cargo test -p victory-gpu --lib pipeline::library:: -- --test-threads=1`: 14/14 passed (including `saving_only_the_early_list_skips_the_library`, `saving_the_early_list_retries_after_an_io_error`, and `saving_the_early_list_survives_failed_serialization`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Cleanly saves the early pipeline list independently without re-serializing the full pipeline library. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 12:05 UTC · original

Confirmed 8a216f5 across fresh processes on the RTX 5080 and Windows inbox WARP. An early-list-only save left the compiled binary untouched on both. When I held the early list open during a full save and released it before the retry, the next process recognized all 3/3 prebuilt keys, loaded all three PSOs from the disk cache and read back 96/96 correct words. Repeated twice per adapter.

Writing the early list independently makes a measurable difference here: the overlapping #3188 head loses all three prebuilt keys under the same one-time sharing violation. Four-revision comparison and reusable restart test

**@⁠steven-seagull27** on GitHub · 2026-11-26 12:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/3181#issuecomment-7191544345) Confirmed `8a216f5` across fresh processes on the RTX 5080 and Windows inbox WARP. An early-list-only save left the compiled binary untouched on both. When I held the early list open during a full save and released it before the retry, the next process recognized all **3/3 prebuilt keys**, loaded all three PSOs from the disk cache and read back **96/96 correct words**. Repeated twice per adapter. Writing the early list independently makes a measurable difference here: the overlapping #3188 head loses all three prebuilt keys under the same one-time sharing violation. [Four-revision comparison and reusable restart test](https://git.gtahub.st/github/Marvisak--VIctory/pulls/3188)
This pull request can be merged automatically.
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/3181/head:github-bot/gh-3181'
git switch 'github-bot/gh-3181'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3181'
git switch 'github-bot/gh-3181'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3181'
git switch 'github-bot/gh-3181'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3181'
git switch 'main'
git merge --squash 'github-bot/gh-3181'
git switch 'main'
git merge --ff-only 'github-bot/gh-3181'
git switch 'main'
git merge 'github-bot/gh-3181'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3181
No description provided.