Skip to content

perf(agc): merge shared shader regions with a heap - #11957

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
Bram910:perf/shader-region-merge
Oct 29, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
Bram910:perf/shader-region-merge

Conversation

@Bram910

@Bram910 Bram910 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What

Collecting a shader's captured memory regions repeatedly scans every supplied shared block to choose the next run, including while emitting interspersed initial regions. Use a min-heap when multiple shared blocks participate, advancing only the block whose next run was consumed. Keep the linear zero/one-block path and the existing merge rules for initial regions and captured pages. Shared blocks are already validated as ordered and disjoint by supplyWords; that validation and guest-write tracking stay in place.

The regression captures real resource tables with 0, 1, 2, 3, 7, 8, 16 and 64 supplied blocks, contiguous and sparse multi-run layouts, reverse insertion, captured descriptor pages and interspersed initial regions. It checks order, byte contents, complete record coverage, initial-region visibility and recent-read reset behavior.

Performance scope: the attached matched main/PR GTA Story-menu captures are explicitly identified by their original commit IDs below. This vblank-limited menu establishes no gameplay FPS benefit or 30 FPS opening-gameplay result. The synthetic microbenchmark measures collection cost only.

Tested

Publication validation on main 3a40945e62b7e2543031d5da2b8e351ab603bc1a and this PR 2ce643be49d775cded5dc7c5453b2cbae82949b4: the same 12 focused shader-memory, SRT, table-snapshot, frontend/layout and prepared-graphics tests pass on both; this PR also passes its region regression (13/13 total) and 20 repeated runs. Both runs used the same RTX 3080, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. Neither verbose log reports a missing layer, VUID/validation error or skipped/unrun selected test. The benchmark CLI also passes. These are focused Windows tests, not a full-suite or cross-platform run.

The rebase changes the surrounding upstream code, so the attached menu pair remains labeled with its actual original revisions (2ee8e9751a06 / 7cbd7eeb345c); it is not a fresh frame-rate measurement of the rebased head. ShaderMemory::collect is byte-identical between each original trace revision and its corresponding refreshed main/PR version. No gameplay speedup is claimed.

Windows 11 Pro 10.0.26200, AMD Ryzen 9 7950X, MinGW GCC 15.2 Release. The original matched validation built shader-memory, AGC runtime and prepared-graphics test targets on main 75f3702aed32762d0efcde60e998e7edb93c8ae2 and the original candidate 7b25204cee7ee6f55ad248a5a0b7e1f99f7c94c5.

The same 12 focused shader-memory, SRT patching, table-snapshot, frontend/layout and prepared-graphics GPU tests pass on both versions. This branch also passes agc_shader_region_merge (13/13 total), plus 20 consecutive runs of the new regression.

ctest --test-dir build-win -R '^agc_shader_(memory|table_snapshot|srt_read|frontend|layout)|^agc_driver_prepared_graphics' -V
ctest --test-dir build-win -R '^agc_shader_region_merge$' --repeat until-fail:20 -V

Both versions used ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_GPU=NVIDIA, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and VK_LAYER_PATH=C:/VulkanSDK/1.4.363.0/Bin. Neither verbose validation log contains missing-layer messages, VUID errors or skipped/unrun selected tests. These are focused tests, not the full project suite; Linux/macOS were not run.

Those original main and candidate versions were also measured with identical synthetic collection fixtures and Release test executables: ABBA order repeated three times, six processes per version, 1,000 Regions() calls per size per process. Request capture and correctness checks are outside the timed section. Median microseconds per collection:

Shared blocks Main (us) Change (us)
0 0.298 0.318
1 0.620 0.601
2 1.091 0.720
3 1.653 1.032
7 5.851 2.034
8 6.992 2.213
16 29.100 3.874
64 564.146 16.203

This workload includes numerous interspersed initial regions. It is not a title frame-rate benchmark. No shader semantics, rendering quality, GTA saves/runtime or launch safeguards were changed by this submission.

Conventions (python tools/check_conventions.py --base origin/main) and git diff --check origin/main...HEAD pass. The test benchmark uses agc_shader_memory_tests --region-merge-bench; ordinary --region-merge runs assertions without timing. No environment-documentation row is added.

Integration checks: the new test command is dispatched away from the insertion points used by #12051 and #6959. Both direct merge orders succeed and produce identical trees with #9626 (7301d0241c1421d0fb37e5773c679629980e06ff), #12051 (f5cf0db16c28ee4a7575c7cd1dda342fd01a9fe6) and #6959 (bf38500c623a21a8a3938937944ee6e89938778a). No code from those PRs is required and no ordering agreement or reviewer approval is claimed.

The refreshed project checker examined 1,303 open PRs and found no direct conflicting hunks or duplicate exports/new files among branches it could compare. It still lists older branches that conflict with main and cannot be compared automatically. Their relevant shared-file patches were inspected: #6188 changes speculative reads and #9898 changes capture profiling, neither implements the collection heap; CMake/test neighbors add other fixtures. Refreshed versions of those stale branches may require another integration review. This is not an unconditional all-PR conflict-free claim.

GTA V Story-menu capture pair

Captured on the same PC in one session, using unmodified main 2ee8e9751a06bd4cb7edb8d17f433d56a39a7025 and this PR 7cbd7eeb345c1f06346a567cd9fd6dca5a165406. Both full runtime builds succeeded and were scanned. GTA V PPSA04263, content 01.010.002, 3840x2160 guest rendering, same 1484x835 client window and save seed. Each runtime reached the Story menu once and was closed and restarted before capture. Controls were released before the window. The Story menu's artwork cycles; this is the same menu state, not a frame-identical frozen image.

Both captures use APS5_TRACE_SECONDS=360:5, with APS5_TRACE_DIR for output and APS5_PAD_INPUT_FILE for navigation. No other APS5_TRACE_* or APS5_PROFILE_* switch was set, and neither capture redirected the game log. Both revisions report dirty=false and trace_dropped=false. Both captures closed normally with exit code 0, no job-cap events, and no low-memory stop. Original saves and runtime were restored and hash-verified after capture.

This is one five-second pair on a vblank-limited menu. Background workloads remained running at the user's request. It establishes no statistically supported speedup or regression, no gameplay FPS gain, and does not demonstrate the 30 FPS gameplay target. The optimization's isolated cost remains measured by the separately disclosed microbenchmark. A supported gameplay workload is still needed to assess frame-time benefit.

Gameplay was attempted on clean main first. Prologue loading aborts before gameplay with reads or writes a converted float image with 16-bit data, which is not implemented. The diagnostic retry confirmed this runtime rejection with exit code 0xC0000409 and zero job-cap events; it is separate from packed-f16 arithmetic support. That run redirected logs for diagnosis and is excluded from performance evidence. No shader guard was bypassed and no extra gameplay patch was included in either capture build.

Metric Main PR
Frame p50 (ms) 16.684 16.683
Frame p90 (ms) 16.889 16.872
Frame p99 (ms) 16.986 17.009
Worst frame (ms) 17.093 17.066
GPU busy per present (ms) 2.124 2.568

main: unedited summary and trace_digest output

seconds 360:5 from present 19514: 300 presents, frame p50 16.7 / p90 16.9 / p99 17.0 / max 17.1 ms, GPU busy 2.1 ms per present
NVIDIA GeForce RTX 3080, NVIDIA 610.47, Windows 10.0.26200, 3840x2160, commit 2ee8e97, dropped: no

{"commit":"2ee8e9751a06","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"360:5"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 610.47","os":"Windows 10.0.26200","cpu":"AMD Ryzen 9 7950X 16-Core Processor","cpu_threads":32,"memory_mib":64608,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.010.002","resolution":"3840x2160","window":{"spec":"seconds 360:5","first_present":19514,"ms":5004.96},"presents":300,"frame_ms":{"p50":16.684,"p90":16.889,"p99":16.986,"max":17.093},"gpu_busy_ms_per_present":2.124,"worker_busy_pct":{"queue worker 0x0":98.976},"top_phases_ms_per_frame":{"Driver.Packet":16.477,"VideoOut.Flip":16.304,"VideoOut.Flip.vblank_wait":15.629,"Driver.Packet.rendering_wait":13.676,"Driver.Packet.draw":2.291,"Driver.Draw":2.274,"Graphics.Draw":1.785,"Driver.Draw.shader_compile_and_link":1.781},"trace_dropped":false,"trace":"aps5-trace-2ee8e9751a06-62204.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 19760: 17.1 ms at 4104 ms: VideoOut.Flip (presenter) 16.7, Driver.Packet (queue worker 0x0) 16.6, VideoOut.Flip.vblank_wait (presenter) 16.1, Driver.Packet.rendering_wait (queue worker 0x0) 14.5
  • present 19545: 17.0 ms at 517 ms: VideoOut.Flip (presenter) 16.9, Driver.Packet (queue worker 0x0) 16.5, VideoOut.Flip.vblank_wait (presenter) 16.4, Driver.Packet.rendering_wait (queue worker 0x0) 14.3
  • present 19676: 17.0 ms at 2703 ms: VideoOut.Flip (presenter) 16.7, Driver.Packet (queue worker 0x0) 16.4, VideoOut.Flip.vblank_wait (presenter) 15.9, Driver.Packet.rendering_wait (queue worker 0x0) 12.9
  • present 19585: 17.0 ms at 1185 ms: VideoOut.Flip (presenter) 16.8, Driver.Packet (queue worker 0x0) 16.4, VideoOut.Flip.vblank_wait (presenter) 16.0, Driver.Packet.rendering_wait (queue worker 0x0) 13.8
  • present 19704: 17.0 ms at 3170 ms: VideoOut.Flip (presenter) 16.7, Driver.Packet (queue worker 0x0) 16.4, VideoOut.Flip.vblank_wait (presenter) 15.9, Driver.Packet.rendering_wait (queue worker 0x0) 13.8

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 2.5 (15 %) 13.7 (82 %) 0.5 2.7 Driver.Packet 16.1, Driver.EndSubmission 0.0
draw committer 1.6 (9 %) 0.0 (0 %) 15.1 1.1 Graphics.Draw 1.5, Recorder.Submit 0.0
presenter 0.7 (4 %) 15.7 (94 %) 0.3 0.1 VideoOut.Flip 16.3, Driver.Present 0.0
gpu 2.1 (13 %) 0.0 (0 %) 14.6 0.0 batch 2.1

Largest slices (ms per frame, inclusive, all threads): VideoOut.Flip 16.3, Driver.Packet 16.1, VideoOut.Flip.vblank_wait 15.6, Driver.Packet.rendering_wait 13.7, Driver.Packet.draw 2.2, Driver.Draw 2.2, batch 2.1, Driver.Draw.shader_compile_and_link 1.6, Graphics.Draw 1.5, Graphics.Draw.draw_and_resource_release 0.8

Longest waits

  • Driver.Packet.rendering_wait (queue worker 0x0) 16.7 ms at 1872 ms, present 19626
  • Driver.Packet.rendering_wait (queue worker 0x0) 16.4 ms at 1388 ms, present 19597
  • VideoOut.Flip.vblank_wait (presenter) 16.4 ms at 518 ms, present 19545
  • VideoOut.Flip.vblank_wait (presenter) 16.2 ms at 735 ms, present 19558
  • VideoOut.Flip.vblank_wait (presenter) 16.2 ms at 2403 ms, present 19658
  • VideoOut.Flip.vblank_wait (presenter) 16.2 ms at 4772 ms, present 19800
  • VideoOut.Flip.vblank_wait (presenter) 16.2 ms at 51 ms, present 19517
  • VideoOut.Flip.vblank_wait (presenter) 16.2 ms at 2920 ms, present 19689
  • VideoOut.Flip.vblank_wait (presenter) 16.2 ms at 1419 ms, present 19599
  • VideoOut.Flip.vblank_wait (presenter) 16.2 ms at 334 ms, present 19534

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

  • batch 568: 3.0 ms at 3157 ms, present 19703: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.8, Graphics.Draw.draw_and_resource_release (draw committer) 1.0, Graphics.Draw.validate (draw committer) 0.1
  • batch 388: 2.9 ms at 2156 ms, present 19643: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.7, Graphics.Draw.draw_and_resource_release (draw committer) 0.9
  • batch 4: 2.8 ms at 20 ms, present 19515: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.2, Graphics.Draw.draw_and_resource_release (draw committer) 0.7
  • batch 562: 2.8 ms at 3124 ms, present 19701: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.6, Graphics.Draw.draw_and_resource_release (draw committer) 0.9, Graphics.Draw.validate (draw committer) 0.0
  • batch 550: 2.8 ms at 3057 ms, present 19697: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.4, Graphics.Draw.draw_and_resource_release (draw committer) 0.7

change: unedited summary and trace_digest output

seconds 360:5 from present 19210: 300 presents, frame p50 16.7 / p90 16.9 / p99 17.0 / max 17.1 ms, GPU busy 2.6 ms per present
NVIDIA GeForce RTX 3080, NVIDIA 610.47, Windows 10.0.26200, 3840x2160, commit 7cbd7ee, dropped: no

{"commit":"7cbd7eeb345c","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"360:5"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 610.47","os":"Windows 10.0.26200","cpu":"AMD Ryzen 9 7950X 16-Core Processor","cpu_threads":32,"memory_mib":64608,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.010.002","resolution":"3840x2160","window":{"spec":"seconds 360:5","first_present":19210,"ms":5005.226},"presents":300,"frame_ms":{"p50":16.683,"p90":16.872,"p99":17.009,"max":17.066},"gpu_busy_ms_per_present":2.568,"worker_busy_pct":{"queue worker 0x0":98.949},"top_phases_ms_per_frame":{"Driver.Packet":16.474,"VideoOut.Flip":16.248,"VideoOut.Flip.vblank_wait":15.567,"Driver.Packet.rendering_wait":13.689,"Driver.Packet.draw":2.282,"Driver.Draw":2.266,"Driver.Draw.shader_compile_and_link":1.78,"Graphics.Draw":1.773},"trace_dropped":false,"trace":"aps5-trace-7cbd7eeb345c-39484.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 19234: 17.1 ms at 400 ms: VideoOut.Flip (presenter) 16.6, Driver.Packet (queue worker 0x0) 16.5, VideoOut.Flip.vblank_wait (presenter) 15.5, Driver.Packet.rendering_wait (queue worker 0x0) 14.0
  • present 19245: 17.0 ms at 584 ms: VideoOut.Flip (presenter) 16.8, Driver.Packet (queue worker 0x0) 16.5, VideoOut.Flip.vblank_wait (presenter) 16.3, Driver.Packet.rendering_wait (queue worker 0x0) 13.5
  • present 19223: 17.0 ms at 217 ms: Driver.Packet (queue worker 0x0) 16.5, VideoOut.Flip (presenter) 15.9, VideoOut.Flip.vblank_wait (presenter) 14.9, Driver.Packet.rendering_wait (queue worker 0x0) 13.8
  • present 19310: 17.0 ms at 1668 ms: VideoOut.Flip (presenter) 16.7, Driver.Packet (queue worker 0x0) 16.5, VideoOut.Flip.vblank_wait (presenter) 16.0, Driver.Packet.rendering_wait (queue worker 0x0) 14.2
  • present 19346: 17.0 ms at 2269 ms: VideoOut.Flip (presenter) 16.8, Driver.Packet (queue worker 0x0) 16.5, VideoOut.Flip.vblank_wait (presenter) 16.2, Driver.Packet.rendering_wait (queue worker 0x0) 14.4

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 2.4 (15 %) 13.7 (82 %) 0.5 2.6 Driver.Packet 16.1, Driver.EndSubmission 0.0
draw committer 1.5 (9 %) 0.0 (0 %) 15.1 1.1 Graphics.Draw 1.5, Recorder.Submit 0.0
presenter 0.6 (4 %) 15.7 (94 %) 0.4 0.1 VideoOut.Flip 16.2, Driver.Present 0.0
gpu 2.6 (15 %) 0.0 (0 %) 14.1 0.0 batch 2.6

Largest slices (ms per frame, inclusive, all threads): VideoOut.Flip 16.2, Driver.Packet 16.1, VideoOut.Flip.vblank_wait 15.6, Driver.Packet.rendering_wait 13.7, batch 2.6, Driver.Packet.draw 2.2, Driver.Draw 2.2, Driver.Draw.shader_compile_and_link 1.6, Graphics.Draw 1.5, Graphics.Draw.draw_and_resource_release 0.8

Longest waits

  • VideoOut.Flip.vblank_wait (presenter) 16.3 ms at 4021 ms, present 19451
  • VideoOut.Flip.vblank_wait (presenter) 16.3 ms at 4689 ms, present 19491
  • VideoOut.Flip.vblank_wait (presenter) 16.3 ms at 585 ms, present 19245
  • VideoOut.Flip.vblank_wait (presenter) 16.2 ms at 2270 ms, present 19346
  • VideoOut.Flip.vblank_wait (presenter) 16.2 ms at 4155 ms, present 19459
  • VideoOut.Flip.vblank_wait (presenter) 16.2 ms at 3838 ms, present 19440
  • VideoOut.Flip.vblank_wait (presenter) 16.1 ms at 1786 ms, present 19317
  • VideoOut.Flip.vblank_wait (presenter) 16.1 ms at 4989 ms, present 19509
  • VideoOut.Flip.vblank_wait (presenter) 16.1 ms at 4522 ms, present 19481
  • VideoOut.Flip.vblank_wait (presenter) 16.1 ms at 3521 ms, present 19421

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

  • batch 175: 4.0 ms at 971 ms, present 19268: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.4, Graphics.Draw.draw_and_resource_release (draw committer) 0.7, Graphics.Draw.validate (draw committer) 0.0
  • batch 109: 3.9 ms at 605 ms, present 19246: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.6, Graphics.Draw.draw_and_resource_release (draw committer) 1.0, Graphics.Draw.validate (draw committer) 0.0
  • batch 730: 3.9 ms at 4058 ms, present 19453: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.5, Graphics.Draw.draw_and_resource_release (draw committer) 0.8
  • batch 649: 3.9 ms at 3608 ms, present 19426: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.5, Graphics.Draw.draw_and_resource_release (draw committer) 0.8, Graphics.Draw.validate (draw committer) 0.0
  • batch 631: 3.8 ms at 3508 ms, present 19420: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.5, Graphics.Draw.draw_and_resource_release (draw committer) 0.8, Graphics.Draw.validate (draw committer) 0.0

Raw traces and unedited summary files are packaged as pr-11957-gta-story-menu-traces.zip (1,351,484 bytes; SHA-256 0b5a758dc79befe09b9c401b3180dc82449d1640a21fbe5cbd74f7f940dd6deb). Download the raw trace archive. Both unmodified compressed traces, summaries, full digests and SHA-256 checksums are included.

Checklist

@github-actions github-actions Bot added perf Performance change perf numbers missing perf pull request without a before and after summary line labels Oct 27, 2026
@github-actions

Copy link
Copy Markdown

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.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The draft correctly discloses that its required title performance report is still missing. I found one separate integration blocker to resolve before this can be ready: a direct merge preview of the current #11957 and #9626 heads conflicts in docs/dev/ENVIRONMENT.md. The two different environment rows were inserted at the same location, so the branches do not currently integrate automatically even though both entries should be retained.

Please agree the order with the #9626 author, state the prerequisite in the checklist (Depends on: #9626 if it must land first, or the agreed reverse order), and rebase/update so both environment rows survive. Keep the PR in draft until it also has the required same-title, same-scene, same-machine aps5-summary.jsonl lines and attached traces; the synthetic microbenchmark is explicitly not a substitute for that report.

I have not approved the draft.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 12828 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9390

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 2434 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 4449 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6185 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6186 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6187 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/ShaderMemory.cpp
PR 6192 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6209 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6235 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6280 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6300 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6481 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6488 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6905 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7048 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7275 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7457 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7464 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7514 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7604 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 7684 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 7689 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8004 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 8014 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8246 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8484 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8542 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8592 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9356 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 9387 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 9508 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 9712 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9748 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 9889 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 9897 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 9898 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/ShaderMemory.cpp
PR 9899 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10026 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10193 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 10233 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 10442 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10472 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10757 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 10920 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 11551 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 11554 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 12070 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 12132 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 12862 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 12904 core/libs/prx/libSceAgcDriver/CMakeLists.txt

@Bram910
Bram910 force-pushed the perf/shader-region-merge branch from 7b25204 to 7cbd7ee Compare October 27, 2026 15:01
@github-actions github-actions Bot added build agc libSceAgc* and removed perf numbers missing perf pull request without a before and after summary line labels Oct 27, 2026
@Bram910
Bram910 force-pushed the perf/shader-region-merge branch from 7cbd7ee to 2ce643b Compare October 28, 2026 10:17
@Bram910
Bram910 marked this pull request as ready for review October 28, 2026 10:20
@adriadam10 adriadam10 self-assigned this Oct 28, 2026
@adriadam10
adriadam10 dismissed MarcZX10’s stale review October 28, 2026 22:52

Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@Bram910 thanks for adding the matched menu summaries and traces and keeping their original revisions explicit. They support the stated menu result, with no gameplay speedup claim. The earlier review also asked which heap sizes titles actually reach: could you add the shared-block-count distribution per Regions()/TakeRecentRegions() call in that scene, with collection cost for the same workload? The synthetic 7-64-block gains do not show how often a title enters that regime. If gameplay is still blocked, please keep that limitation and the menu/microbenchmark results separate.

@adriadam10, leaving the performance qualification and landing decision with you.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head 2ce643be49d775cded5dc7c5453b2cbae82949b4. The required matched menu captures, summary lines, traces and digests are now present, and the author clearly states they show no FPS gain or gameplay result. The current pairwise merge preview with #9626 is clean and the body records both merge orders, so my earlier integration concern is resolved.

One performance question remains before I can approve: the synthetic benchmark shows gains starting at two shared blocks, but the title/menu trace does not report the shared-block-count distribution or collection cost per Regions()/TakeRecentRegions() call. The gameplay capture cannot reach gameplay even on clean main, so it does not establish that real workloads spend meaningful time in the multi-block cases. Please add that distribution and same-workload collection cost for the captured scene as requested in the latest review, or keep the PR explicitly limited to the synthetic complexity result and provide another supported workload that exercises the affected path. The exact-head Windows focused tests pass; Linux/macOS and the full project suite were not run locally.

@TechLevelZero

TechLevelZero commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 2ce643b merged onto main ba5b533 · tested 2026-10-29 17:10 UTC · 26 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,289 passed · 4 failed (0 new, 4 also fail on main) · 39 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,332 of 2,891 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (895 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_bda_device 64.8 s
Failing on main too (4, not counted against this PR)
agc_compute_pipeline_inspection
agc_submit_progress
guest_mmap_executable
guest_socket_options_multicast
Validated but not compared (1, not in the main baseline's validation pass)
agc_shader_region_merge
Validation IDs already present on main (4 IDs in 436 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (436 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_passes_draw_transitions, agc_driver_address_passes_targets_split, agc_driver_alias_copy_label, agc_driver_array_layer_target, agc_driver_array_layer_target_cpu, agc_driver_bda_anchor_reads, and 428 more
VUID-vkCmdCopyImage-srcImage-01548 (11 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_storage_dispatch, and 3 more
VUID-vkCmdCopyImage-srcImage-01551 (11 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_storage_dispatch, and 3 more
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
Skipped (39)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_msaa_dcc_compared_import_2: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_4: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_8: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_main: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fresh: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_labels: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SD
Reproduce
git fetch origin 2ce643be49d775cded5dc7c5453b2cbae82949b4 ba5b5330b37724bca4b99f30faab504653635a04
git checkout ba5b5330b37724bca4b99f30faab504653635a04 && git merge --no-ff 2ce643be49d775cded5dc7c5453b2cbae82949b4
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@adriadam10
adriadam10 merged commit b68fff8 into boykopovar:main Oct 29, 2026
11 of 12 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the heap logic in ShaderMemory::collect (pop/push order, exhausted and empty cursors dropped, zero/one-block path unchanged, disjoint runs so no ties), the new agc_shader_region_merge test (0..64 blocks, order, bytes, coverage, recent reset), the Windows job and @TechLevelZero's NVIDIA run (0 new failures). The gain is the algorithmic one measured by the microbenchmark (64 blocks: 564 → 16 us); the menu capture shows no difference and no gameplay speedup is claimed. The 0-block overhead is negligible; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build perf Performance change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants