Skip to content

feat(agc): report live device memory allocations when the device is lost - #13148

Open
Prophet069 wants to merge 1 commit into
boykopovar:mainfrom
Prophet069:pr/agc-live-allocations
Open

Prophet069 wants to merge 1 commit into
boykopovar:mainfrom
Prophet069:pr/agc-live-allocations

Conversation

@Prophet069

@Prophet069 Prophet069 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What

When the Vulkan device is lost, [device-fault] gives no hint whether memory pressure was involved. This counts vkAllocateMemory and vkFreeMemory per device through a wrapper around the device proc resolver. The device-loss report then prints the live allocations and bytes per memory type, split by size class (<1 MiB … ≥256 MiB). It also lists the eight largest callers: the buffer pool operation, host imports, resident mirrors and the pixel LDS pool, with everything else unlabelled. A warning is printed when live allocations exceed maxMemoryAllocationCount. Labels are thread-local RAII scopes, so code without one is unaffected. tests/LiveAllocations.cpp checks counting, size classes, labels, frees and the report text against a fake resolver.

Tested

  • With ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (VVL vulkan-sdk-1.4.321.0; neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS), ctest --test-dir build -R <the 63 tests of agc_shader_memory_tests, agc_driver_cmask_fast_clear_tests, agc_driver_graphics_tests and agc_driver_sample_multisample_target_tests> -V on main 8c8b998620 and on this branch, same machine and GPU, plus the new agc_live_allocations test: main 63/63 passed, 0 VUID-; this branch 64/64 passed, 0 VUID-.
  • agc_driver_unclamped_normalized_blend (the feat(agc): merge a draw into more than one unclamped normalized color target #12916 multi-target regression, 2 draws blending two targets each) passed on main and on this branch with the same validation settings, 0 VUID-.
  • PPSA02015 (Death Stranding 2), Windows, integration branch, seven runs ending in device loss after 667-1400 s. The report showed about 3000 live allocations against a limit of 4294967295, and about 6 GiB device-local plus about 8 GiB GPU-visible host memory, mostly about 6900 textures. Host imports came to about 4 GiB and the heap mirror to about 1 GiB. This ruled out the allocation count and the cache sizes as causes on an 8 GB GPU with 16 GB RAM.
  • The commit changes only the files listed in the diff; it no longer carries the pre-feat(agc): merge a draw into more than one unclamped normalized color target #12916/fix(agc): don't release a label wait on a store its queue already took and reset #12923 tree of the first push.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU (8 GB), driver 616.64, Windows 10 Pro 19045
  • AI-assisted: yes

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

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.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 1896 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 2434 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 4040 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 4448 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 4472 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
PR 4847 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5372 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6146 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6186 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6187 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6192 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6197 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6209 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6280 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6290 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6481 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6548 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6782 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6804 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6913 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6918 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6987 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6989 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6995 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7002 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7085 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7275 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7369 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7449 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7457 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7464 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7508 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7514 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7604 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7622 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/ResidentMirror.cpp
PR 7643 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7668 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7689 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8004 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 8089 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8212 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 8246 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 8484 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8592 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8912 core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
PR 9012 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 9020 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9289 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 9335 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9356 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9387 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9508 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/ResidentMirror.cpp
PR 9712 core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9748 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9852 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 9875 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9897 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9915 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 10043 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 10141 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 10193 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/ResidentMirror.cpp
PR 10233 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10351 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 10359 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10442 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 10443 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 10497 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 10652 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 10678 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 10757 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10867 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 10920 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 11435 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 11436 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 11452 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 11483 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 11551 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 11825 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 11920 core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
PR 12157 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 12324 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 12746 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 12827 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 12828 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 12840 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 12855 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 12904 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 12944 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 12994 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 13263 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 13486 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 13707 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 13793 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13809 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13863 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/ResidentMirror.cpp
PR 13920 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/ResidentMirror.cpp
PR 13928 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/ResidentMirror.cpp
PR 13929 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/ResidentMirror.cpp
PR 14032 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 14051 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 14076 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
PR 14217 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 14218 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 14344 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 14367 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 14709 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 14871 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 14944 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 15015 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 15136 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 15169 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 15327 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 15343 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 15398 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 15423 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 15456 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 15505 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 15548 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 15551 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 15570 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 15572 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 15621 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 15658 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 15674 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 15719 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 15792 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 15840 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 15859 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 15917 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 15919 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 15941 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 15967 core/libs/prx/libSceAgcDriver/Graphics/src/ResidentMirror.cpp
PR 15986 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 16013 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 16086 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 16115 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 16130 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 16188 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 16252 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 16312 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 16363 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 16474 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@Prophet069 thanks for these. One problem common to all five PRs (#13145, #13146, #13147, #13148, #13149): each commit sits on main 5ecef095b6, but its tree still has the older versions of the files that #12916 and #12923 changed (for example RequestSerializer.cpp, UnclampedNormalizedBlend.cpp, LabelHistory.cpp, WaitMemory.cpp). So each PR, as it stands, would undo both of those merges; that is where the ~465 deleted lines in every diff come from.

For this PR, git diff 08a10d2253 <head> (main just before #12916) shows only your own change. Could you rebase it onto current main keeping only that change (for example git rebase --onto origin/main 08a10d2253 on a branch whose tree is your change applied to 08a10d2253, or re-apply your change on a fresh branch from main), then force-push? We'll review the change itself as soon as the diff no longer touches the #12916/#12923 files.

@MarcZX10 MarcZX10 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — changes requested

The PR introduces an unrelated regression that rejects draws with more than one merged color target, so I cannot approve this head.

What I ran

Reviewed head 6d832a9f907d6dee6a2ffe819b5d81f3b83d35b6 against current main base 8c8b9986204d5b1cbb23847b363df00ae832ec9c; the merge preview is clean (7ee5166fcedc64b4976c5ceb79aa7577656e7235). Environment: Linux container; no compiler invoked.

git merge-tree --write-tree 8c8b9986204d5b1cbb23847b363df00ae832ec9c 6d832a9f907d6dee6a2ffe819b5d81f3b83d35b6
git diff --check 8c8b9986204d5b1cbb23847b363df00ae832ec9c...6d832a9f907d6dee6a2ffe819b5d81f3b83d35b6
python tools/check_conventions.py --base 8c8b9986204d5b1cbb23847b363df00ae832ec9c --head 6d832a9f907d6dee6a2ffe819b5d81f3b83d35b6

Results

Check Result
Merge preview Pass; clean tree 7ee5166fcedc64b4976c5ceb79aa7577656e7235.
git diff --check Pass; no output.
Conventions Pass.
Hosted CI snapshot Windows, Ubuntu/Windows relinker, and ASan passed; macOS relinker jobs were queued.
Raw local command output

git merge-tree --write-tree ...:

7ee5166fcedc64b4976c5ceb79aa7577656e7235

git diff --check ...: no output (exit status 0).

python tools/check_conventions.py ...:

All conventions checks passed.

Findings

Blocking

  • ExportTargetMerge now returns one TargetMerge and requires merge.mask == 0 for each partial-write color. A draw with two eligible color targets reaches the second iteration with a nonzero mask and fails this requirement instead of emitting both merges. The current base retains the vector-returning ExportTargetMerges path and its checks for multiple non-overlapping targets. This change also replaces the recompiler's targetMerges vector with one targetMerge, so multi-target merge information cannot be represented downstream. Keep the multi-target behavior and add a regression test with two eligible targets, or separate the live-allocation reporting change from this refactor. Evidence: PR head State.cpp, PR head Recompiler.hpp, and current-base State.cpp.

Non-blocking

None identified in this source review.

Not verified

  • I did not build or run CTest, the new allocation test, GPU validation, or a console/game workload.
  • The author reports 64/64 focused tests and a Death Stranding 2 device-loss run; I did not independently reproduce them.
  • At the status check, macOS relinker jobs were queued; Linux product and specialized jobs were skipped.

To get this to a good state

Preserve support for multiple merged color targets and add a focused regression test, then request another review. I will rerun the merge preview, diff check, and conventions check on the updated head.

vkAllocateMemory and vkFreeMemory are counted per device. At device loss the fault report lists the live allocations and bytes per memory type, split by size class and by the driver operation that allocated them (buffer pool operations, host imports, resident mirrors, the pixel LDS pool; the rest is unlabelled), and a warning is printed when the live count exceeds maxMemoryAllocationCount.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Prophet069
Prophet069 force-pushed the pr/agc-live-allocations branch from 6d832a9 to ac75125 Compare October 30, 2026 05:19
@Prophet069

Copy link
Copy Markdown
Contributor Author

Thanks, you were right: I squashed onto a moving origin/main, so the commit kept the pre-#12916/#12923 tree. Re-applied only this change on a fresh branch from main 8c8b998620 and force-pushed (same patch-id as git diff 08a10d2253 <old head>); the diff now touches only this PR's files. Rebuilt and reran the focused tests on 8c8b998620 and on the new head with the validation layer; the description has the results.

@MarcZX10 The single-target ExportTargetMerge, the targetMerge field and the Require(merge.mask == 0, ...) came from the stale tree of the first push, which reverted #12916; this PR does not change them. The new head leaves State.cpp, Recompiler.hpp and Recompiler.cpp as on main. agc_driver_unclamped_normalized_blend (2 draws blending two targets each) passes on main 8c8b998620 and on this head with VK_LAYER_KHRONOS_validation, 0 VUID-.

@Tehshortbus

Copy link
Copy Markdown
Contributor

@Prophet069 a heads-up: this branch sets the files #12916 changed back to their contents before #12916 merged (3d2d264392), although its base already includes #12916. For example, core/libs/prx/libSceAgcDriver/tests/execution/UnclampedNormalizedBlend.cpp loses TwoTargetProgram and the two-target draws, and ShaderPixelStageInfo::targetMerges goes back to a single targetMerge. Merged as it is, this would undo #12916, and PPSA26344 would stop again on its two-target blend (#12796). The same happens in #13145, #13146, #13147, #13148 and #13149, so they may share a stale copy of those files.

AI-assisted: yes (Claude Code)

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — changes requested

The allocation counter does not observe all allocations made by this device, so the live totals and allocation-limit warning can under-report Vulkan memory use.

What I ran

Reviewed head ac751257a9fa8571cd0051964020e97d0e35cf31 on base 8c8b9986204d5b1cbb23847b363df00ae832ec9c; the merge preview is clean (318b92639880d9b7e0c655535d6d6bea239efb03). Environment: Linux x86-64. I ran the following checks; no local build or tests were run.

git diff --check 8c8b9986204d5b1cbb23847b363df00ae832ec9c...ac751257a9fa8571cd0051964020e97d0e35cf31
git merge-tree --write-tree 8c8b9986204d5b1cbb23847b363df00ae832ec9c ac751257a9fa8571cd0051964020e97d0e35cf31
python3 tools/check_conventions.py --base 8c8b9986204d5b1cbb23847b363df00ae832ec9c
gh pr checks 13148 --repo boykopovar/AnyPS5

Results

Check Result
Diff check Passed; no output
Merge preview Clean
Conventions Passed
Hosted checks Windows, conventions, eligibility, labels and report passed; Linux, register-context, relinker, relinker-asan and write-watch skipped
Local tests Not run; no build performed
Check output
git diff --check 8c8b9986204d5b1cbb23847b363df00ae832ec9c...ac751257a9fa8571cd0051964020e97d0e35cf31
(no output; exit status 0)

git merge-tree --write-tree 8c8b9986204d5b1cbb23847b363df00ae832ec9c ac751257a9fa8571cd0051964020e97d0e35cf31
318b92639880d9b7e0c655535d6d6bea239efb03

python3 tools/check_conventions.py --base 8c8b9986204d5b1cbb23847b363df00ae832ec9c
All conventions checks passed.

gh pr checks 13148 --repo boykopovar/AnyPS5
labels          pass      9s
windows         pass      15m57s
linux           skipping  0
register-context skipping 0
relinker        skipping 0
relinker-asan   skipping 0
write-watch     skipping 0
conventions     pass      16s
eligibility     pass      7s
report          pass      52s

Findings

Blocking

  • VulkanDevice.cpp, DeviceFunction and the direct marker/upload allocations: DeviceFunction resolves through deviceProc, while the new wrapper is installed in contextDeviceProc at device setup. The vkAllocateMemory/vkFreeMemory calls for buffer markers and display uploads use DeviceFunction, so they bypass countedAllocateMemory/countedFreeMemory. Those allocations are omitted from the live count and report, despite the PR describing per-device vkAllocateMemory/vkFreeMemory accounting. Route these calls through the wrapped resolver (while preserving any existing deferred-destruction wrapper), or explicitly include them in the same accounting path. Add a focused test that exercises these direct allocations and confirms allocation and free totals change.

Non-blocking

None found in the checks above.

Sources

Not verified

I did not run local tests, a build, Linux hosted jobs, specialized hosted jobs, or a game/device-loss reproduction. The author-reported Windows/GPU tests in the PR description were not independently run in this review.

To get this to a good state

Ensure all allocations owned by this Vulkan device flow through the accounting wrapper and add coverage for the marker/upload paths. I will re-run the same non-building checks on the new head and review the focused test result.

@MarcZX10

Copy link
Copy Markdown
Contributor

Re-checked — convention check passed on the exact head

The convention result remains passing; the command in my review did not pin the head, so I reran it explicitly against the PR head.

python3 tools/check_conventions.py --base 8c8b9986204d5b1cbb23847b363df00ae832ec9c --head ac751257a9fa8571cd0051964020e97d0e35cf31
All conventions checks passed.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@Prophet069 thanks, the report itself is useful (counts by memory type, size class and caller, the maxMemoryAllocationCount warning), and the labels are cheap. Reviewed at ac75125. Two points before it can go in, one smaller note:

  1. The counting is on the normal path, and it takes one process-wide lock. CountAllocations replaces the device proc resolver, so countingDeviceProc locks the registry mutex and does a hash lookup for every Context::Function<...>() call, which resolves per call (DeviceProcLookups counts them) and runs on all queue workers. Each vkAllocateMemory takes the mutex twice and builds a std::string plus a std::map and unordered_map entry; each vkFreeMemory takes it once. None of that is needed until the device is lost. Please keep the lookup path lock-free (for example resolve the two real pointers once, return them for those two names without the registry, and forward everything else directly), and either keep the per-allocation bookkeeping cheap (fixed arrays, no strings) or only do it when a switch is set. Please also add a normal-path measurement: an alternated A/B on one title, frame p50 and p99 and DeviceProcLookups per frame, with and without the change.
  2. The registry entry is never removed. DeferredDestruction erases its entry in DestroyDeferredObjects(device); LiveAllocations has no counterpart, so when a second device gets a recycled VkDevice handle value, CountAllocations throws "allocation counting was set up twice for one device" in the VulkanDevice constructor. Please drop the entry before vkDestroyDevice and add a test that creates two devices in a row.
  3. Note: allocations made before CountAllocations runs, and frees done through the raw resolver in the destructor, are not seen, so the totals are "since counting started". A line in the description or the report header would say so.

Also found (reproduced with the exact tracker and fake-driver probes):

  1. Bookkeeping can throw after a successful allocation. After the driver returns VK_SUCCESS, the string/map insertions can throw std::bad_alloc: the allocation stays live but the callback throws instead of returning its result. Please make the tracking best effort (preserve allocation/free semantics, mark the statistics incomplete on a bookkeeping failure) and add a post-success failure test.
  2. Deferred frees are counted too early on MoltenVK. CountAllocations wraps the deferred-destruction resolver there, so the counter subtracts memory when deferredFreeMemory only queues the free; the physical vkFreeMemory runs later, and the report can say zero while allocations are still live. Please count physical frees (compose the layers the other way), or report pending frees separately, with a composed-layer test. For point 2, note the real teardown path uses the raw resolver, so the cleanup has to live there, not only in the counting resolver's destroy.

@MarcZX10

Copy link
Copy Markdown
Contributor

Re-checked — current head, changes requested

The current head still performs synchronized registry lookups on the device-procedure path and has correctness gaps in allocation tracking and deferred frees.

What I ran

Reviewed exact PR head ac751257a9fa8571cd0051964020e97d0e35cf31 against current main 88e2d98f49c949380b45c9cfa266687e28d4443c; the merge preview is clean (949cedae2e85c1cb363376abeace9f2d06a9ee5c). Environment: Linux x86-64. I did not build or run tests.

git diff --check upstream/main...refs/reviews/pr-13148-current
python3 tools/check_conventions.py --base upstream/main --head refs/reviews/pr-13148-current
python3 tools/check_main_sync.py --base upstream/main --head refs/reviews/pr-13148-current
git merge-tree --write-tree upstream/main refs/reviews/pr-13148-current
gh pr checks 13148 --repo boykopovar/AnyPS5

Results

Check Result
Diff check Passed; no output
Conventions Passed; All conventions checks passed.
Current-main merge preview Clean; tree 949cedae2e85c1cb363376abeace9f2d06a9ee5c
Main synchronization Clean merge; two touched files changed since the merge base
Hosted checks Windows, conventions, labels, eligibility, and report passed; Linux and specialized jobs skipped
Local check output
[git diff --check]
(no output; exit status 0)

[python3 tools/check_conventions.py --base upstream/main --head refs/reviews/pr-13148-current]
All conventions checks passed.

[python3 tools/check_main_sync.py --base upstream/main --head refs/reviews/pr-13148-current]
refs/reviews/pr-13148-current is 1 ahead and 96 behind upstream/main (merge base 8c8b99862)
merge: clean
2 file(s) changed on both sides since the merge base:
  core/libs/prx/libSceAgcDriver/CMakeLists.txt
  core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
merged pull requests that touched them: #12378

[git merge-tree --write-tree upstream/main refs/reviews/pr-13148-current]
949cedae2e85c1cb363376abeace9f2d06a9ee5c

Findings

Blocking

  • Normal-path overhead: countingDeviceProc locks the registry and hashes through it for every name other than the two wrapped functions, and countedAllocateMemory/countedFreeMemory also lock around calls. Allocation tracking is activated during normal device initialization, so the lock and lookup cost is on the regular resolver path. Please resolve the wrapped function pointers once and forward unrelated names without the registry lock; also avoid allocating strings/map nodes for every allocation or make tracking explicitly opt-in. Include an A/B measurement on the same title with frame p50/p99 and resolver lookups per frame.
  • Device-handle reuse: the registry entry is inserted in CountAllocations and is not erased on device teardown. A later device reusing the same VkDevice handle therefore makes the next registration fail with “allocation counting was set up twice for one device.” Remove the entry on the actual raw-resolver teardown path and add a sequential two-device test.
  • Tracking can change Vulkan call semantics: after the driver returns VK_SUCCESS, map/string insertion can throw std::bad_alloc; the allocation then exists but the wrapper throws instead of returning the successful result. Make tracking best-effort, mark statistics incomplete on tracking failure, and test a post-success bookkeeping failure.
  • Deferred frees can be reported as complete too early: when the deferred-destruction resolver is wrapped by the counter, countedFreeMemory decrements the live total when the free is queued rather than when Vulkan frees the allocation. Compose the wrappers so the counter observes physical frees, or report pending frees separately, and test the composed path.

Non-blocking

  • The report totals begin after counting is registered; allocations made earlier and frees through the raw resolver during teardown are absent. Label the reported totals as a snapshot since tracking began.
  • The author says a corrected tree was pushed, but GitHub still reports head ac751257a9fa8571cd0051964020e97d0e35cf31. The current head is cleanly based on the refreshed main ancestry; I have reviewed only this SHA.

Sources

Not verified

I did not run the reported fake-driver probes, a C++ build, CTest, or a normal-path performance comparison. Linux and specialized hosted checks were skipped.

To get this to a good state

Address the four correctness/performance findings, add the lifecycle and failure-path tests, and report the matched A/B measurement. I will recheck the exact new head and rerun the non-building checks above.

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head ac75125 merged onto main 98ddd9c · tested 2026-10-30 12:30 UTC · 19 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,364 passed · 6 failed (0 new, 2 also fail on main, 4 unstable on main) · 41 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,411 of 2,987 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (904 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_bda_device 59.8 s
Intermittent validation messages (1, seen once in the parallel run, not reproduced when the test was re-run alone 2 times; not counted against this PR)
agc_driver_depth_clear_hle: VUID-vkCmdCopyBuffer-commonparent (6x)
Unstable on main (4, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_depth_clear_hle: failed in 1 of the last 8 main runs
agc_driver_submit_progress: failed in 5 of the last 8 main runs
agc_submit_progress: failed in 5 of the last 8 main runs
agc_submit_progress_no_timeline: failed in 6 of the last 8 main runs
Failing on main too (2, not counted against this PR)
guest_mmap_executable
guest_socket_options_multicast
Validated but not compared (1, not in the main baseline's validation pass)
agc_live_allocations
Validation IDs already present on main (4 IDs in 425 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (425 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_passes_draw_transitions, agc_driver_address_passes_targets_split, agc_driver_array_layer_target_cpu, agc_driver_bda_span_reads, agc_driver_bda_span_reads_draw_pipeline, agc_driver_bitfield_mask, and 417 more
VUID-vkCmdCopyImage-srcImage-01548 (13 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 5 more
VUID-vkCmdCopyImage-srcImage-01551 (13 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 5 more
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
Skipped (41)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_msaa_dcc_compared_import_2: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_4: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_8: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_main: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fresh: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or plat
Reproduce
git fetch origin ac751257a9fa8571cd0051964020e97d0e35cf31 98ddd9c1792bbab016ceed5db267a93d1d61f00a
git checkout 98ddd9c1792bbab016ceed5db267a93d1d61f00a && git merge --no-ff ac751257a9fa8571cd0051964020e97d0e35cf31
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@adriadam10 adriadam10 self-assigned this Oct 30, 2026

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the rebase; the diff is now only this change. Checked against the head ac751257a9, and the points @oneandonlydean and @MarcZX10 raised hold, so this stays at changes:

  • LiveAllocations.cpp:117-127: countingDeviceProc locks the process-wide registry mutex and does a hash lookup for every name other than the two wrapped ones, on the normal path. Resolve the real vkAllocateMemory/vkFreeMemory once, return them without the registry and forward everything else directly. Keep per-allocation bookkeeping cheap (no strings or map nodes) or make it opt-in. Add the alternated A/B on one title (frame p50/p99, DeviceProcLookups per frame).
  • LiveAllocations.cpp:139-152: the registry entry is never removed, so a second device with a recycled VkDevice value throws "set up twice". Erase it on the raw-resolver teardown path and add a two-devices-in-a-row test.
  • LiveAllocations.cpp:59-83: bookkeeping can throw std::bad_alloc after the driver returned VK_SUCCESS. Make tracking best effort, mark the statistics incomplete, and test a failure after success.
  • VulkanDevice.cpp:2181: the counter wraps the deferred-destruction resolver, so frees are subtracted when deferredFreeMemory queues them, not when Vulkan frees. Count physical frees (compose the layers the other way) or report pending frees separately, with a composed-layer test.
  • VulkanDevice.cpp:640, :718, :752, :988, :991: DeviceFunction and the teardown frees go through deviceProc, so marker and display-upload allocations bypass the counter. Route them through the wrapper and test them.
  • State in the report header or description that totals are "since counting started".

The new test only uses a fake resolver; it should also cover the cases above.

@github-actions github-actions Bot added build agc libSceAgc* labels Oct 30, 2026
@oneandonlydean oneandonlydean self-assigned this Oct 30, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants