perf(agc): fill-cleared linear targets fall back to a whole-target store after every draw on macOS (PPSA02070) #18785

Open
opened 2026-11-12 08:42:34 +00:00 by krishalivaibhav · 0 comments
krishalivaibhav commented 2026-11-12 08:42:34 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-11-12T08:42:34Z.


Title and scene

PPSA02070 (Don't Starve Together: Console Edition 02.009.002), character intro cutscene, seconds 40–50 after launch, 3840x2160

What is slow or what changed

On macOS (Apple M2, MoltenVK, Rosetta), most of the draw committer's time goes to whole-image write-backs of linear render targets right after draws (linear target): ~1,900 stores / ~25.6 GB per 10 s.

Cause, traced with temporary instrumentation: the title clears its linear targets every frame with buffer fills (Driver::storeBufferFill → StorageTexture::FillClear → MarkDirty). Because no draw is being recorded, markLayersPending sets pendingFromOthers, so the next MarkDrawn returns false and keepRecordedDraw (Draw.cpp ~2540) stores the whole target after every draw. 17,995 of 18,000 sampled MarkDrawn calls hit this.

Two prototypes, same binary at 65351c2931, switched by env:

  1. Treat a whole-image fill clear as a full drawn rectangle: worse (~34 FPS). The stores move to StoreDrawnLinear("flip") at 45.6 GB / 10 s.
  2. APS5_DEFER_LINEAR_STORE=1 (diff below): when the draw-time store would run and the target is Cached(), MarkDirty() instead, leaving the store to the next flip/label. The frame looks correct by eye, but correctness is not checked beyond that.
base deferred
presents in 10 s 420 458
frame p50 / p90 / p99 / max 23.4 / 26.8 / 28.9 / 29.5 ms 21.5 / 22.9 / 28.2 / 47.3 ms
GPU busy per present 19.1 ms 16.6 ms
draw committer busy per frame 10.9 ms 0.5 ms
write-backs / 10 s linear target 1,900 / 25.6 GB flip ~2,250 / 30.3 GB

Deferring helps the median, but the bytes only move: Driver.Packet.flip_flush / Recorder.Sync now costs ~16 ms/frame on the queue worker and creates 35–47 ms spikes. Extending the macOS label read traps to StoreDrawnLinear("flip") (same eligibility as StoreReadbackBeforeLabel) trapped nothing here; these targets presumably fail the shared-page test.

Relation to #9685 and #8152: #9685 stores resident linear targets only at completion points and over their drawn rectangles, but a fill clear sets pendingFromOthers, which turns that tracking off, so this title falls back to the per-draw whole store. Prototype 2 stores whole images later, so it likely reintroduces the #8152 hazard (CPU stores made after the draw get overwritten); it is a measurement, not a fix.

Open question for the AGC maintainers: is the whole-target store after a fill-cleared draw needed for correctness? Fill clears could instead keep rectangle tracking (or be recorded as a known clear value) so only the drawn rectangles are stored, without falling back to a full store per draw. I have not opened a PR; the prototype is not something I would propose as-is.

diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
index 48b9d7807b..c36a5eb732 100644
--- a/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
+++ b/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
@@ -2542,7 +2542,12 @@ void keepRecordedDraw(Recorder& recorder, const std::shared_ptr<ShaderResources>
         else if (index < slices.size()) residents[index]->MarkSliceDirty(slices[index].first, slices[index].second);
         else residents[index]->MarkDirty();
     }
+    static const bool deferLinear = std::getenv("APS5_DEFER_LINEAR_STORE") != nullptr;
     for (std::size_t index = 0; index < residents.size(); ++index) {
+        if (storeNow[index] && deferLinear && residents[index]->Cached()) {
+            residents[index]->MarkDirty();
+            continue;
+        }
         if (storeNow[index]) StorageTexture::FlushPending(residents[index]->Descriptor().baseAddress, static_cast<std::size_t>(residents[index]->GuestBytes()), nullptr, "linear target");
     }
 }

Measured on 65351c2931 (main has moved since, including #11485). I will re-measure on current main if useful.

Summary lines

{"commit":"65351c2931ec","dirty":true,"env":{"APS5_TRACE_SECONDS":"40:10"},"gpu":"Apple M2","driver":"MoltenVK 1.4.2","os":"Darwin 27.3.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":8,"memory_mib":16384,"title_id":"PPSA02070","title":"Don't Starve Together: Console Edition","content_version":"02.009.002","resolution":"3840x2160","window":{"spec":"seconds 40:10","first_present":1623,"ms":10008.396},"presents":420,"frame_ms":{"p50":23.365,"p90":26.826,"p99":28.924,"max":29.478},"gpu_busy_ms_per_present":19.103,"worker_busy_pct":{"queue worker 0x0":50.392},"top_phases_ms_per_frame":{"Driver.Packet":12.005,"VideoOut.Flip":11.488,"Driver.Packet.dispatch":11.283,"Driver.Present":10.741,"VideoOut.Flip.present":10.718,"Vulkan.Retire":10.468,"Driver.Present.render_fence_wait":10.468,"Vulkan.Retire.wait":10.461},"owned_draw_counts":{},"trace_dropped":false,"trace":"aps5-trace-65351c2931ec-16195.json.gz"}
{"commit":"65351c2931ec","dirty":true,"env":{"APS5_DEFER_LINEAR_STORE":"1","APS5_TRACE_SECONDS":"40:10"},"gpu":"Apple M2","driver":"MoltenVK 1.4.2","os":"Darwin 27.3.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":8,"memory_mib":16384,"title_id":"PPSA02070","title":"Don't Starve Together: Console Edition","content_version":"02.009.002","resolution":"3840x2160","window":{"spec":"seconds 40:10","first_present":1823,"ms":10020.501},"presents":458,"frame_ms":{"p50":21.496,"p90":22.888,"p99":28.182,"max":47.258},"gpu_busy_ms_per_present":16.609,"worker_busy_pct":{"queue worker 0x0":80.207},"top_phases_ms_per_frame":{"Driver.Packet":17.543,"Driver.Packet.flip_flush":15.96,"Recorder.Sync":15.64,"VideoOut.Flip":4.028,"VideoOut.Flip.present":3.209,"Driver.Present":3.209,"Vulkan.Retire":2.867,"Driver.Present.render_fence_wait":2.867},"owned_draw_counts":{},"trace_dropped":false,"trace":"aps5-trace-65351c2931ec-17101.json.gz"}

Traces

Not attached yet (the GitHub CLI cannot upload files); available on request: aps5-trace-65351c2931ec-16195.json.gz (base), aps5-trace-65351c2931ec-17101.json.gz (deferred).

Digest

base

seconds 40:10 from present 1623: 420 presents, frame p50 23.4 / p90 26.8 / p99 28.9 / max 29.5 ms, GPU busy 19.1 ms per present
Apple M2, MoltenVK 1.4.2, Darwin 27.3.0, 3840x2160, commit 65351c2931 (dirty), dropped: no

{"commit":"65351c2931ec","dirty":true,"env":{"APS5_TRACE_SECONDS":"40:10"},"gpu":"Apple M2","driver":"MoltenVK 1.4.2","os":"Darwin 27.3.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":8,"memory_mib":16384,"title_id":"PPSA02070","title":"Don't Starve Together: Console Edition","content_version":"02.009.002","resolution":"3840x2160","window":{"spec":"seconds 40:10","first_present":1623,"ms":10008.396},"presents":420,"frame_ms":{"p50":23.365,"p90":26.826,"p99":28.924,"max":29.478},"gpu_busy_ms_per_present":19.103,"worker_busy_pct":{"queue worker 0x0":50.392},"top_phases_ms_per_frame":{"Driver.Packet":12.005,"VideoOut.Flip":11.488,"Driver.Packet.dispatch":11.283,"Driver.Present":10.741,"VideoOut.Flip.present":10.718,"Vulkan.Retire":10.468,"Driver.Present.render_fence_wait":10.468,"Vulkan.Retire.wait":10.461},"owned_draw_counts":{},"trace_dropped":false,"trace":"aps5-trace-65351c2931ec-16195.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 1946: 29.5 ms at 7645 ms: batch (gpu) 24.6, Driver.WorkerWait (queue worker 0x0) 15.2, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 15.2, VideoOut.Flip (presenter) 15.1
  • present 1780: 29.3 ms at 3728 ms: batch (gpu) 24.7, Driver.WorkerWait (queue worker 0x0) 15.1, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 15.1, VideoOut.Flip (presenter) 15.1
  • present 1943: 29.1 ms at 7561 ms: batch (gpu) 24.4, Driver.WorkerWait (queue worker 0x0) 14.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 14.8, VideoOut.Flip (presenter) 14.7
  • present 1835: 29.1 ms at 5067 ms: batch (gpu) 22.9, Driver.WorkerWait (queue worker 0x0) 13.6, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 13.6, Driver.Packet (queue worker 0x0) 13.2
  • present 1777: 28.9 ms at 3643 ms: batch (gpu) 24.1, Driver.WorkerWait (queue worker 0x0) 14.6, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 14.6, VideoOut.Flip (presenter) 14.4

Persistent spikes (frame time above the fastest frame that separates it from a longer frame; one entry per stall, not per frame)

  • present 1946: 29.5 ms at 7645 ms, persistence 11.3 ms
  • present 1780: 29.3 ms at 3728 ms, persistence 11.2 ms
  • present 1835: 29.1 ms at 5067 ms, persistence 7.8 ms
  • present 1674: 28.3 ms at 1212 ms, persistence 7.2 ms
  • present 2039: 28.0 ms at 9900 ms, persistence 6.7 ms

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.1 (0 %) 0.0 (0 %) 23.7 0.8 Shader.ResolveGraphicsAbi 0.0, Shader.ResolveAbi 0.0
queue worker 0x0 11.7 (49 %) 11.6 (49 %) 0.5 1.1 Driver.Packet 11.7, Driver.Completion 0.0
draw committer 10.9 (46 %) 0.0 (0 %) 13.0 0.2 Vulkan.DrawFromRecipe 5.4, Graphics.Draw 5.4
presenter 1.0 (4 %) 10.5 (44 %) 12.3 0.1 VideoOut.Flip 11.5, Driver.Present 0.0
gpu 19.1 (80 %) 0.0 (0 %) 4.8 0.0 batch 19.1

Largest slices (ms per frame, inclusive, all threads): batch 19.1, Driver.Packet 11.7, Driver.WorkerWait 11.6, Driver.WorkerWait.idle_and_completion_poll 11.6, VideoOut.Flip 11.5

Longest waits

  • Driver.WorkerWait (queue worker 0x0) 15.2 ms at 7645 ms, present 1945
  • Driver.WorkerWait (queue worker 0x0) 15.1 ms at 3728 ms, present 1780
  • Driver.WorkerWait (queue worker 0x0) 15.0 ms at 1323 ms, present 1677
  • Driver.WorkerWait (queue worker 0x0) 14.8 ms at 7561 ms, present 1942
  • Driver.WorkerWait (queue worker 0x0) 14.7 ms at 7675 ms, present 1947

Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)

  • batch 1291: 13.5 ms at 7645 ms, present 1945: GPU no ranges; recorded by Graphics.Draw (draw committer) 8.6, Graphics.Draw.draw_and_resource_release (draw committer) 8.6, Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2
  • batch 627: 13.5 ms at 3728 ms, present 1779: GPU no ranges; recorded by Graphics.Draw (draw committer) 8.8, Graphics.Draw.draw_and_resource_release (draw committer) 8.8, Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2
  • batch 1279: 13.1 ms at 7561 ms, present 1942: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 8.7, Graphics.DrawWithRecipe (draw committer) 8.7, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 8.7, Graphics.Draw (draw committer) 0.2
  • batch 1295: 13.0 ms at 7675 ms, present 1946: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 9.5, Graphics.DrawWithRecipe (draw committer) 9.5, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 9.5, Graphics.Draw (draw committer) 0.3
  • batch 615: 12.9 ms at 3643 ms, present 1776: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 8.7, Graphics.DrawWithRecipe (draw committer) 8.7, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 8.6, Graphics.Draw (draw committer) 0.2
APS5_DEFER_LINEAR_STORE=1

seconds 40:10 from present 1823: 458 presents, frame p50 21.5 / p90 22.9 / p99 28.2 / max 47.3 ms, GPU busy 16.6 ms per present
Apple M2, MoltenVK 1.4.2, Darwin 27.3.0, 3840x2160, commit 65351c2931 (dirty), dropped: no

{"commit":"65351c2931ec","dirty":true,"env":{"APS5_DEFER_LINEAR_STORE":"1","APS5_TRACE_SECONDS":"40:10"},"gpu":"Apple M2","driver":"MoltenVK 1.4.2","os":"Darwin 27.3.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":8,"memory_mib":16384,"title_id":"PPSA02070","title":"Don't Starve Together: Console Edition","content_version":"02.009.002","resolution":"3840x2160","window":{"spec":"seconds 40:10","first_present":1823,"ms":10020.501},"presents":458,"frame_ms":{"p50":21.496,"p90":22.888,"p99":28.182,"max":47.258},"gpu_busy_ms_per_present":16.609,"worker_busy_pct":{"queue worker 0x0":80.207},"top_phases_ms_per_frame":{"Driver.Packet":17.543,"Driver.Packet.flip_flush":15.96,"Recorder.Sync":15.64,"VideoOut.Flip":4.028,"VideoOut.Flip.present":3.209,"Driver.Present":3.209,"Vulkan.Retire":2.867,"Driver.Present.render_fence_wait":2.867},"owned_draw_counts":{},"trace_dropped":false,"trace":"aps5-trace-65351c2931ec-17101.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 1900: 47.3 ms at 1703 ms: Driver.Packet (queue worker 0x0) 42.5, Driver.Packet.flip_flush (queue worker 0x0) 41.4, Recorder.Sync (queue worker 0x0) 40.8, Recorder.Submit (queue worker 0x0) 18.7
  • present 2202: 37.7 ms at 8239 ms: Driver.Packet (queue worker 0x0) 28.5, Driver.Packet.flip_flush (queue worker 0x0) 27.3, Recorder.Sync (queue worker 0x0) 25.9, batch (gpu) 18.3
  • present 2254: 35.1 ms at 9406 ms: Driver.Packet (queue worker 0x0) 25.1, Driver.Packet.flip_flush (queue worker 0x0) 23.5, Recorder.Sync (queue worker 0x0) 22.9, batch (gpu) 19.0
  • present 2255: 34.0 ms at 9441 ms: Driver.Packet (queue worker 0x0) 20.5, Driver.Packet.flip_flush (queue worker 0x0) 17.3, Recorder.Sync (queue worker 0x0) 16.9, batch (gpu) 15.6
  • present 2203: 28.2 ms at 8277 ms: Driver.Packet (queue worker 0x0) 19.0, batch (gpu) 17.2, Driver.Packet.flip_flush (queue worker 0x0) 17.1, Recorder.Sync (queue worker 0x0) 16.6

Persistent spikes (frame time above the fastest frame that separates it from a longer frame; one entry per stall, not per frame)

  • present 1900: 47.3 ms at 1703 ms, persistence 26.6 ms
  • present 2202: 37.7 ms at 8239 ms, persistence 17.0 ms
  • present 2254: 35.1 ms at 9406 ms, persistence 14.2 ms
  • present 1828: 25.1 ms at 122 ms, persistence 3.9 ms
  • present 2123: 24.2 ms at 6547 ms, persistence 3.4 ms

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.0 (0 %) 0.0 (0 %) 21.9 0.7 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
queue worker 0x0 17.2 (79 %) 4.1 (19 %) 0.5 1.0 Driver.Packet 17.2, Driver.Completion 0.0
draw committer 0.5 (2 %) 0.0 (0 %) 21.3 0.2 Vulkan.DrawFromRecipe 0.2, Graphics.Draw 0.2
presenter 1.2 (5 %) 2.9 (13 %) 17.8 0.1 VideoOut.Flip 4.0, Driver.Present 0.0
gpu 16.6 (76 %) 0.0 (0 %) 5.3 0.0 batch 16.6

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 17.2, batch 16.6, Driver.Packet.flip_flush 16.0, Recorder.Sync 15.6, Driver.WorkerWait 4.1

Longest waits

  • Driver.WorkerWait (queue worker 0x0) 12.8 ms at 9441 ms, present 2254
  • Driver.WorkerWait (queue worker 0x0) 8.5 ms at 8277 ms, present 2202
  • Driver.WorkerWait (queue worker 0x0) 7.7 ms at 1750 ms, present 1900
  • Driver.WorkerWait (queue worker 0x0) 5.0 ms at 2176 ms, present 1919
  • Driver.WorkerWait (queue worker 0x0) 4.9 ms at 8171 ms, present 2198

Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)

  • batch 9: 14.3 ms at 55 ms, present 1825: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.3, Graphics.DrawWithRecipe (draw committer) 0.3, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Graphics.Draw (draw committer) 0.2
  • batch 17: 14.3 ms at 104 ms, present 1827: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.4, Graphics.DrawWithRecipe (draw committer) 0.4, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Graphics.Draw (draw committer) 0.2
  • batch 5: 14.1 ms at 31 ms, present 1824: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.4, Graphics.Draw.draw_and_resource_release (draw committer) 0.3, Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2
  • batch 1: 14.1 ms at 7 ms, present 1823: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.4, Graphics.DrawWithRecipe (draw committer) 0.4, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Graphics.Draw (draw committer) 0.2
  • batch 1201: 14.1 ms at 6554 ms, present 2123: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.4, Graphics.DrawWithRecipe (draw committer) 0.4, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Graphics.Draw (draw committer) 0.3

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 (no other switches were set; the log went to /dev/null)
  • Captures compared here come from the same machine, scene and settings
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6346133155 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/18785). Originally posted by [krishalivaibhav](https://github.com/krishalivaibhav) on 2026-11-12T08:42:34Z. --- ### Title and scene PPSA02070 (Don't Starve Together: Console Edition 02.009.002), character intro cutscene, seconds 40–50 after launch, 3840x2160 ### What is slow or what changed On macOS (Apple M2, MoltenVK, Rosetta), most of the draw committer's time goes to whole-image write-backs of linear render targets right after draws (`linear target`): ~1,900 stores / ~25.6 GB per 10 s. Cause, traced with temporary instrumentation: the title clears its linear targets every frame with buffer fills (`Driver::storeBufferFill` → `StorageTexture::FillClear` → `MarkDirty`). Because no draw is being recorded, `markLayersPending` sets `pendingFromOthers`, so the next `MarkDrawn` returns false and `keepRecordedDraw` (`Draw.cpp` ~2540) stores the whole target after every draw. 17,995 of 18,000 sampled `MarkDrawn` calls hit this. Two prototypes, same binary at `65351c2931`, switched by env: 1. Treat a whole-image fill clear as a full drawn rectangle: worse (~34 FPS). The stores move to `StoreDrawnLinear("flip")` at 45.6 GB / 10 s. 2. `APS5_DEFER_LINEAR_STORE=1` (diff below): when the draw-time store would run and the target is `Cached()`, `MarkDirty()` instead, leaving the store to the next flip/label. The frame looks correct by eye, but correctness is not checked beyond that. | | base | deferred | |---|---|---| | presents in 10 s | 420 | 458 | | frame p50 / p90 / p99 / max | 23.4 / 26.8 / 28.9 / 29.5 ms | 21.5 / 22.9 / 28.2 / 47.3 ms | | GPU busy per present | 19.1 ms | 16.6 ms | | draw committer busy per frame | 10.9 ms | 0.5 ms | | write-backs / 10 s | linear target 1,900 / 25.6 GB | flip ~2,250 / 30.3 GB | Deferring helps the median, but the bytes only move: `Driver.Packet.flip_flush` / `Recorder.Sync` now costs ~16 ms/frame on the queue worker and creates 35–47 ms spikes. Extending the macOS label read traps to `StoreDrawnLinear("flip")` (same eligibility as `StoreReadbackBeforeLabel`) trapped nothing here; these targets presumably fail the shared-page test. Relation to #9685 and #8152: #9685 stores resident linear targets only at completion points and over their drawn rectangles, but a fill clear sets `pendingFromOthers`, which turns that tracking off, so this title falls back to the per-draw whole store. Prototype 2 stores whole images later, so it likely reintroduces the #8152 hazard (CPU stores made after the draw get overwritten); it is a measurement, not a fix. Open question for the AGC maintainers: is the whole-target store after a fill-cleared draw needed for correctness? Fill clears could instead keep rectangle tracking (or be recorded as a known clear value) so only the drawn rectangles are stored, without falling back to a full store per draw. I have not opened a PR; the prototype is not something I would propose as-is. ```diff diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp index 48b9d7807b..c36a5eb732 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp @@ -2542,7 +2542,12 @@ void keepRecordedDraw(Recorder& recorder, const std::shared_ptr<ShaderResources> else if (index < slices.size()) residents[index]->MarkSliceDirty(slices[index].first, slices[index].second); else residents[index]->MarkDirty(); } + static const bool deferLinear = std::getenv("APS5_DEFER_LINEAR_STORE") != nullptr; for (std::size_t index = 0; index < residents.size(); ++index) { + if (storeNow[index] && deferLinear && residents[index]->Cached()) { + residents[index]->MarkDirty(); + continue; + } if (storeNow[index]) StorageTexture::FlushPending(residents[index]->Descriptor().baseAddress, static_cast<std::size_t>(residents[index]->GuestBytes()), nullptr, "linear target"); } } ``` Measured on `65351c2931` (main has moved since, including #11485). I will re-measure on current main if useful. ### Summary lines ```json {"commit":"65351c2931ec","dirty":true,"env":{"APS5_TRACE_SECONDS":"40:10"},"gpu":"Apple M2","driver":"MoltenVK 1.4.2","os":"Darwin 27.3.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":8,"memory_mib":16384,"title_id":"PPSA02070","title":"Don't Starve Together: Console Edition","content_version":"02.009.002","resolution":"3840x2160","window":{"spec":"seconds 40:10","first_present":1623,"ms":10008.396},"presents":420,"frame_ms":{"p50":23.365,"p90":26.826,"p99":28.924,"max":29.478},"gpu_busy_ms_per_present":19.103,"worker_busy_pct":{"queue worker 0x0":50.392},"top_phases_ms_per_frame":{"Driver.Packet":12.005,"VideoOut.Flip":11.488,"Driver.Packet.dispatch":11.283,"Driver.Present":10.741,"VideoOut.Flip.present":10.718,"Vulkan.Retire":10.468,"Driver.Present.render_fence_wait":10.468,"Vulkan.Retire.wait":10.461},"owned_draw_counts":{},"trace_dropped":false,"trace":"aps5-trace-65351c2931ec-16195.json.gz"} {"commit":"65351c2931ec","dirty":true,"env":{"APS5_DEFER_LINEAR_STORE":"1","APS5_TRACE_SECONDS":"40:10"},"gpu":"Apple M2","driver":"MoltenVK 1.4.2","os":"Darwin 27.3.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":8,"memory_mib":16384,"title_id":"PPSA02070","title":"Don't Starve Together: Console Edition","content_version":"02.009.002","resolution":"3840x2160","window":{"spec":"seconds 40:10","first_present":1823,"ms":10020.501},"presents":458,"frame_ms":{"p50":21.496,"p90":22.888,"p99":28.182,"max":47.258},"gpu_busy_ms_per_present":16.609,"worker_busy_pct":{"queue worker 0x0":80.207},"top_phases_ms_per_frame":{"Driver.Packet":17.543,"Driver.Packet.flip_flush":15.96,"Recorder.Sync":15.64,"VideoOut.Flip":4.028,"VideoOut.Flip.present":3.209,"Driver.Present":3.209,"Vulkan.Retire":2.867,"Driver.Present.render_fence_wait":2.867},"owned_draw_counts":{},"trace_dropped":false,"trace":"aps5-trace-65351c2931ec-17101.json.gz"} ``` ### Traces Not attached yet (the GitHub CLI cannot upload files); available on request: `aps5-trace-65351c2931ec-16195.json.gz` (base), `aps5-trace-65351c2931ec-17101.json.gz` (deferred). ### Digest <details><summary>base</summary> **seconds 40:10** from present 1623: 420 presents, frame p50 23.4 / p90 26.8 / p99 28.9 / max 29.5 ms, GPU busy 19.1 ms per present Apple M2, MoltenVK 1.4.2, Darwin 27.3.0, 3840x2160, commit 65351c2931ec (dirty), dropped: no ```json {"commit":"65351c2931ec","dirty":true,"env":{"APS5_TRACE_SECONDS":"40:10"},"gpu":"Apple M2","driver":"MoltenVK 1.4.2","os":"Darwin 27.3.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":8,"memory_mib":16384,"title_id":"PPSA02070","title":"Don't Starve Together: Console Edition","content_version":"02.009.002","resolution":"3840x2160","window":{"spec":"seconds 40:10","first_present":1623,"ms":10008.396},"presents":420,"frame_ms":{"p50":23.365,"p90":26.826,"p99":28.924,"max":29.478},"gpu_busy_ms_per_present":19.103,"worker_busy_pct":{"queue worker 0x0":50.392},"top_phases_ms_per_frame":{"Driver.Packet":12.005,"VideoOut.Flip":11.488,"Driver.Packet.dispatch":11.283,"Driver.Present":10.741,"VideoOut.Flip.present":10.718,"Vulkan.Retire":10.468,"Driver.Present.render_fence_wait":10.468,"Vulkan.Retire.wait":10.461},"owned_draw_counts":{},"trace_dropped":false,"trace":"aps5-trace-65351c2931ec-16195.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 1946: 29.5 ms at 7645 ms: batch (gpu) 24.6, Driver.WorkerWait (queue worker 0x0) 15.2, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 15.2, VideoOut.Flip (presenter) 15.1 - present 1780: 29.3 ms at 3728 ms: batch (gpu) 24.7, Driver.WorkerWait (queue worker 0x0) 15.1, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 15.1, VideoOut.Flip (presenter) 15.1 - present 1943: 29.1 ms at 7561 ms: batch (gpu) 24.4, Driver.WorkerWait (queue worker 0x0) 14.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 14.8, VideoOut.Flip (presenter) 14.7 - present 1835: 29.1 ms at 5067 ms: batch (gpu) 22.9, Driver.WorkerWait (queue worker 0x0) 13.6, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 13.6, Driver.Packet (queue worker 0x0) 13.2 - present 1777: 28.9 ms at 3643 ms: batch (gpu) 24.1, Driver.WorkerWait (queue worker 0x0) 14.6, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 14.6, VideoOut.Flip (presenter) 14.4 **Persistent spikes** (frame time above the fastest frame that separates it from a longer frame; one entry per stall, not per frame) - present 1946: 29.5 ms at 7645 ms, persistence 11.3 ms - present 1780: 29.3 ms at 3728 ms, persistence 11.2 ms - present 1835: 29.1 ms at 5067 ms, persistence 7.8 ms - present 1674: 28.3 ms at 1212 ms, persistence 7.2 ms - present 2039: 28.0 ms at 9900 ms, persistence 6.7 ms **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 0.1 (0 %) | 0.0 (0 %) | 23.7 | 0.8 | Shader.ResolveGraphicsAbi 0.0, Shader.ResolveAbi 0.0 | | queue worker 0x0 | 11.7 (49 %) | 11.6 (49 %) | 0.5 | 1.1 | Driver.Packet 11.7, Driver.Completion 0.0 | | draw committer | 10.9 (46 %) | 0.0 (0 %) | 13.0 | 0.2 | Vulkan.DrawFromRecipe 5.4, Graphics.Draw 5.4 | | presenter | 1.0 (4 %) | 10.5 (44 %) | 12.3 | 0.1 | VideoOut.Flip 11.5, Driver.Present 0.0 | | gpu | 19.1 (80 %) | 0.0 (0 %) | 4.8 | 0.0 | batch 19.1 | **Largest slices** (ms per frame, inclusive, all threads): batch 19.1, Driver.Packet 11.7, Driver.WorkerWait 11.6, Driver.WorkerWait.idle_and_completion_poll 11.6, VideoOut.Flip 11.5 **Longest waits** - Driver.WorkerWait (queue worker 0x0) 15.2 ms at 7645 ms, present 1945 - Driver.WorkerWait (queue worker 0x0) 15.1 ms at 3728 ms, present 1780 - Driver.WorkerWait (queue worker 0x0) 15.0 ms at 1323 ms, present 1677 - Driver.WorkerWait (queue worker 0x0) 14.8 ms at 7561 ms, present 1942 - Driver.WorkerWait (queue worker 0x0) 14.7 ms at 7675 ms, present 1947 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 1291: 13.5 ms at 7645 ms, present 1945: GPU no ranges; recorded by Graphics.Draw (draw committer) 8.6, Graphics.Draw.draw_and_resource_release (draw committer) 8.6, Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2 - batch 627: 13.5 ms at 3728 ms, present 1779: GPU no ranges; recorded by Graphics.Draw (draw committer) 8.8, Graphics.Draw.draw_and_resource_release (draw committer) 8.8, Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2 - batch 1279: 13.1 ms at 7561 ms, present 1942: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 8.7, Graphics.DrawWithRecipe (draw committer) 8.7, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 8.7, Graphics.Draw (draw committer) 0.2 - batch 1295: 13.0 ms at 7675 ms, present 1946: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 9.5, Graphics.DrawWithRecipe (draw committer) 9.5, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 9.5, Graphics.Draw (draw committer) 0.3 - batch 615: 12.9 ms at 3643 ms, present 1776: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 8.7, Graphics.DrawWithRecipe (draw committer) 8.7, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 8.6, Graphics.Draw (draw committer) 0.2 </details> <details><summary>APS5_DEFER_LINEAR_STORE=1</summary> **seconds 40:10** from present 1823: 458 presents, frame p50 21.5 / p90 22.9 / p99 28.2 / max 47.3 ms, GPU busy 16.6 ms per present Apple M2, MoltenVK 1.4.2, Darwin 27.3.0, 3840x2160, commit 65351c2931ec (dirty), dropped: no ```json {"commit":"65351c2931ec","dirty":true,"env":{"APS5_DEFER_LINEAR_STORE":"1","APS5_TRACE_SECONDS":"40:10"},"gpu":"Apple M2","driver":"MoltenVK 1.4.2","os":"Darwin 27.3.0","cpu":"VirtualApple @ 2.50GHz","cpu_threads":8,"memory_mib":16384,"title_id":"PPSA02070","title":"Don't Starve Together: Console Edition","content_version":"02.009.002","resolution":"3840x2160","window":{"spec":"seconds 40:10","first_present":1823,"ms":10020.501},"presents":458,"frame_ms":{"p50":21.496,"p90":22.888,"p99":28.182,"max":47.258},"gpu_busy_ms_per_present":16.609,"worker_busy_pct":{"queue worker 0x0":80.207},"top_phases_ms_per_frame":{"Driver.Packet":17.543,"Driver.Packet.flip_flush":15.96,"Recorder.Sync":15.64,"VideoOut.Flip":4.028,"VideoOut.Flip.present":3.209,"Driver.Present":3.209,"Vulkan.Retire":2.867,"Driver.Present.render_fence_wait":2.867},"owned_draw_counts":{},"trace_dropped":false,"trace":"aps5-trace-65351c2931ec-17101.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 1900: 47.3 ms at 1703 ms: Driver.Packet (queue worker 0x0) 42.5, Driver.Packet.flip_flush (queue worker 0x0) 41.4, Recorder.Sync (queue worker 0x0) 40.8, Recorder.Submit (queue worker 0x0) 18.7 - present 2202: 37.7 ms at 8239 ms: Driver.Packet (queue worker 0x0) 28.5, Driver.Packet.flip_flush (queue worker 0x0) 27.3, Recorder.Sync (queue worker 0x0) 25.9, batch (gpu) 18.3 - present 2254: 35.1 ms at 9406 ms: Driver.Packet (queue worker 0x0) 25.1, Driver.Packet.flip_flush (queue worker 0x0) 23.5, Recorder.Sync (queue worker 0x0) 22.9, batch (gpu) 19.0 - present 2255: 34.0 ms at 9441 ms: Driver.Packet (queue worker 0x0) 20.5, Driver.Packet.flip_flush (queue worker 0x0) 17.3, Recorder.Sync (queue worker 0x0) 16.9, batch (gpu) 15.6 - present 2203: 28.2 ms at 8277 ms: Driver.Packet (queue worker 0x0) 19.0, batch (gpu) 17.2, Driver.Packet.flip_flush (queue worker 0x0) 17.1, Recorder.Sync (queue worker 0x0) 16.6 **Persistent spikes** (frame time above the fastest frame that separates it from a longer frame; one entry per stall, not per frame) - present 1900: 47.3 ms at 1703 ms, persistence 26.6 ms - present 2202: 37.7 ms at 8239 ms, persistence 17.0 ms - present 2254: 35.1 ms at 9406 ms, persistence 14.2 ms - present 1828: 25.1 ms at 122 ms, persistence 3.9 ms - present 2123: 24.2 ms at 6547 ms, persistence 3.4 ms **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 0.0 (0 %) | 0.0 (0 %) | 21.9 | 0.7 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | queue worker 0x0 | 17.2 (79 %) | 4.1 (19 %) | 0.5 | 1.0 | Driver.Packet 17.2, Driver.Completion 0.0 | | draw committer | 0.5 (2 %) | 0.0 (0 %) | 21.3 | 0.2 | Vulkan.DrawFromRecipe 0.2, Graphics.Draw 0.2 | | presenter | 1.2 (5 %) | 2.9 (13 %) | 17.8 | 0.1 | VideoOut.Flip 4.0, Driver.Present 0.0 | | gpu | 16.6 (76 %) | 0.0 (0 %) | 5.3 | 0.0 | batch 16.6 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 17.2, batch 16.6, Driver.Packet.flip_flush 16.0, Recorder.Sync 15.6, Driver.WorkerWait 4.1 **Longest waits** - Driver.WorkerWait (queue worker 0x0) 12.8 ms at 9441 ms, present 2254 - Driver.WorkerWait (queue worker 0x0) 8.5 ms at 8277 ms, present 2202 - Driver.WorkerWait (queue worker 0x0) 7.7 ms at 1750 ms, present 1900 - Driver.WorkerWait (queue worker 0x0) 5.0 ms at 2176 ms, present 1919 - Driver.WorkerWait (queue worker 0x0) 4.9 ms at 8171 ms, present 2198 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 9: 14.3 ms at 55 ms, present 1825: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.3, Graphics.DrawWithRecipe (draw committer) 0.3, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Graphics.Draw (draw committer) 0.2 - batch 17: 14.3 ms at 104 ms, present 1827: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.4, Graphics.DrawWithRecipe (draw committer) 0.4, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Graphics.Draw (draw committer) 0.2 - batch 5: 14.1 ms at 31 ms, present 1824: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.4, Graphics.Draw.draw_and_resource_release (draw committer) 0.3, Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2 - batch 1: 14.1 ms at 7 ms, present 1823: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.4, Graphics.DrawWithRecipe (draw committer) 0.4, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Graphics.Draw (draw committer) 0.2 - batch 1201: 14.1 ms at 6554 ms, present 2123: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.4, Graphics.DrawWithRecipe (draw committer) 0.4, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Graphics.Draw (draw committer) 0.3 </details> ### Capture - [x] 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 (no other switches were set; the log went to /dev/null) - [x] Captures compared here come from the same machine, scene and settings
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#18785
No description provided.