GPU: bound idle staging, shadow snapshot, arena, and list scratch pools #3442
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3442
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3442"
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?
@Luislariosss on GitHub · 2026-11-27 02:23 UTC · original
Luislariosss:feat/gpu-pool-bounds→main· +150 −40 · 3 files · 1 commits · openSummary
Bounds four idle GPU/host memory pools that previously retained over 1 GiB of Private Commit across steady-state frames:
texture.rs): lower defaultCHUNKS_KEPTfrom16(512 MiB ofD3D12_HEAP_TYPE_UPLOAD) to4(128 MiB), overridable viaVICTORY_TEXTURE_STAGING_CHUNKS, and lowerKEPT_BYTESfor oversized power-of-two staging buffers from64 MiBto16 MiB(still covering the 12.7 MiB movie upload path). Excess chunks are drained and dropped outsideCHUNKS.lock().shadow.rs): lower defaultPOOL_BYTESfrom512 MiBto128 MiB, overridable viaVICTORY_SHADOW_POOL_MB.shadow.rs): release completely empty 16 MiBArenaChunks pastARENA_SPARE = 1(preserving existingSliceindices viaOption<ArenaChunk>slots and dropping releasedID3D12Resources outsideARENA.lock()).host.rs): onHostList::reset(), trim grown scratch chunks past1 MiB(keeping at least the first chunk, and dropping excess chunks outsidescratch.lock()).Validation
cargo test -p victory-gpu --lib -- texture:: shadow:: host::tests::list_scratch: 14/14 passed (including new env-override and excess-arena-chunk release assertions).cargo clippy -p victory-gpu --all-targets -- -D warnings(default and--features diagnostics): clean.cargo xtask policy: 191 files ok.2,048frames presented,0errors):@Dukestar69 on GitHub · 2026-11-27 02:26 UTC · original · approved these changes
LGTM — verified on Windows (RTX 5090):
cargo test -p victory-gpu --lib shadow::(10/10),texture::(3/3, includingstaging_chunks_kept_defaults_to_four_and_respects_env), andhost::(34/34 excluding the pre-existingorigin/mainRTX 5090dynamic_slots_are_held_until_releasedfailure) all passedcargo clippy -p victory-gpu --all-targets -- -D warningspassed with 0 warningscargo xtask policypassed (191 files ok)Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@fuzeofficlal on GitHub · 2026-11-27 02:40 UTC · original · approved these changes
Looks good to me — clean, disciplined idle-pool trimming across scratch, snapshot, arena, and texture staging pools with proper lock-free resource drops and safe env-var parsing.
Review & Verification Notes
crates/victory-gpu/src/host.rs:1792-1812:HostList::resettrims scratch chunks past1 MiB(keeping at least one chunk) only when the list is idle, dropping excess chunks outsideself.scratch.lock().crates/victory-gpu/src/shadow.rs:120-148, 711-715, 1137-1295:VICTORY_SHADOW_POOL_MBusessaturating_mul(1 << 20)safely across0, invalid, and huge inputs;Arenatracks live slots asVec<Option<ArenaChunk>>, returns completely empty chunks pastARENA_SPAREto be dropped afterarena()releases the lock, reusesNoneholes without invalidating remainingSliceindices, and updateslog_viewsto iterateflatten().crates/victory-gpu/src/texture.rs:115-205:recycle()lowers default idle retention (KEPT_BYTES = 16 MiB,DEFAULT_CHUNKS_KEPT = 4, overridable viaVICTORY_TEXTURE_STAGING_CHUNKS) and drops excess chunks outsideCHUNKS.lock().5876166d:cargo xtask policypasses (191 files ok).cargo clippy -p victory-gpu(--lib,--tests, and--features diagnostics--lib/--tests,-D warnings) is clean.shadow::tests(9/9) andtexture::tests(3/3) pass on discrete D3D12 hardware (VICTORY_D3D12_DEBUG=1,VICTORY_D3D12_GBV=1) and WARP (--features diagnostics,VICTORY_D3D12_DEBUG=1,VICTORY_D3D12_WARP=1).pool_bytes_forbounds (0, negative, non-numeric,usize::MAX),Arenaempty-chunk eviction &None-slot reuse preserving live slice indices, andHostList::resettrimming 4 scratch chunks back down to 1 (524,288B).View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.