perf: Another Crab's Treasure beach is ~16 ms slower per frame since #20145's idle-store yield (draw recipes miss with template gone) #25535

Open
opened 2026-11-22 07:50:21 +00:00 by JJenkx · 0 comments
JJenkx commented 2026-11-22 07:50:21 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-11-22T07:50:21Z.


Title and scene

PPSA20423 (Another Crab's Treasure 02.000.000), the first beach after New Game, 1920x1080. A script presses cross every 6 s from 70 s through the menus and opening dialogue. Each capture is the 10 s window starting 330 s after launch (APS5_TRACE_SECONDS=330:10).

What is slow or what changed

Since #20145 (ef4b9389b6, "stop the idle store for a thread blocked on the GPU mutex"), frame p50 on this beach has gone from about 73 ms to about 88-99 ms.

Nearly all of the difference comes from its YieldToGpuMutexWaiters wrapper around the idle store. If StoreIdleResults passes stop to FlushAllPendingUntil again (a one-line revert in VulkanDevice.cpp, nothing else changed), current main runs at 74-76 ms.

Bisect. I bisected over the 427 first-parent merges that touch libSceAgcDriver between 71ce478956 (11-11, p50 71.9-72.5 ms) and 786bc3afa1 (11-21). Each step was one capture with a clean build.

  • Last good: 3c3225458d, 73.0 ms.
  • First bad: ef4b9389b6, the #20145 merge, 89.5 ms.
  • Builds below the boundary measured 71.4-73.0 ms; builds above it measured 78.4-93.7 ms.

A/B on current main. 786bc3afa1 against the same commit with only the yield reverted (local commit d7d940a8c1). Arms alternated, each in its own run directory with its own shader cache, same scene and settings:

Run Arm p50 frame p90 frame Presents Graphics.DrawWithRecipe per frame
1 main 88.4 ms 93.6 ms 113 0 ms
2 revert (cold cache) 75.9 ms 80.0 ms 132 0 ms
3 main 90.5 ms 103.4 ms 108 0 ms
4 revert 74.7 ms 78.2 ms 134 19.1 ms
5 main 98.7 ms 108.0 ms 102 0 ms
6 revert 74.0 ms 77.0 ms 135 18.6 ms

System CPU outside the game was 0-7% in every run.

Why it is slower here. These figures come from one extra pair with APS5_PROFILE_DRAW=1, used only for the counters; none of the frame times above come from it. Each is the average of three 10 s reports late in the beach:

Counter per 10 s main revert
[recipe] draw hits ~24,800 ~128,900
[recipe] pre-check misses: template gone ~69,000 0
[rescache] draws misses ~26,100 0
[rescache] revalidate fast-fail: pending image ~4,380 0
T1 refreshed, of which storage images ~4,260 (~1,360) 0

With the yield, the idle store in this scene presumably stops early most of the time, because queue 0 is about 95% busy and another thread is usually blocked on the GPU mutex. I didn't count the yields directly. The storage images it leaves pending then fail the fast revalidation proof (pending image). The T1 refresh that follows replaces the templates the draw recipes refer to, so about 69k recipe draws per 10 s miss with template gone and take the full draw path. Without the yield, the stores finish at idle, nothing is pending at revalidation, and the recipe path serves nearly every draw.

I'm not proposing a revert: #20145 measured large gains in Slay The Princess and Ratchet & Clank: Rift Apart. This scene seems to be the opposite case, where the deferred stores cost more on the draw path than the waits they save. Possible directions, untested:

  • yield only once the store has held the mutex for some minimum time;
  • keep the revalidation proof from rebuilding templates over images whose only pending state is an unfinished idle store.

Setup

  • Machine: Windows 11 Enterprise 22621, AMD Radeon RX 6700 XT, AMD driver 26.11.2, AMD Ryzen 9 5950X.
  • Build: WinLibs GCC 15.2 UCRT, Release, clean (dirty: false in every summary).
  • Environment: only APS5_PAD_INPUT_FILE and the trace switches, apart from the profiling pair noted above.

Summary lines

Frame p50 and presents from each run's aps5-summary.jsonl are in the table above; the commits match (786bc3afa1c8, d7d940a8c112). I can post the full lines or the traces if they help.

Traces

Kept locally (aps5-trace-*.json.gz for each run above and for every bisect step); available on request.

Capture

  • Caches were warm, except run 2 (the first run of the revert build). It was cold and still the fastest arm.
  • No other APS5_TRACE_* or APS5_PROFILE_* switch was set in the six timed runs.
  • All captures compared come from the same machine, scene and settings.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6539975377 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/25535). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-11-22T07:50:21Z. --- ### Title and scene PPSA20423 (Another Crab's Treasure 02.000.000), the first beach after New Game, 1920x1080. A script presses cross every 6 s from 70 s through the menus and opening dialogue. Each capture is the 10 s window starting 330 s after launch (`APS5_TRACE_SECONDS=330:10`). ### What is slow or what changed Since #20145 (`ef4b9389b6`, "stop the idle store for a thread blocked on the GPU mutex"), frame p50 on this beach has gone from about 73 ms to about 88-99 ms. Nearly all of the difference comes from its `YieldToGpuMutexWaiters` wrapper around the idle store. If `StoreIdleResults` passes `stop` to `FlushAllPendingUntil` again (a one-line revert in `VulkanDevice.cpp`, nothing else changed), current `main` runs at 74-76 ms. **Bisect.** I bisected over the 427 first-parent merges that touch `libSceAgcDriver` between `71ce478956` (11-11, p50 71.9-72.5 ms) and `786bc3afa1` (11-21). Each step was one capture with a clean build. - Last good: `3c3225458d`, 73.0 ms. - First bad: `ef4b9389b6`, the #20145 merge, 89.5 ms. - Builds below the boundary measured 71.4-73.0 ms; builds above it measured 78.4-93.7 ms. **A/B on current `main`.** `786bc3afa1` against the same commit with only the yield reverted (local commit `d7d940a8c1`). Arms alternated, each in its own run directory with its own shader cache, same scene and settings: | Run | Arm | p50 frame | p90 frame | Presents | `Graphics.DrawWithRecipe` per frame | |---|---|---|---|---|---| | 1 | `main` | 88.4 ms | 93.6 ms | 113 | 0 ms | | 2 | revert (cold cache) | 75.9 ms | 80.0 ms | 132 | 0 ms | | 3 | `main` | 90.5 ms | 103.4 ms | 108 | 0 ms | | 4 | revert | 74.7 ms | 78.2 ms | 134 | 19.1 ms | | 5 | `main` | 98.7 ms | 108.0 ms | 102 | 0 ms | | 6 | revert | 74.0 ms | 77.0 ms | 135 | 18.6 ms | System CPU outside the game was 0-7% in every run. **Why it is slower here.** These figures come from one extra pair with `APS5_PROFILE_DRAW=1`, used only for the counters; none of the frame times above come from it. Each is the average of three 10 s reports late in the beach: | Counter per 10 s | `main` | revert | |---|---|---| | `[recipe] draw` hits | ~24,800 | ~128,900 | | `[recipe]` pre-check misses: template gone | ~69,000 | 0 | | `[rescache] draws` misses | ~26,100 | 0 | | `[rescache] revalidate` fast-fail: pending image | ~4,380 | 0 | | T1 refreshed, of which storage images | ~4,260 (~1,360) | 0 | With the yield, the idle store in this scene presumably stops early most of the time, because queue 0 is about 95% busy and another thread is usually blocked on the GPU mutex. I didn't count the yields directly. The storage images it leaves pending then fail the fast revalidation proof (`pending image`). The T1 refresh that follows replaces the templates the draw recipes refer to, so about 69k recipe draws per 10 s miss with `template gone` and take the full draw path. Without the yield, the stores finish at idle, nothing is pending at revalidation, and the recipe path serves nearly every draw. I'm not proposing a revert: #20145 measured large gains in Slay The Princess and Ratchet & Clank: Rift Apart. This scene seems to be the opposite case, where the deferred stores cost more on the draw path than the waits they save. Possible directions, untested: - yield only once the store has held the mutex for some minimum time; - keep the revalidation proof from rebuilding templates over images whose only pending state is an unfinished idle store. **Setup** - Machine: Windows 11 Enterprise 22621, AMD Radeon RX 6700 XT, AMD driver 26.11.2, AMD Ryzen 9 5950X. - Build: WinLibs GCC 15.2 UCRT, Release, clean (`dirty: false` in every summary). - Environment: only `APS5_PAD_INPUT_FILE` and the trace switches, apart from the profiling pair noted above. ### Summary lines Frame p50 and presents from each run's `aps5-summary.jsonl` are in the table above; the commits match (`786bc3afa1c8`, `d7d940a8c112`). I can post the full lines or the traces if they help. ### Traces Kept locally (`aps5-trace-*.json.gz` for each run above and for every bisect step); available on request. ### Capture - Caches were warm, except run 2 (the first run of the revert build). It was cold and still the fastest arm. - No other `APS5_TRACE_*` or `APS5_PROFILE_*` switch was set in the six timed runs. - All captures compared come from the same machine, scene and settings. AI-assisted: yes.
Sign in to join this conversation.
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#25535
No description provided.