GPU: a pipeline library save the host has no memory for waits, not aborts (1.7 GB library on NVIDIA) #2005
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2007"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by KevinPratap on 2026-11-25T02:48:41Z.
Problem
library::saveserialises the pipeline library withvec![0u8; GetSerializedSize()]. On NVIDIA the library holds each pipeline's machine code: aftertranslate --cache --pipelinesit is about 1.7 GB on an RTX 4050 Laptop, where the README mentions about 4 MB on AMD. A save in the world then aborted the whole process:(32 GB RAM, about 21 GB committed by the process at that point.)
Fix
The buffer is reserved with
try_reserve_exact. Without memory, the save logs a warning and returns. The pipelines stay counted as added, so the next save tries again.Verified
a_save_buffer_the_host_cannot_give_is_refused; thepipeline::librarytests pass (9).cargo clippy -p victory-gpu --all-targets -- -D warningsis clean.Related: the size itself (one blob rewritten whole every 20 s) is worth splitting on NVIDIA, but that is a larger change.
Only
crates/victory-gpu/src/pipeline/library.rschanges.AI-assisted.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T03:33:10Z.
Review: COMMENTED
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Pipeline-library save with insufficient host memory waits instead of aborting — OOM-path hardening; correct fail-slow behavior for an emulator.
Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-25T03:35:51Z.
Triage verdict — Keep the fallible allocation; preserve early-list retries (
54b994d)Evidence
l.addedintact is insufficient. Whenl.added == 0,prebuilt_changedis false, and the early list alone is dirty, the entry check consumesUSED_CHANGEDwithswap(false, …)before callingzeroed. The new failure return leaves no dirty flag for a later retry. The existing serializer-error path has the same bookkeeping gap.Checks and limits
savewith only the early list dirty. The exact-head Windows check passed. I reviewed the source and CI without inducing host memory pressure.Next step
This verification was AI-assisted.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T09:16:55Z.
Automated triage for the maintainers.
Merge candidate.
crates/victory-gpu/src/pipeline/library.rs::savenow allocates the serialisation buffer withtry_reserve_exact(new helperzeroed) instead ofvec[0u8; GetSerializedSize()], so a library too large for the host's free memory logs a warning and is retried on a later save instead of aborting the process.l.added/prebuilt_changedare left untouched on that path, so the retry does happen; on Windows the allocator reports failure rather than overcommitting, sotry_reserve_exactis the right tool here. Small, focused, merges cleanly.Optional follow-up, also raised in the earlier review comment: when only the early list is dirty,
USED_CHANGEDhas already been swapped tofalsebefore the allocation, so a failed allocation (like the existing serialiser-error path) drops that pending early-list save until something else changes; restoring the flag on both failure returns would close that. #2129 contains the same fallible helper inside a much larger rework of the library file; this PR is the smaller way to land just the abort fix. Recommending a look, not approving.CI: passing (
check).Generated by Claude Code
upstream-sync referenced this pull request2026-11-25 14:07:22 +00:00