perf(gpu/mem): add safe title-private working-set trimming via VICTORY_TRIM_BELOW_MB (#276) #384
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: launcher
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
run report
security: hold
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs gpu test
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/Androtim--MiniVI!384
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-384"
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?
@Androtim on GitHub · 2026-12-03 10:43 UTC · original
Androtim:perf/safe-working-set-trim→main· +554 −3 · 6 files · 3 commits · merged 2026-12-03 11:31 UTCSummary
Adds safe, paced working-set trimming of cold title-private RAM pages when host physical RAM runs low (
VICTORY_TRIM_BELOW_MB), targeting 16 GiB RAM systems without risking GPU device loss (0x887A0005).Adapted from GPL-3.0
LinkoArts/VIctorycommits7839a18and2fa2113(originally derived fromtshadofr/Leilapatches0012and0055), with two clean refinements:in_placerange subtraction once per region instead of twice.base.checked_add(len)bounds, half-openat..endremoval on sub-decommits, andallocation_base(at)normalization inopened_whole.1536 MiBfree-RAM threshold on<= 20 GiBtotal RAM hosts whenVICTORY_TRIM_BELOW_MBis unset, while remaining disabled (0) on> 20 GiBhosts unless explicitly set.Safety Invariants
watch::title_memory_allocated/title_memory_freed), D3D12 in-place host heaps (inplace::open), and write-combined ranges (shadow::write_combined_ranges).VICTORY_TRIM_GENTLE=1) trims strictlyMEM_COMMIT+MEM_PRIVATEpages belonging to tracked title allocations after subtracting all in-place heaps and write-combined ranges, and never touchesMEM_IMAGE,MEM_MAPPED,PAGE_WRITECOMBINE,PAGE_GUARD,PAGE_NOACCESS, runtime heaps, stacks, or driver allocations.2s, trims at most once per30s, and requires+2048 MiBworking-set growth since the previous settled trim.Verification
cargo test -p victory-gpu --lib trim::tests(4 passed)cargo clippy -p victory-gpu --all-targets -- -D warnings(clean)check#282)VICTORY_TRIM_BELOW_MB=16000)Related: #276
github-bot referenced this pull request2026-12-03 11:04:41 +00:00
@Androtim on GitHub · 2026-12-03 11:05 UTC · original
3-Gate Verification Summary (
4c9bde6)check):PASS(4m06s)VERIFIED CLEAN (0 P0, 0 P1)—[P1]scan-to-unlock TOCTOU race eliminated viaOPEN_LOCK+STATE_GEN+ per-chunkVirtualQueryre-verification (5fe71eb), andshadow::write_combined_regionscontract preserved (4c9bde6).VICTORY_TRIM_BELOW_MB=24000):PASS— 3 active gentleVirtualUnlocktrim passes mid-gameplay,0DRED,00x887A0005, peak dedicated VRAM5529 / 6736 MiB, crisp visuals.Ready for merge!