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

Merged
mizzied merged 1 commit from upstream-pr/1624 into main 2026-11-29 08:16:55 +00:00
mizzied commented 2026-11-28 22:34:14 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mizzied on 2026-11-28T22:34:14Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5545235846 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1624). Originally posted by [mizzied](https://github.com/mizzied) on 2026-11-28T22:34:14Z. --- **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.
babuakhil commented 2026-11-28 23:14:00 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by babuakhil on 2026-11-28T23:14:00Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7247290395 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1624#issuecomment-7247290395). Originally posted by [babuakhil](https://github.com/babuakhil) on 2026-11-28T23:14:00Z. --- 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.
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!1624
No description provided.