perf(agc): keep device buffers placed in host memory for reuse while the device heap is full #8748

Merged
LeandroLP23 merged 6 commits from upstream-pr/8748 into main 2026-11-03 16:43:07 +00:00
LeandroLP23 commented 2026-10-20 23:27:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-20T23:27:52Z.


What

When a device buffer doesn't fit in the budget VK_EXT_memory_budget reports for the device-local heap, DeviceMemoryType places it in host memory (d04e98320). On release such a buffer was freed rather than pooled, so that host memory would never be handed out as device memory later. That keeps placement right, but while the heap stays over budget, every request allocates host memory again and frees it on release.

An APU with the common 512 MiB carve-out is always in that state. On a Radeon 860M (device-local heap 512 MiB, budget 486 MiB) the heap reports 512/486 MiB from the menu on. SuperTuxKart's tutorial race placed 8192 buffers in host memory per run, about 97–102 GiB, nearly all of them 8 MiB. A discrete GPU whose VRAM sits at its budget takes the same path.

  • A host-placed device buffer is now released into the device tier under its own key: hostPlaced, a new field of BufferAllocation and of the pool's slot key.
  • DeviceBuffer asks for a device-local slot first. Only on a miss does it take a host-placed slot. It keeps that slot only when Context::DeviceLocalFits says a new allocation would not fit the device-local heap either; otherwise it puts the slot back and allocates as before. So a buffer gets device-local memory whenever the reported budget has room for it, and the budget is read only when a host-placed slot is there to take.
  • A matching host-placed slot is taken without first asking the texture caches to release room. DeviceMemoryType asks them before a new host placement (since e2c1c305ff), but on a heap that stays over budget, a release for every such request would move the churn into the texture caches. A new allocation, with no host-placed slot to take, still asks the caches first. HostSlotBeforeCacheRelease pins both. This order was not measured in a title: the captures below predate e2c1c305ff.
  • DeviceLocalFits and DeviceMemoryType share one budget read (Context::ReportedHeap) and its fit test; only DeviceMemoryType goes on to the texture-cache release.
  • Host-placed slots count against the device tier's budget and are evicted and trimmed like any other slot.

Tested

Head 28f80c25a9 on main aaccd0ba39.

  • agc_buffer_pool passes. HostPlacement and RefusedDevicePlacement check three things: a host-placed buffer is kept after release; it is reused while the device-local heap has no room; and a request that fits gets device-local memory, not the retained host memory. With Resources.cpp from main, the first two checks fail.
  • HostSlotBeforeCacheRelease (head d845d4bfc5, on main 4f41f4c375) retains a host-placed buffer, then sets a texture-cache release that would free any amount: the next request of that size takes the retained buffer without calling it, and a new request of another size calls it once and gets device-local memory. With the probe in Resources.cpp changed to try the release before taking the slot, all three checks fail. agc_buffer_pool, its two small-device modes, the three agc_memory_accounting tests and agc_device_memory_fallback pass, 7/7, on the Radeon 860M laptop (Windows 11, WinLibs GCC, Release).
  • ctest -R "buffer|pool|resources|device_memory|host_placement|budget" with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: 76/76 pass on Windows 11, i5-10600K, RTX 5060 Ti (driver 621.01), WinLibs GCC 15.2.0, Release.
  • SuperTuxKart (PPSA69421) tutorial race on a Radeon 860M (1002:1114, 512 MiB carve-out, driver 32.0.13058.8001), Windows 11 26300, APS5_TRACE_SECONDS=95:20, main and this head alternating in one session. Summary lines, traces and tools/trace_digest.py output for every run are in this comment.
Tree Runs FPS Device buffers placed in host memory per run
main aaccd0ba39 2 7.69, 10.44 8192+ (at least 53–58 GiB)
this PR 28f80c25a9 3 11.78, 8.29, 11.61 3 (48 MiB)

The change removes the host-memory allocation churn. On current main the frame rate difference is within run-to-run spread: both trees fall into the same two modes, about 27 and 44 ms of GPU time per present. An earlier comparison on ec7eacc62, where the race ran at about 2.5 FPS, gave 2.47 FPS on main and 2.94 with this change; that gain does not reproduce on current main.

Overlap. #6553 changes the body of DeviceMemoryType (host heap selection), so the two conflict textually there, not in what they do. #4472 stops pooling device buffers while the device-local heap is over budget. On a 512 MiB carve-out that is always the case, so as written it would drop these host-placed slots too and bring the churn back. They hold no device-local memory, so I think they could be left out of that check. tools/pr_overlap.py found no other overlap among the PRs it could compare.

Idle device reclaim (#8672). ReclaimIdleDevice now skips host-placed slots. They live in deviceTier, but their memory is on the host heap. IdleReclaimSkipsHostPlaced retains an older host-placed slot and a younger device-local slot, and checks that the reclaim frees and counts only the device-local one. Without the skip it fails. agc_buffer_pool and its two small-device modes pass, 3/3.

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: AMD Radeon 860M, driver 32.0.13058.8001, Windows 11 26300; NVIDIA RTX 5060 Ti, driver 621.01, Windows 11
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4943976563 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8748). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-20T23:27:52Z. --- ### What When a device buffer doesn't fit in the budget `VK_EXT_memory_budget` reports for the device-local heap, `DeviceMemoryType` places it in host memory (d04e98320). On release such a buffer was freed rather than pooled, so that host memory would never be handed out as device memory later. That keeps placement right, but while the heap stays over budget, every request allocates host memory again and frees it on release. An APU with the common 512 MiB carve-out is always in that state. On a Radeon 860M (device-local heap 512 MiB, budget 486 MiB) the heap reports 512/486 MiB from the menu on. SuperTuxKart's tutorial race placed 8192 buffers in host memory per run, about 97–102 GiB, nearly all of them 8 MiB. A discrete GPU whose VRAM sits at its budget takes the same path. - A host-placed device buffer is now released into the device tier under its own key: `hostPlaced`, a new field of `BufferAllocation` and of the pool's slot key. - `DeviceBuffer` asks for a device-local slot first. Only on a miss does it take a host-placed slot. It keeps that slot only when `Context::DeviceLocalFits` says a new allocation would not fit the device-local heap either; otherwise it puts the slot back and allocates as before. So a buffer gets device-local memory whenever the reported budget has room for it, and the budget is read only when a host-placed slot is there to take. - A matching host-placed slot is taken without first asking the texture caches to release room. `DeviceMemoryType` asks them before a new host placement (since `e2c1c305ff`), but on a heap that stays over budget, a release for every such request would move the churn into the texture caches. A new allocation, with no host-placed slot to take, still asks the caches first. `HostSlotBeforeCacheRelease` pins both. This order was not measured in a title: the captures below predate `e2c1c305ff`. - `DeviceLocalFits` and `DeviceMemoryType` share one budget read (`Context::ReportedHeap`) and its fit test; only `DeviceMemoryType` goes on to the texture-cache release. - Host-placed slots count against the device tier's budget and are evicted and trimmed like any other slot. ### Tested Head `28f80c25a9` on `main` `aaccd0ba39`. - `agc_buffer_pool` passes. `HostPlacement` and `RefusedDevicePlacement` check three things: a host-placed buffer is kept after release; it is reused while the device-local heap has no room; and a request that fits gets device-local memory, not the retained host memory. With `Resources.cpp` from `main`, the first two checks fail. - `HostSlotBeforeCacheRelease` (head `d845d4bfc5`, on `main` `4f41f4c375`) retains a host-placed buffer, then sets a texture-cache release that would free any amount: the next request of that size takes the retained buffer without calling it, and a new request of another size calls it once and gets device-local memory. With the probe in `Resources.cpp` changed to try the release before taking the slot, all three checks fail. `agc_buffer_pool`, its two small-device modes, the three `agc_memory_accounting` tests and `agc_device_memory_fallback` pass, 7/7, on the Radeon 860M laptop (Windows 11, WinLibs GCC, Release). - `ctest -R "buffer|pool|resources|device_memory|host_placement|budget"` with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: 76/76 pass on Windows 11, i5-10600K, RTX 5060 Ti (driver 621.01), WinLibs GCC 15.2.0, Release. - SuperTuxKart (PPSA69421) tutorial race on a Radeon 860M (`1002:1114`, 512 MiB carve-out, driver 32.0.13058.8001), Windows 11 26300, `APS5_TRACE_SECONDS=95:20`, `main` and this head alternating in one session. Summary lines, traces and `tools/trace_digest.py` output for every run are in [this comment](https://github.com/boykopovar/AnyPS5/pull/8748#issuecomment-6508732716). | Tree | Runs | FPS | Device buffers placed in host memory per run | |---|---|---|---| | `main` `aaccd0ba39` | 2 | 7.69, 10.44 | 8192+ (at least 53–58 GiB) | | this PR `28f80c25a9` | 3 | 11.78, 8.29, 11.61 | 3 (48 MiB) | The change removes the host-memory allocation churn. On current `main` the frame rate difference is within run-to-run spread: both trees fall into the same two modes, about 27 and 44 ms of GPU time per present. An earlier comparison on `ec7eacc62`, where the race ran at about 2.5 FPS, gave 2.47 FPS on `main` and 2.94 with this change; that gain does not reproduce on current `main`. **Overlap.** #6553 changes the body of `DeviceMemoryType` (host heap selection), so the two conflict textually there, not in what they do. #4472 stops pooling device buffers while the device-local heap is over budget. On a 512 MiB carve-out that is always the case, so as written it would drop these host-placed slots too and bring the churn back. They hold no device-local memory, so I think they could be left out of that check. `tools/pr_overlap.py` found no other overlap among the PRs it could compare. **Idle device reclaim (#8672).** `ReclaimIdleDevice` now skips host-placed slots. They live in `deviceTier`, but their memory is on the host heap. `IdleReclaimSkipsHostPlaced` retains an older host-placed slot and a younger device-local slot, and checks that the reclaim frees and counts only the device-local one. Without the skip it fails. `agc_buffer_pool` and its two small-device modes pass, 3/3. ### 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: AMD Radeon 860M, driver 32.0.13058.8001, Windows 11 26300; NVIDIA RTX 5060 Ti, driver 621.01, Windows 11 - [x] AI-assisted: yes (Claude Code)
github-actions[bot] commented 2026-10-20 23:28:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T23:28:08Z.


This pull request is labeled perf, so it needs the summary line of a capture on main and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both aps5-summary.jsonl lines, attach the two traces and add the output of tools/trace_digest.py.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6304108763 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8748#issuecomment-6304108763). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T23:28:08Z. --- <!-- pr-labels-perf --> This pull request is labeled `perf`, so it needs the summary line of a capture on `main` and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both `aps5-summary.jsonl` lines, attach the two traces and add the output of `tools/trace_digest.py`.
MarcZX10 commented 2026-10-20 23:33:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T23:33:50Z.

Review: APPROVED


Reviewed the allocation-selection and pool-key changes plus the host-placement regression cases. The device-local pool is still preferred; a retained host-placed slot is reused only after a fresh budget check says a new device-local allocation would not fit, and the tests assert both reuse under pressure and device-local selection once the budget allows it. The PR includes paired same-machine SuperTuxKart captures and reports the buffer-allocation drop from 8,192 placements to 5. Eligibility, conventions, intake, labels, and report checks pass; hosted platform/runtime jobs are skipped, and the author notes the Khronos validation layer was unavailable.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5593121462 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8748#pullrequestreview-5593121462). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T23:33:50Z. **Review:** APPROVED --- Reviewed the allocation-selection and pool-key changes plus the host-placement regression cases. The device-local pool is still preferred; a retained host-placed slot is reused only after a fresh budget check says a new device-local allocation would not fit, and the tests assert both reuse under pressure and device-local selection once the budget allows it. The PR includes paired same-machine SuperTuxKart captures and reports the buffer-allocation drop from 8,192 placements to 5. Eligibility, conventions, intake, labels, and report checks pass; hosted platform/runtime jobs are skipped, and the author notes the Khronos validation layer was unavailable.
LeandroLP23 commented 2026-10-21 18:08:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-21T18:08:02Z.


SuperTuxKart race data with the rest of the STK fixes underneath. This PR removes the device-buffer churn that is left once the storage round trip and the label waits are gone.

Setup.

  • Hardware and build: Radeon 860M (512 MiB device-local heap), Ryzen AI 7 350, Windows 11 26300, AMD 32.0.13058.8001, WinLibs GCC 15.2.0, Release.
  • Scene: the tutorial race of PPSA69421 00.001.000, started through APS5_PAD_INPUT_FILE, with APS5_TRACE_SECONDS=95:20.
  • Base: main d34da5d694 + #6718 + #7464 + #7465 + #8858, as b097216c65. #7465 conflicted only in tests/execution/HostImportWindows.cpp, where both sides add a test; I kept both.
  • This PR: the same base + d1ce2c5127, as e0d6148d07 (clean merge).
  • Two captures per side.
tree FPS p50 / p90 / p99 ms GPU busy per present device buffers placed in host memory (whole run)
base 10.19 89.1 / 129.1 / 160.9 35.1 ms 4096, 31506 MiB
base 9.55 95.6 / 132.4 / 165.9 36.1 ms 8192, 48524 MiB
base + this PR 10.46 87.7 / 122.0 / 162.0 33.9 ms 32, 118 MiB
base + this PR 10.68 87.3 / 114.9 / 151.3 31.0 ms 32, 118 MiB

The frame rate gain is small, 5 to 10 %. What the PR removes shows on the draw committer: one run per side with APS5_PROFILE_DRAW=1, a 10 s window in the race.

per 10 s base base + this PR
recorded draw, average 356 us 242 us
keep 585.9 ms 56.4 ms
readTarget 1606.6 ms 1137.7 ms

On the base, the committer is the busiest thread. Sampling it puts about 19 % of its time inside the driver under BufferPool::AllocateMemory, in D3DKMTCreateAllocation / FreeGpuVirtualAddress, through DeviceBuffer::DeviceBuffer. With this PR, the placed allocations drop to 32 for the whole run. The busiest thread is then the title's own: about 64 % of its samples are in sceKernelUsleep, waiting for GPU work. So the committer is no longer what bounds the race.

Traces and summary lines: pr8748-race-traces.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6323072201 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8748#issuecomment-6323072201). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-21T18:08:02Z. --- SuperTuxKart race data with the rest of the STK fixes underneath. This PR removes the device-buffer churn that is left once the storage round trip and the label waits are gone. **Setup.** - Hardware and build: Radeon 860M (512 MiB device-local heap), Ryzen AI 7 350, Windows 11 26300, AMD 32.0.13058.8001, WinLibs GCC 15.2.0, Release. - Scene: the tutorial race of PPSA69421 00.001.000, started through `APS5_PAD_INPUT_FILE`, with `APS5_TRACE_SECONDS=95:20`. - Base: `main` `d34da5d694` + #6718 + #7464 + #7465 + #8858, as `b097216c65`. #7465 conflicted only in `tests/execution/HostImportWindows.cpp`, where both sides add a test; I kept both. - This PR: the same base + `d1ce2c5127`, as `e0d6148d07` (clean merge). - Two captures per side. | tree | FPS | p50 / p90 / p99 ms | GPU busy per present | device buffers placed in host memory (whole run) | |---|---|---|---|---| | base | 10.19 | 89.1 / 129.1 / 160.9 | 35.1 ms | 4096, 31506 MiB | | base | 9.55 | 95.6 / 132.4 / 165.9 | 36.1 ms | 8192, 48524 MiB | | base + this PR | 10.46 | 87.7 / 122.0 / 162.0 | 33.9 ms | 32, 118 MiB | | base + this PR | 10.68 | 87.3 / 114.9 / 151.3 | 31.0 ms | 32, 118 MiB | The frame rate gain is small, 5 to 10 %. What the PR removes shows on the draw committer: one run per side with `APS5_PROFILE_DRAW=1`, a 10 s window in the race. | per 10 s | base | base + this PR | |---|---|---| | recorded draw, average | 356 us | 242 us | | `keep` | 585.9 ms | 56.4 ms | | `readTarget` | 1606.6 ms | 1137.7 ms | On the base, the committer is the busiest thread. Sampling it puts about 19 % of its time inside the driver under `BufferPool::AllocateMemory`, in `D3DKMTCreateAllocation` / `FreeGpuVirtualAddress`, through `DeviceBuffer::DeviceBuffer`. With this PR, the placed allocations drop to 32 for the whole run. The busiest thread is then the title's own: about 64 % of its samples are in `sceKernelUsleep`, waiting for GPU work. So the committer is no longer what bounds the race. Traces and summary lines: [pr8748-race-traces](https://github.com/LeandroLP23/AnyPS5/releases/tag/pr8748-race-traces).
MarcZX10 commented 2026-10-29 09:10:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T09:10:38Z.

Review: CHANGES_REQUESTED


Re-check — changes requested\n\nThe additional ReclaimIdleDevice change and IdleReclaimSkipsHostPlaced test address the accounting issue: reclaim now skips host-placed slots instead of freeing host memory while reporting it as released device memory. The new NVIDIA report on head 70a183ef7f is useful broad coverage, but it is not a comparison against current main and does not repeat the title performance measurement.\n\nThe branch is based on acbfd7c7fe, and current main is aaccd0ba39. Main has changed all five PR paths since that base: BufferPool.hpp/cpp, Context.hpp, Resources.cpp and BufferPool.cpp tests. Please rebase onto current main, preserve the device-local-first/host-fallback budget behavior and the reclaim regression, then rerun agc_buffer_pool and the focused memory-budget tests on the exact updated head. Because this is labeled perf, refresh the same-machine SuperTuxKart main/change captures, summary lines, traces and digests after the integration as well. I did not run local tests or GPU captures.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5695268013 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8748#pullrequestreview-5695268013). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T09:10:38Z. **Review:** CHANGES_REQUESTED --- ## Re-check — changes requested\n\nThe additional ReclaimIdleDevice change and IdleReclaimSkipsHostPlaced test address the accounting issue: reclaim now skips host-placed slots instead of freeing host memory while reporting it as released device memory. The new NVIDIA report on head 70a183ef7f is useful broad coverage, but it is not a comparison against current main and does not repeat the title performance measurement.\n\nThe branch is based on acbfd7c7fe, and current main is aaccd0ba39. Main has changed all five PR paths since that base: BufferPool.hpp/cpp, Context.hpp, Resources.cpp and BufferPool.cpp tests. Please rebase onto current main, preserve the device-local-first/host-fallback budget behavior and the reclaim regression, then rerun agc_buffer_pool and the focused memory-budget tests on the exact updated head. Because this is labeled perf, refresh the same-machine SuperTuxKart main/change captures, summary lines, traces and digests after the integration as well. I did not run local tests or GPU captures.
XairRrR commented 2026-10-29 12:26:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T12:26:39Z.

Review: APPROVED


Reviewed — approved

Head 28f80c25a9 merges cleanly onto current main, builds, and passes the focused buffer-pool and device-memory tests with the Khronos validation layer active and no VUID- lines on either side; the new agc_buffer_pool checks fail when the production files are reverted to main.

What I ran

  • Head: 28f80c25a9b466b067a3c3b9bbbd504d548e0376
  • main: 5454cd2e455994d992aca39335ce60507eeda1eb (merge base of the branch: aaccd0ba39)
  • Arch Linux 7.2.11-zen, GCC 16.2.1, Release, Ninja, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), in a clean worktree.
git fetch origin main pull/8748/head:refs/review/8748
git checkout --detach origin/main
git merge --no-ff --no-edit refs/review/8748
git diff --check origin/main...refs/review/8748
python3 tools/check_conventions.py --base origin/main

cmake --build build -j10 --target agc_buffer_pool_tests agc_device_memory_fallback_tests \
  guest_agc_driver_resources_tests agc_driver_many_buffers_tests agc_driver_pooled_buffer_range_tests \
  agc_driver_graphics_tests agc_static_buffer_tests agc_driver_buffer_load_store_tests \
  agc_driver_depth_plane_buffer_memory_tests agc_driver_recorder_tests agc_driver_sparse_buffer_holes_tests libs

VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 \
VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -j4 -V --output-on-failure -R \
  '^(agc_buffer_pool|agc_buffer_pool_small_device_shared|agc_buffer_pool_small_device_no_staging|agc_device_memory_fallback|guest_agc_driver_resources|agc_driver_many_buffers|agc_driver_pooled_buffer_range|agc_pipeline_store_lazy_buffer_pool|agc_static_buffer|agc_driver_buffer_load_store|agc_driver_depth_plane_buffer_memory|agc_storage_written_buffer_order|agc_driver_sparse_buffer_holes)$'

# same build targets and ctest command on origin/main, then back to the merged tree

Results

Check Result
Merge onto main Clean
git diff --check Clean
tools/check_conventions.py --base origin/main All conventions checks passed.
Build of the targets above and libs (merged tree) OK, no warnings
Focused tests, merged tree, with validation 13/13 passed
Focused tests, main, with validation 13/13 passed
VUID- lines 0 on main, 0 on the merged tree
was not found but was requested by env var VK_INSTANCE_LAYERS Absent from both logs; the loader inserted VK_LAYER_KHRONOS_validation 6 times in each run (the GPU tests in the set)
GPU used by the GPU tests NVIDIA GeForce RTX 4070 Ti SUPER, 10de:2705, driver 615.78.08
Test duration agc_buffer_pool 0.38 s; whole set 1.32 s
Merged tree, ctest summary
1/13 Test  #763: agc_buffer_pool_small_device_no_staging ...   Passed    0.00 sec
2/13 Test  #762: agc_buffer_pool_small_device_shared .......   Passed    0.00 sec
3/13 Test  #674: agc_static_buffer .........................   Passed    0.00 sec
4/13 Test  #765: agc_device_memory_fallback ................   Passed    0.00 sec
5/13 Test  #761: agc_buffer_pool ...........................   Passed    0.38 sec
6/13 Test  #804: agc_storage_written_buffer_order ..........   Passed    0.54 sec
7/13 Test #1343: agc_driver_pooled_buffer_range ............   Passed    0.25 sec
8/13 Test #1014: agc_driver_depth_plane_buffer_memory ......   Passed    0.94 sec
9/13 Test #1581: agc_pipeline_store_lazy_buffer_pool .......   Passed    0.00 sec
10/13 Test #1765: guest_agc_driver_resources ................   Passed    0.00 sec
11/13 Test #1416: agc_driver_sparse_buffer_holes ............   Passed    0.23 sec
12/13 Test  #981: agc_driver_buffer_load_store ..............   Passed    1.09 sec
13/13 Test #1268: agc_driver_many_buffers ...................   Passed    0.90 sec
100% tests passed out of 13

Negative control

  1. Restored BufferPool.hpp, Context.hpp, BufferPool.cpp and Resources.cpp from main and kept the PR's tests/BufferPool.cpp. agc_buffer_pool fails; the two small-device modes still pass:

    FAIL: a device buffer placed in host memory was not kept in the pool after its release
    FAIL: a device buffer over the device-local budget did not reuse the retained host-placed buffer
    FAIL: idle device reclaim freed the host-placed buffer instead of the idle device-local one
    
  2. On the merged tree, removed only the slot.allocation.hostPlaced || condition from ReclaimIdleDevice. agc_buffer_pool fails:

    FAIL: idle device reclaim counted a host-placed buffer as device memory
    FAIL: idle device reclaim freed the host-placed buffer instead of the idle device-local one
    

    This confirms the author's report on the #8672 composition, which oneandonlydean raised.

Both changes were restored afterwards.

Findings

Blocking

None.

Non-blocking

  1. A host-placed slot that is probed and refused is re-inserted as the newest slot. Resources.cpp L166-L172 puts the slot back with cache->Put(*pooled) when DeviceLocalFits says device memory is available. Put gives it a fresh lastUse (++clock, BufferPool.cpp L578), and Take has already counted the probe in ++tier.hits (BufferPool.cpp L409-L426). Once the heap is back under budget, a host-placed slot holds host memory that the pool will not hand out while device memory fits. Each refused probe also makes that slot the youngest in the device tier. evictOldest then drops reusable device-local slots of other keys before it, and ReclaimIdleDevice skips it by design. The APS5_PROFILE_DRAW device-tier hit count also includes these refused probes. Suggested fix: when the probe is refused, destroy the slot rather than putting it back, because device memory fits and the host copy is the wrong placement. Alternatively, re-insert it with its original lastUse and leave hits uncounted.

  2. DeviceLocalFits does not check exactly what the fresh path checks. The probe calls DeviceLocalFits(~0u, capacity). The fresh allocation it competes with uses DeviceMemoryType(requirements.memoryTypeBits, ClassAllocationBytes(requirements, capacity), ...) (Resources.cpp L200-L210). With ~0u, MemoryType can pick a device-local type the buffer cannot use. The size also lacks the alignment rounding. On the usual single device-local heap these agree. In the edge case, a request just at the budget boundary passes over the host slot, then gets host memory anyway from a new allocation. The description says both decisions use "the same rule", and that holds only approximately. Passing the slot's alignment-rounded allocationBytes would make the two match exactly.

  3. The GPUs tested line does not match the validation evidence. The checklist names only the Radeon 860M, where the description says the Khronos validation layer is not installed. The author's later run with validation on head 28f80c25a9 used an RTX 5060 Ti and covered only the change, not main. CONTRIBUTING asks for the same focused tests on main and the change with the layer, with each GPU named on that line. The comparison above on the RTX 4070 Ti SUPER, and the earlier ones by JulesB40 and the NVIDIA CI comment, show no new VUID- lines, so I do not treat this as blocking. Adding the 5060 Ti, and a main run on it, to the description would close it.

  4. Overlap with #4472, as the description already says: #4472 stops pooling device buffers while the device-local heap is over budget. Whichever lands second has to exempt hostPlaced slots, or the churn this PR removes comes back on 512 MiB carve-outs. Agreeing the order with that author, and noting it under Depends on if needed, would help.

Not verified

  • The performance claim. I have no APU with a small device-local carve-out. On this machine the device-local heap never goes over budget, so the host-placement path only runs in the mock tests. The description's summary lines and traces are for head d1ce2c51278f against main ec7eacc62, not the current head. MarcZX10 asked for a refresh on current main, and the author says that is pending. The code behind the measured path is the same apart from the reclaim skip, but I have not reproduced the numbers.
  • Windows and AMD drivers, and any title. I ran no title.
  • The full test suite; only the 13 focused tests above.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5697656101 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8748#pullrequestreview-5697656101). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-29T12:26:39Z. **Review:** APPROVED --- # Reviewed — approved Head `28f80c25a9` merges cleanly onto current `main`, builds, and passes the focused buffer-pool and device-memory tests with the Khronos validation layer active and no `VUID-` lines on either side; the new `agc_buffer_pool` checks fail when the production files are reverted to `main`. ## What I ran - Head: `28f80c25a9b466b067a3c3b9bbbd504d548e0376` - `main`: `5454cd2e455994d992aca39335ce60507eeda1eb` (merge base of the branch: `aaccd0ba39`) - Arch Linux 7.2.11-zen, GCC 16.2.1, Release, Ninja, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), in a clean worktree. ```sh git fetch origin main pull/8748/head:refs/review/8748 git checkout --detach origin/main git merge --no-ff --no-edit refs/review/8748 git diff --check origin/main...refs/review/8748 python3 tools/check_conventions.py --base origin/main cmake --build build -j10 --target agc_buffer_pool_tests agc_device_memory_fallback_tests \ guest_agc_driver_resources_tests agc_driver_many_buffers_tests agc_driver_pooled_buffer_range_tests \ agc_driver_graphics_tests agc_static_buffer_tests agc_driver_buffer_load_store_tests \ agc_driver_depth_plane_buffer_memory_tests agc_driver_recorder_tests agc_driver_sparse_buffer_holes_tests libs VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 \ VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -j4 -V --output-on-failure -R \ '^(agc_buffer_pool|agc_buffer_pool_small_device_shared|agc_buffer_pool_small_device_no_staging|agc_device_memory_fallback|guest_agc_driver_resources|agc_driver_many_buffers|agc_driver_pooled_buffer_range|agc_pipeline_store_lazy_buffer_pool|agc_static_buffer|agc_driver_buffer_load_store|agc_driver_depth_plane_buffer_memory|agc_storage_written_buffer_order|agc_driver_sparse_buffer_holes)$' # same build targets and ctest command on origin/main, then back to the merged tree ``` ## Results | Check | Result | |---|---| | Merge onto `main` | Clean | | `git diff --check` | Clean | | `tools/check_conventions.py --base origin/main` | `All conventions checks passed.` | | Build of the targets above and `libs` (merged tree) | OK, no warnings | | Focused tests, merged tree, with validation | 13/13 passed | | Focused tests, `main`, with validation | 13/13 passed | | `VUID-` lines | 0 on `main`, 0 on the merged tree | | `was not found but was requested by env var VK_INSTANCE_LAYERS` | Absent from both logs; the loader inserted `VK_LAYER_KHRONOS_validation` 6 times in each run (the GPU tests in the set) | | GPU used by the GPU tests | NVIDIA GeForce RTX 4070 Ti SUPER, `10de:2705`, driver 615.78.08 | | Test duration | `agc_buffer_pool` 0.38 s; whole set 1.32 s | <details> <summary>Merged tree, ctest summary</summary> ``` 1/13 Test #763: agc_buffer_pool_small_device_no_staging ... Passed 0.00 sec 2/13 Test #762: agc_buffer_pool_small_device_shared ....... Passed 0.00 sec 3/13 Test #674: agc_static_buffer ......................... Passed 0.00 sec 4/13 Test #765: agc_device_memory_fallback ................ Passed 0.00 sec 5/13 Test #761: agc_buffer_pool ........................... Passed 0.38 sec 6/13 Test #804: agc_storage_written_buffer_order .......... Passed 0.54 sec 7/13 Test #1343: agc_driver_pooled_buffer_range ............ Passed 0.25 sec 8/13 Test #1014: agc_driver_depth_plane_buffer_memory ...... Passed 0.94 sec 9/13 Test #1581: agc_pipeline_store_lazy_buffer_pool ....... Passed 0.00 sec 10/13 Test #1765: guest_agc_driver_resources ................ Passed 0.00 sec 11/13 Test #1416: agc_driver_sparse_buffer_holes ............ Passed 0.23 sec 12/13 Test #981: agc_driver_buffer_load_store .............. Passed 1.09 sec 13/13 Test #1268: agc_driver_many_buffers ................... Passed 0.90 sec 100% tests passed out of 13 ``` </details> ## Negative control 1. Restored `BufferPool.hpp`, `Context.hpp`, `BufferPool.cpp` and `Resources.cpp` from `main` and kept the PR's `tests/BufferPool.cpp`. `agc_buffer_pool` fails; the two small-device modes still pass: ``` FAIL: a device buffer placed in host memory was not kept in the pool after its release FAIL: a device buffer over the device-local budget did not reuse the retained host-placed buffer FAIL: idle device reclaim freed the host-placed buffer instead of the idle device-local one ``` 2. On the merged tree, removed only the `slot.allocation.hostPlaced ||` condition from `ReclaimIdleDevice`. `agc_buffer_pool` fails: ``` FAIL: idle device reclaim counted a host-placed buffer as device memory FAIL: idle device reclaim freed the host-placed buffer instead of the idle device-local one ``` This confirms the author's report on the #8672 composition, which oneandonlydean raised. Both changes were restored afterwards. ## Findings ### Blocking None. ### Non-blocking 1. **A host-placed slot that is probed and refused is re-inserted as the newest slot.** [`Resources.cpp` L166-L172](https://github.com/boykopovar/AnyPS5/blob/28f80c25a9b466b067a3c3b9bbbd504d548e0376/core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp#L166-L172) puts the slot back with `cache->Put(*pooled)` when `DeviceLocalFits` says device memory is available. `Put` gives it a fresh `lastUse` (`++clock`, [`BufferPool.cpp` L578](https://github.com/boykopovar/AnyPS5/blob/28f80c25a9b466b067a3c3b9bbbd504d548e0376/core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp#L578)), and `Take` has already counted the probe in `++tier.hits` ([`BufferPool.cpp` L409-L426](https://github.com/boykopovar/AnyPS5/blob/28f80c25a9b466b067a3c3b9bbbd504d548e0376/core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp#L409-L426)). Once the heap is back under budget, a host-placed slot holds host memory that the pool will not hand out while device memory fits. Each refused probe also makes that slot the youngest in the device tier. `evictOldest` then drops reusable device-local slots of other keys before it, and `ReclaimIdleDevice` skips it by design. The `APS5_PROFILE_DRAW` device-tier hit count also includes these refused probes. Suggested fix: when the probe is refused, destroy the slot rather than putting it back, because device memory fits and the host copy is the wrong placement. Alternatively, re-insert it with its original `lastUse` and leave `hits` uncounted. 2. **`DeviceLocalFits` does not check exactly what the fresh path checks.** The probe calls `DeviceLocalFits(~0u, capacity)`. The fresh allocation it competes with uses `DeviceMemoryType(requirements.memoryTypeBits, ClassAllocationBytes(requirements, capacity), ...)` ([`Resources.cpp` L200-L210](https://github.com/boykopovar/AnyPS5/blob/28f80c25a9b466b067a3c3b9bbbd504d548e0376/core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp#L200-L210)). With `~0u`, `MemoryType` can pick a device-local type the buffer cannot use. The size also lacks the alignment rounding. On the usual single device-local heap these agree. In the edge case, a request just at the budget boundary passes over the host slot, then gets host memory anyway from a new allocation. The description says both decisions use "the same rule", and that holds only approximately. Passing the slot's alignment-rounded `allocationBytes` would make the two match exactly. 3. **The `GPUs tested` line does not match the validation evidence.** The checklist names only the Radeon 860M, where the description says the Khronos validation layer is not installed. The author's later run with validation on head `28f80c25a9` used an RTX 5060 Ti and covered only the change, not `main`. CONTRIBUTING asks for the same focused tests on `main` and the change with the layer, with each GPU named on that line. The comparison above on the RTX 4070 Ti SUPER, and the earlier ones by JulesB40 and the NVIDIA CI comment, show no new `VUID-` lines, so I do not treat this as blocking. Adding the 5060 Ti, and a `main` run on it, to the description would close it. 4. **Overlap with #4472**, as the description already says: #4472 stops pooling device buffers while the device-local heap is over budget. Whichever lands second has to exempt `hostPlaced` slots, or the churn this PR removes comes back on 512 MiB carve-outs. Agreeing the order with that author, and noting it under `Depends on` if needed, would help. ## Not verified - The performance claim. I have no APU with a small device-local carve-out. On this machine the device-local heap never goes over budget, so the host-placement path only runs in the mock tests. The description's summary lines and traces are for head `d1ce2c51278f` against `main` `ec7eacc62`, not the current head. MarcZX10 asked for a refresh on current `main`, and the author says that is pending. The code behind the measured path is the same apart from the reclaim skip, but I have not reproduced the numbers. - Windows and AMD drivers, and any title. I ran no title. - The full test suite; only the 13 focused tests above.
MarcZX10 commented 2026-10-30 01:20:49 +00:00 (Migrated from github.com)

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

Review: APPROVED


Reviewed — looks good

I reviewed head 28f80c25a9b466b067a3c3b9bbbd504d548e0376; the updated evidence supports reduced host-memory allocation churn, while correctly making no repeatable FPS-gain claim.

What I ran

  • Compared PR head 28f80c25a9b466b067a3c3b9bbbd504d548e0376 with current main 1a217758a55c09e817366fa4411daac854eeb3f9; their merge base is aaccd0ba39b7d40fdbf19664575a7e567d8542f7 and the merge preview is clean (8c6773cdd121de6ed2d9fa52bfb5f7ee5275c1dd). None of the five PR files changed on main after that baseline.
  • Ran git diff --check upstream/main...refs/review/upstream-8748 and python tools/check_conventions.py --base upstream/main --head refs/review/upstream-8748 on Linux with Python 3.11.2. No local build or tests were run.
  • Read the updated SuperTuxKart report on the same Radeon 860M, including the reported paired summaries, trace digests, and trace links.
git merge-base upstream/main refs/review/upstream-8748
git merge-tree --write-tree upstream/main refs/review/upstream-8748
git diff --check upstream/main...refs/review/upstream-8748
python tools/check_conventions.py --base upstream/main --head refs/review/upstream-8748

Results

Check Result
Current-main merge preview Clean; tree 8c6773cdd121de6ed2d9fa52bfb5f7ee5275c1dd
git diff --check Pass; no output
Conventions Pass; All conventions checks passed.
Exact-head focused tests Author reports 76/76 focused buffer-pool/resource tests passed on 28f80c25a9, with Vulkan validation enabled
Matched title captures Author reports same-machine main aaccd0ba39b7 and PR-head 28f80c25a9b4 captures, summaries, digests, and traces. Buffer placements fell from 8,192+ to 3; the measured FPS modes overlap, so the report does not claim a repeatable FPS gain.
Hosted checks Windows, conventions, labels, eligibility, and report pass; Linux and specialized jobs are skipped

Findings

Blocking

None.

Non-blocking

The evidence supports the reduced allocation churn. It does not establish a general frame-rate improvement, and the updated description states that limitation clearly.

Sources

Not verified

I did not build or run tests locally, download or independently digest the attached traces, or test Linux behavior. Hosted Linux and specialized jobs were skipped.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5707015469 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8748#pullrequestreview-5707015469). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T01:20:49Z. **Review:** APPROVED --- # Reviewed — looks good I reviewed head `28f80c25a9b466b067a3c3b9bbbd504d548e0376`; the updated evidence supports reduced host-memory allocation churn, while correctly making no repeatable FPS-gain claim. ## What I ran - Compared PR head `28f80c25a9b466b067a3c3b9bbbd504d548e0376` with current `main` `1a217758a55c09e817366fa4411daac854eeb3f9`; their merge base is `aaccd0ba39b7d40fdbf19664575a7e567d8542f7` and the merge preview is clean (`8c6773cdd121de6ed2d9fa52bfb5f7ee5275c1dd`). None of the five PR files changed on `main` after that baseline. - Ran `git diff --check upstream/main...refs/review/upstream-8748` and `python tools/check_conventions.py --base upstream/main --head refs/review/upstream-8748` on Linux with Python 3.11.2. No local build or tests were run. - Read the updated SuperTuxKart report on the same Radeon 860M, including the reported paired summaries, trace digests, and trace links. ```sh git merge-base upstream/main refs/review/upstream-8748 git merge-tree --write-tree upstream/main refs/review/upstream-8748 git diff --check upstream/main...refs/review/upstream-8748 python tools/check_conventions.py --base upstream/main --head refs/review/upstream-8748 ``` ## Results | Check | Result | |---|---| | Current-main merge preview | Clean; tree `8c6773cdd121de6ed2d9fa52bfb5f7ee5275c1dd` | | `git diff --check` | Pass; no output | | Conventions | Pass; `All conventions checks passed.` | | Exact-head focused tests | Author reports 76/76 focused buffer-pool/resource tests passed on `28f80c25a9`, with Vulkan validation enabled | | Matched title captures | Author reports same-machine `main` `aaccd0ba39b7` and PR-head `28f80c25a9b4` captures, summaries, digests, and traces. Buffer placements fell from 8,192+ to 3; the measured FPS modes overlap, so the report does not claim a repeatable FPS gain. | | Hosted checks | Windows, conventions, labels, eligibility, and report pass; Linux and specialized jobs are skipped | ## Findings ### Blocking None. ### Non-blocking The evidence supports the reduced allocation churn. It does not establish a general frame-rate improvement, and the updated description states that limitation clearly. ## Sources - [PR-head buffer-pool implementation](https://github.com/boykopovar/AnyPS5/blob/28f80c25a9b466b067a3c3b9bbbd504d548e0376/core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp) - [PR-head pool and host-placement tests](https://github.com/boykopovar/AnyPS5/blob/28f80c25a9b466b067a3c3b9bbbd504d548e0376/core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp) - [Updated matched-capture report](https://github.com/boykopovar/AnyPS5/pull/8748#issuecomment-6508732716) ## Not verified I did not build or run tests locally, download or independently digest the attached traces, or test Linux behavior. Hosted Linux and specialized jobs were skipped.
XairRrR commented 2026-11-03 08:26:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T08:26:52Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

This pull request does not merge cleanly into main (4f41f4c375): head 7cd426f00f conflicts in

  • core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp

Please rebase it onto current main. I will review the change once it merges cleanly.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5749066721 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8748#pullrequestreview-5749066721). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T08:26:52Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested This pull request does not merge cleanly into `main` (4f41f4c375f5abb487dbd184fbc150f31994d762): head 7cd426f00f6efc4ae4a0431c1a8f849bcd500cf1 conflicts in - `core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp` Please rebase it onto current `main`. I will review the change once it merges cleanly. <!-- anyps5-bots job=3207 head=7cd426f00f6efc4ae4a0431c1a8f849bcd500cf1 -->
XairRrR commented 2026-11-03 11:09:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T11:09:52Z.

Review: APPROVED


Re-checked — approved

Since my last review the branch was rebased onto newer main and gained commit 7cd426f00f, which re-reads the heap report through ReportedHeap after main's texture-cache release. main 4f41f4c was also merged into it, and the description now has matched 860M captures. The merged tree builds, the focused tests pass with the Khronos layer active, and the new checks still fail without the production change. One new non-blocking point: how this change interacts with main's texture-cache release.

What changed since my last review

  • Rebase. 48b6bc5d12 now passes the category argument that main added to BufferPool::Take. Otherwise its logic is unchanged. 0ac7f6d55e (the reclaim skip) is identical to the commit I reviewed before.
  • New commit 7cd426f00f. main's e2c1c305ff added a texture-cache release to DeviceMemoryType before it falls back to host memory. That code re-read the budget through locals this PR removed. It now calls ReportedHeap(heap) again after a release and applies the same fit test.
  • 53570aa5ff merges main 4f41f4c. The only conflict was in tests/BufferPool.cpp. The resolution keeps IdleReclaimSkipsHostPlaced and its call in main().
  • Description. It now has the matched SuperTuxKart pairs on main aaccd0ba39 and head 28f80c25a9, and it claims only the removed allocation churn, not a frame-rate gain. The GPUs tested line now names the RTX 5060 Ti too.

What I ran

Head 53570aa5ffeabb0b4b49dd951649de8a5afa0e71, main 4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree 25ccd1a440c2976735630c9f7f144eb5981ffc72. Machine: Debian 13 VM, 2× Xeon Gold 6136, GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6, LLVM 19).

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...53570aa5ffeabb0b4b49dd951649de8a5afa0e71
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762

# negative control: BufferPool.hpp, Context.hpp, BufferPool.cpp, Resources.cpp from main; PR tests kept
git show 4f41f4c375f5abb487dbd184fbc150f31994d762:<path> > <path>
ninja -C build agc_buffer_pool_tests agc_driver_native_multisample_depth_tests
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 \
  ctest --test-dir build -j8 -V --output-on-failure \
  -R '^(agc_buffer_pool|agc_buffer_pool_small_device_shared|agc_buffer_pool_small_device_no_staging|agc_driver_native_depth_uniform_planes)$'

# restore the merged files, rebuild, rerun
git show 25ccd1a440c2976735630c9f7f144eb5981ffc72:<path> > <path>
ninja -C build agc_buffer_pool_tests agc_driver_native_multisample_depth_tests agc_device_memory_fallback_tests
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \
  ctest --test-dir build -j8 -V --output-on-failure \
  -R '^(agc_buffer_pool|agc_buffer_pool_small_device_shared|agc_buffer_pool_small_device_no_staging|agc_device_memory_fallback|agc_driver_native_depth_uniform_planes)$'
git status --porcelain
Check Result
git diff --check Clean, exit 0
check_conventions.py All conventions checks passed.
Build and libs, merged tree (script) OK
Selected tests, merged tree (script) 2173 run, 2052 passed, 114 expected skips, 0 new failures. All 7 failures also fail on main: the denormal/division agc_driver_* tests, vector_constant_factor_tininess and one unwrap_self test.
Validation comparison (script) Layer loaded in 769/770 tests. One "new" ID, VUID-vkCmdDispatch-groupCountX-00386 in agc_driver_native_depth_uniform_planes, a test that is newer than the baseline. It comes from main; see below.
Focused tests, merged tree, with validation 5/5 passed (agc_buffer_pool 0.49 s)
Negative control agc_buffer_pool fails with 3 messages; see below
Worktree after restore git status --porcelain empty
VUID check with main's production files

With the four production files restored from main, agc_driver_native_depth_uniform_planes reports the same 4× VUID-vkCmdDispatch-groupCountX-00386 as on the merged tree. The test was added on main by c9987271e3, after the validation baseline d1ae628bc2. The message comes from main, not from this PR.

Negative control

I restored BufferPool.hpp, Context.hpp, BufferPool.cpp and Resources.cpp from main and kept the PR's tests/BufferPool.cpp. agc_buffer_pool fails; the two small-device modes still pass:

FAIL: a device buffer placed in host memory was not kept in the pool after its release
FAIL: a device buffer over the device-local budget did not reuse the retained host-placed buffer
FAIL: idle device reclaim freed the host-placed buffer instead of the idle device-local one

After restoring the merged files and rebuilding, all 5 tests pass.

Previous findings

  1. A refused host-placed slot is put back as the newest slot and counted as a hit. Still open, non-blocking. Resources.cpp L179-L186 still calls cache->Put(*pooled), and Put gives the slot a fresh ++clock (BufferPool.cpp L589).
  2. DeviceLocalFits(~0u, capacity) does not test what the fresh path tests. Still open, non-blocking. The fresh path uses the buffer's memoryTypeBits and the alignment-rounded ClassAllocationBytes.
  3. GPUs tested line vs the validation evidence. Resolved for the checklist: the line now names the RTX 5060 Ti next to the 860M. The author has not posted a main-side layer run on the 5060 Ti. The lavapipe comparison here, the AMD RX 6300 CI comment on this exact head, and the earlier NVIDIA runs show no new IDs, which covers that gap.
  4. Overlap with #4472. Still open, non-blocking. The description still records it and leaves the order to be agreed.

The perf evidence MarcZX10 asked for is now posted (three PR runs and two main runs, with summary lines, traces and digests). It supports the narrowed claim that 8192+ host placements per run drop to 3. I accept those numbers as author-reported; I could not reproduce them.

New findings

Blocking

None.

Non-blocking

  1. The host-slot probe skips main's texture-cache release, so a retained host slot now wins over a device-local placement that the cache release could make possible. Since e2c1c305ff, a fresh over-budget request first asks the texture caches for the request plus the heap's overage. If they release enough, or the budget read again has room, the request stays device-local (Context.hpp L357-L372). The probe in Resources.cpp L182 only reads the budget through DeviceLocalFits. While a matching host-placed slot exists, the cache release never runs for that size, and the buffer stays in host memory. This contradicts two claims in the description: "a buffer still gets device-local memory whenever there is room for it" and "both decide with the same rule". It may be the better trade-off: releasing textures on every 8 MiB request on a permanently full 512 MiB heap could just move the churn into the texture cache. But it was not measured: the captures are on aaccd0ba39, which predates e2c1c305ff (git merge-base --is-ancestor confirms this). Suggested fix: either state that a retained host slot is preferred over a texture-cache release, and add a mock case with cacheReclaim set that pins this, or try the release before taking the host slot.
  2. Minor: the re-check after a release (Context.hpp L368-L371) writes out the fit test by hand instead of calling after.Fits(bytes). The two differ only when the budget is 0, which the first Fits already handled, so behaviour is the same. Calling Fits would keep a single rule.

Not verified

  • The performance numbers. I have no APU with a small carve-out. The host-placement path runs here only in the mock tests.
  • The interaction with the texture-cache release (new finding 1) in a title.
  • Windows and AMD/NVIDIA hardware drivers. I ran on lavapipe only, and launched no title. I did not run the full suite: only the script's selected tests plus the 5 focused tests above.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5751109443 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8748#pullrequestreview-5751109443). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T11:09:52Z. **Review:** APPROVED --- # Re-checked — approved Since my last review the branch was rebased onto newer `main` and gained commit `7cd426f00f`, which re-reads the heap report through `ReportedHeap` after `main`'s texture-cache release. `main` `4f41f4c` was also merged into it, and the description now has matched 860M captures. The merged tree builds, the focused tests pass with the Khronos layer active, and the new checks still fail without the production change. One new non-blocking point: how this change interacts with `main`'s texture-cache release. ## What changed since my last review - **Rebase.** `48b6bc5d12` now passes the `category` argument that `main` added to `BufferPool::Take`. Otherwise its logic is unchanged. `0ac7f6d55e` (the reclaim skip) is identical to the commit I reviewed before. - **New commit `7cd426f00f`.** `main`'s `e2c1c305ff` added a texture-cache release to `DeviceMemoryType` before it falls back to host memory. That code re-read the budget through locals this PR removed. It now calls `ReportedHeap(heap)` again after a release and applies the same fit test. - **`53570aa5ff` merges `main` `4f41f4c`.** The only conflict was in `tests/BufferPool.cpp`. The resolution keeps `IdleReclaimSkipsHostPlaced` and its call in `main()`. - **Description.** It now has the matched SuperTuxKart pairs on `main` `aaccd0ba39` and head `28f80c25a9`, and it claims only the removed allocation churn, not a frame-rate gain. The `GPUs tested` line now names the RTX 5060 Ti too. ## What I ran Head `53570aa5ffeabb0b4b49dd951649de8a5afa0e71`, `main` `4f41f4c375f5abb487dbd184fbc150f31994d762`, merged tree `25ccd1a440c2976735630c9f7f144eb5981ffc72`. Machine: Debian 13 VM, 2× Xeon Gold 6136, GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6, LLVM 19). ```sh git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...53570aa5ffeabb0b4b49dd951649de8a5afa0e71 python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 # negative control: BufferPool.hpp, Context.hpp, BufferPool.cpp, Resources.cpp from main; PR tests kept git show 4f41f4c375f5abb487dbd184fbc150f31994d762:<path> > <path> ninja -C build agc_buffer_pool_tests agc_driver_native_multisample_depth_tests VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 \ ctest --test-dir build -j8 -V --output-on-failure \ -R '^(agc_buffer_pool|agc_buffer_pool_small_device_shared|agc_buffer_pool_small_device_no_staging|agc_driver_native_depth_uniform_planes)$' # restore the merged files, rebuild, rerun git show 25ccd1a440c2976735630c9f7f144eb5981ffc72:<path> > <path> ninja -C build agc_buffer_pool_tests agc_driver_native_multisample_depth_tests agc_device_memory_fallback_tests VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \ ctest --test-dir build -j8 -V --output-on-failure \ -R '^(agc_buffer_pool|agc_buffer_pool_small_device_shared|agc_buffer_pool_small_device_no_staging|agc_device_memory_fallback|agc_driver_native_depth_uniform_planes)$' git status --porcelain ``` | Check | Result | |---|---| | `git diff --check` | Clean, exit 0 | | `check_conventions.py` | `All conventions checks passed.` | | Build and `libs`, merged tree (script) | OK | | Selected tests, merged tree (script) | 2173 run, 2052 passed, 114 expected skips, **0 new failures**. All 7 failures also fail on `main`: the denormal/division `agc_driver_*` tests, `vector_constant_factor_tininess` and one `unwrap_self` test. | | Validation comparison (script) | Layer loaded in 769/770 tests. One "new" ID, `VUID-vkCmdDispatch-groupCountX-00386` in `agc_driver_native_depth_uniform_planes`, a test that is newer than the baseline. It comes from `main`; see below. | | Focused tests, merged tree, with validation | 5/5 passed (`agc_buffer_pool` 0.49 s) | | Negative control | `agc_buffer_pool` fails with 3 messages; see below | | Worktree after restore | `git status --porcelain` empty | <details><summary>VUID check with main's production files</summary> With the four production files restored from `main`, `agc_driver_native_depth_uniform_planes` reports the same 4× `VUID-vkCmdDispatch-groupCountX-00386` as on the merged tree. The test was added on `main` by `c9987271e3`, after the validation baseline `d1ae628bc2`. The message comes from `main`, not from this PR. </details> ## Negative control I restored `BufferPool.hpp`, `Context.hpp`, `BufferPool.cpp` and `Resources.cpp` from `main` and kept the PR's `tests/BufferPool.cpp`. `agc_buffer_pool` fails; the two small-device modes still pass: ``` FAIL: a device buffer placed in host memory was not kept in the pool after its release FAIL: a device buffer over the device-local budget did not reuse the retained host-placed buffer FAIL: idle device reclaim freed the host-placed buffer instead of the idle device-local one ``` After restoring the merged files and rebuilding, all 5 tests pass. ## Previous findings 1. **A refused host-placed slot is put back as the newest slot and counted as a hit.** Still open, non-blocking. [`Resources.cpp` L179-L186](https://github.com/boykopovar/AnyPS5/blob/53570aa5ffeabb0b4b49dd951649de8a5afa0e71/core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp#L179-L186) still calls `cache->Put(*pooled)`, and `Put` gives the slot a fresh `++clock` ([`BufferPool.cpp` L589](https://github.com/boykopovar/AnyPS5/blob/53570aa5ffeabb0b4b49dd951649de8a5afa0e71/core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp#L589)). 2. **`DeviceLocalFits(~0u, capacity)` does not test what the fresh path tests.** Still open, non-blocking. The fresh path uses the buffer's `memoryTypeBits` and the alignment-rounded `ClassAllocationBytes`. 3. **`GPUs tested` line vs the validation evidence.** Resolved for the checklist: the line now names the RTX 5060 Ti next to the 860M. The author has not posted a `main`-side layer run on the 5060 Ti. The lavapipe comparison here, the AMD RX 6300 CI comment on this exact head, and the earlier NVIDIA runs show no new IDs, which covers that gap. 4. **Overlap with #4472.** Still open, non-blocking. The description still records it and leaves the order to be agreed. The perf evidence MarcZX10 asked for is now posted (three PR runs and two `main` runs, with summary lines, traces and digests). It supports the narrowed claim that 8192+ host placements per run drop to 3. I accept those numbers as author-reported; I could not reproduce them. ## New findings ### Blocking None. ### Non-blocking 1. **The host-slot probe skips `main`'s texture-cache release, so a retained host slot now wins over a device-local placement that the cache release could make possible.** Since `e2c1c305ff`, a fresh over-budget request first asks the texture caches for the request plus the heap's overage. If they release enough, or the budget read again has room, the request stays device-local ([`Context.hpp` L357-L372](https://github.com/boykopovar/AnyPS5/blob/53570aa5ffeabb0b4b49dd951649de8a5afa0e71/core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp#L357-L372)). The probe in [`Resources.cpp` L182](https://github.com/boykopovar/AnyPS5/blob/53570aa5ffeabb0b4b49dd951649de8a5afa0e71/core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp#L179-L186) only reads the budget through `DeviceLocalFits`. While a matching host-placed slot exists, the cache release never runs for that size, and the buffer stays in host memory. This contradicts two claims in the description: "a buffer still gets device-local memory whenever there is room for it" and "both decide with the same rule". It may be the better trade-off: releasing textures on every 8 MiB request on a permanently full 512 MiB heap could just move the churn into the texture cache. But it was not measured: the captures are on `aaccd0ba39`, which predates `e2c1c305ff` (`git merge-base --is-ancestor` confirms this). Suggested fix: either state that a retained host slot is preferred over a texture-cache release, and add a mock case with `cacheReclaim` set that pins this, or try the release before taking the host slot. 2. **Minor:** the re-check after a release ([`Context.hpp` L368-L371](https://github.com/boykopovar/AnyPS5/blob/53570aa5ffeabb0b4b49dd951649de8a5afa0e71/core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp#L357-L372)) writes out the fit test by hand instead of calling `after.Fits(bytes)`. The two differ only when the budget is 0, which the first `Fits` already handled, so behaviour is the same. Calling `Fits` would keep a single rule. ## Not verified - **The performance numbers.** I have no APU with a small carve-out. The host-placement path runs here only in the mock tests. - **The interaction with the texture-cache release** (new finding 1) in a title. - **Windows and AMD/NVIDIA hardware drivers.** I ran on lavapipe only, and launched no title. I did not run the full suite: only the script's selected tests plus the 5 focused tests above. <!-- anyps5-bots job=3292 head=53570aa5ffeabb0b4b49dd951649de8a5afa0e71 -->
XairRrR commented 2026-11-03 12:09:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T12:09:02Z.

Review: APPROVED


Re-checked — approved

Since my last review, bd4354ef0c adds HostSlotBeforeCacheRelease, which pins the order between a retained host-placed slot and main's texture-cache release. d845d4bfc5 replaces the hand-written re-check after a release with after.Fits(bytes). The description now states the order and that the captures predate e2c1c305ff. Both points I raised last time are addressed. The new test fails in both negative controls, and nothing blocking remains.

What changed since my last review

  • bd4354ef0c (test only). HostSlotBeforeCacheRelease retains a 176 MiB host-placed buffer, then installs a cacheReclaim that releases any amount and counts its calls. It checks two things. First, a new request of the same size reuses the retained buffer and makes zero release calls. Second, a 64 MiB request, which has no host slot, makes exactly one release call and gets device-local memory.

  • d845d4bfc5. In DeviceMemoryType, the re-check after a partial release is now after.Fits(bytes) (Context.hpp L364-L371). Production code changed nowhere else (git diff 53570aa5ff d845d4bfc5 --stat: 1 line in Context.hpp, 31 lines in tests/BufferPool.cpp).

  • Description. It now says a matching host-placed slot is taken without a cache release, and it gives the reason. "Whenever there is room" became "whenever the reported budget has room". It notes that the order was not measured in a title.

  • Author reply (11:46 UTC). The author kept the order on purpose and gave two reasons:

    • Releasing caches on every request against a heap that stays over budget would move the churn into the texture caches.
    • A release that succeeds before the reported budget catches up would put the slot back and still place the new buffer in host memory.

    I agree with both: the first is the trade-off I raised, and the second is a real cost of the alternative order. With the order now documented and pinned by a test, I withdraw the request.

What I ran

Head d845d4bfc50963a172bbefb624641ed48e704fb5, main 4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree 4abace0fa91fceb7f140487b1aed12fbd3ce130f. Machine: Debian 13 VM, 2× Xeon Gold 6136, GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6, LLVM 19).

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...d845d4bfc50963a172bbefb624641ed48e704fb5
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
git diff 53570aa5ffeabb0b4b49dd951649de8a5afa0e71 d845d4bfc50963a172bbefb624641ed48e704fb5 --stat

# negative control A: the probe tries the texture-cache release before keeping a host slot (Resources.cpp line 182)
#   if (pooled && ((context.cacheReclaim != nullptr && context.cacheReclaim(capacity, true) >= capacity) || context.DeviceLocalFits(~0u, capacity)))
ninja -C build agc_buffer_pool_tests
ctest --test-dir build --output-on-failure -R '^agc_buffer_pool'

# negative control B: BufferPool.hpp, Context.hpp, BufferPool.cpp, Resources.cpp from main; PR tests kept
git show 4f41f4c375f5abb487dbd184fbc150f31994d762:<path> > <path>
ninja -C build agc_buffer_pool_tests
ctest --test-dir build --output-on-failure -R '^agc_buffer_pool'

# restore merged files, rebuild, focused run with the layer requested
git show 4abace0fa91fceb7f140487b1aed12fbd3ce130f:<path> > <path>
git status --porcelain
ninja -C build agc_buffer_pool_tests agc_device_memory_fallback_tests
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \
  ctest --test-dir build -j8 --test-load 32 -V --output-on-failure \
  -R '^(agc_buffer_pool|agc_buffer_pool_small_device_shared|agc_buffer_pool_small_device_no_staging|agc_device_memory_fallback|agc_memory_accounting.*)$'
Check Result
git diff --check Clean, exit 0
check_conventions.py All conventions checks passed.
Build and libs, merged tree (script) OK
Selected tests, merged tree (script) 2173 run, 2052 passed, 114 expected skips, 0 new failures. The 7 failures (the denormal/division agc_driver_* tests, vector_constant_factor_tininess and one unwrap_self test) also fail on main.
Validation comparison (script) The layer loaded in 769/770 tests. One ID is listed as new: VUID-vkCmdDispatch-groupCountX-00386 in agc_driver_native_depth_uniform_planes. That test is newer than the baseline d1ae628bc2. My last review reproduced this ID with main's production files, and the one production line changed since cannot reach a dispatch. It is not counted against this PR.
Focused tests, merged tree 7/7 passed (agc_buffer_pool 0.55 s). No VUID- lines and no was not found but was requested lines. These are mock-device tests.
Negative control A (release first) agc_buffer_pool fails with the 3 new messages
Negative control B (production from main) agc_buffer_pool fails with 6 messages
Worktree after restore git status --porcelain empty
Negative control output

A, release tried before keeping the host slot:

FAIL: a retained host-placed buffer was passed over for a texture-cache release
FAIL: taking a retained host-placed buffer asked the texture caches to release memory
FAIL: a new device buffer over the device-local budget did not get device-local memory after the texture caches released room

B, production files from main:

FAIL: a device buffer placed in host memory was not kept in the pool after its release
FAIL: a device buffer over the device-local budget did not reuse the retained host-placed buffer
FAIL: a retained host-placed buffer was passed over for a texture-cache release
FAIL: taking a retained host-placed buffer asked the texture caches to release memory
FAIL: a new device buffer over the device-local budget did not get device-local memory after the texture caches released room
FAIL: idle device reclaim freed the host-placed buffer instead of the idle device-local one

In both runs, agc_buffer_pool_small_device_shared and _no_staging passed. Control A confirms the author's statement that all three checks fail.

Previous findings

  1. A refused host-placed slot is put back as the newest slot and counted as a hit. Still open, non-blocking. Resources.cpp L179-L186 is unchanged.
  2. DeviceLocalFits(~0u, capacity) does not test what the fresh path tests (the fresh path uses memoryTypeBits and ClassAllocationBytes). Still open, non-blocking. The code is unchanged.
  3. GPUs tested line. Resolved in my last review. Nothing changed.
  4. Overlap with #4472. Still open, non-blocking. The description still records it, and the order still has to be agreed.
  5. The host-slot probe skips main's texture-cache release. Resolved. The order is now intentional and documented in the description. HostSlotBeforeCacheRelease pins it, and that test fails when the order is reversed (control A).
  6. Minor: the re-check after a release is written out by hand. Resolved. It now calls after.Fits(bytes) (Context.hpp L368-L371).

New findings

Blocking

None.

Non-blocking

None.

Not verified

  • The performance numbers. The SuperTuxKart captures on the Radeon 860M are author-reported. I have no APU with a small carve-out, and the host-placement path runs here only in the mock tests.
  • The cache-release order in a title. The author states this too: the captures predate e2c1c305ff.
  • Windows and AMD/NVIDIA hardware drivers. I ran on lavapipe only, and launched no title. I did not rerun agc_driver_native_depth_uniform_planes with main's files on this head; the attribution to main rests on my previous run.
  • The author's 7/7 on the 860M is accepted as author-reported.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5751905629 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8748#pullrequestreview-5751905629). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T12:09:02Z. **Review:** APPROVED --- # Re-checked — approved Since my last review, `bd4354ef0c` adds `HostSlotBeforeCacheRelease`, which pins the order between a retained host-placed slot and `main`'s texture-cache release. `d845d4bfc5` replaces the hand-written re-check after a release with `after.Fits(bytes)`. The description now states the order and that the captures predate `e2c1c305ff`. Both points I raised last time are addressed. The new test fails in both negative controls, and nothing blocking remains. ## What changed since my last review - **`bd4354ef0c` (test only).** `HostSlotBeforeCacheRelease` retains a 176 MiB host-placed buffer, then installs a `cacheReclaim` that releases any amount and counts its calls. It checks two things. First, a new request of the same size reuses the retained buffer and makes zero release calls. Second, a 64 MiB request, which has no host slot, makes exactly one release call and gets device-local memory. - **`d845d4bfc5`.** In `DeviceMemoryType`, the re-check after a partial release is now `after.Fits(bytes)` ([`Context.hpp` L364-L371](https://github.com/boykopovar/AnyPS5/blob/d845d4bfc50963a172bbefb624641ed48e704fb5/core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp#L364-L371)). Production code changed nowhere else (`git diff 53570aa5ff d845d4bfc5 --stat`: 1 line in `Context.hpp`, 31 lines in `tests/BufferPool.cpp`). - **Description.** It now says a matching host-placed slot is taken without a cache release, and it gives the reason. "Whenever there is room" became "whenever the reported budget has room". It notes that the order was not measured in a title. - **Author reply (11:46 UTC).** The author kept the order on purpose and gave two reasons: - Releasing caches on every request against a heap that stays over budget would move the churn into the texture caches. - A release that succeeds before the reported budget catches up would put the slot back and still place the new buffer in host memory. I agree with both: the first is the trade-off I raised, and the second is a real cost of the alternative order. With the order now documented and pinned by a test, I withdraw the request. ## What I ran Head `d845d4bfc50963a172bbefb624641ed48e704fb5`, `main` `4f41f4c375f5abb487dbd184fbc150f31994d762`, merged tree `4abace0fa91fceb7f140487b1aed12fbd3ce130f`. Machine: Debian 13 VM, 2× Xeon Gold 6136, GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6, LLVM 19). ```sh git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...d845d4bfc50963a172bbefb624641ed48e704fb5 python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 git diff 53570aa5ffeabb0b4b49dd951649de8a5afa0e71 d845d4bfc50963a172bbefb624641ed48e704fb5 --stat # negative control A: the probe tries the texture-cache release before keeping a host slot (Resources.cpp line 182) # if (pooled && ((context.cacheReclaim != nullptr && context.cacheReclaim(capacity, true) >= capacity) || context.DeviceLocalFits(~0u, capacity))) ninja -C build agc_buffer_pool_tests ctest --test-dir build --output-on-failure -R '^agc_buffer_pool' # negative control B: BufferPool.hpp, Context.hpp, BufferPool.cpp, Resources.cpp from main; PR tests kept git show 4f41f4c375f5abb487dbd184fbc150f31994d762:<path> > <path> ninja -C build agc_buffer_pool_tests ctest --test-dir build --output-on-failure -R '^agc_buffer_pool' # restore merged files, rebuild, focused run with the layer requested git show 4abace0fa91fceb7f140487b1aed12fbd3ce130f:<path> > <path> git status --porcelain ninja -C build agc_buffer_pool_tests agc_device_memory_fallback_tests VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \ ctest --test-dir build -j8 --test-load 32 -V --output-on-failure \ -R '^(agc_buffer_pool|agc_buffer_pool_small_device_shared|agc_buffer_pool_small_device_no_staging|agc_device_memory_fallback|agc_memory_accounting.*)$' ``` | Check | Result | |---|---| | `git diff --check` | Clean, exit 0 | | `check_conventions.py` | `All conventions checks passed.` | | Build and `libs`, merged tree (script) | OK | | Selected tests, merged tree (script) | 2173 run, 2052 passed, 114 expected skips, **0 new failures**. The 7 failures (the denormal/division `agc_driver_*` tests, `vector_constant_factor_tininess` and one `unwrap_self` test) also fail on `main`. | | Validation comparison (script) | The layer loaded in 769/770 tests. One ID is listed as new: `VUID-vkCmdDispatch-groupCountX-00386` in `agc_driver_native_depth_uniform_planes`. That test is newer than the baseline `d1ae628bc2`. My last review reproduced this ID with `main`'s production files, and the one production line changed since cannot reach a dispatch. It is not counted against this PR. | | Focused tests, merged tree | 7/7 passed (`agc_buffer_pool` 0.55 s). No `VUID-` lines and no `was not found but was requested` lines. These are mock-device tests. | | Negative control A (release first) | `agc_buffer_pool` fails with the 3 new messages | | Negative control B (production from `main`) | `agc_buffer_pool` fails with 6 messages | | Worktree after restore | `git status --porcelain` empty | <details><summary>Negative control output</summary> A, release tried before keeping the host slot: ``` FAIL: a retained host-placed buffer was passed over for a texture-cache release FAIL: taking a retained host-placed buffer asked the texture caches to release memory FAIL: a new device buffer over the device-local budget did not get device-local memory after the texture caches released room ``` B, production files from `main`: ``` FAIL: a device buffer placed in host memory was not kept in the pool after its release FAIL: a device buffer over the device-local budget did not reuse the retained host-placed buffer FAIL: a retained host-placed buffer was passed over for a texture-cache release FAIL: taking a retained host-placed buffer asked the texture caches to release memory FAIL: a new device buffer over the device-local budget did not get device-local memory after the texture caches released room FAIL: idle device reclaim freed the host-placed buffer instead of the idle device-local one ``` In both runs, `agc_buffer_pool_small_device_shared` and `_no_staging` passed. Control A confirms the author's statement that all three checks fail. </details> ## Previous findings 1. **A refused host-placed slot is put back as the newest slot and counted as a hit.** Still open, non-blocking. [`Resources.cpp` L179-L186](https://github.com/boykopovar/AnyPS5/blob/d845d4bfc50963a172bbefb624641ed48e704fb5/core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp#L179-L186) is unchanged. 2. **`DeviceLocalFits(~0u, capacity)` does not test what the fresh path tests** (the fresh path uses `memoryTypeBits` and `ClassAllocationBytes`). Still open, non-blocking. The code is unchanged. 3. **`GPUs tested` line.** Resolved in my last review. Nothing changed. 4. **Overlap with #4472.** Still open, non-blocking. The description still records it, and the order still has to be agreed. 5. **The host-slot probe skips `main`'s texture-cache release.** Resolved. The order is now intentional and documented in the description. `HostSlotBeforeCacheRelease` pins it, and that test fails when the order is reversed (control A). 6. **Minor: the re-check after a release is written out by hand.** Resolved. It now calls `after.Fits(bytes)` ([`Context.hpp` L368-L371](https://github.com/boykopovar/AnyPS5/blob/d845d4bfc50963a172bbefb624641ed48e704fb5/core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp#L364-L371)). ## New findings ### Blocking None. ### Non-blocking None. ## Not verified - **The performance numbers.** The SuperTuxKart captures on the Radeon 860M are author-reported. I have no APU with a small carve-out, and the host-placement path runs here only in the mock tests. - **The cache-release order in a title.** The author states this too: the captures predate `e2c1c305ff`. - **Windows and AMD/NVIDIA hardware drivers.** I ran on lavapipe only, and launched no title. I did not rerun `agc_driver_native_depth_uniform_planes` with `main`'s files on this head; the attribution to `main` rests on my previous run. - **The author's 7/7 on the 860M** is accepted as author-reported. <!-- anyps5-bots job=3316 head=d845d4bfc50963a172bbefb624641ed48e704fb5 -->
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!8748
No description provided.