Repository navigation
GPU: committed host textures past the budget are evicted and kept, no… - #2872
mitaka1959 wants to merge 1 commit into
Conversation
…t given up Past 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). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GgVYzJwCz6RmvFNMHeHDWR
kotekompotek
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Verified head f5497882 cleanly merged onto origin/main (63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + D3D12 WARP + VICTORY_D3D12_DEBUG=1).
Architecture & Concurrency Audit
- State machine & D3D12 residency count: Transitions among
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). - In-flight & bindless safety:
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. - Lock ordering: Acyclic —
descriptorreleaseskeptand may acquireresidency::LOCKundermade, whileresidencycallsdescriptor::evictandresource::make_roomonly after releasingresidency::LOCK. - Minor observation (non-blocking): The one-shot
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)
- RTX 5090:
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). - WARP:
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.
|
Automated triage for the maintainers. Needs work. This evicts committed host textures past the budget ( CI: passing. Generated by Claude Code |
Past 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).