fix(agc): bind heap mirrors only where the guest holds bytes #7647
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7647"
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 fma-rc on 2026-10-18T19:29:41Z.
What
A heap mirror copied its whole registered range into device memory, so a title with large GPU heaps paid for every page it had reserved, not just the ones it had written. Playroom (PPSA01325) on a Radeon 680M APU loses the device on current
mainat about 359 s:Its three heap mirrors hold 10126 MiB. Heap mirrors are made wherever a range's host import is refused, which happens once registered memory exceeds the import budget, so this is not specific to one GPU or OS. This is the heap mirror part of the device loss in #7047; that report is a Radeon 780M on Windows, which I could not run, and host imports are not changed here.
A heap mirror is now a sparse, aliased buffer of 64 KiB blocks. Each block that holds a nonzero guest byte is bound to device-local memory and keeps a host copy; every other block is bound to one shared zero block per device. Holes of the guest's shared memory are found with SEEK_DATA and never read. A block the guest or the GPU writes later is bound when the next build sees the change. Changed bytes reach the device by copies recorded before the build's work, and bytes the GPU wrote, including into the mirrors a cached address space holds, are copied back after it, so no block needs a host-visible memory type (the RTX 5080 has none that a sparse aliased buffer accepts). A device read of a mirror inside a GPU completion throws.
A device without sparseBinding, sparseResidencyBuffer and sparseResidencyAliased, or without enough sparse address space left for a mirror, keeps the whole-range copy
mainmakes. The RTX 5080, Radeon 610M and 680M (RADV) and lavapipe report all three; lavapipe has 2 GiB of sparse address space, so a larger heap range is copied whole there. From the driver sources, Intel before Gen12 on i915, Mali (panvk), Raspberry Pi (v3dv) and MoltenVK lack them. Device creation no longer limits sparse binding to dma-buf import.A sparse queue takes only a queue that is free. Main and settle queue selection is unchanged. When no free queue binds, binds go to the main queue under its lock. One change on Linux with dma-buf import:
maindropped the settle queue when the sparse family was the settle family with a single queue. That settle queue is now kept.A new joined host import bumps the import epoch, so the next build releases heap mirrors over its ranges. Without that, the next refresh throws
a heap mirror's range is no longer write-watched. PR 6546 and PR 6646 handle that throw by refreshing or re-planning the mirror. This PR removes the case where a joined import leaves the mirrors behind. It does not change what they do in other cases.Memory use is not lower overall: on the 680M the GTT peak drops and the process RSS peak is about the same (table). Texture snapshot memory (
CachedTexture.bytes) is left to PR 6982.Tested
Arch Linux,
mainc4c2b3aa73with and without this PR (the branch is rebased ontobf2c63f853since, after #6646 and the import requester counts changed the same code).mainOver all runs on this machine, including earlier heads of both:
mainlost the device in 9 of 9 (342-372 s), this branch ran to the end in 12 of 12.New test
agc_driver_resident_heap_mirror:main: the heap mirrors of two 8192 KiB heaps hold 16384 KiB where the guest and the GPU wrote 192 KiB.the GPU store of thread 1 into a never-written heap block reached the guest as 0x0, expected 0x4.a heap mirror's range is no longer write-watched).SetResidentAddressSpaceLimit), the two heaps are mirrored whole and the reads and GPU stores still match. With that path replaced by a throw it fails 3 of 3 on the 680M and on lavapipe, and passes 3 of 3 on each with it.New test
agc_driver_device_queue_plancovers queue selection for 9 queue family layouts.On this head (rebased onto
bf2c63f853), all 96 tests that match the changed areas (agc_import_watch,agc_*host_import*,agc_driver_bda*,agc_driver_address*,agc_driver_image_*,agc_driver_graphics, the heap mirror unwatch tests from #6646, the two new tests and others) pass on the NVIDIA RTX 5080 and lavapipe. On the RADV 610M 94 pass;agc_driver_image_table_vouched_lookupsandagc_driver_guest_memory_lifetimefail there and also fail onmain674c25388eon the same GPU (3 of 3 runs each).agc_driver_native_depth_bda_clearis skipped on RADV and lavapipe as onmain.Driver suite (
agc_driver|recompiler) with this PR: lavapipe 541/541; RADV 680M 539/541, the two failures also fail onmain(agc_driver_tessellation, a Mesa 26.2 crash, andagc_driver_bda_device, see #7584); NVIDIAagc_driver|bda|mirror|import555/555. On the rebased head the full suite passes on lavapipe (1654/1654) and on the RADV 680M all but the four that also fail onmainthere (agc_driver_tessellation,agc_driver_bda_device,agc_driver_image_table_vouched_lookups,agc_driver_guest_memory_lifetime); On2d50c08473(the Windows test fixes from @Zenodeon) the Windows VM (WinLibs GCC 15.2, no GPU) builds the PR and passes 1760 of 1761 tests; the one failure,agc_driver_image_array_window_past_layer_limit, does not compile there and fails the same way on the merge base (#8310 fixes it). The VM has no GPU; @LeandroLP23 ran the heap mirror tests on this head on a Radeon 860M (Windows 11, AMD driver 32.0.13058.8001): 8 of 8 pass in 4 runs, andagc_driver_resident_heap_mirrorruns there instead of skipping (comment).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)Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-18T20:45:53Z.
Review: COMMENTED
Static review plus a small arm64 repro on macOS (Apple M2 Max, macOS 27.2, Apple clang 21), head
e6a2bcbbf. I did not build the AGC driver:maindoes not build it on macOS. The macOS series in #7332 does build it, and thereGuestMemory.cppreads regions withmach_vm_regioninstead of/proc/self/maps.The capability check now runs after a
/procread, so the refusal message changes on hosts without procfs.GuestBufferMemory.cpp:2406callsGuestNonzeroBlocksbeforemake_shared<ResidentBuffer>at line 2410, which is whereResidentMirror.cpp:342-343rejects a device withoutsparseBindingorsparseResidencyAliased.GuestNonzeroBlocks→possiblyNonzero→mappings()opens/proc/self/mapsunder#ifndef _WIN32(ResidentMirror.cpp:217-218).populatedPagesdoes the same with/proc/self/pagemap(line 256).AGC graphics: cannot read /proc/self/maps for a heap mirror's pages. That error is raised outside thetrythat wraps it inheapMirrorError, so it carries neitherheap mirror of 0xnorsparse binding.heapMirrorsRefused(BdaResources.cpp:1218-1222) requires both strings, so on MoltenVK, which the PR body lists as lacking the sparse features, itsRequirefails instead of reporting "refused ... mirror behaviour not tested".Repro: I extracted
mappings(),Require, theResidentBuffercapability throw and theheapMirrorsRefusedpredicate withsparseBinding = false:Suggestion:
context.sparseBinding && context.sparseResidencyAliasedbeforeGuestNonzeroBlocksat line 2406, for example with a staticResidentBuffer::Supported(context)that throws throughheapMirrorError. This keeps the refusal the same on every host.mappings()/populatedPages()path on__linux__rather than!_WIN32, and give other hosts the conservative_WIN32branch (maybe.push_back({begin, end, true})). A sparse-capable non-Linux device then still gets a working mirror instead of a procfs error.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-18T20:52:10Z.
AMD on Windows run. Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON. Build:maine8ad642fewith #7651, #7650, #7647, #7655 and #7648 merged together (each merge clean, built once).agc_driver_bda_device,agc_driver_device_queue_plan,agc_driver_graphics,agc_driver_native_depth_bda_clear,agc_driver_tessellationandagc_import_watchpass 3 runs of 3.agc_driver_resident_heap_mirrorskips itself here withskipped, no guest write watch: heap mirrors need one, so this host doesn't exercise the heap-mirror path this PR changes.AI-assisted
Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-18T21:52:58Z.
Windows data: with this PR the 15 tests built from
tests/BdaResources.cpp,DeviceQueuePlan.cppandResidentHeapMirror.cpppass on an Intel UHD 770 and an AMD RX 9070 XT, but the newagc_driver_resident_heap_mirrorskips on both:skipped, no guest write watch: heap mirrors need one.Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built,
ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, withVkCacheemptied first. This heade6a2bcbbfmerged intomainf3059421f.agc_driver_resident_heap_mirrorskipsagc_driver_resident_heap_mirrorskipsThe test files don't build on
mainwithout the rest of the PR, so there is no before-run. On Windows the heap-mirror path itself is therefore not exercised by this test.I also ran full CTest with this PR and the 14 other open AGC PRs I tested in the same batch merged together (#7641, #7630, #7627, #7603, #7600, #7591, #7579, #7535, #7533, #7474, #7462, #7050, #7048, #7650). Neither GPU showed a failure beyond
main's own, except #7650's new test.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-18T23:13:20Z.
@jotitadev thanks, fixed in 71ca66c33e. A device without sparse binding, buffer residency or aliased residency now keeps the whole-range copy
mainmakes instead of throwing, and the nonzero-block scan (the/proc/self/mapsandpagemapreads) only runs when the device has all three, so a host without procfs takes the copy path without touching/proc.heapMirrorsRefusedis gone with the refusal; the new test checks the copy path withSetResidentAddressSpaceLimitinstead. On this head the 86 tests that match the changed areas pass on the RTX 5080, Radeon 610M and lavapipe, and the full ctest in a Windows VM passes 1537/1537.Imported from boykopovar/AnyPS5. Originally posted by 3mro777o on 2026-10-19T09:41:39Z.
This is another reproduction of the #7047 pattern, this time on a discrete AMD GPU with most of its VRAM free. On this title the mirrored ranges are almost all untouched guest memory, which is the case this PR targets.
Setup:
main8816fd772, plus a local fix for the earlierDB_ALPHA_TO_MASK = 0xe701stop. A PR for that fix will follow.Stop: about 10 s after the overworld starts loading, the run fails with
radv/amdgpu: Not enough memory for command submission(the kernel logs the same*ERROR*), thenAGC graphics: vkQueueSubmit recorder: Vulkan result -4. Three runs stopped the same way.Memory at the stop (
mem_info_*_usedsampled once a second,APS5_PROFILE_DRAW=1):[buffers] image mirrors0x2f8c40000+0x98000000What is mirrored: the title makes four 2432 MiB (
0x98000000) GPU pools and prints how much of each it uses:APS5_HEAP_MIRROR_MIB=3072does not help. The run stops on the same range instead:heap mirror of 0x390c40000+0x98000000: past the budget; heap mirrors hold 2432 MiB of 3072 MiB.I have not run this PR on the title. It conflicts with current
maininGuestBufferMemory.cpp, around the new heap mirror budget and sweep, and I did not want to resolve that conflict myself. Once it is rebased I can run Bugsnax on this machine and report the mirror totals and whether the stop goes away.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-19T14:13:35Z.
@3mro777o thanks, that's the case this PR is for. It's rebased onto current
mainnow (head 0670cecb32). The conflict was with #6646's changes to the heap mirror budget and sweep, and both changes are kept.On a device with sparseBinding, sparseResidencyBuffer and sparseResidencyAliased, a heap mirror binds memory only for the 64 KiB blocks where the guest range holds nonzero bytes. So the three nearly empty pools should cost close to nothing. I haven't run Bugsnax myself, so your mirror totals and whether the stop goes away would tell. The
[buffers] image mirrorsline underAPS5_PROFILE_DRAW=1shows the heap MiB and the sparse heaps bound.Imported from boykopovar/AnyPS5. Originally posted by Zenodeon on 2026-10-20T07:39:42Z.
I tested this head (
7472e230e) on Windows and found a test-coverage gap inResidentHeapMirror.cpp:GuestWriteWatchAvailable_nid_postfix()always returns false on Windows, where AGC instead uses the tracked guest arena. The resident-mirror test therefore skips before exercising the implementation. The fixture's separateVirtualAllocheaps are also outside the arena that Windows AGC write tracking covers.I prepared the small test-only correction below:
GuestArenaWriteWatched_nid_postfix()on Windows, keeping the existing check on other platforms.GuestArena.On your unmodified head, the resident-mirror test reports Skipped. With only this fixture correction, 4/4 focused checks pass without skips:
agc_driver_resident_heap_mirror,agc_driver_device_queue_plan,agc_driver_bda_device, andagc_driver_bda_span_reads. The resident-mirror case takes 0.53 seconds and retains its reads/stores, later CPU updates, address-reuse, joined-import retirement and non-sparse fallback checks. The two shared BDA checks also pass on current main3fd1cc393.Machine: Windows 11 build 26200, Intel i7-13700, NVIDIA RTX 4070, driver 610.88; GCC 15.2, Release, SPIR-V Tools enabled. Both main and candidate checks used
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1, andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, with verbose CTest and a 30-second timeout. Neither log contains a VUID error or missing requested validation layer.This validates the focused test behavior on this machine, not a full Astro gameplay run or an FPS/RAM improvement. The runtime implementation is yours; this patch only enables the existing regression on Windows. Would you like to include it here?
Test-fixture correction
Imported from boykopovar/AnyPS5. Originally posted by keravyn-ops on 2026-10-20T18:43:01Z.
Windows / Radeon 780M (Ryzen Z1 Extreme) run of this PR with SILENT HILL: Townfall (PPSA33286), the title from #7047.
Setup
vulkaninfo:sparseBinding,sparseResidencyBufferandsparseResidencyAliasedare all true; the graphics, a compute and a transfer family carrySPARSE_BINDING3fd1cc393b85); B: this PR ated8f15bc1(base636aa09cb), built with WinLibs GCC 15.2.0,--target libs relinker, eboot relinked with the PR's relinker. A and B differ by the main commits between v0.1.3 and the PR base as well as by this PR.PS5.DefaultBackBufferWidth/Heightdefaults are patched from 3840x2160 to 1280x720 (twomov edx, imm32), since the title registers 4K display buffers otherwise.-nothreadtimeoutinuecommandline.txt.APS5_PROFILE_DRAW=1,APS5_ADDRESS_COPY_MAX_MIB=8192, warm shader cache, no input (title sequence), 360 s per run, process memory sampled every 5 sResults (360 s each)
[buffers] image mirrorsat the end[guestmem] read(cumulative)Observations
0 sparse heaps boundrefers to something else, as far as I can tell).compute shader 0x1840300000: ... storing storage image results pending over memory outside the write watch without the guest bytes saved before them is not implemented); 1 of 2 A runs, 0 of 2 B runs, so I can't attribute that to the PR.Logs and the sampled CSV are available if useful.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T20:54:19Z.
bindSparseMirrorno longer catches a failedacquireMirror. Onmain(fromb88ad02090) a sparse descriptor heap whose mirror can't be made prints[gpu] ...; copying the sparse heap insteadand returns false, so the caller copies the heap for that dispatch. Oned8f15bc1bthe same failure (pastAPS5_HEAP_MIRROR_MIB, a buffer or allocation failure, or a sparse bind error) is thrown out of the build instead. The description doesn't mention this, and no test covers it.Every new throw path in
acquireMirrorreturns its reserved bytes toheapBytesbefore throwing, so keeping main's try/catch looks safe. Could you restore it, or say why throwing is right now and add a test for it?Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-20T21:00:33Z.
You're right, that catch shouldn't have gone. Restored in
0b9b519a5e: a sparse heap whose mirror can't be made prints the same[gpu] ...; copying the sparse heap insteadline and is copied for that dispatch, as on main.New test
agc_sparse_heap_mirror_budget: an 8 MiB sparse heap with 5 MiB committed, past the test's 4 MiBAPS5_HEAP_MIRROR_MIB. It checks that the heap is copied up to its last committed byte, that a store is written back, and that no mirror or held bytes are left. Without the catch it throwspast the budget; with it, it passes on NVIDIA, RADV and lavapipe, along with the other heap mirror tests.Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-21T08:14:46Z.
A Windows / AMD APU data point: Radeon 860M (
1002:1114, driver 32.0.13058.8001, 512 MiB UMA carve-out on 32 GiB), Windows 11 26300, WinLibs GCC 15.2.0, Release. I tested this PR at0b9b519a5e, merged ontomainec7eacc62, withANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1.Driver support.
vulkaninforeportssparseBinding,sparseResidencyBufferandsparseResidencyAliasedas true, withsparseAddressSpaceSize0x7ffa00000000. The graphics, compute and transfer families all carrySPARSE_BINDING.agc_sparse_heap_mirror_budgetdoesn't start on Windows. It exits with0xc0000135(DLL not found) because it isn't in theif(WIN32)set_tests_properties(... ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")list next to it, or in theTIMEOUT 30list. Withbuild/core/libs/libs/unpatchedprepended toPATHby hand, it passes:agc_driver_resident_heap_mirrorskips on Windows:skipped, no guest write watch: heap mirrors need one. So no test runs the resident path on Windows. Its fixture doesn't take its heaps from write-watched guest memory, which on Windows means the guest arena.Other tests. The other 43 tests matching
resident_heap_mirror|device_queue_plan|heap_mirror|host_import|import_watch|bda|addresspass,agc_driver_device_queue_planamong them;agc_host_import_sparseskips.At runtime it didn't run. I ran four alternating SuperTuxKart races (PPSA69421), two on
mainand two with this PR, withAPS5_HOST_IMPORT_MIB=1056. That leaves 5,000–23,000 imports refused per run, but the title makes no heap mirrors at all: the refused ranges are served by copies. FPS is the same in both trees, about 2.1 in the race, and neither tree logs an error. So none of the titles I have here exercise the resident path, and I can't add an end-to-end measurement to keravyn-ops's 780M run.Imported from boykopovar/AnyPS5. Originally posted by Zenodeon on 2026-10-21T11:48:05Z.
@fma-rc I prepared the Windows test fixes in https://github.com/fma-rc/AnyPS5/pull/4, targeting your
fix/agc-heap-mirror-residentbranch so you can merge it directly (or cherry-pick11e02f25438bcf809fcddad57f643ff73ca42f7e).It adds the missing DLL-path setup and 30-second timeout for
agc_sparse_heap_mirror_budget, and moves the Windows resident fixture to guest-arena allocations with the appropriate write-watch probe and cleanup. All existing assertions are retained; production code is unchanged.Both reported issues reproduced before the fix. Afterward, 12 unique focused tests pass with zero skips on Windows 11 / RTX 4070, driver 610.88; the resident test actually executes and passes. Matched Vulkan controls on main and the fix show identical known older-layer diagnostics, with no new validation-error signatures or missing-layer messages. Full details are in the fix PR. AI-assisted: yes, OpenAI Codex.
Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-21T12:40:10Z.
Thanks @Zenodeon, cherry-picked as
2d50c08473with you as author. It addsagc_sparse_heap_mirror_budgetto the Windows PATH and timeout lists and moves the resident fixture to guest-arena heaps, the write-watched memory whose absence madeagc_driver_resident_heap_mirrorskip for @LeandroLP23.On this head the Windows VM build passes 1760 of 1761 tests; the failing one doesn't compile on the merge base either (#8310). The VM has no GPU, so @LeandroLP23, if you have time, a run of
resident_heap_mirror|heap_mirroron the 860M would be the first Windows GPU run of the resident path.Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-21T14:22:44Z.
@fma-rc ran
heap_mirroron head2d50c08473on the Radeon 860M (Windows 11, AMD driver 32.0.13058.8001, MinGW GCC 15.2,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1): 8/8 pass, and 3 more repeats pass too.agc_driver_resident_heap_mirrornow runs instead of skipping. It selected the 860M and printedresident heap mirror tests passed(0.89 s). Its log also shows the import write watch holding:host imports of write-watched memory keep the write watch: yes.agc_sparse_heap_mirror_budgetnow findslibc.dlland passes (0.10 s).agc_heap_mirror_unwatch,agc_sparse_heap_mirror_unwatch,agc_heap_mirror_run_unwatchand their_no_space_cachevariants pass.The build used
-k 0; the only target that didn't build isImageArrayWindowPastLayerLimit.cpp, which fails the same way onmain. The test binaries were rebuilt from this head.Imported from boykopovar/AnyPS5. Originally posted by 3mro777o on 2026-10-21T22:41:40Z.
@fma-rc here is the Bugsnax run I promised, on head
2d50c08473merged ontomaina6dcea927.Setup: RX 6700 XT (gfx1031, 12 GiB VRAM), 16 GB RAM (GTT 7934 MiB), Linux 7.2, RADV Mesa 26.2.5, Bugsnax (PPSA01503) 02.000.000,
APS5_PROFILE_DRAW=1.vulkaninforeportssparseBinding,sparseResidencyBufferandsparseResidencyAliasedas true. Currentmainstill stops this title atDB_ALPHA_TO_MASK = 0xe701, so both builds skip that check (a test-only local change, not part of either side). Each run lasts up to 120 s, and a monitor stops it if GTT passes 85 %.main[buffers] image mirrors)GPU1: 2429 GPU2: 39GPU1: 2430 GPU2: 2429 GPU3: 38–62(2 runs)Not enough memory; 1 run hits a general protection fault inlibc.prx.guestat 16.5 smainstopped, and fills its second pool, while GTT stays under 6 GiB. In those runs the overworld was playable: the character could be moved around normally.libcfault on another title once host imports start succeeding. I haven't tied it to this PR.vkAllocateMemorycalls. That's separate from this PR.Imported from boykopovar/AnyPS5. Originally posted by 3mro777o on 2026-10-21T23:12:12Z.
Follow-up: a longer manual session on the same build, about 22 minutes of play in the overworld and cutscenes, with the window at 2560x1440 and the title rendering at 3840x2160.
Not enough memoryand no device loss.DRIVER: 100 msof a 105 ms frame there, so the time is spent on the CPU side of the driver, not in mirror memory.libc.prx.guest.prx+0xb6ff. The last log line was a texture load (/app0/Content/Models/Environment/TerrainTextures/DesertSand01_D.gnf).mainnever runs this long on this machine, so I cannot tell whether the fault is new with this PR. I have not looked into it yet.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T02:55:33Z.
@fma-rc a data point for this PR from #9514's thread: parl0v ran Sword of the Sea (PPSA25344) 01.510.000 on Windows 10, with an RTX 4060 8 GB and 16 GB of RAM (comment). Once #9514 gets the New Game load past the copy cap, it stops on
heap mirror of 0x32af9e0000+0x100000: vkAllocateMemory buffer ... heap 1 7704/7448 MiB; heap mirrors hold 2858 MiB, andmainwithAPS5_ADDRESS_COPY_MAX_MIB=1024stops on the same heap. This PR binds heap mirrors in device-local memory, only where the guest holds bytes, so with it the mirrors wouldn't come from that heap, provided the 4060 reportssparseBinding,sparseResidencyBufferandsparseResidencyAliased. I've asked parl0v whether they'd try #9514 with this PR.Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-22T11:47:50Z.
@fma-rc a coordination note, since #9551 edits the same heap mirror code.
What #9551 does:
bindSparseMirrorfalls back to a joined range over a run of adjacent registered ranges, a newjoinedHeapRangewith a small cache.sweepMirrorsfirst releases joined ranges whose member ranges have expired.releaseImportedMirrorsreleases a heap mirror only when the imported range covers the mirror's reserved span, so importing one member no longer drops a joined mirror.How it meets this PR:
git merge-treeof the two heads reports two textual conflicts inGuestBufferMemory.cpp, both mechanical:void sweepMirrors();(the joined-range cache here,blockBytesand the related helpers there). Keep both.releaseImportedMirrors. Keep #9551'sfound->second->reserved > bytescondition together with this PR'saccounted/unlistMirroraccounting.Neither depends on the other: #9551 changes which range a mirror is built over and when it is released, and this PR changes how a mirror's memory is allocated and bound. Whichever merges second needs the two resolutions above, and I'm happy to rebase #9551 onto this one if it lands first.
Imported from boykopovar/AnyPS5. Originally posted by winstrex on 2026-10-22T13:45:30Z.
@fma-rc #9670 adds a presentation queue in the device-creation block that this PR moves into
PlanDeviceQueues. A merge of the two conflicts only there, inVulkanDevice.cpp. #9670 is small (+62/−7) and its open review items are process ones, so I'd propose that it lands first and that this PR adds the presentation queue to its plan when it rebases. If you'd rather this one went first, I'll rebase #9670 on top of it instead. Just say which you prefer.Whichever lands second has to keep this:
SelectPresentQueue(families[family].queueCount, mainCount). In the plan that is one more field (e.g.presentIndex), the main family'squeueCountbecomespresentIndex + 1, andprioritiesneeds three entries.DeviceQueuePlancase such as "settle on the main family, three queues, with a window" would cover that.