Skip to content

8 GB cards: no first uploads past the budget, render targets resident first - #1944

Draft
RomanFama592 wants to merge 7 commits into
trustno1-coder:mainfrom
RomanFama592:feature/8gb-cards
Draft

RomanFama592 wants to merge 7 commits into
trustno1-coder:mainfrom
RomanFama592:feature/8gb-cards

Conversation

@RomanFama592

@RomanFama592 RomanFama592 commented Nov 29, 2026 •

Copy link
Copy Markdown

On a graphics card of 8 GB the black-face fix's first-upload admission lets the card grow past its DXGI budget for good, and past the budget Windows pages the card's memory: the frame rate then falls with how far over the card is. This keeps first uploads from doing that, keeps render targets resident first when Windows has to page, and documents what helps on these cards. On the test card the game ran at 3–5 fps before either and at 14.9 fps (median) with both. Measured on an RTX 4060 Ti 8 GB, which is still being tested; details in docs/8gb-cards.md.

What it changes

Past the budget, no first uploads that keep the card over it (resource::first_upload_decision; on by default, acts only while DXGI says the card is at or past its budget). Two cases let the card grow without end:

  • A texture object of the title's (not placed in title memory) is weighed as one byte, since the pass does not know its size, and one byte always fit the free ranges: 6.0 → 8.3 GB in use against a 6.8 GB budget in ten minutes, 34,108 first uploads allowed and 11 refused in five seconds.
  • Past the budget, textures that fit free ranges of the texture blocks were admitted because they take no new memory, but those ranges are what slot eviction had just given back: 125,675 went in in 18 minutes while in use rose 7.7 → 9.9 GB.

Windows then paged the card: 89–234 ms of GPU a frame, 3–5 fps, and a Streamline budget warning every frame (5,153 times). Now neither case is admitted past the budget. Under it, and just past it with free ranges to spare, nothing changes, so a card with memory to spare never reaches this. The #1496 test's free-range case is refused now (2.3 GB past the budget with 16 MiB free) and the test says so.

The cost: a refused slot shows the neutral texture until there is room, so walking into a new place, floors and walls can stay grey or black until eviction lets go of the old place's textures (about four seconds unsampled).

Render targets stay resident first (host::prioritise; on by default, VICTORY_RESIDENCY_PRIORITY=0 turns it off). Even with the change above the card stays a few hundred MB past its budget, and with every priority normal Windows paged out render targets too, which every frame reads and writes again. Committed render targets, depth and UAV memory on the card now get D3D12_RESIDENCY_PRIORITY_HIGH when they are made, so textures go first. A hint only: nothing reads or writes differently, and a card under its budget pages nothing.

Same card, build and places, 7–9 min each fps GPU per frame Past the budget (median) Picture
VICTORY_RESIDENCY_PRIORITY=0 3.4 181 ms 682 MB clean
Default (residency priority on) 14.9 2.3 ms 216 MB clean
VICTORY_CARD_WINDOWS_MB=430 instead (tried, left out) 4.8 108 ms 664 MB white shards on plants

docs/8gb-cards.md: why the budget decides the frame rate on these cards (a table of GPU time and fps by how far past the budget the card was), the change and its cost, the residency A/B, title memory windows on the card tried and left out, settings that help (frame generation off, fewer target pixels, what F1 saved overrides, keep the wave-wide fallback on), and what is open. Linked from docs/windows-memory.md.

How it was tested

  • GPU and profile: RTX 4060 Ti 8 GB (budget 6.6–7.2 GB), Ryzen 9 5900X, 64 GB, Windows 11, driver 610.88. Series X at 1440p, DLSS balanced, frame generation off, ray tracing off; earlier runs also Series S 626/720 and frame generation x2.
  • Before: 2–3 GB past the budget, GPU 89–234 ms a frame, 3–5 fps, 5,153 Streamline budget warnings in 18 minutes.
  • After: four runs of 8–11 minutes, 150–780 MB past the budget, no Streamline budget warnings, 5–12 fps median depending on how far over the card stayed (13–14 fps under 300 MB over, 5–6 over 600 MB).
  • Residency priority: an A/B at the same places (table above); F2's explainer then names the CPU, not the GPU, as the limit.
  • cargo test -p victory-gpu passed: yes (591). Clippy: no new findings.

Checked for overlap

🤖 Generated with Claude Code

https://claude.ai/code/session_01WiREjB6TQEQ2QzFVNzZKGS

@github-actions github-actions Bot added the pr-fix Pull request: fixes a bug label Nov 29, 2026
@github-actions github-actions Bot changed the title [pr-fix] 8 GB cards: no first uploads past the budget; opt-in switches, native build, docs 8 GB cards: no first uploads past the budget; opt-in switches, native build, docs Nov 29, 2026
RomanFama592 and others added 3 commits November 29, 2026 01:23
…r it

On an 8 GB card (RTX 4060 Ti, budget 6.8 GB) the black-face fix's first-upload admission let the card grow past its budget for good:
- texture objects of the title's, whose size the pass does not know, were weighed as one byte and always fit the free ranges: 6.0 to 8.3 GB in use in ten minutes, 34,108 first uploads allowed and 11 refused in five seconds;
- past the budget, textures that fit free ranges of the texture blocks refilled what slot eviction had just given back: 125,675 in 18 minutes while the card rose from 7.7 to 9.9 GB.

Windows then paged the card: 89 to 234 ms of GPU a frame, 3 to 5 fps, a Streamline budget warning every frame. While DXGI says the card is at or past its budget, neither is admitted now. Under it, and just past it with free ranges to spare, nothing changes. On the same card: no budget warnings in four runs of 8 to 11 minutes, 150 to 780 MB past the budget instead of 2 to 3 GB.

The trustno1-coder#1496 test's free-range case is refused now: 2.3 GB past the budget with 16 MiB free.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WiREjB6TQEQ2QzFVNzZKGS
…nt first

Opt-in, off by default. Committed render targets, depth and unordered-access memory on the card get D3D12_RESIDENCY_PRIORITY_HIGH, so past the budget Windows pages textures out before memory every frame writes. A hint only: nothing reads or writes differently.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WiREjB6TQEQ2QzFVNzZKGS
…settings that help, what is open

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WiREjB6TQEQ2QzFVNzZKGS
@RomanFama592 RomanFama592 changed the title 8 GB cards: no first uploads past the budget; opt-in switches, native build, docs [pr-fix] 8 GB cards: past the budget, no first uploads that keep the card over it Nov 29, 2026
@github-actions github-actions Bot changed the title [pr-fix] 8 GB cards: past the budget, no first uploads that keep the card over it 8 GB cards: past the budget, no first uploads that keep the card over it Nov 29, 2026
RomanFama592 and others added 3 commits November 29, 2026 01:55
Measured on the RTX 4060 Ti 8 GB at the same places, 7 to 9 minutes a run: with every priority normal, the card a few hundred MB past its budget had Windows page render targets out too, 181 ms of GPU a frame and 3.4 fps; with them at high priority, 2.3 ms and 14.9 fps, the picture unchanged. A hint only, and a card under its budget pages nothing. VICTORY_RESIDENCY_PRIORITY=0 gives them normal priority, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WiREjB6TQEQ2QzFVNzZKGS
…nd left out

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WiREjB6TQEQ2QzFVNzZKGS
@RomanFama592 RomanFama592 changed the title 8 GB cards: past the budget, no first uploads that keep the card over it [pr-fix] 8 GB cards: no first uploads past the budget, render targets resident first (3.4 to 14.9 fps) Nov 29, 2026
@github-actions github-actions Bot changed the title [pr-fix] 8 GB cards: no first uploads past the budget, render targets resident first (3.4 to 14.9 fps) 8 GB cards: no first uploads past the budget, render targets resident first (3.4 to 14.9 fps) Nov 29, 2026
@RomanFama592 RomanFama592 changed the title 8 GB cards: no first uploads past the budget, render targets resident first (3.4 to 14.9 fps) [pr-fix] 8 GB cards: no first uploads past the budget, render targets resident first Nov 29, 2026
@github-actions github-actions Bot changed the title [pr-fix] 8 GB cards: no first uploads past the budget, render targets resident first 8 GB cards: no first uploads past the budget, render targets resident first Nov 29, 2026
@kraiy404

Copy link
Copy Markdown

Tested on the same card you measured on: RTX 4060 Ti 8 GB.

Setup: i5-13400F, 32 GB, Windows 11 26300, driver 621.40.
Series X, 2560x1440 output, DLSS quality, DLSS frame generation 2x, texture room 72%.
Base: 63b902f plus #541 (UI) and the key-mouse commits, then your PR cherry-picked on top
(it applies with two conflicts in resource.rs and host.rs; see the porting note at the end).

Before (same build, same place, without your PR):

  • out of VRAM warnings from Streamline: 8 to 5,206 in a session
  • frame generation sat at "12 presents with it on, 0 frames shown": on, generating nothing
  • the room line read "7290 MB in use ... = 7892 MB" against a 6.75 GB budget
  • 10-14 fps at 6.5k-8k draws
    
    After:
  • out of VRAM: 0 in a 5 minute run
  • frame generation: "12 presents with it on, 0 off, 24 frames shown"
  • room line: "6518 MB in use - 427 MB free in texture blocks ... = 6091 MB", inside the budget
  • 11.6-12.3 fps at ~9,000 draws (average 12.0), CPU prepare 34-45 ms
  • nvidia-smi 7,381 MB of 8,188; the log confirms the priority was given:
    "render targets, depth and memory shaders write: high residency priority (VICTORY_RESIDENCY_PRIORITY=1)"
    
    Porting note, in case it helps the branch: onto that older base your commit needs three symbols that
    base does not have yet.
  • host.rs: with_copy_queue_sync uses ASIDE, but on that base ASIDE is a function-local static inside
    mapped(). I gave the sync path its own static (ASIDE_SYNC) rather than hoisting mapped()'s.
  • resource.rs: texture_budget_limit() was missing; I copied it as is.
  • pool.rs: texture_widest_free() has no per-block ranges on that base, so I stood it in with the total
    free bytes of the texture blocks - more permissive than yours, and only read by the first-upload check.
    
    From my side: this is the first build on this card where frame generation actually produces frames
    with the budget respected. It feels much better to play than any build I have had so far.

@RomanFama592

Copy link
Copy Markdown
Author

Thank you for testing on the same card, and for the porting notes, they are useful. It is good to see a second RTX 4060 Ti 8 GB with a different CPU (i5-13400F) land on the same result. The frame generation result is new to me: in my runs frame generation was the first thing to push the card past its budget, so I had left it off. If you don't mind, I'd like to add your numbers, with credit, to the "How it was tested" section.

One note: the build you tested still had the residency priority as opt-in (VICTORY_RESIDENCY_PRIORITY=1). It is on by default now, and =0 turns it off.

@Roybill203

Copy link
Copy Markdown

Tested on an RTX 4060 Laptop 8 GB (7,188 MB DXGI budget, Ryzen 9 7945HX, 15.7 GB RAM, driver 621.24, Windows 11 build 26300). Built from main @ 568c5e5 plus this PR applied cleanly (all 4 files). Your docs/8gb-cards.md is the most useful document I have read on this problem — the table of fps against how far past the budget the card sits predicts what we saw before we had a fix.

What this PR fixed for us

The OOM loop is gone. Before it, --series-s --dlss performance produced 13,461 no shared buffer refusals of 6,291,456 bytes in 8 seconds, and the run never got past the loading screen. After it, the same profile produced 1 to 3 OOM lines in total and reached the world at frame 29,533. Nothing that looked like your two cases recurs.

What is left on our card, and it is not memory

The runs now stop differently. The last one (Series X, DLSS balanced, VICTORY_RESIDENCY_PRIORITY=1, VICTORY_VRAM_ADMIT=1 at 92/84 — the gate is ours, see below) shows:

06:12:04  launcher start
06:12:14 .. 06:12:54   loading screens, 345-1000 fps, 4-10 draws
06:13:06  13.7 fps, 73.1 ms, 79 draws          <- first world frames
06:13:06  frame times: 128 frames, median 1.0 ms, p95 3.4,
          p99 55.1, longest 9155.2; 2 over 50 ms, 1 over 100 ms
06:13:08  no unordered-access buffer (0x887A0005) size=48
06:13:08  no upload buffer (0x887A0005) size=8388608
06:13:08  ERROR ... device removed

So 0x8007000E is followed by 0x887A0005 DXGI_ERROR_DEVICE_REMOVED. The whole run is 64 seconds and the longest frame is 9,155 ms, so this is not the 60 s TdrDelay firing; the system log carries no Display or nvlddmkm event for it either. The 9 s frame is the thing that stands out, and it lands while mesh pipelines are still being made:

06:13:06.206779  host mesh pipeline shaders=[mesh b7a81f5b96f4ca93, pixel 43e24028d4a1faef-mask]
06:13:06.206824  host mesh pipeline shaders=[mesh b7a81f5b96f4ca93, pixel ee78da6862364ddd-mask]
06:13:06.207071  host mesh pipeline shaders=[mesh 59874b28fd64363d, pixel ee78da6862364ddd-mask]

The residency priority A/B did not reproduce for us

This is the part I would most like your reading on. Your table has VICTORY_RESIDENCY_PRIORITY=0 at 3.4 fps / 181 ms and the default (on) at 14.9 fps / 2.3 ms. On our card the switch removed every OOM and then ended the run with DEVICE_REMOVED 2 seconds into the world:

our run profile priority OOM lines outcome
#1944 only Series X, DLSS balanced =1 1 0x8007000E, frame 31,336
#1944 only Series S, renderer 6 =1 1 0x8007000E, frame 35,120
#1944 only Series S, DLSS performance =1 3 0x8007000E, frame 30,306
#1944 + priority Series X, DLSS balanced =1 0 0x887A0005, 64 s, longest frame 9,155 ms
#1944 + priority Series S, renderer 6 =1 8 0x8007000E + DEVICE_REMOVED, frame 27,858

The one that gave the expected 0 OOM is also the one that died with DEVICE_REMOVED, and it died sooner in wall-clock terms (64 s against about 12 minutes). My guess, offered as a guess: with every render target, depth and UAV at HIGH, the textures are what Windows pages, and our 15.7 GB of RAM gives the pager less to work with than the 64 GB in your test rig — your doc says the card stays 150-780 MB over after the change, and paying for that out of system memory is what the 9 s frame might be. If you have a run on a 16 GB host I would very much like to see whether the p99 tail looks like ours.

Two things that may be worth knowing

VICTORY_RESIDENCY_PRIORITY is off by default in the code as merged, though the PR text says "on by default". host.rs:

/// (`VICTORY_RESIDENCY_PRIORITY=1`; off by default: all of it normal, as
/// before). ... Off by default until runs on such a card have compared it
/// (docs/8gb-cards.md).
fn residency_priority_on() -> bool {
    *ON.get_or_init(|| std::env::var_os("VICTORY_RESIDENCY_PRIORITY").is_some_and(|v| v == "1"))
}

So anyone reading the PR and expecting the A/B by default will silently get =0. Either the comment or the description wants updating.

The one-byte case looks like it is still reachable through a path this PR does not see. Our runs still log first-upload admissions while the card is at the line, up to so_far=3,750:

a first host texture was admitted just over the room line (black face fix)
  so_far=3500 slot=61921 bytes=409...
a first host texture was admitted just over the room line (black face fix)
  so_far=3750 slot=331961 bytes=40...
ERROR: a host command list did not close (0x8007000E)

#1677's author named the same family as "Defect 3, the stale memory snapshot across a texture pass" — the decision reads numbers taken before the pass, so late-pass admissions ride stale ones. That matches what we see: refusing and climbing at the same time.

What we ran, for anyone reproducing

victory.exe play --res 1080to1440 --dlss balanced --fps 1000 \
  --set VICTORY_RESIDENCY_PRIORITY=1 \
  --set VICTORY_VRAM_ADMIT=1 \
  --set VICTORY_VRAM_ADMIT_HIGH_PERCENT=92 \
  --set VICTORY_VRAM_ADMIT_LOW_PERCENT=84

VICTORY_VRAM_ADMIT and the two percentages are our own addition, not yours: a residency gate on the card's LOCAL segment through IDXGIAdapter3, high/low marks with hysteresis, that withholds speculative uploads only. Our first version gated the drawing path too, and that was a mistake worth recording — the gate fired once at 92 % (used 6,402 of 6,956 MB) and never cleared, because refusing an upload the title is drawing with frees nothing; within 50 s the queue reached 16,098 due with the oldest 1,648 frames old and interiors lost their lighting. With it moved to speculative work only, the queue ends at 145-1,573 due and the picture is clean. It is not what stops your OOM though — sampling once a second cannot see a 2 GB step inside one frame, which is the same stale-snapshot shape as Defect 3.

Logs are 3-7 MB each and I can attach any of them or put them in a gist.


Log analysis done with an assistant; the runs and the numbers are mine.

@kraiy404

Copy link
Copy Markdown

Thank you for testing on the same card, and for the porting notes, they are useful. It is good to see a second RTX 4060 Ti 8 GB with a different CPU (i5-13400F) land on the same result. The frame generation result is new to me: in my runs frame generation was the first thing to push the card past its budget, so I had left it off. If you don't mind, I'd like to add your numbers, with credit, to the "How it was tested" section.

One note: the build you tested still had the residency priority as opt-in (). It is on by default now, and turns it off.VICTORY_RESIDENCY_PRIORITY=1``=0

Sure, go ahead - credit is fine.

On frame generation: with the first-upload guard in place it works at 72% texture room,
and it was the difference between "on but generating nothing" and "24 frames shown".

One data point that may matter to you: on the official latest main (568c5e5) with the
same PR, frame generation still fails there - but not because of your guard. That base
counts the budget lower (6,922 MB where the driver reports 7,181), so the 72% line falls
to 4,993 MB and the card sits ~1 GB over it permanently. On 63b902f the same settings
sit inside the budget. So the newer base's budget arithmetic is worth a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-fix Pull request: fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants