Repository navigation
fix(agc): keep at most 4 GiB of the host heap from the host import budget - #7844
Mouhand-Kaddo wants to merge 1 commit into
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.
|
|
Windows and AMD's own driver. AMD Radeon 860M (RDNA 3.5,
AI-assisted: yes (Claude Code) |
fogydes
left a comment
There was a problem hiding this comment.
Reviewed the change:
- Capping the host heap reserve at 4 GiB (
std::min<std::uint64_t>(hostHeap / 2, 4096ull << 20u)) prevents 32 GiB hosts with 16 GiB host heaps from clamping the import budget below the 10,466 MiB working set required by memory-intensive titles (PPSA24191), while preserving the 2 GiB minimum floor for smaller 16 GiB configurations. - The unit test cases in
Graphics.cppexplicitly guard both 16 GiB, 32 GiB, and 15,911 MiB heap scenarios against regression. - Technical debt in
docs/dev/debt/libSceAgcDriver.mdupdated accurately. - Confirmed independent hardware test results posted by
@LeandroLP23(AMD Radeon 860M) verifyingagc_driver_graphicspasses 3/3 on this head. - Zero comments added in code; Conventional Commits title; all CI checks pass.
Ready to merge.
AI-assisted: yes
|
AMD and Intel Windows data: with this PR's test changes, Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built,
AI-assisted: yes (Claude Code) |
096de7f to
ac03b41
Compare
|
I ran into the same thing with Ghost of Yōtei (PPSA26344) on a 32 GiB Windows laptop with an NVIDIA GPU, so here's a second data point from another title and vendor. With #6472's rule the budget there comes out at 8,117 MiB. In a warm run from a save into the open world, imports started being refused as soon as the world began loading, 171,828 of them by the end of the run, and the environment only appeared in the frame dump at 492 s. The same build with the old 2 GiB reserve put back (about 14 GiB here) refused no import in a 1,408 s run, and the same frame showed the environment at 412 s. I haven't run Yōtei with this PR's 4 GiB cap yet; it would give about 12 GiB on this machine. Our older notes put Yōtei's import working set at around 13 GiB, so it may still refuse some here, though far fewer than at 8 GiB. If it's useful, I can run your branch and post the refusal count. One caveat: these runs are from our local tree (a Details
|
|
Performance data from another title: on a 32 GiB Linux machine, #6472's budget makes ASTRO BOT about 2.5× slower, and this PR brings it back. Setup: ASTRO BOT PPSA21567 01.019.000,
What happens on How I found it: Crash Site went from p50 124 ms on AI-assisted: yes (Claude Code) |
ac03b41 to
2af7b9b
Compare
|
Follow-up on the first level, Sky Garden (
Tested and written by Claude (AI assistant) on a contributor's machine. |
|
Windows data point for
|
What
Demon's Souls (PPSA01342) stops on
mainwhile loading into the tutorial level, right after the intro cinematic, on a 32 GiB Linux machine (RX 6900 XT, RADV):#6472 keeps the larger of 2 GiB and half the largest host heap out of the import budget. That fixed the 16 GiB machine it was measured on (heap 8128 MiB, about 4 GiB kept back). The same half also applies to larger heaps, so a 32 GiB machine (RADV heap 15911 MiB) went from 13863 MiB to 7955 MiB. With
APS5_TRACE_HOST_IMPORT, this title holds up to 10466 MiB of live imports at once while it loads the level, so the address-based build's imports are refused and the copy limit aborts.The reserve is now half the heap kept between 2 and 4 GiB:
mainHeaps up to 8 GiB keep
main's budget.APS5_HOST_IMPORT_MIBstill overrides it, and #6479 (lowering the budget aftervkAllocateMemoryfailures) composes with this: it caps the effective budget, this sets the default it starts from. #7808 rewrites theAPS5_HOST_IMPORT_MIBrow ofENVIRONMENT.md; I left that row alone to avoid the conflict. The debt entry is updated.Risk: two-way door, one constant. A machine with a host heap above 8 GiB pins more host memory for imports before the least-recently-used ones are retired. On the run below, total GTT use peaked at 12.6 of 15.9 GiB.
Tested
Linux 7.2.11 (EndeavourOS), i7-13700K, 32 GiB, RX 6900 XT with Mesa 26.2.5 RADV, GCC 16.2.1, Release,
BUILD_TESTING=ON,main36f60df; rebased ontomain98db779 on 2026-10-20 (only the debt entry conflicted:mainhad extended the same paragraph, so its text is kept with this PR's reserve sentence applied).agc_driver_graphics(hostImportBudgetTests): with only the test change onmainit fails witha 32 GiB machine does not keep 4 GiB of its 16 GiB host heap from imports; with the change it passes. The 8128 MiB and 3 GiB cases are unchanged and still pass. Rerun on 98db779:agc_driver_graphics_testswithmain'sGuestBufferMemory.cppexits 1 with the same message, and with this PR it printsGraphics validation tests passed.agc_host_import_unmap,agc_host_import_retirement,agc_host_import_retire,agc_host_import_sparse,agc_driver_bda_anchor_reads,agc_driver_bda_span_readspass.agc_driver_bda_devicefails the same way onmainand on this branch on this GPU (an anchored BDA read differs from the same read through the lookups at anchor ...); it does not use the budget.python3 tools/check_conventions.py --base upstream/mainpasses.--to-intel, continuing a saved character (main menu → Continue → Continue Offline), 1080p (+r_Wants4K = WantsPerfin a copy of therenderconfig_ps5_*.txtfiles), no environment overrides:maine12c913 (sameHostImportBudget): the stop above while loading the level, exit 134 (one run).mainwithAPS5_HOST_IMPORT_MIB=13862(the old default): reaches the level in both runs, peak 10466 MiB live imports, no refusal.mainrun withAPS5_HOST_IMPORT_MIB=11815(this PR's value) crashed in title code while loading: a guest heap pointer had been overwritten with RGBA16F texel data. No import was refused in it, so it is a separate bug, which I'm investigating.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)