perf(shader): keep a binding's element flags inline #6970

Merged
meh7an merged 3 commits from upstream-pr/6970 into main 2026-11-08 08:15:58 +00:00
meh7an commented 2026-10-16 22:55:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by meh7an on 2026-10-16T22:55:31Z.


What

DescriptorBindingBuilder::Populate turns a stage's binding plan into the bindings of a materialized result, for every draw stage the memos miss and for every dispatch. It copies each planned DescriptorBinding (auto physical = entry.descriptor). A binding keeps 12 per-element flag lists as std::vector<bool>: samplerDepthCompare, imageWritten, imageDepthCompare, imageAtomic, imageAtomic64, bufferAtomic, bufferWritten, samplerUnnormalized, samplerIntegerBorder, imageUnnormalized, imageUnnormalizedBaseLevel and bufferRead. Every copy allocates one block per non-empty list, and releasing the result frees them again.

ElementFlags (in Recompiler.hpp) replaces std::vector<bool> for those lists:

  • Up to 64 flags live in one inline word; a longer list moves to a std::vector<bool>. A binding rarely has more than 64 elements, so a copy allocates nothing.
  • It reads and writes as std::vector<bool> does: size, empty, [] (a reference proxy when written), at, back, iteration, push_back, assign, resize, clear, and == with another list or a std::vector<bool>. The code that fills and reads the lists stays as it is.
    • Two test lambdas take ElementFlags instead of std::vector<bool>.
    • The image table reuse keeps its copy of the depth compare flags as ElementFlags.
  • The shader disk cache writes and reads it as before (a count, then one byte per flag), so the entry format is unchanged. The recompiler's sources change, so the shader cache version changes with them.
  • verifyElementFlags (shader disk cache tests) checks 70 flags, past the inline word. It covers reads, iteration, copies, writes through [] and back(), resize both ways, assign, clear, and a round trip through the disk cache.

On the S2 page of Sonic Origins Plus's main menu, the queue worker spent, per frame (APS5 sampler, 15 s):

  • Populate: 1.28 to 0.91. In a profile of the baseline, 78 of its 151 direct operator new samples were inlined std::vector<bool> copies (8 call sites), and 14 more were in std::vector<bool>'s copy constructor.
  • releasing the results (RecompileResult's disposal): 0.76 to 0.57;
  • operator new 3.38 to 2.88, mi_free 0.68 to 0.59;
  • the whole worker: 32.80 to 31.04 samples.

That is a few percent of the worker's frame at most. On current main, three paired runs below put the frame median about 2% lower.

Tested

Windows 11 (10.0.26300), WinLibs GCC 15.2.0 (UCRT), Release, NVIDIA GeForce RTX 2080 Ti, driver 617.14.

  • ShaderDiskCache.cpp's size asserts compile only on Linux (x86_64, libstdc++), so the Windows build above skips them.
    • ElementFlags is 56 bytes against std::vector<bool>'s 40. Main's DescriptorBinding now has 13 such lists, with samplerCoordinatesIgnored, so it grows from 656 to 864 bytes (+32%), and its assert says 864.
    • Under MinGW's libstdc++, whose layout matches (main reads 656 there, as main's assert says), sizeof(DescriptorBinding) is 864 with this change.
    • The first version, on main 7d728b109, grew it from 592 to 784 bytes (thanks @teepean).
  • Rebased onto main 53a0a27bb (a9a338c37).
    • The size asserts keep main's ShaderInvocation (216) and RecompileResult (528). DescriptorBinding is 864. All four sizes were checked under MinGW's libstdc++ with a Size<sizeof(...)> probe: 216, 528, 864 and CompiledShaderArtifact 280.
    • On that main, with this change, the full ctest suite passes 1836 of 1837. agc_driver_image_array_window_past_layer_limit is not run: MinGW does not build its alignas(65536).
  • Rebased onto main 1d4164552.
    • Main's new samplerCoordinatesIgnored is an ElementFlags as well; main's bufferExtent stays a std::vector<std::uint32_t>.
    • On that main, with this change, the full ctest suite passes 1739 of 1741.
      • agc_driver_image_array_window_past_layer_limit is not run: main does not compile ImageArrayWindowPastLayerLimit.cpp with MinGW (alignas(65536)).
      • agc_driver_pass_input_hazard (added in ba4571a25) fails on plain main 1d4164552 as well, 0 of 4 runs alone.
  • Sonic Origins Plus, S2 page, re-measured on main 1d4164552 in one session: three runs per side, interleaved, each a APS5_TRACE_SECONDS=200:15 capture with warm caches and the title FPS (median of six readings).
Run Main frame p50 (ms) This PR frame p50 (ms) Main Driver.Draw (ms per frame) This PR Driver.Draw (ms per frame) Main title FPS This PR title FPS
1 91.13 84.66 71.05 59.15 12.41 12.40
2 86.83 85.16 61.84 60.79 11.91 12.05
3 86.25 85.88 62.63 61.03 12.22 12.22
  • Every run with this change has a lower frame p50 than every main run. The medians are 86.83 and 85.16 ms (-1.9%), and Driver.Draw 62.63 and 60.79 ms (-2.9%).
  • The title FPS medians are equal (12.22), so the gain is small, below what the title counter resolves.
  • The digests at the end are the median pair, run 2 of each side.

Before this rebase:

  • On main 7d728b109 with this change, the full ctest suite passes 1338 of 1341 tests.
    • agc_driver_gpu_indirect_arguments_misaligned_writer_ahead is not run: main itself does not compile it with MinGW (alignas(65536)).
    • select_tests fails in its setup on Windows without the symlink privilege (WinError 1314 from symlink_to), as on main.
    • build_eligibility timed out once in the parallel run; alone it passes in 1.5 s.
  • Sonic Origins Plus, main menu, S2 page (the 3D background), 1233x694 window.
    • A sampled pair (APS5 sampler, 15 s) took the profile numbers above. The FPS shown in the title went from 10.81 to 10.56 (median of six readings).
    • Captured with APS5_TRACE_SECONDS=200:15 on the same machine in one session, caches warm. Traces attached.
    • Baseline b1909f43b, this change 245e35555 (the summaries name the commits before them, see the note):
Metric Baseline This PR Change
frame_ms.p50 100.348 100.704 +0.4%
frame_ms.p90 105.573 106.216 +0.6%
mean_frame_ms 102.355 103.202 +0.8%
gpu_busy_ms_per_present 84.431 83.660 -0.9%
Driver.Packet (ms per frame) 100.360 101.155 +0.8%
Driver.Draw (ms per frame) 88.210 89.173 +1.1%

The title FPS during the two captures was 10.78 and 10.82 (median of six readings each).

Note: measuring base. These numbers come from my fork's dev, on main 0a56aaaf4. The bindings and their copy in Populate are the same on main 7d728b109.

  • The baseline is measure/inline-2026-10-17 (b1909f43b).
  • This change is measure/flags-2026-10-17 (245e35555). There it converts the same 12 lists. This PR adds the reference proxy, back, resize and the image table's flags, which main's newer code and tests use.
  • Each build was made before its commit, so the summaries name the commit before it, dirty: 11882cc99 for the baseline and b1909f43b for this change.

Both carry these commits from my fork:

  • the fixes a71073ce3, c0d875634, e3c68960e, 604f0f373 and 10ff693aa (#5778);
  • make-exe and the stage dumps (522230d62, deee71fde);
  • the crash-report sampler (8d9c3103e..f641e1ec9), which took the profiles;
  • #6037, #6066, #6077, #6067, #6082 (its first version, before #5906), #6095, #6266, #6292, #6312, #6609, #6611, #6615 and #6733;
  • smaller steps kept in my fork:
    • e83260247, 97b1ff6c9, 84f5bf0ff, ce567bc3d, a79e58a7c, a0a891697, 63f7a8ed0, b04806167, 719fb71dd and a21a3ce81;
    • 3b47f7743 (covered on main by #5062);
    • e3b8d1c52 (which #6566 covers);
    • 390f62471 (a draw decode cache; main reuses decodes through its draw data hits);
    • 40a918442 (the pipeline key outside the store's lock, as #5875 does on main, and the thread's last pipeline);
    • b1909f43b (the vertex phase's lists inline, held until #6661 lands).

The comparison tool marks the window's first present as a configuration difference: the window opens 200 s into each run. Both summaries set trace_dropped, because the worker filled its event buffer at about 2,700 draws per frame.

The summaries list only their top phases. Driver.Draw.shader_compile_and_link (33.1 ms per frame in the baseline) and the present's render_fence_wait (32.2 in this change) sit at the list's cutoff, so each capture lists only one of them.

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); 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
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 2080 Ti, driver 617.14, Windows 11
  • AI-assisted: yes

Traces and summary lines (baseline b1909f43b, whose summary says 11882cc993f0; this change 245e35555, whose summary says b1909f43b4d1):
flags-traces.zip

Traces of the six re-measured runs on main 1d4164552, one zip per round with that round's main and this-change capture: flags-rebased-round1.zip, flags-rebased-round2.zip, flags-rebased-round3.zip.

The re-measured median pair on main 1d4164552, with tools/trace_digest.py for each trace:

Main 1d4164552, run 2 (summary commit 1d41645527)

seconds 200:15 from present 3075: 170 presents, frame p50 86.8 / p90 92.1 / p99 115.2 / max 117.7 ms, GPU busy 69.1 ms per present
NVIDIA GeForce RTX 2080 Ti, NVIDIA 617.14, Windows 10.0.26300, 3840x2160, commit 1d41645527, dropped: yes

{"commit":"1d41645527f5","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"200:15"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 617.14","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz","cpu_threads":16,"memory_mib":32684,"title_id":"PPSA05324","title":"Sonic Origins","content_version":"02.002.000","resolution":"3840x2160","window":{"spec":"seconds 200:15","first_present":3075,"ms":15013.344},"presents":170,"frame_ms":{"p50":86.832,"p90":92.073,"p99":115.234,"max":117.659},"gpu_busy_ms_per_present":69.058,"worker_busy_pct":{"queue worker 0x0":96.848},"top_phases_ms_per_frame":{"Driver.Packet":85.501,"Driver.Packet.draw":63.243,"Driver.Draw":61.837,"Graphics.Draw":58.045,"Graphics.Draw.draw_and_resource_release":48.446,"Driver.Draw.shader_compile_and_link":41.847,"Shader.DrawStage":32.497,"VideoOut.Flip":24.784},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":6.117,"events_lost":385724,"totals_full":false},"draw committer":{"events_full_after_s":14.471,"events_lost":10071,"totals_full":false}},"trace":"aps5-trace-1d41645527f5-40372.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 3175: 117.7 ms at 8834 ms: batch (gpu) 67.8, Graphics.Draw (draw committer) 61.7, Graphics.Draw.draw_and_resource_release (draw committer) 56.1, VideoOut.Flip (presenter) 24.6
  • present 3113: 115.2 ms at 3355 ms: Driver.Packet (queue worker 0x0) 77.6, batch (gpu) 70.1, Driver.Packet.draw (queue worker 0x0) 63.2, Driver.Draw (queue worker 0x0) 62.1
  • present 3185: 112.0 ms at 9725 ms: batch (gpu) 69.6, Graphics.Draw (draw committer) 58.1, Graphics.Draw.draw_and_resource_release (draw committer) 53.7, VideoOut.Flip (presenter) 25.0
  • present 3209: 112.0 ms at 11854 ms: batch (gpu) 68.2, Graphics.Draw (draw committer) 57.8, Graphics.Draw.draw_and_resource_release (draw committer) 52.3, VideoOut.Flip (presenter) 24.1
  • present 3085: 110.8 ms at 859 ms: Driver.Packet (queue worker 0x0) 74.1, batch (gpu) 65.2, Driver.Packet.draw (queue worker 0x0) 59.7, Driver.Draw (queue worker 0x0) 58.4

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 1.0 (1 %) 0.0 (0 %) 87.3 0.7 Shader.ResolveGraphicsStagesAbi 0.7, Shader.ResolveAbi 0.3
queue worker 0x0 19.2 (22 %) 0.0 (0 %) 69.0 82.9 Driver.Packet 19.3, Driver.EndSubmission 0.0
draw committer 34.2 (39 %) 0.5 (1 %) 53.6 50.9 Graphics.Draw 32.5, Recorder.Submit 1.0
title 0.4 (0 %) 0.0 (0 %) 88.0 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 88.1 0.1 Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 88.0 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
presenter 0.7 (1 %) 24.1 (27 %) 63.5 0.0 VideoOut.Flip 24.8, Driver.Present 0.0
title 0.3 (0 %) 0.0 (0 %) 88.0 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 88.0 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 88.0 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 88.0 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 88.0 0.1 Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 88.0 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.4 (0 %) 0.0 (0 %) 88.0 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 88.0 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 88.1 0.1 Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveAbi 0.1
gpu 68.5 (78 %) 0.0 (0 %) 19.8 0.0 batch 68.5

Largest slices (ms per frame, inclusive, all threads): batch 68.5, Graphics.Draw 32.5, Graphics.Draw.draw_and_resource_release 28.0, VideoOut.Flip 24.8, Driver.Present 24.7, VideoOut.Flip.present 24.7, Driver.Present.render_fence_wait 24.0, Vulkan.Retire 24.0, Vulkan.Retire.wait 24.0, Driver.Packet 19.3

Longest waits

  • Driver.Present.render_fence_wait (presenter) 28.8 ms at 14313 ms, present 3237
  • Driver.Present.render_fence_wait (presenter) 27.9 ms at 4884 ms, present 3130
  • Driver.Present.render_fence_wait (presenter) 27.8 ms at 10543 ms, present 3194
  • Driver.Present.render_fence_wait (presenter) 27.6 ms at 8233 ms, present 3168
  • Driver.Present.render_fence_wait (presenter) 27.6 ms at 8497 ms, present 3171
  • Driver.Present.render_fence_wait (presenter) 27.5 ms at 14399 ms, present 3238
  • Driver.Present.render_fence_wait (presenter) 27.4 ms at 4440 ms, present 3125
  • Driver.Present.render_fence_wait (presenter) 27.3 ms at 7431 ms, present 3159
  • Driver.Present.render_fence_wait (presenter) 27.2 ms at 13003 ms, present 3222
  • Driver.Present.render_fence_wait (presenter) 27.1 ms at 11252 ms, present 3202

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

  • batch 12254: 12.5 ms at 14483 ms, present 3238: GPU no ranges; recorded by no CPU slices
  • batch 8207: 12.4 ms at 9720 ms, present 3184: GPU no ranges; recorded by no CPU slices
  • batch 10519: 11.2 ms at 12466 ms, present 3215: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.8, Graphics.Draw.draw_and_resource_release (draw committer) 3.6, Resources.Prepare (draw committer) 0.5, Recorder.Submit (draw committer) 0.2
  • batch 4533: 10.9 ms at 5398 ms, present 3135: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.3, Graphics.Draw.draw_and_resource_release (draw committer) 3.1, Resources.Prepare (draw committer) 0.4, Recorder.Submit (draw committer) 0.1
  • batch 10219: 10.9 ms at 12122 ms, present 3211: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.7, Graphics.Draw.draw_and_resource_release (draw committer) 3.4, Resources.Prepare (draw committer) 0.3, Recorder.Submit (draw committer) 0.2
This change 25f8843b1, run 2 (summary commit 25f8843b15fe)

seconds 200:15 from present 3035: 171 presents, frame p50 85.2 / p90 98.0 / p99 116.4 / max 116.6 ms, GPU busy 70.6 ms per present
NVIDIA GeForce RTX 2080 Ti, NVIDIA 617.14, Windows 10.0.26300, 3840x2160, commit 25f8843b15fe, dropped: yes

{"commit":"25f8843b15fe","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"200:15"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 617.14","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz","cpu_threads":16,"memory_mib":32684,"title_id":"PPSA05324","title":"Sonic Origins","content_version":"02.002.000","resolution":"3840x2160","window":{"spec":"seconds 200:15","first_present":3035,"ms":15056.684},"presents":171,"frame_ms":{"p50":85.159,"p90":98.001,"p99":116.412,"max":116.584},"gpu_busy_ms_per_present":70.598,"worker_busy_pct":{"queue worker 0x0":96.969},"top_phases_ms_per_frame":{"Driver.Packet":85.357,"Driver.Packet.draw":62.166,"Driver.Draw":60.792,"Graphics.Draw":57.97,"Graphics.Draw.draw_and_resource_release":48.128,"Driver.Draw.shader_compile_and_link":39.635,"Shader.DrawStage":30.398,"Driver.Present":26.857},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":6.419,"events_lost":354558,"totals_full":false},"draw committer":{"events_full_after_s":14.387,"events_lost":11435,"totals_full":false}},"trace":"aps5-trace-25f8843b15fe-45124.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 3199: 116.6 ms at 14403 ms: batch (gpu) 71.9, VideoOut.Flip (presenter) 28.7, VideoOut.Flip.present (presenter) 28.6, Driver.Present (presenter) 28.6
  • present 3197: 116.4 ms at 14200 ms: batch (gpu) 74.2, Graphics.Draw (draw committer) 62.3, Graphics.Draw.draw_and_resource_release (draw committer) 57.8, VideoOut.Flip (presenter) 29.1
  • present 3200: 115.3 ms at 14520 ms: batch (gpu) 72.9, VideoOut.Flip (presenter) 32.8, VideoOut.Flip.present (presenter) 32.6, Driver.Present (presenter) 32.6
  • present 3124: 114.1 ms at 7855 ms: batch (gpu) 70.5, Graphics.Draw (draw committer) 45.5, Graphics.Draw.draw_and_resource_release (draw committer) 36.6, VideoOut.Flip (presenter) 19.1
  • present 3058: 113.0 ms at 1980 ms: batch (gpu) 72.1, Driver.Packet (queue worker 0x0) 71.3, Graphics.Draw (draw committer) 60.3, Driver.Packet.draw (queue worker 0x0) 56.0

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 1.0 (1 %) 0.0 (0 %) 87.0 0.7 Shader.ResolveGraphicsStagesAbi 0.7, Shader.ResolveAbi 0.3
queue worker 0x0 20.2 (23 %) 0.0 (0 %) 67.9 86.5 Driver.Packet 20.2, Driver.EndSubmission 0.0
draw committer 34.5 (39 %) 0.5 (1 %) 53.1 49.2 Graphics.Draw 32.7, Recorder.Submit 1.1
title 0.3 (0 %) 0.0 (0 %) 87.8 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 87.8 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 87.7 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
presenter 0.8 (1 %) 26.2 (30 %) 61.0 0.0 VideoOut.Flip 26.9, Driver.Present 0.2
title 0.2 (0 %) 0.0 (0 %) 87.8 0.1 Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 87.8 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 87.8 0.1 Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 87.7 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 87.7 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 87.7 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 87.7 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.4 (0 %) 0.0 (0 %) 87.7 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1
title 0.4 (0 %) 0.0 (0 %) 87.7 0.1 Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.2
gpu 70.5 (80 %) 0.0 (0 %) 17.5 0.0 batch 70.5

Largest slices (ms per frame, inclusive, all threads): batch 70.5, Graphics.Draw 32.7, Graphics.Draw.draw_and_resource_release 28.2, Driver.Present 26.9, VideoOut.Flip 26.9, VideoOut.Flip.present 26.7, Driver.Present.render_fence_wait 26.1, Vulkan.Retire 26.1, Vulkan.Retire.wait 26.1, Driver.Packet 20.2

Longest waits

  • Driver.Present.render_fence_wait (presenter) 32.1 ms at 12300 ms, present 3175
  • Driver.Present.render_fence_wait (presenter) 32.0 ms at 14521 ms, present 3200
  • Driver.Present.render_fence_wait (presenter) 31.5 ms at 9105 ms, present 3138
  • Driver.Present.render_fence_wait (presenter) 31.2 ms at 12737 ms, present 3180
  • Driver.Present.render_fence_wait (presenter) 31.1 ms at 3706 ms, present 3077
  • Driver.Present.render_fence_wait (presenter) 31.0 ms at 6428 ms, present 3108
  • Driver.Present.render_fence_wait (presenter) 30.7 ms at 13515 ms, present 3189
  • Driver.Present.render_fence_wait (presenter) 30.3 ms at 13005 ms, present 3183
  • Driver.Present.render_fence_wait (presenter) 30.0 ms at 13431 ms, present 3188
  • Driver.Present.render_fence_wait (presenter) 29.7 ms at 9371 ms, present 3141

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

  • batch 10373: 12.9 ms at 12193 ms, present 3173: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.4, Graphics.Draw.draw_and_resource_release (draw committer) 1.3, Recorder.Submit (draw committer) 0.0, Vulkan.DrawFromRecipe (draw committer) 0.0
  • batch 8658: 12.4 ms at 10190 ms, present 3150: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.3, Graphics.Draw.draw_and_resource_release (draw committer) 1.2, Recorder.Submit (draw committer) 0.1
  • batch 10448: 12.0 ms at 12284 ms, present 3174: GPU no ranges; recorded by Graphics.Draw (draw committer) 4.4, Graphics.Draw.draw_and_resource_release (draw committer) 4.0, Resources.Prepare (draw committer) 0.5, Recorder.Submit (draw committer) 0.2
  • batch 6188: 11.9 ms at 7311 ms, present 3117: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.9, Graphics.Draw.draw_and_resource_release (draw committer) 3.6, Resources.Prepare (draw committer) 0.5, Recorder.Submit (draw committer) 0.2
  • batch 3724: 11.6 ms at 4410 ms, present 3084: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.4, Graphics.Draw.draw_and_resource_release (draw committer) 3.2, Resources.Prepare (draw committer) 0.4, Recorder.Submit (draw committer) 0.2
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4895199133 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6970). Originally posted by [meh7an](https://github.com/meh7an) on 2026-10-16T22:55:31Z. --- ### What `DescriptorBindingBuilder::Populate` turns a stage's binding plan into the bindings of a materialized result, for every draw stage the memos miss and for every dispatch. It copies each planned `DescriptorBinding` (`auto physical = entry.descriptor`). A binding keeps 12 per-element flag lists as `std::vector<bool>`: `samplerDepthCompare`, `imageWritten`, `imageDepthCompare`, `imageAtomic`, `imageAtomic64`, `bufferAtomic`, `bufferWritten`, `samplerUnnormalized`, `samplerIntegerBorder`, `imageUnnormalized`, `imageUnnormalizedBaseLevel` and `bufferRead`. Every copy allocates one block per non-empty list, and releasing the result frees them again. `ElementFlags` (in `Recompiler.hpp`) replaces `std::vector<bool>` for those lists: - Up to 64 flags live in one inline word; a longer list moves to a `std::vector<bool>`. A binding rarely has more than 64 elements, so a copy allocates nothing. - It reads and writes as `std::vector<bool>` does: `size`, `empty`, `[]` (a reference proxy when written), `at`, `back`, iteration, `push_back`, `assign`, `resize`, `clear`, and `==` with another list or a `std::vector<bool>`. The code that fills and reads the lists stays as it is. - Two test lambdas take `ElementFlags` instead of `std::vector<bool>`. - The image table reuse keeps its copy of the depth compare flags as `ElementFlags`. - The shader disk cache writes and reads it as before (a count, then one byte per flag), so the entry format is unchanged. The recompiler's sources change, so the shader cache version changes with them. - `verifyElementFlags` (shader disk cache tests) checks 70 flags, past the inline word. It covers reads, iteration, copies, writes through `[]` and `back()`, `resize` both ways, `assign`, `clear`, and a round trip through the disk cache. On the S2 page of Sonic Origins Plus's main menu, the queue worker spent, per frame (APS5 sampler, 15 s): - `Populate`: 1.28 to 0.91. In a profile of the baseline, 78 of its 151 direct `operator new` samples were inlined `std::vector<bool>` copies (8 call sites), and 14 more were in `std::vector<bool>`'s copy constructor. - releasing the results (`RecompileResult`'s disposal): 0.76 to 0.57; - `operator new` 3.38 to 2.88, `mi_free` 0.68 to 0.59; - the whole worker: 32.80 to 31.04 samples. That is a few percent of the worker's frame at most. On current main, three paired runs below put the frame median about 2% lower. ### Tested Windows 11 (10.0.26300), WinLibs GCC 15.2.0 (UCRT), Release, NVIDIA GeForce RTX 2080 Ti, driver 617.14. - `ShaderDiskCache.cpp`'s size asserts compile only on Linux (x86_64, libstdc++), so the Windows build above skips them. - `ElementFlags` is 56 bytes against `std::vector<bool>`'s 40. Main's `DescriptorBinding` now has 13 such lists, with `samplerCoordinatesIgnored`, so it grows from 656 to 864 bytes (+32%), and its assert says 864. - Under MinGW's libstdc++, whose layout matches (main reads 656 there, as main's assert says), `sizeof(DescriptorBinding)` is 864 with this change. - The first version, on main 7d728b109, grew it from 592 to 784 bytes (thanks @teepean). - Rebased onto main 53a0a27bb (a9a338c37). - The size asserts keep main's `ShaderInvocation` (216) and `RecompileResult` (528). `DescriptorBinding` is 864. All four sizes were checked under MinGW's libstdc++ with a `Size<sizeof(...)>` probe: 216, 528, 864 and `CompiledShaderArtifact` 280. - On that main, with this change, the full ctest suite passes 1836 of 1837. `agc_driver_image_array_window_past_layer_limit` is not run: MinGW does not build its `alignas(65536)`. - Rebased onto main 1d4164552. - Main's new `samplerCoordinatesIgnored` is an `ElementFlags` as well; main's `bufferExtent` stays a `std::vector<std::uint32_t>`. - On that main, with this change, the full ctest suite passes 1739 of 1741. - `agc_driver_image_array_window_past_layer_limit` is not run: main does not compile `ImageArrayWindowPastLayerLimit.cpp` with MinGW (`alignas(65536)`). - `agc_driver_pass_input_hazard` (added in ba4571a25) fails on plain main 1d4164552 as well, 0 of 4 runs alone. - Sonic Origins Plus, S2 page, re-measured on main 1d4164552 in one session: three runs per side, interleaved, each a `APS5_TRACE_SECONDS=200:15` capture with warm caches and the title FPS (median of six readings). | Run | Main frame p50 (ms) | This PR frame p50 (ms) | Main Driver.Draw (ms per frame) | This PR Driver.Draw (ms per frame) | Main title FPS | This PR title FPS | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | 1 | 91.13 | 84.66 | 71.05 | 59.15 | 12.41 | 12.40 | | 2 | 86.83 | 85.16 | 61.84 | 60.79 | 11.91 | 12.05 | | 3 | 86.25 | 85.88 | 62.63 | 61.03 | 12.22 | 12.22 | - Every run with this change has a lower frame p50 than every main run. The medians are 86.83 and 85.16 ms (-1.9%), and `Driver.Draw` 62.63 and 60.79 ms (-2.9%). - The title FPS medians are equal (12.22), so the gain is small, below what the title counter resolves. - The digests at the end are the median pair, run 2 of each side. Before this rebase: - On main 7d728b109 with this change, the full ctest suite passes 1338 of 1341 tests. - `agc_driver_gpu_indirect_arguments_misaligned_writer_ahead` is not run: main itself does not compile it with MinGW (`alignas(65536)`). - `select_tests` fails in its setup on Windows without the symlink privilege (`WinError 1314` from `symlink_to`), as on main. - `build_eligibility` timed out once in the parallel run; alone it passes in 1.5 s. - Sonic Origins Plus, main menu, S2 page (the 3D background), 1233x694 window. - A sampled pair (APS5 sampler, 15 s) took the profile numbers above. The FPS shown in the title went from 10.81 to 10.56 (median of six readings). - Captured with `APS5_TRACE_SECONDS=200:15` on the same machine in one session, caches warm. Traces attached. - Baseline b1909f43b, this change 245e35555 (the summaries name the commits before them, see the note): | Metric | Baseline | This PR | Change | | --- | ---: | ---: | ---: | | frame_ms.p50 | 100.348 | 100.704 | +0.4% | | frame_ms.p90 | 105.573 | 106.216 | +0.6% | | mean_frame_ms | 102.355 | 103.202 | +0.8% | | gpu_busy_ms_per_present | 84.431 | 83.660 | -0.9% | | Driver.Packet (ms per frame) | 100.360 | 101.155 | +0.8% | | Driver.Draw (ms per frame) | 88.210 | 89.173 | +1.1% | The title FPS during the two captures was 10.78 and 10.82 (median of six readings each). > **Note: measuring base.** These numbers come from my fork's dev, on main 0a56aaaf4. The bindings and their copy in `Populate` are the same on main 7d728b109. > - The baseline is [measure/inline-2026-10-17](https://github.com/meh7an/AnyPS5/commits/measure/inline-2026-10-17) (b1909f43b). > - This change is [measure/flags-2026-10-17](https://github.com/meh7an/AnyPS5/commits/measure/flags-2026-10-17) (245e35555). There it converts the same 12 lists. This PR adds the reference proxy, `back`, `resize` and the image table's flags, which main's newer code and tests use. > - Each build was made before its commit, so the summaries name the commit before it, `dirty`: 11882cc99 for the baseline and b1909f43b for this change. > > Both carry these commits from my fork: > - the fixes a71073ce3, c0d875634, e3c68960e, 604f0f373 and 10ff693aa (#5778); > - make-exe and the stage dumps (522230d62, deee71fde); > - the crash-report sampler (8d9c3103e..f641e1ec9), which took the profiles; > - #6037, #6066, #6077, #6067, #6082 (its first version, before #5906), #6095, #6266, #6292, #6312, #6609, #6611, #6615 and #6733; > - smaller steps kept in my fork: > - e83260247, 97b1ff6c9, 84f5bf0ff, ce567bc3d, a79e58a7c, a0a891697, 63f7a8ed0, b04806167, 719fb71dd and a21a3ce81; > - 3b47f7743 (covered on main by #5062); > - e3b8d1c52 (which #6566 covers); > - 390f62471 (a draw decode cache; main reuses decodes through its draw data hits); > - 40a918442 (the pipeline key outside the store's lock, as #5875 does on main, and the thread's last pipeline); > - b1909f43b (the vertex phase's lists inline, held until #6661 lands). > > The comparison tool marks the window's first present as a configuration difference: the window opens 200 s into each run. Both summaries set `trace_dropped`, because the worker filled its event buffer at about 2,700 draws per frame. > > The summaries list only their top phases. `Driver.Draw.shader_compile_and_link` (33.1 ms per frame in the baseline) and the present's `render_fence_wait` (32.2 in this change) sit at the list's cutoff, so each capture lists only one of them. ### 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`); silent stubs are listed under Silent stubs in their library's technical 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 - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 2080 Ti, driver 617.14, Windows 11 - [x] AI-assisted: yes Traces and summary lines (baseline b1909f43b, whose summary says 11882cc993f0; this change 245e35555, whose summary says b1909f43b4d1): [flags-traces.zip](https://github.com/user-attachments/files/33582236/flags-traces.zip) Traces of the six re-measured runs on main 1d4164552, one zip per round with that round's main and this-change capture: [flags-rebased-round1.zip](https://github.com/user-attachments/files/33726584/flags-rebased-round1.zip), [flags-rebased-round2.zip](https://github.com/user-attachments/files/33726597/flags-rebased-round2.zip), [flags-rebased-round3.zip](https://github.com/user-attachments/files/33726606/flags-rebased-round3.zip). The re-measured median pair on main 1d4164552, with `tools/trace_digest.py` for each trace: <details><summary>Main 1d4164552, run 2 (summary commit 1d41645527f5)</summary> **seconds 200:15** from present 3075: 170 presents, frame p50 86.8 / p90 92.1 / p99 115.2 / max 117.7 ms, GPU busy 69.1 ms per present NVIDIA GeForce RTX 2080 Ti, NVIDIA 617.14, Windows 10.0.26300, 3840x2160, commit 1d41645527f5, dropped: yes ```json {"commit":"1d41645527f5","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"200:15"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 617.14","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz","cpu_threads":16,"memory_mib":32684,"title_id":"PPSA05324","title":"Sonic Origins","content_version":"02.002.000","resolution":"3840x2160","window":{"spec":"seconds 200:15","first_present":3075,"ms":15013.344},"presents":170,"frame_ms":{"p50":86.832,"p90":92.073,"p99":115.234,"max":117.659},"gpu_busy_ms_per_present":69.058,"worker_busy_pct":{"queue worker 0x0":96.848},"top_phases_ms_per_frame":{"Driver.Packet":85.501,"Driver.Packet.draw":63.243,"Driver.Draw":61.837,"Graphics.Draw":58.045,"Graphics.Draw.draw_and_resource_release":48.446,"Driver.Draw.shader_compile_and_link":41.847,"Shader.DrawStage":32.497,"VideoOut.Flip":24.784},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":6.117,"events_lost":385724,"totals_full":false},"draw committer":{"events_full_after_s":14.471,"events_lost":10071,"totals_full":false}},"trace":"aps5-trace-1d41645527f5-40372.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 3175: 117.7 ms at 8834 ms: batch (gpu) 67.8, Graphics.Draw (draw committer) 61.7, Graphics.Draw.draw_and_resource_release (draw committer) 56.1, VideoOut.Flip (presenter) 24.6 - present 3113: 115.2 ms at 3355 ms: Driver.Packet (queue worker 0x0) 77.6, batch (gpu) 70.1, Driver.Packet.draw (queue worker 0x0) 63.2, Driver.Draw (queue worker 0x0) 62.1 - present 3185: 112.0 ms at 9725 ms: batch (gpu) 69.6, Graphics.Draw (draw committer) 58.1, Graphics.Draw.draw_and_resource_release (draw committer) 53.7, VideoOut.Flip (presenter) 25.0 - present 3209: 112.0 ms at 11854 ms: batch (gpu) 68.2, Graphics.Draw (draw committer) 57.8, Graphics.Draw.draw_and_resource_release (draw committer) 52.3, VideoOut.Flip (presenter) 24.1 - present 3085: 110.8 ms at 859 ms: Driver.Packet (queue worker 0x0) 74.1, batch (gpu) 65.2, Driver.Packet.draw (queue worker 0x0) 59.7, Driver.Draw (queue worker 0x0) 58.4 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 1.0 (1 %) | 0.0 (0 %) | 87.3 | 0.7 | Shader.ResolveGraphicsStagesAbi 0.7, Shader.ResolveAbi 0.3 | | queue worker 0x0 | 19.2 (22 %) | 0.0 (0 %) | 69.0 | 82.9 | Driver.Packet 19.3, Driver.EndSubmission 0.0 | | draw committer | 34.2 (39 %) | 0.5 (1 %) | 53.6 | 50.9 | Graphics.Draw 32.5, Recorder.Submit 1.0 | | title | 0.4 (0 %) | 0.0 (0 %) | 88.0 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.2 (0 %) | 0.0 (0 %) | 88.1 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveAbi 0.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 88.0 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | presenter | 0.7 (1 %) | 24.1 (27 %) | 63.5 | 0.0 | VideoOut.Flip 24.8, Driver.Present 0.0 | | title | 0.3 (0 %) | 0.0 (0 %) | 88.0 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 88.0 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 88.0 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 88.0 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 88.0 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveAbi 0.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 88.0 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.4 (0 %) | 0.0 (0 %) | 88.0 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 88.0 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 88.1 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveAbi 0.1 | | gpu | 68.5 (78 %) | 0.0 (0 %) | 19.8 | 0.0 | batch 68.5 | **Largest slices** (ms per frame, inclusive, all threads): batch 68.5, Graphics.Draw 32.5, Graphics.Draw.draw_and_resource_release 28.0, VideoOut.Flip 24.8, Driver.Present 24.7, VideoOut.Flip.present 24.7, Driver.Present.render_fence_wait 24.0, Vulkan.Retire 24.0, Vulkan.Retire.wait 24.0, Driver.Packet 19.3 **Longest waits** - Driver.Present.render_fence_wait (presenter) 28.8 ms at 14313 ms, present 3237 - Driver.Present.render_fence_wait (presenter) 27.9 ms at 4884 ms, present 3130 - Driver.Present.render_fence_wait (presenter) 27.8 ms at 10543 ms, present 3194 - Driver.Present.render_fence_wait (presenter) 27.6 ms at 8233 ms, present 3168 - Driver.Present.render_fence_wait (presenter) 27.6 ms at 8497 ms, present 3171 - Driver.Present.render_fence_wait (presenter) 27.5 ms at 14399 ms, present 3238 - Driver.Present.render_fence_wait (presenter) 27.4 ms at 4440 ms, present 3125 - Driver.Present.render_fence_wait (presenter) 27.3 ms at 7431 ms, present 3159 - Driver.Present.render_fence_wait (presenter) 27.2 ms at 13003 ms, present 3222 - Driver.Present.render_fence_wait (presenter) 27.1 ms at 11252 ms, present 3202 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 12254: 12.5 ms at 14483 ms, present 3238: GPU no ranges; recorded by no CPU slices - batch 8207: 12.4 ms at 9720 ms, present 3184: GPU no ranges; recorded by no CPU slices - batch 10519: 11.2 ms at 12466 ms, present 3215: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.8, Graphics.Draw.draw_and_resource_release (draw committer) 3.6, Resources.Prepare (draw committer) 0.5, Recorder.Submit (draw committer) 0.2 - batch 4533: 10.9 ms at 5398 ms, present 3135: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.3, Graphics.Draw.draw_and_resource_release (draw committer) 3.1, Resources.Prepare (draw committer) 0.4, Recorder.Submit (draw committer) 0.1 - batch 10219: 10.9 ms at 12122 ms, present 3211: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.7, Graphics.Draw.draw_and_resource_release (draw committer) 3.4, Resources.Prepare (draw committer) 0.3, Recorder.Submit (draw committer) 0.2 </details> <details><summary>This change 25f8843b1, run 2 (summary commit 25f8843b15fe)</summary> **seconds 200:15** from present 3035: 171 presents, frame p50 85.2 / p90 98.0 / p99 116.4 / max 116.6 ms, GPU busy 70.6 ms per present NVIDIA GeForce RTX 2080 Ti, NVIDIA 617.14, Windows 10.0.26300, 3840x2160, commit 25f8843b15fe, dropped: yes ```json {"commit":"25f8843b15fe","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"200:15"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 617.14","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz","cpu_threads":16,"memory_mib":32684,"title_id":"PPSA05324","title":"Sonic Origins","content_version":"02.002.000","resolution":"3840x2160","window":{"spec":"seconds 200:15","first_present":3035,"ms":15056.684},"presents":171,"frame_ms":{"p50":85.159,"p90":98.001,"p99":116.412,"max":116.584},"gpu_busy_ms_per_present":70.598,"worker_busy_pct":{"queue worker 0x0":96.969},"top_phases_ms_per_frame":{"Driver.Packet":85.357,"Driver.Packet.draw":62.166,"Driver.Draw":60.792,"Graphics.Draw":57.97,"Graphics.Draw.draw_and_resource_release":48.128,"Driver.Draw.shader_compile_and_link":39.635,"Shader.DrawStage":30.398,"Driver.Present":26.857},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":6.419,"events_lost":354558,"totals_full":false},"draw committer":{"events_full_after_s":14.387,"events_lost":11435,"totals_full":false}},"trace":"aps5-trace-25f8843b15fe-45124.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 3199: 116.6 ms at 14403 ms: batch (gpu) 71.9, VideoOut.Flip (presenter) 28.7, VideoOut.Flip.present (presenter) 28.6, Driver.Present (presenter) 28.6 - present 3197: 116.4 ms at 14200 ms: batch (gpu) 74.2, Graphics.Draw (draw committer) 62.3, Graphics.Draw.draw_and_resource_release (draw committer) 57.8, VideoOut.Flip (presenter) 29.1 - present 3200: 115.3 ms at 14520 ms: batch (gpu) 72.9, VideoOut.Flip (presenter) 32.8, VideoOut.Flip.present (presenter) 32.6, Driver.Present (presenter) 32.6 - present 3124: 114.1 ms at 7855 ms: batch (gpu) 70.5, Graphics.Draw (draw committer) 45.5, Graphics.Draw.draw_and_resource_release (draw committer) 36.6, VideoOut.Flip (presenter) 19.1 - present 3058: 113.0 ms at 1980 ms: batch (gpu) 72.1, Driver.Packet (queue worker 0x0) 71.3, Graphics.Draw (draw committer) 60.3, Driver.Packet.draw (queue worker 0x0) 56.0 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 1.0 (1 %) | 0.0 (0 %) | 87.0 | 0.7 | Shader.ResolveGraphicsStagesAbi 0.7, Shader.ResolveAbi 0.3 | | queue worker 0x0 | 20.2 (23 %) | 0.0 (0 %) | 67.9 | 86.5 | Driver.Packet 20.2, Driver.EndSubmission 0.0 | | draw committer | 34.5 (39 %) | 0.5 (1 %) | 53.1 | 49.2 | Graphics.Draw 32.7, Recorder.Submit 1.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 87.8 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 87.8 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 87.7 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | presenter | 0.8 (1 %) | 26.2 (30 %) | 61.0 | 0.0 | VideoOut.Flip 26.9, Driver.Present 0.2 | | title | 0.2 (0 %) | 0.0 (0 %) | 87.8 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveAbi 0.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 87.8 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.2 (0 %) | 0.0 (0 %) | 87.8 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveAbi 0.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 87.7 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 87.7 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 87.7 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.3 (0 %) | 0.0 (0 %) | 87.7 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.4 (0 %) | 0.0 (0 %) | 87.7 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.1 | | title | 0.4 (0 %) | 0.0 (0 %) | 87.7 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.2, Shader.ResolveAbi 0.2 | | gpu | 70.5 (80 %) | 0.0 (0 %) | 17.5 | 0.0 | batch 70.5 | **Largest slices** (ms per frame, inclusive, all threads): batch 70.5, Graphics.Draw 32.7, Graphics.Draw.draw_and_resource_release 28.2, Driver.Present 26.9, VideoOut.Flip 26.9, VideoOut.Flip.present 26.7, Driver.Present.render_fence_wait 26.1, Vulkan.Retire 26.1, Vulkan.Retire.wait 26.1, Driver.Packet 20.2 **Longest waits** - Driver.Present.render_fence_wait (presenter) 32.1 ms at 12300 ms, present 3175 - Driver.Present.render_fence_wait (presenter) 32.0 ms at 14521 ms, present 3200 - Driver.Present.render_fence_wait (presenter) 31.5 ms at 9105 ms, present 3138 - Driver.Present.render_fence_wait (presenter) 31.2 ms at 12737 ms, present 3180 - Driver.Present.render_fence_wait (presenter) 31.1 ms at 3706 ms, present 3077 - Driver.Present.render_fence_wait (presenter) 31.0 ms at 6428 ms, present 3108 - Driver.Present.render_fence_wait (presenter) 30.7 ms at 13515 ms, present 3189 - Driver.Present.render_fence_wait (presenter) 30.3 ms at 13005 ms, present 3183 - Driver.Present.render_fence_wait (presenter) 30.0 ms at 13431 ms, present 3188 - Driver.Present.render_fence_wait (presenter) 29.7 ms at 9371 ms, present 3141 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 10373: 12.9 ms at 12193 ms, present 3173: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.4, Graphics.Draw.draw_and_resource_release (draw committer) 1.3, Recorder.Submit (draw committer) 0.0, Vulkan.DrawFromRecipe (draw committer) 0.0 - batch 8658: 12.4 ms at 10190 ms, present 3150: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.3, Graphics.Draw.draw_and_resource_release (draw committer) 1.2, Recorder.Submit (draw committer) 0.1 - batch 10448: 12.0 ms at 12284 ms, present 3174: GPU no ranges; recorded by Graphics.Draw (draw committer) 4.4, Graphics.Draw.draw_and_resource_release (draw committer) 4.0, Resources.Prepare (draw committer) 0.5, Recorder.Submit (draw committer) 0.2 - batch 6188: 11.9 ms at 7311 ms, present 3117: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.9, Graphics.Draw.draw_and_resource_release (draw committer) 3.6, Resources.Prepare (draw committer) 0.5, Recorder.Submit (draw committer) 0.2 - batch 3724: 11.6 ms at 4410 ms, present 3084: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.4, Graphics.Draw.draw_and_resource_release (draw committer) 3.2, Resources.Prepare (draw committer) 0.4, Recorder.Submit (draw committer) 0.2 </details>
teepean commented 2026-10-17 07:21:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by teepean on 2026-10-17T07:21:15Z.


On Linux (GCC 16.2.1, Release) the head doesn't compile. Merged onto main 6a32550fd, ShaderDiskCache.cpp stops at:

core/shader/recompiler/ShaderDiskCache.cpp:90:41: error: static assertion failed: DescriptorBinding changed: update the binding encoder
   90 | static_assert(sizeof(DescriptorBinding) == 592, "DescriptorBinding changed: update the binding encoder");
  • the comparison reduces to '(784 == 592)'

ElementFlags holds a std::uint64_t, a std::size_t and a std::vector<bool>: 56 bytes against the 40 of the std::vector<bool> it replaces. Twelve lists in DescriptorBinding make that 12 × 16 = 192 bytes more, 784 in all. The PR's Linux job was skipped, so CI didn't catch it. The encoder writes the lists element by element, as the description says, so only the size in the assertion needs updating. With it set to 784 locally, the build runs Stray (PPSA02100), in a batch together with five other open perf PRs, without visible problems.

AI-assisted: yes (analysis and text written with Claude Code; the build is from my machine).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6231148933 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6970#issuecomment-6231148933). Originally posted by [teepean](https://github.com/teepean) on 2026-10-17T07:21:15Z. --- On Linux (GCC 16.2.1, Release) the head doesn't compile. Merged onto `main` 6a32550fd, `ShaderDiskCache.cpp` stops at: ``` core/shader/recompiler/ShaderDiskCache.cpp:90:41: error: static assertion failed: DescriptorBinding changed: update the binding encoder 90 | static_assert(sizeof(DescriptorBinding) == 592, "DescriptorBinding changed: update the binding encoder"); • the comparison reduces to '(784 == 592)' ``` `ElementFlags` holds a `std::uint64_t`, a `std::size_t` and a `std::vector<bool>`: 56 bytes against the 40 of the `std::vector<bool>` it replaces. Twelve lists in `DescriptorBinding` make that 12 × 16 = 192 bytes more, 784 in all. The PR's Linux job was skipped, so CI didn't catch it. The encoder writes the lists element by element, as the description says, so only the size in the assertion needs updating. With it set to 784 locally, the build runs Stray (PPSA02100), in a batch together with five other open perf PRs, without visible problems. AI-assisted: yes (analysis and text written with Claude Code; the build is from my machine).
meh7an commented 2026-10-17 09:03:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by meh7an on 2026-10-17T09:03:54Z.


Thanks for catching it. Fixed in 15bc2186b: the assert now says 784 (12 lists x 16 bytes more, as you worked out). I also compiled that Linux-only block under MinGW's libstdc++, whose layouts match: all 31 asserts hold with the change, and the old 592 fails exactly as you reported.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6232075080 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6970#issuecomment-6232075080). Originally posted by [meh7an](https://github.com/meh7an) on 2026-10-17T09:03:54Z. --- Thanks for catching it. Fixed in 15bc2186b: the assert now says 784 (12 lists x 16 bytes more, as you worked out). I also compiled that Linux-only block under MinGW's libstdc++, whose layouts match: all 31 asserts hold with the change, and the old 592 fails exactly as you reported.
keravyn-ops commented 2026-10-17 10:16:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by keravyn-ops on 2026-10-17T10:16:30Z.


AMD / Windows run of this PR at 15bc2186b: Radeon 780M (RDNA 3, 0x15bf), AMD driver 25.10.20.01 (32.0.21020.1007), Windows 11 Home 10.0.26100, WinLibs GCC 15.2.0 r7, Release.

Every ctest entry built from the test targets this PR changes passes (57):

agc_pipeline_cache, agc_pipeline_cache_file, agc_pipeline_library, agc_pipeline_library_off, agc_pipeline_library_fast_only, agc_import_watch, agc_import_watch_other_family, agc_unchanged_cpu_stamps, agc_storage_kept_unit_settle, agc_storage_baseline_settled, agc_storage_integer_clear, agc_storage_upload_lifetime, agc_storage_upload_failure, agc_storage_written_buffer_order, agc_storage_split_writeback, agc_copied_direct_ordering, agc_recorder_read_list, agc_space_pending_writes, agc_host_import_unmap, agc_parked_import_unmap, agc_host_import_retirement, agc_sparse_run_import, agc_sparse_run_import_copied, agc_unit_shadow, agc_storage_cpu_snapshot, agc_descriptor_pool_recycling, agc_draw_snapshot_cap, agc_draw_snapshot_epoch, agc_multisample_guest_access, agc_draw_inputs_in_place, agc_pending_write_snapshot, agc_resident_present, agc_queued_write_groups, agc_tiled_resolve, agc_slice_dirty, agc_metadata_pass, agc_host_import_second_mapping, agc_pending_key_stores, agc_shadowed_key_stores, agc_sample_dumps, agc_driver_vertex_target_range_copied, agc_driver_vertex_target_range_imported, agc_driver_undithered_alpha_to_coverage_state, agc_driver_alpha_to_coverage_state, agc_driver_prepared_graphics_prebuild_unset, agc_driver_prepared_graphics_prebuild_0, agc_driver_prepared_graphics_prebuild_1, agc_shader_disk_cache, agc_driver_graphics, agc_driver_prepared_graphics, agc_driver_prepared_unregistered_graphics, agc_sparse_buffer_holes, agc_pipeline_journal, agc_descriptor_pool_reset_failure, agc_driver_address_space_teardown, agc_compute_descriptor_layout_flags, agc_driver_covered_centroid_state

AI-assisted: yes (runs made on the device above).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6232716667 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6970#issuecomment-6232716667). Originally posted by [keravyn-ops](https://github.com/keravyn-ops) on 2026-10-17T10:16:30Z. --- AMD / Windows run of this PR at 15bc2186b: Radeon 780M (RDNA 3, 0x15bf), AMD driver 25.10.20.01 (32.0.21020.1007), Windows 11 Home 10.0.26100, WinLibs GCC 15.2.0 r7, Release. Every ctest entry built from the test targets this PR changes passes (57): `agc_pipeline_cache`, `agc_pipeline_cache_file`, `agc_pipeline_library`, `agc_pipeline_library_off`, `agc_pipeline_library_fast_only`, `agc_import_watch`, `agc_import_watch_other_family`, `agc_unchanged_cpu_stamps`, `agc_storage_kept_unit_settle`, `agc_storage_baseline_settled`, `agc_storage_integer_clear`, `agc_storage_upload_lifetime`, `agc_storage_upload_failure`, `agc_storage_written_buffer_order`, `agc_storage_split_writeback`, `agc_copied_direct_ordering`, `agc_recorder_read_list`, `agc_space_pending_writes`, `agc_host_import_unmap`, `agc_parked_import_unmap`, `agc_host_import_retirement`, `agc_sparse_run_import`, `agc_sparse_run_import_copied`, `agc_unit_shadow`, `agc_storage_cpu_snapshot`, `agc_descriptor_pool_recycling`, `agc_draw_snapshot_cap`, `agc_draw_snapshot_epoch`, `agc_multisample_guest_access`, `agc_draw_inputs_in_place`, `agc_pending_write_snapshot`, `agc_resident_present`, `agc_queued_write_groups`, `agc_tiled_resolve`, `agc_slice_dirty`, `agc_metadata_pass`, `agc_host_import_second_mapping`, `agc_pending_key_stores`, `agc_shadowed_key_stores`, `agc_sample_dumps`, `agc_driver_vertex_target_range_copied`, `agc_driver_vertex_target_range_imported`, `agc_driver_undithered_alpha_to_coverage_state`, `agc_driver_alpha_to_coverage_state`, `agc_driver_prepared_graphics_prebuild_unset`, `agc_driver_prepared_graphics_prebuild_0`, `agc_driver_prepared_graphics_prebuild_1`, `agc_shader_disk_cache`, `agc_driver_graphics`, `agc_driver_prepared_graphics`, `agc_driver_prepared_unregistered_graphics`, `agc_sparse_buffer_holes`, `agc_pipeline_journal`, `agc_descriptor_pool_reset_failure`, `agc_driver_address_space_teardown`, `agc_compute_descriptor_layout_flags`, `agc_driver_covered_centroid_state` AI-assisted: yes (runs made on the device above).
adriadam10 commented 2026-10-19 12:40:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T12:40:08Z.

Review: CHANGES_REQUESTED


Thanks, the implementation reads correctly (the 64/65 boundary in push_back/set/operator[], resize shrinking back to inline, and the disk cache format are all consistent, and verifyElementFlags covers the spilled case). Two things before this can go in:

  • The numbers don't show a gain. The frame table moves the wrong way (frame_ms.p50 +0.4%, mean_frame_ms +0.8%, Driver.Draw +1.1%, FPS 10.81 → 10.56), and the profile gain (Populate 1.28 → 0.91, worker 32.80 → 31.04 samples) comes from one sampled pair. The cost is DescriptorBinding growing 592 → 784 bytes (+32%) for every binding held in results and caches. Please post repeated paired runs (several captures per side, with the spread) where the worker or frame time improves outside the noise, or drop this change.
  • It conflicts with main: DescriptorBinding gained samplerCoordinatesIgnored and bufferExtent, and the sizeof asserts in ShaderDiskCache.cpp changed (DescriptorBinding is 656 there now). After rebasing, the new samplerCoordinatesIgnored list should be an ElementFlags too (and its users checked), and the asserts recomputed.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5571660623 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6970#pullrequestreview-5571660623). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T12:40:08Z. **Review:** CHANGES_REQUESTED --- Thanks, the implementation reads correctly (the 64/65 boundary in `push_back`/`set`/`operator[]`, `resize` shrinking back to inline, and the disk cache format are all consistent, and `verifyElementFlags` covers the spilled case). Two things before this can go in: - The numbers don't show a gain. The frame table moves the wrong way (`frame_ms.p50` +0.4%, `mean_frame_ms` +0.8%, `Driver.Draw` +1.1%, FPS 10.81 → 10.56), and the profile gain (`Populate` 1.28 → 0.91, worker 32.80 → 31.04 samples) comes from one sampled pair. The cost is `DescriptorBinding` growing 592 → 784 bytes (+32%) for every binding held in results and caches. Please post repeated paired runs (several captures per side, with the spread) where the worker or frame time improves outside the noise, or drop this change. - It conflicts with `main`: `DescriptorBinding` gained `samplerCoordinatesIgnored` and `bufferExtent`, and the `sizeof` asserts in `ShaderDiskCache.cpp` changed (`DescriptorBinding` is 656 there now). After rebasing, the new `samplerCoordinatesIgnored` list should be an `ElementFlags` too (and its users checked), and the asserts recomputed.
github-actions[bot] commented 2026-10-20 13:11:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T13:11:37Z.


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:6291650317 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6970#issuecomment-6291650317). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T13:11:37Z. --- <!-- 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`.
meh7an commented 2026-10-20 14:44:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by meh7an on 2026-10-20T14:44:01Z.


Thanks. Rebased onto main 1d4164552 and re-measured.

  • samplerCoordinatesIgnored is an ElementFlags too. Its users compile and pass unchanged:
    • the builder's push_back;
    • the resource key's packBits and its flag list;
    • the element reads in ShaderResources.cpp;
    • the disk cache's Flags;
    • the tests that assign it a braced list or compare it with a std::vector<bool>.
  • DescriptorBinding now holds 13 flag lists and grows from 656 to 864 bytes (+32%). The assert says 864.
    • Under MinGW's libstdc++, where main reads 656 as its assert says, the size is 864 with this change.
  • The full suite passes 1739 of 1741; the two that don't also fail on plain main.
  • Sonic Origins Plus, S2 page, on main 1d4164552: three interleaved runs per side, each a 200:15 trace with warm caches, plus the title FPS (median of six readings).
Run Main frame p50 (ms) This PR frame p50 (ms) Main Driver.Draw This PR Driver.Draw Main FPS This PR FPS
1 91.13 84.66 71.05 59.15 12.41 12.40
2 86.83 85.16 61.84 60.79 11.91 12.05
3 86.25 85.88 62.63 61.03 12.22 12.22
  • Every run with the change has a lower frame p50 than every main run.
    • Medians: 86.83 to 85.16 ms (-1.9%), and Driver.Draw 62.63 to 60.79 ms (-2.9%).
    • The title FPS medians are equal (12.22), so the gain is small.
  • The description now carries the table and the digests of the median pair.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6293571675 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6970#issuecomment-6293571675). Originally posted by [meh7an](https://github.com/meh7an) on 2026-10-20T14:44:01Z. --- Thanks. Rebased onto main 1d4164552 and re-measured. - `samplerCoordinatesIgnored` is an `ElementFlags` too. Its users compile and pass unchanged: - the builder's `push_back`; - the resource key's `packBits` and its flag list; - the element reads in `ShaderResources.cpp`; - the disk cache's `Flags`; - the tests that assign it a braced list or compare it with a `std::vector<bool>`. - `DescriptorBinding` now holds 13 flag lists and grows from 656 to 864 bytes (+32%). The assert says 864. - Under MinGW's libstdc++, where main reads 656 as its assert says, the size is 864 with this change. - The full suite passes 1739 of 1741; the two that don't also fail on plain main. - Sonic Origins Plus, S2 page, on main 1d4164552: three interleaved runs per side, each a `200:15` trace with warm caches, plus the title FPS (median of six readings). | Run | Main frame p50 (ms) | This PR frame p50 (ms) | Main `Driver.Draw` | This PR `Driver.Draw` | Main FPS | This PR FPS | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | 1 | 91.13 | 84.66 | 71.05 | 59.15 | 12.41 | 12.40 | | 2 | 86.83 | 85.16 | 61.84 | 60.79 | 11.91 | 12.05 | | 3 | 86.25 | 85.88 | 62.63 | 61.03 | 12.22 | 12.22 | - Every run with the change has a lower frame p50 than every main run. - Medians: 86.83 to 85.16 ms (-1.9%), and `Driver.Draw` 62.63 to 60.79 ms (-2.9%). - The title FPS medians are equal (12.22), so the gain is small. - The description now carries the table and the digests of the median pair.
teepean commented 2026-10-20 18:14:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by teepean on 2026-10-20T18:14:21Z.


@meh7an a Linux follow-up on the rebased head 25f8843b15. Merged with main 5f7e30233e, it compiles with GCC 16.2.1 (Release). agc_shader_disk_cache_tests and agc_driver_graphics_tests pass with the validation layer, with no VUIDs.

I also tried the commit on Stray (PPSA02100), on my local stack (showcase/stray-stack, main 64e2a810a9 plus 84 commits). There every stage-instance hit copies a whole RecompileResult with its bindings. The setup: the start of the Dead City chapter, stock engine.ini, Linux, Ryzen 9 9950X, RTX 3090, tcmalloc preloaded. Four rounds in alternating order, FPS from the title bar (48 readings per run):

round stack stack + this PR
1 16.7 16.9
2 16.5 16.9
3 16.2 16.6
4 16.4 16.5
mean 16.45 16.73 (+1.7 %)

The PR's run was faster in every round. I didn't measure main in the PR's form: one pair of runs there spreads more than the ~2 % you saw on Sonic.

AI-assisted: yes (text with Claude Code; the runs are from my machine).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6297884012 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6970#issuecomment-6297884012). Originally posted by [teepean](https://github.com/teepean) on 2026-10-20T18:14:21Z. --- @meh7an a Linux follow-up on the rebased head 25f8843b15. Merged with `main` 5f7e30233e, it compiles with GCC 16.2.1 (Release). `agc_shader_disk_cache_tests` and `agc_driver_graphics_tests` pass with the validation layer, with no VUIDs. I also tried the commit on Stray (PPSA02100), on my local stack ([`showcase/stray-stack`](https://github.com/teepean/AnyPS5/tree/showcase/stray-stack), `main` 64e2a810a9 plus 84 commits). There every stage-instance hit copies a whole `RecompileResult` with its bindings. The setup: the start of the Dead City chapter, stock `engine.ini`, Linux, Ryzen 9 9950X, RTX 3090, tcmalloc preloaded. Four rounds in alternating order, FPS from the title bar (48 readings per run): | round | stack | stack + this PR | |---|---|---| | 1 | 16.7 | 16.9 | | 2 | 16.5 | 16.9 | | 3 | 16.2 | 16.6 | | 4 | 16.4 | 16.5 | | mean | 16.45 | 16.73 (+1.7 %) | The PR's run was faster in every round. I didn't measure `main` in the PR's form: one pair of runs there spreads more than the ~2 % you saw on Sonic. AI-assisted: yes (text with Claude Code; the runs are from my machine).
mrfelek commented 2026-10-21 00:22:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-21T00:22:04Z.


@adriadam10 you asked for repeated paired runs where the worker or frame time improves outside the noise. Here are two titles, three alternating pairs each.

Repeated paired runs on two titles: this change is faster outside the noise on both. Linux (Ubuntu 26.10, kernel 7.3), Ryzen 9 5950X, RTX 3080 Ti (NVIDIA 615.71.09), Release. Base main 7e95bde79; candidate = that main with this head 25f8843b1 merged (5df59fe43, one conflict: the three sizeof asserts, main's values kept and DescriptorBinding set to 864, which compiles). Each build relinked with its own relinker into a fresh runtime (shader cache empty for pair 1, warm after, the same on both sides), runs alternating main, PR, main, PR, …, presents per 10 s from APS5_PROFILE_DRAW.

Sonic Origins Plus (PPSA05325, 02.002.000), main menu, Sonic 2 page. Scripted: X on the autosave notice, X on the title, Right twice, 30 s to settle, then 60 s measured with no input. Every run's last screenshot is on the Sonic 2 page.

Pair main this PR [draw] driver phases recompile
1 131–139 (avg 135.3) 145–147 (145.7) 5.8 → 3.9 µs
2 132–139 (135.3) 142–147 (143.9) 6.2 → 4.2 µs
3 130–137 (133.3) 144–149 (147.3) 5.8 → 4.1 µs

About +8%, and no PR window is as low as any main window.

Castlevania: Belmont's Curse (PPSA35399, 01.000.000), the boat scene, rendered by the engine and waiting on a dialogue line, no input (about 2,800 draws per frame, CPU-bound). Last 4 windows of 70 s, APS5_HOST_IMPORT_MIB=16384 on both sides:

Pair main this PR recompile
1 61–68 (avg 65.0) 73–80 (77.3) 21.7 → 11.6 µs
2 63–68 (65.8) 73–81 (77.5) 21.5 → 12.3 µs
3 62–66 (63.5) 76–81 (78.5) 22.7 → 11.8 µs

About +20%. Capture and the committer stay the same (~12 µs and ~29–31 µs per draw), so the time comes out of the recompile phase, where Populate copies the bindings.

  • The gain scales with draws per frame, which may be why the Sonic menu shows 2% on your machine and 8% here.
  • With a local variant of the same idea (128 flags inline, not this head), two GPU-bound scenes didn't move either way (one run each): Diablo II: Resurrected in town and ASTRO BOT's Crash Site.
One aps5-summary.jsonl row (10 s) per side, pair 2 of each title

Sonic Origins Plus, main then this PR:

{"commit":"7e95bde794ae","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PROFILE_DRAW":"1","APS5_PROFILE_GPU":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 3080 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.3.0-9-generic","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":32003,"title_id":"PPSA05325","title":"Sonic Origins","content_version":"02.002.000","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":4019,"ms":10060.191},"interval_start_s":140.358,"interval_end_s":150.418,"presents":135,"frame_ms":{"p50":72.726,"p90":84.376,"p99":93.785,"max":97.149},"gpu_busy_ms_per_present":45.323,"worker_busy_pct":{"queue worker 0x0":97.460},"top_phases_ms_per_frame":{"Driver.Packet":72.603,"Driver.Packet.draw":59.211,"Driver.Draw":58.275,"Graphics.Draw":47.942,"Graphics.Draw.draw_and_resource_release":39.474,"Driver.Draw.shader_compile_and_link":36.951,"Shader.DrawStage":29.256,"VideoOut.Flip":20.841},"trace_dropped":false,"trace":""}
{"commit":"5df59fe43bac","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PROFILE_DRAW":"1","APS5_PROFILE_GPU":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 3080 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.3.0-9-generic","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":32003,"title_id":"PPSA05325","title":"Sonic Origins","content_version":"02.002.000","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":4077,"ms":10031.033},"interval_start_s":140.273,"interval_end_s":150.304,"presents":142,"frame_ms":{"p50":67.036,"p90":87.445,"p99":95.318,"max":97.451},"gpu_busy_ms_per_present":45.373,"worker_busy_pct":{"queue worker 0x0":96.976},"top_phases_ms_per_frame":{"Driver.Packet":68.479,"Driver.Packet.draw":55.188,"Driver.Draw":54.217,"Graphics.Draw":45.574,"Graphics.Draw.draw_and_resource_release":37.521,"Driver.Draw.shader_compile_and_link":32.619,"Shader.DrawStage":25.305,"VideoOut.Flip":21.288},"trace_dropped":false,"trace":""}

Castlevania, main then this PR:

{"commit":"7e95bde794ae","dirty":false,"env":{"APS5_HOST_IMPORT_MIB":"16384","APS5_PAD_INPUT_FILE":"<path>","APS5_PROFILE_DRAW":"1","APS5_PROFILE_GPU":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 3080 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.3.0-9-generic","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":32003,"title_id":"PPSA35399","title":"Castlevania: Belmont's Curse","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":8239,"ms":10112.341},"interval_start_s":210.626,"interval_end_s":220.738,"presents":68,"frame_ms":{"p50":148.162,"p90":154.131,"p99":158.655,"max":158.655},"gpu_busy_ms_per_present":48.046,"worker_busy_pct":{"queue worker 0x0":90.510},"top_phases_ms_per_frame":{"Driver.Packet":134.147,"Driver.Packet.draw":125.540,"Driver.Draw":124.340,"Driver.Draw.shader_compile_and_link":105.502,"Shader.DrawStage":93.293,"Graphics.Draw":87.506,"Graphics.Draw.draw_and_resource_release":74.461,"Shader.DrawStage.materialize":58.900},"trace_dropped":false,"trace":""}
{"commit":"5df59fe43bac","dirty":false,"env":{"APS5_HOST_IMPORT_MIB":"16384","APS5_PAD_INPUT_FILE":"<path>","APS5_PROFILE_DRAW":"1","APS5_PROFILE_GPU":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 3080 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.3.0-9-generic","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":32003,"title_id":"PPSA35399","title":"Castlevania: Belmont's Curse","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":8375,"ms":10044.415},"interval_start_s":210.816,"interval_end_s":220.861,"presents":81,"frame_ms":{"p50":123.522,"p90":128.179,"p99":133.216,"max":133.216},"gpu_busy_ms_per_present":40.417,"worker_busy_pct":{"queue worker 0x0":90.611},"top_phases_ms_per_frame":{"Driver.Packet":111.658,"Driver.Packet.draw":102.731,"Driver.Draw":101.658,"Graphics.Draw":83.382,"Driver.Draw.shader_compile_and_link":80.116,"Graphics.Draw.draw_and_resource_release":70.212,"Shader.DrawStage":67.897,"Shader.ResolveAbi":43.610},"trace_dropped":false,"trace":""}

AI-assisted; the runs are from my machine(s).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6304840647 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6970#issuecomment-6304840647). Originally posted by [mrfelek](https://github.com/mrfelek) on 2026-10-21T00:22:04Z. --- @adriadam10 you asked for repeated paired runs where the worker or frame time improves outside the noise. Here are two titles, three alternating pairs each. **Repeated paired runs on two titles: this change is faster outside the noise on both.** Linux (Ubuntu 26.10, kernel 7.3), Ryzen 9 5950X, RTX 3080 Ti (NVIDIA 615.71.09), Release. Base `main` 7e95bde79; candidate = that `main` with this head 25f8843b1 merged (5df59fe43, one conflict: the three `sizeof` asserts, `main`'s values kept and `DescriptorBinding` set to 864, which compiles). Each build relinked with its own relinker into a fresh runtime (shader cache empty for pair 1, warm after, the same on both sides), runs alternating `main`, PR, `main`, PR, …, presents per 10 s from `APS5_PROFILE_DRAW`. **Sonic Origins Plus (PPSA05325, 02.002.000), main menu, Sonic 2 page.** Scripted: X on the autosave notice, X on the title, Right twice, 30 s to settle, then 60 s measured with no input. Every run's last screenshot is on the Sonic 2 page. | Pair | `main` | this PR | `[draw] driver phases` recompile | |---|---|---|---| | 1 | 131–139 (avg 135.3) | 145–147 (145.7) | 5.8 → 3.9 µs | | 2 | 132–139 (135.3) | 142–147 (143.9) | 6.2 → 4.2 µs | | 3 | 130–137 (133.3) | 144–149 (147.3) | 5.8 → 4.1 µs | About +8%, and no PR window is as low as any `main` window. **Castlevania: Belmont's Curse (PPSA35399, 01.000.000), the boat scene**, rendered by the engine and waiting on a dialogue line, no input (about 2,800 draws per frame, CPU-bound). Last 4 windows of 70 s, `APS5_HOST_IMPORT_MIB=16384` on both sides: | Pair | `main` | this PR | recompile | |---|---|---|---| | 1 | 61–68 (avg 65.0) | 73–80 (77.3) | 21.7 → 11.6 µs | | 2 | 63–68 (65.8) | 73–81 (77.5) | 21.5 → 12.3 µs | | 3 | 62–66 (63.5) | 76–81 (78.5) | 22.7 → 11.8 µs | About +20%. Capture and the committer stay the same (~12 µs and ~29–31 µs per draw), so the time comes out of the recompile phase, where `Populate` copies the bindings. - The gain scales with draws per frame, which may be why the Sonic menu shows 2% on your machine and 8% here. - With a local variant of the same idea (128 flags inline, not this head), two GPU-bound scenes didn't move either way (one run each): Diablo II: Resurrected in town and ASTRO BOT's Crash Site. <details><summary>One aps5-summary.jsonl row (10 s) per side, pair 2 of each title</summary> Sonic Origins Plus, `main` then this PR: ```json {"commit":"7e95bde794ae","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PROFILE_DRAW":"1","APS5_PROFILE_GPU":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 3080 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.3.0-9-generic","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":32003,"title_id":"PPSA05325","title":"Sonic Origins","content_version":"02.002.000","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":4019,"ms":10060.191},"interval_start_s":140.358,"interval_end_s":150.418,"presents":135,"frame_ms":{"p50":72.726,"p90":84.376,"p99":93.785,"max":97.149},"gpu_busy_ms_per_present":45.323,"worker_busy_pct":{"queue worker 0x0":97.460},"top_phases_ms_per_frame":{"Driver.Packet":72.603,"Driver.Packet.draw":59.211,"Driver.Draw":58.275,"Graphics.Draw":47.942,"Graphics.Draw.draw_and_resource_release":39.474,"Driver.Draw.shader_compile_and_link":36.951,"Shader.DrawStage":29.256,"VideoOut.Flip":20.841},"trace_dropped":false,"trace":""} ``` ```json {"commit":"5df59fe43bac","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PROFILE_DRAW":"1","APS5_PROFILE_GPU":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 3080 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.3.0-9-generic","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":32003,"title_id":"PPSA05325","title":"Sonic Origins","content_version":"02.002.000","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":4077,"ms":10031.033},"interval_start_s":140.273,"interval_end_s":150.304,"presents":142,"frame_ms":{"p50":67.036,"p90":87.445,"p99":95.318,"max":97.451},"gpu_busy_ms_per_present":45.373,"worker_busy_pct":{"queue worker 0x0":96.976},"top_phases_ms_per_frame":{"Driver.Packet":68.479,"Driver.Packet.draw":55.188,"Driver.Draw":54.217,"Graphics.Draw":45.574,"Graphics.Draw.draw_and_resource_release":37.521,"Driver.Draw.shader_compile_and_link":32.619,"Shader.DrawStage":25.305,"VideoOut.Flip":21.288},"trace_dropped":false,"trace":""} ``` Castlevania, `main` then this PR: ```json {"commit":"7e95bde794ae","dirty":false,"env":{"APS5_HOST_IMPORT_MIB":"16384","APS5_PAD_INPUT_FILE":"<path>","APS5_PROFILE_DRAW":"1","APS5_PROFILE_GPU":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 3080 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.3.0-9-generic","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":32003,"title_id":"PPSA35399","title":"Castlevania: Belmont's Curse","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":8239,"ms":10112.341},"interval_start_s":210.626,"interval_end_s":220.738,"presents":68,"frame_ms":{"p50":148.162,"p90":154.131,"p99":158.655,"max":158.655},"gpu_busy_ms_per_present":48.046,"worker_busy_pct":{"queue worker 0x0":90.510},"top_phases_ms_per_frame":{"Driver.Packet":134.147,"Driver.Packet.draw":125.540,"Driver.Draw":124.340,"Driver.Draw.shader_compile_and_link":105.502,"Shader.DrawStage":93.293,"Graphics.Draw":87.506,"Graphics.Draw.draw_and_resource_release":74.461,"Shader.DrawStage.materialize":58.900},"trace_dropped":false,"trace":""} ``` ```json {"commit":"5df59fe43bac","dirty":false,"env":{"APS5_HOST_IMPORT_MIB":"16384","APS5_PAD_INPUT_FILE":"<path>","APS5_PROFILE_DRAW":"1","APS5_PROFILE_GPU":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 3080 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.3.0-9-generic","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":32003,"title_id":"PPSA35399","title":"Castlevania: Belmont's Curse","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":8375,"ms":10044.415},"interval_start_s":210.816,"interval_end_s":220.861,"presents":81,"frame_ms":{"p50":123.522,"p90":128.179,"p99":133.216,"max":133.216},"gpu_busy_ms_per_present":40.417,"worker_busy_pct":{"queue worker 0x0":90.611},"top_phases_ms_per_frame":{"Driver.Packet":111.658,"Driver.Packet.draw":102.731,"Driver.Draw":101.658,"Graphics.Draw":83.382,"Driver.Draw.shader_compile_and_link":80.116,"Graphics.Draw.draw_and_resource_release":70.212,"Shader.DrawStage":67.897,"Shader.ResolveAbi":43.610},"trace_dropped":false,"trace":""} ``` </details> AI-assisted; the runs are from my machine(s).
meh7an commented 2026-10-21 08:01:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by meh7an on 2026-10-21T08:01:28Z.


@adriadam10 Rebased onto main 53a0a27bb (a9a338c37). The only conflict was the size asserts: main's ShaderInvocation 216 and RecompileResult 528 stay, and DescriptorBinding is 864, checked under MinGW's libstdc++.

Since your review, two independent sets of runs came in:

  • @teepean: builds on Linux (GCC 16.2.1) with no VUIDs under the validation layer, and +1.7% on Stray over four rounds.
  • @mrfelek: three alternating pairs per title. About +8% on Sonic Origins' Sonic 2 page and about +20% on Castlevania's boat scene. Every PR window was above every main window, and the time comes out of the recompile phase, where Populate copies the bindings.

Thanks @teepean and @mrfelek for the runs. Could you take another look?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6311088652 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6970#issuecomment-6311088652). Originally posted by [meh7an](https://github.com/meh7an) on 2026-10-21T08:01:28Z. --- @adriadam10 Rebased onto main 53a0a27bb (a9a338c37). The only conflict was the size asserts: main's `ShaderInvocation` 216 and `RecompileResult` 528 stay, and `DescriptorBinding` is 864, checked under MinGW's libstdc++. Since your review, two independent sets of runs came in: - @teepean: builds on Linux (GCC 16.2.1) with no VUIDs under the validation layer, and +1.7% on Stray over four rounds. - @mrfelek: three alternating pairs per title. About +8% on Sonic Origins' Sonic 2 page and about +20% on Castlevania's boat scene. Every PR window was above every `main` window, and the time comes out of the recompile phase, where `Populate` copies the bindings. Thanks @teepean and @mrfelek for the runs. Could you take another look?
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!6970
No description provided.