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
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
maineea428ca8the Showcase takes about 320 ms per frame in the capture window. A storage round trip repeats on every pass:CB_COLOR_ATTRIB3.MIP0_DEPTHtoSLICE_MAX + 1on 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.eba67d413),DecodeColorBufferkeeps the array (arrayLastSlice = 1, State.cpp:1150). The resident lookup inDraw.cppthen attaches the storage image of the whole declared array throughArraySurfaceForTarget.StorageTexture::Refresh. It first flushes the overlapped images' pending results (write-back reasonstorage refresh). Then it writes back its own stamped units (refresh, ending inSubmitAndWait). Finally it uploads the whole array image from guest memory again (upload reasoncpu), 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=1next todim=2at 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::UnchangedSincereturns false for memory the write tracker doesn't cover. So the sampled lookup of a pending target incachedTextureand its present inPresentDisplayBufferalso run the wholeRefresh, 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):Template captures (
APS5_TRACE_SECONDS=15:10). The full summary lines and digests are below.mainp50 / p90 msOn
main,Graphics.Draw.draw_and_resource_releasetakes 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.WorkerWait65 ms, GPU busy 59.7 ms).StorageTexture writeback submit/upload submitlines 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:mainp50 / p90 msThe frames are the same with and without the probe (
mainleft, probe right; Showcase, PS5MC, OpenNOW):APS5_PROFILE_DRAW=1on the Showcase,main, one 10 s window:That is 10.4 GiB uploaded and 5.7 GiB written back in 10 s, for 33 frames.
readTarget, the resident lookup that callsRefresh, takes 3.6 s of the 10 s.The Showcase's array images (
[src/Texture.cpp:1088 StorageTexture];layersprintsdepthOrLastArray, solayers=1 dim=2is a 2-slice array):Overlap map. Every target uses tile mode 64KB_R_X; slice sizes are rounded up to whole 64 KiB blocks.
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,
maind8888df9b, after #3524) lists OpenNOW at 25.8 FPS, in the same range asmainhere.Directions.
MIP0_DEPTHholds the last slice, so a single 2D target should set it to 0, or toSLICE_MAXfor 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.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. ItsDecodeTargetcheck at line 196 requiresarrayLastSlice == Layers - 1for that view, and the probe leaves it 0. I found this by reading the code and haven't run the tests with the probe.StorageTexture's pending lookup and upload.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
Traces
In the order of the summary lines: Showcase
main, Showcase probe, PS5MCmain, PS5MC probe, OpenNOWmain, OpenNOW probe (the probe lines aredirty). Each file name is the title, the build, then the originalaps5-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)
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)
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)
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)
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)
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)
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 inreadTarget.Capture
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 withSDL_AUDIODRIVER=dummy. Each title was launched in its own console after a 30 s warm-up run. The probe build iseea428ca8plus the diff above.AI-assisted: yes (Claude Code)
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
main40315fcf8c+ #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).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 mostlymunmap→GuestAllocationsUnmap→WaitForLeasesAndImportsreleasing retired imports inside NVIDIA's driver (osDevReadReg032), about 30% of all samples. The committer's largest item isStorageTexture::compareUntracked(12.5%).perf record -e context-switches -c 1, 4 s): 98.6% of the guest thread's switches are insceKernelUsleep/usleep, about 660 per second. 2060 of them return to one site, a backoff helper (at 0x10aeb0 in the relinked image). It spins withpausefor 200,000 clock units, then callsusleep(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)
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