perf(agc): drop three per-draw allocations on the draw and materialize paths #9177

Merged
milescoviello merged 3 commits from upstream-pr/9177 into main 2026-10-24 16:29:20 +00:00
milescoviello commented 2026-10-21 14:21:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T14:21:49Z.


What

Three allocations that ran on every draw or stage materialization, in three commits:

  1. Driver::draw copies the draw programs for every draw. Since the draw finisher (#6946), the draw tail takes programs = decode->programs on every draw: one allocation, plus one userData vector and two shared_ptr reference bumps per program. Before #6946, the copy was made only for draws that write user words (the mesh index buffer words, indirect record words or relocated user patches), and every other draw read decode->programs in place.
    • DrawTail::writablePrograms now holds that copy, made on the same condition as before, and DrawTail::programs points at it or at decode->programs. Every write goes through writablePrograms, so a const view of the decode can't be written.
    • The queued commit closures move writablePrograms. When it is empty, the captured decode keeps decode->programs alive. decode is only replaced (by the relocated copy) on draws with user patches, and those take the copy.
  2. Driver::draw reserves programs.size() + 2 RecompileResults for every draw. Only three paths fill results: the rect-list pair, barycentric emulation and CPU-path indirect draws. The reserve now sits right before the first push on each of those paths, with the same bound, so &results[i] stays stable. An ordinary direct draw no longer allocates there.
  3. Three small per-materialization allocations in binding population:
    • DescriptorBindingBuilder::Populate reserves its exact shaderDataUserWords count.
    • GuestSamplersDescriptor reserves four dwords per sampler, as GuestBuffersDescriptor already does.
    • ResolveImageTablesShared returns one shared empty ResolvedImageTables when there are no tables, still calling ResolveImageTables first so its mismatch check keeps throwing.

Tested

Rebased onto main 16319642a4, after #6946's draw finisher, as 9e6966b121. #6946 moved the end of Driver::draw into a DrawTail that owns its own copy of the programs, and its commit closures move that copy. So the old first commit (capturing writablePrograms instead of copying a const vector) no longer applied, and the copy it avoided became one made on every draw. The new first commit makes that copy only for the draws that write user words, as before #6946. The other two commits are replayed onto the new structure. The second commit's removed reservation now sits in the tail setup.

On that head, Ubuntu 26.04.1 (kernel 7.0), GCC 15.2, NVIDIA RTX 4070 Ti, driver 615.71.09, Release:

  • The 62 tests matching mesh_draw_relocation|draw_cache_relocation|pipelined_indirect_draw|indirect_patched_stage|rect_list_indirect|rect_list_corner|pixel_barycentric_emulation|image_table|shader_disk_cache|_draw_pipeline$|draw_finisher|draw_pipeline_trace|draw_data_hit_user_words|mesh|indirect|queued_raw_shader pass 3 of 3. That's the earlier 15 plus #6946's draw finisher and pipelined-draw tests and the other mesh and indirect tests. Two of them, agc_driver_pipelined_metadata_pass_draw_pipeline and agc_driver_finisher_label_order_draw_pipeline, ran in a second pass after their executables were built.
  • Windows 11 VM, GeForce GT 1030 (R580), WinLibs GCC 15.2, Release, ANYPS5_REQUIRE_VULKAN=1: the 34 tests matching mesh_draw_relocation|draw_cache_relocation|pipelined_indirect_draw|indirect_patched_stage|rect_list_indirect|rect_list_corner|pixel_barycentric_emulation|image_table|shader_disk_cache|draw_finisher|draw_pipeline_trace|draw_data_hit_user_words|draw_cache_reuse|draw_write_ranges pass 3 of 3 on main 16319642a4 and 3 of 3 on this head.

CoD Black Ops II (PPSA34502), war-room menu: current main against this head, same machine and scene.

  • Base: main 0db47b263d plus #9656 (f1a1b46987; its libSceVoice.md debt-file conflict resolved to main's side, the code merged cleanly). Without #9656, main stops this title at 10 s (#9601).
  • Candidate: the same plus this head (dc10dbdc15).
  • Method: as before: release libs, 12 GB cap, the scripted run, three rounds with the order swapped in round 2, 10 s summaries and a trace of presents 7270:10 in every run. tools/performance_compare.py --require-matching-context accepts all three pairs.
round base presents per 10 s (menu mean) with this PR base mean frame in the window (ms) with this PR PR minus base
1 (both cold) 11.3 9.0 16.7 (the window fell in the intro) 1,079 not a usable pair
2 (PR first) 9.9 10.4 1,108 976 -12.0 %
3 14.0 12.1 716 865 +20.9 %

On current main this still shows no measurable difference.

  • Between rounds 2 and 3, main alone went from 9.9 to 14.0 presents per 10 s, and the two usable pairs differ by -12 % and +21 %.
  • A frame takes 0.7 to 1.1 s, and 570 to 920 ms of that is Driver.Draw, mostly Graphics.Draw.draw_and_resource_release. Three small allocations per draw don't show next to that.
  • Round 1 was each side's first run on its own shader cache version, and in the base run the intro lasted until present 7333, so its window caught 60 FPS intro frames. The menu intervals of round 1 are listed for completeness only.

The summaries, traces and comparator reports of all six runs are in this release. Round 3's window lines:

Base:

{"commit":"f1a1b4698721","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":".","APS5_TRACE_FRAMES":"7270:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.0.0-38-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":30993,"title_id":"PPSA34502","title":"Call of Duty\u00c2\u00ae: Black Ops II","content_version":"01.010.000","resolution":"1920x1080","window":{"spec":"frames 7270:10","first_present":7270,"ms":7159.304},"presents":10,"frame_ms":{"p50":717.667,"p90":789.638,"p99":789.638,"max":789.638},"gpu_busy_ms_per_present":104.532,"worker_busy_pct":{"queue worker 0x0":87.774},"top_phases_ms_per_frame":{"Driver.Packet":600.534,"Graphics.Draw":579.031,"Graphics.Draw.draw_and_resource_release":573.217,"Driver.Packet.draw":568.397,"Driver.Draw":567.372,"Driver.Draw.draw_enqueued":502.342,"Shader.ResolveAbi":102.387,"Shader.ResolveGraphicsStagesAbi":79.292},"trace_dropped":false,"trace":"aps5-trace-f1a1b4698721-3.json.gz"}

This PR:

{"commit":"dc10dbdc15d0","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":".","APS5_TRACE_FRAMES":"7270:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.0.0-38-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":30993,"title_id":"PPSA34502","title":"Call of Duty\u00c2\u00ae: Black Ops II","content_version":"01.010.000","resolution":"1920x1080","window":{"spec":"frames 7270:10","first_present":7270,"ms":8652.715},"presents":10,"frame_ms":{"p50":872.987,"p90":912.655,"p99":912.655,"max":912.655},"gpu_busy_ms_per_present":116.45,"worker_busy_pct":{"queue worker 0x0":89.515},"top_phases_ms_per_frame":{"Driver.Packet":739.23,"Graphics.Draw":713.162,"Graphics.Draw.draw_and_resource_release":707.611,"Driver.Packet.draw":703.764,"Driver.Draw":702.804,"Driver.Draw.draw_enqueued":639.762,"Shader.ResolveAbi":101.288,"Shader.ResolveGraphicsStagesAbi":75.025},"trace_dropped":false,"trace":"aps5-trace-dc10dbdc15d0-3.json.gz"}

Before the rebase onto #6946.

Rebased onto main cc0078595d as 07e939750f, with no conflicts. git range-diff shows the three commits unchanged. On that head, on Ubuntu 26.04.1 (kernel 7.0), GCC 15.2, NVIDIA RTX 4070 Ti, driver 615.71.09, Release: the 15 tests matching mesh_draw_relocation|draw_cache_relocation|pipelined_indirect_draw|indirect_patched_stage|rect_list_indirect|rect_list_corner|pixel_barycentric_emulation|image_table|shader_disk_cache pass 3 of 3.

CoD Black Ops II (PPSA34502), war-room menu: main 4777caca34 against the pre-rebase head, same machine and scene.

  • Base: main 4777caca34 plus #9656 (9d56f02254). Without #9656, main stops this title at 10 s on sceVoiceGetPortAttr (#9601).
  • Candidate: the same plus this PR's head (5b24a5b8c3).
  • Method: release libs, 12 GB cap, the scripted run, three rounds with the order swapped in round 2. Each run records 10 s summaries and a trace of the same 10 presents, APS5_TRACE_FRAMES=7270:10: the menu starts at about present 7246, after the title's 60 FPS intro. So both sides' windows start at the same present, with the same environment and nothing dropped, and tools/performance_compare.py --require-matching-context accepts all three pairs.
round base presents per 10 s (menu mean) with this PR base frame p50 (ms) with this PR mean frame time, PR minus base
1 11.0 10.3 950 961 -0.2 %
2 (PR first) 10.4 9.6 1028 1107 +9.5 %
3 11.9 12.0 880 889 +0.2 %

On main this shows no measurable difference. A frame takes about 0.9 to 1.1 s, and 690 to 890 ms of it is Graphics.Draw.draw_and_resource_release, the per-draw snapshot copies that #8756 removes. Three small allocations per draw don't show next to that, and round 2's gap is within this machine's run-to-run noise. The summaries, traces and comparator reports of all six runs are in this release. Round 3's window lines:

Base:

{"commit":"9d56f02254da","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":".","APS5_TRACE_FRAMES":"7270:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.0.0-38-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":30993,"title_id":"PPSA34502","title":"Call of Duty\u00c2\u00ae: Black Ops II","content_version":"01.010.000","resolution":"1920x1080","window":{"spec":"frames 7270:10","first_present":7270,"ms":8718.58},"presents":10,"frame_ms":{"p50":879.643,"p90":914.046,"p99":914.046,"max":914.046},"gpu_busy_ms_per_present":118.379,"worker_busy_pct":{"queue worker 0x0":90.263},"top_phases_ms_per_frame":{"Driver.Packet":757.556,"Driver.Packet.draw":713.589,"Driver.Draw":712.425,"Graphics.Draw":694.609,"Graphics.Draw.draw_and_resource_release":688.25,"Driver.Draw.draw_enqueued":627.459,"Shader.ResolveAbi":94.793,"Shader.ResolveGraphicsStagesAbi":69.168},"trace_dropped":false,"trace":"aps5-trace-9d56f02254da-3.json.gz"}

This PR:

{"commit":"5b24a5b8c3fb","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":".","APS5_TRACE_FRAMES":"7270:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.0.0-38-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":30993,"title_id":"PPSA34502","title":"Call of Duty\u00c2\u00ae: Black Ops II","content_version":"01.010.000","resolution":"1920x1080","window":{"spec":"frames 7270:10","first_present":7270,"ms":8732.553},"presents":10,"frame_ms":{"p50":889.031,"p90":912.664,"p99":912.664,"max":912.664},"gpu_busy_ms_per_present":116.286,"worker_busy_pct":{"queue worker 0x0":90.086},"top_phases_ms_per_frame":{"Driver.Packet":751.697,"Driver.Packet.draw":717.244,"Driver.Draw":715.92,"Graphics.Draw":706.998,"Graphics.Draw.draw_and_resource_release":699.975,"Driver.Draw.draw_enqueued":627.015,"Shader.ResolveAbi":86.669,"Driver.Draw.shader_compile_and_link":71.515},"trace_dropped":false,"trace":"aps5-trace-5b24a5b8c3fb-3.json.gz"}

Supporting context only, not evidence against main: the same menu on a faster composite base. The runs below are from before the rebase: Ubuntu 24.04, GCC 13.3, NVIDIA RTX 4070 Ti, driver 595.99.02, i7-13700K.

Suites on main e072e8840a:

  • ^agc_|^shader|^request_serializer$ passes 866 of 869. The 3 failures are #6683's sample-order tests, which fail on main on this card too; #9056 fixes them.
  • Khronos validation layer 1.4.363 over the 44 relocation, indirect, rect-list, barycentric, image-table, shader-memory, draw-cache and pipelined tests: 44 of 44 pass on main and on this head, with no VUID on either.

CoD Black Ops II (PPSA34502), war-room menu, on a composite base. Release libs, 12 GB cap, the scripted run, 10 s summaries from 140 s. On main alone the menu is bound by per-draw snapshot copies (about 9 presents per 10 s), and the three commits make no measurable difference there: 9.2 against 9.2 over three rounds. So the comparison runs on main f894ba69d3 with #8975 (its pre-merge head), #8756, #8888 and #8928 merged (base 690fd73114), and the same three commits on it, where the menu reaches about 60 presents per 10 s and these allocations are a visible part of the queue worker's time. Six alternating rounds, after one warm-up round each:

round base presents per 10 s (mean) with this PR
1 59.0 61.1
2 61.6 61.2
3 59.5 63.3
4 56.5 60.4
5 60.8 63.0
6 62.2 60.9

The mean is 59.9 against 61.7, +2.9 %, and this PR is ahead in 4 of 6 rounds. That's small next to the run-to-run noise on this machine, which shares its CPU with other services. Treat it as a modest gain, not a proven one. Round 4's base run lost its first intervals to host load.

Captures of round 6, the last one (summary files, traces and tools/trace_digest.py output), are in this release. The 220:5 window lines:

Base:

{"commit":"690fd731145a","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":".","APS5_TRACE_SECONDS":"220:5","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 6.8.0-147-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":32022,"title_id":"PPSA34502","title":"Call of Duty\u00c2\u00ae: Black Ops II","content_version":"01.010.000","resolution":"1920x1080","window":{"spec":"seconds 220:5","first_present":7848,"ms":5124.782},"presents":32,"frame_ms":{"p50":158.175,"p90":175.641,"p99":179.709,"max":179.709},"gpu_busy_ms_per_present":28.208,"worker_busy_pct":{"queue worker 0x0":77.066},"top_phases_ms_per_frame":{"Driver.Packet":122.550,"Driver.Packet.draw":101.710,"Driver.Draw":100.761,"Driver.Draw.shader_compile_and_link":65.929,"Graphics.Draw":60.745,"Graphics.Draw.draw_and_resource_release":54.655,"Shader.DrawStage":54.205,"Shader.ResolveGraphicsAbi":32.483},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":4.434,"events_lost":42081,"totals_full":false}},"trace":"aps5-trace-690fd731145a-3.json.gz"}

This PR:

{"commit":"229a439d32e7","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":".","APS5_TRACE_SECONDS":"220:5","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 6.8.0-147-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":32022,"title_id":"PPSA34502","title":"Call of Duty\u00c2\u00ae: Black Ops II","content_version":"01.010.000","resolution":"1920x1080","window":{"spec":"seconds 220:5","first_present":7836,"ms":5156.383},"presents":31,"frame_ms":{"p50":166.949,"p90":194.986,"p99":201.887,"max":201.887},"gpu_busy_ms_per_present":30.604,"worker_busy_pct":{"queue worker 0x0":74.916},"top_phases_ms_per_frame":{"Driver.Packet":123.340,"Driver.Packet.draw":101.303,"Driver.Draw":100.314,"Driver.Draw.shader_compile_and_link":66.453,"Graphics.Draw":61.821,"Shader.DrawStage":56.791,"Graphics.Draw.draw_and_resource_release":55.914,"Shader.ResolveGraphicsAbi":33.164},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":4.932,"events_lost":12130,"totals_full":false}},"trace":"aps5-trace-229a439d32e7-3.json.gz"}
  • macOS, a title bound by the queue worker: @imellag ran it on an Apple M4 Pro (macOS 27.0.1, MoltenVK 1.4.2, x86-64 Release under Rosetta 2). main doesn't build on macOS, so the base was main cecb540a63 plus the macOS port PRs, with this PR's three commits (pre-rebase head 401aab07d9, the same commits) cherry-picked onto it. Arms alternated, scripted input.

    • Planet of Lana (PPSA19450), about 650 draws a frame with the queue worker as the limit: 29.70 fps mean on the base, 30.09 with this PR (+1.3 %). Every PR run is above the base mean, and the busiest queue worker goes from 71-73 % to 69-70 %.
    • God of War Sons of Sparta (PPSA28997), which is GPU-bound: unchanged, no regression.
  • AMD, Linux: @JJenkx ran it on an RX 6650 XT (RADV, Mesa 26.2.4) with ASTRO BOT booted without input, the PR against its own base, alternated base, PR, PR, base. FPS 21.40, 21.42 on the base and 21.54, 21.18 with the PR: no change and no regression on that scene. Swapping in jemalloc gains about 4 % there, so allocation does show, but these three allocations are too small to.

  • Windows 11 Enterprise 26300, NVIDIA GeForce GT 1030 (driver 582.78), WinLibs GCC 15.2.0 r7 (UCRT), Release: the 28 AGC relocation, indirect, rect-list, barycentric, draw descriptor and pipelined tests pass 3 of 3 on main and 3 of 3 with this change. The pattern also matched 6 relinker relocation tests. They could not start on either side, because that run didn't build the relinker they launch.

Not tested: Intel.

Overlap (the generated report on this head: a textual conflict with #9049; #6804, #7369, #9387 and #9508 also share Draw.cpp but conflict with main, so they weren't compared):

  • #6946 (@Raghav314, draw finisher) has landed, and this head carries it as the earlier note said: the program copy moved into DrawTail, and the reservations stay in the three paths that fill results.
  • #9049 (@EdouardSence) turns GuestSamplersDescriptor into a function that fills a reused vector (result.clear()), next to this PR's result.reserve(resources.size() * 4u). Whichever lands second keeps the reserve after the clear(). With a reused vector it costs nothing once the capacity is there.
  • #9508 (@Raghav314) is still stacked on #6946's branch and conflicts with main. Its Draw.cpp changes only read programs, so the const view this PR gives that code is enough, and it doesn't touch results' reservations.
  • #9387 (@Alexius0815) changes the barycentric-emulation branch, one of the three paths that reserve their results. Its new mesh-compute case builds the readback vertex shader in a local std::optional and still appends at most the two tessellation results, which that branch's reservation covers. So the two only touch neighbouring lines.
  • #6804 and #7369 change neighbouring lines in Draw.cpp; their changes are distinct.

Checklist

  • Based on current main; no other open PR implements the same functions (a textual conflict with #9049, and neighbouring lines of #9387, #9508, #6804 and #7369: see Overlap above)
  • 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); silent stubs are listed under Silent stubs in their library's technical debt file
  • 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
  • Generic behaviour, not specific to one title
  • Depends on: none (measured on top of #8756, #8888 and #8928, which it doesn't need)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 595.99.02, Ubuntu 24.04, and driver 615.71.09, Ubuntu 26.04.1; AMD Radeon RX 6650 XT, RADV, Linux (@JJenkx); NVIDIA GeForce GT 1030, driver 582.78, Windows 11; AMD Radeon RX 9070 XT, RADV (Mesa 26.2.4), Linux (@EdouardSence)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4953156024 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9177). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T14:21:49Z. --- ### What Three allocations that ran on every draw or stage materialization, in three commits: 1. **`Driver::draw` copies the draw programs for every draw.** Since the draw finisher (#6946), the draw tail takes `programs = decode->programs` on every draw: one allocation, plus one `userData` vector and two `shared_ptr` reference bumps per program. Before #6946, the copy was made only for draws that write user words (the mesh index buffer words, indirect record words or relocated user patches), and every other draw read `decode->programs` in place. - `DrawTail::writablePrograms` now holds that copy, made on the same condition as before, and `DrawTail::programs` points at it or at `decode->programs`. Every write goes through `writablePrograms`, so a const view of the decode can't be written. - The queued commit closures move `writablePrograms`. When it is empty, the captured `decode` keeps `decode->programs` alive. `decode` is only replaced (by the relocated copy) on draws with user patches, and those take the copy. 2. **`Driver::draw` reserves `programs.size() + 2` `RecompileResult`s for every draw.** Only three paths fill `results`: the rect-list pair, barycentric emulation and CPU-path indirect draws. The reserve now sits right before the first push on each of those paths, with the same bound, so `&results[i]` stays stable. An ordinary direct draw no longer allocates there. 3. **Three small per-materialization allocations in binding population:** - `DescriptorBindingBuilder::Populate` reserves its exact `shaderDataUserWords` count. - `GuestSamplersDescriptor` reserves four dwords per sampler, as `GuestBuffersDescriptor` already does. - `ResolveImageTablesShared` returns one shared empty `ResolvedImageTables` when there are no tables, still calling `ResolveImageTables` first so its mismatch check keeps throwing. ### Tested **Rebased onto `main` 16319642a4, after #6946's draw finisher, as `9e6966b121`.** #6946 moved the end of `Driver::draw` into a `DrawTail` that owns its own copy of the programs, and its commit closures move that copy. So the old first commit (capturing `writablePrograms` instead of copying a const vector) no longer applied, and the copy it avoided became one made on every draw. The new first commit makes that copy only for the draws that write user words, as before #6946. The other two commits are replayed onto the new structure. The second commit's removed reservation now sits in the tail setup. On that head, Ubuntu 26.04.1 (kernel 7.0), GCC 15.2, NVIDIA RTX 4070 Ti, driver 615.71.09, Release: - The 62 tests matching `mesh_draw_relocation|draw_cache_relocation|pipelined_indirect_draw|indirect_patched_stage|rect_list_indirect|rect_list_corner|pixel_barycentric_emulation|image_table|shader_disk_cache|_draw_pipeline$|draw_finisher|draw_pipeline_trace|draw_data_hit_user_words|mesh|indirect|queued_raw_shader` pass 3 of 3. That's the earlier 15 plus #6946's draw finisher and pipelined-draw tests and the other mesh and indirect tests. Two of them, `agc_driver_pipelined_metadata_pass_draw_pipeline` and `agc_driver_finisher_label_order_draw_pipeline`, ran in a second pass after their executables were built. - Windows 11 VM, GeForce GT 1030 (R580), WinLibs GCC 15.2, Release, `ANYPS5_REQUIRE_VULKAN=1`: the 34 tests matching `mesh_draw_relocation|draw_cache_relocation|pipelined_indirect_draw|indirect_patched_stage|rect_list_indirect|rect_list_corner|pixel_barycentric_emulation|image_table|shader_disk_cache|draw_finisher|draw_pipeline_trace|draw_data_hit_user_words|draw_cache_reuse|draw_write_ranges` pass 3 of 3 on `main` 16319642a4 and 3 of 3 on this head. **CoD Black Ops II (PPSA34502), war-room menu: current `main` against this head, same machine and scene.** - **Base:** `main` 0db47b263d plus #9656 (`f1a1b46987`; its `libSceVoice.md` debt-file conflict resolved to `main`'s side, the code merged cleanly). Without #9656, `main` stops this title at 10 s (#9601). - **Candidate:** the same plus this head (`dc10dbdc15`). - **Method:** as before: release libs, 12 GB cap, the scripted run, three rounds with the order swapped in round 2, 10 s summaries and a trace of presents `7270:10` in every run. `tools/performance_compare.py --require-matching-context` accepts all three pairs. | round | base presents per 10 s (menu mean) | with this PR | base mean frame in the window (ms) | with this PR | PR minus base | |---|---|---|---|---|---| | 1 (both cold) | 11.3 | 9.0 | 16.7 (the window fell in the intro) | 1,079 | not a usable pair | | 2 (PR first) | 9.9 | 10.4 | 1,108 | 976 | -12.0 % | | 3 | 14.0 | 12.1 | 716 | 865 | +20.9 % | On current `main` this still shows no measurable difference. - Between rounds 2 and 3, `main` alone went from 9.9 to 14.0 presents per 10 s, and the two usable pairs differ by -12 % and +21 %. - A frame takes 0.7 to 1.1 s, and 570 to 920 ms of that is `Driver.Draw`, mostly `Graphics.Draw.draw_and_resource_release`. Three small allocations per draw don't show next to that. - Round 1 was each side's first run on its own shader cache version, and in the base run the intro lasted until present 7333, so its window caught 60 FPS intro frames. The menu intervals of round 1 are listed for completeness only. The summaries, traces and comparator reports of all six runs are in [this release](https://github.com/milescoviello/AnyPS5/releases/tag/perf-bo2-9177-rebased-2026-10-23). Round 3's window lines: Base: ```json {"commit":"f1a1b4698721","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":".","APS5_TRACE_FRAMES":"7270:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.0.0-38-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":30993,"title_id":"PPSA34502","title":"Call of Duty\u00c2\u00ae: Black Ops II","content_version":"01.010.000","resolution":"1920x1080","window":{"spec":"frames 7270:10","first_present":7270,"ms":7159.304},"presents":10,"frame_ms":{"p50":717.667,"p90":789.638,"p99":789.638,"max":789.638},"gpu_busy_ms_per_present":104.532,"worker_busy_pct":{"queue worker 0x0":87.774},"top_phases_ms_per_frame":{"Driver.Packet":600.534,"Graphics.Draw":579.031,"Graphics.Draw.draw_and_resource_release":573.217,"Driver.Packet.draw":568.397,"Driver.Draw":567.372,"Driver.Draw.draw_enqueued":502.342,"Shader.ResolveAbi":102.387,"Shader.ResolveGraphicsStagesAbi":79.292},"trace_dropped":false,"trace":"aps5-trace-f1a1b4698721-3.json.gz"} ``` This PR: ```json {"commit":"dc10dbdc15d0","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":".","APS5_TRACE_FRAMES":"7270:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.0.0-38-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":30993,"title_id":"PPSA34502","title":"Call of Duty\u00c2\u00ae: Black Ops II","content_version":"01.010.000","resolution":"1920x1080","window":{"spec":"frames 7270:10","first_present":7270,"ms":8652.715},"presents":10,"frame_ms":{"p50":872.987,"p90":912.655,"p99":912.655,"max":912.655},"gpu_busy_ms_per_present":116.45,"worker_busy_pct":{"queue worker 0x0":89.515},"top_phases_ms_per_frame":{"Driver.Packet":739.23,"Graphics.Draw":713.162,"Graphics.Draw.draw_and_resource_release":707.611,"Driver.Packet.draw":703.764,"Driver.Draw":702.804,"Driver.Draw.draw_enqueued":639.762,"Shader.ResolveAbi":101.288,"Shader.ResolveGraphicsStagesAbi":75.025},"trace_dropped":false,"trace":"aps5-trace-dc10dbdc15d0-3.json.gz"} ``` **Before the rebase onto #6946.** **Rebased** onto `main` cc0078595d as `07e939750f`, with no conflicts. `git range-diff` shows the three commits unchanged. On that head, on Ubuntu 26.04.1 (kernel 7.0), GCC 15.2, NVIDIA RTX 4070 Ti, driver 615.71.09, Release: the 15 tests matching `mesh_draw_relocation|draw_cache_relocation|pipelined_indirect_draw|indirect_patched_stage|rect_list_indirect|rect_list_corner|pixel_barycentric_emulation|image_table|shader_disk_cache` pass 3 of 3. **CoD Black Ops II (PPSA34502), war-room menu: `main` 4777caca34 against the pre-rebase head, same machine and scene.** - **Base:** `main` 4777caca34 plus #9656 (`9d56f02254`). Without #9656, `main` stops this title at 10 s on `sceVoiceGetPortAttr` (#9601). - **Candidate:** the same plus this PR's head (`5b24a5b8c3`). - **Method:** release libs, 12 GB cap, the scripted run, three rounds with the order swapped in round 2. Each run records 10 s summaries and a trace of the same 10 presents, `APS5_TRACE_FRAMES=7270:10`: the menu starts at about present 7246, after the title's 60 FPS intro. So both sides' windows start at the same present, with the same environment and nothing dropped, and `tools/performance_compare.py --require-matching-context` accepts all three pairs. | round | base presents per 10 s (menu mean) | with this PR | base frame p50 (ms) | with this PR | mean frame time, PR minus base | |---|---|---|---|---|---| | 1 | 11.0 | 10.3 | 950 | 961 | -0.2 % | | 2 (PR first) | 10.4 | 9.6 | 1028 | 1107 | +9.5 % | | 3 | 11.9 | 12.0 | 880 | 889 | +0.2 % | On `main` this shows no measurable difference. A frame takes about 0.9 to 1.1 s, and 690 to 890 ms of it is `Graphics.Draw.draw_and_resource_release`, the per-draw snapshot copies that #8756 removes. Three small allocations per draw don't show next to that, and round 2's gap is within this machine's run-to-run noise. The summaries, traces and comparator reports of all six runs are in [this release](https://github.com/milescoviello/AnyPS5/releases/tag/perf-bo2-9177-main-2026-10-22). Round 3's window lines: Base: ```json {"commit":"9d56f02254da","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":".","APS5_TRACE_FRAMES":"7270:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.0.0-38-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":30993,"title_id":"PPSA34502","title":"Call of Duty\u00c2\u00ae: Black Ops II","content_version":"01.010.000","resolution":"1920x1080","window":{"spec":"frames 7270:10","first_present":7270,"ms":8718.58},"presents":10,"frame_ms":{"p50":879.643,"p90":914.046,"p99":914.046,"max":914.046},"gpu_busy_ms_per_present":118.379,"worker_busy_pct":{"queue worker 0x0":90.263},"top_phases_ms_per_frame":{"Driver.Packet":757.556,"Driver.Packet.draw":713.589,"Driver.Draw":712.425,"Graphics.Draw":694.609,"Graphics.Draw.draw_and_resource_release":688.25,"Driver.Draw.draw_enqueued":627.459,"Shader.ResolveAbi":94.793,"Shader.ResolveGraphicsStagesAbi":69.168},"trace_dropped":false,"trace":"aps5-trace-9d56f02254da-3.json.gz"} ``` This PR: ```json {"commit":"5b24a5b8c3fb","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":".","APS5_TRACE_FRAMES":"7270:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.0.0-38-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":30993,"title_id":"PPSA34502","title":"Call of Duty\u00c2\u00ae: Black Ops II","content_version":"01.010.000","resolution":"1920x1080","window":{"spec":"frames 7270:10","first_present":7270,"ms":8732.553},"presents":10,"frame_ms":{"p50":889.031,"p90":912.664,"p99":912.664,"max":912.664},"gpu_busy_ms_per_present":116.286,"worker_busy_pct":{"queue worker 0x0":90.086},"top_phases_ms_per_frame":{"Driver.Packet":751.697,"Driver.Packet.draw":717.244,"Driver.Draw":715.92,"Graphics.Draw":706.998,"Graphics.Draw.draw_and_resource_release":699.975,"Driver.Draw.draw_enqueued":627.015,"Shader.ResolveAbi":86.669,"Driver.Draw.shader_compile_and_link":71.515},"trace_dropped":false,"trace":"aps5-trace-5b24a5b8c3fb-3.json.gz"} ``` **Supporting context only, not evidence against `main`: the same menu on a faster composite base.** The runs below are from before the rebase: Ubuntu 24.04, GCC 13.3, NVIDIA RTX 4070 Ti, driver 595.99.02, i7-13700K. **Suites** on `main` e072e8840a: - `^agc_|^shader|^request_serializer$` passes 866 of 869. The 3 failures are #6683's sample-order tests, which fail on `main` on this card too; #9056 fixes them. - Khronos validation layer 1.4.363 over the 44 relocation, indirect, rect-list, barycentric, image-table, shader-memory, draw-cache and pipelined tests: 44 of 44 pass on `main` and on this head, with no VUID on either. **CoD Black Ops II (PPSA34502), war-room menu, on a composite base.** Release libs, 12 GB cap, the scripted run, 10 s summaries from 140 s. On `main` alone the menu is bound by per-draw snapshot copies (about 9 presents per 10 s), and the three commits make no measurable difference there: 9.2 against 9.2 over three rounds. So the comparison runs on `main` f894ba69d3 with #8975 (its pre-merge head), #8756, #8888 and #8928 merged (base `690fd73114`), and the same three commits on it, where the menu reaches about 60 presents per 10 s and these allocations are a visible part of the queue worker's time. Six alternating rounds, after one warm-up round each: | round | base presents per 10 s (mean) | with this PR | |---|---|---| | 1 | 59.0 | 61.1 | | 2 | 61.6 | 61.2 | | 3 | 59.5 | 63.3 | | 4 | 56.5 | 60.4 | | 5 | 60.8 | 63.0 | | 6 | 62.2 | 60.9 | The mean is 59.9 against 61.7, +2.9 %, and this PR is ahead in 4 of 6 rounds. That's small next to the run-to-run noise on this machine, which shares its CPU with other services. Treat it as a modest gain, not a proven one. Round 4's base run lost its first intervals to host load. Captures of round 6, the last one (summary files, traces and `tools/trace_digest.py` output), are in [this release](https://github.com/milescoviello/AnyPS5/releases/tag/perf-bo2-drawallocs-2026-10-21). The 220:5 window lines: Base: ```json {"commit":"690fd731145a","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":".","APS5_TRACE_SECONDS":"220:5","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 6.8.0-147-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":32022,"title_id":"PPSA34502","title":"Call of Duty\u00c2\u00ae: Black Ops II","content_version":"01.010.000","resolution":"1920x1080","window":{"spec":"seconds 220:5","first_present":7848,"ms":5124.782},"presents":32,"frame_ms":{"p50":158.175,"p90":175.641,"p99":179.709,"max":179.709},"gpu_busy_ms_per_present":28.208,"worker_busy_pct":{"queue worker 0x0":77.066},"top_phases_ms_per_frame":{"Driver.Packet":122.550,"Driver.Packet.draw":101.710,"Driver.Draw":100.761,"Driver.Draw.shader_compile_and_link":65.929,"Graphics.Draw":60.745,"Graphics.Draw.draw_and_resource_release":54.655,"Shader.DrawStage":54.205,"Shader.ResolveGraphicsAbi":32.483},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":4.434,"events_lost":42081,"totals_full":false}},"trace":"aps5-trace-690fd731145a-3.json.gz"} ``` This PR: ```json {"commit":"229a439d32e7","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":".","APS5_TRACE_SECONDS":"220:5","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 6.8.0-147-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":32022,"title_id":"PPSA34502","title":"Call of Duty\u00c2\u00ae: Black Ops II","content_version":"01.010.000","resolution":"1920x1080","window":{"spec":"seconds 220:5","first_present":7836,"ms":5156.383},"presents":31,"frame_ms":{"p50":166.949,"p90":194.986,"p99":201.887,"max":201.887},"gpu_busy_ms_per_present":30.604,"worker_busy_pct":{"queue worker 0x0":74.916},"top_phases_ms_per_frame":{"Driver.Packet":123.340,"Driver.Packet.draw":101.303,"Driver.Draw":100.314,"Driver.Draw.shader_compile_and_link":66.453,"Graphics.Draw":61.821,"Shader.DrawStage":56.791,"Graphics.Draw.draw_and_resource_release":55.914,"Shader.ResolveGraphicsAbi":33.164},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":4.932,"events_lost":12130,"totals_full":false}},"trace":"aps5-trace-229a439d32e7-3.json.gz"} ``` - macOS, a title bound by the queue worker: @imellag [ran it](https://github.com/boykopovar/AnyPS5/pull/9177#issuecomment-6339079554) on an Apple M4 Pro (macOS 27.0.1, MoltenVK 1.4.2, x86-64 Release under Rosetta 2). `main` doesn't build on macOS, so the base was `main` cecb540a63 plus the macOS port PRs, with this PR's three commits (pre-rebase head `401aab07d9`, the same commits) cherry-picked onto it. Arms alternated, scripted input. - Planet of Lana (PPSA19450), about 650 draws a frame with the queue worker as the limit: 29.70 fps mean on the base, 30.09 with this PR (+1.3 %). Every PR run is above the base mean, and the busiest queue worker goes from 71-73 % to 69-70 %. - God of War Sons of Sparta (PPSA28997), which is GPU-bound: unchanged, no regression. - AMD, Linux: @JJenkx [ran it](https://github.com/boykopovar/AnyPS5/pull/9177#issuecomment-6322240111) on an RX 6650 XT (RADV, Mesa 26.2.4) with ASTRO BOT booted without input, the PR against its own base, alternated base, PR, PR, base. FPS 21.40, 21.42 on the base and 21.54, 21.18 with the PR: no change and no regression on that scene. Swapping in jemalloc gains about 4 % there, so allocation does show, but these three allocations are too small to. - Windows 11 Enterprise 26300, NVIDIA GeForce GT 1030 (driver 582.78), WinLibs GCC 15.2.0 r7 (UCRT), Release: the 28 AGC relocation, indirect, rect-list, barycentric, draw descriptor and pipelined tests pass 3 of 3 on `main` and 3 of 3 with this change. The pattern also matched 6 relinker relocation tests. They could not start on either side, because that run didn't build the relinker they launch. Not tested: Intel. **Overlap** (the generated report on this head: a textual conflict with #9049; #6804, #7369, #9387 and #9508 also share `Draw.cpp` but conflict with `main`, so they weren't compared): - **#6946** (@Raghav314, draw finisher) has landed, and this head carries it as the earlier note said: the program copy moved into `DrawTail`, and the reservations stay in the three paths that fill `results`. - **#9049** (@EdouardSence) turns `GuestSamplersDescriptor` into a function that fills a reused vector (`result.clear()`), next to this PR's `result.reserve(resources.size() * 4u)`. Whichever lands second keeps the reserve after the `clear()`. With a reused vector it costs nothing once the capacity is there. - **#9508** (@Raghav314) is still stacked on #6946's branch and conflicts with `main`. Its `Draw.cpp` changes only read `programs`, so the const view this PR gives that code is enough, and it doesn't touch `results`' reservations. - **#9387** (@Alexius0815) changes the barycentric-emulation branch, one of the three paths that reserve their results. Its new mesh-compute case builds the readback vertex shader in a local `std::optional` and still appends at most the two tessellation results, which that branch's reservation covers. So the two only touch neighbouring lines. - **#6804** and **#7369** change neighbouring lines in `Draw.cpp`; their changes are distinct. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions (a textual conflict with #9049, and neighbouring lines of #9387, #9508, #6804 and #7369: see **Overlap** above) - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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 - [x] Generic behaviour, not specific to one title - [x] Depends on: none (measured on top of #8756, #8888 and #8928, which it doesn't need) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 595.99.02, Ubuntu 24.04, and driver 615.71.09, Ubuntu 26.04.1; AMD Radeon RX 6650 XT, RADV, Linux (@JJenkx); NVIDIA GeForce GT 1030, driver 582.78, Windows 11; AMD Radeon RX 9070 XT, RADV (Mesa 26.2.4), Linux (@EdouardSence) - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
JJenkx commented 2026-10-21 17:26:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-21T17:26:04Z.


AMD/Linux data point, for the "Not tested: AMD" line. The result is neutral: no change and no regression.

Setup

  • ASTRO BOT (PPSA21564) title screen ("PRESS ANY BUTTON"), reached with no input, so the scene is the same in every run. It is not a gameplay scene.
  • Linux 7.2.9 (Arch), Ryzen 9 7950X, RX 6650 XT, RADV (Mesa 26.2.4).
  • This PR's head 401aab07d9 against its own base main e072e8840a; both builds are clean, and one relinked app.elf is shared by both.
  • ANYPS5_PRESENT_MODE=immediate, APS5_TRACE_SECONDS=150:30, APS5_TRACE_EVENTS=4194304.
  • One warm-up run, then alternated base, PR, PR, base; 240 s each.
  • Every trace reports dirty false and dropped false.
Run FPS (presents/window) frame p50 / p99 ms GPU busy ms/present
base 21.40 46.5 / 52.4 34.0
this PR 21.54 46.3 / 52.2 34.0
this PR 21.18 47.0 / 53.9 34.1
base 21.42 46.4 / 53.2 33.9

Means are 21.36 FPS for this PR and 21.41 for the base, within noise. Swapping the whole allocator for a preloaded jemalloc gained about 4 % on this scene (#357), so allocation cost is visible here, but the three allocations this PR removes are too small to show.

AI-assisted: yes (Claude Code); results above were run on this machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6322240111 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9177#issuecomment-6322240111). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-21T17:26:04Z. --- AMD/Linux data point, for the "Not tested: AMD" line. The result is neutral: no change and no regression. **Setup** - ASTRO BOT (PPSA21564) title screen ("PRESS ANY BUTTON"), reached with no input, so the scene is the same in every run. It is not a gameplay scene. - Linux 7.2.9 (Arch), Ryzen 9 7950X, RX 6650 XT, RADV (Mesa 26.2.4). - This PR's head 401aab07d9 against its own base `main` e072e8840a; both builds are clean, and one relinked `app.elf` is shared by both. - `ANYPS5_PRESENT_MODE=immediate`, `APS5_TRACE_SECONDS=150:30`, `APS5_TRACE_EVENTS=4194304`. - One warm-up run, then alternated base, PR, PR, base; 240 s each. - Every trace reports dirty false and dropped false. | Run | FPS (presents/window) | frame p50 / p99 ms | GPU busy ms/present | |---|---|---|---| | base | 21.40 | 46.5 / 52.4 | 34.0 | | this PR | 21.54 | 46.3 / 52.2 | 34.0 | | this PR | 21.18 | 47.0 / 53.9 | 34.1 | | base | 21.42 | 46.4 / 53.2 | 33.9 | Means are 21.36 FPS for this PR and 21.41 for the base, within noise. Swapping the whole allocator for a preloaded jemalloc gained about 4 % on this scene (#357), so allocation cost is visible here, but the three allocations this PR removes are too small to show. AI-assisted: yes (Claude Code); results above were run on this machine.
milescoviello commented 2026-10-21 17:26:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T17:26:52Z.


Thanks @JJenkx. A neutral result on RADV fits what this PR removes: three small allocations per draw, which only show on a frame bound by the draw path, as BO2's menu is here. I added your run to the Tested section and the GPU line.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6322255821 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9177#issuecomment-6322255821). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T17:26:52Z. --- Thanks @JJenkx. A neutral result on RADV fits what this PR removes: three small allocations per draw, which only show on a frame bound by the draw path, as BO2's menu is here. I added your run to the Tested section and the GPU line. AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-10-22 08:22:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T08:22:07Z.

Review: DISMISSED


Review

I did not find a correctness defect in the three allocation changes on this head. The move capture is valid for the local writable program vector, and the scoped reservations match the result-producing paths. I’m requesting changes for the performance evidence and the current overlap state.

Performance evidence

The CONTRIBUTING performance guidance asks for main and change summary lines from the same machine and scene, with traces attached per the issue form. The only paired traces in this PR are from the composite base 690fd731145a and the candidate. Your description explicitly says that base includes #8975, #8756, #8888, and #8928, and correctly warns that the +2.9% result is small and noisy.

I ran the repository comparator on those attached summaries and traces. With --require-matching-context, it rejects the pair because window.first_present differs (7848 vs 7836). Without that requirement, it warns that the measurements do not isolate the code change. Both traces also report dropped events, so the trace detail is incomplete even though the summary data is available. The PR mentions a separate main-alone 9.2 vs 9.2 result, but does not include its matching summary/trace evidence.

Please add a same-machine, same-scene comparison of current main and this change, with the matching summary lines and traces (or explain any unavoidable context mismatch in the report). Please keep the composite-base result clearly labeled as supporting context rather than evidence of the change against main. The current head is 599 commits behind current main, so please also refresh the base and rerun the focused validation after rebasing.

Overlap

The generated overlap report now lists #6946 and #9508 in addition to #6804, #7369, and newer #9387. These are not all duplicates, but the impact should be recorded:

  • #6946’s current Draw.cpp still unconditionally reserves results for programs.size() + 2, which would erase this PR’s ordinary-draw allocation saving if that path is combined as written. Its draw-finisher also changes the ownership/capture flow, so the vector-capture optimization should be rechecked against the combined implementation.
  • #9508 is stacked on #6946 and inherits that interaction.
  • #9387 changes the barycentric-emulation branch in the same draw function, which is one of the paths whose result reservation this PR moves.

Please add the relevant PRs to the overlap notes/checklist and coordinate the combined behavior with those authors as needed. The existing #6804 and #7369 intersections appear to be neighboring, distinct changes.

Checks I ran

  • git diff --check: passed.
  • Repository conventions against current main: passed.
  • Three-way merge check against current main: clean.
  • I did not run a local AGC build or title benchmark on this head; the submitted report contains extensive hardware testing, but the missing current-main paired evidence remains.

The code changes themselves look reasonable. I’ll revisit the review when the performance comparison and overlap notes are updated.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5611248342 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9177#pullrequestreview-5611248342). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T08:22:07Z. **Review:** DISMISSED --- ## Review I did not find a correctness defect in the three allocation changes on this head. The move capture is valid for the local writable program vector, and the scoped reservations match the result-producing paths. I’m requesting changes for the performance evidence and the current overlap state. ### Performance evidence The CONTRIBUTING performance guidance asks for main and change summary lines from the same machine and scene, with traces attached per the issue form. The only paired traces in this PR are from the composite base `690fd731145a` and the candidate. Your description explicitly says that base includes #8975, #8756, #8888, and #8928, and correctly warns that the +2.9% result is small and noisy. I ran the repository comparator on those attached summaries and traces. With `--require-matching-context`, it rejects the pair because `window.first_present` differs (7848 vs 7836). Without that requirement, it warns that the measurements do not isolate the code change. Both traces also report dropped events, so the trace detail is incomplete even though the summary data is available. The PR mentions a separate `main`-alone 9.2 vs 9.2 result, but does not include its matching summary/trace evidence. Please add a same-machine, same-scene comparison of current `main` and this change, with the matching summary lines and traces (or explain any unavoidable context mismatch in the report). Please keep the composite-base result clearly labeled as supporting context rather than evidence of the change against main. The current head is 599 commits behind current main, so please also refresh the base and rerun the focused validation after rebasing. ### Overlap The generated overlap report now lists #6946 and #9508 in addition to #6804, #7369, and newer #9387. These are not all duplicates, but the impact should be recorded: - #6946’s current `Draw.cpp` still unconditionally reserves `results` for `programs.size() + 2`, which would erase this PR’s ordinary-draw allocation saving if that path is combined as written. Its draw-finisher also changes the ownership/capture flow, so the vector-capture optimization should be rechecked against the combined implementation. - #9508 is stacked on #6946 and inherits that interaction. - #9387 changes the barycentric-emulation branch in the same draw function, which is one of the paths whose result reservation this PR moves. Please add the relevant PRs to the overlap notes/checklist and coordinate the combined behavior with those authors as needed. The existing #6804 and #7369 intersections appear to be neighboring, distinct changes. ### Checks I ran - `git diff --check`: passed. - Repository conventions against current `main`: passed. - Three-way merge check against current `main`: clean. - I did not run a local AGC build or title benchmark on this head; the submitted report contains extensive hardware testing, but the missing current-main paired evidence remains. The code changes themselves look reasonable. I’ll revisit the review when the performance comparison and overlap notes are updated.
milescoviello commented 2026-10-22 10:57:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-22T10:57:27Z.


@MarcZX10 thanks.

Rebase: onto main cc0078595d as 07e939750f, with no conflicts. The three commits are unchanged, and the 15 focused tests pass 3 of 3.

Current main against this PR: three alternating rounds in BO2's war-room menu on the same machine.

  • The base is main 4777caca34 plus #9656, which the title needs to start.
  • Each run traces the same 10 presents (APS5_TRACE_FRAMES=7270:10). The windows start at the same present with the same environment and nothing dropped, and --require-matching-context accepts all three pairs.
  • The result is no measurable difference on main: mean frame time -0.2 %, +9.5 % (the round with this PR first) and +0.2 %. A menu frame there is about a second, and 690 to 890 ms of it is Graphics.Draw.draw_and_resource_release, the per-draw snapshot copies #8756 removes. Three small allocations per draw don't show next to that.
  • The summaries, traces and comparator reports are in Tested and in the linked release.
  • The composite-base result is now labelled as supporting context only.

Overlap: recorded under Overlap in Tested.

  • #6946 keeps the unconditional reservation and the copying programs capture. Whichever of the two lands second has to carry the other's change by hand, and #9508 inherits that through #6946.
  • #9387 only touches neighbouring lines: its mesh-compute case still appends at most the two results that branch reserves.

@Raghav314 (#6946, #9508): do you have a preferred order? If #6946 goes first, I'll rebase this onto it and move the three reservations and the writablePrograms capture into your finisher. If this goes first, the same two changes apply on your side. @Alexius0815 (#9387): I don't think we need an order. Correct me if your barycentric branch can append more than two results.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6339065109 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9177#issuecomment-6339065109). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-22T10:57:27Z. --- @MarcZX10 thanks. **Rebase:** onto `main` cc0078595d as `07e939750f`, with no conflicts. The three commits are unchanged, and the 15 focused tests pass 3 of 3. **Current `main` against this PR:** three alternating rounds in BO2's war-room menu on the same machine. - The base is `main` 4777caca34 plus #9656, which the title needs to start. - Each run traces the same 10 presents (`APS5_TRACE_FRAMES=7270:10`). The windows start at the same present with the same environment and nothing dropped, and `--require-matching-context` accepts all three pairs. - The result is no measurable difference on `main`: mean frame time -0.2 %, +9.5 % (the round with this PR first) and +0.2 %. A menu frame there is about a second, and 690 to 890 ms of it is `Graphics.Draw.draw_and_resource_release`, the per-draw snapshot copies #8756 removes. Three small allocations per draw don't show next to that. - The summaries, traces and comparator reports are in Tested and in the linked release. - The composite-base result is now labelled as supporting context only. **Overlap:** recorded under **Overlap** in Tested. - #6946 keeps the unconditional reservation and the copying `programs` capture. Whichever of the two lands second has to carry the other's change by hand, and #9508 inherits that through #6946. - #9387 only touches neighbouring lines: its mesh-compute case still appends at most the two results that branch reserves. @Raghav314 (#6946, #9508): do you have a preferred order? If #6946 goes first, I'll rebase this onto it and move the three reservations and the `writablePrograms` capture into your finisher. If this goes first, the same two changes apply on your side. @Alexius0815 (#9387): I don't think we need an order. Correct me if your barycentric branch can append more than two results. AI-assisted: yes (Claude Code)
imellag commented 2026-10-22 10:58:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by imellag on 2026-10-22T10:58:16Z.


An Apple / MoltenVK data point, on a title whose frame is bound by the queue worker. A small gain there.

Setup: Apple M4 Pro, macOS 27.0.1, MoltenVK 1.4.2, x86-64 Release under Rosetta 2. main does not build on macOS, so the base is main cecb540a63 + #8658 + #9193 + #9263 + #8612. This PR's three commits (head 401aab07d9) cherry-pick onto it cleanly. Warm shader caches, APS5_TRACE_SUMMARY_EVERY, no other trace or profile switch, arms alternated, scripted input.

Scene base + this PR
Planet of Lana (PPSA19450), village, standing still, 110 to 190 s 29.40 / 30.04 / 29.83 / 29.51 fps (mean 29.70) 30.08 / 30.13 / 29.89 / 30.25 fps (mean 30.09, +1.3%)
busiest queue worker, same windows 71 to 73% 69 to 70%
God of War Sons of Sparta (PPSA28997), Cyclops fight 39.72 / 39.57 fps 39.90 / 39.88 fps (GPU-bound at 22.8 ms in both, neutral)

In Lana every run of this PR is above the mean of the base runs, and the worker is busy about 3 points less. That fits the per-draw allocations this removes: Lana records about 650 draws a frame with the queue worker as the limit. God of War is limited by the GPU, so it shows no change, and no regression.

AI-assisted: yes (Claude Code). The runs are from my M4 Pro.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6339079554 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9177#issuecomment-6339079554). Originally posted by [imellag](https://github.com/imellag) on 2026-10-22T10:58:16Z. --- An Apple / MoltenVK data point, on a title whose frame is bound by the queue worker. A small gain there. **Setup:** Apple M4 Pro, macOS 27.0.1, MoltenVK 1.4.2, x86-64 Release under Rosetta 2. `main` does not build on macOS, so the base is `main` cecb540a63 + #8658 + #9193 + #9263 + #8612. This PR's three commits (head 401aab07d9) cherry-pick onto it cleanly. Warm shader caches, `APS5_TRACE_SUMMARY_EVERY`, no other trace or profile switch, arms alternated, scripted input. | Scene | base | + this PR | |---|---|---| | Planet of Lana (PPSA19450), village, standing still, 110 to 190 s | 29.40 / 30.04 / 29.83 / 29.51 fps (mean 29.70) | 30.08 / 30.13 / 29.89 / 30.25 fps (mean 30.09, **+1.3%**) | | busiest queue worker, same windows | 71 to 73% | 69 to 70% | | God of War Sons of Sparta (PPSA28997), Cyclops fight | 39.72 / 39.57 fps | 39.90 / 39.88 fps (GPU-bound at 22.8 ms in both, neutral) | In Lana every run of this PR is above the mean of the base runs, and the worker is busy about 3 points less. That fits the per-draw allocations this removes: Lana records about 650 draws a frame with the queue worker as the limit. God of War is limited by the GPU, so it shows no change, and no regression. AI-assisted: yes (Claude Code). The runs are from my M4 Pro.
milescoviello commented 2026-10-22 10:59:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-22T10:59:20Z.


@imellag thanks for the M4 Pro runs. Planet of Lana, with about 650 draws a frame and the queue worker as the limit, is the kind of scene where these allocations should show. Every PR run was above the base mean, and the worker dropped about 3 points, which fits that. God of War being neutral is also useful, as it shows no regression in a GPU-bound case. Added to Tested.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6339098426 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9177#issuecomment-6339098426). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-22T10:59:20Z. --- @imellag thanks for the M4 Pro runs. Planet of Lana, with about 650 draws a frame and the queue worker as the limit, is the kind of scene where these allocations should show. Every PR run was above the base mean, and the worker dropped about 3 points, which fits that. God of War being neutral is also useful, as it shows no regression in a GPU-bound case. Added to Tested. AI-assisted: yes (Claude Code)
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!9177
No description provided.