perf(sweeping): curb eviction budget overruns and fix BackOff/drain edge cases #5
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/MahanYTT--VIctory-MA!5
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-5"
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?
@MahanYTT on GitHub · 2026-12-04 17:39 UTC · original
MahanYTT:perf/slot-evict-fix→mega-upgrade-v3· +197 −53 · 2 files · 2 commits · merged 2026-12-04 20:18 UTCSummary
Addresses the texture-sweep / slot-eviction overhead observed in the 170s RTX 5070 Ti playtest log (
VICTORY_SLOT_EVICT=1,VICTORY_TEX_PARK=1,VICTORY_TEXTURE_POOL=1), where 51 idle-texture sweep looks averaged 3.00 ms (max 16.4 ms, 42/50 walks hitting the 3 ms budget) whileVICTORY_SLOT_EVICTreclaimed 0 textures (0 MB) across 68,918 idle-looking textures (28,832 bindless-pinned).Root Causes & Changes in
crates/victory-gpu/src/sweeping.rsHELD_MStoo short (5_000ms →30_000ms): With 68,918 textures and 28,832+ bindless-pinned textures, a 5 s hold-skip window expired before the next sweep, forcingresource::let_go_idleto repeatedly collect, sort, and lock-check the same pinned textures on every sweep. RaisingHELD_MSto 30 s aligns it withVICTORY_SLOT_EVICT_BACKOFF_MS.CLOCK_EVERYbudget overshoot (64→32): Polling the clock every 32 entries instead of 64 halves time-budget overshoot when per-entry visits acquire per-texture locks.timed_out = trueinevict_window_drain:out_of_time()was checked before checking whethercandidateshad any remaining items. If the deadline expired while processing the final candidate,timed_outwas set totruedespite zero candidates remaining, which causedEvictionPass::rest_afterto refuse enteringBackOff.BackOff::overzero/small-budget bug &RISE_PERCENT(2→5): Whenbudget < 100(including0),budget / 100 * RISE_PERCENTevaluated to0, makingused >= self.used.saturating_add(0)unconditionallytrueand cancelling backoff immediately. Guarded withrise > 0and raisedRISE_PERCENTto 5% (~730 MB on a 14.6 GB budget) to avoid early wake-ups on normal frame-to-frame VRAM jitter.Unit Tests Added (
crates/victory-gpu/src/sweeping.rs)evict_window_drain_does_not_report_timeout_when_queue_is_exhaustedbackoff_does_not_end_early_when_budget_is_zero_or_smallVerification
crates/victory-gpu/src/sweeping.rslocally withrustc --edition 2024 --test(17/17 passing).windows-latestCI validation (cargo clippy --workspace --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings&cargo test --workspace --locked).