perf(agc): index the resource cache by a four-lane key hash #6972

Closed
meh7an wants to merge 1 commit from upstream-pr/6972 into main
meh7an commented 2026-10-16 22:57:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by meh7an on 2026-10-16T22:57:15Z.


What

ResourceCache holds the shader resource objects of draws and dispatches. Its keys are about a hundred words: the device, the stages and their bindings' guest descriptors. Every draw and every dispatch looks one up (Find, or Touch on a recipe hit). The cache indexes its LRU list with an std::unordered_map<Key, iterator, KeyHash>:

  • KeyHash is FNV-1a over every word: one multiply per word, each waiting on the one before.
  • KeyHash is noexcept, so libstdc++ keeps no hash code in the nodes. A lookup's bucket walk hashes the key of every node it passes again, to find where its bucket ends.

The index is now a HashSlotMap (Execution/include/HashSlotMap.hpp) keyed by the key's hash:

  • It uses open addressing in a power-of-two table kept at most half full. A lookup masks the hash, scans a compact array of hashes, and compares the one key it finds.
  • The hash is FNV-1a in four lanes over pairs of words, so their multiplies overlap. The lanes are then folded so that the low bits, which pick the slot, depend on all of them. The hash is taken before the mutex.
  • When two keys have the same 64-bit hash, the newer entry replaces the older one, counted as an eviction.
  • An entry keeps its hash for the evictions (the entry bound and the table element budget) and for RemoveImage.
  • Erasing shifts the entries after it back, so the table has no tombstones.
  • hashSlotMapTests (graphics tests) covers:
    • inserts, a repeated insert, and growth to 1003 keys;
    • erases, including the backward shift of an erase whose probe run wraps past the end of the table;
    • key 0, which is stored as 1;
    • clearing.

On the S2 page of Sonic Origins Plus's main menu, the queue worker spent, per frame (APS5 sampler, 15 s):

  • ResourceCache::Find: 0.52 to 0.27. In a profile of an earlier build, 45 of its 70 samples were its own code, mostly the inlined FNV over the key, and 23 the bucket walk.
  • std::_Hashtable::_M_find_before_node, the bucket walk: 0.26 to 0.06. What remains belongs to other hash tables.

That is about 1.5% of the worker's frame (31 samples).

#6492 adds another walk over the cache's entries that reads it->first and it->second. Whichever of the two lands second changes them to it->hash and it->resources.

Tested

Windows 11 (10.0.26300), WinLibs GCC 15.2.0 (UCRT), Release, NVIDIA GeForce RTX 2080 Ti, driver 617.14.

  • On main 7d728b109 with this change, the full ctest suite passes 1337 of 1341 tests.
    • agc_driver_gpu_indirect_arguments_misaligned_writer_ahead is not run: main itself does not compile it with MinGW (alignas(65536)).
    • select_tests fails in its setup on Windows without the symlink privilege (WinError 1314 from symlink_to), as on main.
    • agc_driver_multisample_fill_host_only failed once ("the sentinel fill did not land"). That is main's own race, #6512, which #6522 fixes. With #6522's line added it failed 0 of 200 runs (8 at a time).
    • guest_positioned_close (libkernel and libc only) ended with 0xc0000409 once in the parallel run. Alone it passes 5 of 5.
  • Sonic Origins Plus, main menu, S2 page (the 3D background), 1233x694 window.
    • A sampled pair (APS5 sampler, 15 s) took the profile numbers above. The FPS shown in the title went from 10.56 to 10.84 (median of six readings).
    • Captured with APS5_TRACE_SECONDS=200:15 on the same machine in one session, caches warm. Traces attached.
    • Baseline 245e35555 (#6970), this change 557d4dafb (the summaries name the commits before them, see the note):
Metric Baseline This PR Change
frame_ms.p50 100.704 98.072 -2.6%
frame_ms.p90 106.216 101.147 -4.8%
mean_frame_ms 103.202 98.211 -4.8%
gpu_busy_ms_per_present 83.660 83.570 -0.1%
Driver.Packet (ms per frame) 101.155 96.211 -4.9%
Driver.Draw (ms per frame) 89.173 83.863 -6.0%

This pair overstates the change: its target is about 1.5% of the worker's frame, and windows of this page vary by a few percent at the median. The title FPS during the two captures was 10.82 and 11.12. The sampled pair, 10.56 to 10.84 FPS, is the better estimate.

Note: measuring base. These numbers come from my fork's dev, on main 0a56aaaf4. The resource cache this change indexes is the same on main 7d728b109, which adds the table element budget and RemoveImage to it.

Both carry these commits from my fork:

  • the fixes a71073ce3, c0d875634, e3c68960e, 604f0f373 and 10ff693aa (#5778);
  • make-exe and the stage dumps (522230d62, deee71fde);
  • the crash-report sampler (8d9c3103e..f641e1ec9), which took the profiles;
  • #6037, #6066, #6077, #6067, #6082 (its first version, before #5906), #6095, #6266, #6292, #6312, #6609, #6611, #6615, #6733 and #6970;
  • smaller steps kept in my fork:
    • e83260247, 97b1ff6c9, 84f5bf0ff, ce567bc3d, a79e58a7c, a0a891697, 63f7a8ed0, b04806167, 719fb71dd and a21a3ce81;
    • 3b47f7743 (covered on main by #5062);
    • e3b8d1c52 (which #6566 covers);
    • 390f62471 (a draw decode cache; main reuses decodes through its draw data hits);
    • 40a918442 (the pipeline key outside the store's lock, as #5875 does on main, and the thread's last pipeline);
    • b1909f43b (the vertex phase's lists inline, held until #6661 lands).

The comparison tool marks the window's first present as a configuration difference: the window opens 200 s into each run. Both summaries set trace_dropped, because the worker filled its event buffer at about 2,700 draws per frame. The phase totals above stay complete.

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
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 2080 Ti, driver 617.14, Windows 11
  • AI-assisted: yes

Traces and summary lines (baseline 245e35555, whose summary says b1909f43b4d1; this change 557d4dafb, whose summary says 245e35555cf4):
keyhash-traces.zip

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4895211844 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6972). Originally posted by [meh7an](https://github.com/meh7an) on 2026-10-16T22:57:15Z. --- ### What `ResourceCache` holds the shader resource objects of draws and dispatches. Its keys are about a hundred words: the device, the stages and their bindings' guest descriptors. Every draw and every dispatch looks one up (`Find`, or `Touch` on a recipe hit). The cache indexes its LRU list with an `std::unordered_map<Key, iterator, KeyHash>`: - `KeyHash` is FNV-1a over every word: one multiply per word, each waiting on the one before. - `KeyHash` is `noexcept`, so libstdc++ keeps no hash code in the nodes. A lookup's bucket walk hashes the key of every node it passes again, to find where its bucket ends. The index is now a `HashSlotMap` (`Execution/include/HashSlotMap.hpp`) keyed by the key's hash: - It uses open addressing in a power-of-two table kept at most half full. A lookup masks the hash, scans a compact array of hashes, and compares the one key it finds. - The hash is FNV-1a in four lanes over pairs of words, so their multiplies overlap. The lanes are then folded so that the low bits, which pick the slot, depend on all of them. The hash is taken before the mutex. - When two keys have the same 64-bit hash, the newer entry replaces the older one, counted as an eviction. - An entry keeps its hash for the evictions (the entry bound and the table element budget) and for `RemoveImage`. - Erasing shifts the entries after it back, so the table has no tombstones. - `hashSlotMapTests` (graphics tests) covers: - inserts, a repeated insert, and growth to 1003 keys; - erases, including the backward shift of an erase whose probe run wraps past the end of the table; - key 0, which is stored as 1; - clearing. On the S2 page of Sonic Origins Plus's main menu, the queue worker spent, per frame (APS5 sampler, 15 s): - `ResourceCache::Find`: 0.52 to 0.27. In a profile of an earlier build, 45 of its 70 samples were its own code, mostly the inlined FNV over the key, and 23 the bucket walk. - `std::_Hashtable::_M_find_before_node`, the bucket walk: 0.26 to 0.06. What remains belongs to other hash tables. That is about 1.5% of the worker's frame (31 samples). #6492 adds another walk over the cache's entries that reads `it->first` and `it->second`. Whichever of the two lands second changes them to `it->hash` and `it->resources`. ### Tested Windows 11 (10.0.26300), WinLibs GCC 15.2.0 (UCRT), Release, NVIDIA GeForce RTX 2080 Ti, driver 617.14. - On main 7d728b109 with this change, the full ctest suite passes 1337 of 1341 tests. - `agc_driver_gpu_indirect_arguments_misaligned_writer_ahead` is not run: main itself does not compile it with MinGW (`alignas(65536)`). - `select_tests` fails in its setup on Windows without the symlink privilege (`WinError 1314` from `symlink_to`), as on main. - `agc_driver_multisample_fill_host_only` failed once ("the sentinel fill did not land"). That is main's own race, #6512, which #6522 fixes. With #6522's line added it failed 0 of 200 runs (8 at a time). - `guest_positioned_close` (libkernel and libc only) ended with 0xc0000409 once in the parallel run. Alone it passes 5 of 5. - Sonic Origins Plus, main menu, S2 page (the 3D background), 1233x694 window. - A sampled pair (APS5 sampler, 15 s) took the profile numbers above. The FPS shown in the title went from 10.56 to 10.84 (median of six readings). - Captured with `APS5_TRACE_SECONDS=200:15` on the same machine in one session, caches warm. Traces attached. - Baseline 245e35555 (#6970), this change 557d4dafb (the summaries name the commits before them, see the note): | Metric | Baseline | This PR | Change | | --- | ---: | ---: | ---: | | frame_ms.p50 | 100.704 | 98.072 | -2.6% | | frame_ms.p90 | 106.216 | 101.147 | -4.8% | | mean_frame_ms | 103.202 | 98.211 | -4.8% | | gpu_busy_ms_per_present | 83.660 | 83.570 | -0.1% | | Driver.Packet (ms per frame) | 101.155 | 96.211 | -4.9% | | Driver.Draw (ms per frame) | 89.173 | 83.863 | -6.0% | This pair overstates the change: its target is about 1.5% of the worker's frame, and windows of this page vary by a few percent at the median. The title FPS during the two captures was 10.82 and 11.12. The sampled pair, 10.56 to 10.84 FPS, is the better estimate. > **Note: measuring base.** These numbers come from my fork's dev, on main 0a56aaaf4. The resource cache this change indexes is the same on main 7d728b109, which adds the table element budget and `RemoveImage` to it. > - The baseline is [measure/flags-2026-10-17](https://github.com/meh7an/AnyPS5/commits/measure/flags-2026-10-17) (245e35555, #6970). > - This change is [measure/keyhash-2026-10-17](https://github.com/meh7an/AnyPS5/commits/measure/keyhash-2026-10-17) (557d4dafb). > - Each build was made before its commit, so the summaries name the commit before it, `dirty`: b1909f43b for the baseline and 245e35555 for this change. > > Both carry these commits from my fork: > - the fixes a71073ce3, c0d875634, e3c68960e, 604f0f373 and 10ff693aa (#5778); > - make-exe and the stage dumps (522230d62, deee71fde); > - the crash-report sampler (8d9c3103e..f641e1ec9), which took the profiles; > - #6037, #6066, #6077, #6067, #6082 (its first version, before #5906), #6095, #6266, #6292, #6312, #6609, #6611, #6615, #6733 and #6970; > - smaller steps kept in my fork: > - e83260247, 97b1ff6c9, 84f5bf0ff, ce567bc3d, a79e58a7c, a0a891697, 63f7a8ed0, b04806167, 719fb71dd and a21a3ce81; > - 3b47f7743 (covered on main by #5062); > - e3b8d1c52 (which #6566 covers); > - 390f62471 (a draw decode cache; main reuses decodes through its draw data hits); > - 40a918442 (the pipeline key outside the store's lock, as #5875 does on main, and the thread's last pipeline); > - b1909f43b (the vertex phase's lists inline, held until #6661 lands). > > The comparison tool marks the window's first present as a configuration difference: the window opens 200 s into each run. Both summaries set `trace_dropped`, because the worker filled its event buffer at about 2,700 draws per frame. The phase totals above stay complete. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical 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] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 2080 Ti, driver 617.14, Windows 11 - [x] AI-assisted: yes Traces and summary lines (baseline 245e35555, whose summary says b1909f43b4d1; this change 557d4dafb, whose summary says 245e35555cf4): [keyhash-traces.zip](https://github.com/user-attachments/files/33582253/keyhash-traces.zip)
github-actions[bot] commented 2026-10-16 23:09:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T23:09:45Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1395 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5441 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5499 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5500 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5925 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6146 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6177 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6192 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6194 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6202 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6223 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6235 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6280 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6412 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6481 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6498 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6548 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6636 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6683 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6946 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6947 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7002 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7085 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7154 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7256 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7484 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7668 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7689 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7800 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7948 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8047 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6226390534 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6972#issuecomment-6226390534). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T23:09:45Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 1395](https://www.github.com/boykopovar/AnyPS5/pull/1395) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 4040](https://www.github.com/boykopovar/AnyPS5/pull/4040) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5441](https://www.github.com/boykopovar/AnyPS5/pull/5441) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5499](https://www.github.com/boykopovar/AnyPS5/pull/5499) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5500](https://www.github.com/boykopovar/AnyPS5/pull/5500) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6146](https://www.github.com/boykopovar/AnyPS5/pull/6146) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6177](https://www.github.com/boykopovar/AnyPS5/pull/6177) | `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6192](https://www.github.com/boykopovar/AnyPS5/pull/6192) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 6194](https://www.github.com/boykopovar/AnyPS5/pull/6194) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6202](https://www.github.com/boykopovar/AnyPS5/pull/6202) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 6223](https://www.github.com/boykopovar/AnyPS5/pull/6223) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 6235](https://www.github.com/boykopovar/AnyPS5/pull/6235) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6280](https://www.github.com/boykopovar/AnyPS5/pull/6280) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6412](https://www.github.com/boykopovar/AnyPS5/pull/6412) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 6481](https://www.github.com/boykopovar/AnyPS5/pull/6481) | `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6498](https://www.github.com/boykopovar/AnyPS5/pull/6498) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 6548](https://www.github.com/boykopovar/AnyPS5/pull/6548) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6636](https://www.github.com/boykopovar/AnyPS5/pull/6636) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6683](https://www.github.com/boykopovar/AnyPS5/pull/6683) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6808](https://www.github.com/boykopovar/AnyPS5/pull/6808) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6946](https://www.github.com/boykopovar/AnyPS5/pull/6946) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 6947](https://www.github.com/boykopovar/AnyPS5/pull/6947) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 7002](https://www.github.com/boykopovar/AnyPS5/pull/7002) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 7085](https://www.github.com/boykopovar/AnyPS5/pull/7085) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 7154](https://www.github.com/boykopovar/AnyPS5/pull/7154) | `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 7256](https://www.github.com/boykopovar/AnyPS5/pull/7256) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 7484](https://www.github.com/boykopovar/AnyPS5/pull/7484) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 7642](https://www.github.com/boykopovar/AnyPS5/pull/7642) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 7668](https://www.github.com/boykopovar/AnyPS5/pull/7668) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 7689](https://www.github.com/boykopovar/AnyPS5/pull/7689) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 7800](https://www.github.com/boykopovar/AnyPS5/pull/7800) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 7948](https://www.github.com/boykopovar/AnyPS5/pull/7948) | `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 8047](https://www.github.com/boykopovar/AnyPS5/pull/8047) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` |
keravyn-ops commented 2026-10-17 09:59:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by keravyn-ops on 2026-10-17T09:59:26Z.


AMD / Windows run of this PR at 5b3c1ea31: Radeon 780M (RDNA 3, 0x15bf), AMD driver 25.10.20.01 (32.0.21020.1007), Windows 11 Home 10.0.26100, WinLibs GCC 15.2.0 r7, Release.

Every ctest entry built from the test targets this PR changes passes (14):

  • agc_driver_undithered_alpha_to_coverage_state (0.11 s): 289: Existing undithered alpha-to-coverage states passed
  • agc_driver_alpha_to_coverage_state (0.02 s): 290: Alpha-to-coverage state and refusal tests passed
  • agc_driver_prepared_graphics_prebuild_unset (0.16 s): 292: prebuild policy native readback passed
  • agc_driver_prepared_graphics_prebuild_0 (0.13 s): 293: prebuild policy native readback passed
  • agc_driver_prepared_graphics_prebuild_1 (0.13 s): 294: prebuild policy native readback passed
  • agc_driver_graphics (4.93 s): 327: Graphics validation tests passed
  • agc_driver_prepared_graphics (0.13 s): 588: prepared graphics ABI tests passed
  • agc_driver_prepared_unregistered_graphics (0.15 s): 591: prepared unregistered graphics tests passed
  • agc_sparse_buffer_holes (0.04 s): 708: sparse buffer hole tests passed
  • agc_pipeline_journal (0.07 s): 712: pipeline journal recipe, record and replay tests passed
  • agc_descriptor_pool_reset_failure (0.02 s)
  • agc_driver_address_space_teardown (0.02 s): 767: address-space device teardown releases cached guest allocations
  • agc_compute_descriptor_layout_flags (0.02 s): 798: Descriptor layout native and captured binding flags passed
  • agc_driver_covered_centroid_state (0.02 s): 799: Covered-centroid and multisample state checks passed

AI-assisted: yes (runs made on the device above).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6232561692 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6972#issuecomment-6232561692). Originally posted by [keravyn-ops](https://github.com/keravyn-ops) on 2026-10-17T09:59:26Z. --- AMD / Windows run of this PR at 5b3c1ea31: Radeon 780M (RDNA 3, 0x15bf), AMD driver 25.10.20.01 (32.0.21020.1007), Windows 11 Home 10.0.26100, WinLibs GCC 15.2.0 r7, Release. Every ctest entry built from the test targets this PR changes passes (14): - `agc_driver_undithered_alpha_to_coverage_state` (0.11 s): `289: Existing undithered alpha-to-coverage states passed` - `agc_driver_alpha_to_coverage_state` (0.02 s): `290: Alpha-to-coverage state and refusal tests passed` - `agc_driver_prepared_graphics_prebuild_unset` (0.16 s): `292: prebuild policy native readback passed` - `agc_driver_prepared_graphics_prebuild_0` (0.13 s): `293: prebuild policy native readback passed` - `agc_driver_prepared_graphics_prebuild_1` (0.13 s): `294: prebuild policy native readback passed` - `agc_driver_graphics` (4.93 s): `327: Graphics validation tests passed` - `agc_driver_prepared_graphics` (0.13 s): `588: prepared graphics ABI tests passed` - `agc_driver_prepared_unregistered_graphics` (0.15 s): `591: prepared unregistered graphics tests passed` - `agc_sparse_buffer_holes` (0.04 s): `708: sparse buffer hole tests passed` - `agc_pipeline_journal` (0.07 s): `712: pipeline journal recipe, record and replay tests passed` - `agc_descriptor_pool_reset_failure` (0.02 s) - `agc_driver_address_space_teardown` (0.02 s): `767: address-space device teardown releases cached guest allocations` - `agc_compute_descriptor_layout_flags` (0.02 s): `798: Descriptor layout native and captured binding flags passed` - `agc_driver_covered_centroid_state` (0.02 s): `799: Covered-centroid and multisample state checks passed` AI-assisted: yes (runs made on the device above).
adriadam10 commented 2026-10-19 12:40:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T12:40:14Z.

Review: CHANGES_REQUESTED


Thanks, the HashSlotMap itself reads correctly (growth, backward-shift erase including the wrapped run, key 0, and the test pins them). It now conflicts with main, and not mechanically:

  • ResourceCache on main has adaptive capacity (capacity, fixedCapacity, baseEntries, shrink window) and new helpers noteEvicted(key), noteReturn(key), noteUse(key), dropReleasedTextures(evicted). Find, Insert and Touch call them, and Insert no longer uses the static capacity lambda your diff edits (ShaderResources.cpp around the Insert hunk).
  • noteEvicted/noteUse still take a Key and use KeyHash{}(key) for their own tables, so KeyHash cannot simply be removed. Decide whether they take the new hashKey value (then evictedKeys/usedKeys are keyed by it) or keep the old hash.
  • ResourceCache has other places that read entries as pairs (->first/->second) on main; they need the Entry struct too.

Please rebase on current main and re-measure: noteUse adds work per Find/Touch, so the ~1.5% of the worker's frame may differ. Keep the trace-vs-sampler caveat in the body.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5571661718 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6972#pullrequestreview-5571661718). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T12:40:14Z. **Review:** CHANGES_REQUESTED --- Thanks, the `HashSlotMap` itself reads correctly (growth, backward-shift erase including the wrapped run, key 0, and the test pins them). It now conflicts with `main`, and not mechanically: - `ResourceCache` on `main` has adaptive capacity (`capacity`, `fixedCapacity`, `baseEntries`, shrink window) and new helpers `noteEvicted(key)`, `noteReturn(key)`, `noteUse(key)`, `dropReleasedTextures(evicted)`. `Find`, `Insert` and `Touch` call them, and `Insert` no longer uses the static `capacity` lambda your diff edits (`ShaderResources.cpp` around the `Insert` hunk). - `noteEvicted`/`noteUse` still take a `Key` and use `KeyHash{}(key)` for their own tables, so `KeyHash` cannot simply be removed. Decide whether they take the new `hashKey` value (then `evictedKeys`/`usedKeys` are keyed by it) or keep the old hash. - `ResourceCache` has other places that read `entries` as pairs (`->first`/`->second`) on `main`; they need the `Entry` struct too. Please rebase on current `main` and re-measure: `noteUse` adds work per `Find`/`Touch`, so the ~1.5% of the worker's frame may differ. Keep the trace-vs-sampler caveat in the body.
github-actions[bot] commented 2026-10-20 13:39:28 +00:00 (Migrated from github.com)

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


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:6292210381 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6972#issuecomment-6292210381). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T13:39:28Z. --- <!-- 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`.
meh7an commented 2026-10-20 14:44:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by meh7an on 2026-10-20T14:44:14Z.


Closing this: on current main it shows no gain.

  • Rebased onto main 1d4164552 (ae33fb54f).
    • Main's adaptive-capacity helpers take the four-lane hash now, so KeyHash and its pass over the key on every Find and Touch are gone.
    • The full suite passes 1738 of 1741. The three that don't also fail on plain main: agc_driver_pipelined_dispatch_item failed 1 of 40 runs under load on both.
  • Re-measured on the Sonic Origins Plus S2 page, with three interleaved runs per side on main 1d4164552:
    • frame p50: main 86.25 / 86.83 / 91.13 ms, this change 85.73 / 87.07 / 104.35 ms (median +0.3%);
    • title FPS: main 11.91 / 12.22 / 12.41, this change 11.70 / 11.80 / 12.33.

That isn't worth a new map in the cache. Thanks @adriadam10 for the review and @keravyn-ops for the AMD run.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6293576487 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6972#issuecomment-6293576487). Originally posted by [meh7an](https://github.com/meh7an) on 2026-10-20T14:44:14Z. --- Closing this: on current main it shows no gain. - Rebased onto main 1d4164552 (ae33fb54f). - Main's adaptive-capacity helpers take the four-lane hash now, so `KeyHash` and its pass over the key on every `Find` and `Touch` are gone. - The full suite passes 1738 of 1741. The three that don't also fail on plain main: `agc_driver_pipelined_dispatch_item` failed 1 of 40 runs under load on both. - Re-measured on the Sonic Origins Plus S2 page, with three interleaved runs per side on main 1d4164552: - frame p50: main 86.25 / 86.83 / 91.13 ms, this change 85.73 / 87.07 / 104.35 ms (median +0.3%); - title FPS: main 11.91 / 12.22 / 12.41, this change 11.70 / 11.80 / 12.33. That isn't worth a new map in the cache. Thanks @adriadam10 for the review and @keravyn-ops for the AMD run.

Pull request closed

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!6972
No description provided.