perf(agc): find cached draws across moved user-data pointers #4943

Merged
TheAggie merged 6 commits from upstream-pr/4943 into main 2026-10-16 10:13:51 +00:00
TheAggie commented 2026-10-13 05:49:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-13T05:49:30Z.


What

Addresses #4054: a guest driver that puts per-draw pointers in the user data (RADV does, for its descriptor sets and push constants) misses the draw cache on almost every draw, because the register key and the entry's memory runs both contain the pointer values.

  • The recompiler's SRT evaluator records, for each raw read, the user-data word its address is based on, and marks a word that is also used as a plain value. The result names the user-data word behind each shader-data dword.
  • The driver learns per shader set which user-data words are only read through. A draw that differs from a cached one only in those words looks up an alias key built from the contents behind the pointers instead of the pointers themselves.
  • On an alias hit the cached variant's runs are shifted by the pointer delta and validated by value, as an ordinary hit is, and the shader-data words that forward a pointer are patched.
  • A word that is used as a value anywhere, a pointer whose delta does not fit the runs, or contents that differ, all fall back to the normal miss path.
  • main now caches a draw the second time its key is seen (#5216). With moving pointers the exact key never repeats, so a repeat of the alias key counts as a second sighting too, and one draw of a shader set that has not been learned yet is admitted so the pointer words can be learned from it. Alias admission is limited: a shader set gets two such admissions on probation, and after that only one whose relocated entries actually hit (validated hits, not donors found) is admitted through its alias. Without this, aliases that come up exactly twice each inserted an entry nobody used (the D2R hit drop in the review).
  • A title whose draws never match this way should not pay for the lookup: the alias key is built only when the exact key misses, and a shader set whose alias lookups hit less than 1 time in 16 over 1,024 tries is left alone for its next 16,384 draws before it is tried again. A shader set that does hit builds the alias with the key, as one pass.
  • The contents behind a pointer are hashed whole, 64 words at a time. When the alias map reaches its limit every other entry is dropped, not all of them, and the [draw-relocate] line counts the dropped ones.
  • The shader disk cache carries the new shaderDataUserWords field of a result, and its Linux-only size asserts expect the grown structs.
  • The alias key is built on main's incremental register fingerprint: RegisterStateKey gets an optional shapeKey out-parameter, and the user words are walked by one shared helper.

APS5_NO_DRAW_RELOCATION=1 turns it off.

Related: #494 (draft) reuses a shape's decode and stages when only user data differs; this PR covers the case where the user data are pointers and the data behind them is unchanged or moved. They touch the same lookup and would need a rebase against each other.

This is the first part. Later steps I have locally and would send separately, each with its own numbers: relocating stages independently, reusing a stage when only buffer base addresses moved, and reusing draw snapshots.

Tested

Windows 11, NVIDIA GeForce RTX 5070 Ti, MinGW-w64 GCC 15.2.0, rebased on main 940eba9a2.

  • ctest: 1269 of 1291 pass, 14 skipped. guest_call_trace_abort, windows_backtrace_report and agc_driver_store_over_untracked fail, and fail the same way on plain main here. Three newer tests, agc_driver_prepared_graphics_prebuild_0/_1 and undeliverable_host_exception, fail under my test runner because it skips their environment changes and pass pattern; run with those, all three pass.
  • The size asserts in ShaderDiskCache.cpp only compile on Linux. I have no Linux build; I compiled the structs under MinGW libstdc++ on x86_64, where all 31 asserted sizes match, including the ones this PR does not touch. agc_shader_disk_cache's result round trip now sets shaderDataUserWords and compares it after decoding; it fails if the decoder drops them.
  • New test agc_driver_draw_cache_relocation: a pixel shader loads its colour through a user-data pointer. The same contents drawn from eight addresses hit the cached draw from the fifth draw on (two draws teach the shader set, two more are the first and second sighting of the contents); other contents do not hit; an address seen before still hits. It fails with APS5_NO_DRAW_RELOCATION=1. A second case draws 12 aliases that each come up exactly twice, between draws of a repeated one: at most 2 of them are cached and the repeated draw keeps all its hits (with the old admission rule all 12 were cached; the case fails on it).
  • RetroArch (PPSA99169) with its Flycast core running Crazy Taxi's attract demo, measured before the rebase, on main 4430780bd (without #5216) plus local changes outside this PR that the frontend needs to boot. Same build, relocation off against on, two unprofiled runs each: audio produced at 26.9% and 27.0% of real time against 38.5% and 39.1%.
  • On main a14ae8e23 plus the same local changes) the same demo does not get faster with this PR alone: audio at 5.4% and 5.5% against 5.8% without it, unprofiled. About 40% of draws hit, but each draw on this base copies a 2 MiB guest buffer into a snapshot whether it hits or not, and that copy dominates. #5609 on top reaches 36%; see the numbers there.
  • On main 940eba9a2, the same demo with this PR and #5609 on top against the same build without them (both with the same local changes the frontend needs to boot, immediate present, audio muted, three alternating unprofiled runs): audio produced at 34.5%, 35.7% and 35.6% of real time without, against 45.7%, 44.1% and 42.8% with.
  • Old base, one profiled run each: queue worker 71.2 µs against 48.4 µs per draw packet; stage captures per 10 s 200,444 against 71,430; 72,924 of 100,001 alias lookups hit.
  • Same demo with APS5_VERIFY_DRAW_ENTRIES=1, which captures every hit again and compares: 0 stages differed in every report (88,797 hits in the largest).

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 in TechnicalDebt
  • 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 (#5609 builds on this PR and lands after it)
  • AI-assisted: yes. Written with Claude Code under my direction.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4838971596 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943). Originally posted by [TheAggie](https://github.com/TheAggie) on 2026-10-13T05:49:30Z. --- ### What Addresses #4054: a guest driver that puts per-draw pointers in the user data (RADV does, for its descriptor sets and push constants) misses the draw cache on almost every draw, because the register key and the entry's memory runs both contain the pointer values. - The recompiler's SRT evaluator records, for each raw read, the user-data word its address is based on, and marks a word that is also used as a plain value. The result names the user-data word behind each shader-data dword. - The driver learns per shader set which user-data words are only read through. A draw that differs from a cached one only in those words looks up an alias key built from the contents behind the pointers instead of the pointers themselves. - On an alias hit the cached variant's runs are shifted by the pointer delta and validated by value, as an ordinary hit is, and the shader-data words that forward a pointer are patched. - A word that is used as a value anywhere, a pointer whose delta does not fit the runs, or contents that differ, all fall back to the normal miss path. - `main` now caches a draw the second time its key is seen (#5216). With moving pointers the exact key never repeats, so a repeat of the alias key counts as a second sighting too, and one draw of a shader set that has not been learned yet is admitted so the pointer words can be learned from it. Alias admission is limited: a shader set gets two such admissions on probation, and after that only one whose relocated entries actually hit (validated hits, not donors found) is admitted through its alias. Without this, aliases that come up exactly twice each inserted an entry nobody used (the D2R hit drop in the review). - A title whose draws never match this way should not pay for the lookup: the alias key is built only when the exact key misses, and a shader set whose alias lookups hit less than 1 time in 16 over 1,024 tries is left alone for its next 16,384 draws before it is tried again. A shader set that does hit builds the alias with the key, as one pass. - The contents behind a pointer are hashed whole, 64 words at a time. When the alias map reaches its limit every other entry is dropped, not all of them, and the `[draw-relocate]` line counts the dropped ones. - The shader disk cache carries the new `shaderDataUserWords` field of a result, and its Linux-only size asserts expect the grown structs. - The alias key is built on `main`'s incremental register fingerprint: `RegisterStateKey` gets an optional `shapeKey` out-parameter, and the user words are walked by one shared helper. `APS5_NO_DRAW_RELOCATION=1` turns it off. Related: #494 (draft) reuses a shape's decode and stages when only user data differs; this PR covers the case where the user data are pointers and the data behind them is unchanged or moved. They touch the same lookup and would need a rebase against each other. This is the first part. Later steps I have locally and would send separately, each with its own numbers: relocating stages independently, reusing a stage when only buffer base addresses moved, and reusing draw snapshots. ### Tested Windows 11, NVIDIA GeForce RTX 5070 Ti, MinGW-w64 GCC 15.2.0, rebased on main `940eba9a2`. - `ctest`: 1269 of 1291 pass, 14 skipped. `guest_call_trace_abort`, `windows_backtrace_report` and `agc_driver_store_over_untracked` fail, and fail the same way on plain main here. Three newer tests, `agc_driver_prepared_graphics_prebuild_0`/`_1` and `undeliverable_host_exception`, fail under my test runner because it skips their environment changes and pass pattern; run with those, all three pass. - The size asserts in `ShaderDiskCache.cpp` only compile on Linux. I have no Linux build; I compiled the structs under MinGW libstdc++ on x86_64, where all 31 asserted sizes match, including the ones this PR does not touch. `agc_shader_disk_cache`'s result round trip now sets `shaderDataUserWords` and compares it after decoding; it fails if the decoder drops them. - New test `agc_driver_draw_cache_relocation`: a pixel shader loads its colour through a user-data pointer. The same contents drawn from eight addresses hit the cached draw from the fifth draw on (two draws teach the shader set, two more are the first and second sighting of the contents); other contents do not hit; an address seen before still hits. It fails with `APS5_NO_DRAW_RELOCATION=1`. A second case draws 12 aliases that each come up exactly twice, between draws of a repeated one: at most 2 of them are cached and the repeated draw keeps all its hits (with the old admission rule all 12 were cached; the case fails on it). - RetroArch (PPSA99169) with its Flycast core running Crazy Taxi's attract demo, measured before the rebase, on main `4430780bd` (without #5216) plus local changes outside this PR that the frontend needs to boot. Same build, relocation off against on, two unprofiled runs each: audio produced at 26.9% and 27.0% of real time against 38.5% and 39.1%. - On `main` `a14ae8e23` plus the same local changes) the same demo does not get faster with this PR alone: audio at 5.4% and 5.5% against 5.8% without it, unprofiled. About 40% of draws hit, but each draw on this base copies a 2 MiB guest buffer into a snapshot whether it hits or not, and that copy dominates. #5609 on top reaches 36%; see the numbers there. - On `main` `940eba9a2`, the same demo with this PR and #5609 on top against the same build without them (both with the same local changes the frontend needs to boot, immediate present, audio muted, three alternating unprofiled runs): audio produced at 34.5%, 35.7% and 35.6% of real time without, against 45.7%, 44.1% and 42.8% with. - Old base, one profiled run each: queue worker 71.2 µs against 48.4 µs per draw packet; stage captures per 10 s 200,444 against 71,430; 72,924 of 100,001 alias lookups hit. - Same demo with `APS5_VERIFY_DRAW_ENTRIES=1`, which captures every hit again and compares: 0 stages differed in every report (88,797 hits in the largest). ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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 (#5609 builds on this PR and lands after it) - [x] AI-assisted: yes. Written with Claude Code under my direction. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
xXPBSXx commented 2026-10-13 08:40:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T08:40:01Z.


Windows test (MinGW GCC 15.2, Release, Windows 10, RTX 4080 SUPER). Built on main 534451426 together with six other open GPU PRs (their own commits applied, no merge conflicts), so only the tests that belong to this PR say something about it:

  • tests/execution/DrawCacheRelocation.cpp, which ctest runs as agc_driver_draw_cache_relocation: 3 of 3 runs passed.

Not tested: no game run. The batch was built once, not per PR; nothing failed, so no bisect was needed.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6141701081 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6141701081). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-13T08:40:01Z. --- Windows test (MinGW GCC 15.2, Release, Windows 10, RTX 4080 SUPER). Built on main `534451426` together with six other open GPU PRs (their own commits applied, no merge conflicts), so only the tests that belong to this PR say something about it: - `tests/execution/DrawCacheRelocation.cpp`, which `ctest` runs as `agc_driver_draw_cache_relocation`: 3 of 3 runs passed. Not tested: no game run. The batch was built once, not per PR; nothing failed, so no bisect was needed. AI-assisted (Claude Code).
TideOPL commented 2026-10-13 10:14:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TideOPL on 2026-10-13T10:14:59Z.


Tested on Minecraft Dungeons II (PPSA16064) gameplay: Windows 11, RTX 5070, cherry-picked onto our MCD2 build (main + the import-join PRs). No change for this title; data in case it helps the later steps:

  • Draw cache: about 38,000 lookups per 10 s, about 37,800 with no entry and about 170 hits, with and without this PR.
  • [draw-relocate] (report threshold lowered locally): 8,238 alias lookups over the whole run, 1 donor with moved user words, 0 refusals, 0 hits; 263 shader sets learned.
  • A local diagnostic that hashes the draw registers without the user-data words finds about 3,970 distinct shapes over 200,000 draws, and no repeat of a shape has equal user data. The words that change are mostly pointer pairs (low dwords like c9ccc9a0 -> caf3c9a0, same low 16 bits: a per-frame ring) in PS u24/u26 and VS u28/u24/u12, plus a few small values (PS u22: 0x280 -> 0x610).

So the data behind the pointers likely differs per draw (per-draw constants), which this first step does not cover. "Reusing a stage when only buffer base addresses moved" sounds like what this title needs; happy to test it.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6143313159 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6143313159). Originally posted by [TideOPL](https://github.com/TideOPL) on 2026-10-13T10:14:59Z. --- Tested on Minecraft Dungeons II (PPSA16064) gameplay: Windows 11, RTX 5070, cherry-picked onto our MCD2 build (`main` + the import-join PRs). No change for this title; data in case it helps the later steps: - Draw cache: about 38,000 lookups per 10 s, about 37,800 with no entry and about 170 hits, with and without this PR. - `[draw-relocate]` (report threshold lowered locally): 8,238 alias lookups over the whole run, 1 donor with moved user words, 0 refusals, 0 hits; 263 shader sets learned. - A local diagnostic that hashes the draw registers without the user-data words finds about 3,970 distinct shapes over 200,000 draws, and no repeat of a shape has equal user data. The words that change are mostly pointer pairs (low dwords like `c9ccc9a0` -> `caf3c9a0`, same low 16 bits: a per-frame ring) in PS u24/u26 and VS u28/u24/u12, plus a few small values (PS u22: `0x280` -> `0x610`). So the data behind the pointers likely differs per draw (per-draw constants), which this first step does not cover. "Reusing a stage when only buffer base addresses moved" sounds like what this title needs; happy to test it. AI-assisted (Claude Code).
LeandroLP23 commented 2026-10-13 12:54:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-13T12:54:29Z.


No measurable change on AMD in two light 2D catalog titles, the same result as @TideOPL's Minecraft Dungeons II run.

Setup: Windows 11 (26300), Radeon 860M (RDNA 3.5, AMD proprietary driver 24.30.58.08), WinLibs GCC 15.2.0, Release, 1920x1080. Base is main 5d50886ee + #5081, which these titles need so their UI renders at all. Each PR head was merged onto that base, with a clean merge. Catalog releases relinked with --windows, one warm-up run per build, then APS5_TRACE_SECONDS=20:10 with no other APS5_* switch. Three runs per build, interleaved (base, #4878, #4943, base, ...) so that laptop thermal drift hits every build alike. Median frame_ms.p50, with the per-run range:

Scene base + #4878 + #4943
Jelly5 (PPSA99505), server connection screen 65.4 ms (63.3-65.5) 64.9 ms (63.6-66.1, 2 traces; the third run's window didn't close before exit) 65.5 ms (60.9-66.1)
EVO Player (PPSA99039), home screen 72.5 ms (66.9-77.6) 76.5 ms (75.5-77.2) 77.2 ms (76.3-77.7)

In every build the queue worker is busy only 35-37 % of the window, and gpu_busy_ms_per_present is 2.9-8.1 ms. Driver.Packet.execute is 16-17 ms per frame in all three. These EVO-engine titles are bound by their own CPU side: each frame they wait on a fence with usleep(1000) and fill the 8 MB scanout from the CPU. So neither PR has much to remove here, and the EVO Player difference is inside the base's own spread. I'm posting it as a no-change data point on AMD; it isn't a regression claim. Summary lines and traces are available if you want them attached.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6146011847 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6146011847). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-13T12:54:29Z. --- No measurable change on AMD in two light 2D catalog titles, the same result as @TideOPL's Minecraft Dungeons II run. Setup: Windows 11 (26300), Radeon 860M (RDNA 3.5, AMD proprietary driver 24.30.58.08), WinLibs GCC 15.2.0, Release, 1920x1080. Base is `main` `5d50886ee` + #5081, which these titles need so their UI renders at all. Each PR head was merged onto that base, with a clean merge. Catalog releases relinked with `--windows`, one warm-up run per build, then `APS5_TRACE_SECONDS=20:10` with no other `APS5_*` switch. Three runs per build, interleaved (base, #4878, #4943, base, ...) so that laptop thermal drift hits every build alike. Median `frame_ms.p50`, with the per-run range: | Scene | base | + #4878 | + #4943 | |---|---|---|---| | Jelly5 (PPSA99505), server connection screen | 65.4 ms (63.3-65.5) | 64.9 ms (63.6-66.1, 2 traces; the third run's window didn't close before exit) | 65.5 ms (60.9-66.1) | | EVO Player (PPSA99039), home screen | 72.5 ms (66.9-77.6) | 76.5 ms (75.5-77.2) | 77.2 ms (76.3-77.7) | In every build the queue worker is busy only 35-37 % of the window, and `gpu_busy_ms_per_present` is 2.9-8.1 ms. `Driver.Packet.execute` is 16-17 ms per frame in all three. These EVO-engine titles are bound by their own CPU side: each frame they wait on a fence with `usleep(1000)` and fill the 8 MB scanout from the CPU. So neither PR has much to remove here, and the EVO Player difference is inside the base's own spread. I'm posting it as a no-change data point on AMD; it isn't a regression claim. Summary lines and traces are available if you want them attached.
JAB-dev commented 2026-10-13 23:47:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JAB-dev on 2026-10-13T23:47:23Z.


Besiege (PPSA20313), this branch (df467c2b1) against its merge base 2a55cfe1e, Windows 11, RTX 4070 SUPER, 1080p, three runs each (the base lost one capture):

  • base: 16.8, 16.6 FPS; this branch: 15.9, 16.2, 16.2 FPS (about 3-5% lower)

The relocation does not take effect on this title. Over 10 s the draw cache sees about 75,000 lookups with 74,000 "no entry" and 927 hits, and your counters read [draw-relocate] 123013 alias lookups: 2 donors with moved user words, 0 refusals, 3 hits through a relocated entry; 59 shader sets learned, 12202 aliases held. So the keys that differ in Besiege are not the ones your alias path joins.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6157606334 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6157606334). Originally posted by [JAB-dev](https://github.com/JAB-dev) on 2026-10-13T23:47:23Z. --- Besiege (PPSA20313), this branch (`df467c2b1`) against its merge base `2a55cfe1e`, Windows 11, RTX 4070 SUPER, 1080p, three runs each (the base lost one capture): - base: 16.8, 16.6 FPS; this branch: 15.9, 16.2, 16.2 FPS (about 3-5% lower) The relocation does not take effect on this title. Over 10 s the draw cache sees about 75,000 lookups with 74,000 "no entry" and 927 hits, and your counters read `[draw-relocate] 123013 alias lookups: 2 donors with moved user words, 0 refusals, 3 hits through a relocated entry; 59 shader sets learned, 12202 aliases held`. So the keys that differ in Besiege are not the ones your alias path joins.
JAB-dev commented 2026-10-14 00:16:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JAB-dev on 2026-10-14T00:16:21Z.


Data for why the relocation does not fire on Besiege (PPSA20313, main at a0f5916a2 plus #5364, local build that prints the old and new user-data words for the draws whose only changed key group is the user-data registers):

In steady state 70% of the misses are exactly that case, and in the first 40 sampled draws a single word changes in 39 of them (the 40th printed no changed word): the second stage's user word 8 (register 0x94, index 8 of the 0x8c group). It goes up by exactly +176 each time (1dacb3e0 -> 1dacb490 -> 1dacb540 -> ..., 39 of 39), with a jump now and then where draws in between were cache hits. No other user word differs. So the title walks a ring of 176-byte per-draw constant slots, and the draws are otherwise identical (same shaders, same registers).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6157966688 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6157966688). Originally posted by [JAB-dev](https://github.com/JAB-dev) on 2026-10-14T00:16:21Z. --- Data for why the relocation does not fire on Besiege (PPSA20313, `main` at a0f5916a2 plus #5364, local build that prints the old and new user-data words for the draws whose only changed key group is the user-data registers): In steady state 70% of the misses are exactly that case, and in the first 40 sampled draws a single word changes in 39 of them (the 40th printed no changed word): the second stage's user word 8 (register 0x94, index 8 of the 0x8c group). It goes up by exactly +176 each time (`1dacb3e0 -> 1dacb490 -> 1dacb540 -> ...`, 39 of 39), with a jump now and then where draws in between were cache hits. No other user word differs. So the title walks a ring of 176-byte per-draw constant slots, and the draws are otherwise identical (same shaders, same registers).
TheAggie commented 2026-10-14 02:06:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-14T02:06:42Z.


Thanks for the three data points. I've rebased the branch onto current main and force-pushed; what changed:

@JAB-dev that 3-5% on Besiege was the alias lookup running for every draw with nothing to find (your counters show 2 donors in 123,013 lookups). Two changes for that case:

  • The alias key is now built only when the exact key misses, not for every draw.
  • Each shader set is on trial: when fewer than 1 in 16 of its alias lookups hit over 1,024 tries, the relocation is skipped for that shader set's next 16,384 draws, then tried again.

I don't have Besiege, so I can't confirm it closes the gap there. If you can run the new head against the same base, the [draw-relocate] line should show far fewer alias lookups.

Your second comment explains why nothing matches: one user word walking a ring of 176-byte per-draw constant slots, with everything else equal. Whether that can be reused depends on how the shader reaches the slot. If it binds the slot as a buffer, #5609 covers it: only the base address moves and the contents stay out of the match. If it reads the constants through the pointer during the capture, the contents differ every draw and neither PR can match; that case needs the constants refreshed in a cached stage rather than compared, which is closer to what #494 does for user data, and I haven't done it here. A run of #5609's head on Besiege would tell which it is.

The rebase also had to deal with #5216 (a draw is cached the second time its key is seen). With moving pointers the exact key never repeats, so nothing was cached and the relocation had nothing to reuse. A repeat of the alias key now counts as a second sighting too. On the Flycast workload, with the follow-up applied: 59% of real time without the admission, 51% with #5216 as merged, 59% with this change.

@TideOPL your shape analysis is the case the next step is for. A pointer pair that moves through a per-frame ring with different data behind it each draw can't hit here, since this PR only matches when the contents behind the pointers are equal. The follow-up keeps a cached stage when the only words that differ are buffer base addresses the shader binds as buffers, so the per-draw constants stay out of the match. It is up as #5609, stacked on this one.

@LeandroLP23 thanks for the AMD numbers; no change is what I'd expect on titles that don't put pointers in the user data.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159281912 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6159281912). Originally posted by [TheAggie](https://github.com/TheAggie) on 2026-10-14T02:06:42Z. --- Thanks for the three data points. I've rebased the branch onto current `main` and force-pushed; what changed: @JAB-dev that 3-5% on Besiege was the alias lookup running for every draw with nothing to find (your counters show 2 donors in 123,013 lookups). Two changes for that case: - The alias key is now built only when the exact key misses, not for every draw. - Each shader set is on trial: when fewer than 1 in 16 of its alias lookups hit over 1,024 tries, the relocation is skipped for that shader set's next 16,384 draws, then tried again. I don't have Besiege, so I can't confirm it closes the gap there. If you can run the new head against the same base, the `[draw-relocate]` line should show far fewer alias lookups. Your second comment explains why nothing matches: one user word walking a ring of 176-byte per-draw constant slots, with everything else equal. Whether that can be reused depends on how the shader reaches the slot. If it binds the slot as a buffer, #5609 covers it: only the base address moves and the contents stay out of the match. If it reads the constants through the pointer during the capture, the contents differ every draw and neither PR can match; that case needs the constants refreshed in a cached stage rather than compared, which is closer to what #494 does for user data, and I haven't done it here. A run of #5609's head on Besiege would tell which it is. The rebase also had to deal with #5216 (a draw is cached the second time its key is seen). With moving pointers the exact key never repeats, so nothing was cached and the relocation had nothing to reuse. A repeat of the alias key now counts as a second sighting too. On the Flycast workload, with the follow-up applied: 59% of real time without the admission, 51% with #5216 as merged, 59% with this change. @TideOPL your shape analysis is the case the next step is for. A pointer pair that moves through a per-frame ring with different data behind it each draw can't hit here, since this PR only matches when the contents behind the pointers are equal. The follow-up keeps a cached stage when the only words that differ are buffer base addresses the shader binds as buffers, so the per-draw constants stay out of the match. It is up as #5609, stacked on this one. @LeandroLP23 thanks for the AMD numbers; no change is what I'd expect on titles that don't put pointers in the user data. AI-assisted (Claude Code).
Raghav314 commented 2026-10-14 03:44:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-14T03:44:41Z.


I ran this with #5609 on top on my machine (Linux, CachyOS, GCC, RTX 4090, NVIDIA 615.78.08), merged with main a5f493f90, and tried it on Hades II (PPSA36082). Two things, and some numbers.

The Linux build fails. ShaderDiskCache.cpp has layout asserts that only exist on Linux x86-64 with libstdc++, so a Windows build never sees them:

ShaderDiskCache.cpp:82: static assertion failed: RecompileResult changed: update EncodeResult and DecodeResult   (368 == 320)
ShaderDiskCache.cpp:97: static assertion failed: BindingAllocationResult changed: update the allocation encoder   (200 == 152)

shaderDataUserWords (5d8dff973, here) and bufferBaseSlots (54c1f168c, #5609) are what grew them. Nothing is lost on disk, since the cached variant only stores the CompiledBindingLayout and both fields are rebuilt by DescriptorBindingBuilder::Populate on every capture. So it is only the asserts, plus EncodeResult/DecodeResult not carrying the two fields. What I used locally:

static_assert(sizeof(RecompileResult) == 368, ...);
static_assert(sizeof(BindingAllocationResult) == 200, ...);

// EncodeResult, after workgroupMemoryDwords
writer.Values(std::span<const std::uint32_t>(result.shaderDataUserWords));
writer.List(result.bufferBaseSlots, [](Writer& out, const std::array<std::uint32_t, 3>& slot) { out.Values(std::span<const std::uint32_t>(slot)); });

// DecodeResult, after workgroupMemoryDwords
reader.Values(result.shaderDataUserWords);
reader.List(result.bufferBaseSlots, 12, [](Reader& in, std::array<std::uint32_t, 3>& slot) {
    std::vector<std::uint32_t> words;
    in.Values(words);
    if (words.size() != slot.size()) in.Fail();
    else std::copy(words.begin(), words.end(), slot.begin());
});

With that, the full ctest passes except agc_driver_bc_block_copy, which fails the same way on plain main here.

The [draw-relocate] line never printed in Hades. It is only reached from inside if (!userPatches.empty()), once lookups >= 100000, and Hades rarely gets there. I added a local counter line printed with the [draw-cache] report every 10 s to see what happens.

Hades II, hub, standing still (APS5_PROFILE_DRAW=1, per 10 s):

  • APS5_VERIFY_DRAW_ENTRIES=1 APS5_VERIFY_REGISTER_KEYS=1 APS5_VERIFY_DRAW_SNAPSHOTS=1: 0 stages differed (about 49k hits captured again per 10 s), and the picture looks right.
  • About 241k draws keyed. About 129k of them (54%) were skipped by the trial back-off (shader sets under 1 hit in 16). About 61k tried an alias lookup: about 26k found no donor decode, about 35k relocated every stage, and about 13k of those became hits. The rest differed in contents after the move.
  • So in Hades the per-sprite pointer mostly points at different data, not the same data somewhere else, and relocation turns about 5% of the draws into hits. I did not run an A/B with APS5_NO_DRAW_RELOCATION=1, so I have no frame-time number for the change itself.

LLM assistance used.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6160404009 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6160404009). Originally posted by [Raghav314](https://github.com/Raghav314) on 2026-10-14T03:44:41Z. --- I ran this with #5609 on top on my machine (Linux, CachyOS, GCC, RTX 4090, NVIDIA 615.78.08), merged with `main` a5f493f90, and tried it on Hades II (PPSA36082). Two things, and some numbers. **The Linux build fails.** `ShaderDiskCache.cpp` has layout asserts that only exist on Linux x86-64 with libstdc++, so a Windows build never sees them: ``` ShaderDiskCache.cpp:82: static assertion failed: RecompileResult changed: update EncodeResult and DecodeResult (368 == 320) ShaderDiskCache.cpp:97: static assertion failed: BindingAllocationResult changed: update the allocation encoder (200 == 152) ``` `shaderDataUserWords` (5d8dff973, here) and `bufferBaseSlots` (54c1f168c, #5609) are what grew them. Nothing is lost on disk, since the cached variant only stores the `CompiledBindingLayout` and both fields are rebuilt by `DescriptorBindingBuilder::Populate` on every capture. So it is only the asserts, plus `EncodeResult`/`DecodeResult` not carrying the two fields. What I used locally: ```cpp static_assert(sizeof(RecompileResult) == 368, ...); static_assert(sizeof(BindingAllocationResult) == 200, ...); // EncodeResult, after workgroupMemoryDwords writer.Values(std::span<const std::uint32_t>(result.shaderDataUserWords)); writer.List(result.bufferBaseSlots, [](Writer& out, const std::array<std::uint32_t, 3>& slot) { out.Values(std::span<const std::uint32_t>(slot)); }); // DecodeResult, after workgroupMemoryDwords reader.Values(result.shaderDataUserWords); reader.List(result.bufferBaseSlots, 12, [](Reader& in, std::array<std::uint32_t, 3>& slot) { std::vector<std::uint32_t> words; in.Values(words); if (words.size() != slot.size()) in.Fail(); else std::copy(words.begin(), words.end(), slot.begin()); }); ``` With that, the full ctest passes except `agc_driver_bc_block_copy`, which fails the same way on plain `main` here. **The `[draw-relocate]` line never printed in Hades.** It is only reached from inside `if (!userPatches.empty())`, once `lookups >= 100000`, and Hades rarely gets there. I added a local counter line printed with the `[draw-cache]` report every 10 s to see what happens. **Hades II, hub, standing still** (`APS5_PROFILE_DRAW=1`, per 10 s): - `APS5_VERIFY_DRAW_ENTRIES=1 APS5_VERIFY_REGISTER_KEYS=1 APS5_VERIFY_DRAW_SNAPSHOTS=1`: 0 stages differed (about 49k hits captured again per 10 s), and the picture looks right. - About 241k draws keyed. About 129k of them (54%) were skipped by the trial back-off (shader sets under 1 hit in 16). About 61k tried an alias lookup: about 26k found no donor decode, about 35k relocated every stage, and about 13k of those became hits. The rest differed in contents after the move. - So in Hades the per-sprite pointer mostly points at different data, not the same data somewhere else, and relocation turns about 5% of the draws into hits. I did not run an A/B with `APS5_NO_DRAW_RELOCATION=1`, so I have no frame-time number for the change itself. LLM assistance used.
JAB-dev commented 2026-10-14 03:46:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JAB-dev on 2026-10-14T03:46:41Z.


Reading the code to see why this does not fire on Besiege (the one moving word is user word 8 of the 0x8c group, register 0x94, +176 per draw; that group feeds programs[0], the vertex stage), two things stand out:

  1. tagVariantRuns(..., decodeReads[i].empty() && (!vertexInfos[i] || resourcesNum == 0), ...) in DrawCapture.cpp skips every vertex stage that has vertex inputs, so the word is never learned as relocatable and its raw value stays in the alias key: every draw gets a new alias, which matches 2 donors in 123,013 alias lookups. Dropping that gate and instead excluding the vertex-table pointer words that DecodeVertexStageInfo reads (ShaderInputState.cpp near line 209) would let the word be learned.
  2. Even then the alias key hashes the contents behind the pointer, and in Besiege each 176-byte slot holds different per-draw constants, so the alias still would not repeat unless the words that are only passed to the GPU (the pure slots of SrtFlatSlotClasses.cpp) are left out of the content key and validated live, the way the dispatch cache's data hits do.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6160426183 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6160426183). Originally posted by [JAB-dev](https://github.com/JAB-dev) on 2026-10-14T03:46:41Z. --- Reading the code to see why this does not fire on Besiege (the one moving word is user word 8 of the 0x8c group, register 0x94, +176 per draw; that group feeds `programs[0]`, the vertex stage), two things stand out: 1. `tagVariantRuns(..., decodeReads[i].empty() && (!vertexInfos[i] || resourcesNum == 0), ...)` in `DrawCapture.cpp` skips every vertex stage that has vertex inputs, so the word is never learned as relocatable and its raw value stays in the alias key: every draw gets a new alias, which matches 2 donors in 123,013 alias lookups. Dropping that gate and instead excluding the vertex-table pointer words that `DecodeVertexStageInfo` reads (`ShaderInputState.cpp` near line 209) would let the word be learned. 2. Even then the alias key hashes the contents behind the pointer, and in Besiege each 176-byte slot holds different per-draw constants, so the alias still would not repeat unless the words that are only passed to the GPU (the pure slots of `SrtFlatSlotClasses.cpp`) are left out of the content key and validated live, the way the dispatch cache's data hits do.
blawesom commented 2026-10-14 05:48:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-14T05:48:20Z.


Rebase handoff — rebased onto current main (all four commits), authorship unchanged.

One code conflict (main's skipped-shader early return beside this PR's user-patch application — both kept) plus one structural follow-through: this PR's shaderDataUserWords (a runtime vector on RecompileResult/BindingAllocationResult) changes struct sizes that main's newer disk-cache encoders assert on. The handoff updates the two static_assert sizes for the merged layouts (320→344, 152→176); the field itself is not added to the encoders, as it looks runtime-only (recomputed per recompile, not persisted) — please confirm that's intended, since the assert message points at the encoders by design.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 1100/1101 — the only failure is the known main regression (agc_driver_tessellation segfault, #4727); the disk-cache and draw-cache-relocation tests all pass (4/4)

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/4943
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is d94dc175e.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6161840616 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6161840616). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-14T05:48:20Z. --- **Rebase handoff** — rebased onto current `main` (all four commits), authorship unchanged. One code conflict (main's skipped-shader early return beside this PR's user-patch application — both kept) plus one structural follow-through: this PR's `shaderDataUserWords` (a runtime vector on `RecompileResult`/`BindingAllocationResult`) changes struct sizes that `main`'s newer disk-cache encoders assert on. The handoff updates the two `static_assert` sizes for the merged layouts (320→344, 152→176); the field itself is **not** added to the encoders, as it looks runtime-only (recomputed per recompile, not persisted) — **please confirm that's intended**, since the assert message points at the encoders by design. Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): - builds; `tools/check_conventions.py --base origin/main` passes - **full suite: 1100/1101** — the only failure is the known `main` regression (`agc_driver_tessellation` segfault, #4727); the disk-cache and draw-cache-relocation tests all pass (4/4) **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/4943 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `d94dc175e`.
adriadam10 commented 2026-10-14 11:12:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T11:12:20Z.

Review: CHANGES_REQUESTED


Thanks for the work and for the rebase after #5216. This head conflicts with main and, merged with it, does not build on Linux. Points to fix:

  • Draw/Draw.cpp conflicts with main (the skipped-shader early return next to the user-patch application). Please rebase.
  • After the rebase, core/shader/recompiler/ShaderDiskCache.cpp:79 and :94 (static_assert on sizeof(RecompileResult) / sizeof(BindingAllocationResult)) fail on Linux/libstdc++ because shaderDataUserWords grows both structs (see Raghav314's report). Updating the sizes alone is not enough: a RecompileResult decoded from the disk cache comes back with an empty shaderDataUserWords, so applyShaderDataPatches patches nothing and a relocated hit would keep the old pointer in the shader data. Either persist the field in EncodeResult/DecodeResult and the allocation encoder (and bump the cache version), or make the relocation refuse variants whose compiled result has no learned words. Please add a test for a result that went through the disk cache.
  • Besiege data from @JAB-dev (above): the gate in DrawCapture.cpp (decodeReads[i].empty() && (!vertexInfos[i] || vertexInfos[i]->resourcesNum == 0)) never learns the word that moves in vertex stages with vertex inputs. Please say whether that case is in or out of this PR and, if out, why the trial back-off is enough there.
  • Gain so far is shown on one title (RetroArch/Flycast); MCD2, two AMD titles and Besiege show no change or a small loss, and Hades II turns ~5% of draws into hits without an A/B. A before/after on one of those with APS5_NO_DRAW_RELOCATION=1 would settle it.
  • #494 and #5609 touch the same lookup; list them under Depends on / say which lands first.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5516996922 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#pullrequestreview-5516996922). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T11:12:20Z. **Review:** CHANGES_REQUESTED --- Thanks for the work and for the rebase after #5216. This head conflicts with `main` and, merged with it, does not build on Linux. Points to fix: - `Draw/Draw.cpp` conflicts with `main` (the skipped-shader early return next to the user-patch application). Please rebase. - After the rebase, `core/shader/recompiler/ShaderDiskCache.cpp:79` and `:94` (`static_assert` on `sizeof(RecompileResult)` / `sizeof(BindingAllocationResult)`) fail on Linux/libstdc++ because `shaderDataUserWords` grows both structs (see Raghav314's report). Updating the sizes alone is not enough: a `RecompileResult` decoded from the disk cache comes back with an empty `shaderDataUserWords`, so `applyShaderDataPatches` patches nothing and a relocated hit would keep the old pointer in the shader data. Either persist the field in `EncodeResult`/`DecodeResult` and the allocation encoder (and bump the cache version), or make the relocation refuse variants whose compiled result has no learned words. Please add a test for a result that went through the disk cache. - Besiege data from @JAB-dev (above): the gate in `DrawCapture.cpp` (`decodeReads[i].empty() && (!vertexInfos[i] || vertexInfos[i]->resourcesNum == 0)`) never learns the word that moves in vertex stages with vertex inputs. Please say whether that case is in or out of this PR and, if out, why the trial back-off is enough there. - Gain so far is shown on one title (RetroArch/Flycast); MCD2, two AMD titles and Besiege show no change or a small loss, and Hades II turns ~5% of draws into hits without an A/B. A before/after on one of those with `APS5_NO_DRAW_RELOCATION=1` would settle it. - #494 and #5609 touch the same lookup; list them under Depends on / say which lands first.
adriadam10 commented 2026-10-14 13:07:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T13:07:04Z.

Review: CHANGES_REQUESTED


Thanks for the update; persisting shaderDataUserWords in EncodeResult/DecodeResult is the right direction. What is still open:

  • The head conflicts with main again (Driver/Draw/DrawCache.hpp, core/shader/recompiler/ShaderDiskCache.cpp). Please rebase and re-check the static_assert sizes on Linux/libstdc++ against the merged structs.
  • No test covers a result that went through the disk cache: encode + decode a RecompileResult with non-empty shaderDataUserWords and check the words (and an alias hit on the decoded result). Without it the encoder change is untested.
  • The DrawCapture.cpp gate (decodeReads[i].empty() && (!vertexInfos[i] || vertexInfos[i]->resourcesNum == 0)) still skips vertex stages with vertex inputs, so Besiege's moving word is never learned (@JAB-dev above). Please say whether that case is in or out of this PR and, if out, why the trial back-off is enough there.
  • Gain is shown on one title (RetroArch/Flycast); MCD2, two AMD titles and Besiege show no change or a small loss. A before/after with APS5_NO_DRAW_RELOCATION=1 on one of them would settle it.
  • #494 and #5609 touch the same lookup: list them under Depends on and say which lands first.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5518368751 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#pullrequestreview-5518368751). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T13:07:04Z. **Review:** CHANGES_REQUESTED --- Thanks for the update; persisting `shaderDataUserWords` in `EncodeResult`/`DecodeResult` is the right direction. What is still open: - The head conflicts with `main` again (`Driver/Draw/DrawCache.hpp`, `core/shader/recompiler/ShaderDiskCache.cpp`). Please rebase and re-check the `static_assert` sizes on Linux/libstdc++ against the merged structs. - No test covers a result that went through the disk cache: encode + decode a `RecompileResult` with non-empty `shaderDataUserWords` and check the words (and an alias hit on the decoded result). Without it the encoder change is untested. - The `DrawCapture.cpp` gate (`decodeReads[i].empty() && (!vertexInfos[i] || vertexInfos[i]->resourcesNum == 0)`) still skips vertex stages with vertex inputs, so Besiege's moving word is never learned (@JAB-dev above). Please say whether that case is in or out of this PR and, if out, why the trial back-off is enough there. - Gain is shown on one title (RetroArch/Flycast); MCD2, two AMD titles and Besiege show no change or a small loss. A before/after with `APS5_NO_DRAW_RELOCATION=1` on one of them would settle it. - #494 and #5609 touch the same lookup: list them under Depends on and say which lands first.
adriadam10 commented 2026-10-14 13:28:30 +00:00 (Migrated from github.com)

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

Review: CHANGES_REQUESTED


Thanks for the rebase and for persisting shaderDataUserWords in the disk cache. Merged onto current main, the Agc/AgcDriver scope builds and passes here on Linux (agc_driver_draw_cache_relocation included). Still open from the last review:

  • No test covers a result that went through the disk cache: encode + decode a RecompileResult with non-empty shaderDataUserWords and check the words (and an alias hit on the decoded result). The encoder/decoder lines added in ShaderDiskCache.cpp are untested.
  • DrawCapture.cpp:103 (decodeReads[i].empty() && (!vertexInfos[i] || vertexInfos[i]->resourcesNum == 0)) still skips vertex stages with vertex inputs, so Besiege's moving word (@JAB-dev above) is never learned. Please say whether that case is in or out of this PR and, if out, why the trial back-off is enough there.
  • The gain is shown on one title (RetroArch/Flycast); MCD2, two AMD titles and Besiege show no change or a small loss. A before/after with APS5_NO_DRAW_RELOCATION=1 on one of them would settle it.
  • #494 and #5609 touch the same lookup: please list them under Depends on (currently none) and say which lands first.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5518660958 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#pullrequestreview-5518660958). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T13:28:30Z. **Review:** CHANGES_REQUESTED --- Thanks for the rebase and for persisting `shaderDataUserWords` in the disk cache. Merged onto current `main`, the Agc/AgcDriver scope builds and passes here on Linux (`agc_driver_draw_cache_relocation` included). Still open from the last review: - No test covers a result that went through the disk cache: encode + decode a `RecompileResult` with non-empty `shaderDataUserWords` and check the words (and an alias hit on the decoded result). The encoder/decoder lines added in `ShaderDiskCache.cpp` are untested. - `DrawCapture.cpp:103` (`decodeReads[i].empty() && (!vertexInfos[i] || vertexInfos[i]->resourcesNum == 0)`) still skips vertex stages with vertex inputs, so Besiege's moving word (@JAB-dev above) is never learned. Please say whether that case is in or out of this PR and, if out, why the trial back-off is enough there. - The gain is shown on one title (RetroArch/Flycast); MCD2, two AMD titles and Besiege show no change or a small loss. A before/after with `APS5_NO_DRAW_RELOCATION=1` on one of them would settle it. - #494 and #5609 touch the same lookup: please list them under `Depends on` (currently `none`) and say which lands first.
TheAggie commented 2026-10-14 13:30:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-14T13:30:04Z.


Rebased onto main 7181fe94d and force-pushed. Since then #5656 went up, stacked on #494: it reuses a stage when the changed user words are ones that stage never reads, which is a different case from the moved pointers here. What changed since the last push:

@Raghav314 thank you, that is a real break and I could not have seen it here. The Linux-only size asserts in ShaderDiskCache.cpp now expect the grown structs (376 and 176 on this branch, 400 and 200 on #5609, on top of main's own growth), and EncodeResult/DecodeResult carry shaderDataUserWords (and bufferBaseSlots on #5609). I have no Linux machine, so I checked the numbers by compiling that file once with the guard forced on under MinGW's libstdc++, which lays these structs out the same way; a Linux build of the new head would still be the real confirmation.

You are also right that the [draw-relocate] line is only reached from the patch path after 100,000 lookups, so a title that seldom patches never prints it. I have not changed that in this push. Your Hades II numbers are useful as they are: about 5% of draws turned into hits, 0 stages differing under the three verify switches, and more than half the draws skipped by the back-off.

@JAB-dev both points are right.

  1. Vertex stages with vertex inputs are left out on purpose for now: the vertex table pointers are read by the stage decode, not only by the capture, so a moved pointer there needs the decoded vertex state moved with it. Excluding just the words DecodeVertexStageInfo reads, as you suggest, is the right shape for it. It is not in this PR.
  2. Agreed, and it is the same limit I described above: this PR only matches when the contents behind the pointer are equal. Leaving the pass-through words out of the content key and checking them live is the next step after that, and closer to #494.

So Besiege gains nothing from this PR until those two steps exist. What the back-off should do is take away the 3-5% it cost; I can't measure that here, so a rerun on your side is what would show it.

Two smaller changes came from the review on #5609 and apply here too: the content key now hashes the whole of each read instead of its first 64 words, and when the alias map reaches its limit every other entry is dropped instead of all of them.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169514722 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6169514722). Originally posted by [TheAggie](https://github.com/TheAggie) on 2026-10-14T13:30:04Z. --- Rebased onto `main` `7181fe94d` and force-pushed. Since then #5656 went up, stacked on #494: it reuses a stage when the changed user words are ones that stage never reads, which is a different case from the moved pointers here. What changed since the last push: @Raghav314 thank you, that is a real break and I could not have seen it here. The Linux-only size asserts in `ShaderDiskCache.cpp` now expect the grown structs (376 and 176 on this branch, 400 and 200 on #5609, on top of `main`'s own growth), and `EncodeResult`/`DecodeResult` carry `shaderDataUserWords` (and `bufferBaseSlots` on #5609). I have no Linux machine, so I checked the numbers by compiling that file once with the guard forced on under MinGW's libstdc++, which lays these structs out the same way; a Linux build of the new head would still be the real confirmation. You are also right that the `[draw-relocate]` line is only reached from the patch path after 100,000 lookups, so a title that seldom patches never prints it. I have not changed that in this push. Your Hades II numbers are useful as they are: about 5% of draws turned into hits, 0 stages differing under the three verify switches, and more than half the draws skipped by the back-off. @JAB-dev both points are right. 1. Vertex stages with vertex inputs are left out on purpose for now: the vertex table pointers are read by the stage decode, not only by the capture, so a moved pointer there needs the decoded vertex state moved with it. Excluding just the words `DecodeVertexStageInfo` reads, as you suggest, is the right shape for it. It is not in this PR. 2. Agreed, and it is the same limit I described above: this PR only matches when the contents behind the pointer are equal. Leaving the pass-through words out of the content key and checking them live is the next step after that, and closer to #494. So Besiege gains nothing from this PR until those two steps exist. What the back-off should do is take away the 3-5% it cost; I can't measure that here, so a rerun on your side is what would show it. Two smaller changes came from the review on #5609 and apply here too: the content key now hashes the whole of each read instead of its first 64 words, and when the alias map reaches its limit every other entry is dropped instead of all of them. AI-assisted (Claude Code).
mrfelek commented 2026-10-14 16:13:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-14T16:13:08Z.


Data point from a title that misses the draw cache on almost every draw. Diablo II: Resurrected (PPSA03912, 01.039.000), Linux, RTX 3080 Ti (NVIDIA 615.71.09), in game (Rogue Encampment). Build: main 84b01f9cd plus #1186. A = that; C = A plus this PR (head 1c72efdc9); B = C plus #5609 (head d6abd5555). Three alternating runs of each, presents per 10 s: A 39.7 / 41.0 / 39.1; C 39.4 / 40.3 / 39.3; B 33.3 (a startup dip in its first window) / 40.0 / 39.7. No change in speed. The draw-cache hits per 10 s fall: about 377 (A), about 220 (C), about 201 (B).

Why it does not help on this title: over 60,000 draws one stage's user-data word 0x090 changes on essentially every draw (59,959 of them). That stage holds inline V#s (base, stride and count, format) whose bases advance by a fixed step per draw, as a streaming vertex buffer does: word 0x08c over four consecutive draws is 5b199b00, 5b19a000, 5b19a500, 5b19aa00 (step 0x500). A second word, 0x00c, moves on almost every draw too (02e4dad0, 02e50bf0, 02e69ff0 over three draws). So the values that change are the V# bases themselves and a constant pointer, and the key still never repeats. Happy to rerun with more registers or a trace if that helps.

AI-assisted; the runs are from my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6172837912 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6172837912). Originally posted by [mrfelek](https://github.com/mrfelek) on 2026-10-14T16:13:08Z. --- Data point from a title that misses the draw cache on almost every draw. Diablo II: Resurrected (PPSA03912, 01.039.000), Linux, RTX 3080 Ti (NVIDIA 615.71.09), in game (Rogue Encampment). Build: `main` 84b01f9cd plus #1186. A = that; C = A plus this PR (head 1c72efdc9); B = C plus #5609 (head d6abd5555). Three alternating runs of each, presents per 10 s: A 39.7 / 41.0 / 39.1; C 39.4 / 40.3 / 39.3; B 33.3 (a startup dip in its first window) / 40.0 / 39.7. No change in speed. The draw-cache hits per 10 s fall: about 377 (A), about 220 (C), about 201 (B). Why it does not help on this title: over 60,000 draws one stage's user-data word 0x090 changes on essentially every draw (59,959 of them). That stage holds inline V#s (base, stride and count, format) whose bases advance by a fixed step per draw, as a streaming vertex buffer does: word 0x08c over four consecutive draws is `5b199b00`, `5b19a000`, `5b19a500`, `5b19aa00` (step 0x500). A second word, 0x00c, moves on almost every draw too (`02e4dad0`, `02e50bf0`, `02e69ff0` over three draws). So the values that change are the V# bases themselves and a constant pointer, and the key still never repeats. Happy to rerun with more registers or a trace if that helps. AI-assisted; the runs are from my machine.
adriadam10 commented 2026-10-14 20:42:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T20:42:03Z.

Review: CHANGES_REQUESTED


Thanks for the update. On this head the Agc/AgcDriver scope builds and passes here on Linux, and agc_driver_draw_cache_relocation fails with APS5_NO_DRAW_RELOCATION=1, as it should. Your reasoning on the vertex-stage gate (DrawCapture.cpp:103, the vertex decode reads the table pointers) holds; that point is dropped. What blocks the merge is the performance case:

  • No gain on current main yet. Your own run on a14ae8e23 shows this PR alone slightly slower (audio 5.4/5.5% against 5.8%); @TideOPL (MCD2), @LeandroLP23 (two AMD titles) and @mrfelek (D2R) see no change, and @JAB-dev saw 3-5% lower on Besiege before the back-off. The 26.9% → 38.5% gain is from a base without #5216. Since the gain only comes back with #5609 on top, please post a before/after of the stack (#4943 + #5609) against current main on the Flycast demo, same build otherwise, a few alternating runs. If that holds, the two can land back to back.
  • Draw-cache hits drop on D2R. @mrfelek's run of this exact patch (1c72efdc9, same commits as 895d65498) shows hits per 10 s going from about 377 to about 220, with the speed unchanged. A likely cause: admitDrawKey (DrawCache.cpp:87-95) admits an exact key at its first sight whenever its alias key was seen before, whether or not that shader set's alias lookups ever relocate. On a title where they never do (buffer bases move, the validation refuses), those entries never hit and push live ones out of the cache, which undoes #5216's protection. Please either gate that admission on the shader set's alias lookups actually hitting, or show with insert/evict counters that the drop comes from somewhere else, and add a case to agc_driver_draw_cache_relocation where the alias repeats but never relocates and the exact keys keep their hits.
  • Disk-cache round trip still untested. ShaderDiskCache.cpp:1506/:1514 encode and decode shaderDataUserWords; a test that encodes a RecompileResult with non-empty words, decodes it and checks them would pin it.

The conflict with main is mechanical; we'll rebase it ourselves once the above is settled. We have also taken over #494's rebase, so you don't need to coordinate with it.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5524385781 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#pullrequestreview-5524385781). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T20:42:03Z. **Review:** CHANGES_REQUESTED --- Thanks for the update. On this head the Agc/AgcDriver scope builds and passes here on Linux, and `agc_driver_draw_cache_relocation` fails with `APS5_NO_DRAW_RELOCATION=1`, as it should. Your reasoning on the vertex-stage gate (`DrawCapture.cpp:103`, the vertex decode reads the table pointers) holds; that point is dropped. What blocks the merge is the performance case: - **No gain on current `main` yet.** Your own run on `a14ae8e23` shows this PR alone slightly slower (audio 5.4/5.5% against 5.8%); @TideOPL (MCD2), @LeandroLP23 (two AMD titles) and @mrfelek (D2R) see no change, and @JAB-dev saw 3-5% lower on Besiege before the back-off. The 26.9% → 38.5% gain is from a base without #5216. Since the gain only comes back with #5609 on top, please post a before/after of the stack (#4943 + #5609) against current `main` on the Flycast demo, same build otherwise, a few alternating runs. If that holds, the two can land back to back. - **Draw-cache hits drop on D2R.** @mrfelek's run of this exact patch (`1c72efdc9`, same commits as `895d65498`) shows hits per 10 s going from about 377 to about 220, with the speed unchanged. A likely cause: `admitDrawKey` (`DrawCache.cpp:87-95`) admits an exact key at its first sight whenever its alias key was seen before, whether or not that shader set's alias lookups ever relocate. On a title where they never do (buffer bases move, the validation refuses), those entries never hit and push live ones out of the cache, which undoes #5216's protection. Please either gate that admission on the shader set's alias lookups actually hitting, or show with insert/evict counters that the drop comes from somewhere else, and add a case to `agc_driver_draw_cache_relocation` where the alias repeats but never relocates and the exact keys keep their hits. - **Disk-cache round trip still untested.** `ShaderDiskCache.cpp:1506`/`:1514` encode and decode `shaderDataUserWords`; a test that encodes a `RecompileResult` with non-empty words, decodes it and checks them would pin it. The conflict with `main` is mechanical; we'll rebase it ourselves once the above is settled. We have also taken over #494's rebase, so you don't need to coordinate with it.
JAB-dev commented 2026-10-15 05:09:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JAB-dev on 2026-10-15T05:09:56Z.


Besiege (PPSA20313), this branch (895d65498) against its merge base (84b01f9cd), Windows 11, RTX 4070 SUPER, 1080p: title screen 15.2 / 14.1 FPS on the base, 15.1 / 15.2 / 15.0 on this branch (no change; the 3-5% loss I measured on the earlier head is gone).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6184914101 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6184914101). Originally posted by [JAB-dev](https://github.com/JAB-dev) on 2026-10-15T05:09:56Z. --- Besiege (PPSA20313), this branch (`895d65498`) against its merge base (`84b01f9cd`), Windows 11, RTX 4070 SUPER, 1080p: title screen 15.2 / 14.1 FPS on the base, 15.1 / 15.2 / 15.0 on this branch (no change; the 3-5% loss I measured on the earlier head is gone).
github-actions[bot] commented 2026-10-15 12:07:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:07:10Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6188 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp L350
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp L82-83
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCache.cpp L105-106
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp L7, L149-168, L180
PR 6292 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp L350-351
PR 6312 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp L146
PR 6412 core/shader/recompiler/ShaderDiskCache.cpp L89-90
PR 6454 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp L57, L161-168
core/shader/recompiler/Optimization/include/Optimization/SrtWalker.hpp L4-5, L37
PR 6486 core/shader/recompiler/ShaderDiskCache.cpp L89-90
PR 6615 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp L350-351

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 1341 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1896 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCache.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp
core/shader/recompiler/Optimization/src/SrtWalker/SrtEvaluator.cpp
core/shader/recompiler/Recompiler.hpp
PR 3891 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4072 core/shader/recompiler/Recompiler.cpp
PR 4156 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4396 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4397 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4422 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4423 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4424 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4520 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4521 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4522 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4523 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4566 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4599 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4650 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
PR 4718 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4740 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4749 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4760 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4813 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 4891 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/shader/recompiler/Recompiler.cpp
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
PR 5426 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5431 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp
PR 5499 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5500 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 5656 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCache.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp
core/shader/recompiler/Optimization/include/Optimization/SrtWalker.hpp
core/shader/recompiler/Optimization/src/SrtWalker/SrtEvaluator.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 5867 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCache.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp
core/shader/recompiler/Optimization/src/SrtWalker/SrtEvaluator.cpp
PR 5875 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 6044 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6177 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
PR 6208 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
PR 6222 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
PR 6235 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Recompiler.hpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191659631 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6191659631). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T12:07:10Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` [L350](https://github.com/boykopovar/AnyPS5/blob/332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5/core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp#L350)<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp` [L82-83](https://github.com/boykopovar/AnyPS5/blob/332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp#L82-L83)<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCache.cpp` [L105-106](https://github.com/boykopovar/AnyPS5/blob/332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCache.cpp#L105-L106)<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp` [L7](https://github.com/boykopovar/AnyPS5/blob/332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp#L7), [L149-168](https://github.com/boykopovar/AnyPS5/blob/332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp#L149-L168), [L180](https://github.com/boykopovar/AnyPS5/blob/332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp#L180) | | | | [PR 6292](https://www.github.com/boykopovar/AnyPS5/pull/6292) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` [L350-351](https://github.com/boykopovar/AnyPS5/blob/332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5/core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp#L350-L351) | | | | [PR 6312](https://www.github.com/boykopovar/AnyPS5/pull/6312) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp` [L146](https://github.com/boykopovar/AnyPS5/blob/332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp#L146) | | | | [PR 6412](https://www.github.com/boykopovar/AnyPS5/pull/6412) | `core/shader/recompiler/ShaderDiskCache.cpp` [L89-90](https://github.com/boykopovar/AnyPS5/blob/332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5/core/shader/recompiler/ShaderDiskCache.cpp#L89-L90) | | | | [PR 6454](https://www.github.com/boykopovar/AnyPS5/pull/6454) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp` [L57](https://github.com/boykopovar/AnyPS5/blob/332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp#L57), [L161-168](https://github.com/boykopovar/AnyPS5/blob/332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp#L161-L168)<br>`core/shader/recompiler/Optimization/include/Optimization/SrtWalker.hpp` [L4-5](https://github.com/boykopovar/AnyPS5/blob/332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5/core/shader/recompiler/Optimization/include/Optimization/SrtWalker.hpp#L4-L5), [L37](https://github.com/boykopovar/AnyPS5/blob/332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5/core/shader/recompiler/Optimization/include/Optimization/SrtWalker.hpp#L37) | | | | [PR 6486](https://www.github.com/boykopovar/AnyPS5/pull/6486) | `core/shader/recompiler/ShaderDiskCache.cpp` [L89-90](https://github.com/boykopovar/AnyPS5/blob/332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5/core/shader/recompiler/ShaderDiskCache.cpp#L89-L90) | | | | [PR 6615](https://www.github.com/boykopovar/AnyPS5/pull/6615) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` [L350-351](https://github.com/boykopovar/AnyPS5/blob/332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5/core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp#L350-L351) | | | 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 1341](https://www.github.com/boykopovar/AnyPS5/pull/1341) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 1368](https://www.github.com/boykopovar/AnyPS5/pull/1368) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 1395](https://www.github.com/boykopovar/AnyPS5/pull/1395) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 1896](https://www.github.com/boykopovar/AnyPS5/pull/1896) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCache.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp`<br>`core/shader/recompiler/Optimization/src/SrtWalker/SrtEvaluator.cpp`<br>`core/shader/recompiler/Recompiler.hpp` | | [PR 3891](https://www.github.com/boykopovar/AnyPS5/pull/3891) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4072](https://www.github.com/boykopovar/AnyPS5/pull/4072) | `core/shader/recompiler/Recompiler.cpp` | | [PR 4156](https://www.github.com/boykopovar/AnyPS5/pull/4156) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4396](https://www.github.com/boykopovar/AnyPS5/pull/4396) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4397](https://www.github.com/boykopovar/AnyPS5/pull/4397) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4422](https://www.github.com/boykopovar/AnyPS5/pull/4422) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4423](https://www.github.com/boykopovar/AnyPS5/pull/4423) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4424](https://www.github.com/boykopovar/AnyPS5/pull/4424) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4520](https://www.github.com/boykopovar/AnyPS5/pull/4520) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4521](https://www.github.com/boykopovar/AnyPS5/pull/4521) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4522](https://www.github.com/boykopovar/AnyPS5/pull/4522) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4523](https://www.github.com/boykopovar/AnyPS5/pull/4523) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4566](https://www.github.com/boykopovar/AnyPS5/pull/4566) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4599](https://www.github.com/boykopovar/AnyPS5/pull/4599) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4650](https://www.github.com/boykopovar/AnyPS5/pull/4650) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp`<br>`core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/Recompiler.hpp` | | [PR 4718](https://www.github.com/boykopovar/AnyPS5/pull/4718) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4740](https://www.github.com/boykopovar/AnyPS5/pull/4740) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4749](https://www.github.com/boykopovar/AnyPS5/pull/4749) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4760](https://www.github.com/boykopovar/AnyPS5/pull/4760) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4813](https://www.github.com/boykopovar/AnyPS5/pull/4813) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 4891](https://www.github.com/boykopovar/AnyPS5/pull/4891) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/shader/recompiler/Recompiler.cpp` | | [PR 5371](https://www.github.com/boykopovar/AnyPS5/pull/5371) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp` | | [PR 5426](https://www.github.com/boykopovar/AnyPS5/pull/5426) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 5431](https://www.github.com/boykopovar/AnyPS5/pull/5431) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp` | | [PR 5499](https://www.github.com/boykopovar/AnyPS5/pull/5499) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 5500](https://www.github.com/boykopovar/AnyPS5/pull/5500) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp`<br>`core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/Recompiler.hpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp` | | [PR 5656](https://www.github.com/boykopovar/AnyPS5/pull/5656) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Dispatch/DispatchCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCache.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp`<br>`core/shader/recompiler/Optimization/include/Optimization/SrtWalker.hpp`<br>`core/shader/recompiler/Optimization/src/SrtWalker/SrtEvaluator.cpp`<br>`core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/Recompiler.hpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp` | | [PR 5867](https://www.github.com/boykopovar/AnyPS5/pull/5867) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCache.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp`<br>`core/shader/recompiler/Optimization/src/SrtWalker/SrtEvaluator.cpp` | | [PR 5875](https://www.github.com/boykopovar/AnyPS5/pull/5875) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/shader/recompiler/Recompiler.hpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp`<br>`core/shader/recompiler/Recompiler.hpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6177](https://www.github.com/boykopovar/AnyPS5/pull/6177) | `core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp`<br>`core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/Recompiler.hpp` | | [PR 6208](https://www.github.com/boykopovar/AnyPS5/pull/6208) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp`<br>`core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/Recompiler.hpp` | | [PR 6235](https://www.github.com/boykopovar/AnyPS5/pull/6235) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp`<br>`core/shader/recompiler/Recompiler.hpp` |
TheAggie commented 2026-10-15 16:09:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-15T16:09:59Z.


@adriadam10 thanks for the review. Both branches are rebased onto main 940eba9a2 (#4943 is now 5 commits, #5609 is 8 on top of it, without #5906's two commits, which are merged). The three points:

Performance of the stack against current main. Flycast demo (Crazy Taxi attract mode), RetroArch PPSA99169, the same local support commits on both sides (the emulator needs them to run RetroArch; they are identical in both builds), immediate present, audio muted, alternating runs:

run main + support (audio) + #4943 + #5609 (audio)
1 34.5% 45.7%
2 35.7% 44.1%
3 35.6% 42.8%

Audio produced as a share of real time, unprofiled, about 9 points higher with the stack in every alternating pair.

Draw-cache hits on D2R. You were right about the admission. An exact key was admitted at its first sight whenever its alias had been seen, whether or not that shader set's relocations ever hit. That admission exists so a shader set can get a first entry to relocate from: after an alias-admitted insert, the next draw with the same alias hits through relocation and is never inserted. So the cost falls on aliases that come up exactly twice. Each such pair inserts an entry that becomes a donor nobody uses. The rule now:

  • a shader set gets two probation admissions through its alias;
  • after that, alias admission needs relocation hits, and trial.hits now counts only hits that validated through a relocated entry, not donors found;
  • once the trial decides the set is unproductive (fewer than 1 in 16 over 1,024 lookups), the alias isn't even computed (unchanged).

The new case in agc_driver_draw_cache_relocation (UnrelocatedAliasesStayOut) draws 12 aliases that each appear exactly twice, interleaved with a repeated draw. With the old rule it inserts 12 entries; with the new one at most 2, and the repeated draw keeps all 12 of its hits. The test fails on the old rule (checked by restoring it). I haven't got D2R to confirm the hit count on a real title; @mrfelek, if you can rerun with this head, the [draw-cache] inserts/evictions lines would show it.

Disk-cache round trip. agc_shader_disk_cache's result round trip now sets shaderDataUserWords and compares it after decoding (it fails if the decoder drops the words). The static_assert sizes were re-checked after the rebase: I compiled the structs with MinGW's libstdc++ on x86_64, where all 31 asserted sizes match, including the ones this branch doesn't touch. RecompileResult is 496 and BindingAllocationResult 184 on #4943, and 520/208 on #5609.

AI-assisted (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6196642420 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6196642420). Originally posted by [TheAggie](https://github.com/TheAggie) on 2026-10-15T16:09:59Z. --- @adriadam10 thanks for the review. Both branches are rebased onto `main` 940eba9a2 (#4943 is now 5 commits, #5609 is 8 on top of it, without #5906's two commits, which are merged). The three points: **Performance of the stack against current `main`.** Flycast demo (Crazy Taxi attract mode), RetroArch PPSA99169, the same local support commits on both sides (the emulator needs them to run RetroArch; they are identical in both builds), immediate present, audio muted, alternating runs: | run | `main` + support (audio) | + #4943 + #5609 (audio) | |---|---|---| | 1 | 34.5% | 45.7% | | 2 | 35.7% | 44.1% | | 3 | 35.6% | 42.8% | Audio produced as a share of real time, unprofiled, about 9 points higher with the stack in every alternating pair. **Draw-cache hits on D2R.** You were right about the admission. An exact key was admitted at its first sight whenever its alias had been seen, whether or not that shader set's relocations ever hit. That admission exists so a shader set can get a first entry to relocate from: after an alias-admitted insert, the next draw with the same alias hits through relocation and is never inserted. So the cost falls on aliases that come up exactly twice. Each such pair inserts an entry that becomes a donor nobody uses. The rule now: - a shader set gets two probation admissions through its alias; - after that, alias admission needs relocation hits, and `trial.hits` now counts only hits that validated through a relocated entry, not donors found; - once the trial decides the set is unproductive (fewer than 1 in 16 over 1,024 lookups), the alias isn't even computed (unchanged). The new case in `agc_driver_draw_cache_relocation` (`UnrelocatedAliasesStayOut`) draws 12 aliases that each appear exactly twice, interleaved with a repeated draw. With the old rule it inserts 12 entries; with the new one at most 2, and the repeated draw keeps all 12 of its hits. The test fails on the old rule (checked by restoring it). I haven't got D2R to confirm the hit count on a real title; @mrfelek, if you can rerun with this head, the `[draw-cache]` inserts/evictions lines would show it. **Disk-cache round trip.** `agc_shader_disk_cache`'s result round trip now sets `shaderDataUserWords` and compares it after decoding (it fails if the decoder drops the words). The `static_assert` sizes were re-checked after the rebase: I compiled the structs with MinGW's libstdc++ on x86_64, where all 31 asserted sizes match, including the ones this branch doesn't touch. RecompileResult is 496 and BindingAllocationResult 184 on #4943, and 520/208 on #5609. AI-assisted (Claude Code)
milescoviello commented 2026-10-16 03:52:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T03:52:11Z.


Linux results, since the description has no Linux build. Ubuntu 24.04, GCC 13.3, Release, RTX 4070 Ti, NVIDIA 595.99, 244f41ed2 merged onto main 5d9dcc42d (clean merge).

  • Build. It builds, including the Linux-only size asserts in ShaderDiskCache.cpp.
  • Tests. agc_shader_disk_cache and agc_driver_draw_cache_relocation pass 3 of 3. The 469 tests matching ^agc_driver_|^agc_vertex_barrier|recompiler|shader_cache|request_serializer|spirv give 468 passes. agc_driver_store_over_untracked fails the same way on main here (#6385).
  • A title where it doesn't engage yet. Super Meat Boy 3D (PPSA31162) is Unreal and misses the draw cache almost entirely on main. With APS5_TRACE_DRAW_CACHE, about 10,000 lookups per 10 s find no entry, and about 9,700 of those are user words/pointers only. The data-only path then compiles about 18,000 to 25,000 stages per 10 s, against 1,000 to 7,000 reused. With this PR (warm caches, after one warm-up run), the same counters look the same: 2.3% hits, user words/pointers only 9,714, 18,682 stages compiled against 1,086 reused. There is no [draw-relocate] line in 150 s, so it made fewer than 100,000 alias lookups. Presents per 10 s vary too much between runs on this title to show a difference either way. So these draws don't take the relocated path. Maybe their user words are also used as values, or the shader sets aren't learned. I haven't looked into which.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6207682385 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6207682385). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-16T03:52:11Z. --- Linux results, since the description has no Linux build. Ubuntu 24.04, GCC 13.3, Release, RTX 4070 Ti, NVIDIA 595.99, `244f41ed2` merged onto `main` 5d9dcc42d (clean merge). - **Build.** It builds, including the Linux-only size asserts in `ShaderDiskCache.cpp`. - **Tests.** `agc_shader_disk_cache` and `agc_driver_draw_cache_relocation` pass 3 of 3. The 469 tests matching `^agc_driver_|^agc_vertex_barrier|recompiler|shader_cache|request_serializer|spirv` give 468 passes. `agc_driver_store_over_untracked` fails the same way on `main` here (#6385). - **A title where it doesn't engage yet.** Super Meat Boy 3D (PPSA31162) is Unreal and misses the draw cache almost entirely on `main`. With `APS5_TRACE_DRAW_CACHE`, about 10,000 lookups per 10 s find no entry, and about 9,700 of those are `user words/pointers only`. The data-only path then compiles about 18,000 to 25,000 stages per 10 s, against 1,000 to 7,000 reused. With this PR (warm caches, after one warm-up run), the same counters look the same: 2.3% hits, `user words/pointers only` 9,714, 18,682 stages compiled against 1,086 reused. There is no `[draw-relocate]` line in 150 s, so it made fewer than 100,000 alias lookups. Presents per 10 s vary too much between runs on this title to show a difference either way. So these draws don't take the relocated path. Maybe their user words are also used as values, or the shader sets aren't learned. I haven't looked into which. AI-assisted: yes
LuisAguilarDev commented 2026-10-16 06:08:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LuisAguilarDev on 2026-10-16T06:08:19Z.


Field data from PPSA08587 (Dragon Ball Xenoverse 2), in case it helps the relocation path: in its heavy gameplay scenes, this PR finds no donors, and the scene stays at 6-12 fps.

Setup: Windows 11, i5-11400, RTX 3070 Ti (NVIDIA 610.88). Build: main 5d9dcc42d + #6539 (which includes this PR at 244f41ed2) + the title's own unrelated fixes. Run with APS5_PROFILE_DRAW=1 APS5_TRACE_DRAW_CACHE=1 APS5_DRAW_CACHE_ENTRIES=32768.

The miss is in user data

Each frame has ~1,300 draws at ~65 µs each on the queue worker; the worker is ~90% busy and the GPU ~35%. 10 s window:

[draw-cache] 88436 lookups (10 s): 75097 no entry, 13339 validated ... 6829 hits
[draw-cache] register-key miss component changes (10 s): stable registers 6575, user data 74853, auxiliary registers 0, device 0, first shader set 1, unchanged components 47
[draw] driver phases (10 s, 109864 draw packets, 105059 drawn, 176120 captures), us per packet: ... decode 7.4 ... capture 16.2 ... recompile 19.1 ... key/lookup/validate 6.8 ... lock wait 7.1 ..., total 69.8

[draw-relocate] never printed, because it only reports once userPatches is non-empty.

Where the relocation path stops

To find out, I added counters at each exit of the relocation path. They are local only and don't change behaviour. One line per 10 s in the heavy scene, with this PR as is:

[draw-relocate-gates] (10 s): misses: no relocation learned 1, identity idle 80950, aliases built 2867, aliases unreadable 2470;
  learn: key not inserted 76321, learned 2063, no relocatable words 7903, words banned 0;
  capture stages: eligible 6619, ineligible (vertex fetch or decode reads) 14017;
  relocate: no donor decode 2867, no donor stage 0, refused 0, relocated 0; admit: by alias 0, probation spent 61
  • 94% of misses skip relocation because the identity is idle. The trial (1/16 hit share over 1024 lookups) never becomes productive.
  • Every alias lookup fails at drawDecodes.find(aliases.structure). No donor is ever learned, because learnPendingRelocation needs the pending key to have been inserted, and admitDrawKey admits only repeated keys, which these never are.

Same scene, with probation and idle bypassed

I then bypassed both, locally: a key whose alias structure was seen before is admitted, and the trial never goes idle. I also set APS5_NO_DRAW_STAGE_DATA_HITS=1, so tagBufferWords runs. Stage data hits were 0 in this title anyway. Result:

[draw-relocate-gates] (10 s): misses: no relocation learned 4, identity idle 0, aliases built 30313, aliases unreadable 36672;
  learn: key not inserted 62702, learned 940, no relocatable words 3347, words banned 0;
  capture stages: eligible 2450, ineligible (vertex fetch or decode reads) 5539;
  relocate: no donor decode 30301, no donor stage 22, refused 0, relocated 0;
  admit: by alias 0, probation spent 845, alias structure repeated 880 / new 29434, admitted by structure 58; stage donors found 2 / missing 22
[draw-relocate] 106640 alias lookups: 11 donors with moved user words, 0 refusals, 8 hits through a relocated entry

The probation and idle gates were not the root cause:

  • The alias structure itself is new on 97% of draws (29434 new vs. 880 repeated). About 70% of captured stages fail eligibility at DrawCapture.cpp (decodeReads[i].empty() && resourcesNum == 0), because they have vertex fetch. My guess is that their per-draw user words then enter other at their raw value, so the structure is unique per draw.
  • More than half of the alias computations come out unreadable (36672). A relocatable word is 0, or its reads are unmapped.

So for this title, the gain would come from making stages with vertex fetch relocatable, when their fetch descriptors are reached through the moved pointer, and from looking into why so many aliases are unreadable. I can run a build from a branch or share the counter patch if that helps; the full logs are available too.

The analysis was done with AI assistance (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6209264507 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#issuecomment-6209264507). Originally posted by [LuisAguilarDev](https://github.com/LuisAguilarDev) on 2026-10-16T06:08:19Z. --- Field data from PPSA08587 (Dragon Ball Xenoverse 2), in case it helps the relocation path: in its heavy gameplay scenes, this PR finds no donors, and the scene stays at 6-12 fps. **Setup:** Windows 11, i5-11400, RTX 3070 Ti (NVIDIA 610.88). Build: `main` 5d9dcc42d + #6539 (which includes this PR at 244f41ed2) + the title's own unrelated fixes. Run with `APS5_PROFILE_DRAW=1 APS5_TRACE_DRAW_CACHE=1 APS5_DRAW_CACHE_ENTRIES=32768`. ### The miss is in user data Each frame has ~1,300 draws at ~65 µs each on the queue worker; the worker is ~90% busy and the GPU ~35%. 10 s window: ``` [draw-cache] 88436 lookups (10 s): 75097 no entry, 13339 validated ... 6829 hits [draw-cache] register-key miss component changes (10 s): stable registers 6575, user data 74853, auxiliary registers 0, device 0, first shader set 1, unchanged components 47 [draw] driver phases (10 s, 109864 draw packets, 105059 drawn, 176120 captures), us per packet: ... decode 7.4 ... capture 16.2 ... recompile 19.1 ... key/lookup/validate 6.8 ... lock wait 7.1 ..., total 69.8 ``` `[draw-relocate]` never printed, because it only reports once `userPatches` is non-empty. ### Where the relocation path stops To find out, I added counters at each exit of the relocation path. They are local only and don't change behaviour. One line per 10 s in the heavy scene, with this PR as is: ``` [draw-relocate-gates] (10 s): misses: no relocation learned 1, identity idle 80950, aliases built 2867, aliases unreadable 2470; learn: key not inserted 76321, learned 2063, no relocatable words 7903, words banned 0; capture stages: eligible 6619, ineligible (vertex fetch or decode reads) 14017; relocate: no donor decode 2867, no donor stage 0, refused 0, relocated 0; admit: by alias 0, probation spent 61 ``` - 94% of misses skip relocation because the identity is idle. The trial (1/16 hit share over 1024 lookups) never becomes productive. - Every alias lookup fails at `drawDecodes.find(aliases.structure)`. No donor is ever learned, because `learnPendingRelocation` needs the pending key to have been inserted, and `admitDrawKey` admits only repeated keys, which these never are. ### Same scene, with probation and idle bypassed I then bypassed both, locally: a key whose alias `structure` was seen before is admitted, and the trial never goes idle. I also set `APS5_NO_DRAW_STAGE_DATA_HITS=1`, so `tagBufferWords` runs. Stage data hits were 0 in this title anyway. Result: ``` [draw-relocate-gates] (10 s): misses: no relocation learned 4, identity idle 0, aliases built 30313, aliases unreadable 36672; learn: key not inserted 62702, learned 940, no relocatable words 3347, words banned 0; capture stages: eligible 2450, ineligible (vertex fetch or decode reads) 5539; relocate: no donor decode 30301, no donor stage 22, refused 0, relocated 0; admit: by alias 0, probation spent 845, alias structure repeated 880 / new 29434, admitted by structure 58; stage donors found 2 / missing 22 [draw-relocate] 106640 alias lookups: 11 donors with moved user words, 0 refusals, 8 hits through a relocated entry ``` The probation and idle gates were not the root cause: - **The alias `structure` itself is new on 97% of draws (29434 new vs. 880 repeated).** About 70% of captured stages fail eligibility at `DrawCapture.cpp` (`decodeReads[i].empty() && resourcesNum == 0`), because they have vertex fetch. My guess is that their per-draw user words then enter `other` at their raw value, so the structure is unique per draw. - **More than half of the alias computations come out unreadable (36672).** A relocatable word is 0, or its reads are unmapped. So for this title, the gain would come from making stages with vertex fetch relocatable, when their fetch descriptors are reached through the moved pointer, and from looking into why so many aliases are unreadable. I can run a build from a branch or share the counter patch if that helps; the full logs are available too. The analysis was done with AI assistance (Claude Code).
adriadam10 commented 2026-10-16 09:19:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T09:19:56Z.

Review: APPROVED


Thanks for the update. Checked against our last review:

  • Stack numbers on main 940eba9a2 (audio 34.5-35.7% → 42.8-45.7%) answer the performance point; the gain needs #5609 on top, so the two should land back to back.
  • Alias admission now stops after two probation admissions unless relocated hits validate. UnrelocatedAliasesStayOut fails when the probation condition is forced to always admit, and passes with the PR as is.
  • agc_shader_disk_cache now round-trips shaderDataUserWords.

On this head merged onto main, the Agc/AgcDriver scope builds and agc_shader_disk_cache and agc_driver_draw_cache_relocation pass here on Linux; thanks @milescoviello for the independent Linux run. Not verified by us: the D2R hit counts on this head (@mrfelek's last run was on the earlier one), and Windows runtime behaviour beyond CI. Merging once the full Build is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5545624325 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4943#pullrequestreview-5545624325). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-16T09:19:56Z. **Review:** APPROVED --- Thanks for the update. Checked against our last review: - Stack numbers on `main` `940eba9a2` (audio 34.5-35.7% → 42.8-45.7%) answer the performance point; the gain needs #5609 on top, so the two should land back to back. - Alias admission now stops after two probation admissions unless relocated hits validate. `UnrelocatedAliasesStayOut` fails when the probation condition is forced to always admit, and passes with the PR as is. - `agc_shader_disk_cache` now round-trips `shaderDataUserWords`. On this head merged onto `main`, the Agc/AgcDriver scope builds and `agc_shader_disk_cache` and `agc_driver_draw_cache_relocation` pass here on Linux; thanks @milescoviello for the independent Linux run. Not verified by us: the D2R hit counts on this head (@mrfelek's last run was on the earlier one), and Windows runtime behaviour beyond CI. Merging once the full Build is green.
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!4943
No description provided.