Skip to content

perf(victory-gpu): reclaim idle surplus upload slabs from windowup pool - #404

Closed
Lewandox wants to merge 1 commit into
LooperSalty:mainfrom
Lewandox:perf/windowup-trim-idle-slabs
Closed

Lewandox wants to merge 1 commit into
LooperSalty:mainfrom
Lewandox:perf/windowup-trim-idle-slabs

Conversation

@Lewandox

Copy link
Copy Markdown
Collaborator

Summary

Reclaims idle surplus upload slabs from the transient-window upload pool (third_party/victory/crates/victory-gpu/src/windowup.rs + 1-line hook in host::sweep):

  1. Problem: With VICTORY_CARD_WINDOW_UPLOAD=1, windowup::alloc grows POOL.slabs in 16 MiB D3D12 upload slabs up to VICTORY_CARD_WINDOW_UPLOAD_MB (default 512 MiB) during loading/streaming bursts, and previously never released idle slabs once gameplay settled back to 1–2 active slabs.
  2. Fix:
    • Tracks last_used (crate::host::moment()) on each PooledSlab.
    • Adds windowup::let_go_idle() called from host::sweep() using the same adaptive ram_idle_ms + IDLE_FRAMES = 4 policy as shadow::let_go_idle() and texture::let_go_idle().
    • Always keeps the single most recently used slab warm so steady-state uploads never churn D3D12 resource creation, and releases any other slab with live == 0 (all Chunks already dropped after GPU completion in Host::card_done) outside the POOL mutex.
    • Updates POOLED and pool.cur accurately and logs reclaimed bytes via host::trail.
  3. Test: Adds windowup::tests::trim_idle_releases_unused_surplus_slabs_and_keeps_live_ones verifying live slabs are never evicted, idle surplus slabs are released and deducted from POOLED, and the last warm slab stays reusable.

Verification

  • cargo test -p victory-gpu --lib windowup::tests (default and --features diagnostics)
  • cargo xtask policy inside third_party/victory

@Lewandox

Copy link
Copy Markdown
Collaborator Author

Closing as obsolete after #409 (\windowup.rs\ was removed in the combined base). Keeping the PR queue clean.

@Lewandox Lewandox closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant