16 GB PCs: idle host lists sized by the memory shared with the card, refused upload buffers retried after letting go of what is kept #255

Open
github-bot wants to merge 1 commit from github-bot/gh-255 into main AGit
Owner

@⁠Zayfway on GitHub · 2026-11-26 13:22 UTC · original
Zayfway:memory-relief-16gb → main · +132 −3 · 4 files · 1 commits · open

On a PC with 16 GB of RAM, the memory Windows lets the card share (QueryVideoMemoryInfo non-local budget) is 7,488 MiB. In the first mission it fills up. NVIDIA then refuses upload buffers, a host list fails to close with E_OUTOFMEMORY, and the run ends.

Most of what sits there is kept on purpose:

  • The idle pool keeps up to 512 host lists, and each keeps its command allocators, which live in that memory.
  • Spare scratch chunks.
  • Empty staging blocks.

This PR lets go of these when that memory runs short. Nothing changes while there is room.

Change

  • list.rs: the idle pool's limit follows the shared budget, read every 250 ms:

    • 512 lists below 70 %
    • 96 below 86 %
    • 32 below 92 %
    • none above

    Lists over a new, lower limit are freed at once. VICTORY_LIST_POOL_MOST=<n> fixes the limit.

  • host.rs: when upload_buffer is refused, it lets go of the idle lists, the spare scratch chunks and the empty staging blocks (pool::relieve_staging), then tries once more. A warning says what was freed and whether the retry worked.

  • pool.rs / texture.rs: relieve_staging().

Measurements

PC: RTX 3060 12 GB, Ryzen 7 5700X, 16 GB RAM, Windows 11, Series S profile.

Build and settings:

  • Measured on codec-d/cool_fox f4b48ad, which is built on this repository and has the same list.rs / upload_buffer. A run from the start to the first mission takes about 25 minutes there, and I have not repeated it on 0dec5dc.
  • CARD_BUFFERS_MIN_KB=64 and CARD_BUFFERS_MB=1536, as in #225.
  • Player driven through the prison to the check-cashing mission.
Run At the mission's first "hold LT to aim" Outcome
without this change shared memory over budget; 1,626 host lists alive no upload buffer 0x8007000E, then "a host command list did not close (0x8007000E)": run ended
with this change the same point passed; 61 refused upload buffers, retried about two more minutes of aiming, then the device hung (0x887A0005) with shared memory still at 7,520 / 7,488 MiB
with this change + SHADER_LOOP_LIMIT=4096, JOIN_PARTS=1 1,159–1,253 host lists alive 6 minutes of aiming in the mission without a crash (48,544 refused and retried; about 6 fps there)

So this turns a certain crash at that point into a slow but live game. It does not make the memory fit: the refusals keep coming. The next thing to look at is what else lives in that memory, such as windows of title memory, which are about 4.7 GB at that point.

Tests

  • cargo test -p victory-gpu --lib list: 13 passed, 3 ignored.
  • cargo clippy -p victory-gpu --lib -- -D warnings: clean.
  • Builds on 0dec5dc.

🤖 Generated with Claude Code

**@⁠Zayfway** on GitHub · 2026-11-26 13:22 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/255) `Zayfway:memory-relief-16gb` → `main` · +132 −3 · 4 files · 1 commits · open On a PC with 16 GB of RAM, the memory Windows lets the card share (`QueryVideoMemoryInfo` non-local budget) is 7,488 MiB. In the first mission it fills up. NVIDIA then refuses upload buffers, a host list fails to close with `E_OUTOFMEMORY`, and the run ends. Most of what sits there is kept on purpose: - The idle pool keeps up to 512 host lists, and each keeps its command allocators, which live in that memory. - Spare scratch chunks. - Empty staging blocks. This PR lets go of these when that memory runs short. Nothing changes while there is room. ### Change - **`list.rs`:** the idle pool's limit follows the shared budget, read every 250 ms: - 512 lists below 70 % - 96 below 86 % - 32 below 92 % - none above Lists over a new, lower limit are freed at once. `VICTORY_LIST_POOL_MOST=<n>` fixes the limit. - **`host.rs`:** when `upload_buffer` is refused, it lets go of the idle lists, the spare scratch chunks and the empty staging blocks (`pool::relieve_staging`), then tries once more. A warning says what was freed and whether the retry worked. - **`pool.rs` / `texture.rs`:** `relieve_staging()`. ### Measurements **PC:** RTX 3060 12 GB, Ryzen 7 5700X, 16 GB RAM, Windows 11, Series S profile. **Build and settings:** - Measured on codec-d/cool_fox f4b48ad, which is built on this repository and has the same `list.rs` / `upload_buffer`. A run from the start to the first mission takes about 25 minutes there, and I have not repeated it on 0dec5dc. - `CARD_BUFFERS_MIN_KB=64` and `CARD_BUFFERS_MB=1536`, as in #225. - Player driven through the prison to the check-cashing mission. | Run | At the mission's first "hold LT to aim" | Outcome | |---|---|---| | without this change | shared memory over budget; 1,626 host lists alive | `no upload buffer` 0x8007000E, then "a host command list did not close (0x8007000E)": run ended | | with this change | the same point passed; 61 refused upload buffers, retried | about two more minutes of aiming, then the device hung (0x887A0005) with shared memory still at 7,520 / 7,488 MiB | | with this change + `SHADER_LOOP_LIMIT=4096`, `JOIN_PARTS=1` | 1,159–1,253 host lists alive | 6 minutes of aiming in the mission without a crash (48,544 refused and retried; about 6 fps there) | So this turns a certain crash at that point into a slow but live game. It does not make the memory fit: the refusals keep coming. The next thing to look at is what else lives in that memory, such as windows of title memory, which are about 4.7 GB at that point. ### Tests - `cargo test -p victory-gpu --lib list`: 13 passed, 3 ignored. - `cargo clippy -p victory-gpu --lib -- -D warnings`: clean. - Builds on 0dec5dc. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
On a 16 GB PC (budget of memory shared with the card: 7,488 MiB) the idle
pool of 512 host lists keeps their command allocators, which live in that
memory: 1,626 host lists were alive when NVIDIA refused 4 MiB upload
buffers in the first mission and a host list could not be closed
(E_OUTOFMEMORY, the run ended). The pool now holds 512 lists under 70 % of
that budget, 96 under 86 %, 32 under 92 % and none above, looked at every
250 ms (VICTORY_LIST_POOL_MOST=<n> fixes it). A refused upload buffer lets
go of the idle lists, the spare scratch chunks and the empty staging
blocks, and is tried once more.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 13:26:02 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/255/head:github-bot/gh-255'
git switch 'github-bot/gh-255'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-255'
git switch 'github-bot/gh-255'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-255'
git switch 'github-bot/gh-255'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-255'
git switch 'main'
git merge --squash 'github-bot/gh-255'
git switch 'main'
git merge --ff-only 'github-bot/gh-255'
git switch 'main'
git merge 'github-bot/gh-255'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.