VRAM: tighten D3D12MA/heaps granularity and Pool::Copies/Bind caps on <=8 GiB budgets #393
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/gamingwithhomie--larp!393
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-393"
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?
@Lakanya on GitHub · 2026-12-06 00:04 UTC · original
Lakanya:pr/vram-8gb-pools-and-heaps→main· +73 −23 · 6 files · 2 commits · openOn 8 GB VRAM cards running Xbox Series X mode (
--card-budget 7200), three allocation defaults cause severe VRAM fragmentation and WDDM shared-RAM spill (~1.0 GB spilled):Pool::Copies(CARD_MOST = 1024 MiB,WINDOW_MAPPED_MOST = 4096 MiB,cardmem::may_placeup to 80% of budget) greedily fills VRAM during world load, andshadow::let_go_idle()usesram_idle_ms(10 s on 32 GB RAM) while ignoring VRAM pressure.Pool::Bindkeeps up toSPARE_MOST = 128 MiBof idleGPU_UPLOADscratch chunks inSPARE.texheapuses 64 MiB D3D12MA pools (even for 4 KiB small textures) andheaps.rsuses 128 MiBKind::Cardheaps that mix transient buffers with persistentsparse.rstiles while always retaining an empty 128 MiB spare heap.What is in it
crates/larp-gpu/src/cardmem.rs: addtight_vram()(budget <= 8 GiB) and tightenmay_place()headroom from 80% to 60% on<= 8 GiBbudgets.crates/larp-gpu/src/shadow.rs: ontight_vram(), capCARD_MOSTto 256 MiB (CARD_LEAST = 4 MiB) andWINDOW_MAPPED_MOSTto 192 MiB (cold windows fall back to existingshared_buffer), and lowerlet_go_idle()timeout for mapped VRAM windows to1_000 mswhenused > target.crates/larp-gpu/src/host.rs: capPool::BindSPARE_MOSTto 32 MiB ontight_vram().crates/larp-gpu/src/texheap.rs&crates/larp-gpu/d3d12ma/shim.cpp: use 16 MiB D3D12MA pool blocks (8 MiB for the 4 KiB small-texture pool) ontight_vram()(concept from Darner PR #345).crates/larp-gpu/src/heaps.rs: use 64 MiBKind::Cardheaps ontight_vram(), split persistentsparsetiles intoKind::CardTiles, and release empty card spare heaps under tight VRAM / over target.No visual, mip, or RT shortcuts; cards with
> 8 GiBbudget keep the existing defaults.Tested
cargo test --lib -p larp-gpu -p larp-hle -- --test-threads=4:larp-gpu24 passed / 0 failed / 6 ignored;larp-hle76 passed / 0 failed / 4 ignored.-197 MB(6,289 -> 6,092 MB),free_heap256 -> 163-178 MB(D3D12MA free100 -> 21 MB), p99270.4 -> 91.2 ms.AI-assisted by Antigravity (Gemini 4 Neon Medium).
@vanya890 on GitHub · 2026-12-06 01:27 UTC · original
The allocation changes are narrowly gated and the 8-GiB A/B data is useful. Please add focused boundary tests for the policy selector and placement threshold: exactly 8 GiB versus just above 8 GiB, plus the
ASKEDfallback whenfigures()is unavailable.tight_vram()now controls heap sizing, pool caps, mapped-window limits, and idle release, whilemay_place()changes the headroom from 80% to 60%; a small regression test around those boundaries would make it safer to maintain this policy across adapters and explicit--card-budgetvalues.@TrinityForever15 on GitHub · 2026-12-06 03:17 UTC · original
Tested on RX 6650 XT 8 GB (RDNA 2), Series S profile, 1080p FSR Quality + FG 2x, together with #388 (
LARP_HEAP_MB=64), #464, #435 and #392 on top ofamd-testv1.1.7. Free heap space went from 1.1 GB to 662 MB, shared memory from 1.0 to 0.8 GB, and VRAM stayed steady at 7.4 GB. Combined with the others: 1% low 112 ms, 0.1% low 388 ms, longest frame 434 ms (up to 6,519 ms before). I haven't isolated this PR's share on its own. No regressions seen. I also recommended it to larp-amd for RX 6000 users: https://github.com/iceboerg00/larp-amd/issues/64View 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.