Card buffers: VICTORY_CARD_BUFFERS_MIN_KB keeps an 8 GB card's floor #890

Closed
github-bot wants to merge 1 commit from gh-pr/890/head into gh-pr/890/base
Owner

@⁠psttt432454 on GitHub · 2026-11-28 08:38 UTC · original
psttt432454:fix/small-card-buffer-floor → main · +42 −3 · 1 files · 1 commits · closed without merging

Problem

Play-VIctory.cmd and scripts/play-foxhound.ps1 both set VICTORY_CARD_BUFFERS_MIN_KB=64 on every card. That overrides the budget-scaled minimum from default_card_limits_mb (16 MiB on budgets up to 12 GiB). On an 8 GB card it moves the title's small buffers onto the card past its budget.

Measured

RTX 5070 Laptop 8 GB (local budget 7,123 MB), Ryzen 9 HX, 32 GB RAM, --console series-s, Play-VIctory.cmd pareto-residency. All three runs used the same save and the same spot. World frames per one-second line of frame_times:

run card_buffers_min_kb world frames picture
launcher default (before) 64 ~310-340 ms faces missing, vehicles drawn 5-6 times over
VICTORY_CARD_BUFFERS_MIN_KB=0 (before) 16384 ~220-290 ms intact
launcher default, this PR 16384 (warning logged) ~110-250 ms intact, faces lit properly

fxceless/victory-fork#1417 reports the same overflow on an RX 7600 8 GB.

Change

  • New min_kb_floor in shadow.rs. When the local budget is under 10 GiB, the KiB override can raise the minimum but not lower it below the budget-scaled default.
  • When the override is left out, a WARN names both values (asked_kb, kept_kb).
  • 12 GB cards (budget about 11 GB), larger cards and unknown budgets (WARP) get exactly what they ask for, as before.
  • The fix sits in the code rather than in the launchers, so both launchers, and anyone setting the variable by hand, get it.

Tests

  • New unit test window_tests::small_cards_keep_their_buffer_floor.
  • cargo test -p victory-gpu --locked -- --test-threads=1: 453 passed. I skipped tiles::tests::card_wrote_failure_does_not_poison_card_mask, which crashes with an access violation on this RTX 5070 Laptop with or without this change.
  • cargo clippy -p victory-gpu --all-targets reports two manual_is_multiple_of errors, at descriptor.rs:1234 and shadow.rs:1708 on main. Both are already on main and not touched here.

Not covered

  • Only measured on one 8 GB card.
  • The 10 GiB threshold sits between the 8 GB budgets seen (7.1 GB) and the 12 GB ones (about 11 GB). A 10 GB card (e.g. RTX 3080 10 GB, budget about 9.3 GB) falls under it and keeps its 16 MiB floor. It has not been measured.
  • Houses streaming in late is unchanged; it also happens with MIN_KB=0.

No game files, logs of the title or images are included.

🤖 Generated with Claude Code

**@⁠psttt432454** on GitHub · 2026-11-28 08:38 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/890) `psttt432454:fix/small-card-buffer-floor` → `main` · +42 −3 · 1 files · 1 commits · closed without merging ## Problem `Play-VIctory.cmd` and `scripts/play-foxhound.ps1` both set `VICTORY_CARD_BUFFERS_MIN_KB=64` on every card. That overrides the budget-scaled minimum from `default_card_limits_mb` (16 MiB on budgets up to 12 GiB). On an 8 GB card it moves the title's small buffers onto the card past its budget. ## Measured RTX 5070 Laptop 8 GB (local budget 7,123 MB), Ryzen 9 HX, 32 GB RAM, `--console series-s`, `Play-VIctory.cmd pareto-residency`. All three runs used the same save and the same spot. World frames per one-second line of `frame_times`: | run | `card_buffers_min_kb` | world frames | picture | |---|---|---|---| | launcher default (before) | 64 | ~310-340 ms | faces missing, vehicles drawn 5-6 times over | | `VICTORY_CARD_BUFFERS_MIN_KB=0` (before) | 16384 | ~220-290 ms | intact | | launcher default, this PR | 16384 (warning logged) | ~110-250 ms | intact, faces lit properly | fxceless/victory-fork#1417 reports the same overflow on an RX 7600 8 GB. ## Change - New `min_kb_floor` in `shadow.rs`. When the local budget is under 10 GiB, the KiB override can raise the minimum but not lower it below the budget-scaled default. - When the override is left out, a `WARN` names both values (`asked_kb`, `kept_kb`). - 12 GB cards (budget about 11 GB), larger cards and unknown budgets (WARP) get exactly what they ask for, as before. - The fix sits in the code rather than in the launchers, so both launchers, and anyone setting the variable by hand, get it. ## Tests - New unit test `window_tests::small_cards_keep_their_buffer_floor`. - `cargo test -p victory-gpu --locked -- --test-threads=1`: 453 passed. I skipped `tiles::tests::card_wrote_failure_does_not_poison_card_mask`, which crashes with an access violation on this RTX 5070 Laptop with or without this change. - `cargo clippy -p victory-gpu --all-targets` reports two `manual_is_multiple_of` errors, at `descriptor.rs:1234` and `shadow.rs:1708` on `main`. Both are already on `main` and not touched here. ## Not covered - Only measured on one 8 GB card. - The 10 GiB threshold sits between the 8 GB budgets seen (7.1 GB) and the 12 GB ones (about 11 GB). A 10 GB card (e.g. RTX 3080 10 GB, budget about 9.3 GB) falls under it and keeps its 16 MiB floor. It has not been measured. - Houses streaming in late is unchanged; it also happens with `MIN_KB=0`. No game files, logs of the title or images are included. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Both launchers (Play-VIctory.cmd, play-foxhound.ps1) set
VICTORY_CARD_BUFFERS_MIN_KB=64 on every card, which overrides the
budget-scaled minimum (16 MiB on budgets up to 12 GiB). On a card with
under 10 GiB of local budget that puts the title's small buffers on the
card past its budget.

Measured on an RTX 5070 Laptop 8 GB (budget 7,123 MB), Series S, same
save and spot, Play-VIctory.cmd otherwise unchanged:
- MIN_KB=64 (launcher default): world frames ~310-340 ms, faces
  missing, vehicles drawn several times over.
- MIN_KB=0 (the budget-scaled 16 MiB): ~220-290 ms, picture intact.
fxceless/victory-fork#1417 saw the same overflow on an RX 7600 8 GB.

Under 10 GiB of budget the KiB override can now raise the floor but not
lower it below the default, with a warning naming both values. 12 GB
cards (budget about 11 GB), larger ones and unknown budgets get what
they ask for, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:29:38 +00:00
github-bot closed this pull request 2026-11-28 14:29:38 +00:00
Author
Owner

@⁠psttt432454 on GitHub · 2026-11-28 09:32 UTC · original

A correction to the description: three launchers set VICTORY_CARD_BUFFERS_MIN_KB=64, not two. The built-in victory play (apps/victory/src/play.rs) sets it too. Because the fix is in shadow.rs, it covers all three.

Measured again with victory play --series-s on the same RTX 5070 Laptop 8 GB, same save and spot. The log shows MIN_KB left out … asked_kb=64 kept_kb=16384. World frames were about 100 ms, and faces and vehicles were drawn correctly.

**@⁠psttt432454** on GitHub · 2026-11-28 09:32 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/890#issuecomment-7237302355) A correction to the description: three launchers set `VICTORY_CARD_BUFFERS_MIN_KB=64`, not two. The built-in `victory play` (`apps/victory/src/play.rs`) sets it too. Because the fix is in `shadow.rs`, it covers all three. Measured again with `victory play --series-s` on the same RTX 5070 Laptop 8 GB, same save and spot. The log shows `MIN_KB left out … asked_kb=64 kept_kb=16384`. World frames were about 100 ms, and faces and vehicles were drawn correctly.
Author
Owner

@⁠ArturoWolff on GitHub · 2026-11-28 09:45 UTC · original

Independent Linux data point for psttt432454's #890: I tested the existing settings path (VICTORY_CARD_BUFFERS_MIN_KB=0) rather than applying the PR, to isolate the policy on a single executable. RTX 4060 desktop 8 GB, 16 GB system RAM, NVIDIA 620.73.04, GE-Proton11-14. Base .01 (63b902fe), #925 helper compiler plus the same already-tested Linux file-backing adaptation. Series X 1080to1440, DLSS/FG off, full requested RT/water lighting, ordinary waits and full write-back. Same cloned profile seed and fresh external caches; only the effective card-buffer minimum override differs.

Loading-stage observation Launcher 64 Override 0
Effective buffer-copy minimum (KiB) 64 16384
Initial reported DXGI budget (MiB) 6652 6790
Card-side buffer-copy creation log records 3459 9
Peak periodic reported use (MiB) 3126 3126
Final reserve for card copies (MiB) 850 850
Final accounted texture admission total / line (MiB) 6442 / 5959 6485 / 6091
No-room periodic samples 2/9 2/9
Final detailed due texture slots 1 81
Minimum available system RAM (MiB) 1914 2200
Elapsed seconds / actual exit 127.938 / 5 134.778 / 5

This verifies the launcher override and the substantially different copy-allocation policy in an actual Linux title load. Creation records are not unique live allocations or allocated byte totals; both arms have the same peak sampled use and the same reservation for future card copies. Neither crossed the reported DXGI budget in those nine texture-room samples. Both reached loading artwork then black overlay and the existing #628 exit 5, without a memory guard stop, OOM increment, recorded GPU fault or reported device/fence failure. No claim about in-world FPS, final visual fidelity, or a cure for the load failure; your Series S world measurements cover a later workload. I would keep this as a useful opt-in comparison for local testing, not infer a general performance benefit from these cold-loading timings. The remaining admission reservation is also relevant to the separate #609 discussion.

AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).

**@⁠ArturoWolff** on GitHub · 2026-11-28 09:45 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/890#issuecomment-7237444264) Independent Linux data point for psttt432454's #890: I tested the existing settings path (`VICTORY_CARD_BUFFERS_MIN_KB=0`) rather than applying the PR, to isolate the policy on a single executable. RTX 4060 desktop 8 GB, 16 GB system RAM, NVIDIA 620.73.04, GE-Proton11-14. Base `.01` (`63b902fe`), [#925 helper compiler](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/925) plus the same already-tested Linux file-backing adaptation. Series X 1080to1440, DLSS/FG off, full requested RT/water lighting, ordinary waits and full write-back. Same cloned profile seed and fresh external caches; only the effective card-buffer minimum override differs. | Loading-stage observation | Launcher 64 | Override 0 | |---|---:|---:| | Effective buffer-copy minimum (KiB) | 64 | 16384 | | Initial reported DXGI budget (MiB) | 6652 | 6790 | | Card-side buffer-copy creation log records | 3459 | 9 | | Peak periodic reported use (MiB) | 3126 | 3126 | | Final reserve for card copies (MiB) | 850 | 850 | | Final accounted texture admission total / line (MiB) | 6442 / 5959 | 6485 / 6091 | | No-room periodic samples | 2/9 | 2/9 | | Final detailed due texture slots | 1 | 81 | | Minimum available system RAM (MiB) | 1914 | 2200 | | Elapsed seconds / actual exit | 127.938 / 5 | 134.778 / 5 | This verifies the launcher override and the substantially different copy-allocation policy in an actual Linux title load. Creation records are not unique live allocations or allocated byte totals; both arms have the same peak sampled use and the same reservation for future card copies. Neither crossed the reported DXGI budget in those nine texture-room samples. Both reached loading artwork then black overlay and the existing #628 exit 5, without a memory guard stop, OOM increment, recorded GPU fault or reported device/fence failure. No claim about in-world FPS, final visual fidelity, or a cure for the load failure; your Series S world measurements cover a later workload. I would keep this as a useful opt-in comparison for local testing, not infer a general performance benefit from these cold-loading timings. The remaining admission reservation is also relevant to the separate #609 discussion. AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).
Author
Owner

@⁠CuteBooty on GitHub · 2026-11-28 09:58 UTC · original

I measured in-world frame times on a desktop 8 GB card. In this test, the 16 MiB floor was 2.4-2.7 times slower.

Machine: RTX 3070 8 GB (driver 621.24) on PCIe 3.0 x16. nvidia-smi reports link gen max 3 and the card's own max 4. The rest is a Ryzen 7 5800X3D, 32 GB and Windows 11 build 26200.

Build and test: main 63b902fe plus my local patches, without this PR. Like ArturoWolff, I set the value by hand: VICTORY_CARD_BUFFERS_MIN_KB=16384, which is the floor this PR keeps on this card. The limits line printed card_buffers_min_kb=16384 card_buffers_max_mb=1305. Settings: Series S, DLSS performance, no frame generation. Nothing else in the profile changed; it normally sets 64.

These were unattended runs on the same save: it loaded, then stood still for 11 minutes after world entry. Here is one run at 16384 against two runs at 64 of the same build (medians of the 5-second lines):

MIN_KB=64 (run A / run B) MIN_KB=16384
Frame 58.3 / 67.2 ms 159.6 ms
On the GPU 11.2 / 15.7 ms 95.7 ms
Preparing 31.2 / 34.1 ms 45.7 ms
Copying back 6.9 / 9.9 ms 23.7 ms
Host copies in the card's memory at the end 3425 / 3428 copies, 959 MB 12 copies, 446 MB
Card in use at the end 5958 / 6140 MB 5369 MB
"no room, new textures wait" lines 9 / 14 7
Texture room at the end (accounted / line) 5547 / 5890, 5681 / 5889 MB 5655 / 5815 MB

It wasn't a transient. Per-minute means after world entry were 138-174 ms at 16384. At 64 they were 55-72 ms in run A and 58-82 ms in run B. All three runs were stopped after 12 minutes, with no crash signs.

How I read it:

  • The higher floor came with 6-8.5 times the GPU time.
  • Card use fell by 589-771 MB, but the texture headroom didn't grow; it shrank. Line minus accounted was 343 / 208 MB at 64 and 160 MB at 16384, because "kept for card copies of title buffers" rose from 144 to 658 MB.
  • [guess] The cause: the small buffers now in shared PC memory are read over the bus. The comment at VICTORY_CARD_BUFFERS_MIN_KB in shadow.rs says every shader load, store and atomic on them crosses it, and PCIe 3.0 would make that worse here than on a newer laptop link. I haven't shown that.

Not covered: nobody watched the picture, so I can't say whether faces or vehicles differ here. This is one run at 16384, standing still.

This single high-floor run suggests caution about making it the default on every card under 10 GiB. Opt-in, as ArturoWolff suggested, or a choice keyed to the bus rather than the budget, would be worth testing.

(Unattended standing-still runs without frame generation. Measurements and text prepared with my AI assistants, Claude Code and Codex. No game files.)

**@⁠CuteBooty** on GitHub · 2026-11-28 09:58 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/890#issuecomment-7237590481) I measured in-world frame times on a desktop 8 GB card. In this test, the 16 MiB floor was 2.4-2.7 times slower. **Machine:** RTX 3070 8 GB (driver 621.24) on PCIe 3.0 x16. nvidia-smi reports link gen max 3 and the card's own max 4. The rest is a Ryzen 7 5800X3D, 32 GB and Windows 11 build 26200. **Build and test:** main 63b902fe plus my local patches, without this PR. Like ArturoWolff, I set the value by hand: `VICTORY_CARD_BUFFERS_MIN_KB=16384`, which is the floor this PR keeps on this card. The limits line printed `card_buffers_min_kb=16384 card_buffers_max_mb=1305`. Settings: Series S, DLSS performance, no frame generation. Nothing else in the profile changed; it normally sets 64. These were unattended runs on the same save: it loaded, then stood still for 11 minutes after world entry. Here is one run at 16384 against two runs at 64 of the same build (medians of the 5-second lines): | | MIN_KB=64 (run A / run B) | MIN_KB=16384 | |---|---:|---:| | Frame | 58.3 / 67.2 ms | 159.6 ms | | On the GPU | 11.2 / 15.7 ms | 95.7 ms | | Preparing | 31.2 / 34.1 ms | 45.7 ms | | Copying back | 6.9 / 9.9 ms | 23.7 ms | | Host copies in the card's memory at the end | 3425 / 3428 copies, 959 MB | 12 copies, 446 MB | | Card in use at the end | 5958 / 6140 MB | 5369 MB | | "no room, new textures wait" lines | 9 / 14 | 7 | | Texture room at the end (accounted / line) | 5547 / 5890, 5681 / 5889 MB | 5655 / 5815 MB | It wasn't a transient. Per-minute means after world entry were 138-174 ms at 16384. At 64 they were 55-72 ms in run A and 58-82 ms in run B. All three runs were stopped after 12 minutes, with no crash signs. **How I read it:** - The higher floor came with 6-8.5 times the GPU time. - Card use fell by 589-771 MB, but the texture headroom didn't grow; it shrank. Line minus accounted was 343 / 208 MB at 64 and 160 MB at 16384, because "kept for card copies of title buffers" rose from 144 to 658 MB. - [guess] The cause: the small buffers now in shared PC memory are read over the bus. The comment at `VICTORY_CARD_BUFFERS_MIN_KB` in `shadow.rs` says every shader load, store and atomic on them crosses it, and PCIe 3.0 would make that worse here than on a newer laptop link. I haven't shown that. **Not covered:** nobody watched the picture, so I can't say whether faces or vehicles differ here. This is one run at 16384, standing still. This single high-floor run suggests caution about making it the default on every card under 10 GiB. Opt-in, as ArturoWolff suggested, or a choice keyed to the bus rather than the budget, would be worth testing. (Unattended standing-still runs without frame generation. Measurements and text prepared with my AI assistants, Claude Code and Codex. No game files.)
Author
Owner

@⁠psttt432454 on GitHub · 2026-11-28 12:01 UTC · original

Thanks @⁠ArturoWolff and @⁠CuteBooty, your numbers were right. I re-measured on my machine and I'm closing this.

Machine: RTX 5070 Laptop 8 GB (DXGI budget ~7.1 GB), Windows 11. victory play --series-s, same save and spot both times, shader cache warm both times.

main 63b902fe (MIN_KB=64) this PR (floor 16 MiB)
World frame, median ~45 ms ~180 ms
Card busy 75-85 % ~94 %
Kept for card copies of title buffers 118 MB 658 MB
Crash / OOM none none

The picture was correct on main: faces, houses and textures were all there. The OOM and broken picture I first saw with 64 KiB were on an older build, and current main no longer shows them on this card. So the floor only costs time here, about 4x, matching CuteBooty's PCIe reading, and it doesn't free room either.

My earlier ~100 ms comment had no comparison behind it: I hadn't run current main with 64 KiB on this card.

#943 (the slot eviction report line) doesn't depend on this PR and stays open.

**@⁠psttt432454** on GitHub · 2026-11-28 12:01 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/890#issuecomment-7238945367) Thanks @⁠ArturoWolff and @⁠CuteBooty, your numbers were right. I re-measured on my machine and I'm closing this. **Machine:** RTX 5070 Laptop 8 GB (DXGI budget ~7.1 GB), Windows 11. `victory play --series-s`, same save and spot both times, shader cache warm both times. | | main `63b902fe` (MIN_KB=64) | this PR (floor 16 MiB) | |---|---:|---:| | World frame, median | ~45 ms | ~180 ms | | Card busy | 75-85 % | ~94 % | | Kept for card copies of title buffers | 118 MB | 658 MB | | Crash / OOM | none | none | The picture was correct on main: faces, houses and textures were all there. The OOM and broken picture I first saw with 64 KiB were on an older build, and current main no longer shows them on this card. So the floor only costs time here, about 4x, matching CuteBooty's PCIe reading, and it doesn't free room either. My earlier ~100 ms comment had no comparison behind it: I hadn't run current main with 64 KiB on this card. #943 (the slot eviction report line) doesn't depend on this PR and stays open.

Pull request closed

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!890
No description provided.