Skip to content

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

Closed
CwWwWwW wants to merge 1 commit into
fxceless:mainfrom
CwWwWwW:port/library-save-oom
Closed

CwWwWwW wants to merge 1 commit into
fxceless:mainfrom
CwWwWwW:port/library-save-oom

Conversation

@CwWwWwW

@CwWwWwW CwWwWwW commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

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.)

… aborts (upstream #2007)

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.
@CwWwWwW CwWwWwW closed this Nov 26, 2026
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.

1 participant