perf: PS5 OpenGL Showcase (PPSA99005) at 3 FPS: the unused second slice of each color target overlaps the next target, so every pass writes back and re-uploads #6189

Closed
opened 2026-10-15 01:23:08 +00:00 by MiguelAdolfsen · 2 comments
MiguelAdolfsen commented 2026-10-15 01:23:08 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MiguelAdolfsen on 2026-10-15T01:23:08Z.


Title and scene

PPSA99005 (PS5 OpenGL Showcase), from launch with no input; the window is seconds 15–25 after the first present. The same captures for PPSA99420 (PS5MC) and PPSA99082 (OpenNOW PS5, sign-in screen), which embed the same ps5-opengl runtime.

What is slow or what changed

On main eea428ca8 the Showcase takes about 320 ms per frame in the capture window. A storage round trip repeats on every pass:

  1. ps5-opengl sets CB_COLOR_ATTRIB3.MIP0_DEPTH to SLICE_MAX + 1 on every tiled color target (ps5_agc_runtime_backend.c#L450-L456, v1.0.2). A view of slice 0 therefore declares a 2-slice array, and the title only ever renders slice 0.
  2. Since #3524 (eba67d413), DecodeColorBuffer keeps the array (arrayLastSlice = 1, State.cpp:1150). The resident lookup in Draw.cpp then attaches the storage image of the whole declared array through ArraySurfaceForTarget.
  3. The title allocates its targets back to back, each sized for one slice. The phantom slice 1 of each array image covers the next target (map below).
  4. Each draw into one of these targets runs StorageTexture::Refresh. It first flushes the overlapped images' pending results (write-back reason storage refresh). Then it writes back its own stamped units (refresh, ending in SubmitAndWait). Finally it uploads the whole array image from guest memory again (upload reason cpu), because the neighbour's write-back stamped blocks inside its slice 1. The next target then does the same against this one.

The 4K and 1080p scene targets also get a separate 2D image for sampling (dim=1 next to dim=2 at 0x21f600000, 0x226600000 and 0x227c00000), which round-trips with the array image the same way.

On Windows the targets are direct host imports, which are compared instead of write-tracked since #5596 (#5692; #5851 would change that). GuestMemory::UnchangedSince returns false for memory the write tracker doesn't cover. So the sampled lookup of a pending target in cachedTexture and its present in PresentDisplayBuffer also run the whole Refresh, and each of them flushes the neighbour's results out of the phantom slice. The runs here and #5745 are all on Windows; I haven't measured Linux or #5851.

To confirm the cause, I gated the array path on lastSlice != 0, so that a single-slice view decodes as a 2D target again. This is a probe, not a proposed fix (see Directions below):

--- a/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
+++ b/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
@@ -1147,7 +1147,7 @@
-    } else if ((attrib3 & 0x1fffu) != 0) {
+    } else if ((attrib3 & 0x1fffu) != 0 && lastSlice != 0) {

Template captures (APS5_TRACE_SECONDS=15:10). The full summary lines and digests are below.

Title main p50 / p90 ms probe p50 / p90 ms GPU busy per present, main → probe queue worker busy, main → probe
PPSA99005 Showcase 319.5 / 350.1 110.5 / 124.8 85.2 → 59.7 ms 79.5 → 41.4 %
PPSA99420 PS5MC 63.2 / 83.9 16.7 / 17.0 (vsync) 9.2 → 9.2 ms 80.8 → 18.9 %
PPSA99082 OpenNOW 48.2 / 72.3 24.9 / 37.2 0.9 → 0.3 ms 53.9 → 7.2 %

On main, Graphics.Draw.draw_and_resource_release takes 253 ms of the Showcase's frame. With the probe it takes 30 ms, and the frame is bound by waiting on the GPU (Driver.WorkerWait 65 ms, GPU busy 59.7 ms). StorageTexture writeback submit / upload submit lines in the window runs: Showcase 98 / 647 → 0 / 0; PS5MC 467 / 236 → 0 / 0 (OpenNOW's log goes to its console, so it isn't counted).

Separate 45 s runs without a trace window (APS5_TRACE_SUMMARY_EVERY=15, frame dumps on), two 15 s intervals each:

Title main p50 / p90 ms probe p50 / p90 ms write-backs / uploads, main → probe
PPSA99005 Showcase 289.4 / 305.2, 292.6 / 303.6 86.4 / 92.3, 87.1 / 91.8 152 / 1109 → 0 / 0
PPSA99420 PS5MC 55.1 / 59.2, 54.9 / 57.5 16.7 / 17.0, 16.7 / 17.0 894 / 450 → 0 / 0
PPSA99082 OpenNOW 43.3 / 68.0, 64.5 / 70.0 25.6 / 29.0, 25.9 / 28.5 491 / 3 → 0 / 0

The frames are the same with and without the probe (main left, probe right; Showcase, PS5MC, OpenNOW):

Image

APS5_PROFILE_DRAW=1 on the Showcase, main, one 10 s window:

[draws] 613 draws over 10 s (613 recorded avg 12833 us, ...): ... readTarget=3601.2ms (580 resident lookups, 288 of them >= 1 ms = 3565.7; target lookups: full-scissor 580 / partial 0 / pages walked 5493504 / ...)
[storage] uploads by path (count/MiB, 10 s): clear 0/0.0 direct 81/2755.8 cpu 240/7876.0 alias 0/0.0; by reason: cpu 321/10631.8; write-backs by reason (count/MiB): refresh 80/3062.0 storage refresh 305/2733.4; 343 write-backs GPU-direct, ...

That is 10.4 GiB uploaded and 5.7 GiB written back in 10 s, for 33 frames. readTarget, the resident lookup that calls Refresh, takes 3.6 s of the 10 s.

The Showcase's array images ([src/Texture.cpp:1088 StorageTexture]; layers prints depthOrLastArray, so layers=1 dim=2 is a 2-slice array):

StorageTexture address=0x21f600000 3840x2160 mips=1 mip=0 layers=1 base=0 dim=2 tile=7 format=71 vk=97
StorageTexture address=0x225600000 1920x1080 mips=1 mip=0 layers=1 base=0 dim=2 tile=7 format=71 vk=97

Overlap map. Every target uses tile mode 64KB_R_X; slice sizes are rounded up to whole 64 KiB blocks.

Array image Format Slice size Phantom slice 1 Overlaps
0x208000000 3840x2160 RGBA8 31.9 MiB 0x209fe0000–0x20bfc0000 0x20a000000 (the other 4K RGBA8 target)
0x21f600000 3840x2160 RGBA16F 63.75 MiB 0x2235c0000–0x227580000 0x225600000, 0x226600000
0x225600000 1920x1080 RGBA16F 15.9 MiB 0x2265f0000–0x2275e0000 0x226600000
0x226600000 1920x1080 RGBA16F 15.9 MiB 0x2275f0000–0x2285e0000 0x227600000, 0x227c00000, 0x228200000, 0x228400000
0x227600000 960x540 RGBA16F 4.5 MiB 0x227a80000–0x227f00000 0x227c00000
0x227c00000 960x540 RGBA16F 4.5 MiB 0x228080000–0x228500000 0x228200000, 0x228400000
0x228200000 480x270 RGBA16F 1.25 MiB 0x228340000–0x228480000 0x228400000
0x228400000 480x270 RGBA16F 1.25 MiB 0x228540000–0x228680000 0x228600000

The 135p and smaller targets are 2 MiB apart, wider than two of their slices, so they don't overlap.

Other titles that embed ps5-opengl also declare 2-slice targets but don't slow down. Their 1080p RGBA8 slices (8.4 MiB) fit twice into the 32 MiB spacing, so nothing overlaps and they have 0 write-backs: OliSe Player (PPSA01153), Stremio Plus, PokeMMO Prospero and Cloud Play (PPSA99600). The cost is not specific to NVIDIA. #5745 (Radeon 860M, main d8888df9b, after #3524) lists OpenNOW at 25.8 FPS, in the same range as main here.

Directions.

  • Fix it in ps5-opengl. MIP0_DEPTH holds the last slice, so a single 2D target should set it to 0, or to SLICE_MAX for a real array. Hardware writes only the view's slices, so the extra declared slice is probably free on a PS5, which would explain why nobody noticed. This fixes new builds, but releases already in the catalog keep the cost. I can report it there.
  • Treat a slice-0-only view as 2D (the probe). This removes the cost for these titles, but it breaks what #3524 tests. SampleSliceZero (ArrayLayerTarget.cpp:295-306) draws into slice 0 of a real 2-layer array and requires the draw to land in the array image. Its DecodeTarget check at line 196 requires arrayLastSlice == Layers - 1 for that view, and the probe leaves it 0. I found this by reading the code and haven't run the tests with the probe.
  • Keep the array image, but don't let its unused layers own guest memory. Overlap lookups, refreshes and uploads would cover only the layers that have been rendered or sampled. A declared layer that is never touched would then not collide with the surface allocated over it. This keeps #3524's behaviour for real arrays, but needs per-layer ranges in StorageTexture's pending lookup and upload.
  • Clamp a declared array whose later layers overlap a live surface of another shape. With XOR tile modes, a 2D surface at slice N's address doesn't hold slice N's texels (the point of #3524), so such a surface can't be that layer. This is less work than per-layer ranges, but it's a heuristic, and memory reused over time makes the "live" check matter.

I'd lean to the third, and would report the first upstream either way.

I have a prototype of the third. A draw into a slice, a 2D view of slice 0 and a present of slice 0 refresh only that slice's layers, so results pending over the other layers stay pending. The byte compares of untracked memory are memoized per layer range, as they already are for the whole image. In the same captures it gives 89.6 / 16.7 / 25.6 ms p50 for the Showcase, PS5MC and OpenNOW, with the same frames, and the agc_driver tests pass on the RTX 4070. I can open it as a pull request with its own summary lines and traces.

Summary lines

{"commit":"eea428ca855f","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 595.79","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":45,"ms":10009.018},"presents":31,"frame_ms":{"p50":319.510,"p90":350.113,"p99":364.014,"max":364.014},"gpu_busy_ms_per_present":85.248,"worker_busy_pct":{"queue worker 0x0":79.539},"top_phases_ms_per_frame":{"Driver.Packet":256.367,"Driver.Packet.draw":255.091,"Driver.Draw":255.055,"Driver.Draw.draw_and_resource_release":253.640,"Graphics.Draw":253.583,"Graphics.Draw.draw_and_resource_release":253.167,"Graphics.Wait":37.500,"Graphics.Wait.fence_wait":37.434},"trace_dropped":false,"trace":"aps5-trace-eea428ca855f-26312.json.gz"}
{"commit":"eea428ca855f","dirty":true,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 595.79","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":134,"ms":10118.666},"presents":91,"frame_ms":{"p50":110.531,"p90":124.755,"p99":143.879,"max":143.879},"gpu_busy_ms_per_present":59.726,"worker_busy_pct":{"queue worker 0x0":41.386},"top_phases_ms_per_frame":{"Driver.Packet":45.520,"Driver.Packet.draw":43.250,"Driver.Draw":43.214,"Driver.Draw.draw_and_resource_release":42.543,"Graphics.Draw":30.215,"Graphics.Draw.draw_and_resource_release":29.772,"Vulkan.DrawFromRecipe":12.288,"Graphics.DrawWithRecipe":12.281},"trace_dropped":false,"trace":"aps5-trace-eea428ca855f-6000.json.gz"}
{"commit":"eea428ca855f","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 595.79","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":241,"ms":10043.953},"presents":161,"frame_ms":{"p50":63.215,"p90":83.932,"p99":96.492,"max":105.777},"gpu_busy_ms_per_present":9.184,"worker_busy_pct":{"queue worker 0x0":80.829},"top_phases_ms_per_frame":{"Driver.Packet":50.381,"Driver.Packet.draw":49.982,"Driver.Draw":49.951,"Driver.Draw.draw_and_resource_release":47.936,"Graphics.Draw":47.877,"Graphics.Draw.draw_and_resource_release":47.716,"Graphics.Wait":17.384,"Graphics.Wait.fence_wait":17.380},"trace_dropped":false,"trace":"aps5-trace-eea428ca855f-44008.json.gz"}
{"commit":"eea428ca855f","dirty":true,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 595.79","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":804,"ms":10009.823},"presents":600,"frame_ms":{"p50":16.677,"p90":17.017,"p99":19.700,"max":22.610},"gpu_busy_ms_per_present":9.179,"worker_busy_pct":{"queue worker 0x0":18.926},"top_phases_ms_per_frame":{"Driver.Present":4.394,"Driver.Present.present_display_buffer":3.406,"Driver.Packet":3.119,"Driver.Packet.draw":2.732,"Driver.Draw":2.706,"Driver.Draw.draw_and_resource_release":2.176,"Graphics.Draw":1.707,"Graphics.Draw.draw_and_resource_release":1.628},"trace_dropped":false,"trace":"aps5-trace-eea428ca855f-43880.json.gz"}
{"commit":"eea428ca855f","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 595.79","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":317,"ms":10019.020},"presents":195,"frame_ms":{"p50":48.153,"p90":72.271,"p99":113.401,"max":120.628},"gpu_busy_ms_per_present":0.903,"worker_busy_pct":{"queue worker 0x0":53.859},"top_phases_ms_per_frame":{"Driver.Packet":27.644,"Driver.Packet.draw":27.557,"Driver.Draw":27.555,"Driver.Draw.draw_and_resource_release":27.465,"Graphics.Draw":27.461,"Graphics.Draw.draw_and_resource_release":27.455,"Graphics.Wait":17.213,"Graphics.Wait.fence_wait":17.211},"trace_dropped":false,"trace":"aps5-trace-eea428ca855f-30556.json.gz"}
{"commit":"eea428ca855f","dirty":true,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 595.79","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":504,"ms":10026.594},"presents":356,"frame_ms":{"p50":24.940,"p90":37.185,"p99":63.933,"max":96.982},"gpu_busy_ms_per_present":0.310,"worker_busy_pct":{"queue worker 0x0":7.230},"top_phases_ms_per_frame":{"Driver.Present":3.630,"Driver.Present.present_display_buffer":3.363,"Driver.Packet":1.967,"Driver.Packet.draw":1.856,"Driver.Draw":1.852,"Driver.Draw.draw_and_resource_release":1.809,"Vulkan.DrawFromRecipe":1.807,"Graphics.DrawWithRecipe":1.804},"trace_dropped":false,"trace":"aps5-trace-eea428ca855f-4528.json.gz"}

Traces

In the order of the summary lines: Showcase main, Showcase probe, PS5MC main, PS5MC probe, OpenNOW main, OpenNOW probe (the probe lines are dirty). Each file name is the title, the build, then the original aps5-trace-eea428ca855f-<pid>.json.gz.

Digest

python tools/trace_digest.py <trace>, cut to the headline, threads and largest slices. The full output is in digests.txt.

PPSA99005 Showcase, main

seconds 15:10 from present 45: 31 presents, frame p50 319.5 / p90 350.1 / p99 364.0 / max 364.0 ms, GPU busy 85.2 ms per present

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 218.9 (68 %) 103.2 (32 %) 0.8 2.3 Driver.Packet 256.0, Driver.EndSubmission 0.4
presenter 6.3 (2 %) 3.1 (1 %) 313.5 0.1 Driver.Present 9.4
gpu 86.0 (27 %) 0.0 (0 %) 236.9 0.0 batch 86.0

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 256.0, Driver.Packet.draw 255.1, Driver.Draw 255.1, Driver.Draw.draw_and_resource_release 253.6, Graphics.Draw 253.6, Graphics.Draw.draw_and_resource_release 253.2, batch 86.0, Driver.WorkerWait 65.7, Driver.WorkerWait.idle_and_completion_poll 65.6, Graphics.Wait 37.5

PPSA99005 Showcase, probe

seconds 15:10 from present 134: 91 presents, frame p50 110.5 / p90 124.8 / p99 143.9 / max 143.9 ms, GPU busy 59.7 ms per present

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 45.6 (41 %) 65.0 (58 %) 0.6 1.5 Driver.Packet 45.1, Driver.EndSubmission 0.5
presenter 3.3 (3 %) 0.3 (0 %) 107.6 0.1 Driver.Present 3.6
gpu 59.1 (53 %) 0.0 (0 %) 52.1 0.0 batch 59.1

Largest slices (ms per frame, inclusive, all threads): Driver.WorkerWait 65.0, Driver.WorkerWait.idle_and_completion_poll 64.9, batch 59.1, Driver.Packet 45.1, Driver.Packet.draw 43.3, Driver.Draw 43.2, Driver.Draw.draw_and_resource_release 42.5, Graphics.Draw 30.2, Graphics.Draw.draw_and_resource_release 29.8, Vulkan.DrawFromRecipe 12.3

PPSA99420 PS5MC, main

seconds 15:10 from present 241: 161 presents, frame p50 63.2 / p90 83.9 / p99 96.5 / max 105.8 ms, GPU busy 9.2 ms per present

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 32.7 (52 %) 29.2 (47 %) 0.5 4.1 Driver.Packet 50.1, Driver.EndSubmission 0.0
presenter 7.1 (11 %) 2.4 (4 %) 52.9 0.1 Driver.Present 9.5
gpu 9.2 (15 %) 0.0 (0 %) 53.2 0.0 batch 9.2

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 50.1, Driver.Packet.draw 50.0, Driver.Draw 50.0, Driver.Draw.draw_and_resource_release 47.9, Graphics.Draw 47.9, Graphics.Draw.draw_and_resource_release 47.7, Graphics.Wait 17.4, Graphics.Wait.fence_wait 17.4, Driver.WorkerWait 11.8, Driver.WorkerWait.idle_and_completion_poll 11.8

PPSA99420 PS5MC, probe

seconds 15:10 from present 804: 600 presents, frame p50 16.7 / p90 17.0 / p99 19.7 / max 22.6 ms, GPU busy 9.2 ms per present

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 2.9 (17 %) 13.4 (80 %) 0.4 1.0 Driver.Packet 2.9, Driver.EndSubmission 0.0
presenter 3.5 (21 %) 0.9 (5 %) 12.3 0.1 Driver.Present 4.4
gpu 9.2 (55 %) 0.0 (0 %) 7.5 0.0 batch 9.2

Largest slices (ms per frame, inclusive, all threads): Driver.WorkerWait 13.4, Driver.WorkerWait.idle_and_completion_poll 13.4, batch 9.2, Driver.Present 4.4, Driver.Present.present_display_buffer 3.4, Driver.Packet 2.9, Driver.Packet.draw 2.7, Driver.Draw 2.7, Driver.Draw.draw_and_resource_release 2.2, Graphics.Draw 1.7

PPSA99082 OpenNOW, main

seconds 15:10 from present 317: 195 presents, frame p50 48.2 / p90 72.3 / p99 113.4 / max 120.6 ms, GPU busy 0.9 ms per present

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 10.4 (20 %) 40.9 (80 %) 0.1 0.1 Driver.Packet 27.6, Driver.EndSubmission 0.0
presenter 6.0 (12 %) 0.6 (1 %) 44.7 0.1 Driver.Present 6.7
gpu 0.9 (2 %) 0.0 (0 %) 50.5 0.0 batch 0.9

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 27.6, Driver.Packet.draw 27.6, Driver.Draw 27.6, Driver.Draw.draw_and_resource_release 27.5, Graphics.Draw 27.5, Graphics.Draw.draw_and_resource_release 27.5, Driver.WorkerWait 23.7, Driver.WorkerWait.idle_and_completion_poll 23.7, Graphics.Wait 17.2, Graphics.Wait.fence_wait 17.2

PPSA99082 OpenNOW, probe

seconds 15:10 from present 504: 356 presents, frame p50 24.9 / p90 37.2 / p99 63.9 / max 97.0 ms, GPU busy 0.3 ms per present

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 2.0 (7 %) 26.1 (93 %) 0.1 0.1 Driver.Packet 2.0, Driver.EndSubmission 0.1
presenter 3.5 (12 %) 0.2 (1 %) 24.5 0.1 Driver.Present 3.6
gpu 0.3 (1 %) 0.0 (0 %) 27.9 0.0 batch 0.3

Largest slices (ms per frame, inclusive, all threads): Driver.WorkerWait 26.1, Driver.WorkerWait.idle_and_completion_poll 26.1, Driver.Present 3.6, Driver.Present.present_display_buffer 3.4, Driver.Packet 2.0, Driver.Packet.draw 1.9, Driver.Draw 1.9, Driver.Draw.draw_and_resource_release 1.8, Vulkan.DrawFromRecipe 1.8, Graphics.DrawWithRecipe 1.8

Worker stacks

Not sampled. The digest already puts the queue worker's time in Graphics.Draw.draw_and_resource_release, and the [draws] line above puts it in readTarget.

Capture

  • The caches were warm (the scene ran once and the title was restarted)
  • No other APS5_TRACE_* or APS5_PROFILE_* switch was set and the log was not redirected
  • Captures compared here come from the same machine, scene and settings

Setup: Windows 11 (26200), Intel i5-14400F, NVIDIA GeForce RTX 4070 (driver 595.79), display 3440x1440 at 59 Hz, video output 3840x2160. WinLibs GCC 15.2.0 r7, Release. Catalog releases relinked with --windows. Audio muted with SDL_AUDIODRIVER=dummy. Each title was launched in its own console after a 30 s warm-up run. The probe build is eea428ca8 plus the diff above.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5858408506 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6189). Originally posted by [MiguelAdolfsen](https://github.com/MiguelAdolfsen) on 2026-10-15T01:23:08Z. --- ### Title and scene PPSA99005 (PS5 OpenGL Showcase), from launch with no input; the window is seconds 15–25 after the first present. The same captures for PPSA99420 (PS5MC) and PPSA99082 (OpenNOW PS5, sign-in screen), which embed the same ps5-opengl runtime. ### What is slow or what changed On `main` eea428ca8 the Showcase takes about 320 ms per frame in the capture window. A storage round trip repeats on every pass: 1. ps5-opengl sets `CB_COLOR_ATTRIB3.MIP0_DEPTH` to `SLICE_MAX + 1` on every tiled color target ([ps5_agc_runtime_backend.c#L450-L456](https://github.com/blackbearreloaded/ps5-opengl/blob/v1.0.2/src/platform/ps5_agc_runtime_backend.c#L450-L456), v1.0.2). A view of slice 0 therefore declares a 2-slice array, and the title only ever renders slice 0. 2. Since #3524 (eba67d413), `DecodeColorBuffer` keeps the array (`arrayLastSlice = 1`, [State.cpp:1150](https://github.com/boykopovar/AnyPS5/blob/eea428ca855fb59a3edd394bab9abf99165590f1/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L1150)). The resident lookup in `Draw.cpp` then attaches the storage image of the whole declared array through `ArraySurfaceForTarget`. 3. The title allocates its targets back to back, each sized for one slice. The phantom slice 1 of each array image covers the next target (map below). 4. Each draw into one of these targets runs `StorageTexture::Refresh`. It first flushes the overlapped images' pending results (write-back reason `storage refresh`). Then it writes back its own stamped units (`refresh`, ending in `SubmitAndWait`). Finally it uploads the whole array image from guest memory again (upload reason `cpu`), because the neighbour's write-back stamped blocks inside its slice 1. The next target then does the same against this one. The 4K and 1080p scene targets also get a separate 2D image for sampling (`dim=1` next to `dim=2` at 0x21f600000, 0x226600000 and 0x227c00000), which round-trips with the array image the same way. On Windows the targets are direct host imports, which are compared instead of write-tracked since #5596 (#5692; #5851 would change that). `GuestMemory::UnchangedSince` returns false for memory the write tracker doesn't cover. So the sampled lookup of a pending target in `cachedTexture` and its present in `PresentDisplayBuffer` also run the whole `Refresh`, and each of them flushes the neighbour's results out of the phantom slice. The runs here and #5745 are all on Windows; I haven't measured Linux or #5851. To confirm the cause, I gated the array path on `lastSlice != 0`, so that a single-slice view decodes as a 2D target again. This is a probe, not a proposed fix (see Directions below): ```diff --- a/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp @@ -1147,7 +1147,7 @@ - } else if ((attrib3 & 0x1fffu) != 0) { + } else if ((attrib3 & 0x1fffu) != 0 && lastSlice != 0) { ``` Template captures (`APS5_TRACE_SECONDS=15:10`). The full summary lines and digests are below. | Title | `main` p50 / p90 ms | probe p50 / p90 ms | GPU busy per present, main → probe | queue worker busy, main → probe | |---|---|---|---|---| | PPSA99005 Showcase | 319.5 / 350.1 | 110.5 / 124.8 | 85.2 → 59.7 ms | 79.5 → 41.4 % | | PPSA99420 PS5MC | 63.2 / 83.9 | 16.7 / 17.0 (vsync) | 9.2 → 9.2 ms | 80.8 → 18.9 % | | PPSA99082 OpenNOW | 48.2 / 72.3 | 24.9 / 37.2 | 0.9 → 0.3 ms | 53.9 → 7.2 % | On `main`, `Graphics.Draw.draw_and_resource_release` takes 253 ms of the Showcase's frame. With the probe it takes 30 ms, and the frame is bound by waiting on the GPU (`Driver.WorkerWait` 65 ms, GPU busy 59.7 ms). `StorageTexture writeback submit` / `upload submit` lines in the window runs: Showcase 98 / 647 → 0 / 0; PS5MC 467 / 236 → 0 / 0 (OpenNOW's log goes to its console, so it isn't counted). Separate 45 s runs without a trace window (`APS5_TRACE_SUMMARY_EVERY=15`, frame dumps on), two 15 s intervals each: | Title | `main` p50 / p90 ms | probe p50 / p90 ms | write-backs / uploads, main → probe | |---|---|---|---| | PPSA99005 Showcase | 289.4 / 305.2, 292.6 / 303.6 | 86.4 / 92.3, 87.1 / 91.8 | 152 / 1109 → 0 / 0 | | PPSA99420 PS5MC | 55.1 / 59.2, 54.9 / 57.5 | 16.7 / 17.0, 16.7 / 17.0 | 894 / 450 → 0 / 0 | | PPSA99082 OpenNOW | 43.3 / 68.0, 64.5 / 70.0 | 25.6 / 29.0, 25.9 / 28.5 | 491 / 3 → 0 / 0 | The frames are the same with and without the probe (`main` left, probe right; Showcase, PS5MC, OpenNOW): <img width="1304" height="1112" alt="Image" src="https://github.com/user-attachments/assets/3b613e21-9306-4c00-acd9-4ef5adc76b4f" /> `APS5_PROFILE_DRAW=1` on the Showcase, `main`, one 10 s window: ``` [draws] 613 draws over 10 s (613 recorded avg 12833 us, ...): ... readTarget=3601.2ms (580 resident lookups, 288 of them >= 1 ms = 3565.7; target lookups: full-scissor 580 / partial 0 / pages walked 5493504 / ...) [storage] uploads by path (count/MiB, 10 s): clear 0/0.0 direct 81/2755.8 cpu 240/7876.0 alias 0/0.0; by reason: cpu 321/10631.8; write-backs by reason (count/MiB): refresh 80/3062.0 storage refresh 305/2733.4; 343 write-backs GPU-direct, ... ``` That is 10.4 GiB uploaded and 5.7 GiB written back in 10 s, for 33 frames. `readTarget`, the resident lookup that calls `Refresh`, takes 3.6 s of the 10 s. The Showcase's array images (`[src/Texture.cpp:1088 StorageTexture]`; `layers` prints `depthOrLastArray`, so `layers=1 dim=2` is a 2-slice array): ``` StorageTexture address=0x21f600000 3840x2160 mips=1 mip=0 layers=1 base=0 dim=2 tile=7 format=71 vk=97 StorageTexture address=0x225600000 1920x1080 mips=1 mip=0 layers=1 base=0 dim=2 tile=7 format=71 vk=97 ``` Overlap map. Every target uses tile mode 64KB_R_X; slice sizes are rounded up to whole 64 KiB blocks. | Array image | Format | Slice size | Phantom slice 1 | Overlaps | |---|---|---|---|---| | 0x208000000 3840x2160 | RGBA8 | 31.9 MiB | 0x209fe0000–0x20bfc0000 | 0x20a000000 (the other 4K RGBA8 target) | | 0x21f600000 3840x2160 | RGBA16F | 63.75 MiB | 0x2235c0000–0x227580000 | 0x225600000, 0x226600000 | | 0x225600000 1920x1080 | RGBA16F | 15.9 MiB | 0x2265f0000–0x2275e0000 | 0x226600000 | | 0x226600000 1920x1080 | RGBA16F | 15.9 MiB | 0x2275f0000–0x2285e0000 | 0x227600000, 0x227c00000, 0x228200000, 0x228400000 | | 0x227600000 960x540 | RGBA16F | 4.5 MiB | 0x227a80000–0x227f00000 | 0x227c00000 | | 0x227c00000 960x540 | RGBA16F | 4.5 MiB | 0x228080000–0x228500000 | 0x228200000, 0x228400000 | | 0x228200000 480x270 | RGBA16F | 1.25 MiB | 0x228340000–0x228480000 | 0x228400000 | | 0x228400000 480x270 | RGBA16F | 1.25 MiB | 0x228540000–0x228680000 | 0x228600000 | The 135p and smaller targets are 2 MiB apart, wider than two of their slices, so they don't overlap. Other titles that embed ps5-opengl also declare 2-slice targets but don't slow down. Their 1080p RGBA8 slices (8.4 MiB) fit twice into the 32 MiB spacing, so nothing overlaps and they have 0 write-backs: OliSe Player (PPSA01153), Stremio Plus, PokeMMO Prospero and Cloud Play (PPSA99600). The cost is not specific to NVIDIA. #5745 (Radeon 860M, `main` d8888df9b, after #3524) lists OpenNOW at 25.8 FPS, in the same range as `main` here. **Directions.** - **Fix it in ps5-opengl.** `MIP0_DEPTH` holds the last slice, so a single 2D target should set it to 0, or to `SLICE_MAX` for a real array. Hardware writes only the view's slices, so the extra declared slice is probably free on a PS5, which would explain why nobody noticed. This fixes new builds, but releases already in the catalog keep the cost. I can report it there. - **Treat a slice-0-only view as 2D (the probe).** This removes the cost for these titles, but it breaks what #3524 tests. `SampleSliceZero` ([ArrayLayerTarget.cpp:295-306](https://github.com/boykopovar/AnyPS5/blob/eea428ca855fb59a3edd394bab9abf99165590f1/core/libs/prx/libSceAgcDriver/tests/execution/ArrayLayerTarget.cpp#L295-L306)) draws into slice 0 of a real 2-layer array and requires the draw to land in the array image. Its `DecodeTarget` check at line 196 requires `arrayLastSlice == Layers - 1` for that view, and the probe leaves it 0. I found this by reading the code and haven't run the tests with the probe. - **Keep the array image, but don't let its unused layers own guest memory.** Overlap lookups, refreshes and uploads would cover only the layers that have been rendered or sampled. A declared layer that is never touched would then not collide with the surface allocated over it. This keeps #3524's behaviour for real arrays, but needs per-layer ranges in `StorageTexture`'s pending lookup and upload. - **Clamp a declared array whose later layers overlap a live surface of another shape.** With XOR tile modes, a 2D surface at slice N's address doesn't hold slice N's texels (the point of #3524), so such a surface can't be that layer. This is less work than per-layer ranges, but it's a heuristic, and memory reused over time makes the "live" check matter. I'd lean to the third, and would report the first upstream either way. I have a prototype of the third. A draw into a slice, a 2D view of slice 0 and a present of slice 0 refresh only that slice's layers, so results pending over the other layers stay pending. The byte compares of untracked memory are memoized per layer range, as they already are for the whole image. In the same captures it gives 89.6 / 16.7 / 25.6 ms p50 for the Showcase, PS5MC and OpenNOW, with the same frames, and the agc_driver tests pass on the RTX 4070. I can open it as a pull request with its own summary lines and traces. ### Summary lines ```json {"commit":"eea428ca855f","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 595.79","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":45,"ms":10009.018},"presents":31,"frame_ms":{"p50":319.510,"p90":350.113,"p99":364.014,"max":364.014},"gpu_busy_ms_per_present":85.248,"worker_busy_pct":{"queue worker 0x0":79.539},"top_phases_ms_per_frame":{"Driver.Packet":256.367,"Driver.Packet.draw":255.091,"Driver.Draw":255.055,"Driver.Draw.draw_and_resource_release":253.640,"Graphics.Draw":253.583,"Graphics.Draw.draw_and_resource_release":253.167,"Graphics.Wait":37.500,"Graphics.Wait.fence_wait":37.434},"trace_dropped":false,"trace":"aps5-trace-eea428ca855f-26312.json.gz"} {"commit":"eea428ca855f","dirty":true,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 595.79","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":134,"ms":10118.666},"presents":91,"frame_ms":{"p50":110.531,"p90":124.755,"p99":143.879,"max":143.879},"gpu_busy_ms_per_present":59.726,"worker_busy_pct":{"queue worker 0x0":41.386},"top_phases_ms_per_frame":{"Driver.Packet":45.520,"Driver.Packet.draw":43.250,"Driver.Draw":43.214,"Driver.Draw.draw_and_resource_release":42.543,"Graphics.Draw":30.215,"Graphics.Draw.draw_and_resource_release":29.772,"Vulkan.DrawFromRecipe":12.288,"Graphics.DrawWithRecipe":12.281},"trace_dropped":false,"trace":"aps5-trace-eea428ca855f-6000.json.gz"} {"commit":"eea428ca855f","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 595.79","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":241,"ms":10043.953},"presents":161,"frame_ms":{"p50":63.215,"p90":83.932,"p99":96.492,"max":105.777},"gpu_busy_ms_per_present":9.184,"worker_busy_pct":{"queue worker 0x0":80.829},"top_phases_ms_per_frame":{"Driver.Packet":50.381,"Driver.Packet.draw":49.982,"Driver.Draw":49.951,"Driver.Draw.draw_and_resource_release":47.936,"Graphics.Draw":47.877,"Graphics.Draw.draw_and_resource_release":47.716,"Graphics.Wait":17.384,"Graphics.Wait.fence_wait":17.380},"trace_dropped":false,"trace":"aps5-trace-eea428ca855f-44008.json.gz"} {"commit":"eea428ca855f","dirty":true,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 595.79","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":804,"ms":10009.823},"presents":600,"frame_ms":{"p50":16.677,"p90":17.017,"p99":19.700,"max":22.610},"gpu_busy_ms_per_present":9.179,"worker_busy_pct":{"queue worker 0x0":18.926},"top_phases_ms_per_frame":{"Driver.Present":4.394,"Driver.Present.present_display_buffer":3.406,"Driver.Packet":3.119,"Driver.Packet.draw":2.732,"Driver.Draw":2.706,"Driver.Draw.draw_and_resource_release":2.176,"Graphics.Draw":1.707,"Graphics.Draw.draw_and_resource_release":1.628},"trace_dropped":false,"trace":"aps5-trace-eea428ca855f-43880.json.gz"} {"commit":"eea428ca855f","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 595.79","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":317,"ms":10019.020},"presents":195,"frame_ms":{"p50":48.153,"p90":72.271,"p99":113.401,"max":120.628},"gpu_busy_ms_per_present":0.903,"worker_busy_pct":{"queue worker 0x0":53.859},"top_phases_ms_per_frame":{"Driver.Packet":27.644,"Driver.Packet.draw":27.557,"Driver.Draw":27.555,"Driver.Draw.draw_and_resource_release":27.465,"Graphics.Draw":27.461,"Graphics.Draw.draw_and_resource_release":27.455,"Graphics.Wait":17.213,"Graphics.Wait.fence_wait":17.211},"trace_dropped":false,"trace":"aps5-trace-eea428ca855f-30556.json.gz"} {"commit":"eea428ca855f","dirty":true,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 595.79","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":504,"ms":10026.594},"presents":356,"frame_ms":{"p50":24.940,"p90":37.185,"p99":63.933,"max":96.982},"gpu_busy_ms_per_present":0.310,"worker_busy_pct":{"queue worker 0x0":7.230},"top_phases_ms_per_frame":{"Driver.Present":3.630,"Driver.Present.present_display_buffer":3.363,"Driver.Packet":1.967,"Driver.Packet.draw":1.856,"Driver.Draw":1.852,"Driver.Draw.draw_and_resource_release":1.809,"Vulkan.DrawFromRecipe":1.807,"Graphics.DrawWithRecipe":1.804},"trace_dropped":false,"trace":"aps5-trace-eea428ca855f-4528.json.gz"} ``` ### Traces In the order of the summary lines: Showcase `main`, Showcase probe, PS5MC `main`, PS5MC probe, OpenNOW `main`, OpenNOW probe (the probe lines are `dirty`). Each file name is the title, the build, then the original `aps5-trace-eea428ca855f-<pid>.json.gz`. - [PPSA99005-main-aps5-trace-eea428ca855f-26312.json.gz](https://github.com/user-attachments/files/33467573/PPSA99005-main-aps5-trace-eea428ca855f-26312.json.gz) - [PPSA99005-probe-aps5-trace-eea428ca855f-6000.json.gz](https://github.com/user-attachments/files/33467574/PPSA99005-probe-aps5-trace-eea428ca855f-6000.json.gz) - [PPSA99420-main-aps5-trace-eea428ca855f-44008.json.gz](https://github.com/user-attachments/files/33467571/PPSA99420-main-aps5-trace-eea428ca855f-44008.json.gz) - [PPSA99420-probe-aps5-trace-eea428ca855f-43880.json.gz](https://github.com/user-attachments/files/33467572/PPSA99420-probe-aps5-trace-eea428ca855f-43880.json.gz) - [PPSA99082-main-aps5-trace-eea428ca855f-30556.json.gz](https://github.com/user-attachments/files/33467570/PPSA99082-main-aps5-trace-eea428ca855f-30556.json.gz) - [PPSA99082-probe-aps5-trace-eea428ca855f-4528.json.gz](https://github.com/user-attachments/files/33467575/PPSA99082-probe-aps5-trace-eea428ca855f-4528.json.gz) ### Digest `python tools/trace_digest.py <trace>`, cut to the headline, threads and largest slices. The full output is in [digests.txt](https://github.com/user-attachments/files/33467576/digests.txt). #### PPSA99005 Showcase, main **seconds 15:10** from present 45: 31 presents, frame p50 319.5 / p90 350.1 / p99 364.0 / max 364.0 ms, GPU busy 85.2 ms per present **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 218.9 (68 %) | 103.2 (32 %) | 0.8 | 2.3 | Driver.Packet 256.0, Driver.EndSubmission 0.4 | | presenter | 6.3 (2 %) | 3.1 (1 %) | 313.5 | 0.1 | Driver.Present 9.4 | | gpu | 86.0 (27 %) | 0.0 (0 %) | 236.9 | 0.0 | batch 86.0 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 256.0, Driver.Packet.draw 255.1, Driver.Draw 255.1, Driver.Draw.draw_and_resource_release 253.6, Graphics.Draw 253.6, Graphics.Draw.draw_and_resource_release 253.2, batch 86.0, Driver.WorkerWait 65.7, Driver.WorkerWait.idle_and_completion_poll 65.6, Graphics.Wait 37.5 #### PPSA99005 Showcase, probe **seconds 15:10** from present 134: 91 presents, frame p50 110.5 / p90 124.8 / p99 143.9 / max 143.9 ms, GPU busy 59.7 ms per present **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 45.6 (41 %) | 65.0 (58 %) | 0.6 | 1.5 | Driver.Packet 45.1, Driver.EndSubmission 0.5 | | presenter | 3.3 (3 %) | 0.3 (0 %) | 107.6 | 0.1 | Driver.Present 3.6 | | gpu | 59.1 (53 %) | 0.0 (0 %) | 52.1 | 0.0 | batch 59.1 | **Largest slices** (ms per frame, inclusive, all threads): Driver.WorkerWait 65.0, Driver.WorkerWait.idle_and_completion_poll 64.9, batch 59.1, Driver.Packet 45.1, Driver.Packet.draw 43.3, Driver.Draw 43.2, Driver.Draw.draw_and_resource_release 42.5, Graphics.Draw 30.2, Graphics.Draw.draw_and_resource_release 29.8, Vulkan.DrawFromRecipe 12.3 #### PPSA99420 PS5MC, main **seconds 15:10** from present 241: 161 presents, frame p50 63.2 / p90 83.9 / p99 96.5 / max 105.8 ms, GPU busy 9.2 ms per present **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 32.7 (52 %) | 29.2 (47 %) | 0.5 | 4.1 | Driver.Packet 50.1, Driver.EndSubmission 0.0 | | presenter | 7.1 (11 %) | 2.4 (4 %) | 52.9 | 0.1 | Driver.Present 9.5 | | gpu | 9.2 (15 %) | 0.0 (0 %) | 53.2 | 0.0 | batch 9.2 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 50.1, Driver.Packet.draw 50.0, Driver.Draw 50.0, Driver.Draw.draw_and_resource_release 47.9, Graphics.Draw 47.9, Graphics.Draw.draw_and_resource_release 47.7, Graphics.Wait 17.4, Graphics.Wait.fence_wait 17.4, Driver.WorkerWait 11.8, Driver.WorkerWait.idle_and_completion_poll 11.8 #### PPSA99420 PS5MC, probe **seconds 15:10** from present 804: 600 presents, frame p50 16.7 / p90 17.0 / p99 19.7 / max 22.6 ms, GPU busy 9.2 ms per present **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 2.9 (17 %) | 13.4 (80 %) | 0.4 | 1.0 | Driver.Packet 2.9, Driver.EndSubmission 0.0 | | presenter | 3.5 (21 %) | 0.9 (5 %) | 12.3 | 0.1 | Driver.Present 4.4 | | gpu | 9.2 (55 %) | 0.0 (0 %) | 7.5 | 0.0 | batch 9.2 | **Largest slices** (ms per frame, inclusive, all threads): Driver.WorkerWait 13.4, Driver.WorkerWait.idle_and_completion_poll 13.4, batch 9.2, Driver.Present 4.4, Driver.Present.present_display_buffer 3.4, Driver.Packet 2.9, Driver.Packet.draw 2.7, Driver.Draw 2.7, Driver.Draw.draw_and_resource_release 2.2, Graphics.Draw 1.7 #### PPSA99082 OpenNOW, main **seconds 15:10** from present 317: 195 presents, frame p50 48.2 / p90 72.3 / p99 113.4 / max 120.6 ms, GPU busy 0.9 ms per present **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 10.4 (20 %) | 40.9 (80 %) | 0.1 | 0.1 | Driver.Packet 27.6, Driver.EndSubmission 0.0 | | presenter | 6.0 (12 %) | 0.6 (1 %) | 44.7 | 0.1 | Driver.Present 6.7 | | gpu | 0.9 (2 %) | 0.0 (0 %) | 50.5 | 0.0 | batch 0.9 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 27.6, Driver.Packet.draw 27.6, Driver.Draw 27.6, Driver.Draw.draw_and_resource_release 27.5, Graphics.Draw 27.5, Graphics.Draw.draw_and_resource_release 27.5, Driver.WorkerWait 23.7, Driver.WorkerWait.idle_and_completion_poll 23.7, Graphics.Wait 17.2, Graphics.Wait.fence_wait 17.2 #### PPSA99082 OpenNOW, probe **seconds 15:10** from present 504: 356 presents, frame p50 24.9 / p90 37.2 / p99 63.9 / max 97.0 ms, GPU busy 0.3 ms per present **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 2.0 (7 %) | 26.1 (93 %) | 0.1 | 0.1 | Driver.Packet 2.0, Driver.EndSubmission 0.1 | | presenter | 3.5 (12 %) | 0.2 (1 %) | 24.5 | 0.1 | Driver.Present 3.6 | | gpu | 0.3 (1 %) | 0.0 (0 %) | 27.9 | 0.0 | batch 0.3 | **Largest slices** (ms per frame, inclusive, all threads): Driver.WorkerWait 26.1, Driver.WorkerWait.idle_and_completion_poll 26.1, Driver.Present 3.6, Driver.Present.present_display_buffer 3.4, Driver.Packet 2.0, Driver.Packet.draw 1.9, Driver.Draw 1.9, Driver.Draw.draw_and_resource_release 1.8, Vulkan.DrawFromRecipe 1.8, Graphics.DrawWithRecipe 1.8 ### Worker stacks Not sampled. The digest already puts the queue worker's time in `Graphics.Draw.draw_and_resource_release`, and the `[draws]` line above puts it in `readTarget`. ### Capture - [x] The caches were warm (the scene ran once and the title was restarted) - [x] No other APS5_TRACE_* or APS5_PROFILE_* switch was set and the log was not redirected - [x] Captures compared here come from the same machine, scene and settings Setup: Windows 11 (26200), Intel i5-14400F, NVIDIA GeForce RTX 4070 (driver 595.79), display 3440x1440 at 59 Hz, video output 3840x2160. WinLibs GCC 15.2.0 r7, Release. Catalog releases relinked with `--windows`. Audio muted with `SDL_AUDIODRIVER=dummy`. Each title was launched in its own console after a 30 s warm-up run. The probe build is eea428ca8 plus the diff above. AI-assisted: yes (Claude Code)
milescoviello commented 2026-10-17 14:26:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-17T14:26:15Z.


What remains after #6202, measured on a second ps5-opengl title. OliSe Player (PPSA01153) with the Rovastar Dark Ritual preset (two-slice 1920x1080 targets), on main 40315fcf8c + #6530 (its merged-coverage draws) + #6202. Ubuntu 24.04, RTX 4070 Ti (NVIDIA 595.99), Release, Square once, 120 s.

#6202 removes the storage round trip there: 130–134 whole-image CPU uploads per 10 s go to 0, and presents rise from 44–45 to 57–58 per 10 s (numbers on #6202). The rest of the frame time is mostly the title waiting for its submissions:

  • [present], per frame: GPU busy 41.5 ms, idle gaps 131.3 ms. 4121 submissions per 10 s, about 71 per frame, and 16427 draw commits per 10 s at 74.9 µs each on the committer.
  • [gputime], per present: draws 72 × 32.6 ms (0.45 ms each), and storage write-backs 2 × 7.9 ms (the linear targets, 15.8 MiB each).
  • On-CPU profile (perf record -F 299, DWARF, 6 s at 60 s): the process uses about half a core. The guest thread's on-CPU time is mostly munmap → GuestAllocationsUnmap → WaitForLeasesAndImports releasing retired imports inside NVIDIA's driver (osDevReadReg032), about 30% of all samples. The committer's largest item is StorageTexture::compareUntracked (12.5%).
  • Off-CPU (perf record -e context-switches -c 1, 4 s): 98.6% of the guest thread's switches are in sceKernelUsleep/usleep, about 660 per second. 2060 of them return to one site, a backoff helper (at 0x10aeb0 in the relinked image). It spins with pause for 200,000 clock units, then calls usleep(1000) and returns 1. Its caller loops reading a 64-bit label until it equals the expected value, for up to 2000 of those sleeps. That looks like the 2 s retirement watchdog that makes Afterglow (PPSA47770) and Surround Sound Studio quit when the first pipeline link is slow. I haven't checked that their builds use the same loop.

So with ~4 draws per submission at ~0.45 ms of GPU time plus ~75 µs of commit each, a submission doesn't finish within the title's 200 µs spin. Each wait then falls into 1 ms sleeps, and the GPU idles during them. The levers left are GPU time per draw and the commit cost per draw, not the waits themselves.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6235064967 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6189#issuecomment-6235064967). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-17T14:26:15Z. --- What remains after #6202, measured on a second ps5-opengl title. OliSe Player (PPSA01153) with the Rovastar Dark Ritual preset (two-slice 1920x1080 targets), on `main` 40315fcf8c + #6530 (its merged-coverage draws) + #6202. Ubuntu 24.04, RTX 4070 Ti (NVIDIA 595.99), Release, Square once, 120 s. #6202 removes the storage round trip there: 130–134 whole-image CPU uploads per 10 s go to 0, and presents rise from 44–45 to 57–58 per 10 s (numbers on #6202). The rest of the frame time is mostly the title waiting for its submissions: - `[present]`, per frame: GPU busy 41.5 ms, idle gaps 131.3 ms. 4121 submissions per 10 s, about 71 per frame, and 16427 draw commits per 10 s at 74.9 µs each on the committer. - `[gputime]`, per present: draws 72 × 32.6 ms (0.45 ms each), and storage write-backs 2 × 7.9 ms (the linear targets, 15.8 MiB each). - On-CPU profile (`perf record -F 299`, DWARF, 6 s at 60 s): the process uses about half a core. The guest thread's on-CPU time is mostly `munmap` → `GuestAllocationsUnmap` → `WaitForLeasesAndImports` releasing retired imports inside NVIDIA's driver (`osDevReadReg032`), about 30% of all samples. The committer's largest item is `StorageTexture::compareUntracked` (12.5%). - Off-CPU (`perf record -e context-switches -c 1`, 4 s): 98.6% of the guest thread's switches are in `sceKernelUsleep`/`usleep`, about 660 per second. 2060 of them return to one site, a backoff helper (at 0x10aeb0 in the relinked image). It spins with `pause` for 200,000 clock units, then calls `usleep(1000)` and returns 1. Its caller loops reading a 64-bit label until it equals the expected value, for up to 2000 of those sleeps. That looks like the 2 s retirement watchdog that makes Afterglow (PPSA47770) and Surround Sound Studio quit when the first pipeline link is slow. I haven't checked that their builds use the same loop. So with ~4 draws per submission at ~0.45 ms of GPU time plus ~75 µs of commit each, a submission doesn't finish within the title's 200 µs spin. Each wait then falls into 1 ms sleeps, and the GPU idles during them. The levers left are GPU time per draw and the commit cost per draw, not the waits themselves. AI-assisted: yes (Claude Code)
DavidSamir commented 2026-10-21 08:51:28 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-21T08:51:28Z.


AMD Radeon 680M results for #6202 with Pulse PPSA99993: https://github.com/boykopovar/AnyPS5/pull/6202#issuecomment-6311977706. On #6202's base, uploads drop from about 1,200 to 3 per 60 s and readTarget time by 80%. On current main, the title uploads before every draw and exits after 4 s on the 680M (2 of 3 runs on an RTX 3070), so #6202 needs a rebase to show the fix there.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6311978657 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6189#issuecomment-6311978657). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-21T08:51:28Z. --- AMD Radeon 680M results for #6202 with Pulse PPSA99993: https://github.com/boykopovar/AnyPS5/pull/6202#issuecomment-6311977706. On #6202's base, uploads drop from about 1,200 to 3 per 60 s and readTarget time by 80%. On current `main`, the title uploads before every draw and exits after 4 s on the 680M (2 of 3 runs on an RTX 3070), so #6202 needs a rebase to show the fix there. 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#6189
No description provided.