gpu(resource): guard real VRAM budget margin in room() #144
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/144"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T15:28:11Z.
Guards
resource::room()against fragmented-block over-commitment incrates/victory-gpu/src/resource.rs:real_budget_blocks,room_allowed, andVICTORY_ROOM_REAL(default on;=0disables) withREAL_MARGIN = 256 MiBso fragmented free space inside existing texture blocks does not permit new texture allocations once process VRAM usage is within 256 MiB of budget (or over it).weighed(budget, used) < room_line(budget)headroom checks.real_budget_blocks_near_or_over_vram_budget.Verification
cargo +1.98.1-x86_64-pc-windows-gnu xtask policy(304 files ok)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu resource:: --locked(28 passed; 0 failed)cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets(--lockedand--features diagnostics --locked,-D warnings)Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T16:05:06Z.
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingReview Summary
Logic, arithmetic safety, and unit test coverage look solid, and CI is passing. Because this changes default VRAM budget/eviction gating (
VICTORY_ROOM_REALon by default), it warrants a local real-GPU smoke test before merging.Verified Changes (
crates/victory-gpu/src/resource.rs)room()/real_budget_blocks()/room_allowed(): Whenweighed_with(..., false) < room_line(budget)only succeeds whilefree = crate::pool::texture_room() > 0andused >= budget.saturating_sub(REAL_MARGIN)(256 MiB),VICTORY_ROOM_REAL(default on;=0disables) refuses new texture allocations and logs rate-limited telemetry (ROOM_REAL, first hit and every 20,000th). ExistingVICTORY_TEXTURE_BUDGET_MBandtexture_floor_bytesearly returns remain intact.weighed()/weighed_with()/weighed_bytes(): Applies the sameREAL_MARGINcondition whenVICTORY_ROOM_REALis enabled, raising weighed pressure toused.saturating_add(kept).max(line)solet_go_idle()androom_terms()stay consistent withroom()and can evict idle textures rather than stalling.saturating_sub/saturating_add), andreal_budget_blocks_near_or_over_vram_budgetcovers normal headroom,free == 0, the inclusive 256 MiB boundary, over-budget, toggle off,credited == false, and0/u64::MAXextremes.Note
free > 0) andVICTORY_ROOM_REALnear budget.Generated with Antigravity CLI (
agy).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T18:08:23Z.
Rebased onto
origin/main(9d8b3646, including#140and#145/#147) and addressed allminivi-triagefindings atbe71a80d:texture_room() > 0before attributing credit to block headroom (crates/victory-gpu/src/resource.rs):real_budget_blocks(credited, free_in_blocks, budget, used)to requirefree_in_blocks > 0, so budgets/lines wherefree_in_blocks == 0no longer trigger the guard or log"by free space in texture blocks alone".weighed()/let_go_idle()symmetrical withroom():weighed_bytes(budget, used, free, kept, line, room_real_on)used byweighed()(weighed_with): wheneverVICTORY_ROOM_REALblocks new allocations due to fragmented block free space near/over budget,weighed()returnsused.saturating_add(kept).max(line)(>= room_line(budget)), ensuringlet_go_idle()/vram_keep_below()sees the same pressure and sweeps idle textures instead of stallingroom().real_budget_blocks_near_or_over_vram_budgetunit test to coverfree == 0, fragmented block credit vs normal headroom,VICTORY_ROOM_REAL=0opt-out,weighed_bytessymmetry withlet_go_idle(), andu64::MAX/0boundaries.Local Verification
cargo +1.98.1-x86_64-pc-windows-gnu xtask policy:305 files okcargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked -- resource:::28 passed; 0 failedclippy --all-targets -- -D warnings(default and--features diagnostics): 0 warningsImported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T21:26:56Z.
Automated RTX 4060 Ti 8 GB Open-World A/B hardware verification PASSED (
playtest/wave5vsorigin/mainb1b6dc1,VICTORY_LEVELS_ON_DEMAND=0play-parity):cargo test(RTX 4060 Ti): 645 passed, 0 failed (victory39/39,victory-shaderemit::wave64_tests19/19 &lower19/19,victory-gpu568/568).scripts/verify-world.ps1, DLSS Quality + open-world save):9.4 fpsvs7.5 fps(+1.90 fps / +25%), min8.3 fpsvs0.8 fps, preparing53.6 msvs60.0 ms5760 MBvs6005 MB(-245 MB,0 MBover budget);no room for new oneshalved (9,000vs18,000);max_waitingdropped (36,432vs41,431)0mismatches (other_bytes=0, showed_another_view=0, failed=0vs5and2on baseline)mapped_rate1.63 ms/svs6.9 ms/s(-76%, max12.9vs51.9 ms)frame-5975.png,frame-5983.png),edge_energy=4.69vs3.88,near_black=0.02%,magenta=0.0%(and#1412bf6800showed zero visual artifacts).