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
Zayfway wants to merge 1 commit from upstream-pr/255 into main
Zayfway commented 2026-11-26 13:22:24 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by Zayfway on 2026-11-26T13:22:24Z.


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

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6627583796 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/255). Originally posted by [Zayfway](https://github.com/Zayfway) on 2026-11-26T13:22:24Z. --- 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)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/255:upstream-pr/255'
git switch 'upstream-pr/255'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/255'
git switch 'upstream-pr/255'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/255'
git switch 'upstream-pr/255'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/255'
git switch 'main'
git merge --squash 'upstream-pr/255'
git switch 'main'
git merge --ff-only 'upstream-pr/255'
git switch 'main'
git merge 'upstream-pr/255'
git push origin 'main'
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
avatarmanz/VIctory-7900XTX!255
No description provided.