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

Open
Prophet069 wants to merge 1 commit from upstream-pr/13148 into main
Prophet069 commented 2026-10-30 04:16:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Prophet069 on 2026-10-30T04:16:01Z.


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 #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-#12916/#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

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5079378196 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13148). Originally posted by [Prophet069](https://github.com/Prophet069) on 2026-10-30T04:16:01Z. --- ### 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 <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - 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 #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-#12916/#12923 tree of the first push. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU (8 GB), driver 616.64, Windows 10 Pro 19045 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-30 04:51:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T04:51:49Z.

Review: CHANGES_REQUESTED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5708216361 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13148#pullrequestreview-5708216361). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T04:51:49Z. **Review:** CHANGES_REQUESTED --- # 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. ```sh 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. | <details> <summary>Raw local command output</summary> `git merge-tree --write-tree ...`: ```text 7ee5166fcedc64b4976c5ceb79aa7577656e7235 ``` `git diff --check ...`: no output (exit status 0). `python tools/check_conventions.py ...`: ```text All conventions checks passed. ``` </details> ## 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`](https://github.com/boykopovar/AnyPS5/blob/6d832a9f907d6dee6a2ffe819b5d81f3b83d35b6/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L1945-L1955), [PR head `Recompiler.hpp`](https://github.com/boykopovar/AnyPS5/blob/6d832a9f907d6dee6a2ffe819b5d81f3b83d35b6/core/shader/recompiler/Recompiler.hpp#L239), and [current-base `State.cpp`](https://github.com/boykopovar/AnyPS5/blob/8c8b9986204d5b1cbb23847b363df00ae832ec9c/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L1945-L1952). ### 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.
MarcZX10 commented 2026-10-30 05:43:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T05:43:43Z.

Review: CHANGES_REQUESTED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5708518143 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13148#pullrequestreview-5708518143). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T05:43:43Z. **Review:** CHANGES_REQUESTED --- # 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. ```sh 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 | <details> <summary>Check output</summary> ```text 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 ``` </details> ## Findings ### Blocking - [VulkanDevice.cpp, `DeviceFunction` and the direct marker/upload allocations](https://github.com/boykopovar/AnyPS5/blob/ac751257a9fa8571cd0051964020e97d0e35cf31/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp#L636-L640): `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 - [Counter wrapper installation and Vulkan device-function resolution at this PR head](https://github.com/boykopovar/AnyPS5/blob/ac751257a9fa8571cd0051964020e97d0e35cf31/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp#L636-L640) - [Allocation-counter resolver and tracked functions at this PR head](https://github.com/boykopovar/AnyPS5/blob/ac751257a9fa8571cd0051964020e97d0e35cf31/core/libs/prx/libSceAgcDriver/Graphics/src/LiveAllocations.cpp#L115-L120) - [Counter setup at this PR head](https://github.com/boykopovar/AnyPS5/blob/ac751257a9fa8571cd0051964020e97d0e35cf31/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp#L2175-L2178) ## 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.
adriadam10 commented 2026-10-30 13:26:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-30T13:26:55Z.

Review: CHANGES_REQUESTED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5712913257 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13148#pullrequestreview-5712913257). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-30T13:26:55Z. **Review:** CHANGES_REQUESTED --- 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.
ligmaSec commented 2026-12-03 22:54:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:54:27Z.

Review: COMMENTED


CountAllocations registers a VkDevice permanently. The new registry has no erase path, while VulkanDevice.cpp destroys the device in cleanup. If Vulkan reuses that handle when a device is recreated, emplace fails and the new initialization throws the duplicate-registration error. Please unregister after the last wrapped free and cover both a failed initialization and a second mock device registration using the same handle. The trial merge also conflicts in the device and allocation code.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6180072799 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13148#pullrequestreview-6180072799). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T22:54:27Z. **Review:** COMMENTED --- `CountAllocations` registers a `VkDevice` permanently. The new registry has no erase path, while `VulkanDevice.cpp` destroys the device in cleanup. If Vulkan reuses that handle when a device is recreated, `emplace` fails and the new initialization throws the duplicate-registration error. Please unregister after the last wrapped free and cover both a failed initialization and a second mock device registration using the same handle. The trial merge also conflicts in the device and allocation code. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/13148:upstream-pr/13148'
git switch 'upstream-pr/13148'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/13148'
git switch 'upstream-pr/13148'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/13148'
git switch 'upstream-pr/13148'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/13148'
git switch 'main'
git merge --squash 'upstream-pr/13148'
git switch 'main'
git merge --ff-only 'upstream-pr/13148'
git switch 'main'
git merge 'upstream-pr/13148'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!13148
No description provided.