gpu: reclaim idle superseded and slot-pinned dead render targets #2361
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2361"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-11-29T12:21:32Z.
What it changes
Extends the periodic dead render-target sweep in
crates/victory-gpu/src/resource.rs,crates/victory-gpu/src/descriptor.rs, andcrates/victory-gpu/src/descriptor/host.rsto reclaim superseded and slot-pinned dead render targets (addressing the render-target VRAM growth tracked in #791):NEXT_DEAD_RT_SWEEPonly reclaimed placed render targets whose title memory was unmapped (!committed), so old render targets superseded by a newer target at the same title virtual address (TARGETS_AT/superseded) stayed in VRAM indefinitely because the new target keeps that VA committed.reclaim_dead_render_targetsnow also reclaims superseded non-null targets after 10 s / 60 frames idle (keeping 30 s / 60 frames for unmapped targets).twin'sArc::strong_countand COM reference count before reclaiming and includestwin.colour.bytesin reclaimed totals.TEXTURESlock soTARGETS_ATandSHADER_HEAPSnever nest underTEXTURES. For dead RTs withArc::strong_count == 1whose host resource is still pinned only by stale title descriptor slots (references > 1), queriesdescriptor::evictable_dead_rt_slots(skipping any slot shown by a draw table or marked by sampled-marks since the 10 s cutoff, or held by non-title/sampler slots), resets only slots still holding that exactexpected_rawresource pointer viaHostHeap::texture_slot_evicted(index, Some(expected_raw))without re-queuing them into the sampled texture pass, and restores slots viadescriptor::texture_madeif concurrent reuse occurred.How it was tested
let_go_idle(), causing steady render-target VRAM growth on 8 GB GPUsdead_rt_reclaimable_policy_matrix,reclaim_dead_render_targets_frees_idle_superseded_and_keeps_newest_and_recent, fullresource::tests::&descriptor::tests::, and live 8 GB RTX 3060 Ti sessionscargo testpassed for the crates it touches: yes (cargo test -p victory-gpu --lib --locked -- resource::tests:: descriptor::tests::— 62 passed, 0 failed, 1 ignored)Checked for overlap
slot_evict's filled-texture eviction oridle_sweep_policy, which are already onmain)