Prioritize on-screen sampled textures and fix slot_evict on 8 GB GPUs #1763
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1763"
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 EduardoMFOliveira on 2026-11-28T23:58:31Z.
Summary
Follow-up fix for 8 GB GPUs on top of
d4b5d51(tested on an NVIDIA GeForce RTX 5060 Laptop 8 GB, Series S + DLSS + FrameGen 2x).Problems Observed
slot_evictreceivedidle_ms = 600_000(10 min) whileRINGonly stores 120 seconds, causingframe_atto returnNoneafter 2 minutes of play and disabling slot eviction.slot_evictran, holdingTEXTURESacrossevictable_slots()/evict_slots()caused an AB-BA deadlock withHostHeap::mirror(madelock ->TEXTURES), triggering the title's 30s watchdog.View::Shaderfirst uploads over the room line chargedreserve = 1byte instead of the texture's footprint, allowing VRAM to reach 7,937 MB on a ~7,054 MB budget (causing 1,600+ DLSSout of VRAM (39)failures and permanently black interior textures).Changes
VICTORY_SAMPLED_MARKS=1+VICTORY_SAMPLED_EVICT=1(apps/victory/src/play.rs,crates/victory-gpu/src/sampled.rs,crates/victory-gpu/src/descriptor/host.rs,crates/victory-gpu/src/draw.rs):sampled::sampled_lately()soTextureQueue::collect_due_and_census()wakesheldslots andDue::ordered()prioritizes textures shaders are actively sampling on screen.first_uploadindraw.rsonsampled_lately(index, 120)and usedresource::object_texture_bytes()forView::Shader.slot_evict&HostHeap::slots_showing(crates/victory-gpu/src/resource.rs,crates/victory-gpu/src/descriptor/host.rs):evict_idle_msinside the 120s ring window, alignedhigh/lowwatermarks withroom_line(budget) - face_headroom_bytes(), and droppedTEXTURESbefore callingevictable_slots()/evict_slots().tabled_out() && self.tabled_stamp(i) != 0inHostHeap::slots_showing.Results & Testing
cargo test --release -p victory-gpu: 550 passed; 0 failed (and 25 passed; 0 failed on-- slotafter the final deadlock fix).cargo build --release --locked -p victory: clean release build.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by joeypercia on 2026-11-29T04:52:12Z.
A data point for one part of this PR, the
drop(all)beforeevict_slotsinslot_evict. On currentmainthat lock order is a real deadlock, not only a cost.On an RTX 4070 Ti (12 GB),
main568c5e5, release, Series X, the run stalled 150 s in and ended with the title's watchdog (+0x23cf683). Thread stacks taken withcdb21 s into the stall show a ring of three locks:victory-submit:sweep→let_go_idle→slot_evict→evict_slots→texture_slot_evicted(Made::lock)TEXTURES(held byslot_evictto the end)Madelockvictory-views-*,victory-aside:HostHeap::mirror_inner→begun_before→placed_texture→texture_atMadelockPLACED_TEXTUREStexture_at→create_at_address→hand_out_resource(textures().insert)PLACED_TEXTURESTEXTURESLetting
TEXTURESgo beforeevict_slots, as this PR does, breaks the ring. It doesn't depend on the card being 8 GB: it showed on a 12 GB card, and it can show wherever slot eviction runs.I had opened #1969 with only that change, before I saw it here; I'm closing it as a duplicate of this part. Since this PR conflicts with
mainnow, it might be worth landing the lock-order part on its own. #1969's branch has it as one small commit (pins the candidates withadd_ref_alive/Heldinstead of re-taking the table per texture), if that helps.(Written with Claude Code, Claude Opus 5.5.)