fix(victory): deduplicate prepare queue slots and refcount waiting slots #442
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!442
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-442"
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 18:53 UTC · original
mauroalvare:fix/victory-prepare-slot-dedup→main· +238 −21 · 1 files · 2 commits · closed without mergingChange
Fixes two slot-tracking leaks in
victory-gpu's background texture preparation queue (third_party/victory/crates/victory-gpu/src/texture/prepare.rs):Duplicate slots & pinned
Arc<Staging>/ budget leak whenfinish()replaces a same-mipReadyentry:finish()calledq.hint(&slots)before mergingslots.append(&mut old.slots)and callingq.gone(&old). Becauseappendemptiedold.slots,q.gone(&old)did not callunhintonold's slots, leaving any slot shared betweenslotsandold.slotsduplicated inReady.slotsand double-counted inready_slots.take_ready()orserved()served that slot,iter().position(...)removed only one occurrence, leaving the entry inq.readywith itsArc<Staging>upload buffer pinned inSTAGED(preventing return toSTAGE_POOL),q.outstandinginflated againstVICTORY_TEXTURE_STAGE_MB, andprepare::slot(slot)stuck reportingSlot::Readyuntilprune()evicted it after 2+ seconds.oldviaq.gone(old)first, merge only non-duplicate slots fromold.slots, and then callq.hint(&slots)once for the deduplicated set.Premature
waitingremoval and duplicatependingentries across concurrent jobs:Queue::waitingwas aHashSet<u32>, so finishing one pending job unconditionally removedslotfromq.waitingeven if another pending job still listedslot, andlook()pushedslotintoq.pending[key]without checking whether it was already present.Queue::waitingas a per-slot refcount (HashMap<u32, u32>, mirroringready_slots) viawait()/unwait(), and skip duplicate pushes inlook().Verification
Base SHA:
c3cc02932fc596ee9d937e5743f73007c538365a(LooperSalty/AnyXboxX:main).Hardware: Windows x64, Ryzen 7 9700X, NVIDIA GeForce RTX 5070 Ti (15995 MiB VRAM, driver
32.0.16.2140), 32 GB RAM.Regression test — Base vs Fix (synthetic 1024×1024 RGBA8 4 MiB texture on RTX 5070 Ti)
Command:
c3cc029) — FAILS:Additional checks
Oracle and test data
resource::create_committed+ realStagingupload buffers viatexture::prepared_stagingon the local RTX 5070 Ti.texture::prepare::tests::replacing_ready_deduplicates_slots_and_releases_stagingfails onc3cc029(leaking 1Readyentry, 4 MiB inq.outstanding, 4 MiB inSTAGED,Arc<Staging>refcount = 1, and staleSlot::Ready) and passes with this fix (0leaked across all metrics).Checklist
E_NOTIMPL), never a fake success.This change was investigated, implemented, and verified with AI assistance.
@LooperSalty on GitHub · 2026-11-26 23:08 UTC · original
Closing after #454 moved
third_party/victoryto the Vice-Tay base (TaynanGT/Vice-Tay a252348).texture/prepare.rsdoes not exist on the new base; Vice-Tay's texture queue (texture/ahead.rs) works differently.Thanks for the work. If you measure a gain on the new base, a new PR against
mainis welcome.🤖 Closed by Claude Code on behalf of the maintainer
Pull request closed