Series S on a 16 GB shared-memory APU (AMD BC-250): memory measurements and two fixes #451
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/lobomfz--VIctory-xmem#451
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@GoldenTXS on GitHub · 2026-12-04 10:08 UTC · original
Summary
On a BC-250 (16 GB shared by the CPU and the GPU), the game reaches the world load. There, the card driver's memory climbs past what the machine has, and
VICTORY_GPU_GUARDstops the run. This happens about 40–50 s after start, every time.I measured where the memory goes, using kernel BO lists and VIctory's own counters.
I found two things worth fixing upstream:
8aec563, every bound title page is shown to the card, so the driver creates all of them. Hiding the untouched ones again cuts memory at the first frame from 6.8 GB to 4.3 GB.ERROR_NOACCESS.Even with those fixes, the world load still needs more memory than a 16 GB shared machine has. The measurements below may help decide what to cut next.
Setup
amdgpu.gttsizegives 14336 MiB of GTT.proton-cachyos-native-bc250.patches/mesa.patchported to it.0b652f8.warmwas done: 102,666 pipelines, and 7 were missed in play.What the memory does
Over one run (
memory: card driverlines, plusmem_info_gtt_used):MemorySwapMaxraised to 6GIn the last run, the rise slows down but does not level off before RAM is used up.
Breakdown of the game process (
amdgpu_gem_info, summed by BO size), during the final 20 s:Pool window pages made while the world loads (a counter I added to the window fault handler):
So almost all of the rise is real streamed data. It is not reads of empty pages.
VIctory's own accounting: 2.1–2.2 GB on the card, out of a 3040 MB budget. Host copies of the textures the title fills: about 12k copies, 1.2 GB.
Fix 1: hide unseen bound pages from the card again
Commit
8aec563droppedHIDDENfromlazy::bind, for hardware BVH64. Since then, every bound page alias is shown to the card (alias->card = true), and the driver creates every bound page. With lazy pool pages, that is about 88k pages (5.5 GB) bound at the first frame. Only about 7.9k of them are ever read by the card.What the patch does:
bind, a page the CPU has not touched and the card has not seen is boundHIDDEN, as before8aec563.!host_bvh()).VICTORY_LAZY_HIDDEN=0or1forces it either way.make(), which is unchanged.Result: 4.3 GB of card driver memory at the swap chain, instead of 6.8 GB.
Fix 2: DirectStorage reads into lazy pool windows
dstorage::into_boundlets the kernel write the file straight into the pool window. With lazy pool pages, a window page that does not exist yet isPROT_NONE. The kernel's write does not fault intowindow_fault. It fails instead withERROR_NOACCESS(998). The title then gives up (0x80000003).This also happens with Fix 1: a hidden alias is not CPU-mapped by RADV either.
What the patch does:
lazy::window_made(window, len)makes the window's pages before the read.Other changes I tried
RADV_UM_LAZY_POOLS=1): the 64 KiB page BOs of pools of 64 MiB or more are created on their first CPU alias, or on their first GPU VA map. An earlier version also created them when a hidden alias was registered, which made about 9 GB of pages. Pages that are never mapped are now never created.VICTORY_TILE_HEAP_MBbelow 3977 also patches the Series S size. In this build it is at title+0x24796d5, 0x19 after the Series X site. Setting 3072 or 2048 made no difference to the peak.VICTORY_BVH_PAGES_MB=512or128: no visible change to the peak.Notes that may save others time
VICTORY_BVH_IN_PLACEchangeshost_bvh()(the card's node test). That value is part of the shader translation key. So changingVICTORY_BVH_IN_PLACEre-translates about 25.8k shaders and rebuilds about 104k pipelines: roughly 1 hour on this board. Also,run.shexportsVICTORY_BVH_IN_PLACE=1even whenVICTORY_BVH_BUILDER=0.MemorySwapMax=2Gis hard-coded inrun.sh. A setting for it would help on hosts with a large swap.run.sh shaders,warmorplaystarted from a text console with no display waits forever: Proton's prefix update and the window need one.Questions
The patches are attached:
victory-lazy-hidden.patch: Fix 1, Fix 2, and the window-page counters.mesa-radv-lazy-pools-only.patch
victory-lazy-hidden.patch
victory-lazy-pools.patch
victory-optim-latest.patch
@GoldenTXS on GitHub · 2026-12-04 10:40 UTC · original
Follow-up with per-second numbers (
amdgpu_gem_infoevery 1 s, same setup as above).The title levels off; VIctory's blocks do not.
VICTORY_POOL_MOVE=1moved 1,810 textures (276 MB) but still gave back 0 blocks within the load.Things that made no difference to the peak:
VICTORY_PRESET=potatowithVICTORY_WORLD_DIST_SCALE=0.15(patches confirmed in the log),VICTORY_LEAN_VRAM_PERCENT=10(budget 2,048 MB, 3,259 MB used anyway).With the guard at 95 % and
MemorySwapMax=12G: stopped at 13.6 GB of GTT, 137 MiB of RAM free, 2.8 GB in swap, still rising. So the world load wants about 18 GB here.Questions:
resource.rscomment)?VICTORY_MEMORY_CATEGORIESneeds a diagnostics build; is there a way to get that breakdown in a normal build?@tommiehansen on GitHub · 2026-12-05 17:43 UTC · original
#393 and #501 are worth following for the texture blocks that never get returned. #501 is still a draft and neither has been merged. They may help memory pressure, but we don't yet know if that's enough to load the world on 16 GB shared memory.
@tommiehansen on GitHub · 2026-12-05 20:08 UTC · original
I've added the configurable swap limit you mentioned in #620. CI passed, and the default stays at 2 GiB. You can try
SWAP_MAX_MB=6144once it's merged (or on the PR branch). This doesn't solve the underlying GPU memory pressure, though.