fix(agc): let draw relocation aliases name a cached key, not hold its entry #9396

Merged
EagleBearerYS merged 4 commits from upstream-pr/9396 into main 2026-10-24 16:35:40 +00:00
EagleBearerYS commented 2026-10-21 20:33:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T20:33:57Z.


What

Draw relocation learns an alias for a draw whose user-data words moved, so the next draw at the moved address can reuse the cached entry. learnPendingRelocation stored each alias as a shared_ptr to the entry it had just inserted. When the draw cache later evicted that key, or replaced its entry, the alias kept the old entry alive, and with it every stage variant's runs and words.

Only MaxAliases (16,384, four times the cache's entry cap) bounds the alias map, and the cache's byte budget (#9129) doesn't count what the map holds. #9129 lists this under its limits.

The change:

  • drawAliases maps an alias to the draw key it was learned for, not to the entry.
  • relocateDrawEntry looks that key up in drawCache and uses the entry found there as the donor. When the key has left the cache, it drops the alias and the draw takes the ordinary miss path.
  • A draw that hits through an alias moves its donor to the front of the cache's LRU, with the same rate limit as a direct hit. A relocated hit isn't inserted, and lookupDraw refreshed only an entry cached under the draw's own key. So without this, a donor that serves only relocated draws ages out like an unused entry, which now also ends its alias.

A relocation now only reuses entries the cache still holds, so everything a donor keeps alive is inside the cache's entry and byte bounds.

Why, from Resident Evil Village (PPSA01556)'s main menu. The first runs show what holds the memory; the pair after them measures this PR.

  • Heap counts, on a local tree with #9129's byte bound and the draw cache at its 256 MiB budget: live variant runs and words reached ~3.1 GB in 1,052 pairs after 8 minutes, against the ~564 variants the cache counted.
  • Relocation off (APS5_NO_DRAW_RELOCATION=1) on main 1ff5c8ac5c plus #8926 and #9129, unprofiled, warm, 16 minutes at the static menu, GPU clocks weren't held:
private growth, menu +1 to +10 min menu fps, median
that tree 240 MB/min 0.373
relocation off 63 MB/min 0.484
  • Draw cache off (APS5_NO_DRAW_SRT_ENTRIES=1 APS5_NO_DRAW_KEY=1) gave 68 MB/min and 0.491 fps. Both runs' menu screenshots match the first's.

The pair, relocation on: that tree (main 1ff5c8ac5c plus #8926 and #9129's byte bound) against the same tree with this PR's 1d2fdfb261 and 2b862fbb7e. Resident Evil Village (PPSA01556), NVIDIA GeForce RTX 3070 (driver 617.42), Windows 11, the same launch settings for both; unprofiled, warm shader cache, 16 minutes at the static menu each, frames measured over menu +5 to +15 min; GPU clocks weren't held.

that tree with this PR
median frame 3,606 ms (0.277 fps) 2,196 ms (0.455 fps)
p90 frame 4,694 ms 3,118 ms
private growth, menu +1 to +10 min 224 MB/min 58 MB/min
private bytes at +15 min 22,120 MB 18,516 MB
presents in 16 minutes 165 267
  • The tree ran slower in this pair than in its two earlier runs (0.371 and 0.373 fps, 207 to 240 MB/min). Against those, the fps with this PR is about 22% higher.
  • With this PR the growth is close to the relocation-off run's 63 MB/min.
  • The alias change is what stops the growth. The donor refresh doesn't show at the menu, where traces show about 30 draw-cache hits in about 200,000 lookups per 5 minutes and no relocated draw. It rests on its own test below.

Overlap: checked with git merge-tree on c06bd7c7e1 against every open PR touching these files. The ones that merge cleanly with main merge cleanly with this PR too, except #9335 (frankea), whose latest tests are declared at the same place in libSceAgcDriver/CMakeLists.txt. That's a clash of test declarations only, and whichever lands second keeps both on rebase. Of the ones that conflict with main themselves, this PR adds conflicts only to #5609 and #6539, which is stacked on it, both in the alias map (Driver.hpp and DrawRelocate.cpp). Two PRs work on the same path:

  • #7369 adds a donor pointer to DrawEntry, so a relocated entry keeps its donor's recipes. It doesn't touch the alias map, and the two compose.
  • #5609 (TheAggie) replaces the alias map with per-stage donors (drawStageDonors and drawDecodes). This PR goes first, as proposed in the note on #5609, which conflicts with main at the moment. #5609's donor maps would take the same two rules when it rebases: hold a draw key, not the entry, and move a donor up the LRU on a relocated hit. #6539 carries #5609's maps, so the same rebase covers it. If #5609 lands first, this PR moves both rules to its donor maps instead.

Tested

  • New ctest agc_driver_draw_cache_relocation_evicted. It's DrawCacheRelocation.cpp --evicted with APS5_DRAW_CACHE_ENTRIES=2. It teaches an alias as MovedDataHitsTheCache does, checks that a moved draw hits through it, then evicts both taught entries with two other keys. It requires that one more moved draw of the first identity doesn't hit.

    • Red, with main's Driver.hpp and DrawRelocate.cpp and the test unchanged: "a draw whose data moved reused a draw the cache had evicted, through its relocation alias (1 hits)".
    • Green: "An evicted draw served no relocation with graphics pipeline libraries".
  • New ctest agc_driver_draw_cache_relocation_kept, for the donor refresh. It's DrawCacheRelocation.cpp --kept with APS5_DRAW_CACHE_ENTRIES=2. It teaches an alias, then runs three rounds: two draws of another vertex shader that insert an entry, then a moved draw with the taught contents. Every moved draw has to hit. Without the refresh, the second round's insert evicts the donor and its moved draw misses. On GitHub's Linux runner (run) it fails 3 of 3 without 2b862fbb7e's Draw.cpp change and passes 10 of 10 with it.

  • GitHub's runners (run):

    • Linux: with main's code the new case fails 3 of 3; with this PR it passes 10 of 10. The 6 draw-cache tests pass, and so does the libkernel suite. The libc suite's precise_wait failed in this run with the fix, and on both sides in an earlier run. It's a timing test this change doesn't reach.
    • Windows: it builds and the libc and libkernel suites pass. The draw-cache tests skip there, as the Vulkan tests do on that runner.
  • Linux (Ubuntu 24.04, GCC 13.3, lavapipe, CI's flags): ^agc_driver_draw_cache 6 of 6, --repeat until-fail:10 on both relocation tests, check_test_registration.py and check_conventions.py pass.

  • jotitadev's run (review): Ubuntu 26.04, GCC 15.2, Release, this PR's 1d2fdfb26 on main a6dcea927. They ran the new case with ANYPS5_NO_SHADER_CACHE=1 APS5_DRAW_CACHE_ENTRIES=2, which they describe as the path without graphics pipeline libraries, on an NVIDIA GeForce RTX 3070 (driver 595.99.02) and on lavapipe (Mesa 26.0.3) on the same host.

    • It passes with this PR on both.
    • With main's driver and this PR's test, it fails on both with the same message as the red above.
  • After the merge with main at b27924d851 (c06bd7c7e1, no conflicts, the PR's own diff unchanged; run): the six draw-cache tests pass 10 runs in a row on Linux, none skipped; on Windows all six build and skip, as the runner has no Vulkan device. The libc and libkernel suites pass on both (116 and 197 on Linux, 143 and 207 on Windows).

  • Validation layer, main against this PR (CONTRIBUTING's AGC rule), on one GitHub Linux runner (the same run). Both runs used VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1 and ctest -V, with VK_LOADER_DEBUG=layer to show the layer loading. The device was llvmpipe (LLVM 20.1.2) on Mesa 25.2.8, Ubuntu 24.04.5, Khronos validation layers 1.3.275.

    • Tests: agc_driver_draw_cache_relocation, agc_driver_draw_cache_reuse_inline, agc_driver_draw_cache_reuse_off and agc_driver_draw_cache_reuse_verify on both trees, and this PR's agc_driver_draw_cache_relocation_evicted and _kept, which main doesn't have. main's tree ran its four once and this PR's six ten times.
    • The loader inserted VK_LAYER_KHRONOS_validation 8 times on main and 120 with this PR, and neither log has was not found but was requested by env var VK_INSTANCE_LAYERS.
    • Both logs report the same single message, VUID-VkDeviceCreateInfo-pNext-pNext, for a device-creation structure newer than that layer version. This PR adds no VUID- message.
  • Windows on a GPU, at 2b862fbb7e, the head before the merge: NVIDIA GeForce RTX 3070 Laptop GPU (driver 617.42, the only device enumerated), Windows 11, WinLibs GCC 15.2.0, Release, ANYPS5_REQUIRE_VULKAN=1. GPU clocks weren't held; these are pass/fail only.

    • Both new cases pass 10 runs in a row.
    • With main's Driver.hpp, DrawRelocate.cpp and Draw.cpp, _evicted fails 3 of 3 with the red message above.
    • With only 2b862fbb7e's Draw.cpp change removed, _kept fails 3 of 3: "a draw whose data moved again lost the cached draw it reused before each of 2 rounds of another vertex shader's draws (2 inserts, 2 evictions)". _evicted still passes, so each commit's test catches its own case.
  • Ghost of Tsushima Director's Cut (PPSA02225), by @milescoviello (comment): Linux, RTX 4070 Ti, warm cache, a 20 GiB cap, journal replay off, on a stack with #8115, #8121, #8213, #8608, #9318 and #9129 (f2c368b242), plus a 256 MiB result memo budget and a 3D view bound. One gameplay run without this PR's three commits and one with them (cherry-picked cleanly).

    • With #9129 alone, a jemalloc profile at 1,157 s put 1,448 MiB live under Driver::tagVariantRuns (from cacheDrawStages), while the draw cache's own count stayed at ~250 MiB of its 256 MiB budget: the aliases this PR changes kept evicted and replaced entries alive.
    • RssAnon tracked between the two runs until the draw cache began evicting, around minute 14. At minutes 16, 18, 20 and 22 it was 6,884, 7,740, 8,786 and 9,209 MB without this PR, against 6,634, 6,458, 6,872 and 7,845 MB with it. The cap ended the run without it at 1,265 s, and the run with it at 1,700 s.
    • Both runs were still in the opening when the cap ended them, so the title gets no further yet. RssAnon varies by a few hundred MB between identical runs on that host, so only the gap after minute 16 is read as this PR's.

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 (merges before #5609, see Overlap)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: Mesa lavapipe (llvmpipe, LLVM 20.1.2, Mesa 25.2.8), Ubuntu 24.04, on GitHub's runner and a Linux build machine, with the validation comparison on GitHub's runner; NVIDIA GeForce RTX 3070 (driver 595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04, in jotitadev's run; NVIDIA GeForce RTX 3070 Laptop GPU (driver 617.42), Windows 11, for both cases' red/green and in the Resident Evil Village pair
  • AI-assisted: yes

Related: #9129

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4957976232 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9396). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-21T20:33:57Z. --- ### What Draw relocation learns an alias for a draw whose user-data words moved, so the next draw at the moved address can reuse the cached entry. `learnPendingRelocation` stored each alias as a `shared_ptr` to the entry it had just inserted. When the draw cache later evicted that key, or replaced its entry, the alias kept the old entry alive, and with it every stage variant's runs and words. Only `MaxAliases` (16,384, four times the cache's entry cap) bounds the alias map, and the cache's byte budget (#9129) doesn't count what the map holds. #9129 lists this under its limits. **The change:** - `drawAliases` maps an alias to the draw key it was learned for, not to the entry. - `relocateDrawEntry` looks that key up in `drawCache` and uses the entry found there as the donor. When the key has left the cache, it drops the alias and the draw takes the ordinary miss path. - A draw that hits through an alias moves its donor to the front of the cache's LRU, with the same rate limit as a direct hit. A relocated hit isn't inserted, and `lookupDraw` refreshed only an entry cached under the draw's own key. So without this, a donor that serves only relocated draws ages out like an unused entry, which now also ends its alias. A relocation now only reuses entries the cache still holds, so everything a donor keeps alive is inside the cache's entry and byte bounds. **Why, from Resident Evil Village (PPSA01556)'s main menu.** The first runs show what holds the memory; the pair after them measures this PR. - **Heap counts,** on a local tree with #9129's byte bound and the draw cache at its 256 MiB budget: live variant runs and words reached ~3.1 GB in 1,052 pairs after 8 minutes, against the ~564 variants the cache counted. - **Relocation off** (`APS5_NO_DRAW_RELOCATION=1`) on `main` 1ff5c8ac5c plus #8926 and #9129, unprofiled, warm, 16 minutes at the static menu, GPU clocks weren't held: | | private growth, menu +1 to +10 min | menu fps, median | |---|---|---| | that tree | 240 MB/min | 0.373 | | relocation off | 63 MB/min | 0.484 | - Draw cache off (`APS5_NO_DRAW_SRT_ENTRIES=1 APS5_NO_DRAW_KEY=1`) gave 68 MB/min and 0.491 fps. Both runs' menu screenshots match the first's. **The pair**, relocation on: that tree (`main` 1ff5c8ac5c plus #8926 and #9129's byte bound) against the same tree with this PR's 1d2fdfb261 and 2b862fbb7e. Resident Evil Village (PPSA01556), NVIDIA GeForce RTX 3070 (driver 617.42), Windows 11, the same launch settings for both; unprofiled, warm shader cache, 16 minutes at the static menu each, frames measured over menu +5 to +15 min; GPU clocks weren't held. | | that tree | with this PR | |---|---|---| | median frame | 3,606 ms (0.277 fps) | 2,196 ms (0.455 fps) | | p90 frame | 4,694 ms | 3,118 ms | | private growth, menu +1 to +10 min | 224 MB/min | 58 MB/min | | private bytes at +15 min | 22,120 MB | 18,516 MB | | presents in 16 minutes | 165 | 267 | - The tree ran slower in this pair than in its two earlier runs (0.371 and 0.373 fps, 207 to 240 MB/min). Against those, the fps with this PR is about 22% higher. - With this PR the growth is close to the relocation-off run's 63 MB/min. - The alias change is what stops the growth. The donor refresh doesn't show at the menu, where traces show about 30 draw-cache hits in about 200,000 lookups per 5 minutes and no relocated draw. It rests on its own test below. **Overlap:** checked with `git merge-tree` on c06bd7c7e1 against every open PR touching these files. The ones that merge cleanly with `main` merge cleanly with this PR too, except #9335 (frankea), whose latest tests are declared at the same place in `libSceAgcDriver/CMakeLists.txt`. That's a clash of test declarations only, and whichever lands second keeps both on rebase. Of the ones that conflict with `main` themselves, this PR adds conflicts only to #5609 and #6539, which is stacked on it, both in the alias map (`Driver.hpp` and `DrawRelocate.cpp`). Two PRs work on the same path: - #7369 adds a `donor` pointer to `DrawEntry`, so a relocated entry keeps its donor's recipes. It doesn't touch the alias map, and the two compose. - #5609 (TheAggie) replaces the alias map with per-stage donors (`drawStageDonors` and `drawDecodes`). This PR goes first, as proposed in the [note](https://github.com/boykopovar/AnyPS5/pull/5609#issuecomment-6333966478) on #5609, which conflicts with `main` at the moment. #5609's donor maps would take the same two rules when it rebases: hold a draw key, not the entry, and move a donor up the LRU on a relocated hit. #6539 carries #5609's maps, so the same rebase covers it. If #5609 lands first, this PR moves both rules to its donor maps instead. ### Tested - **New ctest `agc_driver_draw_cache_relocation_evicted`.** It's `DrawCacheRelocation.cpp --evicted` with `APS5_DRAW_CACHE_ENTRIES=2`. It teaches an alias as `MovedDataHitsTheCache` does, checks that a moved draw hits through it, then evicts both taught entries with two other keys. It requires that one more moved draw of the first identity doesn't hit. - **Red**, with `main`'s `Driver.hpp` and `DrawRelocate.cpp` and the test unchanged: "a draw whose data moved reused a draw the cache had evicted, through its relocation alias (1 hits)". - **Green:** "An evicted draw served no relocation with graphics pipeline libraries". - **New ctest `agc_driver_draw_cache_relocation_kept`**, for the donor refresh. It's `DrawCacheRelocation.cpp --kept` with `APS5_DRAW_CACHE_ENTRIES=2`. It teaches an alias, then runs three rounds: two draws of another vertex shader that insert an entry, then a moved draw with the taught contents. Every moved draw has to hit. Without the refresh, the second round's insert evicts the donor and its moved draw misses. On GitHub's Linux runner ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39693819016)) it fails 3 of 3 without 2b862fbb7e's `Draw.cpp` change and passes 10 of 10 with it. - **GitHub's runners** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39664772762)): - Linux: with `main`'s code the new case fails 3 of 3; with this PR it passes 10 of 10. The 6 draw-cache tests pass, and so does the libkernel suite. The libc suite's `precise_wait` failed in this run with the fix, and on both sides in an [earlier run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39658782630). It's a timing test this change doesn't reach. - Windows: it builds and the libc and libkernel suites pass. The draw-cache tests skip there, as the Vulkan tests do on that runner. - **Linux** (Ubuntu 24.04, GCC 13.3, lavapipe, CI's flags): `^agc_driver_draw_cache` 6 of 6, `--repeat until-fail:10` on both relocation tests, `check_test_registration.py` and `check_conventions.py` pass. - **jotitadev's run** ([review](https://github.com/boykopovar/AnyPS5/pull/9396#pullrequestreview-5606918043)): Ubuntu 26.04, GCC 15.2, Release, this PR's `1d2fdfb26` on `main` `a6dcea927`. They ran the new case with `ANYPS5_NO_SHADER_CACHE=1 APS5_DRAW_CACHE_ENTRIES=2`, which they describe as the path without graphics pipeline libraries, on an NVIDIA GeForce RTX 3070 (driver 595.99.02) and on lavapipe (Mesa 26.0.3) on the same host. - It passes with this PR on both. - With `main`'s driver and this PR's test, it fails on both with the same message as the red above. - **After the merge with `main` at b27924d851** (c06bd7c7e1, no conflicts, the PR's own diff unchanged; [run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39731569182)): the six draw-cache tests pass 10 runs in a row on Linux, none skipped; on Windows all six build and skip, as the runner has no Vulkan device. The libc and libkernel suites pass on both (116 and 197 on Linux, 143 and 207 on Windows). - **Validation layer, `main` against this PR** (CONTRIBUTING's AGC rule), on one GitHub Linux runner (the same [run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39731569182)). Both runs used `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1` and `ctest -V`, with `VK_LOADER_DEBUG=layer` to show the layer loading. The device was llvmpipe (LLVM 20.1.2) on Mesa 25.2.8, Ubuntu 24.04.5, Khronos validation layers 1.3.275. - Tests: `agc_driver_draw_cache_relocation`, `agc_driver_draw_cache_reuse_inline`, `agc_driver_draw_cache_reuse_off` and `agc_driver_draw_cache_reuse_verify` on both trees, and this PR's `agc_driver_draw_cache_relocation_evicted` and `_kept`, which `main` doesn't have. `main`'s tree ran its four once and this PR's six ten times. - The loader inserted `VK_LAYER_KHRONOS_validation` 8 times on `main` and 120 with this PR, and neither log has `was not found but was requested by env var VK_INSTANCE_LAYERS`. - Both logs report the same single message, `VUID-VkDeviceCreateInfo-pNext-pNext`, for a device-creation structure newer than that layer version. This PR adds no `VUID-` message. - **Windows on a GPU**, at 2b862fbb7e, the head before the merge: NVIDIA GeForce RTX 3070 Laptop GPU (driver 617.42, the only device enumerated), Windows 11, WinLibs GCC 15.2.0, Release, `ANYPS5_REQUIRE_VULKAN=1`. GPU clocks weren't held; these are pass/fail only. - Both new cases pass 10 runs in a row. - With `main`'s `Driver.hpp`, `DrawRelocate.cpp` and `Draw.cpp`, `_evicted` fails 3 of 3 with the red message above. - With only 2b862fbb7e's `Draw.cpp` change removed, `_kept` fails 3 of 3: "a draw whose data moved again lost the cached draw it reused before each of 2 rounds of another vertex shader's draws (2 inserts, 2 evictions)". `_evicted` still passes, so each commit's test catches its own case. - **Ghost of Tsushima Director's Cut (PPSA02225)**, by @milescoviello ([comment](https://github.com/boykopovar/AnyPS5/pull/9396#issuecomment-6359411097)): Linux, RTX 4070 Ti, warm cache, a 20 GiB cap, journal replay off, on a stack with #8115, #8121, #8213, #8608, #9318 and #9129 (f2c368b242), plus a 256 MiB result memo budget and a 3D view bound. One gameplay run without this PR's three commits and one with them (cherry-picked cleanly). - With #9129 alone, a jemalloc profile at 1,157 s put 1,448 MiB live under `Driver::tagVariantRuns` (from `cacheDrawStages`), while the draw cache's own count stayed at ~250 MiB of its 256 MiB budget: the aliases this PR changes kept evicted and replaced entries alive. - RssAnon tracked between the two runs until the draw cache began evicting, around minute 14. At minutes 16, 18, 20 and 22 it was 6,884, 7,740, 8,786 and 9,209 MB without this PR, against 6,634, 6,458, 6,872 and 7,845 MB with it. The cap ended the run without it at 1,265 s, and the run with it at 1,700 s. - Both runs were still in the opening when the cap ended them, so the title gets no further yet. RssAnon varies by a few hundred MB between identical runs on that host, so only the gap after minute 16 is read as this PR's. ### Checklist - [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 (merges before #5609, see Overlap) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: Mesa lavapipe (llvmpipe, LLVM 20.1.2, Mesa 25.2.8), Ubuntu 24.04, on GitHub's runner and a Linux build machine, with the validation comparison on GitHub's runner; NVIDIA GeForce RTX 3070 (driver 595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04, in jotitadev's run; NVIDIA GeForce RTX 3070 Laptop GPU (driver 617.42), Windows 11, for both cases' red/green and in the Resident Evil Village pair - [x] AI-assisted: yes Related: #9129
jotitadev commented 2026-10-21 22:17:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-21T22:17:31Z.

Review: COMMENTED


A Linux run on NVIDIA and lavapipe, with a red control, at the current head.

Machine: Ubuntu 26.04, i7-8700, GCC 15.2, Release, BUILD_TESTING=ON. NVIDIA GeForce RTX 3070 (driver 595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same host, selected with VK_ICD_FILENAMES. Head 1d2fdfb26 applied onto main a6dcea927 (clean). The new agc_driver_draw_cache_relocation_evicted case, run as --evicted with ANYPS5_NO_SHADER_CACHE=1 APS5_DRAW_CACHE_ENTRIES=2 (no-GPL path).

agc_driver_draw_cache_relocation --evicted RTX 3070 lavapipe
this PR pass pass
main driver + only this PR's test fail fail

The red control fails identically on both:

a draw whose data moved reused a draw the cache had evicted, through its relocation alias (1 hits)

So on NVIDIA as well as on software Vulkan, a main drawAliases entry keeps the evicted draw's entry alive and a later moved-data draw reuses it (1 stray hit); with this PR the alias names the draw key, finds the key gone from drawCache, drops the alias and the draw takes the ordinary miss path (0 stray hits). The teaching/first-relocation counters (lookups 4, hits 0, inserts 2, then hits 1) match on both devices.

Not run: the graphics-pipeline-libraries path of this case, Windows, the title heap measurements in the description.

GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02, Linux) and lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5606918043 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9396#pullrequestreview-5606918043). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-21T22:17:31Z. **Review:** COMMENTED --- A Linux run on NVIDIA and lavapipe, with a red control, at the current head. **Machine:** Ubuntu 26.04, i7-8700, GCC 15.2, Release, `BUILD_TESTING=ON`. NVIDIA GeForce RTX 3070 (driver 595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same host, selected with `VK_ICD_FILENAMES`. Head `1d2fdfb26` applied onto `main` `a6dcea927` (clean). The new `agc_driver_draw_cache_relocation_evicted` case, run as `--evicted` with `ANYPS5_NO_SHADER_CACHE=1 APS5_DRAW_CACHE_ENTRIES=2` (no-GPL path). | `agc_driver_draw_cache_relocation` `--evicted` | RTX 3070 | lavapipe | |---|---|---| | this PR | pass | pass | | `main` driver + only this PR's test | fail | fail | The red control fails identically on both: ``` a draw whose data moved reused a draw the cache had evicted, through its relocation alias (1 hits) ``` So on NVIDIA as well as on software Vulkan, a `main` `drawAliases` entry keeps the evicted draw's entry alive and a later moved-data draw reuses it (1 stray hit); with this PR the alias names the draw key, finds the key gone from `drawCache`, drops the alias and the draw takes the ordinary miss path (0 stray hits). The teaching/first-relocation counters (`lookups 4, hits 0, inserts 2`, then `hits 1`) match on both devices. Not run: the graphics-pipeline-libraries path of this case, Windows, the title heap measurements in the description. GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02, Linux) and lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04 Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
EagleBearerYS commented 2026-10-21 22:20:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T22:20:36Z.


Thanks, @jotitadev. A red control on NVIDIA as well as lavapipe is what this case needed. I've added your run to Tested and to GPUs tested.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6327820118 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9396#issuecomment-6327820118). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-21T22:20:36Z. --- Thanks, @jotitadev. A red control on NVIDIA as well as lavapipe is what this case needed. I've added your run to Tested and to GPUs tested.
MarcZX10 commented 2026-10-22 05:45:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T05:45:28Z.

Review: DISMISSED


The change removes the alias map’s strong reference to evicted draw entries, and the red/green regression directly exercises that leak. The donor-retention test also covers the LRU behavior. The report has useful Linux/lavapipe and NVIDIA runs plus title memory/frame measurements, and git diff --check passes. The current head merges cleanly with main.

I’m requesting changes for the remaining repository requirements:

  • This head is based on 1ff5c8ac5c (current main is 4a17c71757, 496 commits ahead). Please rebase onto current main and rerun the focused draw-cache tests on main and the change with VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, and ANYPS5_REQUIRE_VULKAN=1; compare and report the VUIDs and tested GPUs as required for AGC changes. The recorded Linux/NVIDIA focused runs do not show that validation-layer comparison.
  • The current overlap scan cannot compare #5609 because that open branch conflicts with current main. #5609 replaces the relocation alias map with per-stage donor maps, and this PR says it would move to those maps if #5609 lands first. Please coordinate order with its author and set Depends on: to match the agreement. #7369 appears complementary and does not show a same-line conflict in the current scan.

Hosted product build jobs on this PR are skipped. No local AGC test or GPU run was possible in this review environment. Please refresh the overlap scan after rebasing and manually check its uncomparable intersections before merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5609759601 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9396#pullrequestreview-5609759601). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T05:45:28Z. **Review:** DISMISSED --- The change removes the alias map’s strong reference to evicted draw entries, and the red/green regression directly exercises that leak. The donor-retention test also covers the LRU behavior. The report has useful Linux/lavapipe and NVIDIA runs plus title memory/frame measurements, and `git diff --check` passes. The current head merges cleanly with `main`. I’m requesting changes for the remaining repository requirements: - This head is based on `1ff5c8ac5c` (current main is `4a17c71757`, 496 commits ahead). Please rebase onto current `main` and rerun the focused draw-cache tests on main and the change with `VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, and `ANYPS5_REQUIRE_VULKAN=1`; compare and report the VUIDs and tested GPUs as required for AGC changes. The recorded Linux/NVIDIA focused runs do not show that validation-layer comparison. - The current overlap scan cannot compare #5609 because that open branch conflicts with current main. #5609 replaces the relocation alias map with per-stage donor maps, and this PR says it would move to those maps if #5609 lands first. Please coordinate order with its author and set `Depends on:` to match the agreement. #7369 appears complementary and does not show a same-line conflict in the current scan. Hosted product build jobs on this PR are skipped. No local AGC test or GPU run was possible in this review environment. Please refresh the overlap scan after rebasing and manually check its uncomparable intersections before merge.
EagleBearerYS commented 2026-10-22 08:36:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T08:36:02Z.


Thanks, @MarcZX10. On the three points:

  1. Main: c06bd7c7e1 merges main at b27924d851, which contains 4a17c71757. It had no conflicts and leaves the PR's own diff unchanged. It still merges cleanly with main at 7e2ba73e4c, whose 34 newer commits touch none of these files.
  2. Validation layer (run): main's tree and this PR's ran on one GitHub Linux runner with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1 and ANYPS5_REQUIRE_VULKAN=1. The device was llvmpipe (LLVM 20.1.2, Mesa 25.2.8) with Khronos validation layers 1.3.275. main ran its four draw-cache relocation and reuse tests; this PR ran those and its two new ones, ten times. Both logs report the same single message, VUID-VkDeviceCreateInfo-pNext-pNext, for a device-creation structure newer than that layer version. This PR adds no VUID. Tested and GPUs tested now list it, with a red/green of both new cases on an NVIDIA GeForce RTX 3070 Laptop GPU on Windows.
  3. #5609: the order note is on #5609 (comment). It proposes this PR first, with #5609's donor maps taking the same two rules when it rebases, and Depends on: says so. If #5609 lands first, this PR moves both rules to its donor maps.

Overlap, after the merge: I checked the scan's uncomparable intersections with git merge-tree, merging each of those PRs' heads with c06bd7c7e1 and with main alone. This PR adds conflicts only to #5609 and to #6539, which is stacked on it, both in the alias map (Driver.hpp and DrawRelocate.cpp). For the others, each shared file has as many conflicts with this PR as with main alone.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6336456449 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9396#issuecomment-6336456449). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-22T08:36:02Z. --- Thanks, @MarcZX10. On the three points: 1. **Main:** c06bd7c7e1 merges `main` at b27924d851, which contains `4a17c71757`. It had no conflicts and leaves the PR's own diff unchanged. It still merges cleanly with `main` at 7e2ba73e4c, whose 34 newer commits touch none of these files. 2. **Validation layer** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39731569182)): `main`'s tree and this PR's ran on one GitHub Linux runner with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1` and `ANYPS5_REQUIRE_VULKAN=1`. The device was llvmpipe (LLVM 20.1.2, Mesa 25.2.8) with Khronos validation layers 1.3.275. `main` ran its four draw-cache relocation and reuse tests; this PR ran those and its two new ones, ten times. Both logs report the same single message, `VUID-VkDeviceCreateInfo-pNext-pNext`, for a device-creation structure newer than that layer version. This PR adds no VUID. Tested and GPUs tested now list it, with a red/green of both new cases on an NVIDIA GeForce RTX 3070 Laptop GPU on Windows. 3. **#5609:** the order note is on #5609 ([comment](https://github.com/boykopovar/AnyPS5/pull/5609#issuecomment-6333966478)). It proposes this PR first, with #5609's donor maps taking the same two rules when it rebases, and `Depends on:` says so. If #5609 lands first, this PR moves both rules to its donor maps. **Overlap, after the merge:** I checked the scan's uncomparable intersections with `git merge-tree`, merging each of those PRs' heads with c06bd7c7e1 and with `main` alone. This PR adds conflicts only to #5609 and to #6539, which is stacked on it, both in the alias map (`Driver.hpp` and `DrawRelocate.cpp`). For the others, each shared file has as many conflicts with this PR as with `main` alone.
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!9396
No description provided.