fix(victory): count mapped tile bytes for levels-on-demand VRAM accounting and eviction #287
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!287
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-287"
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?
@mauroalvare on GitHub · 2026-11-26 01:16 UTC · original
mauroalvare:fix/victory-tiled-vram-eviction→main· +76 −11 · 1 files · 3 commits · open## Change
In
third_party/victory/crates/victory-gpu/src/resource.rs, levels-on-demand host textures (HostTexture::new_tiled, enabled by default viaVICTORY_LEVELS_ON_DEMAND=1intools/lancer_victory.ps1) sethost.bytes = 0because their VRAM lives incrate::tiles::Tiled(given_bytes()).While
room()andcard_accounting()already accounted for tiled bytes, several eviction and VRAM-accounting paths still readhost.bytesdirectly (seeing0for every tiled texture):pressure_victims()(VICTORY_VRAM_EVICT) andslot_evict()(VICTORY_SLOT_EVICT) passed0bytes intooldest_covering(), causing sweeps under VRAM pressure to blow past the excess/rate cap and over-evict tiled textures (leading to unnecessary re-creation and re-upload thrashing).pressure_victims()also did not filter outcrate::texture::host_wrote(at)textures (whichlet_go_idle()skips), and both pressure paths considered 0-tile reserved textures that free 0 VRAM bytes.let_go_idle(),slot_evict(),account()(VRAM_KINDS),copy_state(),targets_census(), andcensus()all reported0bytes for levels-on-demand textures.This change adds
HostTexture::card_bytes()(returningtiled.given_bytes()for levels-on-demand textures andself.bytesotherwise), uses it across all eviction and reporting paths (without alteringHOST_TEXTURES[1]/KINDS[1]invariants used byroom()andtargets_room_kept()), skipshost_wroteand 0-byte copies during pressure selection, and adds an RTX-verified regression test.Verification
Base SHA:
c4c93bdc413191a9dc909998d2d53080a3f0c880GPU:
NVIDIA GeForce RTX 5070 Ti(15995 MiB VRAM, driver32.0.16.2140), D3D12 Tiled Resources Tier 2+.Synthetic reproduction (
tiled_textures_account_vram_and_bound_pressure_eviction: 6 backed 1024×1024 RGBA8 11-mip levels-on-demand textures of 5,636,096 B each, 1 host-written tiled texture, and 1 unbacked 0-tile reserved texture, with eviction excess = 1.5× one texture = 8,454,144 B):c4c93bd)copy_statereported bytes05,636,096(5,504 KiB)VRAM_KINDS[1](filled placed)039,452,672(37.6 MiB)pressure_victimsselected (expected 2)8(all 6 backed + host-written + 0-tile)2(only the 2 oldest backed evictable)11,272,192B; 4 surviving textures read back identical texelsCommands run from
third_party/victory(Rust1.98.1):Note: Python tests (
pytest/ruff) were not modified because this PR only touchesthird_party/victory(covered by CIpolitique VIctoryandlint/pytest).Oracle and test data
resource::tests::tiled_textures_account_vram_and_bound_pressure_evictionusing D3D12CreateReservedResourceandUpdateTileMappingson the local RTX 5070 Ti.c4c93bdwithVICTORY_VRAM_EVICT=80):tiled_textures_account_vram_and_bound_pressure_evictionfails withcopy_state=0(expected5636096),VRAM_KINDS[1]=0(expected>= 39452672), andpressure_victims_total=8(backed=6, includes_host_written=true, includes_empty=true) instead of2.Checklist
E_NOTIMPL), never a fake success.Made with AI assistance (Antigravity / Gemini).
adb0aece5cto806d1419db@mauroalvare on GitHub · 2026-11-26 18:41 UTC · original
The branch was rebased while I was testing the resolution. I verified that its new head matches the tree I tested and that GitHub reports the PR as mergeable.
The resolved code counts mapped tile bytes and keeps main's lock release and resource-liveness checks in the slot-eviction path. All 17 resource tests passed on the RTX 5070 Ti. The pressure regression selected two backed textures and excluded the host-written and unbacked textures.
GitHub Actions for this revision.
806d1419dbto5635bea8965635bea896to3dd4104747View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.