perf: first-visit freezes of up to 10 s from graphics pipeline library builds under the GpuMutex (PPSA06207, Radeon 8060S) #25352

Closed
opened 2026-11-21 23:38:36 +00:00 by kripotker · 0 comments
kripotker commented 2026-11-21 23:38:36 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by kripotker on 2026-11-21T23:38:36Z.


Title and scene

PPSA06207 (What Remains of Edith Finch) 01.001.000. Molly's story: a 90-second window opened while paused in Molly's room, covering her turning into a cat and the climb that follows.

What is slow or what changed

The first time the AMD driver compiles a scene's pipelines, the game freezes for several seconds. Once the driver has cached them, the same scene doesn't freeze. In the freeze, the draw committer builds graphics pipeline library parts one after another (Vulkan.GraphicsPipelineLibrary, up to 1 s each) while it holds GuestMemory::GpuMutex(). Queue worker 0x0 waits behind it at fill.

Driver::commitDraw (Execution/src/Driver/Draw/Draw.cpp) takes the GPU mutex at the Draw site and holds it across VulkanDevice::Draw. That call reaches the vkCreateGraphicsPipelines calls for missing parts in Graphics/src/PipelineLibrary.cpp. Compute pipelines are already built outside the mutex: the [vk] line reports compute pipelines created 116 (0 under the GPU mutex).

The same scene and window, captured twice:

cold warm
presents in the 90 s window 1747 2388
max frame 10480 ms 392 ms
p99 frame 123 ms 92 ms
Vulkan.GraphicsPipelineLibrary 20291 ms (longest slice 1052 ms) 18 ms over 74 slices (longest 0.6 ms)
GpuMutex.wait.fill 8410 ms 1353 ms
Driver.Draw.shader_compile_and_link 21070 ms 27129 ms
  • Cold: the AMD driver's cache for the title (its two files in %LOCALAPPDATA%\AMD\VkCache) and AnyPS5's pipelines.journal and vk-pipelines-*.bin were moved aside before the run.
  • Warm: the driver's cache still held the scene. AnyPS5's journal and pipeline cache were moved aside here too, so only the driver cache differs between the two runs.

The 10480 ms frame (present 2970, starting 38460 ms into the cold window), right after the "…was a cat!" text:

thread slice count total (ms) longest (ms)
draw committer Graphics.Draw 713 10347 1175
draw committer Vulkan.GraphicsPipelineLibrary 26 9654 1052
queue worker 0x0 GpuMutex.wait.fill 1 7083 7083
queue worker 0x20 Driver.Packet.memory_wait 2 10499 10452
queue worker 0x0 Driver.Draw.shader_compile_and_link 563 474 45

The 26 parts are built one after another on the draw committer:

  • 188, 177, 184, 170, 178, 192, 195, 215, 225, 930, 897, 168, 954, 198, 852, 170, 906, 853, 1052, 214, 104, 171, 69, 123, 125, 143 ms.

Earlier full play sessions (APS5_TRACE_SUMMARY_EVERY=2 with APS5_PROFILE_DRAW=1) showed the same pattern every time a run reached a scene for the first time:

  • Freezes: up to 8074 ms, at the cat, owl, shark, ocean and sea-monster transformations, with 2.0 to 8.3 s of Vulkan.GraphicsPipelineLibrary in each.
  • [lock] line in the worst one: the draw thread held the mutex at draw for 9441 ms of 10 s, the longest hold 1017 ms. Queue 0x0 waited 4982 ms behind untagged/draw.

The pipeline journal is not the fix on this driver: the warm capture had AnyPS5's journal empty and still didn't freeze, because the driver's own cache served the parts. A player meets these freezes on a first playthrough.

Two directions, neither tried:

  • Build missing parts before taking the lock. Do the PipelineLibrary part builds a draw needs before commitDraw takes the mutex, so the other queues keep running.
  • Build parts in parallel. Build a pipeline's missing parts at once rather than one after another: 26 builds of 69–1052 ms ran serially on one thread here.

APS5_LIBRARY_PREBUILD=1 builds parts early, but #23812 made it opt-in because it builds far more than a title reaches.

Summary lines

Both captures on main 8763aeffdc37, not dirty. AMD Radeon 8060S (Strix Halo APU, 1002:1586), AMD proprietary driver 26.11.2 (LLPC, 32.0.32029.2010), AMD Ryzen AI MAX+ 388, Windows 11 Pro 10.0.26300, 3840x2160, WinLibs GCC 15.2.0 r7, Release.

{"window": {"spec": "seconds 0:90"}, "env": {"APS5_HOST_IMPORT_MIB": "8192", "APS5_PLAYGO_UNLISTED_CHUNKS": "installed", "APS5_TRACE_EVENTS": "4194304", "APS5_TRACE_SECONDS": "0:90", "APS5_TRACE_TRIGGER_FILE": "<path>"}, "title_id": "PPSA06207", "content_version": "01.001.000"}
cold: {"presents": 1747, "frame_ms": {"p50": 36.888, "p90": 51.454, "p99": 122.726, "max": 10480.279}, "trace_dropped": false}
warm: {"presents": 2388, "frame_ms": {"p50": 35.426, "p90": 49.296, "p99": 91.535, "max": 392.329}, "trace_dropped": false}

The full summary lines are in summary-cold.jsonl and summary-warm.jsonl, with the traces.

APS5_HOST_IMPORT_MIB=8192 keeps the import budget out of the measurement. At this machine's default of 3383 MiB, refused imports halve the frame rate (#7047).

Traces

trace-cold.json.gz (34 MB) and trace-warm.json.gz (45 MB) are over GitHub's 25 MB attachment limit. They and both summary files are at https://github.com/kripotker/AnyPS5/releases/tag/trace-ppsa06207-first-visit-pipelines.

Digest

python3 tools/trace_digest.py trace-cold.json.gz:

1746 frames over 89973.6 ms
- present 2970: 10480.3 ms at 38460 ms: Driver.Packet (queue worker 0x20) 10480.1, Driver.Packet.memory_wait (queue worker 0x20) 10467.7, Driver.Packet (queue worker 0x0) 10453.5, Graphics.Draw (draw committer) 10346.6
- present 2977: 4518.5 ms at 49814 ms: Driver.Packet (queue worker 0x20) 4518.2, Driver.Packet.memory_wait (queue worker 0x20) 4514.4, Driver.Packet (queue worker 0x0) 4488.8, Graphics.Draw (draw committer) 4362.7
Longest waits
- Driver.Packet.memory_wait (queue worker 0x20) 10452.5 ms at 38506 ms, present 2970
- GpuMutex.wait.fill (queue worker 0x0) 7083.2 ms at 40753 ms, present 2970
- Driver.Packet.memory_wait (queue worker 0x20) 3834.2 ms at 50510 ms, present 2977

python3 tools/trace_digest.py trace-warm.json.gz:

2387 frames over 89991.3 ms
- present 3185: 392.3 ms at 33919 ms: Driver.Packet (queue worker 0x20) 392.2, Driver.Packet.memory_wait (queue worker 0x20) 379.7, Driver.Packet (queue worker 0x0) 374.7, Driver.Packet.draw (queue worker 0x0) 349.1
Longest waits
- Driver.Packet.memory_wait (queue worker 0x20) 366.1 ms at 33960 ms, present 3185

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

Both left unticked on purpose:

  • Caches: the warm capture meets this for the driver cache. The cold one leaves both caches empty on purpose, since first-visit compilation is what it measures. The shader cache was warm for both.
  • Switches and log: no APS5_PROFILE_* was set. The other APS5_TRACE_* switches are the ones that set the window: APS5_TRACE_EVENTS and APS5_TRACE_TRIGGER_FILE, which opens it on a trigger file once the scene is reached. The game ran from a background shell with stdout and stderr sent to the null device, so no log file was written.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6535865564 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/25352). Originally posted by [kripotker](https://github.com/kripotker) on 2026-11-21T23:38:36Z. --- ### Title and scene PPSA06207 (What Remains of Edith Finch) 01.001.000. Molly's story: a 90-second window opened while paused in Molly's room, covering her turning into a cat and the climb that follows. ### What is slow or what changed The first time the AMD driver compiles a scene's pipelines, the game freezes for several seconds. Once the driver has cached them, the same scene doesn't freeze. In the freeze, the draw committer builds graphics pipeline library parts one after another (`Vulkan.GraphicsPipelineLibrary`, up to 1 s each) while it holds `GuestMemory::GpuMutex()`. Queue worker 0x0 waits behind it at `fill`. `Driver::commitDraw` (`Execution/src/Driver/Draw/Draw.cpp`) takes the GPU mutex at the `Draw` site and holds it across `VulkanDevice::Draw`. That call reaches the `vkCreateGraphicsPipelines` calls for missing parts in `Graphics/src/PipelineLibrary.cpp`. Compute pipelines are already built outside the mutex: the `[vk]` line reports `compute pipelines created 116 (0 under the GPU mutex)`. The same scene and window, captured twice: | | cold | warm | | --- | ---: | ---: | | presents in the 90 s window | 1747 | 2388 | | max frame | 10480 ms | 392 ms | | p99 frame | 123 ms | 92 ms | | `Vulkan.GraphicsPipelineLibrary` | 20291 ms (longest slice 1052 ms) | 18 ms over 74 slices (longest 0.6 ms) | | `GpuMutex.wait.fill` | 8410 ms | 1353 ms | | `Driver.Draw.shader_compile_and_link` | 21070 ms | 27129 ms | - **Cold:** the AMD driver's cache for the title (its two files in `%LOCALAPPDATA%\AMD\VkCache`) and AnyPS5's `pipelines.journal` and `vk-pipelines-*.bin` were moved aside before the run. - **Warm:** the driver's cache still held the scene. AnyPS5's journal and pipeline cache were moved aside here too, so only the driver cache differs between the two runs. The 10480 ms frame (present 2970, starting 38460 ms into the cold window), right after the "…was a cat!" text: | thread | slice | count | total (ms) | longest (ms) | | --- | --- | ---: | ---: | ---: | | draw committer | `Graphics.Draw` | 713 | 10347 | 1175 | | draw committer | `Vulkan.GraphicsPipelineLibrary` | 26 | 9654 | 1052 | | queue worker 0x0 | `GpuMutex.wait.fill` | 1 | 7083 | 7083 | | queue worker 0x20 | `Driver.Packet.memory_wait` | 2 | 10499 | 10452 | | queue worker 0x0 | `Driver.Draw.shader_compile_and_link` | 563 | 474 | 45 | The 26 parts are built one after another on the draw committer: - 188, 177, 184, 170, 178, 192, 195, 215, 225, 930, 897, 168, 954, 198, 852, 170, 906, 853, 1052, 214, 104, 171, 69, 123, 125, 143 ms. Earlier full play sessions (`APS5_TRACE_SUMMARY_EVERY=2` with `APS5_PROFILE_DRAW=1`) showed the same pattern every time a run reached a scene for the first time: - **Freezes:** up to 8074 ms, at the cat, owl, shark, ocean and sea-monster transformations, with 2.0 to 8.3 s of `Vulkan.GraphicsPipelineLibrary` in each. - **`[lock]` line in the worst one:** the draw thread held the mutex at `draw` for 9441 ms of 10 s, the longest hold 1017 ms. Queue 0x0 waited 4982 ms behind `untagged/draw`. The pipeline journal is not the fix on this driver: the warm capture had AnyPS5's journal empty and still didn't freeze, because the driver's own cache served the parts. A player meets these freezes on a first playthrough. Two directions, neither tried: - **Build missing parts before taking the lock.** Do the `PipelineLibrary` part builds a draw needs before `commitDraw` takes the mutex, so the other queues keep running. - **Build parts in parallel.** Build a pipeline's missing parts at once rather than one after another: 26 builds of 69–1052 ms ran serially on one thread here. `APS5_LIBRARY_PREBUILD=1` builds parts early, but #23812 made it opt-in because it builds far more than a title reaches. ### Summary lines Both captures on `main` `8763aeffdc37`, not dirty. AMD Radeon 8060S (Strix Halo APU, `1002:1586`), AMD proprietary driver 26.11.2 (LLPC, 32.0.32029.2010), AMD Ryzen AI MAX+ 388, Windows 11 Pro 10.0.26300, 3840x2160, WinLibs GCC 15.2.0 r7, Release. ```json {"window": {"spec": "seconds 0:90"}, "env": {"APS5_HOST_IMPORT_MIB": "8192", "APS5_PLAYGO_UNLISTED_CHUNKS": "installed", "APS5_TRACE_EVENTS": "4194304", "APS5_TRACE_SECONDS": "0:90", "APS5_TRACE_TRIGGER_FILE": "<path>"}, "title_id": "PPSA06207", "content_version": "01.001.000"} cold: {"presents": 1747, "frame_ms": {"p50": 36.888, "p90": 51.454, "p99": 122.726, "max": 10480.279}, "trace_dropped": false} warm: {"presents": 2388, "frame_ms": {"p50": 35.426, "p90": 49.296, "p99": 91.535, "max": 392.329}, "trace_dropped": false} ``` The full summary lines are in `summary-cold.jsonl` and `summary-warm.jsonl`, with the traces. `APS5_HOST_IMPORT_MIB=8192` keeps the import budget out of the measurement. At this machine's default of 3383 MiB, refused imports halve the frame rate (#7047). ### Traces `trace-cold.json.gz` (34 MB) and `trace-warm.json.gz` (45 MB) are over GitHub's 25 MB attachment limit. They and both summary files are at https://github.com/kripotker/AnyPS5/releases/tag/trace-ppsa06207-first-visit-pipelines. ### Digest `python3 tools/trace_digest.py trace-cold.json.gz`: ``` 1746 frames over 89973.6 ms - present 2970: 10480.3 ms at 38460 ms: Driver.Packet (queue worker 0x20) 10480.1, Driver.Packet.memory_wait (queue worker 0x20) 10467.7, Driver.Packet (queue worker 0x0) 10453.5, Graphics.Draw (draw committer) 10346.6 - present 2977: 4518.5 ms at 49814 ms: Driver.Packet (queue worker 0x20) 4518.2, Driver.Packet.memory_wait (queue worker 0x20) 4514.4, Driver.Packet (queue worker 0x0) 4488.8, Graphics.Draw (draw committer) 4362.7 Longest waits - Driver.Packet.memory_wait (queue worker 0x20) 10452.5 ms at 38506 ms, present 2970 - GpuMutex.wait.fill (queue worker 0x0) 7083.2 ms at 40753 ms, present 2970 - Driver.Packet.memory_wait (queue worker 0x20) 3834.2 ms at 50510 ms, present 2977 ``` `python3 tools/trace_digest.py trace-warm.json.gz`: ``` 2387 frames over 89991.3 ms - present 3185: 392.3 ms at 33919 ms: Driver.Packet (queue worker 0x20) 392.2, Driver.Packet.memory_wait (queue worker 0x20) 379.7, Driver.Packet (queue worker 0x0) 374.7, Driver.Packet.draw (queue worker 0x0) 349.1 Longest waits - Driver.Packet.memory_wait (queue worker 0x20) 366.1 ms at 33960 ms, present 3185 ``` ### 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 - [x] Captures compared here come from the same machine, scene and settings Both left unticked on purpose: - **Caches:** the warm capture meets this for the driver cache. The cold one leaves both caches empty on purpose, since first-visit compilation is what it measures. The shader cache was warm for both. - **Switches and log:** no `APS5_PROFILE_*` was set. The other `APS5_TRACE_*` switches are the ones that set the window: `APS5_TRACE_EVENTS` and `APS5_TRACE_TRIGGER_FILE`, which opens it on a trigger file once the scene is reached. The game ran from a background shell with stdout and stderr sent to the null device, so no log file was written. 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#25352
No description provided.