GPU: committed host textures past the budget are evicted and kept, no… #2872
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2872
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2872"
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?
@mitaka1959 on GitHub · 2026-11-25 22:51 UTC · original
mitaka1959:claude/compassionate-cerf-n9485q→main· +1205 −96 · 7 files · 1 commits · openPast the card's budget the eviction pass gave up (destroyed) the least recently used host textures fed from title memory, and their next use made them again from title memory, detiled and uploaded. A committed one is now evicted instead (ID3D12Device::Evict): its contents and GPU address stay, and its next use only makes it resident again. Textures in heaps of textures cannot be evicted on their own (residency is the heap's) and are given up as before, as are idle textures (two minutes and 300 frames unused).
No GPU work reaches an evicted texture. The textures a submission's lists name are made resident before they run. The pass leaves the heap slots viewing a texture null before it evicts it, a use makes a texture resident before a view of it is made, and a slot made while a pass picked or evicted its texture is checked once it holds it. If the device refuses to make textures resident, others are evicted first; refused again, the run ends instead of faulting the GPU. Each texture's residency changes together with its device call, under one lock, so the device's count stays 1 or 0.
The policy (which textures go, the budget marks, the address-space check) lives in residency.rs with tests that need no GPU, among them every order of passes and uses; GPU tests cover an eviction, a use, a list recorded before the eviction and a heap slot. The first eviction of a run logs the card's use before and after, and if evicting did not lower it, textures are given up from then on. Diagnostics builds take VICTORY_VRAM_BUDGET_MB (a smaller budget) and VICTORY_GIVE_UP_TEXTURES (the old behaviour, for comparing runs).
@Marvisak on GitHub · 2026-11-26 04:25 UTC · original
Automated triage for the maintainers.
Needs work. This evicts committed host textures past the budget (
ID3D12Device::Evict) instead of destroying them, and makes them resident again on next use (residency.rs,Resource::host,HostHeap::check_resident,Host::execute). The design holds together on paper, but it changes GPU resource lifetime and needs evidence from hardware: a title run withVICTORY_VRAM_BUDGET_MBlow enough to force evictions, showing the eviction lines, per-frame evict/resident counts, no device removal, and fewer remade textures than withVICTORY_GIVE_UP_TEXTURES=1. Please also say whether GPU work outsideHost::execute's lists (copy-queue uploads, present blits) can name a texture when it is evicted, and whethervideo_memory()right afterEvictreliably shows the drop.CI: passing.
Generated by Claude Code
@kotekompotek on GitHub · 2026-11-25 22:53 UTC · original · reviewed
The budget plumbing checks out: check_resident fires exactly where a slot starts holding a texture, the evict-vs-give-up split is env-gated with documented semantics (evicted-and-kept default, given-up under VICTORY_GIVE_UP_TEXTURES), and the README entries match the implementation. Coherent with the #2870 series. LGTM.
@fuzeofficlal on GitHub · 2026-11-25 23:37 UTC · original · reviewed
Verified head
f5497882cleanly merged ontoorigin/main(63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + D3D12 WARP +VICTORY_D3D12_DEBUG=1).Architecture & Concurrency Audit
RESIDENT(0) <-> PICKED(1) -> EVICTED(2)happen underresidency::LOCKpaired withEvict/MakeResident, keeping device residency counts strictly in{0, 1}(well covered by the exhaustive interleaving testresidency_counts_stay_one_or_zero_in_every_order).resource::evict_unused()runs underHost::execute'ssubmittedlock after prior GPU work is idle; previously recorded lists referencing evicted textures are made resident byresidency::before_running(runs)beforeExecuteCommandLists(withmake_roomretry +host::failguard); anddescriptor::evictclears shader-visible heap slots to null prior todevice.Evictso bindless shaders cannot touch evicted resources.descriptorreleaseskeptand may acquireresidency::LOCKundermade, whileresidencycallsdescriptor::evictandresource::make_roomonly after releasingresidency::LOCK.FIRSTeffectiveness check inresidency::evictpermanently setsINEFFECTIVE = trueif system-widevideo_memory()drops by less thanbytes / 4across the firstEvict. Concurrent VRAM allocations by another process during that window could trigger a false-positive permanent fallback to drop-on-evict.Local Verification (
VICTORY_D3D12_DEBUG=1)residency::13/13,resource::tests17/17,descriptor::tests7/7,draw::tests20/20,host::tests30/31 (only the pre-existingdynamic_slots_are_held_until_released1M view cap baseline).residency::13/13,resource::tests17/17,host::tests31/31.cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--features diagnostics) &cargo xtask policy(192 files ok): clean.Solid design and verification.
@potatoe0100 on GitHub · 2026-11-26 14:21 UTC · original
Tested
f5497882merged ontomain(63bcca4) on an RTX 4060 8 GB (driver 621.14, Windows 11, Resizable BAR on), which is the kind of card this is for.cargo test -p victory-gpu --lib: 241 passed, 2 failed. The 2 are the known NVIDIA heap-cap failures thatmainalso has on this card (dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views). All 13residency::tests pass, including the three device tests.video_memory()afterEvict: I wrote a throwaway probe (not part of this PR) that makes 4 x 256 MB default-heap buffers, then evicts them and makes them resident again. LocalCurrentUsagewent 12 to 1086 MB after creating them, fell straight back to 12 MB on the very nextQueryVideoMemoryInfoafterEvict(same again 200 ms later), and went back to 1086 MB afterMakeResident. So on this NVIDIA driver the drop shows at once. The local budget on this card is 7,537 MB.Host::execute:queue.rspresentgets its planes throughresource::host_resource, soResource::hostcallsmake_residentthere. But if thatMakeResidentis refused, nothing else catches it.presentrecords and runs its own copy list, sobefore_runningnever sees those planes, and the blit would read an evicted texture. Amake_roomand retry there (or not evicting a texture presented in the last few frames) would cover it.AI-assisted (Claude).
View 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.