AGC: on a Radeon 780M APU (Windows) the 3 GiB host heap is exhausted by heap mirrors and imports while the device-local heap stays half empty #7047
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?
Imported from boykopovar/AnyPS5. Originally posted by keravyn-ops on 2026-10-17T08:16:40Z.
Hardware / software
mainat8ac10e7a0(+ #6472, #6646 for the second set of runs), WinLibs GCC 15.2.0 r7Heap layout the driver reports
The host heap is a quarter of the memory, not half:
HostImportBudget(#6472) therefore still gives 3104 − 2048 = 1056 MiB, the same as before #6472.What fills the host heap
With
APS5_PROFILE_DRAW=1(default settings,APS5_ADDRESS_COPY_MAX_MIB=8192), 45 s after start:Heap mirrors (host-cached, type 3) + imports ≈ 3.9 GiB on a 3.1 GiB heap; the device-local heap (system memory too on this device) holds 1.3 GiB. Raising
APS5_HOST_IMPORT_MIBto 2560 only moves the crash (imports 2560 + mirrors 936 MiB).Experiments on a local branch
vkCmdCopyBufferinto the open batch; write-backs read the written ranges through copies recorded before/after the work. Result: the memoryType-3 abort is gone (2.4 GiB of mirrors move to heap 0); the next limit is physical memory (below).entry.unwatched); with the import budget full they retire constantly, and their ranges then stay excluded for good:acquireMirrorrefuses them and every address-based build copies them —APS5_ADDRESS_COPY_MAX_MIBat its default reportsan address-based build copies 443 MiB of 3200 registered ranges ... (0.9 MiB committed, outside the write-watched arena). Restoring the watch when such an import retires (no other unwatched import overlapping) brought "unwatched heaps" from ~29000 to ~500 in the same run length. #6678 adds aGuestMemory::Rewatchfor settled small imports; I'll report how #6678 behaves on this device separately on that PR.sceKernelAvailableDirectMemorySize/sceKernelGetDirectMemorySizereport (localAPS5_DIRECT_MEMORY_MIB) still boots at 4096 MiB, but the process reaches ~11 GiB private within 60–100 s and free physical memory hits 0 — the host copies (mirrors, textures, storage images) live in the same 16 GiB.Questions
HostImportBudget, heap mirror budget, the buffer pool's 512 MiB host tier) fromVK_EXT_memory_budget?VK_EXT_memory_budgetusage/budget to thevkAllocateMemoryfailure message be welcome? (Example:...; heap 0 5327/5899 MiB, heap 1 2586/2949 MiB, heap 2 0/243 MiB: Vulkan result -2— it is how the above was found.)Related: #6045 (same device, same 1056 MiB budget), #6472, #6479 (import budget from
VK_EXT_memory_budget— would help only if heap mirrors and host buffers are counted against the same 2949 MiB), #6553, #6174, #5987, #4472.AI-assisted: yes (investigation and the local patches were written with Claude Code; I ran every measurement on the device above).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T12:18:09Z.
I opened #7119 for the focused diagnostic you asked about: when AGC buffer allocation fails, it appends per-heap
VK_EXT_memory_budgetusage/budget if that query is available, without changing allocation or retry policy.I validated the changed translation units with Linux syntax-only compilation and ran a standalone harness against
BufferPool.cppfor the two-heap output and missing-extension fallback. Full CMake/CTest could not run here because the SDL2 submodule has noCMakeLists.txtand no system SDL2 package config is installed; the PR describes this limitation.Imported from boykopovar/AnyPS5. Originally posted by ultraacademy657-dot on 2026-10-18T00:33:37Z.
<html> <html><head></head>
Additional reproduction: ASTRO's PLAYROOM (PPSA01325) aborts on Windows/NVIDIA RTX 3080 during a 6544 MiB heap-mirror allocation
This is an additional Windows/NVIDIA reproduction relevant to the host-heap and heap-mirror allocation problem described in #7047. The original report concerns an AMD APU; this reproduction uses a discrete NVIDIA GPU.
Environment
Game: ASTRO's PLAYROOM (PPSA01325)
OS: Windows 11 Pro, version 25H2, build 26200
GPU: NVIDIA GeForce RTX 3080, 10 GB VRAM
System RAM: 16 GB
Vulkan device ID:
0x2206AnyPS5 repository HEAD when preparing this report:
d8f36fd74986030e9997aeae965dd01591d90fd8Build provenance: Local Windows Relinker and libraries. The working-tree cleanliness and exact correspondence between this HEAD and every binary used in the run have not been independently recorded.
Summary
The converted executable starts and reaches shader preparation, rendering and texture allocation. It then aborts when a 6544 MiB guest-memory import is refused and the fallback heap-mirror allocation also fails.
The failure has recurred across multiple testing attempts. This report records one captured reproduction.
Relevant runtime output
The failed allocation is 6,861,881,344 bytes (6544 MiB). Vulkan result
-2isVK_ERROR_OUT_OF_DEVICE_MEMORY.Vulkan memory properties
vulkaninfo.execompleted successfully and reported:These are values from a separate
vulkaninfosnapshot, not measurements taken at the precise moment of the crash. The runtime separately reported a device-local heap budget of 9283 MiB and usage of 144 MiB.The runtime reports 2000 MiB of live imports against a 6063 MiB host-import budget, then refuses a 6544 MiB import. The fallback requests a 6544 MiB heap mirror using
memoryType=4, which maps to the host heap, and the allocation fails.This is consistent with host-heap allocation pressure, but the available evidence does not prove it is the only cause. The reported
maxMemoryAllocationSizedoes not identify a smaller explicit Vulkan allocation limit.Checks completed
Relinker conversion completed successfully and produced
eboot.exe.Two guest modules were converted.
Import audit: 3178 references, 2466 unique imports, zero absent imports, seven stub imports and 1549 module imports.
Required Windows
.prxlibraries and MinGW runtime DLLs were present.The executable reached the graphics path before the failure.
vulkaninfo.exeexited successfully and identified the RTX 3080.Questions for maintainers
Is this the same underlying allocation issue as #7047, or does the NVIDIA host-heap layout indicate a separate failure mode?
Could the runtime use a device-local heap-mirror path with staged refresh/write-back, or another fallback that considers the available heap budgets, when a large host-heap allocation fails?
Could allocation-failure diagnostics report per-heap memory usage and budget at the time of failure, as discussed in #7047 and PR #7119?
Artifacts available
PPSA01325-first-run.log— full runtime output from the failed launch.PPSA01325-vulkaninfo-full.txt— Vulkan device, memory-type and heap information.PPSA01325-import-audit.txt— import audit results.The immediate failure is reproducible at the graphics memory-allocation stage. The exact allocation-policy change needed remains to be determined.
AI-assisted report; conversion, preflight checks and runtime behavior were tested locally.
</html> </html>PPSA01325-report-logs.zip
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T00:41:39Z.
Thanks, this adds a useful discrete-GPU reproduction. It looks consistent with the same broad host-heap pressure path: the refused import is followed by a 6544 MiB mirror request on host heap 1 (memoryType 4). The separate
vulkaninfosnapshot and the runtime import counters do not give heap 1 usage at the exact allocation failure, though, so they do not yet establish how much headroom remained or whether the APU and RTX 3080 failures need the same policy change. #7119 adds per-heap usage/budget to the allocation failure diagnostic; once available, a run with that diagnostic and an exact binary commit would help distinguish the cases.Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-18T03:56:51Z.
Same pattern on Linux with RADV: Astro's Playroom (PPSA01325) on a Radeon 680M iGPU (Mesa 26.2.4, 16.17 GB GTT), main
1e2d9b369b. Both runs stop incpuplaza_mini_04withAGC graphics: vkQueueSubmit recorder: Vulkan result -4and the kernel'sNot enough memory for command submission. With the default budget the 6544 MiB import at 0x108a800000+0x199000000 is refused and a 6544 MiB host-visible buffer appears instead; with a large budget the same memory is imported. Sizes are the app's buffers fromamdgpu_gem_info, 30 s before the stop:APS5_HOST_IMPORT_MIBThe three buffers are heap mirrors: a rerun with
APS5_PROFILE_DRAW=1on the same build reports[buffers] image mirrors: 4 ranges (10126.2 MiB, 3 writable, 3 heap 10126.0 MiB)before the same stop at 357 s. So the budget only moves this title's memory between imports and heap mirrors here. #6479 at287dd14bf8stopped the same way at 342 s.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T04:33:05Z.
Thanks for the paired runs. The budget change moves roughly 9.3 GiB from heap mirrors to imports, while total reported memory falls by only about 1 GiB; both runs still fail. That points to aggregate host-memory pressure, but the current data does not identify a safe allocation-policy change. #7119 already has a pending diagnostics change for per-heap budgets on allocation failure. Could you capture, on the same failing build, each Vulkan heap’s usage/budget plus system available RAM and the import, mirror, buffer-pool and guest-backing totals immediately before failure? That would show whether there is a correctable accounting/selection issue or simply no remaining backing memory.
Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-18T05:56:32Z.
Here is the state before the stop on the same build (main
1e2d9b369bplus a 5 s sampler thread, no behaviour change), Playroom on the 680M at the default 3432 MiB import budget. It stopped at 318.6 s with the samevkQueueSubmit recorder: Vulkan result -4; that is a submit failure, so a vkAllocateMemory report would not print. Values in MiB, budget/usage fromVK_EXT_memory_budget:Host RAM is not the limit; heap1 sits at its budget for the whole last minute. The title's resident shared memory is about 1.5 GiB, and a census run found 468 of the mirrored 10126 MiB resident when the mirrors were made, so most of the mirrors copy pages the guest never wrote. I don't have a reliable buffer-pool total.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T21:47:18Z.
Follow-up: I opened #7647 for sparse, aliased heap mirrors that allocate device memory only for blocks containing nonzero guest bytes, with copy-in/write-back for changed blocks. On a Radeon 680M Linux run, it reduced mirror device memory from 10126 MiB to 5125 MiB and avoided the prior 359 s device-loss failure in 12/12 runs. This supports the mirror-overcommit direction, but it does not validate the 780M Windows reproduction or claim to solve the separate physical-memory limit you measured.
Imported from boykopovar/AnyPS5. Originally posted by keravyn-ops on 2026-10-20T19:09:27Z.
Follow-up on the 780M with v0.1.3 and #7647: on this APU the default host import budget costs Townfall about a factor of ten in frame rate, and raising it runs into the heap-mirror/commit problem this issue is about.
Setup
PS5.DefaultBackBufferWidth/Heightdefaults are patched from 3840x2160 to 1280x720;-nothreadtimeoutinuecommandline.txtAPS5_PROFILE_DRAW=1,APS5_ADDRESS_COPY_MAX_MIB=8192, warm shader cache, no input, process memory sampled every 5 s3fd1cc393b85) and #7647 ated8f15bc1Default budget: the frame is spent copying buffers
With the default (
hostHeap 3104 MiB - reserve max(2048, heap/2)= 1056 MiB), 360 s at ~1.0 FPS:About 99 % of the
[guestmem]read samples come fromGuestBufferMemory::copyRegion(read sitebuffer-upload, 10.08 M of 10.24 M), i.e. ~0.7 TiB of guest reads in 6 minutes.APS5_HOST_IMPORT_MIBsweepvkQueueSubmit recorder: Vulkan result -2at 168 svkAllocateMemory device buffer ... memoryType=0 ... heap 0 1400/5899 MiB; heap 1 6064/2949 MiBat 105 sThe working set of imports looks like 2–2.6 GiB: at 1536 the imports still thrash and the copies stay, past 2048 they mostly go.
What ends the fast runs
Only the runs that get fast reach a phase where two compute shaders (programs
0x1ac0984000, 68206 words, and one of 60151 words,5357x1x1) bind a 4095 MiB buffer:It never appears in the 1–1.5 FPS runs (0 lines), and appears 15, 7 and 13 times in the 2048, 2600 and #7647+2600 runs. From that point private bytes jump (v0.1.3/2600: 7.1 → 12.9 GiB between 72 s and 87 s, free RAM 65 MiB) and the commit charge reaches the limit, after which the allocations above fail even though heap 0 is a quarter used. With #7647 the commit peak is lower (31.3 vs 33.6 GiB) and that run did not hit an allocation failure, but presents still stop at 62 s while the queue workers report 20–27 s of dispatch time per 10 s; audio keeps playing. It then aborts with the #7017 message:
(v0.1.3 hit the same abort once at the default budget, after ~40 s, in 1 of 2 profiled 720p runs.)
So on this machine the fixed 2048 MiB reserve keeps the title at 1 FPS, and a budget large enough to avoid the copies needs the 4 GiB mirror to stay sparse to fit. Logs and CSVs are available.
Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-20T23:28:07Z.
Data from a second APU, with the other common carve-out: Ryzen AI 7 350 / Radeon 860M, 32 GiB, a 512 MiB UMA frame buffer, AMD driver 32.0.13058.8001, Windows 11 26300. The heaps come out the other way round from the Legion Go's:
So the default host import budget is about 7.8 GiB here, and the import thrashing above doesn't happen at the default. The device-local heap, though, is full from the first menu screen on (
device-local heap 1 uses 512 of its 486 MiB budget). Every device buffer then goes throughDeviceMemoryType's host placement, and on release it was freed instead of pooled. SuperTuxKart's tutorial race made and freed 8192 such buffers per run, about 100 GiB, nearly all of them 8 MiB. #8748 keeps them for reuse, but only while a new buffer would be placed in host memory anyway: race FPS 2.38–2.43 → 2.73–2.92, frame p50 about 402 → 333 ms.To check the Legion Go's budget on this machine I forced it with
APS5_HOST_IMPORT_MIB=1056. The same race onmain+ #8538 + #6718 drops from 8.8–9.1 to 7.2–8.1 FPS, refusing about 170 imports (about 500 MiB). With #8622 on top it drops to 7.9–8.1 FPS and refuses 1. That change stops re-importing a range that is mapped again at map time. Most of the 1 GiB a small budget holds here went to map-time imports the GPU never reads. SuperTuxKart's working set is small, though, so this only shows how a small budget fills up. It doesn't reproduce Townfall's factor of ten.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T06:30:57Z.
@keravyn-ops, the "unwatched imports never return to the write watch" case from your experiment 2 now also hits Resident Evil Village (PPSA01556) on a discrete GPU. Since #6457 (ours), a 64 KiB piece mapped on its own is imported, and its import retires as soon as its neighbour is registered and the run grows into a larger aligned block, before its settle has put it back in the watch. With the import budget full, every later address-based build copies those pieces. Village on main
6696def6e6aborts in its intro with "an address-based build copies 185 MiB of 2960 registered ranges, past 64 MiB (APS5_ADDRESS_COPY_MAX_MIB) … (0.1 MiB committed, outside the write-watched arena)".#8926 restores the watch when an unwatched import retires, in
refreshImportsand the budget eviction: only for ranges still registered as the same range, and not where another unwatched import or a live storage texture covers them. That's the restore you measured, and the PR's description credits your finding. If you have your branch for it, or would like to be listed as co-author, say so and I'll add you or take your commits. A run of #8926 on the 780M would also show whether it brings "unwatched heaps" down as your version did.Imported from boykopovar/AnyPS5. Originally posted by keravyn-ops on 2026-10-21T15:47:21Z.
@EagleBearerYS thanks for the credit. Yes, please add me as co-author:
No need to take my commits: my local version (never pushed) also bundles two unrelated knobs (
APS5_DIRECT_MEMORY_MIB,APS5_HOST_POOL_MIB), so your change is the cleaner one to keep.I'm building
main(cecb540a6) + #8622 + #8926 now and will post Townfall runs on the 780M here: the default budget and 1536 MiB, with theunwatched heapscounter, against v0.1.3.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T15:56:31Z.
@keravyn-ops, thank you. The trailer is on #8926's commit, now
a356b6a75a. Only the commit message changed, and the code is the same as before. Your runs on the 780M withmain+ #8622 + #8926 are very welcome here.Imported from boykopovar/AnyPS5. Originally posted by keravyn-ops on 2026-10-21T16:34:12Z.
Townfall runs of #8622 and #8926 on the 780M, as promised. Together they take the title from ~1.2 to 4–6 FPS at the default import budget; neither does it alone in these runs.
Setup
Same machine and title as above (Ryzen Z1 Extreme / 780M, 16 GiB, 3 GiB UMA frame buffer, Windows 11 26100, AMD driver 32.0.23044.19; 720p backbuffer patch,
-nothreadtimeout).APS5_PROFILE_DRAW=1,APS5_ADDRESS_COPY_MAX_MIB=8192, noAPS5_HOST_IMPORT_MIB(default budget 1056 MiB) unless stated, warm shader cache, no input, 360 s per run, one run per row. Title runs only; I didn't run the test suite. Builds:maincecb540a63, #8622 atbf66eeccfd, #8926 atacc7b1792e(before its update toa356b6a75a), each merged onto thatmain, WinLibs GCC 15.2.0,--target libs relinker, eboot relinked with each build's relinker.Results
unwatched heapsmainmain+ #8622main+ #8926main+ #8622 + #8926main+ #8622 + #8926,APS5_HOST_IMPORT_MIB=1536The copy volume is what limited the frame rate before: with both PRs the buffer copies drop from ~440 GiB to ~0.5 GiB per run and the count of unwatched heap refreshes from ~500k to ~550, in line with what my local version of the restore did on 2026-10-17 (~29,000 to ~500 there). With #8622 alone the copies and the refusals stay where they were (and the unwatched count roughly doubles). The
main+ #8926 row is a single run that hit the intermittent #7017 abort before the first frame, so it says nothing about #8926 alone; I can repeat it if that split matters.What stops it now
Both fast runs end the same way as the
APS5_HOST_IMPORT_MIB=2600runs above, once the title reaches the phase with the 4095 MiB buffer:(GPU shared usage peak 6215 and 6464 MiB, app private bytes peak 14.5 GiB in the default run.) At ~1 FPS, the earlier default-budget runs never got there within 6 minutes.
Logs and CSVs are available.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T16:49:22Z.
@keravyn-ops, thank you for the full table and for keeping your caveats with it. The rows with #8926 are now in its Tested section, together with the #7017 note and the out-of-memory end. Since you offered: one more run of the
main+ #8926 row would only be worth it if it gets past the start-up abort, to show #8926 without #8622. If that's easy on your side, it's welcome, but nothing waits on it.Imported from boykopovar/AnyPS5. Originally posted by keravyn-ops on 2026-10-21T17:14:34Z.
One more data point, so nobody has to try it: moving the heap mirrors to device-local memory doesn't get Townfall past the 4095 MiB phase on the 780M. It moves the memory from heap 1 to heap 0, and the runs fail at the same total.
What I ran
maincecb540a63+ #8622 (bf66eeccfd) + #8926 (acc7b1792e) + my local commit from 2026-10-17 that places non-sparse heap mirrors in device-local memory (refreshes through host staging, write-backs through recorded copies; never pushed), forced on with itsAPS5_DEVICE_HEAP_MIRRORS=1. Same machine and settings as my previous comments (3 GiB UMA frame buffer, 720p backbuffer patch,-nothreadtimeout,APS5_PROFILE_DRAW=1, no input), one run per row. Title runs only, no test suite.The 4095 MiB region is a sparse heap: an uploaded-region trace shows
0x8fc0000000+0xfff00000 sparseHeap=1 backed=1/0x21000000served by a 528 MiB heap mirror, so it is not 4 GiB of mirror. Beside it, writable heap mirrors of 256 and 323 MiB appear in the same phase.Results
device buffer ... memoryType=0device buffer ... memoryType=0device buffer ... memoryType=0buffer ... memoryType=3APS5_TEXTURE_CACHE_MIB=512buffer ... memoryType=3(Heap 0 is device-local, budget 5899 MiB; heap 1 is host, budget 2949 MiB.)
So on this APU the limit looks like the total the driver will back across both heaps, not either heap's budget, and the title needs less GPU memory overall in that phase rather than a different placement. I'm not proposing the device-local mirror change. Logs and CSVs are available.