Repository navigation
fix(agc): keep half the host heap out of the host import budget - #6472
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Data point from Resident Evil Village (PPSA01556) on Windows 11, RTX 3070 Laptop GPU, 16 GB: main's default import budget here is 5,840 MiB. Village fills it by its title screen and keeps refusing imports (21,138 refusals in one boot), each one falling back to a CPU copy. With this rule the budget on this machine would be about 3,944 MiB. At 6,864 MiB we did see |
|
Tested on Linux x86-64 (Release build, lavapipe / llvmpipe LLVM 20.1.2), with d46210a merged into main 44df216:
AI-assisted: yes (Claude Code) |
Imports, type-3 mirrors and the buffers and textures placed in host memory share the driver's system memory heap. On Windows that heap is half the physical memory, so on a 16 GiB machine the old budget (the heap less 2 GiB) let imports hold about 6 of its 8 GiB, and host buffer allocations then overflowed into the 256 MiB device-local host-visible heap and failed. The budget now reserves the larger of 2 GiB and half the largest host heap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d46210a to
f970620
Compare
The host-import debt entry takes boykopovar#6472's budget sentence and keeps this branch's sentence on remembered refusals.
The host-import debt entry takes boykopovar#6472's budget sentence and keeps this branch's sentence on remembered refusals.
ASTRO BOT no longer boots on a 32 GiB host after this changeWindows 11, Ryzen 7 5800X3D, 32 GiB RAM, RX 9070 XT (16 GiB, Adrenalin 26.8.1). The driver's host heap is 16,345.5 MiB. ASTRO BOT (PPSA21564), on main 676d423 plus the open PRs #6188 #6273 #6292 #6503 #6566 #6609 #6615 #6617 and some local experiments, none of which change the import budget. The budget used to be the heap less 2 GiB, 14,297 MiB here; it is now half the heap, 8,172 MiB. During the boot, the title's large registered ranges then stop fitting: The refused range falls back to a copy, and So on hosts where half the heap is well above the 2 GiB floor, the reservation costs titles with large imports more than the 16 GiB case needed. A few options, in case they help:
Happy to test a change on this machine. Written with AI assistance (Claude); measured on the machine above. |
|
A data point from a 32 GB machine where the new budget is too small for a title: ASTRO BOT PPSA21567 v01.019.000 on With this PR the budget here is 8172 MiB, which puts the host heap at about 16.0 GiB. The title imports 2172 MiB at That is 3 of 3 runs on With #6499 reverted on top of the same So on 32 GB the half-heap reserve takes the budget from 14 GiB to 8 GiB, and this title holds about 12.4 GiB of imports live at its title screen. Is the reserve meant to keep growing with the heap, or should it stop near the 4 GiB the 16 GB machine in this PR needed? A reserve capped there would give about 12 GiB here, which is marginal for this title, so maybe the answer is elsewhere; I can run whatever formula you have in mind on this machine. AI-assisted: yes (Claude Code) |
…5_HOST_IMPORT_HALF_HEAP_RESERVE=1 Main's boykopovar#6472 reserves half the host heap: on this 32 GiB machine the budget drops from 14 to 8 GiB (8117 MiB), Yotei's imports reach it as the world loads (w20m-long: 9,654 imports, 1.2 GiB refused by frame 084) and the world arrives late. The half-heap reserve (meant for 16 GiB machines) is now opt-in; HostImportBudget keeps it as its default argument for its tests. AI-assisted: yes
…5_HOST_IMPORT_HALF_HEAP_RESERVE=1 Main's boykopovar#6472 reserves half the host heap: on this 32 GiB machine the budget drops from 14 to 8 GiB (8117 MiB), Yotei's imports reach it as the world loads (w20m-long: 9,654 imports, 1.2 GiB refused by frame 084) and the world arrives late. The half-heap reserve (meant for 16 GiB machines) is now opt-in; HostImportBudget keeps it as its default argument for its tests. AI-assisted: yes
What
Imports, type-3 mirrors and the buffers and textures placed in host memory share the driver's system memory heap. On Windows that heap is half the physical memory, so on a 16 GiB machine (heap 8128 MiB,
VK_EXT_memory_budget7465 MiB on the RX 6600 XT below) the import budget, the heap less 2 GiB, let live imports hold 6080 MiB and left about 1.4 GiB for everything else. Host buffer allocations then fell back to the 256 MiB device-local host-visible heap (no Resizable BAR) and failed:The budget now keeps the larger of 2 GiB and half the largest host heap out of it.
HostImportBudgetholds the arithmetic soagc_driver_graphicscan check it: 16 GiB machine 4064 MiB (6080 before), 32 GiB 8 GiB (14 before), 64 GiB 16 GiB (30 before); heaps of 4 GiB and less keep the 2 GiB reserve.APS5_HOST_IMPORT_MIBstill overrides it. Imports past the budget retire the least recently used ones as before; in the runs below no import was refused.Tested
agc_driver_graphics(Windows 11 26200, GCC 15.2.0 UCRT, Release,BUILD_TESTING=ON): passes. With the old 2 GiB reserve put back,hostImportBudgetTestsfails with "imports on a 16 GiB machine take more than half its 8128 MiB host heap".python tools/check_conventions.py --base upstream/main: passes.Marvel's Wolverine PPSA03671 01.001.005, Windows 11, Ryzen 7 5800X3D, 16 GiB RAM, RX 6600 XT 8 GB (AMD 26.9.2),
--windows.mainalone aborts earlier on this card (device memory, Marvel's Wolverine (PPSA03671) on an 8 GB card: storage images cycle ~5.4 GB through the 2 GB storage cache, and evicted images stay alive until device memory runs out #5961), so the runs use a local branch:maina5e2a80 + fix(agc): include retained storage images in recorder budget #5998, perf(agc): reuse eligible image table entries independently #6340, fix(agc): place device memory in host memory when the driver refuses a device-local allocation #5987, fix(agc): release the texture caches when a device allocation runs out of memory #6174, plus a local storage-cache budget of 4 GiB (APS5_STORAGE_CACHE_MIB=4096). The 464 s run and the 600 and 1500 s runs predate a commit that makes two texture creation logs debug-only (a separate PR); every other run has it. Only the import budget differs:vkAllocateMemory buffer: allocation=196083712 memoryType=3 reclaimed=0 released=1048576 initialResult=-2 attempts=2APS5_HOST_IMPORT_MIB=4096The 3052 s abort took the same path: heap 1 full, then a 187 MiB buffer sent to the BAR heap.
The imports stayed within the budget then, and none was refused. Heap 1 had filled with storage textures that the full device-local heap placed in host memory:
[gpu] storage texture: device-local heap 0 uses 6583 of its 6583 MiB budget, 3670016 bytes placed in host memory type 1; 524288 such allocations, 1507919 MiB. That placement has no host-heap budget of its own; it is a separate topic, not in this PR.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)