gpu: gate new texture blocks and by-address VRAM against the budget line #399

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

@⁠Kikoarl on GitHub · 2026-11-27 21:55 UTC · original
Kikoarl:feat/pool-gate → main · +658 −57 · 6 files · 1 commits · open

Summary

Ports VICTORY_POOL_GATE and VICTORY_POOL_FULLEST from fxceless/victory-fork commit 2eade68cade9b2f8cd2511cc97328e83f58508c3 (GPL-3.0-or-later), rebased onto main (df2daaf).

Changes

  • pool.rs, resource.rs: Allocate a new 64 MiB texture block only while card real use + new block + buffer-copy reserve + targets_to_come remains at or below the texture budget line (VICTORY_POOL_GATE=0 disables). Otherwise reuse free pieces or defer waitable heap textures while keeping headroom + one block free during idle sweeps so the gate does not deadlock. Adds optional fullest-block-first placement (VICTORY_POOL_FULLEST=1; play.rs defaults to 0 first-fit).
  • draw.rs, host.rs: Defer heap texture slots when no free piece fits and the gate is closed, track HEAP_TEXTURES_NO_PLACE / pool::BLOCKS, and log texture blocks: ... alongside room_terms.
  • shadow.rs, apps/victory/src/play.rs: Enforce targets_to_come reserve (VICTORY_CARD_ROOM_FOR_TARGETS_MB) in by_address_room for title memory by address. Because main already routes arenas through shadow::by_address, memory.rs is left untouched and merged PR #88 is preserved.

Distinct from PR #79 (VICTORY_POOL_STATS logging) and PR #209 (window heap hole reuse).

Verification

Verified on Windows (x86_64-pc-windows-msvc) against main (df2daaf):

  • git diff --check main..HEAD — clean
  • cargo test -p xtask --locked — 6 passed, 0 failed (asset policy: 287 files ok)
  • cargo clippy -p victory-gpu -p victory --all-targets --locked — exit 0, 0 warnings in changed files (main has pre-existing clippy warnings in untouched files)
  • cargo test -p victory-gpu --locked pool:: — 9 passed, 0 failed
  • cargo test -p victory-gpu --locked resource:: — 18 passed, 0 failed
  • cargo test -p victory --locked — 23 passed + 2 passed, 0 failed
**@⁠Kikoarl** on GitHub · 2026-11-27 21:55 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/399) `Kikoarl:feat/pool-gate` → `main` · +658 −57 · 6 files · 1 commits · open ### Summary Ports `VICTORY_POOL_GATE` and `VICTORY_POOL_FULLEST` from `fxceless/victory-fork` commit `2eade68cade9b2f8cd2511cc97328e83f58508c3` (`GPL-3.0-or-later`), rebased onto `main` (`df2daaf`). ### Changes - **`pool.rs`, `resource.rs`**: Allocate a new 64 MiB texture block only while card real use + new block + buffer-copy reserve + `targets_to_come` remains at or below the texture budget line (`VICTORY_POOL_GATE=0` disables). Otherwise reuse free pieces or defer waitable heap textures while keeping headroom + one block free during idle sweeps so the gate does not deadlock. Adds optional fullest-block-first placement (`VICTORY_POOL_FULLEST=1`; `play.rs` defaults to `0` first-fit). - **`draw.rs`, `host.rs`**: Defer heap texture slots when no free piece fits and the gate is closed, track `HEAP_TEXTURES_NO_PLACE` / `pool::BLOCKS`, and log `texture blocks: ...` alongside `room_terms`. - **`shadow.rs`, `apps/victory/src/play.rs`**: Enforce `targets_to_come` reserve (`VICTORY_CARD_ROOM_FOR_TARGETS_MB`) in `by_address_room` for title memory by address. Because `main` already routes arenas through `shadow::by_address`, `memory.rs` is left untouched and merged PR #88 is preserved. Distinct from PR #79 (`VICTORY_POOL_STATS` logging) and PR #209 (window heap hole reuse). ### Verification Verified on Windows (`x86_64-pc-windows-msvc`) against `main` (`df2daaf`): - `git diff --check main..HEAD` — clean - `cargo test -p xtask --locked` — 6 passed, 0 failed (`asset policy: 287 files ok`) - `cargo clippy -p victory-gpu -p victory --all-targets --locked` — exit 0, 0 warnings in changed files (`main` has pre-existing clippy warnings in untouched files) - `cargo test -p victory-gpu --locked pool::` — 9 passed, 0 failed - `cargo test -p victory-gpu --locked resource::` — 18 passed, 0 failed - `cargo test -p victory --locked` — 23 passed + 2 passed, 0 failed
Port VICTORY_POOL_GATE from fxceless/victory-fork commit 2eade68cade9b2f8cd2511cc97328e83f58508c3 onto trustno1-victory main (f3534e6).

- pool, resource: make a new 64 MiB texture block only while card real use + block + buffer-copy reserve + render targets still to come stays at or under the texture line (VICTORY_POOL_GATE=0 disables); otherwise reuse free pieces or defer waitable heap textures, keeping 2-5% + one block free during idle sweeps so the gate does not deadlock. Support fullest-block-first placement (VICTORY_POOL_FULLEST; launcher keeps first-fit).

- draw, host: defer heap texture slots with no free piece when the gate closes, track HEAP_TEXTURES_NO_PLACE and pool::BLOCKS, and log 'texture blocks: ...' alongside room_terms.

- shadow: enforce targets_to_come reserve in by_address_room for title memory by address (memory.rs routes arenas through shadow::by_address on main, so no memory.rs change is needed and PR #88 is preserved).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 21:58:18 +00:00
Author
Owner

@⁠CuteBooty on GitHub · 2026-11-27 22:55 UTC · original

Test data from an 8 GB card, in case it helps the review. I ran the same gate today before seeing this PR.

Important: this is not this branch. It is my own local port of the gate from fxceless/victory-fork 2eade68c onto f3534e6b (pool.rs, resource.rs, the draw.rs hunk, the texture blocks: line). Differences from this PR that I know of: the by-address (ray arena) room term is left out, and shadow.rs / memory.rs are untouched. I have not built or run this PR's code.

Setup: RTX 3070 8 GB (DXGI budget 7,250 MB), Ryzen 7 5800X3D, 32 GB, Windows 11. Series S profile, 1920x1080, no DLSS, no frame generation, ray tracing off, built from source. VICTORY_POOL_GATE at its default (on), VICTORY_POOL_FULLEST=0, VICTORY_CARD_ROOM_FOR_TARGETS_MB at its default (3072). 39 minutes of ordinary story play with a lot of driving, one session.

What the texture blocks: line said over the session:

minute blocks made (MB) blocks not made made without room "in use" sum against the line
0 3 (192) 0 0 708 MB 4,483 / 6,525 MB
5 36 (2,304) 2 0 5,561 MB 7,371 / 6,352 MB
10 41 (2,624) 34,302 5 6,075 MB 7,763 / 6,352 MB
15 46 (2,944) 44,844 10 6,483 MB 8,138 / 6,352 MB
20 48 (3,072) 45,376 12 6,874 MB 8,276 / 6,352 MB
36 48 (3,072) 45,376 12 7,072 MB 8,238 / 6,352 MB

What I read from it:

  • The gate does act on this card: it closes about five minutes in and refuses 45,376 blocks.
  • The card still fills. "In use" goes from 5.6 GB when the gate closes to 7.1 GB, against a budget of 7.25 GB. Twelve blocks "made without room" account for 768 MB of that rise; the other roughly 740 MB is not texture blocks, so something the gate does not weigh keeps growing here.
  • Texture blocks are 3.1 GB of the 7.1 GB in use at the end. On 8 GB the gate controls less than half of what is on the card.
  • "The card has no room" lines: 2,442 in 39 minutes (63 a minute). Without the gate, on an older base (d12eb1b2 plus the #58 fix) and a different route, a 60-minute session gave 4,317 (72 a minute). Different base and route, so I would not call that a difference.
  • By eye: textures still dropped out, worst while driving.
  • No crash, exit normal.

Frame times in that session, for what one run is worth: 55 / 60 / 70 / 78 ms at 3-5k / 5-7k / 7-9k / 9-11k draws a frame.

Caveats: one session; VICTORY_DYNAMIC_WAIT=1 and VICTORY_THIN_GATE=1 from the same fork were also on (the dynamic-slot wait never triggered: 0.00 draws a frame found no slot), so this is not the gate alone. Not tested: VICTORY_CARD_ROOM_FOR_TARGETS_MB at a lower value, VICTORY_POOL_FULLEST=1, Series X, DLSS.

I can post the log lines or rerun with other settings if that is useful.

Measurements and this note were prepared with an AI assistant (Claude Code); the session was played on my machine.

**@⁠CuteBooty** on GitHub · 2026-11-27 22:55 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/399#issuecomment-7229729749) Test data from an 8 GB card, in case it helps the review. I ran the same gate today before seeing this PR. **Important: this is not this branch.** It is my own local port of the gate from `fxceless/victory-fork` `2eade68c` onto `f3534e6b` (`pool.rs`, `resource.rs`, the `draw.rs` hunk, the `texture blocks:` line). Differences from this PR that I know of: the by-address (ray arena) room term is left out, and `shadow.rs` / `memory.rs` are untouched. I have not built or run this PR's code. Setup: RTX 3070 8 GB (DXGI budget 7,250 MB), Ryzen 7 5800X3D, 32 GB, Windows 11. Series S profile, 1920x1080, no DLSS, no frame generation, ray tracing off, built from source. `VICTORY_POOL_GATE` at its default (on), `VICTORY_POOL_FULLEST=0`, `VICTORY_CARD_ROOM_FOR_TARGETS_MB` at its default (3072). 39 minutes of ordinary story play with a lot of driving, one session. What the `texture blocks:` line said over the session: | minute | blocks made (MB) | blocks not made | made without room | "in use" | sum against the line | |---|---|---|---|---|---| | 0 | 3 (192) | 0 | 0 | 708 MB | 4,483 / 6,525 MB | | 5 | 36 (2,304) | 2 | 0 | 5,561 MB | 7,371 / 6,352 MB | | 10 | 41 (2,624) | 34,302 | 5 | 6,075 MB | 7,763 / 6,352 MB | | 15 | 46 (2,944) | 44,844 | 10 | 6,483 MB | 8,138 / 6,352 MB | | 20 | 48 (3,072) | 45,376 | 12 | 6,874 MB | 8,276 / 6,352 MB | | 36 | 48 (3,072) | 45,376 | 12 | 7,072 MB | 8,238 / 6,352 MB | What I read from it: - The gate does act on this card: it closes about five minutes in and refuses 45,376 blocks. - The card still fills. "In use" goes from 5.6 GB when the gate closes to 7.1 GB, against a budget of 7.25 GB. Twelve blocks "made without room" account for 768 MB of that rise; the other roughly 740 MB is not texture blocks, so something the gate does not weigh keeps growing here. - Texture blocks are 3.1 GB of the 7.1 GB in use at the end. On 8 GB the gate controls less than half of what is on the card. - "The card has no room" lines: 2,442 in 39 minutes (63 a minute). Without the gate, on an older base (`d12eb1b2` plus the #58 fix) and a different route, a 60-minute session gave 4,317 (72 a minute). Different base and route, so I would not call that a difference. - By eye: textures still dropped out, worst while driving. - No crash, exit normal. Frame times in that session, for what one run is worth: 55 / 60 / 70 / 78 ms at 3-5k / 5-7k / 7-9k / 9-11k draws a frame. Caveats: one session; `VICTORY_DYNAMIC_WAIT=1` and `VICTORY_THIN_GATE=1` from the same fork were also on (the dynamic-slot wait never triggered: 0.00 draws a frame found no slot), so this is not the gate alone. Not tested: `VICTORY_CARD_ROOM_FOR_TARGETS_MB` at a lower value, `VICTORY_POOL_FULLEST=1`, Series X, DLSS. I can post the log lines or rerun with other settings if that is useful. Measurements and this note were prepared with an AI assistant (Claude Code); the session was played on my machine.
Author
Owner

@⁠ArturoWolff on GitHub · 2026-11-28 00:10 UTC · original

Independent Linux/Proton test of this PR's actual source delta on an 8 GB card (rather than a different port). RTX 4060 desktop, 16 GB host RAM, NVIDIA driver 620.73.04, GE-Proton11-14/vkd3d-proton 3.2.0 (cae8353ed7959c4+).

Receiver: 64d4931b3dd90305134512b805fc98f04119fb6e (v2026.11.27.8), with the same three compatibility fixes in both arms described in #357. Candidate adds Kikoarl's 11a44a1fa9a13fa75d117ec78d2db47533849886 delta against df2daafeb1b2170931cf7a6eddff6de254841d9c, ported from fxceless 2eade68cade9b2f8cd2511cc97328e83f58508c3 (GPL-3.0-or-later). Applied cleanly; locked offline MSVC release build passed in 1m43s. Combined candidate patch SHA-256 faa299b7e3dd06cf67c3015ca9c3a5a3e35a492c746a521ab61d7e058983775d.

Both launches used separate copies of the same private profile, fresh engine/external caches, Wine Windows 11 mode (the startup workaround described in #120), Series X, 1080to1440 (1440p swap chain, 1080p client), DLSS/FG off for this diagnostic, water light/BVH enabled, full write-back, waits on, no explicit pass omissions or Bink skipping. Both showed the account picker and received one explicitly gated A input. Effective engine switch headers differ only by the added VICTORY_POOL_FULLEST=0 default; the block gate defaults on in the candidate. Earlier pre-engine timeouts occurred in both builds and are excluded from this rendering comparison.

Observation Three-fix control Plus #399
Texture queue room samples 15 16
Samples saying no room / new textures wait 2 2
Highest observed queue accounting / its line (log MB) 6514 / 6198 6548 / 6198
Minimum available host RAM (MiB) 2767.5 1892.2
Elapsed wall time (s, including startup and input wait) 161.858 165.719
Actual child exit 5 5

The candidate's last block report showed 30 blocks (1920 MB), 71 MB free; its prospective new-block sum 6732 MB against 6198 MB, with the admission message saying no new block and reuse free pieces. However, the cumulative counts were still 0 blocks not made for want of room, 0 made without room, 0 given back, 0 texture-placement waits. Thus the policy was observed closed at the final sample but this short workload did not witness an actual refused block request. The separate texture-queue accounting has a different free-space term (120 MB at that sample); these lines are sampled diagnostics, not a hard physical VRAM cap.

Both runs progressed through loading artwork to black frames, then exit 5, with the same one unsupported Wave64 compute translation and no missing clamp/compare/library warning. No new host OOM kill, recorded kernel GPU fault or 256 MiB guard stop; temporary backing directories empty after retirement. This is a matched startup/load comparison, not a world-play benchmark or a texture-fidelity verdict. It does not demonstrate memory savings or a fix for the black screen on this workload; the gate needs a longer allocation-heavy world run before drawing that conclusion. The comparable negative result is retained so we do not attribute the pre-existing load failure to this PR.

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

**@⁠ArturoWolff** on GitHub · 2026-11-28 00:10 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/399#issuecomment-7230708269) Independent Linux/Proton test of this PR's actual source delta on an 8 GB card (rather than a different port). RTX 4060 desktop, 16 GB host RAM, NVIDIA driver 620.73.04, GE-Proton11-14/vkd3d-proton 3.2.0 (`cae8353ed7959c4+`). Receiver: `64d4931b3dd90305134512b805fc98f04119fb6e` (v2026.11.27.8), with the same three compatibility fixes in both arms described in [#357](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/issues/357). Candidate adds Kikoarl's `11a44a1fa9a13fa75d117ec78d2db47533849886` delta against `df2daafeb1b2170931cf7a6eddff6de254841d9c`, ported from fxceless `2eade68cade9b2f8cd2511cc97328e83f58508c3` (GPL-3.0-or-later). Applied cleanly; locked offline MSVC release build passed in 1m43s. Combined candidate patch SHA-256 `faa299b7e3dd06cf67c3015ca9c3a5a3e35a492c746a521ab61d7e058983775d`. Both launches used separate copies of the same private profile, fresh engine/external caches, Wine Windows 11 mode (the startup workaround described in [#120](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/120)), Series X, `1080to1440` (1440p swap chain, 1080p client), DLSS/FG off for this diagnostic, water light/BVH enabled, full write-back, waits on, no explicit pass omissions or Bink skipping. Both showed the account picker and received one explicitly gated A input. Effective engine switch headers differ only by the added `VICTORY_POOL_FULLEST=0` default; the block gate defaults on in the candidate. Earlier pre-engine timeouts occurred in both builds and are excluded from this rendering comparison. | Observation | Three-fix control | Plus #399 | |---|---:|---:| | Texture queue room samples | 15 | 16 | | Samples saying no room / new textures wait | 2 | 2 | | Highest observed queue accounting / its line (log MB) | 6514 / 6198 | 6548 / 6198 | | Minimum available host RAM (MiB) | 2767.5 | 1892.2 | | Elapsed wall time (s, including startup and input wait) | 161.858 | 165.719 | | Actual child exit | 5 | 5 | The candidate's last block report showed 30 blocks (1920 MB), 71 MB free; its prospective new-block sum 6732 MB against 6198 MB, with the admission message saying no new block and reuse free pieces. However, the cumulative counts were still **0 blocks not made for want of room, 0 made without room, 0 given back, 0 texture-placement waits**. Thus the policy was observed closed at the final sample but this short workload did not witness an actual refused block request. The separate texture-queue accounting has a different free-space term (120 MB at that sample); these lines are sampled diagnostics, not a hard physical VRAM cap. Both runs progressed through loading artwork to black frames, then exit 5, with the same one unsupported Wave64 compute translation and no missing clamp/compare/library warning. No new host OOM kill, recorded kernel GPU fault or 256 MiB guard stop; temporary backing directories empty after retirement. This is a matched startup/load comparison, not a world-play benchmark or a texture-fidelity verdict. It does not demonstrate memory savings or a fix for the black screen on this workload; the gate needs a longer allocation-heavy world run before drawing that conclusion. The comparable negative result is retained so we do not attribute the pre-existing load failure to this PR. AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).
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/399/head:github-bot/gh-399'
git switch 'github-bot/gh-399'

Merge

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