GPU: a small allocation failure no longer ends the title #1624

Manually merged
github merged 1 commit from github-bot/gh-1624 into main 2026-11-29 08:21:54 +00:00 AGit
Owner

@⁠mizzied on GitHub · 2026-11-28 22:34 UTC · original
mizzied:up/fetch-stepdown → main · +235 −16 · 3 files · 1 commits · merged 2026-11-29 08:16 UTC

What was wrong. A failed 16 MiB allocation for a fetch buffer ended the title, even when the PC was only briefly short of memory.

The fix.

  • The relay and card-back fetch buffers step down to a smaller size and retry once. If that fails too, the fetch is skipped and NO MEMORY TO FETCH is logged, and the title goes on.
  • A read-back buffer is retried once.
  • VICTORY_FETCH_STEPDOWN=0 restores the old behaviour.

Related open PRs #1472 (retry texture staging smaller) and #625 cover nearby allocations, but not the fetch buffers.

How it was tested. RTX 5070, Windows 11. There are five tests in fetchmem.rs covering the step-down sizes, the single retry, the skip and the switch. cargo test --workspace passes apart from repository_passes_policy, which already fails on main: lower.rs is over the 640 KiB file-size limit there (#1493 raises it). Clippy reports only the 16 findings already on main, none on lines this PR changes. The victory-gpu watch:: tests are flaky on this machine in files this PR does not touch, and pass on a rerun.

**@⁠mizzied** on GitHub · 2026-11-28 22:34 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1624) `mizzied:up/fetch-stepdown` → `main` · +235 −16 · 3 files · 1 commits · merged 2026-11-29 08:16 UTC **What was wrong.** A failed 16 MiB allocation for a fetch buffer ended the title, even when the PC was only briefly short of memory. **The fix.** - The relay and card-back fetch buffers step down to a smaller size and retry once. If that fails too, the fetch is skipped and `NO MEMORY TO FETCH` is logged, and the title goes on. - A read-back buffer is retried once. - `VICTORY_FETCH_STEPDOWN=0` restores the old behaviour. Related open PRs #1472 (retry texture staging smaller) and #625 cover nearby allocations, but not the fetch buffers. **How it was tested.** RTX 5070, Windows 11. There are five tests in `fetchmem.rs` covering the step-down sizes, the single retry, the skip and the switch. `cargo test --workspace` passes apart from `repository_passes_policy`, which already fails on `main`: `lower.rs` is over the 640 KiB file-size limit there (#1493 raises it). Clippy reports only the 16 findings already on `main`, none on lines this PR changes. The `victory-gpu` `watch::` tests are flaky on this machine in files this PR does not touch, and pass on a rerun.
The relay's fetch buffer and the card-back fetch buffer were made 16 MiB at
a time, and where the system refused that the layer ended the run through
host::fail ("no memory to fetch what shaders wrote to the card's memory"),
though the PC had room for the few megabytes a fetch needs.

Both now step down (16 MiB rounded, 1 MiB, the least the bytes allow; not
the first while host memory pressure is on), try the least once more after a
moment, and if none can be made the fetch is skipped, counted and logged
loudly (NO MEMORY TO FETCH): the pieces stay as they were in title memory
until a later fetch of them. A read-back buffer is retried once the same
way. VICTORY_FETCH_STEPDOWN=0 restores the single 16 MiB try and the fatal
failure.

Tests (fetchmem.rs): the step-down sizes, the pressure case, the retry of
the least, and the count of skipped fetches.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 22:35:39 +00:00
Author
Owner

@⁠babuakhil on GitHub · 2026-11-28 23:14 UTC · original

Second machine for this: Windows 11, RTX 3060, Ryzen 7 5700X, Rust 1.98.1 (pinned), applied on current main (d4b5d51); cherry-picks cleanly.

  • clippy on victory-gpu, with and without --all-features: the same 2 errors as main, none in fetchmem.rs or the changed parts of host.rs
  • the five fetchmem tests pass; cargo test -p victory-gpu --lib --locked: 555 passed in 2 of 3 runs, and the third had one failure in watch::tests::what_is_put_in_beside_the_guards_is_told_at_every_view, a watch test that fails now and then on main too; with --all-features, 609 passed

Reading the paths, since an allocation failure can't be forced on a real card from a test:

  • The step-down can work: shared_buffer returns None with a warning when creation fails rather than ending the run, so fetchmem::buffer gets each size in turn.
  • The relay skip ends the same way as the existing pieces.is_empty() path (relay_fetched(after), then return), and RELAY_FETCHED is only read by card_dirty to drop ordering notes, so the bookkeeping stays as it is when there is nothing to fetch.
  • What a skip costs is as the log line says: those pieces' card bytes are not merged, and title memory keeps its old bytes until a later flight flags the same pieces. If none does, they stay stale. That's a reasonable trade for not ending the run, and the counts (stale_bytes_so_far) make it visible; worth keeping in mind when a report shows NO MEMORY TO FETCH.

Not checked: a run that actually hits the failure (the unit tests drive fetchmem::buffer with a fake make), and the comment that the old buffer's last fetch has been waited for before it is let go.

**@⁠babuakhil** on GitHub · 2026-11-28 23:14 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1624#issuecomment-7247290395) Second machine for this: Windows 11, RTX 3060, Ryzen 7 5700X, Rust 1.98.1 (pinned), applied on current `main` (`d4b5d51`); cherry-picks cleanly. - clippy on `victory-gpu`, with and without `--all-features`: the same 2 errors as `main`, none in `fetchmem.rs` or the changed parts of `host.rs` - the five `fetchmem` tests pass; `cargo test -p victory-gpu --lib --locked`: 555 passed in 2 of 3 runs, and the third had one failure in `watch::tests::what_is_put_in_beside_the_guards_is_told_at_every_view`, a `watch` test that fails now and then on `main` too; with `--all-features`, 609 passed Reading the paths, since an allocation failure can't be forced on a real card from a test: - The step-down can work: `shared_buffer` returns `None` with a warning when creation fails rather than ending the run, so `fetchmem::buffer` gets each size in turn. - The relay skip ends the same way as the existing `pieces.is_empty()` path (`relay_fetched(after)`, then return), and `RELAY_FETCHED` is only read by `card_dirty` to drop ordering notes, so the bookkeeping stays as it is when there is nothing to fetch. - What a skip costs is as the log line says: those pieces' card bytes are not merged, and title memory keeps its old bytes until a later flight flags the same pieces. If none does, they stay stale. That's a reasonable trade for not ending the run, and the counts (`stale_bytes_so_far`) make it visible; worth keeping in mind when a report shows `NO MEMORY TO FETCH`. Not checked: a run that actually hits the failure (the unit tests drive `fetchmem::buffer` with a fake `make`), and the comment that the old buffer's last fetch has been waited for before it is let go.
github manually merged commit 3c3aed3afd into main 2026-11-29 08:21:54 +00:00
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/trustno1-coder--VIctory-NVIDIA!1624
No description provided.