perf(agc): cache CPU-path indirect draws behind APS5_DRAW_CACHE_INDIRECT #9243

Merged
fisherjoey merged 3 commits from upstream-pr/9243 into main 2026-10-30 00:51:26 +00:00
fisherjoey commented 2026-10-21 16:24:05 +00:00 (Migrated from github.com)

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


What

cacheDrawStages never admits a draw that an indirect packet runs on the CPU path (drawParameters.indirect && indirectCpu), since 29b460156: "the CPU path of an indirect draw recompiles on patched words below: nothing of it is kept". That is only half true. On the CPU path the front stage is materialized once with the packet's user words to classify the draw, then per record only the programs holding a patched word are materialized again, and the fragment stage is reused from the first pass. A title whose draws are mostly CPU-path indirect draws therefore looks up every draw and never inserts one, whatever the cache size. On Demon's Souls 97% of the draw packets are DRAW_INDEX_INDIRECT draws whose record patches a user word the vertex program reads as a value, so the draw cache missed 92% of its lookups and APS5_DRAW_CACHE_ENTRIES=32768 did not move the hit rate.

With APS5_DRAW_CACHE_INDIRECT set, cacheDrawStages admits these draws like any other. A hit reuses the fragment stage and skips the first front-stage pass. The stage whose user word the record patches is still materialized once per record, which the hit path already provides for (materializeDrawStage adds the matched stages' regions when drawHit). Nothing else changes: the key, the validation and the eviction are the ones direct draws use.

The switch is off by default, so main behaves as before without it. It stays a switch because a hit still pays the full word validation (about 15 us per lookup on the title below) and one materialization per record, so the gain on its own is small. The follow-up PR that forwards the record's word as push data removes the second cost. It has a row in docs/dev/ENVIRONMENT.md.

Related, not overlapping:

  • #7930 (@AnthonyClemens, open) skips CPU-path indirect draws whose records draw nothing before their stages are built. This PR caches the ones that draw. The two touch different lines, and our game runs below had #7930 on both arms. No code dependency in either direction.
  • #6931 (merged) queues CPU-path indirect draws on the draw pipeline; this PR does not touch that path.
  • #5609 (@TheAggie, open) reuses cached draw stages when only buffer base addresses moved. It is about the key, this PR is about admission, so no overlap in purpose, but it changes DrawCache.cpp, Driver.hpp and the test list near these lines. Whichever lands second needs a rebase.

Tested

  • New agc_driver_draw_cache_reuse_indirect (the agc_driver_draw_cache_reuse_tests binary with APS5_DRAW_CACHE_INDIRECT=1 and APS5_PROFILE_DRAW=1): three DRAW_INDIRECT draws whose packet patches a user word the vertex program reads as a value, so they take the CPU path (IndirectDrawPath::NotFolded, 3 of 3). With the switch they insert once and hit once; the existing agc_driver_draw_cache_reuse, _off, _verify and _inline variants run the same draws without it and have to see no insert and no hit. All five 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.
  • New RecordsKeepThePacketsFragmentWord in the same binary, run by all five variants: a DRAW_INDIRECT_MULTI with two records on the CPU path, the first moving the triangle off screen through the vertex word the packet names, the second drawing it, with the fragment stage reading its own user word 0 as its color. Submitted three times with the word 0.75 (absent, insert, hit; 191 drawn), once with 0.25 (no hit, 64 drawn), twice more (insert, hit), then with 0.75 again (hits the first entry, 191 drawn). A record never patches a fragment word (UserDataWords skips the fragment role) and the fragment word is part of the key; the test pins both. Passes in all five variants on lavapipe and on the RTX 5070 Ti.
  • ctest -R agc on lavapipe, ANYPS5_NO_SHADER_CACHE=1: 857 of 858 pass. The one failure is agc_driver_multisample_retirement (MSAA storage promotion did not retain its source image), which passes on the RTX 5070 Ti. It does not set the switch and does not reach the draw cache, and it fails the same way on lavapipe with a main cecb540a6 build, so it comes from main (MSAA retirement, adc46f3ea), not from this change. The 24 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 --base origin/main 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. The numbers are medians over the level windows (10 s each, 56 to 68 per run), judged 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, 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.
    • Draw-cache hit rate 8.4% to 90.1% (57.4k of 63.6k lookups per 10 s; inserts 1.0k to 3.7k per 10 s; 4096 entries, about 15k variants, 20 to 52 MiB).
    • Queue 0 packet time per present 912.9 vs 926.8 ms (-1.5%, lower in all three pairs; ranges 905 to 923 vs 917 to 935). Presents per 10 s in the level 10.44 vs 10.29 (+1.5%, higher in all three pairs). [draw] 106.2 vs 108.6 us per packet (-2.2%, no overlap). Capture plus recompile 25.0 vs 35.2 us per packet. GPU busy flat (162.8 vs 163.1 ms per present), drains and committer flat, screenshots clean.
    • The gain is small and consistent. What a hit still costs on this title: validation 14.5 to 16 us per lookup (2.2 stages, 150 to 500 captured words each, 45% come back equal) and one materialization of the patched stage per record (24.5 us). The push-data follow-up removes the second.
  • 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: none
  • 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/9243#issuecomment-6326683722.

{"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":"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":"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:4954840882 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9243). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-21T16:24:05Z. --- ### What `cacheDrawStages` never admits a draw that an indirect packet runs on the CPU path (`drawParameters.indirect && indirectCpu`), since 29b460156: "the CPU path of an indirect draw recompiles on patched words below: nothing of it is kept". That is only half true. On the CPU path the front stage is materialized once with the packet's user words to classify the draw, then per record only the programs holding a patched word are materialized again, and the fragment stage is reused from the first pass. A title whose draws are mostly CPU-path indirect draws therefore looks up every draw and never inserts one, whatever the cache size. On Demon's Souls 97% of the draw packets are `DRAW_INDEX_INDIRECT` draws whose record patches a user word the vertex program reads as a value, so the draw cache missed 92% of its lookups and `APS5_DRAW_CACHE_ENTRIES=32768` did not move the hit rate. With `APS5_DRAW_CACHE_INDIRECT` set, `cacheDrawStages` admits these draws like any other. A hit reuses the fragment stage and skips the first front-stage pass. The stage whose user word the record patches is still materialized once per record, which the hit path already provides for (`materializeDrawStage` adds the matched stages' regions when `drawHit`). Nothing else changes: the key, the validation and the eviction are the ones direct draws use. The switch is off by default, so `main` behaves as before without it. It stays a switch because a hit still pays the full word validation (about 15 us per lookup on the title below) and one materialization per record, so the gain on its own is small. The follow-up PR that forwards the record's word as push data removes the second cost. It has a row in `docs/dev/ENVIRONMENT.md`. Related, not overlapping: - #7930 (@AnthonyClemens, open) skips CPU-path indirect draws whose records draw nothing before their stages are built. This PR caches the ones that draw. The two touch different lines, and our game runs below had #7930 on both arms. No code dependency in either direction. - #6931 (merged) queues CPU-path indirect draws on the draw pipeline; this PR does not touch that path. - #5609 (@TheAggie, open) reuses cached draw stages when only buffer base addresses moved. It is about the key, this PR is about admission, so no overlap in purpose, but it changes `DrawCache.cpp`, `Driver.hpp` and the test list near these lines. Whichever lands second needs a rebase. ### Tested - New `agc_driver_draw_cache_reuse_indirect` (the `agc_driver_draw_cache_reuse_tests` binary with `APS5_DRAW_CACHE_INDIRECT=1` and `APS5_PROFILE_DRAW=1`): three `DRAW_INDIRECT` draws whose packet patches a user word the vertex program reads as a value, so they take the CPU path (`IndirectDrawPath::NotFolded`, 3 of 3). With the switch they insert once and hit once; the existing `agc_driver_draw_cache_reuse`, `_off`, `_verify` and `_inline` variants run the same draws without it and have to see no insert and no hit. All five 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. - New `RecordsKeepThePacketsFragmentWord` in the same binary, run by all five variants: a `DRAW_INDIRECT_MULTI` with two records on the CPU path, the first moving the triangle off screen through the vertex word the packet names, the second drawing it, with the fragment stage reading its own user word 0 as its color. Submitted three times with the word 0.75 (absent, insert, hit; 191 drawn), once with 0.25 (no hit, 64 drawn), twice more (insert, hit), then with 0.75 again (hits the first entry, 191 drawn). A record never patches a fragment word (`UserDataWords` skips the fragment role) and the fragment word is part of the key; the test pins both. Passes in all five variants on lavapipe and on the RTX 5070 Ti. - `ctest -R agc` on lavapipe, `ANYPS5_NO_SHADER_CACHE=1`: 857 of 858 pass. The one failure is `agc_driver_multisample_retirement` (`MSAA storage promotion did not retain its source image`), which passes on the RTX 5070 Ti. It does not set the switch and does not reach the draw cache, and it fails the same way on lavapipe with a `main` cecb540a6 build, so it comes from main (MSAA retirement, adc46f3ea), not from this change. The 24 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 --base origin/main` 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`. The numbers are medians over the level windows (10 s each, 56 to 68 per run), judged 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, 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`. - Draw-cache hit rate 8.4% to 90.1% (57.4k of 63.6k lookups per 10 s; inserts 1.0k to 3.7k per 10 s; 4096 entries, about 15k variants, 20 to 52 MiB). - Queue 0 packet time per present 912.9 vs 926.8 ms (-1.5%, lower in all three pairs; ranges 905 to 923 vs 917 to 935). Presents per 10 s in the level 10.44 vs 10.29 (+1.5%, higher in all three pairs). `[draw]` 106.2 vs 108.6 us per packet (-2.2%, no overlap). Capture plus recompile 25.0 vs 35.2 us per packet. GPU busy flat (162.8 vs 163.1 ms per present), drains and committer flat, screenshots clean. - The gain is small and consistent. What a hit still costs on this title: validation 14.5 to 16 us per lookup (2.2 stages, 150 to 500 captured words each, 45% come back equal) and one materialization of the patched stage per record (24.5 us). The push-data follow-up removes the second. - 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: none - [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/9243#issuecomment-6326683722. ```json {"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":"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":"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:24:23 +00:00 (Migrated from github.com)

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


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:6320942450 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9243#issuecomment-6320942450). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-21T16:24:23Z. --- <!-- 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`.
CnRJay commented 2026-10-21 17:42:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-21T17:42:53Z.

Review: COMMENTED


The diagnosis is good (97% of Demon's Souls draw packets are CPU-path indirect draws, so the draw cache missed 92% of its lookups whatever its size) and the evidence is honest about the size of the win. It argues against merging the switch by itself.

  • The measured effect is +1.5% presents (10.44 against 10.29 per 10 s) and -1.5% queue 0 packet time, with the hit rate up from 8.4% to 90.1%. A hit still pays 14.5 to 16 us of validation per lookup (2.2 stages, 150 to 500 captured words each) and one materialization of the patched stage per record (24.5 us). What a hit saves is capture plus recompile (35.2 down to 25.0 us per packet); what it still pays is the validation and the per-record materialization, which together are larger than that saving. Adding an opt-in path, a new environment row and a test matrix for 1.5% is a poor trade; the description itself says the gain comes with the push-data follow-up. Land them together, or show that the follow-up is not coming.
  • Six 900 s runs, three pairs, on a base that is main plus seven open PRs and a local stencil-export workaround. The change arm differs only in libSceAgcDriver.prx, which is the right design, but the base isn't main, and the summary lines and traces the perf label asks for "follow as a comment". Please attach them, with the A/A spread of the setup, so +1.5% can be told from drift.
  • The switch is off by default, so no title gets it and CI exercises only the new test with the switch on. If the intent is that this becomes the default after the follow-up, say what condition flips it, and that the key, validation and eviction used for direct draws have been checked against a record that patches a word the fragment stage also reads as a value (the description reuses the fragment stage from the first pass).
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5603820630 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9243#pullrequestreview-5603820630). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-21T17:42:53Z. **Review:** COMMENTED --- The diagnosis is good (97% of Demon's Souls draw packets are CPU-path indirect draws, so the draw cache missed 92% of its lookups whatever its size) and the evidence is honest about the size of the win. It argues against merging the switch by itself. - The measured effect is +1.5% presents (10.44 against 10.29 per 10 s) and -1.5% queue 0 packet time, with the hit rate up from 8.4% to 90.1%. A hit still pays 14.5 to 16 us of validation per lookup (2.2 stages, 150 to 500 captured words each) and one materialization of the patched stage per record (24.5 us). What a hit saves is capture plus recompile (35.2 down to 25.0 us per packet); what it still pays is the validation and the per-record materialization, which together are larger than that saving. Adding an opt-in path, a new environment row and a test matrix for 1.5% is a poor trade; the description itself says the gain comes with the push-data follow-up. Land them together, or show that the follow-up is not coming. - Six 900 s runs, three pairs, on a base that is `main` plus seven open PRs and a local stencil-export workaround. The change arm differs only in `libSceAgcDriver.prx`, which is the right design, but the base isn't `main`, and the summary lines and traces the `perf` label asks for "follow as a comment". Please attach them, with the A/A spread of the setup, so +1.5% can be told from drift. - The switch is off by default, so no title gets it and CI exercises only the new test with the switch on. If the intent is that this becomes the default after the follow-up, say what condition flips it, and that the key, validation and eviction used for direct draws have been checked against a record that patches a word the *fragment* stage also reads as a value (the description reuses the fragment stage from the first pass).
fisherjoey commented 2026-10-21 17:44:48 +00:00 (Migrated from github.com)

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


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.

  • #8372 (verify refreshed stage data): textual. Conflicts on the cacheDrawStages line and in main() of DrawCacheReuse.cpp. Resolution: keep its new stageData parameter plus this PR's drawCacheIndirect() condition, and put CpuPathIndirectDrawsAreCachedWhenAsked in its else branch. With both merged, its APS5_VERIFY_DRAW_ENTRIES check also runs on admitted CPU-path indirect entries. Those are inserted before the record loop, from the packet's words, so I don't expect either side to need a change. I haven't run that combination.
  • #9129 (bound the draw cache by bytes): textual. Both add a static getter at the same spot in DrawCache.cpp; keep both. Admitted indirect entries go through insertDrawEntry, so its byte bound already counts them.
  • #7369 and #7446 merge cleanly onto this branch. They only overlap with #9248, which is stacked on this one.

Either order works; whichever lands second takes the resolutions above.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6322615418 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9243#issuecomment-6322615418). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-21T17:44:48Z. --- 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. - #8372 (verify refreshed stage data): textual. Conflicts on the `cacheDrawStages` line and in `main()` of `DrawCacheReuse.cpp`. Resolution: keep its new `stageData` parameter plus this PR's `drawCacheIndirect()` condition, and put `CpuPathIndirectDrawsAreCachedWhenAsked` in its `else` branch. With both merged, its `APS5_VERIFY_DRAW_ENTRIES` check also runs on admitted CPU-path indirect entries. Those are inserted before the record loop, from the packet's words, so I don't expect either side to need a change. I haven't run that combination. - #9129 (bound the draw cache by bytes): textual. Both add a static getter at the same spot in `DrawCache.cpp`; keep both. Admitted indirect entries go through `insertDrawEntry`, so its byte bound already counts them. - #7369 and #7446 merge cleanly onto this branch. They only overlap with #9248, which is stacked on this one. Either order works; whichever lands second takes the resolutions above. AI-assisted: yes
fisherjoey commented 2026-10-21 18:54:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-21T18:54:34Z.


Thanks for the read. Three answers, in your order.

On landing it with the push-data follow-up: the follow-up is #9248, open, "Depends on #9243". It forwards the record's patched word as push data instead of materializing the stage per record, and on the same 3v3 method (same title, same level, alternating arms, measuring mode, 900 s) it measures 11.87 vs 10.76 presents per 10 s (+10.3%; 11.91, 11.66, 12.05 vs 10.84, 10.62, 10.82) and 798.5 vs 884.4 ms queue 0 per present (-9.7%). #9248 now sits on this branch's head. If you would rather review one PR, say so and I fold #9248 into this one; I have not done that on my own.

On the base, the summary lines and the A/A spread: agreed that the base is not main. Captures on main follow as a comment once the sets are rebuilt: they will be main plus the local stencil-export workaround (needed to reach the level on this GPU) plus the #6280 mip clamp. Today's first capture session on main plus the workaround alone stopped on an Xid 31 that, going by the log and the kernel line, is the known copy-past-the-image fault #6280 clamps (a 4x1 BC3 array T# naming 8 mip levels, vkCmdCopyBufferToImage on the copy engine); the same signature has hit three times before on sets without the clamp and never on sets with it, including this PR's 3v3 runs. So the clamp goes into both capture arms and the pair is re-run; one valid capture of the change arm exists, none of main yet.

A/A numbers from the same setup (steady presents per 10 s and queue 0 ms per present, medians over the level windows, measuring mode, 900 s each):

  • The base arm of this PR's 3v3, three runs alternated with the change arm in one session: presents 10.20, 10.27, 10.39 (spread 1.8%), queue 0 917 to 935 (2.0%). The change arm: 10.32, 10.48, 10.52 (1.9%), 905 to 923 (1.9%). Per pair: +1.2%, +2.0%, +1.3% presents; -1.3%, -1.9%, -1.3% queue 0. The ranges overlap; the direction is the same in all three pairs.
  • Another base set, same day, six runs over two 3v3s: 9.57 to 9.71 (1.4%), queue 0 984 to 998 (1.4%).
  • An earlier session's base set, seven runs: 9.41 to 9.73 (3.3%), queue 0 983 to 1030 (4.8%).
  • The same change-arm set run in two sessions four hours apart on the same day (once as the change arm here, once as the base of #9248's 3v3): 10.32 to 10.52, then 10.62 to 10.84, 4.9% across the six.

So +1.5% is about the size of the within-session spread and well inside the drift between sessions. The alternation is what makes it readable, and I would not claim more for it than "small, same sign in every pair". The number that moves without ambiguity is the hit rate.

On the fragment stage: a record never patches a fragment-stage word, with or without the switch. UserDataWords (DrawDecode.cpp) resolves the packet's base-vertex, start-instance and draw-index register locations into (program, word) pairs and skips the Fragment and GeometryBack roles; the packet names registers in the front stages' user-data ranges, the fragment stage's user words live in their own range. What the fragment stage does read as a value is its own user word, which the packet sets, and that word is in the key either way: the draw key mixes every program's user words (DrawLookup.cpp), the register key hashes the user-data registers of all three ranges (forEachKeyedUserWord in DrawRegisterKey.cpp), and a data-only hit refuses a stage whose changed word is in its userDataMask. The captured-word validation and the LRU eviction are the ones direct draws use; this PR does not touch them. The reuse itself is what main's miss path already does: the fragment stage is materialized once with the packet's words and used for every record of the packet.

That was by reading, so there is now a test for it, RecordsKeepThePacketsFragmentWord in DrawCacheReuse.cpp, run by all five agc_driver_draw_cache_reuse* variants (with and without the switch). A DRAW_INDIRECT_MULTI with two records takes the CPU path: the first record moves the triangle off screen through the vertex word the packet names, the second draws it, and the fragment stage reads its own user word 0 as its color. The draw is submitted three times with the fragment word 0.75 (absent, insert, hit; 191 drawn), then with 0.25 (must not reuse the entry: 64 drawn, no hit), twice more (insert, hit; 64), then back to 0.75 (hits the first entry; 191). It passes on lavapipe in all five variants, and in all seven on #9248 rebased onto it. The GPU here is held for the fault above today, so the RTX run of the new test follows with the captures. The Tested sections of both PRs say which runs are lavapipe-only.

On the default: the switch stays off while a hit still pays one materialization per record. The condition I would propose for flipping it is #9248 merged, then full level runs of the pair with APS5_VERIFY_DRAW_ENTRIES and APS5_VERIFY_DRAW_PUSH_WORD clean on Demon's Souls, and no regression from at least two other titles run with both switches by people who have them. I only have the one title here, so that last part needs other hands, and I am fine with the switch staying opt-in until then.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6323994376 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9243#issuecomment-6323994376). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-21T18:54:34Z. --- Thanks for the read. Three answers, in your order. On landing it with the push-data follow-up: the follow-up is #9248, open, "Depends on #9243". It forwards the record's patched word as push data instead of materializing the stage per record, and on the same 3v3 method (same title, same level, alternating arms, measuring mode, 900 s) it measures 11.87 vs 10.76 presents per 10 s (+10.3%; 11.91, 11.66, 12.05 vs 10.84, 10.62, 10.82) and 798.5 vs 884.4 ms queue 0 per present (-9.7%). #9248 now sits on this branch's head. If you would rather review one PR, say so and I fold #9248 into this one; I have not done that on my own. On the base, the summary lines and the A/A spread: agreed that the base is not `main`. Captures on `main` follow as a comment once the sets are rebuilt: they will be `main` plus the local stencil-export workaround (needed to reach the level on this GPU) plus the #6280 mip clamp. Today's first capture session on `main` plus the workaround alone stopped on an Xid 31 that, going by the log and the kernel line, is the known copy-past-the-image fault #6280 clamps (a 4x1 BC3 array T# naming 8 mip levels, `vkCmdCopyBufferToImage` on the copy engine); the same signature has hit three times before on sets without the clamp and never on sets with it, including this PR's 3v3 runs. So the clamp goes into both capture arms and the pair is re-run; one valid capture of the change arm exists, none of `main` yet. A/A numbers from the same setup (steady presents per 10 s and queue 0 ms per present, medians over the level windows, measuring mode, 900 s each): - The base arm of this PR's 3v3, three runs alternated with the change arm in one session: presents 10.20, 10.27, 10.39 (spread 1.8%), queue 0 917 to 935 (2.0%). The change arm: 10.32, 10.48, 10.52 (1.9%), 905 to 923 (1.9%). Per pair: +1.2%, +2.0%, +1.3% presents; -1.3%, -1.9%, -1.3% queue 0. The ranges overlap; the direction is the same in all three pairs. - Another base set, same day, six runs over two 3v3s: 9.57 to 9.71 (1.4%), queue 0 984 to 998 (1.4%). - An earlier session's base set, seven runs: 9.41 to 9.73 (3.3%), queue 0 983 to 1030 (4.8%). - The same change-arm set run in two sessions four hours apart on the same day (once as the change arm here, once as the base of #9248's 3v3): 10.32 to 10.52, then 10.62 to 10.84, 4.9% across the six. So +1.5% is about the size of the within-session spread and well inside the drift between sessions. The alternation is what makes it readable, and I would not claim more for it than "small, same sign in every pair". The number that moves without ambiguity is the hit rate. On the fragment stage: a record never patches a fragment-stage word, with or without the switch. `UserDataWords` (`DrawDecode.cpp`) resolves the packet's base-vertex, start-instance and draw-index register locations into (program, word) pairs and skips the `Fragment` and `GeometryBack` roles; the packet names registers in the front stages' user-data ranges, the fragment stage's user words live in their own range. What the fragment stage does read as a value is its own user word, which the packet sets, and that word is in the key either way: the draw key mixes every program's user words (`DrawLookup.cpp`), the register key hashes the user-data registers of all three ranges (`forEachKeyedUserWord` in `DrawRegisterKey.cpp`), and a data-only hit refuses a stage whose changed word is in its `userDataMask`. The captured-word validation and the LRU eviction are the ones direct draws use; this PR does not touch them. The reuse itself is what `main`'s miss path already does: the fragment stage is materialized once with the packet's words and used for every record of the packet. That was by reading, so there is now a test for it, `RecordsKeepThePacketsFragmentWord` in `DrawCacheReuse.cpp`, run by all five `agc_driver_draw_cache_reuse*` variants (with and without the switch). A `DRAW_INDIRECT_MULTI` with two records takes the CPU path: the first record moves the triangle off screen through the vertex word the packet names, the second draws it, and the fragment stage reads its own user word 0 as its color. The draw is submitted three times with the fragment word 0.75 (absent, insert, hit; 191 drawn), then with 0.25 (must not reuse the entry: 64 drawn, no hit), twice more (insert, hit; 64), then back to 0.75 (hits the first entry; 191). It passes on lavapipe in all five variants, and in all seven on #9248 rebased onto it. The GPU here is held for the fault above today, so the RTX run of the new test follows with the captures. The Tested sections of both PRs say which runs are lavapipe-only. On the default: the switch stays off while a hit still pays one materialization per record. The condition I would propose for flipping it is #9248 merged, then full level runs of the pair with `APS5_VERIFY_DRAW_ENTRIES` and `APS5_VERIFY_DRAW_PUSH_WORD` clean on Demon's Souls, and no regression from at least two other titles run with both switches by people who have them. I only have the one title here, so that last part needs other hands, and I am fine with the switch staying opt-in until then. AI-assisted: yes
fisherjoey commented 2026-10-21 21:13:24 +00:00 (Migrated from github.com)

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


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, this PR, #9248, main again. The window is APS5_TRACE_SECONDS=400:60 (60 s from t+400 s, level loaded).

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. Without the clamp, main hits the Xid 31 from my earlier comment (a 4x1 BC3 array T# naming 8 mip levels). The trace's commit field, 3e72d893778d, is that local build. dd46b3e09585 is the same tree plus this PR's head b2b765ad4; ab0687554423 adds #9248'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. 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: main run329, this PR run330, main again run332; #9248's run331 is on #9248)

{"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":"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":"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
329 main 50 1183.1 1376.2 1632.9 155.4
330 this PR, APS5_DRAW_CACHE_INDIRECT=1 47 1271.8 1519.6 2048.9 156.5
331 #9248 on top, plus APS5_DRAW_CACHE_PUSH_WORD=1 52 1172.3 1415.7 1536.4 156.7
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, with the mean of the two mains (p50 1204.5) as the reference:

  • This PR alone: p50 +5.6%, p90 +5.4%, presents 47 against 50 and 48. That is just outside the A/A spread, on one capture per arm, so I read it as no gain and possibly a small loss rather than a measured regression. It does not reproduce the -1.5% queue 0 time the 3v3 on our stack measured, and on plain main it is not a win.
  • With #9248 on top: p50 -2.7%, p90 -1.8%, presents 52 against 50 and 48. Inside the A/A spread. Against this PR alone, #9248 is -7.8% p50 and +10.6% presents, the same direction as the 3v3 (-9.7% queue 0, +10.3% presents), on one capture each.

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

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

What the digests show:

  • On main the frame is queue 0. queue worker 0x0 is 99.5% busy in all four captures. Draw plus dispatch summed over the workers is 1250 to 1350 ms per frame against a p50 of 1170 to 1270, and most of it sits on that worker. The seven other queue workers spend 95 to 100% of the frame in Driver.Packet.memory_wait (about 0.88 of the frame each; 7342 of the 8670 ms of Driver.Packet on run329), and the largest slice in each of the five slowest frames of every capture is a memory_wait on queue worker 0x30, 1.36 to 2.02 s. memory_wait is 6.0 to 6.2 times p50 on all four arms, so it is the other queues waiting for the frame, not a stall of its own. The GPU is 12 to 13% busy. A draw-path change has to show on queue 0 to show at all.
  • This PR alone does not shorten the draw path on main. Driver.Draw is 927 ms per frame against 894 and 920 on the two mains. Inside it, Shader.DrawStage drops 18% (321 against 380 and 405; that is the first front-stage pass a hit skips), but Driver.Draw.draw_enqueued is up 18% (500 against 426 and 424), Driver.Packet.dispatch sits at the top of the main range (419 against 374 and 409), and the draw committer's Graphics.Draw is up on its own thread (181 against 136 and 155 ms per frame, most of it draw_and_resource_release). The saving and the extra cost cancel, which matches what the description says a hit still pays: the word validation and one materialization per record.
  • With #9248 on top the draw path does drop: Driver.Draw 832 ms (-10.3% against this PR, -8.3% against the main mean), draw_enqueued 386 (-23% and -9%), Shader.DrawStage off the top 8. Driver.Packet.dispatch does not move (414), and the committer stays above main (169). Against this PR the frame moves by about the Driver.Draw delta (-96 ms Driver.Draw, -100 ms p50); against main it moves by less (-75 ms Driver.Draw, -32 ms p50, with dispatch +23 ms of the difference).
  • 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.

On the review's first point: this agrees with it. On plain main this switch alone is not worth landing; the change you can measure comes with the push-word forwarding. The offer stands: say so and I fold #9248 into this PR, so there is one PR to review with one capture pair. Otherwise they stay stacked as they are.

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, 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, 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, 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:6326683722 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9243#issuecomment-6326683722). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-21T21:13:24Z. --- 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, this PR, #9248, main again. The window is `APS5_TRACE_SECONDS=400:60` (60 s from t+400 s, level loaded). 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. Without the clamp, main hits the Xid 31 from my earlier comment (a 4x1 BC3 array T# naming 8 mip levels). The trace's commit field, 3e72d893778d, is that local build. dd46b3e09585 is the same tree plus this PR's head b2b765ad4; ab0687554423 adds #9248'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. 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: main run329, this PR run330, main again run332; #9248's run331 is on #9248) ```json {"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":"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":"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) - run329 main: https://github.com/fisherjoey/AnyPS5/releases/download/perf-captures-20261021/aps5-trace-3e72d893778d-3139565.json.gz - run330 this PR: https://github.com/fisherjoey/AnyPS5/releases/download/perf-captures-20261021/aps5-trace-dd46b3e09585-3182475.json.gz - run331 #9248 on top: https://github.com/fisherjoey/AnyPS5/releases/download/perf-captures-20261021/aps5-trace-ab0687554423-3238611.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 | |---|---|---|---|---|---|---| | 329 | main | 50 | 1183.1 | 1376.2 | 1632.9 | 155.4 | | 330 | this PR, `APS5_DRAW_CACHE_INDIRECT=1` | 47 | 1271.8 | 1519.6 | 2048.9 | 156.5 | | 331 | #9248 on top, plus `APS5_DRAW_CACHE_PUSH_WORD=1` | 52 | 1172.3 | 1415.7 | 1536.4 | 156.7 | | 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, with the mean of the two mains (p50 1204.5) as the reference: - This PR alone: p50 +5.6%, p90 +5.4%, presents 47 against 50 and 48. That is just outside the A/A spread, on one capture per arm, so I read it as no gain and possibly a small loss rather than a measured regression. It does not reproduce the -1.5% queue 0 time the 3v3 on our stack measured, and on plain `main` it is not a win. - With #9248 on top: p50 -2.7%, p90 -1.8%, presents 52 against 50 and 48. Inside the A/A spread. Against this PR alone, #9248 is -7.8% p50 and +10.6% presents, the same direction as the 3v3 (-9.7% queue 0, +10.3% presents), on one capture each. Where the frame goes, from `top_phases_ms_per_frame` (ms per frame, summed over threads) and the digest's thread table | phase | main 329 | main 332 | this PR 330 | plus #9248 331 | |---|---|---|---|---| | Driver.Packet | 8670.0 | 9049.4 | 9215.5 | 8338.4 | | Driver.Packet.memory_wait | 7341.8 | 7651.7 | 7790.0 | 7024.6 | | Driver.Packet.draw | 895.8 | 922.4 | 929.2 | 833.3 | | Driver.Draw | 893.9 | 920.3 | 927.2 | 831.7 | | Driver.Draw.draw_enqueued | 426.3 | 424.3 | 500.0 | 385.8 | | Driver.Packet.dispatch | 373.8 | 408.6 | 419.0 | 414.0 | | Shader.DrawStage | 379.6 | 404.6 | 321.2 | under 320.2 (off the top 8) | | Driver.Draw.shader_compile_and_link | 333.9 | 352.9 | under 321.2 (off the top 8) | 320.2 | | draw committer thread, Graphics.Draw | 135.5 | 154.6 | 181.2 | 168.9 | | gpu busy | 155.4 | 153.8 | 156.5 | 156.7 | What the digests show: - On `main` the frame is queue 0. `queue worker 0x0` is 99.5% busy in all four captures. Draw plus dispatch summed over the workers is 1250 to 1350 ms per frame against a p50 of 1170 to 1270, and most of it sits on that worker. The seven other queue workers spend 95 to 100% of the frame in `Driver.Packet.memory_wait` (about 0.88 of the frame each; 7342 of the 8670 ms of Driver.Packet on run329), and the largest slice in each of the five slowest frames of every capture is a memory_wait on `queue worker 0x30`, 1.36 to 2.02 s. memory_wait is 6.0 to 6.2 times p50 on all four arms, so it is the other queues waiting for the frame, not a stall of its own. The GPU is 12 to 13% busy. A draw-path change has to show on queue 0 to show at all. - This PR alone does not shorten the draw path on `main`. Driver.Draw is 927 ms per frame against 894 and 920 on the two mains. Inside it, `Shader.DrawStage` drops 18% (321 against 380 and 405; that is the first front-stage pass a hit skips), but `Driver.Draw.draw_enqueued` is up 18% (500 against 426 and 424), `Driver.Packet.dispatch` sits at the top of the main range (419 against 374 and 409), and the draw committer's `Graphics.Draw` is up on its own thread (181 against 136 and 155 ms per frame, most of it `draw_and_resource_release`). The saving and the extra cost cancel, which matches what the description says a hit still pays: the word validation and one materialization per record. - With #9248 on top the draw path does drop: Driver.Draw 832 ms (-10.3% against this PR, -8.3% against the main mean), draw_enqueued 386 (-23% and -9%), Shader.DrawStage off the top 8. `Driver.Packet.dispatch` does not move (414), and the committer stays above main (169). Against this PR the frame moves by about the Driver.Draw delta (-96 ms Driver.Draw, -100 ms p50); against main it moves by less (-75 ms Driver.Draw, -32 ms p50, with dispatch +23 ms of the difference). - 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. On the review's first point: this agrees with it. On plain `main` this switch alone is not worth landing; the change you can measure comes with the push-word forwarding. The offer stands: say so and I fold #9248 into this PR, so there is one PR to review with one capture pair. Otherwise they stay stacked as they are. 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, 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, 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, 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
MarcZX10 commented 2026-10-23 12:00:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T12:00:37Z.

Review: DISMISSED


I reviewed the new coverage, including RecordsKeepThePacketsFragmentWord, which does exercise the case where the packet-patched word is also read by the fragment stage. The updated performance report now supplies the requested same-machine main/PR/#9248 captures and A/A spread; the report check passes.

The branch still needs a current-main refresh before this change can be re-reviewed. Its measurement base is cecb540a6; current main is 0f8da39a, and the compare reports 1,491 commits ahead. More importantly, current main changed the same draw-cache files: Driver.hpp, DrawCache.cpp, and DrawCapture.cpp, adding shape-entry replacement and shapeNeedsEntry handling alongside the cache-admission path this PR changes. Please rebase/merge current main, preserve those semantics while applying the indirect admission condition, and rerun the focused draw-cache tests with APS5_DRAW_CACHE_INDIRECT both unset and set. The merge preview being clean does not validate this interaction.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5627910883 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9243#pullrequestreview-5627910883). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T12:00:37Z. **Review:** DISMISSED --- I reviewed the new coverage, including `RecordsKeepThePacketsFragmentWord`, which does exercise the case where the packet-patched word is also read by the fragment stage. The updated performance report now supplies the requested same-machine `main`/PR/#9248 captures and A/A spread; the report check passes. The branch still needs a current-main refresh before this change can be re-reviewed. Its measurement base is `cecb540a6`; current `main` is `0f8da39a`, and the compare reports 1,491 commits ahead. More importantly, current main changed the same draw-cache files: `Driver.hpp`, `DrawCache.cpp`, and `DrawCapture.cpp`, adding shape-entry replacement and `shapeNeedsEntry` handling alongside the cache-admission path this PR changes. Please rebase/merge current main, preserve those semantics while applying the indirect admission condition, and rerun the focused draw-cache tests with `APS5_DRAW_CACHE_INDIRECT` both unset and set. The merge preview being clean does not validate this interaction.
MarcZX10 commented 2026-10-29 06:01:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T06:01:13Z.

Review: CHANGES_REQUESTED


Re-checked — changes requested

What I checked

  • Reviewed exact head 949c9cf477ce8857fedc2683a560a2fe23dd91bd against fetched main 2960e9a6e7. The current-main merge preview and git diff --check pass.
  • The reported rebase preserves the current shapeNeedsEntry/replaceShape behavior, and the author reports 59 focused draw-cache tests passing with the switch both unset and enabled. Hosted Windows and conventions checks pass; product Linux and specialized jobs were skipped. I did not run GPU tests locally.

Blocking items

  • This is labeled perf, but the current description still lacks the required paired aps5-summary.jsonl lines for the same title, scene, and machine, attached baseline/change traces, and tools/trace_digest.py output. The older capture data and trace filenames do not meet that report checklist; please add the required artifacts from the current head and current main.
  • Open #5609 edits several of the same draw-cache files. The pairwise merge preview conflicts, while this PR says only that whichever lands second must rebase; I found no agreed order or declared Depends on. Please coordinate with #5609’s author and record the order.
  • The current head is 232 commits behind fetched main. Please refresh and rerun the focused draw-cache tests and the required performance pair on that integration head.

The 59/59 test result is author-reported from the earlier base 3a40945e6; no local GPU tests were run. I cannot approve until the performance evidence, overlap order, and current-head validation are complete.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693500848 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9243#pullrequestreview-5693500848). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T06:01:13Z. **Review:** CHANGES_REQUESTED --- # Re-checked — changes requested ## What I checked - Reviewed exact head `949c9cf477ce8857fedc2683a560a2fe23dd91bd` against fetched `main` `2960e9a6e7`. The current-main merge preview and `git diff --check` pass. - The reported rebase preserves the current `shapeNeedsEntry`/`replaceShape` behavior, and the author reports 59 focused draw-cache tests passing with the switch both unset and enabled. Hosted Windows and conventions checks pass; product Linux and specialized jobs were skipped. I did not run GPU tests locally. ## Blocking items - This is labeled `perf`, but the current description still lacks the required paired `aps5-summary.jsonl` lines for the same title, scene, and machine, attached baseline/change traces, and `tools/trace_digest.py` output. The older capture data and trace filenames do not meet that report checklist; please add the required artifacts from the current head and current `main`. - Open #5609 edits several of the same draw-cache files. The pairwise merge preview conflicts, while this PR says only that whichever lands second must rebase; I found no agreed order or declared `Depends on`. Please coordinate with #5609’s author and record the order. - The current head is 232 commits behind fetched `main`. Please refresh and rerun the focused draw-cache tests and the required performance pair on that integration head. The 59/59 test result is author-reported from the earlier base `3a40945e6`; no local GPU tests were run. I cannot approve until the performance evidence, overlap order, and current-head validation are complete.
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!9243
No description provided.