GPU: guard real VRAM budget margin in room() (VICTORY_ROOM_REAL, from FoxHound v0.8) #1888

Merged
Nosheboo merged 1 commit from upstream-pr/1888 into main 2026-11-29 08:16:52 +00:00
Nosheboo commented 2026-11-29 01:42:40 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Nosheboo on 2026-11-29T01:42:40Z.


Fixes #

What it changes

Ports VICTORY_ROOM_REAL (REAL_MARGIN, real_budget_blocks(), and room_allowed()) from readmet3xt-lab/foxhound commit 4349ab56 (GPL-3.0-or-later) into crates/victory-gpu/src/resource.rs (room()).

  • Reserves a 256 MiB (REAL_MARGIN) headroom margin below DXGI's real VRAM budget in room() (used >= budget.saturating_sub(REAL_MARGIN), inclusive) so texture/host allocations back off or evict instead of pushing the device into 0x887A0006 (DXGI_ERROR_DEVICE_REMOVED) when real VRAM nears capacity.
  • Opt-out / legacy behavior switch: set VICTORY_ROOM_REAL=0 (via crate::toggled!("VICTORY_ROOM_REAL")) to restore the prior behavior.
  • Scope is strictly limited to crates/victory-gpu/src/resource.rs.

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): NVIDIA GeForce RTX 4070 Ti (12 GiB), Windows 11 — unit tests, clippy, and rustfmt verified locally; live in-game telemetry A/B pending after merge/release testing.
  • Before: room() did not enforce a real VRAM margin check below DXGI's reported real budget when credited allocations were checked.
  • After: room() blocks new allocations once real VRAM usage reaches budget.saturating_sub(256 MiB) unless VICTORY_ROOM_REAL=0; verified by resource::tests::real_budget_blocks_near_or_over_vram_budget covering headroom, inclusive budget - 256 MiB boundary, over-budget, VICTORY_ROOM_REAL=0 bypass, credited == false, u64::MAX, and 0.
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A (no shader changes).
  • cargo test passed for the crates it touches: yes
    • cargo test -p victory-gpu --lib --locked -- --test-threads=1 on de2d4ba: 590 passed; 0 failed; 44 ignored (--test-threads=1 used due to pre-existing parallel watch flake #724; VICTORY_HOME/LOCALAPPDATA isolated, VICTORY_STREAMLINE_DIR unset).
    • cargo clippy -p victory-gpu --no-deps --all-targets --locked: 0 warnings in touched lines of crates/victory-gpu/src/resource.rs (only pre-existing baseline warnings elsewhere in victory-gpu).
    • rustfmt --edition 2024 --config-path rustfmt.toml: 0 formatting diffs on touched lines in crates/victory-gpu/src/resource.rs.
    • Note: cargo xtask policy fails on pre-existing untouched crates/victory-shader/src/emit/lower.rs (> 655,360 bytes) already present on main (#1460/#1493/#1527).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. No duplicate open PR ports VICTORY_ROOM_REAL in crates/victory-gpu/src/resource.rs.

Council review

Reviewer Model Round 1 Round 2 Verdict
Concurrency & Safety Auditor gpt-6-luna (xhigh) 8/10 (C2 inclusive >= boundary) 9/10 (C2 resolved) APPROVE
Performance & Modernization Architect gpt-6-luna (xhigh) 8/10 (stacked nosh-perf) 8/10 (verified) APPROVE
Upstream PR Hygiene & Test Critic gpt-6-luna (xhigh) 7/10 (H1 baseline, H2–H3, H5) 9/10 (H1 acknowledged baseline, H2–H5 resolved) APPROVE

Created with Gemini Pro Orchestrator (Neon) and reviewed by GPT-6 Luna (xhigh) in T3 Code.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5546523283 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1888). Originally posted by [Nosheboo](https://github.com/Nosheboo) on 2026-11-29T01:42:40Z. --- Fixes # ## What it changes Ports `VICTORY_ROOM_REAL` (`REAL_MARGIN`, `real_budget_blocks()`, and `room_allowed()`) from `readmet3xt-lab/foxhound` commit `4349ab56` (GPL-3.0-or-later) into `crates/victory-gpu/src/resource.rs` (`room()`). - Reserves a 256 MiB (`REAL_MARGIN`) headroom margin below DXGI's real VRAM budget in `room()` (`used >= budget.saturating_sub(REAL_MARGIN)`, inclusive) so texture/host allocations back off or evict instead of pushing the device into `0x887A0006` (`DXGI_ERROR_DEVICE_REMOVED`) when real VRAM nears capacity. - Opt-out / legacy behavior switch: set `VICTORY_ROOM_REAL=0` (via `crate::toggled!("VICTORY_ROOM_REAL")`) to restore the prior behavior. - Scope is strictly limited to `crates/victory-gpu/src/resource.rs`. ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): NVIDIA GeForce RTX 4070 Ti (12 GiB), Windows 11 — unit tests, `clippy`, and `rustfmt` verified locally; live in-game telemetry A/B pending after merge/release testing. - Before: `room()` did not enforce a real VRAM margin check below DXGI's reported real budget when `credited` allocations were checked. - After: `room()` blocks new allocations once real VRAM usage reaches `budget.saturating_sub(256 MiB)` unless `VICTORY_ROOM_REAL=0`; verified by `resource::tests::real_budget_blocks_near_or_over_vram_budget` covering headroom, inclusive `budget - 256 MiB` boundary, over-budget, `VICTORY_ROOM_REAL=0` bypass, `credited == false`, `u64::MAX`, and `0`. - For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A (no shader changes). - `cargo test` passed for the crates it touches: yes - `cargo test -p victory-gpu --lib --locked -- --test-threads=1` on `de2d4ba`: `590 passed; 0 failed; 44 ignored` (`--test-threads=1` used due to pre-existing parallel watch flake #724; `VICTORY_HOME`/`LOCALAPPDATA` isolated, `VICTORY_STREAMLINE_DIR` unset). - `cargo clippy -p victory-gpu --no-deps --all-targets --locked`: 0 warnings in touched lines of `crates/victory-gpu/src/resource.rs` (only pre-existing baseline warnings elsewhere in `victory-gpu`). - `rustfmt --edition 2024 --config-path rustfmt.toml`: 0 formatting diffs on touched lines in `crates/victory-gpu/src/resource.rs`. - Note: `cargo xtask policy` fails on pre-existing untouched `crates/victory-shader/src/emit/lower.rs` (> 655,360 bytes) already present on `main` (`#1460`/`#1493`/`#1527`). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. No duplicate open PR ports `VICTORY_ROOM_REAL` in `crates/victory-gpu/src/resource.rs`. ## Council review | Reviewer | Model | Round 1 | Round 2 | Verdict | | --- | --- | --- | --- | --- | | Concurrency & Safety Auditor | `gpt-6-luna` (`xhigh`) | 8/10 (`C2` inclusive `>=` boundary) | 9/10 (`C2` resolved) | APPROVE | | Performance & Modernization Architect | `gpt-6-luna` (`xhigh`) | 8/10 (stacked `nosh-perf`) | 8/10 (verified) | APPROVE | | Upstream PR Hygiene & Test Critic | `gpt-6-luna` (`xhigh`) | 7/10 (`H1` baseline, `H2`–`H3`, `H5`) | 9/10 (`H1` acknowledged baseline, `H2`–`H5` resolved) | APPROVE | Created with Gemini Pro Orchestrator (Neon) and reviewed by GPT-6 Luna (xhigh) in T3 Code.
amazedturnip commented 2026-11-29 05:38:57 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by amazedturnip on 2026-11-29T05:38:57Z.


Tested on RTX 5070 Ti 16 GB across 20+ min sessions. Real DXGI VRAM budget margin in room() works cleanly without false throttling or crashes.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7251377736 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1888#issuecomment-7251377736). Originally posted by [amazedturnip](https://github.com/amazedturnip) on 2026-11-29T05:38:57Z. --- Tested on RTX 5070 Ti 16 GB across 20+ min sessions. Real DXGI VRAM budget margin in room() works cleanly without false throttling or crashes.
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
trustno1-coder/VIctory-NVIDIA!1888
No description provided.