GPU: a pipeline library save with no memory for its buffer waits, not aborts (port of upstream #2007) #1326

Closed
github-bot wants to merge 1 commit from github-bot/gh-1326 into main AGit
Owner

@⁠CwWwWwW on GitHub · 2026-11-26 15:30 UTC · original
CwWwWwW:port/library-save-oom → main · +23 −1 · 1 files · 1 commits · closed without merging

Problem

When the pipeline library's file cannot be mapped - the file system refuses the mapping, or VICTORY_LIBRARY_MAP=0 - library::serialise falls back to an infallible vec![0u8; size]. The serialised library is about 1.7 GB on NVIDIA (each pipeline's machine code), and an allocation of that size the host cannot give aborts the whole process mid-run: upstream saw memory allocation of 2650101862 bytes failed on an RTX 4050 Laptop.

Upstream VIctory fixed this in commit 321a4bc (pull request #2007, by Kevin); this is that fix ported to the fork, which keeps the mapped path and the fallback the upstream change targets.

Change

  • A new zeroed(n) -> Option<Vec<u8>> allocates with try_reserve_exact; no memory returns None and serialise returns an error instead of aborting.
  • save logs it and leaves the save for a later one (the pipelines stay counted as added, so a later save retries); the run continues.
  • The mapped path is untouched.

Tests

  • New a_save_buffer_the_host_cannot_give_is_refused: a size the host cannot give is None, 100 bytes are zeros.
  • cargo test -p victory-gpu --lib --locked: 218 passed, 0 failed, 6 ignored.
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: clean.
  • No game or GPU needed for the test. The 1.7 GB allocation itself cannot be reproduced here (it depends on the host's memory); the path is a pure allocation helper.

(CI note: the check job on main is currently red on the asset-policy violation; #1322 fixes that, after which this can be rebased.)

**@⁠CwWwWwW** on GitHub · 2026-11-26 15:30 UTC · [original](https://github.com/fxceless/victory-fork/pull/1326) `CwWwWwW:port/library-save-oom` → `main` · +23 −1 · 1 files · 1 commits · closed without merging ## Problem When the pipeline library's file cannot be mapped - the file system refuses the mapping, or `VICTORY_LIBRARY_MAP=0` - `library::serialise` falls back to an infallible `vec![0u8; size]`. The serialised library is about 1.7 GB on NVIDIA (each pipeline's machine code), and an allocation of that size the host cannot give **aborts the whole process** mid-run: upstream saw `memory allocation of 2650101862 bytes failed` on an RTX 4050 Laptop. Upstream VIctory fixed this in [commit 321a4bc](https://github.com/Marvisak/VIctory/commit/321a4bc) (pull request #2007, by **Kevin**); this is that fix ported to the fork, which keeps the mapped path and the fallback the upstream change targets. ## Change - A new `zeroed(n) -> Option<Vec<u8>>` allocates with `try_reserve_exact`; no memory returns `None` and `serialise` returns an error instead of aborting. - `save` logs it and leaves the save for a later one (the pipelines stay counted as added, so a later save retries); the run continues. - The mapped path is untouched. ## Tests - New `a_save_buffer_the_host_cannot_give_is_refused`: a size the host cannot give is `None`, 100 bytes are zeros. - `cargo test -p victory-gpu --lib --locked`: **218 passed, 0 failed, 6 ignored**. - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings`: clean. - No game or GPU needed for the test. The 1.7 GB allocation itself cannot be reproduced here (it depends on the host's memory); the path is a pure allocation helper. (CI note: the `check` job on main is currently red on the asset-policy violation; #1322 fixes that, after which this can be rebased.)
Ported from upstream VIctory commit 321a4bc (pull request #2007, Kevin):
the save path that cannot map the library's file (the file cannot be
mapped, or VICTORY_LIBRARY_MAP=0) made an infallible vec![0u8; size].
The library is about 1.7 GB on NVIDIA (each pipeline's machine code), and
an allocation of that size the host cannot give aborted the whole process
mid-run ("memory allocation of 2650101862 bytes failed", RTX 4050
Laptop). The buffer now comes from try_reserve_exact; no memory leaves
the save for a later one (the pipelines stay counted as added) and the
run goes on.

The mapped path is unchanged; only the fallback buffer is.

Test: a_save_buffer_the_host_cannot_give_is_refused (a size the host
cannot give is refused, 100 bytes are zeros).

cargo test -p victory-gpu --lib: 218 passed, 0 failed, 6 ignored;
cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 15:35:18 +00:00
github-bot closed this pull request 2026-11-26 15:52:07 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.