perf(agc): forward an indirect record's patched user word as push data #9248

Merged
fisherjoey merged 5 commits from upstream-pr/9248 into main 2026-11-08 23:45:34 +00:00
fisherjoey commented 2026-10-21 16:32:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-21T16:32:53Z.


What

On the CPU path of an indirect draw, each record patches a user word (base vertex, start instance or draw index) into the programs that hold it, and Driver::draw captures and recompiles those stages again per record. With APS5_DRAW_CACHE_INDIRECT (#9243) a hit skips the first pass and reuses the fragment stage, but that per-record materialization stays: 24 to 31 us per record, about 17% of the queue 0 time on Demon's Souls, where every DRAW_INDEX_INDIRECT packet patches START_INSTANCE into GS user word 2 (s10) and the vertex program reads it as a value (the record's firstInstance is a small object index).

With APS5_DRAW_CACHE_PUSH_WORD set, the record's word is written into the stage's forwarded push data instead: the slot shaderDataUserWords names, and the ShaderData binding's descriptor word when that data lives in a buffer. That is the same patch applyShaderDataPatches already makes for a relocated entry, so the write moved into patchForwardedWord and both use it. The compiled stage is kept. A word is forwarded only when all three hold:

  • The SRT walker never read it, as a pointer base or as a value. For a fresh capture that is the capture's SrtUserDataUse (asBase | asValue); for a cached stage it is the new DispatchVariant::userWordsWalked, which tagVariantRuns records at insert and relocateDrawEntry copies. A word at or beyond TrackedWords is never forwarded.
  • The vertex stage info decoded with the patched word is the same as before it.
  • The stage is not the front stage of a mesh draw.

Otherwise the record materializes the stage as before. Tessellation control and evaluation stages keep their per-record materialization too (they are patched with the record's parameters, not a word).

Why this is sound: a stage's materialization depends on its user words through four paths. The SRT walker records every word it reads in SrtUserDataUse; ShaderDataDwordsFor copies the GetUserData reads that survive into the push data or the ShaderData buffer; DecodeVertexStageInfo reads the fetch-shader and vertex-table pointers; and the mesh front stage has hidden words. The walk is a deterministic function of the words it reads, so a word it never read cannot change the regions it captured, the descriptors it resolved, the flat SRT or the specialization. The second path is reproduced by writing the slot, the third is checked, the fourth is excluded. On a hit the cached walk is the walk for this packet, because the register key matched the user words and the validation matched the memory. relocatableWords uses asBase & ~asValue; this check uses the union, which is stricter.

APS5_VERIFY_DRAW_PUSH_WORD builds every forwarded stage in full as well and throws when its variant, push constants, bindings or forwarded words differ from the patched result, or when the full build's walk read the word. The [draw-cache] indirect records (10 s) profile line counts words forwarded, stages re-materialized, words refused and words verified. Both switches have rows in docs/dev/ENVIRONMENT.md.

Related, not overlapping: #5609 (@TheAggie, open) and #9177 (@milescoviello, open) change Draw.cpp and the draw-cache headers near these lines (relocation by moved base addresses, and fewer per-draw allocations on the materialize path). Neither forwards a record's word, so whichever lands second needs a textual rebase only.

Depends on #9243: the hit path this PR uses for cached stages (matched[programIndex]->userWordsWalked) only sees CPU-path indirect draws when they are admitted. The switch also works on misses without it.

Tested

  • New agc_driver_draw_cache_reuse_push_word and agc_driver_draw_cache_reuse_push_word_verify (the agc_driver_draw_cache_reuse_tests binary with APS5_DRAW_CACHE_INDIRECT=1 APS5_DRAW_CACHE_PUSH_WORD=1, the second also with APS5_VERIFY_DRAW_PUSH_WORD=1): a vertex program reads the user word a DRAW_INDIRECT packet's base vertex is patched into as a value, and four records set it to move a triangle off screen three times and on screen once. The record's value has to reach the shader on the miss and on the two hits (nothing drawn with 4, the triangle drawn with 0), 4 words forwarded, 0 stages re-materialized, 0 refused, and 4 verified in the verify variant. Without APS5_DRAW_CACHE_PUSH_WORD the same draws forward 0 words and re-materialize 4 stages, which the _indirect variant from #9243 checks. All seven agc_driver_draw_cache_reuse* variants pass on lavapipe (Mesa llvmpipe) and on the RTX 5070 Ti (ANYPS5_REQUIRE_VULKAN=1), on this branch at main cecb540a6, Linux, Release, GCC 16.2. On main the last drawable record of a CPU-path indirect draw is queued on the draw pipeline (#6931), so the record counters are added before that enqueue as well as after the loop; the first port of this change missed that and the new tests caught it (0 of 4 words counted).
  • Rebased onto #9243's RecordsKeepThePacketsFragmentWord commit; that test runs in all seven variants here too, with the push word forwarding the vertex word per record while the fragment word stays the packet's. All seven pass on lavapipe and on the RTX 5070 Ti after the rebase.
  • ctest -R agc on lavapipe, ANYPS5_NO_SHADER_CACHE=1: 859 of 860 pass. The one failure is agc_driver_multisample_retirement, the same one as on #9243's branch; it passes on the RTX 5070 Ti and does not reach the draw cache. The 26 draw-cache, draw-data-hit, key-miss, register-key and indirect-draw tests pass on the RTX 5070 Ti. The Khronos validation layer is not installed here, so the validation-layer comparison against main is not done.
  • python3 tools/check_conventions.py against #9243's branch passes.
  • Demon's Souls PPSA01341 v1.07, Linux (Nobara, kernel 7.2), RTX 5070 Ti, driver 595.91.07. Six 900 s runs from boot through New Game into the first level, alternating this change and its base on the same day, measuring mode, no stream, caps and preload identical on both arms. The two sets differ only in libSceAgcDriver.prx. Medians over the level windows (10 s each, 65 to 68 per run), from the [packets], [draw] and [draw-cache] profile lines.
    • These runs were not on plain main. The base was main 676269473 plus #6280, #6926, #7844, #8047, #7984, #7981, #7930 and #9243 with APS5_DRAW_CACHE_INDIRECT=1, a local stencil-export workaround this GPU needs to reach the level (never upstream), and two local diagnostics that were off. The change arm was the same set with this PR's driver and APS5_DRAW_CACHE_INDIRECT=1 APS5_DRAW_CACHE_PUSH_WORD=1.
    • Queue 0 packet time per present 798.5 vs 884.4 ms (-9.7%; per run 796.1, 813.1, 786.3 vs 878.2, 895.6, 879.5, no overlap). Presents per 10 s in the level 11.87 vs 10.76 (+10.3%; 11.91, 11.66, 12.05 vs 10.84, 10.62, 10.82). [draw] 86.0 vs 102.7 us per packet (-16.2%). Capture plus recompile 10.3 vs 24.0 us per packet. GPU busy flat (159.6 to 160.1 vs 158.4 to 160.0 ms per present). Screenshots clean.
    • [draw-cache] indirect records: 60k to 66k patched words forwarded per 10 s, 0 stages re-materialized, 0 refused, on every change run. So on this title the patched word never feeds the SRT walker.
    • Per DRAW_INDEX_INDIRECT packet (last window of one pair): captures 0.17 vs 1.03, capture 4.5 vs 13.8 us, recompile 8.1 vs 9.1, validate 13.7 vs 13.1, total 50 to 51 vs 70 to 74 us. Validation is now the largest cost left on a hit.
    • Against the same stack without #7930, #9243 and this PR: 11.87 vs 9.58 presents per 10 s.
  • The summary lines and traces the perf label asks for are not attached yet. A capture pair (APS5_TRACE_SECONDS, same scene, base and change) follows as a comment.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); this change adds no stubs
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source; none added
  • Generic behaviour, not specific to one title
  • Depends on: #9243
  • Fixes: none
  • Unblocks: none
  • GPUs tested: lavapipe (Mesa llvmpipe), Linux, for the tests; NVIDIA GeForce RTX 5070 Ti, driver 595.91.07, Linux (Nobara, kernel 7.2), for the tests and the game runs
  • AI-assisted: yes

AI-assisted: yes

Performance summary lines

main and this change, same machine and scene. The full captures, traces and digests are in https://github.com/boykopovar/AnyPS5/pull/9248#issuecomment-6326685429.

{"commit":"dd46b3e09585","dirty":false,"env":{"APS5_DRAW_CACHE_INDIRECT":"1","APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2403,"ms":60420.379},"presents":47,"frame_ms":{"p50":1271.848,"p90":1519.619,"p99":2048.945,"max":2048.945},"gpu_busy_ms_per_present":156.459,"worker_busy_pct":{"queue worker 0x0":99.525,"queue worker 0x28":81.517,"queue worker 0x30":98.639,"queue worker 0x20":86.980,"queue worker 0x50":88.778,"queue worker 0x38":96.961,"queue worker 0x48":80.746,"queue worker 0x40":83.999},"top_phases_ms_per_frame":{"Driver.Packet":9215.511,"Driver.Packet.memory_wait":7789.973,"Driver.Packet.draw":929.184,"Driver.Draw":927.227,"Driver.Draw.draw_enqueued":500.001,"Driver.Packet.dispatch":418.997,"Driver.Dispatch":326.507,"Shader.DrawStage":321.166},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":10.372,"events_lost":1194837,"totals_full":false}},"trace":"aps5-trace-dd46b3e09585-3182475.json.gz"}
{"commit":"ab0687554423","dirty":false,"env":{"APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2312,"ms":60982.146},"presents":52,"frame_ms":{"p50":1172.284,"p90":1415.656,"p99":1536.414,"max":1536.414},"gpu_busy_ms_per_present":156.697,"worker_busy_pct":{"queue worker 0x0":99.577,"queue worker 0x48":79.363,"queue worker 0x40":82.780,"queue worker 0x30":98.471,"queue worker 0x28":80.222,"queue worker 0x50":87.901,"queue worker 0x20":86.331,"queue worker 0x38":96.722},"top_phases_ms_per_frame":{"Driver.Packet":8338.417,"Driver.Packet.memory_wait":7024.596,"Driver.Packet.draw":833.329,"Driver.Draw":831.704,"Driver.Packet.dispatch":413.997,"Driver.Draw.draw_enqueued":385.831,"Driver.Dispatch":321.362,"Driver.Draw.shader_compile_and_link":320.153},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":12.645,"events_lost":1010793,"totals_full":false}},"trace":"aps5-trace-ab0687554423-3238611.json.gz"}
{"commit":"3e72d893778d","dirty":false,"env":{"APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2883,"ms":60321.019},"presents":50,"frame_ms":{"p50":1183.067,"p90":1376.162,"p99":1632.915,"max":1632.915},"gpu_busy_ms_per_present":155.402,"worker_busy_pct":{"queue worker 0x0":99.509,"queue worker 0x20":87.538,"queue worker 0x28":82.007,"queue worker 0x30":98.647,"queue worker 0x50":88.657,"queue worker 0x38":96.965,"queue worker 0x40":84.399,"queue worker 0x48":81.222},"top_phases_ms_per_frame":{"Driver.Packet":8669.965,"Driver.Packet.memory_wait":7341.848,"Driver.Packet.draw":895.824,"Driver.Draw":893.870,"Driver.Draw.draw_enqueued":426.271,"Shader.DrawStage":379.582,"Driver.Packet.dispatch":373.842,"Driver.Draw.shader_compile_and_link":333.911},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":10.162,"events_lost":1338036,"totals_full":false}},"trace":"aps5-trace-3e72d893778d-3139565.json.gz"}
{"commit":"3e72d893778d","dirty":false,"env":{"APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2351,"ms":60729.568},"presents":48,"frame_ms":{"p50":1225.973,"p90":1507.486,"p99":1802.503,"max":1802.503},"gpu_busy_ms_per_present":153.840,"worker_busy_pct":{"queue worker 0x0":99.496,"queue worker 0x28":81.294,"queue worker 0x48":80.521,"queue worker 0x20":86.714,"queue worker 0x50":88.187,"queue worker 0x38":97.188,"queue worker 0x40":83.561,"queue worker 0x30":98.586},"top_phases_ms_per_frame":{"Driver.Packet":9049.414,"Driver.Packet.memory_wait":7651.717,"Driver.Packet.draw":922.369,"Driver.Draw":920.258,"Driver.Draw.draw_enqueued":424.276,"Driver.Packet.dispatch":408.618,"Shader.DrawStage":404.616,"Driver.Draw.shader_compile_and_link":352.944},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":10.319,"events_lost":1324421,"totals_full":false}},"trace":"aps5-trace-3e72d893778d-3303223.json.gz"}
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4954951419 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9248). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-21T16:32:53Z. --- ### What On the CPU path of an indirect draw, each record patches a user word (base vertex, start instance or draw index) into the programs that hold it, and `Driver::draw` captures and recompiles those stages again per record. With `APS5_DRAW_CACHE_INDIRECT` (#9243) a hit skips the first pass and reuses the fragment stage, but that per-record materialization stays: 24 to 31 us per record, about 17% of the queue 0 time on Demon's Souls, where every `DRAW_INDEX_INDIRECT` packet patches `START_INSTANCE` into GS user word 2 (`s10`) and the vertex program reads it as a value (the record's `firstInstance` is a small object index). With `APS5_DRAW_CACHE_PUSH_WORD` set, the record's word is written into the stage's forwarded push data instead: the slot `shaderDataUserWords` names, and the `ShaderData` binding's descriptor word when that data lives in a buffer. That is the same patch `applyShaderDataPatches` already makes for a relocated entry, so the write moved into `patchForwardedWord` and both use it. The compiled stage is kept. A word is forwarded only when all three hold: - The SRT walker never read it, as a pointer base or as a value. For a fresh capture that is the capture's `SrtUserDataUse` (`asBase | asValue`); for a cached stage it is the new `DispatchVariant::userWordsWalked`, which `tagVariantRuns` records at insert and `relocateDrawEntry` copies. A word at or beyond `TrackedWords` is never forwarded. - The vertex stage info decoded with the patched word is the same as before it. - The stage is not the front stage of a mesh draw. Otherwise the record materializes the stage as before. Tessellation control and evaluation stages keep their per-record materialization too (they are patched with the record's parameters, not a word). Why this is sound: a stage's materialization depends on its user words through four paths. The SRT walker records every word it reads in `SrtUserDataUse`; `ShaderDataDwordsFor` copies the `GetUserData` reads that survive into the push data or the ShaderData buffer; `DecodeVertexStageInfo` reads the fetch-shader and vertex-table pointers; and the mesh front stage has hidden words. The walk is a deterministic function of the words it reads, so a word it never read cannot change the regions it captured, the descriptors it resolved, the flat SRT or the specialization. The second path is reproduced by writing the slot, the third is checked, the fourth is excluded. On a hit the cached walk is the walk for this packet, because the register key matched the user words and the validation matched the memory. `relocatableWords` uses `asBase & ~asValue`; this check uses the union, which is stricter. `APS5_VERIFY_DRAW_PUSH_WORD` builds every forwarded stage in full as well and throws when its variant, push constants, bindings or forwarded words differ from the patched result, or when the full build's walk read the word. The `[draw-cache] indirect records (10 s)` profile line counts words forwarded, stages re-materialized, words refused and words verified. Both switches have rows in `docs/dev/ENVIRONMENT.md`. Related, not overlapping: #5609 (@TheAggie, open) and #9177 (@milescoviello, open) change `Draw.cpp` and the draw-cache headers near these lines (relocation by moved base addresses, and fewer per-draw allocations on the materialize path). Neither forwards a record's word, so whichever lands second needs a textual rebase only. Depends on #9243: the hit path this PR uses for cached stages (`matched[programIndex]->userWordsWalked`) only sees CPU-path indirect draws when they are admitted. The switch also works on misses without it. ### Tested - New `agc_driver_draw_cache_reuse_push_word` and `agc_driver_draw_cache_reuse_push_word_verify` (the `agc_driver_draw_cache_reuse_tests` binary with `APS5_DRAW_CACHE_INDIRECT=1 APS5_DRAW_CACHE_PUSH_WORD=1`, the second also with `APS5_VERIFY_DRAW_PUSH_WORD=1`): a vertex program reads the user word a `DRAW_INDIRECT` packet's base vertex is patched into as a value, and four records set it to move a triangle off screen three times and on screen once. The record's value has to reach the shader on the miss and on the two hits (nothing drawn with 4, the triangle drawn with 0), 4 words forwarded, 0 stages re-materialized, 0 refused, and 4 verified in the verify variant. Without `APS5_DRAW_CACHE_PUSH_WORD` the same draws forward 0 words and re-materialize 4 stages, which the `_indirect` variant from #9243 checks. All seven `agc_driver_draw_cache_reuse*` variants pass on lavapipe (Mesa llvmpipe) and on the RTX 5070 Ti (`ANYPS5_REQUIRE_VULKAN=1`), on this branch at main cecb540a6, Linux, Release, GCC 16.2. On `main` the last drawable record of a CPU-path indirect draw is queued on the draw pipeline (#6931), so the record counters are added before that enqueue as well as after the loop; the first port of this change missed that and the new tests caught it (0 of 4 words counted). - Rebased onto #9243's `RecordsKeepThePacketsFragmentWord` commit; that test runs in all seven variants here too, with the push word forwarding the vertex word per record while the fragment word stays the packet's. All seven pass on lavapipe and on the RTX 5070 Ti after the rebase. - `ctest -R agc` on lavapipe, `ANYPS5_NO_SHADER_CACHE=1`: 859 of 860 pass. The one failure is `agc_driver_multisample_retirement`, the same one as on #9243's branch; it passes on the RTX 5070 Ti and does not reach the draw cache. The 26 draw-cache, draw-data-hit, key-miss, register-key and indirect-draw tests pass on the RTX 5070 Ti. The Khronos validation layer is not installed here, so the validation-layer comparison against `main` is not done. - `python3 tools/check_conventions.py` against #9243's branch passes. - Demon's Souls PPSA01341 v1.07, Linux (Nobara, kernel 7.2), RTX 5070 Ti, driver 595.91.07. Six 900 s runs from boot through New Game into the first level, alternating this change and its base on the same day, measuring mode, no stream, caps and preload identical on both arms. The two sets differ only in `libSceAgcDriver.prx`. Medians over the level windows (10 s each, 65 to 68 per run), from the `[packets]`, `[draw]` and `[draw-cache]` profile lines. - These runs were not on plain `main`. The base was main 676269473 plus #6280, #6926, #7844, #8047, #7984, #7981, #7930 and #9243 with `APS5_DRAW_CACHE_INDIRECT=1`, a local stencil-export workaround this GPU needs to reach the level (never upstream), and two local diagnostics that were off. The change arm was the same set with this PR's driver and `APS5_DRAW_CACHE_INDIRECT=1 APS5_DRAW_CACHE_PUSH_WORD=1`. - Queue 0 packet time per present 798.5 vs 884.4 ms (-9.7%; per run 796.1, 813.1, 786.3 vs 878.2, 895.6, 879.5, no overlap). Presents per 10 s in the level 11.87 vs 10.76 (+10.3%; 11.91, 11.66, 12.05 vs 10.84, 10.62, 10.82). `[draw]` 86.0 vs 102.7 us per packet (-16.2%). Capture plus recompile 10.3 vs 24.0 us per packet. GPU busy flat (159.6 to 160.1 vs 158.4 to 160.0 ms per present). Screenshots clean. - `[draw-cache] indirect records`: 60k to 66k patched words forwarded per 10 s, 0 stages re-materialized, 0 refused, on every change run. So on this title the patched word never feeds the SRT walker. - Per `DRAW_INDEX_INDIRECT` packet (last window of one pair): captures 0.17 vs 1.03, capture 4.5 vs 13.8 us, recompile 8.1 vs 9.1, validate 13.7 vs 13.1, total 50 to 51 vs 70 to 74 us. Validation is now the largest cost left on a hit. - Against the same stack without #7930, #9243 and this PR: 11.87 vs 9.58 presents per 10 s. - The summary lines and traces the `perf` label asks for are not attached yet. A capture pair (`APS5_TRACE_SECONDS`, same scene, base and change) follows as a comment. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); this change adds no stubs - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source; none added - [x] Generic behaviour, not specific to one title - [x] Depends on: #9243 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: lavapipe (Mesa llvmpipe), Linux, for the tests; NVIDIA GeForce RTX 5070 Ti, driver 595.91.07, Linux (Nobara, kernel 7.2), for the tests and the game runs - [x] AI-assisted: yes AI-assisted: yes ### Performance summary lines `main` and this change, same machine and scene. The full captures, traces and digests are in https://github.com/boykopovar/AnyPS5/pull/9248#issuecomment-6326685429. ```json {"commit":"dd46b3e09585","dirty":false,"env":{"APS5_DRAW_CACHE_INDIRECT":"1","APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2403,"ms":60420.379},"presents":47,"frame_ms":{"p50":1271.848,"p90":1519.619,"p99":2048.945,"max":2048.945},"gpu_busy_ms_per_present":156.459,"worker_busy_pct":{"queue worker 0x0":99.525,"queue worker 0x28":81.517,"queue worker 0x30":98.639,"queue worker 0x20":86.980,"queue worker 0x50":88.778,"queue worker 0x38":96.961,"queue worker 0x48":80.746,"queue worker 0x40":83.999},"top_phases_ms_per_frame":{"Driver.Packet":9215.511,"Driver.Packet.memory_wait":7789.973,"Driver.Packet.draw":929.184,"Driver.Draw":927.227,"Driver.Draw.draw_enqueued":500.001,"Driver.Packet.dispatch":418.997,"Driver.Dispatch":326.507,"Shader.DrawStage":321.166},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":10.372,"events_lost":1194837,"totals_full":false}},"trace":"aps5-trace-dd46b3e09585-3182475.json.gz"} {"commit":"ab0687554423","dirty":false,"env":{"APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2312,"ms":60982.146},"presents":52,"frame_ms":{"p50":1172.284,"p90":1415.656,"p99":1536.414,"max":1536.414},"gpu_busy_ms_per_present":156.697,"worker_busy_pct":{"queue worker 0x0":99.577,"queue worker 0x48":79.363,"queue worker 0x40":82.780,"queue worker 0x30":98.471,"queue worker 0x28":80.222,"queue worker 0x50":87.901,"queue worker 0x20":86.331,"queue worker 0x38":96.722},"top_phases_ms_per_frame":{"Driver.Packet":8338.417,"Driver.Packet.memory_wait":7024.596,"Driver.Packet.draw":833.329,"Driver.Draw":831.704,"Driver.Packet.dispatch":413.997,"Driver.Draw.draw_enqueued":385.831,"Driver.Dispatch":321.362,"Driver.Draw.shader_compile_and_link":320.153},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":12.645,"events_lost":1010793,"totals_full":false}},"trace":"aps5-trace-ab0687554423-3238611.json.gz"} {"commit":"3e72d893778d","dirty":false,"env":{"APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2883,"ms":60321.019},"presents":50,"frame_ms":{"p50":1183.067,"p90":1376.162,"p99":1632.915,"max":1632.915},"gpu_busy_ms_per_present":155.402,"worker_busy_pct":{"queue worker 0x0":99.509,"queue worker 0x20":87.538,"queue worker 0x28":82.007,"queue worker 0x30":98.647,"queue worker 0x50":88.657,"queue worker 0x38":96.965,"queue worker 0x40":84.399,"queue worker 0x48":81.222},"top_phases_ms_per_frame":{"Driver.Packet":8669.965,"Driver.Packet.memory_wait":7341.848,"Driver.Packet.draw":895.824,"Driver.Draw":893.870,"Driver.Draw.draw_enqueued":426.271,"Shader.DrawStage":379.582,"Driver.Packet.dispatch":373.842,"Driver.Draw.shader_compile_and_link":333.911},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":10.162,"events_lost":1338036,"totals_full":false}},"trace":"aps5-trace-3e72d893778d-3139565.json.gz"} {"commit":"3e72d893778d","dirty":false,"env":{"APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2351,"ms":60729.568},"presents":48,"frame_ms":{"p50":1225.973,"p90":1507.486,"p99":1802.503,"max":1802.503},"gpu_busy_ms_per_present":153.840,"worker_busy_pct":{"queue worker 0x0":99.496,"queue worker 0x28":81.294,"queue worker 0x48":80.521,"queue worker 0x20":86.714,"queue worker 0x50":88.187,"queue worker 0x38":97.188,"queue worker 0x40":83.561,"queue worker 0x30":98.586},"top_phases_ms_per_frame":{"Driver.Packet":9049.414,"Driver.Packet.memory_wait":7651.717,"Driver.Packet.draw":922.369,"Driver.Draw":920.258,"Driver.Draw.draw_enqueued":424.276,"Driver.Packet.dispatch":408.618,"Shader.DrawStage":404.616,"Driver.Draw.shader_compile_and_link":352.944},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":10.319,"events_lost":1324421,"totals_full":false}},"trace":"aps5-trace-3e72d893778d-3303223.json.gz"} ```
github-actions[bot] commented 2026-10-21 16:33:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T16:33:07Z.


This pull request is labeled perf, so it needs the summary line of a capture on main and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both aps5-summary.jsonl lines, attach the two traces and add the output of tools/trace_digest.py.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6321123280 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9248#issuecomment-6321123280). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-21T16:33:07Z. --- <!-- pr-labels-perf --> This pull request is labeled `perf`, so it needs the summary line of a capture on `main` and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both `aps5-summary.jsonl` lines, attach the two traces and add the output of `tools/trace_digest.py`.
fisherjoey commented 2026-10-21 17:44:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-21T17:44:50Z.


I checked the PRs the overlap bot named by trial-merging each head onto this branch (git merge-tree, no build). None of them does what this PR does. The DrawCapture.cpp overlap comes from #9243, already listed under Depends on.

  • #8372 (verify refreshed stage data): textual. Same resolution as on #9243: keep its stageData parameter plus the drawCacheIndirect() condition, and put both new tests in its else branch. Forwarding happens per record, after cacheDrawStages, so its entry verify never compares a forwarded word.
  • #9129 (bound the draw cache by bytes): textual. Keep both getters in DrawCache.cpp. userWordsWalked is a plain field, so sizeof(DispatchVariant) in variantBytes covers it.
  • #7369 (recipes on the relocated donor): textual. Both add one DispatchVariant field after relocatableWords, and one copy line in relocateDrawEntry; keep both. This PR already copies userWordsWalked to the relocated variant. The recipe path is gated on !drawParameters.indirect, so its donor lookup never meets a forwarded stage.
  • #7446 (prepare again when captured memory changed): textual, though it touches the same loop. It conflicts only where both add declarations before the record loop; keep both. Its check before the first record compares memory. A forwarded stage skips re-capture only for words the SRT walker never read, so its captured regions are the packet's, and the check still covers them. On a retry it calls draw() again, which rebuilds all of this PR's per-packet state.

Apart from #9243 going first, order doesn't matter; whichever lands second takes the resolutions above.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6322615901 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9248#issuecomment-6322615901). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-21T17:44:50Z. --- I checked the PRs the overlap bot named by trial-merging each head onto this branch (`git merge-tree`, no build). None of them does what this PR does. The `DrawCapture.cpp` overlap comes from #9243, already listed under Depends on. - #8372 (verify refreshed stage data): textual. Same resolution as on #9243: keep its `stageData` parameter plus the `drawCacheIndirect()` condition, and put both new tests in its `else` branch. Forwarding happens per record, after `cacheDrawStages`, so its entry verify never compares a forwarded word. - #9129 (bound the draw cache by bytes): textual. Keep both getters in `DrawCache.cpp`. `userWordsWalked` is a plain field, so `sizeof(DispatchVariant)` in `variantBytes` covers it. - #7369 (recipes on the relocated donor): textual. Both add one `DispatchVariant` field after `relocatableWords`, and one copy line in `relocateDrawEntry`; keep both. This PR already copies `userWordsWalked` to the relocated variant. The recipe path is gated on `!drawParameters.indirect`, so its donor lookup never meets a forwarded stage. - #7446 (prepare again when captured memory changed): textual, though it touches the same loop. It conflicts only where both add declarations before the record loop; keep both. Its check before the first record compares `memory`. A forwarded stage skips re-capture only for words the SRT walker never read, so its captured regions are the packet's, and the check still covers them. On a retry it calls `draw()` again, which rebuilds all of this PR's per-packet state. Apart from #9243 going first, order doesn't matter; whichever lands second takes the resolutions above. AI-assisted: yes
fisherjoey commented 2026-10-21 21:13:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-21T21:13:30Z.


Captures for the perf label, on main. Demon's Souls PPSA01341 v1.07, in the first level, 1920x1080, Linux (Nobara, kernel 7.2), RTX 5070 Ti, driver 595.91.07. Four 900 s runs from boot into the level, one session, in this order: main, #9243, this PR, main again. The window is APS5_TRACE_SECONDS=400:60 (60 s from t+400 s, level loaded). The base for this PR is #9243 with its switch on, as in the description, so the pair here is run330 against run331; the two main captures are shown for scale and for the A/A spread. The same four captures are on #9243 with the view from that side.

Setup

  • Base: main cecb540a6 plus the local stencil-export workaround (this GPU needs it to reach the level, never upstream) plus the #6280 mip clamp, which keeps main off the Xid 31 I described on #9243. The trace's commit field, 3e72d893778d, is that local build. dd46b3e09585 is the same tree plus #9243's head b2b765ad4; ab0687554423 adds this PR's head b0442fbd8 on top. Each set differs from main only in libSceAgcDriver.prx (checked with an aps5-libs diff: exactly one file).
  • Caches warm: a 1200 s run of the main set into the level preceded the four captures, and the three sets report the same shader SourceVersion.
  • No other APS5_TRACE_* or APS5_PROFILE_* switch. APS5_VERIFY_DRAW_PUSH_WORD was off. The other APS5_* values in the env field (memory caps, APS5_IGNORE_STENCIL_EXPORT, APS5_GPU_MEASURING, the lock name) are the same on all four arms.
  • One deviation from the form: the game log was written to a file on every arm. The run harness does that and I did not turn it off. It is the same on all four arms, so it does not favour one, but it is not what the form asks.
  • trace_dropped: true in all four: the event buffer of queue worker 0x0 filled after 10.2 to 12.6 s (1.0 to 1.3 M events lost, totals_full: false). The per-slice tables for that worker in the digests cover the first 10 to 13 s of the window; the totals in the summary line (frame_ms, top_phases_ms_per_frame, worker_busy_pct) are not marked full, and the phase comparison below uses those.

Summary lines (aps5-summary.jsonl, verbatim: base run330, this PR run331, then the two mains run329 and run332)

{"commit":"dd46b3e09585","dirty":false,"env":{"APS5_DRAW_CACHE_INDIRECT":"1","APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2403,"ms":60420.379},"presents":47,"frame_ms":{"p50":1271.848,"p90":1519.619,"p99":2048.945,"max":2048.945},"gpu_busy_ms_per_present":156.459,"worker_busy_pct":{"queue worker 0x0":99.525,"queue worker 0x28":81.517,"queue worker 0x30":98.639,"queue worker 0x20":86.980,"queue worker 0x50":88.778,"queue worker 0x38":96.961,"queue worker 0x48":80.746,"queue worker 0x40":83.999},"top_phases_ms_per_frame":{"Driver.Packet":9215.511,"Driver.Packet.memory_wait":7789.973,"Driver.Packet.draw":929.184,"Driver.Draw":927.227,"Driver.Draw.draw_enqueued":500.001,"Driver.Packet.dispatch":418.997,"Driver.Dispatch":326.507,"Shader.DrawStage":321.166},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":10.372,"events_lost":1194837,"totals_full":false}},"trace":"aps5-trace-dd46b3e09585-3182475.json.gz"}
{"commit":"ab0687554423","dirty":false,"env":{"APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2312,"ms":60982.146},"presents":52,"frame_ms":{"p50":1172.284,"p90":1415.656,"p99":1536.414,"max":1536.414},"gpu_busy_ms_per_present":156.697,"worker_busy_pct":{"queue worker 0x0":99.577,"queue worker 0x48":79.363,"queue worker 0x40":82.780,"queue worker 0x30":98.471,"queue worker 0x28":80.222,"queue worker 0x50":87.901,"queue worker 0x20":86.331,"queue worker 0x38":96.722},"top_phases_ms_per_frame":{"Driver.Packet":8338.417,"Driver.Packet.memory_wait":7024.596,"Driver.Packet.draw":833.329,"Driver.Draw":831.704,"Driver.Packet.dispatch":413.997,"Driver.Draw.draw_enqueued":385.831,"Driver.Dispatch":321.362,"Driver.Draw.shader_compile_and_link":320.153},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":12.645,"events_lost":1010793,"totals_full":false}},"trace":"aps5-trace-ab0687554423-3238611.json.gz"}
{"commit":"3e72d893778d","dirty":false,"env":{"APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2883,"ms":60321.019},"presents":50,"frame_ms":{"p50":1183.067,"p90":1376.162,"p99":1632.915,"max":1632.915},"gpu_busy_ms_per_present":155.402,"worker_busy_pct":{"queue worker 0x0":99.509,"queue worker 0x20":87.538,"queue worker 0x28":82.007,"queue worker 0x30":98.647,"queue worker 0x50":88.657,"queue worker 0x38":96.965,"queue worker 0x40":84.399,"queue worker 0x48":81.222},"top_phases_ms_per_frame":{"Driver.Packet":8669.965,"Driver.Packet.memory_wait":7341.848,"Driver.Packet.draw":895.824,"Driver.Draw":893.870,"Driver.Draw.draw_enqueued":426.271,"Shader.DrawStage":379.582,"Driver.Packet.dispatch":373.842,"Driver.Draw.shader_compile_and_link":333.911},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":10.162,"events_lost":1338036,"totals_full":false}},"trace":"aps5-trace-3e72d893778d-3139565.json.gz"}
{"commit":"3e72d893778d","dirty":false,"env":{"APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2351,"ms":60729.568},"presents":48,"frame_ms":{"p50":1225.973,"p90":1507.486,"p99":1802.503,"max":1802.503},"gpu_busy_ms_per_present":153.840,"worker_busy_pct":{"queue worker 0x0":99.496,"queue worker 0x28":81.294,"queue worker 0x48":80.521,"queue worker 0x20":86.714,"queue worker 0x50":88.187,"queue worker 0x38":97.188,"queue worker 0x40":83.561,"queue worker 0x30":98.586},"top_phases_ms_per_frame":{"Driver.Packet":9049.414,"Driver.Packet.memory_wait":7651.717,"Driver.Packet.draw":922.369,"Driver.Draw":920.258,"Driver.Draw.draw_enqueued":424.276,"Driver.Packet.dispatch":408.618,"Shader.DrawStage":404.616,"Driver.Draw.shader_compile_and_link":352.944},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":10.319,"events_lost":1324421,"totals_full":false}},"trace":"aps5-trace-3e72d893778d-3303223.json.gz"}

Traces (a release on my fork; the assets keep their aps5-trace-<commit>-<pid>.json.gz names and open in ui.perfetto.dev)

Frame times (ms, the 60 s window)

run set presents p50 p90 p99 GPU busy ms per present
330 #9243, APS5_DRAW_CACHE_INDIRECT=1 (base) 47 1271.8 1519.6 2048.9 156.5
331 this PR, plus APS5_DRAW_CACHE_PUSH_WORD=1 52 1172.3 1415.7 1536.4 156.7
329 main 50 1183.1 1376.2 1632.9 155.4
332 main again (A/A) 48 1226.0 1507.5 1802.5 153.8

A/A spread of the two main captures: p50 43 ms (3.6%), p90 131 ms, presents 50 against 48.

Reading:

  • Against its base (#9243 alone): p50 -7.8%, p90 -6.8%, p99 -25%, presents 52 against 47 (+10.6%). Same direction and about the same size as the 3v3 on our stack (-9.7% queue 0 time, +10.3% presents), but this is one capture per arm, and the base capture is the worse of the four, so part of that gap is the base's own noise.
  • Against the mean of the two mains (p50 1204.5): p50 -2.7%, p90 -1.8%, presents 52 against 50 and 48. That is inside the A/A spread. On plain main the pair is a small gain that one capture each cannot separate from noise. The draw path itself is a clearer signal, see below. #9243 alone is +5.6% p50 against the main mean, which is why the gap to it is larger than the gap to main.

Where the frame goes, from top_phases_ms_per_frame (ms per frame, summed over threads) and the digest's thread table

phase base 330 this PR 331 main 329 main 332
Driver.Packet 9215.5 8338.4 8670.0 9049.4
Driver.Packet.memory_wait 7790.0 7024.6 7341.8 7651.7
Driver.Packet.draw 929.2 833.3 895.8 922.4
Driver.Draw 927.2 831.7 893.9 920.3
Driver.Draw.draw_enqueued 500.0 385.8 426.3 424.3
Driver.Packet.dispatch 419.0 414.0 373.8 408.6
Shader.DrawStage 321.2 under 320.2 (off the top 8) 379.6 404.6
Driver.Draw.shader_compile_and_link under 321.2 (off the top 8) 320.2 333.9 352.9
draw committer thread, Graphics.Draw 181.2 168.9 135.5 154.6
gpu busy 156.5 156.7 155.4 153.8

What the digests show:

  • The draw path this PR targets does drop. Driver.Draw is 832 ms per frame against 927 on the base (-10.3%) and against 894 and 920 on the two mains (-8.3% against their mean). Driver.Draw.draw_enqueued is 386 against 500 (-23%) and against 426 and 424 on main (-9%). Shader.DrawStage, the stage materialization, falls off the top 8 (under 320 ms per frame, against 321 on the base and 380 and 405 on main). GPU busy is flat at 154 to 157 ms per present, 12 to 13% of the frame, in all four.
  • What does not drop: Driver.Packet.dispatch stays at 414 (419 on the base, 374 and 409 on main), and the draw committer's Graphics.Draw on its own thread is 169 ms per frame, down from 181 on the base but above main's 136 and 155.
  • Why the frame moves less than the draw path on main: the frame here is queue 0. queue worker 0x0 is 99.5% busy in all four captures, and draw plus dispatch summed over the workers is 1250 to 1350 ms per frame against a p50 of 1170 to 1270. The seven other queue workers spend 95 to 100% of the frame in Driver.Packet.memory_wait (about 0.88 of the frame each), the largest slice in each of the five slowest frames of every capture is a memory_wait on queue worker 0x30 of 1.36 to 2.02 s, and memory_wait is 6.0 to 6.2 times p50 on all four arms: it is the other queues waiting for the frame, not a stall of its own. Against the base the frame moves by about the Driver.Draw delta (-96 ms Driver.Draw, -100 ms p50). Against main the Driver.Draw delta is -75 ms but the frame moves -32 ms, with dispatch +23 ms of the difference and the rest within the A/A spread.
  • The 3v3 on our stack had queue 0 at 884 ms per present on its base; on plain main the frame is about 1200 ms and queue 0 is busy for all of it. The digests say where main's frame goes, not which of the stack's PRs account for the shorter queue 0 there, so I am not claiming that here.

Digests, made with tools/trace_digest.py on each trace. The JSON block is the summary line above; the title-thread rows and the GPU batch list are left out for length.

trace_digest.py, run330, PR 9243 dd46b3e09585 (APS5_DRAW_CACHE_INDIRECT=1)

seconds 400:60 from present 2403: 47 presents, frame p50 1271.8 / p90 1519.6 / p99 2048.9 / max 2048.9 ms, GPU busy 156.5 ms per present
NVIDIA GeForce RTX 5070 Ti, NVIDIA 595.91.07, Linux 7.2.0-202.nobara.fc44.x86_64, 1920x1080, commit dd46b3e09585, dropped: yes

Slowest frames (largest slices inside each, inclusive)

  • present 2438: 2048.9 ms at 44451 ms: Driver.Packet (queue worker 0x30) 2030.5, Driver.Packet.memory_wait (queue worker 0x30) 2021.8, Driver.Packet (queue worker 0x38) 1938.1, Driver.Packet.memory_wait (queue worker 0x38) 1923.0
  • present 2406: 1750.1 ms at 3358 ms: Driver.Packet (queue worker 0x30) 1724.9, Driver.Packet.memory_wait (queue worker 0x30) 1719.3, Driver.Packet (queue worker 0x0) 1705.6, Driver.Packet (queue worker 0x38) 1705.4
  • present 2428: 1617.8 ms at 31691 ms: Driver.Packet (queue worker 0x30) 1599.1, Driver.Packet.memory_wait (queue worker 0x30) 1589.9, Driver.Packet (queue worker 0x38) 1587.3, Driver.Packet.memory_wait (queue worker 0x38) 1575.1
  • present 2420: 1556.6 ms at 21372 ms: Driver.Packet (queue worker 0x30) 1535.1, Driver.Packet.memory_wait (queue worker 0x30) 1522.8, Driver.Packet (queue worker 0x38) 1458.5, Driver.Packet.memory_wait (queue worker 0x38) 1440.9
  • present 2413: 1519.6 ms at 12269 ms: Driver.Packet (queue worker 0x30) 1503.8, Driver.Packet.memory_wait (queue worker 0x30) 1492.8, Driver.Packet (queue worker 0x38) 1490.8, Driver.Packet.memory_wait (queue worker 0x38) 1475.0

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 208.9 (16 %) 3.9 (0 %) 1072.7 72.0 Driver.Packet 212.5, Driver.EndSubmission 0.2
presenter 0.9 (0 %) 0.1 (0 %) 1284.5 0.1 VideoOut.Flip 0.9, Driver.Present 0.1
draw committer 184.3 (14 %) 12.9 (1 %) 1088.3 107.8 Graphics.Draw 181.2, Recorder.Submit 2.8
queue worker 0x28 2.2 (0 %) 1282.2 (100 %) 1.1 2.4 Driver.Packet 1047.3, Driver.EndSubmission 0.3
queue worker 0x30 7.6 (1 %) 1277.1 (99 %) 0.8 2.3 Driver.Packet 1267.4, Driver.EndSubmission 0.1
queue worker 0x20 31.4 (2 %) 1253.3 (97 %) 0.8 3.9 Driver.Packet 1117.5, Driver.EndSubmission 0.2
queue worker 0x50 61.4 (5 %) 1220.4 (95 %) 3.7 22.9 Driver.Packet 1138.0, Driver.EndSubmission 0.2
queue worker 0x38 12.9 (1 %) 1272.0 (99 %) 0.6 2.9 Driver.Packet 1245.4, Driver.EndSubmission 0.7
queue worker 0x48 1.8 (0 %) 1279.4 (100 %) 4.3 0.3 Driver.Packet 1037.3, Driver.EndSubmission 0.7
queue worker 0x40 3.2 (0 %) 1281.6 (100 %) 0.7 0.7 Driver.Packet 1079.5, Driver.EndSubmission 0.2
gpu 156.5 (12 %) 0.0 (0 %) 1129.1 0.0 batch 156.5

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 8144.9, Driver.Packet.memory_wait 7788.9, Driver.WorkerWait 1052.0, Driver.WorkerWait.idle_and_completion_poll 1051.9, Graphics.Draw 194.1, Driver.Packet.dispatch 192.2, Graphics.Draw.draw_and_resource_release 162.4, batch 156.5, Driver.Packet.draw 151.9, Driver.Draw 151.4

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x28) 1680.9 ms at 44819 ms, present 2438
  • Driver.Packet.memory_wait (queue worker 0x20) 1639.7 ms at 44814 ms, present 2438
  • Driver.Packet.memory_wait (queue worker 0x28) 1417.5 ms at 3689 ms, present 2406
  • Driver.Packet.memory_wait (queue worker 0x38) 1401.7 ms at 45053 ms, present 2438
  • Driver.Packet.memory_wait (queue worker 0x28) 1351.5 ms at 31957 ms, present 2428
  • Driver.Packet.memory_wait (queue worker 0x20) 1346.8 ms at 3687 ms, present 2406
  • Driver.Packet.memory_wait (queue worker 0x40) 1300.8 ms at 45201 ms, present 2438
  • Driver.Packet.memory_wait (queue worker 0x20) 1261.4 ms at 31952 ms, present 2428
  • Driver.Packet.memory_wait (queue worker 0x28) 1241.1 ms at 14027 ms, present 2414
  • Driver.Packet.memory_wait (queue worker 0x28) 1240.1 ms at 21688 ms, present 2420
trace_digest.py, run331, PR 9248 ab0687554423 (APS5_DRAW_CACHE_INDIRECT=1 APS5_DRAW_CACHE_PUSH_WORD=1)

seconds 400:60 from present 2312: 52 presents, frame p50 1172.3 / p90 1415.7 / p99 1536.4 / max 1536.4 ms, GPU busy 156.7 ms per present
NVIDIA GeForce RTX 5070 Ti, NVIDIA 595.91.07, Linux 7.2.0-202.nobara.fc44.x86_64, 1920x1080, commit ab0687554423, dropped: yes

Slowest frames (largest slices inside each, inclusive)

  • present 2348: 1536.4 ms at 41589 ms: Driver.Packet (queue worker 0x30) 1519.1, Driver.Packet (queue worker 0x38) 1504.4, Driver.Packet.memory_wait (queue worker 0x30) 1503.3, Driver.Packet.memory_wait (queue worker 0x38) 1488.4
  • present 2322: 1499.2 ms at 11690 ms: Driver.Packet (queue worker 0x30) 1483.4, Driver.Packet (queue worker 0x38) 1475.1, Driver.Packet.memory_wait (queue worker 0x30) 1473.7, Driver.Packet.memory_wait (queue worker 0x38) 1458.9
  • present 2362: 1498.7 ms at 58009 ms: Driver.Packet (queue worker 0x30) 1478.8, Driver.Packet.memory_wait (queue worker 0x30) 1465.3, Driver.Packet (queue worker 0x50) 1359.0, Driver.Packet (queue worker 0x38) 1341.9
  • present 2363: 1474.6 ms at 59508 ms: Driver.Packet (queue worker 0x30) 1460.4, Driver.Packet.memory_wait (queue worker 0x30) 1453.1, Driver.Packet (queue worker 0x38) 1444.6, Driver.Packet.memory_wait (queue worker 0x38) 1431.8
  • present 2346: 1464.2 ms at 39032 ms: Driver.Packet (queue worker 0x30) 1453.8, Driver.Packet.memory_wait (queue worker 0x30) 1444.0, Driver.Packet (queue worker 0x38) 1442.5, Driver.Packet.memory_wait (queue worker 0x38) 1429.1

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 228.8 (20 %) 4.0 (0 %) 939.9 61.5 Driver.Packet 232.6, Driver.EndSubmission 0.2
presenter 0.9 (0 %) 0.1 (0 %) 1171.8 0.1 VideoOut.Flip 1.0, Driver.Present 0.0
draw committer 171.2 (15 %) 12.7 (1 %) 988.9 109.4 Graphics.Draw 168.9, Recorder.Submit 1.8
queue worker 0x48 1.7 (0 %) 1167.0 (100 %) 4.1 0.3 Driver.Packet 929.6, Driver.EndSubmission 1.1
queue worker 0x40 3.1 (0 %) 1168.7 (100 %) 0.9 0.7 Driver.Packet 970.3, Driver.EndSubmission 0.2
queue worker 0x30 7.9 (1 %) 1163.9 (99 %) 0.9 2.3 Driver.Packet 1154.1, Driver.EndSubmission 0.2
queue worker 0x28 2.6 (0 %) 1169.5 (100 %) 0.6 2.5 Driver.Packet 940.2, Driver.EndSubmission 0.2
queue worker 0x50 59.4 (5 %) 1109.5 (95 %) 3.9 22.9 Driver.Packet 1027.6, Driver.EndSubmission 0.1
queue worker 0x20 31.5 (3 %) 1140.5 (97 %) 0.7 3.9 Driver.Packet 1011.8, Driver.EndSubmission 0.2
queue worker 0x38 13.1 (1 %) 1159.0 (99 %) 0.7 2.9 Driver.Packet 1133.4, Driver.EndSubmission 0.5
gpu 156.7 (13 %) 0.0 (0 %) 1016.0 0.0 batch 156.7

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 7399.7, Driver.Packet.memory_wait 7023.3, Driver.WorkerWait 1027.7, Driver.WorkerWait.idle_and_completion_poll 1027.6, Driver.Packet.dispatch 197.2, Graphics.Draw 186.3, Driver.Packet.draw 165.9, Driver.Draw 165.6, batch 156.7, Graphics.Draw.draw_and_resource_release 153.7

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x28) 1266.3 ms at 39229 ms, present 2346
  • Driver.Packet.memory_wait (queue worker 0x28) 1240.9 ms at 59740 ms, present 2363
  • Driver.Packet.memory_wait (queue worker 0x28) 1228.5 ms at 11962 ms, present 2322
  • Driver.Packet.memory_wait (queue worker 0x28) 1228.0 ms at 41897 ms, present 2348
  • Driver.Packet.memory_wait (queue worker 0x28) 1168.3 ms at 2498 ms, present 2314
  • Driver.Packet.memory_wait (queue worker 0x20) 1156.8 ms at 41895 ms, present 2348
  • Driver.Packet.memory_wait (queue worker 0x28) 1139.1 ms at 34448 ms, present 2342
  • Driver.Packet.memory_wait (queue worker 0x28) 1129.7 ms at 45768 ms, present 2351
  • Driver.Packet.memory_wait (queue worker 0x20) 1128.4 ms at 11960 ms, present 2322
  • Driver.Packet.memory_wait (queue worker 0x20) 1124.2 ms at 2495 ms, present 2314
trace_digest.py, run329, main 3e72d893778d

seconds 400:60 from present 2883: 50 presents, frame p50 1183.1 / p90 1376.2 / p99 1632.9 / max 1632.9 ms, GPU busy 155.4 ms per present
NVIDIA GeForce RTX 5070 Ti, NVIDIA 595.91.07, Linux 7.2.0-202.nobara.fc44.x86_64, 1920x1080, commit 3e72d893778d, dropped: yes

Slowest frames (largest slices inside each, inclusive)

  • present 2909: 1632.9 ms at 31625 ms: Driver.Packet (queue worker 0x30) 1617.2, Driver.Packet.memory_wait (queue worker 0x30) 1611.0, Driver.Packet (queue worker 0x38) 1509.3, Driver.Packet.memory_wait (queue worker 0x38) 1495.5
  • present 2928: 1512.3 ms at 54297 ms: Driver.Packet (queue worker 0x30) 1495.1, Driver.Packet.memory_wait (queue worker 0x30) 1488.8, Driver.Packet (queue worker 0x38) 1487.7, Driver.Packet.memory_wait (queue worker 0x38) 1472.1
  • present 2897: 1456.9 ms at 16920 ms: Driver.Packet (queue worker 0x30) 1441.0, Driver.Packet.memory_wait (queue worker 0x30) 1433.9, Driver.Packet (queue worker 0x38) 1418.7, Driver.Packet.memory_wait (queue worker 0x38) 1406.0
  • present 2888: 1444.5 ms at 6145 ms: Driver.Packet (queue worker 0x30) 1425.0, Driver.Packet.memory_wait (queue worker 0x30) 1416.7, Driver.Packet (queue worker 0x38) 1411.8, Driver.Packet (queue worker 0x0) 1404.7
  • present 2891: 1376.2 ms at 9733 ms: Driver.Packet (queue worker 0x30) 1364.2, Driver.Packet.memory_wait (queue worker 0x30) 1360.2, Driver.Packet (queue worker 0x38) 1275.1, Driver.Packet (queue worker 0x20) 1256.4

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 193.7 (16 %) 2.9 (0 %) 1009.8 87.7 Driver.Packet 196.4, Driver.EndSubmission 0.2
draw committer 137.7 (11 %) 8.7 (1 %) 1060.1 109.3 Graphics.Draw 135.5, Recorder.Submit 1.9
presenter 0.9 (0 %) 0.2 (0 %) 1205.4 0.1 VideoOut.Flip 1.0, Driver.Present 0.0
queue worker 0x20 31.1 (3 %) 1174.3 (97 %) 1.0 3.9 Driver.Packet 1055.3, Driver.EndSubmission 0.3
queue worker 0x28 2.5 (0 %) 1203.1 (100 %) 0.9 2.4 Driver.Packet 988.7, Driver.EndSubmission 0.2
queue worker 0x30 5.6 (0 %) 1199.7 (99 %) 1.1 2.3 Driver.Packet 1189.5, Driver.EndSubmission 0.1
queue worker 0x50 51.6 (4 %) 1151.0 (95 %) 3.9 22.5 Driver.Packet 1066.4, Driver.EndSubmission 0.1
queue worker 0x38 11.2 (1 %) 1193.8 (99 %) 1.4 2.9 Driver.Packet 1169.2, Driver.EndSubmission 0.1
queue worker 0x40 2.9 (0 %) 1202.7 (100 %) 0.9 0.7 Driver.Packet 1017.8, Driver.EndSubmission 0.2
queue worker 0x48 1.2 (0 %) 1200.6 (100 %) 4.6 0.3 Driver.Packet 978.8, Driver.EndSubmission 1.0
gpu 155.4 (13 %) 0.0 (0 %) 1051.0 0.0 batch 155.4

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 7662.2, Driver.Packet.memory_wait 7340.8, Driver.WorkerWait 963.2, Driver.WorkerWait.idle_and_completion_poll 963.1, Driver.Packet.dispatch 165.7, batch 155.4, Graphics.Draw 152.2, Driver.Packet.draw 146.0, Driver.Draw 145.6, Graphics.Draw.draw_and_resource_release 119.3

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x28) 1300.8 ms at 54508 ms, present 2928
  • Driver.Packet.memory_wait (queue worker 0x28) 1257.5 ms at 31999 ms, present 2909
  • Driver.Packet.memory_wait (queue worker 0x28) 1226.5 ms at 17150 ms, present 2897
  • Driver.Packet.memory_wait (queue worker 0x20) 1221.0 ms at 54505 ms, present 2928
  • Driver.Packet.memory_wait (queue worker 0x28) 1200.0 ms at 6389 ms, present 2888
  • Driver.Packet.memory_wait (queue worker 0x20) 1196.5 ms at 31999 ms, present 2909
  • Driver.Packet.memory_wait (queue worker 0x20) 1172.9 ms at 17149 ms, present 2897
  • Driver.Packet.memory_wait (queue worker 0x28) 1148.7 ms at 12401 ms, present 2893
  • Driver.Packet.memory_wait (queue worker 0x20) 1130.3 ms at 6387 ms, present 2888
  • Driver.Packet.memory_wait (queue worker 0x28) 1128.0 ms at 24628 ms, present 2903
trace_digest.py, run332, main again (A/A) 3e72d893778d

seconds 400:60 from present 2351: 48 presents, frame p50 1226.0 / p90 1507.5 / p99 1802.5 / max 1802.5 ms, GPU busy 153.8 ms per present
NVIDIA GeForce RTX 5070 Ti, NVIDIA 595.91.07, Linux 7.2.0-202.nobara.fc44.x86_64, 1920x1080, commit 3e72d893778d, dropped: yes

Slowest frames (largest slices inside each, inclusive)

  • present 2358: 1802.5 ms at 9335 ms: Driver.Packet (queue worker 0x30) 1787.2, Driver.Packet.memory_wait (queue worker 0x30) 1778.6, Driver.Packet (queue worker 0x38) 1707.2, Driver.Packet.memory_wait (queue worker 0x38) 1694.6
  • present 2354: 1647.3 ms at 3716 ms: Driver.Packet (queue worker 0x30) 1625.8, Driver.Packet.memory_wait (queue worker 0x30) 1619.6, Driver.Packet (queue worker 0x0) 1609.9, Driver.Packet (queue worker 0x38) 1607.4
  • present 2383: 1592.5 ms at 41301 ms: Driver.Packet (queue worker 0x30) 1571.6, Driver.Packet.memory_wait (queue worker 0x30) 1562.6, Driver.Packet (queue worker 0x38) 1561.7, Driver.Packet.memory_wait (queue worker 0x38) 1545.0
  • present 2371: 1508.5 ms at 26359 ms: Driver.Packet (queue worker 0x30) 1492.5, Driver.Packet (queue worker 0x38) 1484.8, Driver.Packet.memory_wait (queue worker 0x30) 1483.6, Driver.Packet.memory_wait (queue worker 0x38) 1474.2
  • present 2376: 1507.5 ms at 32542 ms: Driver.Packet (queue worker 0x30) 1490.7, Driver.Packet.memory_wait (queue worker 0x30) 1482.2, Driver.Packet (queue worker 0x38) 1410.8, Driver.Packet.memory_wait (queue worker 0x38) 1394.5

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 205.3 (16 %) 4.0 (0 %) 1055.9 79.3 Driver.Packet 208.9, Driver.EndSubmission 0.2
presenter 0.9 (0 %) 0.2 (0 %) 1264.2 0.1 VideoOut.Flip 1.0, Driver.Present 0.0
draw committer 157.7 (12 %) 9.1 (1 %) 1098.5 107.4 Graphics.Draw 154.6, Recorder.Submit 2.5
queue worker 0x28 2.4 (0 %) 1262.0 (100 %) 0.7 2.5 Driver.Packet 1027.7, Driver.EndSubmission 0.2
queue worker 0x48 1.6 (0 %) 1257.6 (99 %) 6.0 0.3 Driver.Packet 1018.2, Driver.EndSubmission 0.5
queue worker 0x20 30.3 (2 %) 1234.0 (98 %) 0.9 3.8 Driver.Packet 1096.1, Driver.EndSubmission 0.3
queue worker 0x50 57.7 (5 %) 1203.4 (95 %) 4.1 22.9 Driver.Packet 1112.2, Driver.EndSubmission 0.1
queue worker 0x38 11.9 (1 %) 1252.8 (99 %) 0.5 2.9 Driver.Packet 1228.9, Driver.EndSubmission 0.3
queue worker 0x40 3.1 (0 %) 1261.2 (100 %) 0.9 0.7 Driver.Packet 1056.7, Driver.EndSubmission 0.3
queue worker 0x30 7.0 (1 %) 1257.0 (99 %) 1.1 2.3 Driver.Packet 1246.7, Driver.EndSubmission 0.1
gpu 157.1 (12 %) 0.0 (0 %) 1108.1 0.0 batch 157.1

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 7995.5, Driver.Packet.memory_wait 7649.4, Driver.WorkerWait 1053.6, Driver.WorkerWait.idle_and_completion_poll 1053.5, Driver.Packet.dispatch 183.5, Graphics.Draw 169.7, batch 157.1, Driver.Packet.draw 150.1, Driver.Draw 149.5, Graphics.Draw.draw_and_resource_release 136.8

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x28) 1445.7 ms at 9691 ms, present 2358
  • Driver.Packet.memory_wait (queue worker 0x28) 1374.5 ms at 41515 ms, present 2383
  • Driver.Packet.memory_wait (queue worker 0x20) 1342.3 ms at 9689 ms, present 2358
  • Driver.Packet.memory_wait (queue worker 0x20) 1337.0 ms at 41509 ms, present 2383
  • Driver.Packet.memory_wait (queue worker 0x28) 1335.4 ms at 4027 ms, present 2354
  • Driver.Packet.memory_wait (queue worker 0x20) 1256.6 ms at 4025 ms, present 2354
  • Driver.Packet.memory_wait (queue worker 0x28) 1215.7 ms at 29238 ms, present 2373
  • Driver.Packet.memory_wait (queue worker 0x28) 1211.4 ms at 17699 ms, present 2364
  • Driver.Packet.memory_wait (queue worker 0x28) 1196.9 ms at 26668 ms, present 2371
  • Driver.Packet.memory_wait (queue worker 0x28) 1171.5 ms at 7006 ms, present 2356

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6326685429 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9248#issuecomment-6326685429). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-21T21:13:30Z. --- Captures for the `perf` label, on `main`. Demon's Souls PPSA01341 v1.07, in the first level, 1920x1080, Linux (Nobara, kernel 7.2), RTX 5070 Ti, driver 595.91.07. Four 900 s runs from boot into the level, one session, in this order: main, #9243, this PR, main again. The window is `APS5_TRACE_SECONDS=400:60` (60 s from t+400 s, level loaded). The base for this PR is #9243 with its switch on, as in the description, so the pair here is run330 against run331; the two main captures are shown for scale and for the A/A spread. The same four captures are on #9243 with the view from that side. Setup - Base: main cecb540a6 plus the local stencil-export workaround (this GPU needs it to reach the level, never upstream) plus the #6280 mip clamp, which keeps main off the Xid 31 I described on #9243. The trace's commit field, 3e72d893778d, is that local build. dd46b3e09585 is the same tree plus #9243's head b2b765ad4; ab0687554423 adds this PR's head b0442fbd8 on top. Each set differs from main only in `libSceAgcDriver.prx` (checked with an aps5-libs diff: exactly one file). - Caches warm: a 1200 s run of the main set into the level preceded the four captures, and the three sets report the same shader SourceVersion. - No other `APS5_TRACE_*` or `APS5_PROFILE_*` switch. `APS5_VERIFY_DRAW_PUSH_WORD` was off. The other `APS5_*` values in the env field (memory caps, `APS5_IGNORE_STENCIL_EXPORT`, `APS5_GPU_MEASURING`, the lock name) are the same on all four arms. - One deviation from the form: the game log was written to a file on every arm. The run harness does that and I did not turn it off. It is the same on all four arms, so it does not favour one, but it is not what the form asks. - `trace_dropped: true` in all four: the event buffer of `queue worker 0x0` filled after 10.2 to 12.6 s (1.0 to 1.3 M events lost, `totals_full: false`). The per-slice tables for that worker in the digests cover the first 10 to 13 s of the window; the totals in the summary line (`frame_ms`, `top_phases_ms_per_frame`, `worker_busy_pct`) are not marked full, and the phase comparison below uses those. Summary lines (`aps5-summary.jsonl`, verbatim: base run330, this PR run331, then the two mains run329 and run332) ```json {"commit":"dd46b3e09585","dirty":false,"env":{"APS5_DRAW_CACHE_INDIRECT":"1","APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2403,"ms":60420.379},"presents":47,"frame_ms":{"p50":1271.848,"p90":1519.619,"p99":2048.945,"max":2048.945},"gpu_busy_ms_per_present":156.459,"worker_busy_pct":{"queue worker 0x0":99.525,"queue worker 0x28":81.517,"queue worker 0x30":98.639,"queue worker 0x20":86.980,"queue worker 0x50":88.778,"queue worker 0x38":96.961,"queue worker 0x48":80.746,"queue worker 0x40":83.999},"top_phases_ms_per_frame":{"Driver.Packet":9215.511,"Driver.Packet.memory_wait":7789.973,"Driver.Packet.draw":929.184,"Driver.Draw":927.227,"Driver.Draw.draw_enqueued":500.001,"Driver.Packet.dispatch":418.997,"Driver.Dispatch":326.507,"Shader.DrawStage":321.166},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":10.372,"events_lost":1194837,"totals_full":false}},"trace":"aps5-trace-dd46b3e09585-3182475.json.gz"} {"commit":"ab0687554423","dirty":false,"env":{"APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2312,"ms":60982.146},"presents":52,"frame_ms":{"p50":1172.284,"p90":1415.656,"p99":1536.414,"max":1536.414},"gpu_busy_ms_per_present":156.697,"worker_busy_pct":{"queue worker 0x0":99.577,"queue worker 0x48":79.363,"queue worker 0x40":82.780,"queue worker 0x30":98.471,"queue worker 0x28":80.222,"queue worker 0x50":87.901,"queue worker 0x20":86.331,"queue worker 0x38":96.722},"top_phases_ms_per_frame":{"Driver.Packet":8338.417,"Driver.Packet.memory_wait":7024.596,"Driver.Packet.draw":833.329,"Driver.Draw":831.704,"Driver.Packet.dispatch":413.997,"Driver.Draw.draw_enqueued":385.831,"Driver.Dispatch":321.362,"Driver.Draw.shader_compile_and_link":320.153},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":12.645,"events_lost":1010793,"totals_full":false}},"trace":"aps5-trace-ab0687554423-3238611.json.gz"} {"commit":"3e72d893778d","dirty":false,"env":{"APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2883,"ms":60321.019},"presents":50,"frame_ms":{"p50":1183.067,"p90":1376.162,"p99":1632.915,"max":1632.915},"gpu_busy_ms_per_present":155.402,"worker_busy_pct":{"queue worker 0x0":99.509,"queue worker 0x20":87.538,"queue worker 0x28":82.007,"queue worker 0x30":98.647,"queue worker 0x50":88.657,"queue worker 0x38":96.965,"queue worker 0x40":84.399,"queue worker 0x48":81.222},"top_phases_ms_per_frame":{"Driver.Packet":8669.965,"Driver.Packet.memory_wait":7341.848,"Driver.Packet.draw":895.824,"Driver.Draw":893.870,"Driver.Draw.draw_enqueued":426.271,"Shader.DrawStage":379.582,"Driver.Packet.dispatch":373.842,"Driver.Draw.shader_compile_and_link":333.911},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":10.162,"events_lost":1338036,"totals_full":false}},"trace":"aps5-trace-3e72d893778d-3139565.json.gz"} {"commit":"3e72d893778d","dirty":false,"env":{"APS5_GPU_LOCK_NAME":"level","APS5_GPU_MEASURING":"1","APS5_IGNORE_STENCIL_EXPORT":"1","APS5_MEMCAP_HELD":"1","APS5_MEM_MAX":"20G","APS5_RUN_DIR":"<path>","APS5_SWAP_MAX":"12G","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"400:60"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 595.91.07","os":"Linux 7.2.0-202.nobara.fc44.x86_64","cpu":"AMD Ryzen 5 7600X 6-Core Processor","cpu_threads":12,"memory_mib":31177,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"seconds 400:60","first_present":2351,"ms":60729.568},"presents":48,"frame_ms":{"p50":1225.973,"p90":1507.486,"p99":1802.503,"max":1802.503},"gpu_busy_ms_per_present":153.840,"worker_busy_pct":{"queue worker 0x0":99.496,"queue worker 0x28":81.294,"queue worker 0x48":80.521,"queue worker 0x20":86.714,"queue worker 0x50":88.187,"queue worker 0x38":97.188,"queue worker 0x40":83.561,"queue worker 0x30":98.586},"top_phases_ms_per_frame":{"Driver.Packet":9049.414,"Driver.Packet.memory_wait":7651.717,"Driver.Packet.draw":922.369,"Driver.Draw":920.258,"Driver.Draw.draw_enqueued":424.276,"Driver.Packet.dispatch":408.618,"Shader.DrawStage":404.616,"Driver.Draw.shader_compile_and_link":352.944},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":10.319,"events_lost":1324421,"totals_full":false}},"trace":"aps5-trace-3e72d893778d-3303223.json.gz"} ``` Traces (a release on my fork; the assets keep their `aps5-trace-<commit>-<pid>.json.gz` names and open in ui.perfetto.dev) - run330 base, #9243 with `APS5_DRAW_CACHE_INDIRECT=1`: https://github.com/fisherjoey/AnyPS5/releases/download/perf-captures-20261021/aps5-trace-dd46b3e09585-3182475.json.gz - run331 this PR, plus `APS5_DRAW_CACHE_PUSH_WORD=1`: https://github.com/fisherjoey/AnyPS5/releases/download/perf-captures-20261021/aps5-trace-ab0687554423-3238611.json.gz - run329 main: https://github.com/fisherjoey/AnyPS5/releases/download/perf-captures-20261021/aps5-trace-3e72d893778d-3139565.json.gz - run332 main again: https://github.com/fisherjoey/AnyPS5/releases/download/perf-captures-20261021/aps5-trace-3e72d893778d-3303223.json.gz - Release page: https://github.com/fisherjoey/AnyPS5/releases/tag/perf-captures-20261021 Frame times (ms, the 60 s window) | run | set | presents | p50 | p90 | p99 | GPU busy ms per present | |---|---|---|---|---|---|---| | 330 | #9243, `APS5_DRAW_CACHE_INDIRECT=1` (base) | 47 | 1271.8 | 1519.6 | 2048.9 | 156.5 | | 331 | this PR, plus `APS5_DRAW_CACHE_PUSH_WORD=1` | 52 | 1172.3 | 1415.7 | 1536.4 | 156.7 | | 329 | main | 50 | 1183.1 | 1376.2 | 1632.9 | 155.4 | | 332 | main again (A/A) | 48 | 1226.0 | 1507.5 | 1802.5 | 153.8 | A/A spread of the two main captures: p50 43 ms (3.6%), p90 131 ms, presents 50 against 48. Reading: - Against its base (#9243 alone): p50 -7.8%, p90 -6.8%, p99 -25%, presents 52 against 47 (+10.6%). Same direction and about the same size as the 3v3 on our stack (-9.7% queue 0 time, +10.3% presents), but this is one capture per arm, and the base capture is the worse of the four, so part of that gap is the base's own noise. - Against the mean of the two mains (p50 1204.5): p50 -2.7%, p90 -1.8%, presents 52 against 50 and 48. That is inside the A/A spread. On plain `main` the pair is a small gain that one capture each cannot separate from noise. The draw path itself is a clearer signal, see below. #9243 alone is +5.6% p50 against the main mean, which is why the gap to it is larger than the gap to main. Where the frame goes, from `top_phases_ms_per_frame` (ms per frame, summed over threads) and the digest's thread table | phase | base 330 | this PR 331 | main 329 | main 332 | |---|---|---|---|---| | Driver.Packet | 9215.5 | 8338.4 | 8670.0 | 9049.4 | | Driver.Packet.memory_wait | 7790.0 | 7024.6 | 7341.8 | 7651.7 | | Driver.Packet.draw | 929.2 | 833.3 | 895.8 | 922.4 | | Driver.Draw | 927.2 | 831.7 | 893.9 | 920.3 | | Driver.Draw.draw_enqueued | 500.0 | 385.8 | 426.3 | 424.3 | | Driver.Packet.dispatch | 419.0 | 414.0 | 373.8 | 408.6 | | Shader.DrawStage | 321.2 | under 320.2 (off the top 8) | 379.6 | 404.6 | | Driver.Draw.shader_compile_and_link | under 321.2 (off the top 8) | 320.2 | 333.9 | 352.9 | | draw committer thread, Graphics.Draw | 181.2 | 168.9 | 135.5 | 154.6 | | gpu busy | 156.5 | 156.7 | 155.4 | 153.8 | What the digests show: - The draw path this PR targets does drop. Driver.Draw is 832 ms per frame against 927 on the base (-10.3%) and against 894 and 920 on the two mains (-8.3% against their mean). `Driver.Draw.draw_enqueued` is 386 against 500 (-23%) and against 426 and 424 on main (-9%). `Shader.DrawStage`, the stage materialization, falls off the top 8 (under 320 ms per frame, against 321 on the base and 380 and 405 on main). GPU busy is flat at 154 to 157 ms per present, 12 to 13% of the frame, in all four. - What does not drop: `Driver.Packet.dispatch` stays at 414 (419 on the base, 374 and 409 on main), and the draw committer's `Graphics.Draw` on its own thread is 169 ms per frame, down from 181 on the base but above main's 136 and 155. - Why the frame moves less than the draw path on `main`: the frame here is queue 0. `queue worker 0x0` is 99.5% busy in all four captures, and draw plus dispatch summed over the workers is 1250 to 1350 ms per frame against a p50 of 1170 to 1270. The seven other queue workers spend 95 to 100% of the frame in `Driver.Packet.memory_wait` (about 0.88 of the frame each), the largest slice in each of the five slowest frames of every capture is a memory_wait on `queue worker 0x30` of 1.36 to 2.02 s, and memory_wait is 6.0 to 6.2 times p50 on all four arms: it is the other queues waiting for the frame, not a stall of its own. Against the base the frame moves by about the Driver.Draw delta (-96 ms Driver.Draw, -100 ms p50). Against main the Driver.Draw delta is -75 ms but the frame moves -32 ms, with dispatch +23 ms of the difference and the rest within the A/A spread. - The 3v3 on our stack had queue 0 at 884 ms per present on its base; on plain `main` the frame is about 1200 ms and queue 0 is busy for all of it. The digests say where main's frame goes, not which of the stack's PRs account for the shorter queue 0 there, so I am not claiming that here. Digests, made with `tools/trace_digest.py` on each trace. The JSON block is the summary line above; the title-thread rows and the GPU batch list are left out for length. <details> <summary>trace_digest.py, run330, PR 9243 dd46b3e09585 (APS5_DRAW_CACHE_INDIRECT=1)</summary> **seconds 400:60** from present 2403: 47 presents, frame p50 1271.8 / p90 1519.6 / p99 2048.9 / max 2048.9 ms, GPU busy 156.5 ms per present NVIDIA GeForce RTX 5070 Ti, NVIDIA 595.91.07, Linux 7.2.0-202.nobara.fc44.x86_64, 1920x1080, commit dd46b3e09585, dropped: yes **Slowest frames** (largest slices inside each, inclusive) - present 2438: 2048.9 ms at 44451 ms: Driver.Packet (queue worker 0x30) 2030.5, Driver.Packet.memory_wait (queue worker 0x30) 2021.8, Driver.Packet (queue worker 0x38) 1938.1, Driver.Packet.memory_wait (queue worker 0x38) 1923.0 - present 2406: 1750.1 ms at 3358 ms: Driver.Packet (queue worker 0x30) 1724.9, Driver.Packet.memory_wait (queue worker 0x30) 1719.3, Driver.Packet (queue worker 0x0) 1705.6, Driver.Packet (queue worker 0x38) 1705.4 - present 2428: 1617.8 ms at 31691 ms: Driver.Packet (queue worker 0x30) 1599.1, Driver.Packet.memory_wait (queue worker 0x30) 1589.9, Driver.Packet (queue worker 0x38) 1587.3, Driver.Packet.memory_wait (queue worker 0x38) 1575.1 - present 2420: 1556.6 ms at 21372 ms: Driver.Packet (queue worker 0x30) 1535.1, Driver.Packet.memory_wait (queue worker 0x30) 1522.8, Driver.Packet (queue worker 0x38) 1458.5, Driver.Packet.memory_wait (queue worker 0x38) 1440.9 - present 2413: 1519.6 ms at 12269 ms: Driver.Packet (queue worker 0x30) 1503.8, Driver.Packet.memory_wait (queue worker 0x30) 1492.8, Driver.Packet (queue worker 0x38) 1490.8, Driver.Packet.memory_wait (queue worker 0x38) 1475.0 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 208.9 (16 %) | 3.9 (0 %) | 1072.7 | 72.0 | Driver.Packet 212.5, Driver.EndSubmission 0.2 | | presenter | 0.9 (0 %) | 0.1 (0 %) | 1284.5 | 0.1 | VideoOut.Flip 0.9, Driver.Present 0.1 | | draw committer | 184.3 (14 %) | 12.9 (1 %) | 1088.3 | 107.8 | Graphics.Draw 181.2, Recorder.Submit 2.8 | | queue worker 0x28 | 2.2 (0 %) | 1282.2 (100 %) | 1.1 | 2.4 | Driver.Packet 1047.3, Driver.EndSubmission 0.3 | | queue worker 0x30 | 7.6 (1 %) | 1277.1 (99 %) | 0.8 | 2.3 | Driver.Packet 1267.4, Driver.EndSubmission 0.1 | | queue worker 0x20 | 31.4 (2 %) | 1253.3 (97 %) | 0.8 | 3.9 | Driver.Packet 1117.5, Driver.EndSubmission 0.2 | | queue worker 0x50 | 61.4 (5 %) | 1220.4 (95 %) | 3.7 | 22.9 | Driver.Packet 1138.0, Driver.EndSubmission 0.2 | | queue worker 0x38 | 12.9 (1 %) | 1272.0 (99 %) | 0.6 | 2.9 | Driver.Packet 1245.4, Driver.EndSubmission 0.7 | | queue worker 0x48 | 1.8 (0 %) | 1279.4 (100 %) | 4.3 | 0.3 | Driver.Packet 1037.3, Driver.EndSubmission 0.7 | | queue worker 0x40 | 3.2 (0 %) | 1281.6 (100 %) | 0.7 | 0.7 | Driver.Packet 1079.5, Driver.EndSubmission 0.2 | | gpu | 156.5 (12 %) | 0.0 (0 %) | 1129.1 | 0.0 | batch 156.5 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 8144.9, Driver.Packet.memory_wait 7788.9, Driver.WorkerWait 1052.0, Driver.WorkerWait.idle_and_completion_poll 1051.9, Graphics.Draw 194.1, Driver.Packet.dispatch 192.2, Graphics.Draw.draw_and_resource_release 162.4, batch 156.5, Driver.Packet.draw 151.9, Driver.Draw 151.4 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x28) 1680.9 ms at 44819 ms, present 2438 - Driver.Packet.memory_wait (queue worker 0x20) 1639.7 ms at 44814 ms, present 2438 - Driver.Packet.memory_wait (queue worker 0x28) 1417.5 ms at 3689 ms, present 2406 - Driver.Packet.memory_wait (queue worker 0x38) 1401.7 ms at 45053 ms, present 2438 - Driver.Packet.memory_wait (queue worker 0x28) 1351.5 ms at 31957 ms, present 2428 - Driver.Packet.memory_wait (queue worker 0x20) 1346.8 ms at 3687 ms, present 2406 - Driver.Packet.memory_wait (queue worker 0x40) 1300.8 ms at 45201 ms, present 2438 - Driver.Packet.memory_wait (queue worker 0x20) 1261.4 ms at 31952 ms, present 2428 - Driver.Packet.memory_wait (queue worker 0x28) 1241.1 ms at 14027 ms, present 2414 - Driver.Packet.memory_wait (queue worker 0x28) 1240.1 ms at 21688 ms, present 2420 </details> <details> <summary>trace_digest.py, run331, PR 9248 ab0687554423 (APS5_DRAW_CACHE_INDIRECT=1 APS5_DRAW_CACHE_PUSH_WORD=1)</summary> **seconds 400:60** from present 2312: 52 presents, frame p50 1172.3 / p90 1415.7 / p99 1536.4 / max 1536.4 ms, GPU busy 156.7 ms per present NVIDIA GeForce RTX 5070 Ti, NVIDIA 595.91.07, Linux 7.2.0-202.nobara.fc44.x86_64, 1920x1080, commit ab0687554423, dropped: yes **Slowest frames** (largest slices inside each, inclusive) - present 2348: 1536.4 ms at 41589 ms: Driver.Packet (queue worker 0x30) 1519.1, Driver.Packet (queue worker 0x38) 1504.4, Driver.Packet.memory_wait (queue worker 0x30) 1503.3, Driver.Packet.memory_wait (queue worker 0x38) 1488.4 - present 2322: 1499.2 ms at 11690 ms: Driver.Packet (queue worker 0x30) 1483.4, Driver.Packet (queue worker 0x38) 1475.1, Driver.Packet.memory_wait (queue worker 0x30) 1473.7, Driver.Packet.memory_wait (queue worker 0x38) 1458.9 - present 2362: 1498.7 ms at 58009 ms: Driver.Packet (queue worker 0x30) 1478.8, Driver.Packet.memory_wait (queue worker 0x30) 1465.3, Driver.Packet (queue worker 0x50) 1359.0, Driver.Packet (queue worker 0x38) 1341.9 - present 2363: 1474.6 ms at 59508 ms: Driver.Packet (queue worker 0x30) 1460.4, Driver.Packet.memory_wait (queue worker 0x30) 1453.1, Driver.Packet (queue worker 0x38) 1444.6, Driver.Packet.memory_wait (queue worker 0x38) 1431.8 - present 2346: 1464.2 ms at 39032 ms: Driver.Packet (queue worker 0x30) 1453.8, Driver.Packet.memory_wait (queue worker 0x30) 1444.0, Driver.Packet (queue worker 0x38) 1442.5, Driver.Packet.memory_wait (queue worker 0x38) 1429.1 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 228.8 (20 %) | 4.0 (0 %) | 939.9 | 61.5 | Driver.Packet 232.6, Driver.EndSubmission 0.2 | | presenter | 0.9 (0 %) | 0.1 (0 %) | 1171.8 | 0.1 | VideoOut.Flip 1.0, Driver.Present 0.0 | | draw committer | 171.2 (15 %) | 12.7 (1 %) | 988.9 | 109.4 | Graphics.Draw 168.9, Recorder.Submit 1.8 | | queue worker 0x48 | 1.7 (0 %) | 1167.0 (100 %) | 4.1 | 0.3 | Driver.Packet 929.6, Driver.EndSubmission 1.1 | | queue worker 0x40 | 3.1 (0 %) | 1168.7 (100 %) | 0.9 | 0.7 | Driver.Packet 970.3, Driver.EndSubmission 0.2 | | queue worker 0x30 | 7.9 (1 %) | 1163.9 (99 %) | 0.9 | 2.3 | Driver.Packet 1154.1, Driver.EndSubmission 0.2 | | queue worker 0x28 | 2.6 (0 %) | 1169.5 (100 %) | 0.6 | 2.5 | Driver.Packet 940.2, Driver.EndSubmission 0.2 | | queue worker 0x50 | 59.4 (5 %) | 1109.5 (95 %) | 3.9 | 22.9 | Driver.Packet 1027.6, Driver.EndSubmission 0.1 | | queue worker 0x20 | 31.5 (3 %) | 1140.5 (97 %) | 0.7 | 3.9 | Driver.Packet 1011.8, Driver.EndSubmission 0.2 | | queue worker 0x38 | 13.1 (1 %) | 1159.0 (99 %) | 0.7 | 2.9 | Driver.Packet 1133.4, Driver.EndSubmission 0.5 | | gpu | 156.7 (13 %) | 0.0 (0 %) | 1016.0 | 0.0 | batch 156.7 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 7399.7, Driver.Packet.memory_wait 7023.3, Driver.WorkerWait 1027.7, Driver.WorkerWait.idle_and_completion_poll 1027.6, Driver.Packet.dispatch 197.2, Graphics.Draw 186.3, Driver.Packet.draw 165.9, Driver.Draw 165.6, batch 156.7, Graphics.Draw.draw_and_resource_release 153.7 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x28) 1266.3 ms at 39229 ms, present 2346 - Driver.Packet.memory_wait (queue worker 0x28) 1240.9 ms at 59740 ms, present 2363 - Driver.Packet.memory_wait (queue worker 0x28) 1228.5 ms at 11962 ms, present 2322 - Driver.Packet.memory_wait (queue worker 0x28) 1228.0 ms at 41897 ms, present 2348 - Driver.Packet.memory_wait (queue worker 0x28) 1168.3 ms at 2498 ms, present 2314 - Driver.Packet.memory_wait (queue worker 0x20) 1156.8 ms at 41895 ms, present 2348 - Driver.Packet.memory_wait (queue worker 0x28) 1139.1 ms at 34448 ms, present 2342 - Driver.Packet.memory_wait (queue worker 0x28) 1129.7 ms at 45768 ms, present 2351 - Driver.Packet.memory_wait (queue worker 0x20) 1128.4 ms at 11960 ms, present 2322 - Driver.Packet.memory_wait (queue worker 0x20) 1124.2 ms at 2495 ms, present 2314 </details> <details> <summary>trace_digest.py, run329, main 3e72d893778d</summary> **seconds 400:60** from present 2883: 50 presents, frame p50 1183.1 / p90 1376.2 / p99 1632.9 / max 1632.9 ms, GPU busy 155.4 ms per present NVIDIA GeForce RTX 5070 Ti, NVIDIA 595.91.07, Linux 7.2.0-202.nobara.fc44.x86_64, 1920x1080, commit 3e72d893778d, dropped: yes **Slowest frames** (largest slices inside each, inclusive) - present 2909: 1632.9 ms at 31625 ms: Driver.Packet (queue worker 0x30) 1617.2, Driver.Packet.memory_wait (queue worker 0x30) 1611.0, Driver.Packet (queue worker 0x38) 1509.3, Driver.Packet.memory_wait (queue worker 0x38) 1495.5 - present 2928: 1512.3 ms at 54297 ms: Driver.Packet (queue worker 0x30) 1495.1, Driver.Packet.memory_wait (queue worker 0x30) 1488.8, Driver.Packet (queue worker 0x38) 1487.7, Driver.Packet.memory_wait (queue worker 0x38) 1472.1 - present 2897: 1456.9 ms at 16920 ms: Driver.Packet (queue worker 0x30) 1441.0, Driver.Packet.memory_wait (queue worker 0x30) 1433.9, Driver.Packet (queue worker 0x38) 1418.7, Driver.Packet.memory_wait (queue worker 0x38) 1406.0 - present 2888: 1444.5 ms at 6145 ms: Driver.Packet (queue worker 0x30) 1425.0, Driver.Packet.memory_wait (queue worker 0x30) 1416.7, Driver.Packet (queue worker 0x38) 1411.8, Driver.Packet (queue worker 0x0) 1404.7 - present 2891: 1376.2 ms at 9733 ms: Driver.Packet (queue worker 0x30) 1364.2, Driver.Packet.memory_wait (queue worker 0x30) 1360.2, Driver.Packet (queue worker 0x38) 1275.1, Driver.Packet (queue worker 0x20) 1256.4 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 193.7 (16 %) | 2.9 (0 %) | 1009.8 | 87.7 | Driver.Packet 196.4, Driver.EndSubmission 0.2 | | draw committer | 137.7 (11 %) | 8.7 (1 %) | 1060.1 | 109.3 | Graphics.Draw 135.5, Recorder.Submit 1.9 | | presenter | 0.9 (0 %) | 0.2 (0 %) | 1205.4 | 0.1 | VideoOut.Flip 1.0, Driver.Present 0.0 | | queue worker 0x20 | 31.1 (3 %) | 1174.3 (97 %) | 1.0 | 3.9 | Driver.Packet 1055.3, Driver.EndSubmission 0.3 | | queue worker 0x28 | 2.5 (0 %) | 1203.1 (100 %) | 0.9 | 2.4 | Driver.Packet 988.7, Driver.EndSubmission 0.2 | | queue worker 0x30 | 5.6 (0 %) | 1199.7 (99 %) | 1.1 | 2.3 | Driver.Packet 1189.5, Driver.EndSubmission 0.1 | | queue worker 0x50 | 51.6 (4 %) | 1151.0 (95 %) | 3.9 | 22.5 | Driver.Packet 1066.4, Driver.EndSubmission 0.1 | | queue worker 0x38 | 11.2 (1 %) | 1193.8 (99 %) | 1.4 | 2.9 | Driver.Packet 1169.2, Driver.EndSubmission 0.1 | | queue worker 0x40 | 2.9 (0 %) | 1202.7 (100 %) | 0.9 | 0.7 | Driver.Packet 1017.8, Driver.EndSubmission 0.2 | | queue worker 0x48 | 1.2 (0 %) | 1200.6 (100 %) | 4.6 | 0.3 | Driver.Packet 978.8, Driver.EndSubmission 1.0 | | gpu | 155.4 (13 %) | 0.0 (0 %) | 1051.0 | 0.0 | batch 155.4 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 7662.2, Driver.Packet.memory_wait 7340.8, Driver.WorkerWait 963.2, Driver.WorkerWait.idle_and_completion_poll 963.1, Driver.Packet.dispatch 165.7, batch 155.4, Graphics.Draw 152.2, Driver.Packet.draw 146.0, Driver.Draw 145.6, Graphics.Draw.draw_and_resource_release 119.3 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x28) 1300.8 ms at 54508 ms, present 2928 - Driver.Packet.memory_wait (queue worker 0x28) 1257.5 ms at 31999 ms, present 2909 - Driver.Packet.memory_wait (queue worker 0x28) 1226.5 ms at 17150 ms, present 2897 - Driver.Packet.memory_wait (queue worker 0x20) 1221.0 ms at 54505 ms, present 2928 - Driver.Packet.memory_wait (queue worker 0x28) 1200.0 ms at 6389 ms, present 2888 - Driver.Packet.memory_wait (queue worker 0x20) 1196.5 ms at 31999 ms, present 2909 - Driver.Packet.memory_wait (queue worker 0x20) 1172.9 ms at 17149 ms, present 2897 - Driver.Packet.memory_wait (queue worker 0x28) 1148.7 ms at 12401 ms, present 2893 - Driver.Packet.memory_wait (queue worker 0x20) 1130.3 ms at 6387 ms, present 2888 - Driver.Packet.memory_wait (queue worker 0x28) 1128.0 ms at 24628 ms, present 2903 </details> <details> <summary>trace_digest.py, run332, main again (A/A) 3e72d893778d</summary> **seconds 400:60** from present 2351: 48 presents, frame p50 1226.0 / p90 1507.5 / p99 1802.5 / max 1802.5 ms, GPU busy 153.8 ms per present NVIDIA GeForce RTX 5070 Ti, NVIDIA 595.91.07, Linux 7.2.0-202.nobara.fc44.x86_64, 1920x1080, commit 3e72d893778d, dropped: yes **Slowest frames** (largest slices inside each, inclusive) - present 2358: 1802.5 ms at 9335 ms: Driver.Packet (queue worker 0x30) 1787.2, Driver.Packet.memory_wait (queue worker 0x30) 1778.6, Driver.Packet (queue worker 0x38) 1707.2, Driver.Packet.memory_wait (queue worker 0x38) 1694.6 - present 2354: 1647.3 ms at 3716 ms: Driver.Packet (queue worker 0x30) 1625.8, Driver.Packet.memory_wait (queue worker 0x30) 1619.6, Driver.Packet (queue worker 0x0) 1609.9, Driver.Packet (queue worker 0x38) 1607.4 - present 2383: 1592.5 ms at 41301 ms: Driver.Packet (queue worker 0x30) 1571.6, Driver.Packet.memory_wait (queue worker 0x30) 1562.6, Driver.Packet (queue worker 0x38) 1561.7, Driver.Packet.memory_wait (queue worker 0x38) 1545.0 - present 2371: 1508.5 ms at 26359 ms: Driver.Packet (queue worker 0x30) 1492.5, Driver.Packet (queue worker 0x38) 1484.8, Driver.Packet.memory_wait (queue worker 0x30) 1483.6, Driver.Packet.memory_wait (queue worker 0x38) 1474.2 - present 2376: 1507.5 ms at 32542 ms: Driver.Packet (queue worker 0x30) 1490.7, Driver.Packet.memory_wait (queue worker 0x30) 1482.2, Driver.Packet (queue worker 0x38) 1410.8, Driver.Packet.memory_wait (queue worker 0x38) 1394.5 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 205.3 (16 %) | 4.0 (0 %) | 1055.9 | 79.3 | Driver.Packet 208.9, Driver.EndSubmission 0.2 | | presenter | 0.9 (0 %) | 0.2 (0 %) | 1264.2 | 0.1 | VideoOut.Flip 1.0, Driver.Present 0.0 | | draw committer | 157.7 (12 %) | 9.1 (1 %) | 1098.5 | 107.4 | Graphics.Draw 154.6, Recorder.Submit 2.5 | | queue worker 0x28 | 2.4 (0 %) | 1262.0 (100 %) | 0.7 | 2.5 | Driver.Packet 1027.7, Driver.EndSubmission 0.2 | | queue worker 0x48 | 1.6 (0 %) | 1257.6 (99 %) | 6.0 | 0.3 | Driver.Packet 1018.2, Driver.EndSubmission 0.5 | | queue worker 0x20 | 30.3 (2 %) | 1234.0 (98 %) | 0.9 | 3.8 | Driver.Packet 1096.1, Driver.EndSubmission 0.3 | | queue worker 0x50 | 57.7 (5 %) | 1203.4 (95 %) | 4.1 | 22.9 | Driver.Packet 1112.2, Driver.EndSubmission 0.1 | | queue worker 0x38 | 11.9 (1 %) | 1252.8 (99 %) | 0.5 | 2.9 | Driver.Packet 1228.9, Driver.EndSubmission 0.3 | | queue worker 0x40 | 3.1 (0 %) | 1261.2 (100 %) | 0.9 | 0.7 | Driver.Packet 1056.7, Driver.EndSubmission 0.3 | | queue worker 0x30 | 7.0 (1 %) | 1257.0 (99 %) | 1.1 | 2.3 | Driver.Packet 1246.7, Driver.EndSubmission 0.1 | | gpu | 157.1 (12 %) | 0.0 (0 %) | 1108.1 | 0.0 | batch 157.1 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 7995.5, Driver.Packet.memory_wait 7649.4, Driver.WorkerWait 1053.6, Driver.WorkerWait.idle_and_completion_poll 1053.5, Driver.Packet.dispatch 183.5, Graphics.Draw 169.7, batch 157.1, Driver.Packet.draw 150.1, Driver.Draw 149.5, Graphics.Draw.draw_and_resource_release 136.8 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x28) 1445.7 ms at 9691 ms, present 2358 - Driver.Packet.memory_wait (queue worker 0x28) 1374.5 ms at 41515 ms, present 2383 - Driver.Packet.memory_wait (queue worker 0x20) 1342.3 ms at 9689 ms, present 2358 - Driver.Packet.memory_wait (queue worker 0x20) 1337.0 ms at 41509 ms, present 2383 - Driver.Packet.memory_wait (queue worker 0x28) 1335.4 ms at 4027 ms, present 2354 - Driver.Packet.memory_wait (queue worker 0x20) 1256.6 ms at 4025 ms, present 2354 - Driver.Packet.memory_wait (queue worker 0x28) 1215.7 ms at 29238 ms, present 2373 - Driver.Packet.memory_wait (queue worker 0x28) 1211.4 ms at 17699 ms, present 2364 - Driver.Packet.memory_wait (queue worker 0x28) 1196.9 ms at 26668 ms, present 2371 - Driver.Packet.memory_wait (queue worker 0x28) 1171.5 ms at 7006 ms, present 2356 </details> AI-assisted: yes
EagleBearerYS commented 2026-10-22 11:52:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T11:52:26Z.


@fisherjoey a merge-order note for this PR and #9243 against two of ours. Ours go after yours, and rebase over them:

  • #9129 (DrawCache.cpp): it adds Driver::DrawCacheBytes() (APS5_DRAW_CACHE_BYTES) where #9243 adds drawCacheIndirect() and this PR adds drawCachePushWord(). They're adjacent getters, and all of them stay.
  • #7446 (Draw.cpp): it adds a recordedOne flag before the indirect record loop, where this PR adds its forwarded-word state and lambdas. #7446 uses the flag to check the captured memory once, before the first record is drawn, and to prepare the whole draw again if that memory changed. Both stay. A redone draw forwards its record words as it would the first time.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6340063922 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9248#issuecomment-6340063922). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-22T11:52:26Z. --- @fisherjoey a merge-order note for this PR and #9243 against two of ours. Ours go after yours, and rebase over them: - **#9129** (`DrawCache.cpp`): it adds `Driver::DrawCacheBytes()` (`APS5_DRAW_CACHE_BYTES`) where #9243 adds `drawCacheIndirect()` and this PR adds `drawCachePushWord()`. They're adjacent getters, and all of them stay. - **#7446** (`Draw.cpp`): it adds a `recordedOne` flag before the indirect record loop, where this PR adds its forwarded-word state and lambdas. #7446 uses the flag to check the captured memory once, before the first record is drawn, and to prepare the whole draw again if that memory changed. Both stay. A redone draw forwards its record words as it would the first time.
fisherjoey commented 2026-10-22 12:41:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-22T12:41:27Z.


@EagleBearerYS thanks, that order works for us, and both resolutions match what we listed in our overlap note: the adjacent getters all stay, and the forwarded-word state sits next to recordedOne. If either of yours lands first instead, I'll rebase these two over it the same way.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6340998407 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9248#issuecomment-6340998407). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-22T12:41:27Z. --- @EagleBearerYS thanks, that order works for us, and both resolutions match what we listed in our overlap note: the adjacent getters all stay, and the forwarded-word state sits next to `recordedOne`. If either of yours lands first instead, I'll rebase these two over it the same way. AI-assisted: yes
Sign in to join this conversation.
No reviewers
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!9248
No description provided.