Check VRAM before allocating first streamed textures #3406

Closed
github-bot wants to merge 1 commit from github-bot/gh-3406 into main AGit
Owner

@⁠Kitrae on GitHub · 2026-11-29 22:51 UTC · original
Kitrae:fix/streamed-vram-budget → main · +164 −15 · 4 files · 1 commits · closed without merging

Refs #3374

What it changes

The background pass can admit a first texture upload based on its title footprint and free space in the pool. If placement finds no usable range, the allocator can then request a 64 MiB heap even for a small texture.

  • Check current DXGI headroom before growing the pool or committing a standalone texture. The check uses the full heap size or the D3D12 allocation size, respectively. Uploads that fit in existing blocks can still reuse them.
  • Keep budget-deferred uploads queued, preserve pending texture seeds, and refund the first-upload allowance for the deferred attempt.
  • Set VICTORY_FIRST_UPLOAD_VRAM_GUARD=0 to compare the previous behavior with the same build.

How it was tested

  • The reference run in #3374 used an RTX 3070 8 GB, Series S, 1080→1440, DLSS Performance, and 2× frame generation via the MFG Unlocker. DXGI local usage reached 8,844 MiB against a 7,031 MiB budget in the attached log.
  • The new tests cover the full allocation cost at and above the reported budget, reuse of existing pool space when growth is deferred, and clearing deferral state before subsequent allocations.
  • On Windows with an RTX 4090, cargo test -p victory-gpu --lib --locked -- --test-threads=1 reported 917 passed, 1 failed and 60 ignored. Upstream 716a0c99 reported 914 passed, 1 failed and 60 ignored. Both failed the same shader-cache check for VICTORY_SCALAR_SPLITS.
  • A matched gameplay run on an 8 GB card is still needed to measure VRAM and frame-time impact.

Checked for overlap

  • I searched open PRs. #1944 changes first-upload admission and residency priority. #3128 changes when sampled texture eviction is enabled. This PR checks the actual allocation after admission.
**@⁠Kitrae** on GitHub · 2026-11-29 22:51 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3406) `Kitrae:fix/streamed-vram-budget` → `main` · +164 −15 · 4 files · 1 commits · closed without merging Refs #3374 ## What it changes The background pass can admit a first texture upload based on its title footprint and free space in the pool. If placement finds no usable range, the allocator can then request a 64 MiB heap even for a small texture. - Check current DXGI headroom before growing the pool or committing a standalone texture. The check uses the full heap size or the D3D12 allocation size, respectively. Uploads that fit in existing blocks can still reuse them. - Keep budget-deferred uploads queued, preserve pending texture seeds, and refund the first-upload allowance for the deferred attempt. - Set `VICTORY_FIRST_UPLOAD_VRAM_GUARD=0` to compare the previous behavior with the same build. ## How it was tested - The reference run in #3374 used an RTX 3070 8 GB, Series S, 1080→1440, DLSS Performance, and 2× frame generation via the MFG Unlocker. DXGI local usage reached 8,844 MiB against a 7,031 MiB budget in the attached log. - The new tests cover the full allocation cost at and above the reported budget, reuse of existing pool space when growth is deferred, and clearing deferral state before subsequent allocations. - On Windows with an RTX 4090, `cargo test -p victory-gpu --lib --locked -- --test-threads=1` reported 917 passed, 1 failed and 60 ignored. Upstream `716a0c99` reported 914 passed, 1 failed and 60 ignored. Both failed the same shader-cache check for `VICTORY_SCALAR_SPLITS`. - A matched gameplay run on an 8 GB card is still needed to measure VRAM and frame-time impact. ## Checked for overlap - [x] I searched open PRs. #1944 changes first-upload admission and residency priority. #3128 changes when sampled texture eviction is enabled. This PR checks the actual allocation after admission.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 22:52:20 +00:00
Author
Owner

@⁠tyr0nsur on GitHub · 2026-11-30 06:26 UTC · original · edited 2026-11-30 06:31 UTC

I tested 446f0a5 on a Windows RTX 4060 8 GiB, merged locally onto 41adb55. A test-only input set the guard's headroom. The textures, heaps, residency calls, and DXGI measurements used real D3D12. All 12 first-upload tests passed.

  • With 4 MiB simulated headroom and an empty pool, a 256×256 RGBA8 texture fell back to a committed resource because a 64 MiB block would not fit. At 0 MiB, a fresh allocation deferred. Placing the texture in an existing block succeeded and left DXGI local usage unchanged.
  • With 72 MiB simulated headroom and a suitable range already in the pool, a guarded take still added an ahead block with VICTORY_RIPE_BLOCKS=12 (the pool default when unset). Pool size and DXGI local usage both rose by exactly 64 MiB. With VICTORY_RIPE_BLOCKS=0, the same take added zero bytes. Both shipped launchers set 0, and the two v2026.11.29.05 captures from this RTX 4060 used 0 as well. The extra ahead block therefore does not explain their VRAM growth. PR #2038 also suppresses ahead growth after over-budget pressure is detected while retaining the preference for ripe blocks.

Could the growth callback distinguish a required block from an ahead block so the latter can have a separate headroom threshold? The existing rationale for ripe blocks makes a matched gameplay run worth doing before changing the default. This allocator test leaves FPS and in-game texture latency open. Review assisted by Claude Opus 5.5.

**@⁠tyr0nsur** on GitHub · 2026-11-30 06:26 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3406#issuecomment-7270655600) · edited 2026-11-30 06:31 UTC I tested `446f0a5` on a Windows RTX 4060 8 GiB, merged locally onto `41adb55`. A test-only input set the guard's headroom. The textures, heaps, residency calls, and DXGI measurements used real D3D12. All 12 first-upload tests passed. - With 4 MiB simulated headroom and an empty pool, a 256×256 RGBA8 texture fell back to a committed resource because a 64 MiB block would not fit. At 0 MiB, a fresh allocation deferred. Placing the texture in an existing block succeeded and left DXGI local usage unchanged. - With 72 MiB simulated headroom and a suitable range already in the pool, a guarded take still added an ahead block with `VICTORY_RIPE_BLOCKS=12` (the pool default when unset). Pool size and DXGI local usage both rose by exactly 64 MiB. With `VICTORY_RIPE_BLOCKS=0`, the same take added zero bytes. Both shipped launchers set `0`, and the two v2026.11.29.05 captures from this RTX 4060 used `0` as well. The extra ahead block therefore does not explain their VRAM growth. PR #2038 also suppresses ahead growth after over-budget pressure is detected while retaining the preference for ripe blocks. Could the growth callback distinguish a required block from an ahead block so the latter can have a separate headroom threshold? The existing rationale for ripe blocks makes a matched gameplay run worth doing before changing the default. This allocator test leaves FPS and in-game texture latency open. Review assisted by Claude Opus 5.5.
github-bot closed this pull request 2026-12-01 18:58:44 +00:00

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