Skip to content

perf(shader): keep recently specialized SPIR-V for reuse - #25852

Merged
oneandonlydean merged 3 commits into
boykopovar:mainfrom
Remi-Bon:perf/shader-keep-specialized-spirv
Nov 25, 2026
Merged

oneandonlydean merged 3 commits into
boykopovar:mainfrom
Remi-Bon:perf/shader-keep-specialized-spirv

Conversation

@Remi-Bon

Copy link
Copy Markdown
Contributor

What

A specialized module holds its SPIR-V words only weakly, so the words are freed with the module's last result. A variant specialized again soon after is rebuilt word for word. Split table call parts do this often, because their results are short-lived.

APS5_KEEP_SPECIALIZED_MIB sets a byte budget for a ring of the most recently specialized modules. The ring holds them strongly, so a re-materialization finds the words still alive. The default is 0, which keeps today's behaviour: unused words are released.

Tested

  • Windows 11, MinGW Release build.
  • ctest --test-dir build -R "specializ|recompiler|pipeline_cache|shader_memory|layer_specialization": 16/16 passed, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and VK_LOADER_DEBUG=layer, validation layer from Vulkan SDK 1.4.363.1. The loader log shows Insert instance layer "VK_LAYER_KHRONOS_validation" and contains no VUID-.
  • The new test agc_shader_layer_specialization_kept runs the release test with APS5_KEEP_SPECIALIZED_MIB=1 and requires the released words to stay alive.
  • Not measured in a title.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 9070, AMD driver 2.0.416 (Vulkan 1.4.359), Windows 11
  • AI-assisted: yes

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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.

Reviewed — comments

The review covers head 2a16f1846720f1a90ff5f63c2036cbb2aa5aabb4; I found no verified blocking defect, but the configured byte budget has edge cases worth addressing before relying on it for a hard memory limit.

What I ran

No build or tests were run. I inspected the prepared diff and targeted source at the pinned head.

Results

Check Result Note
Diff and context review passed Changed behavior inspected
Build and tests not run Author reports 16 passing tests

Findings

Blocking

None.

Non-blocking

  • APS5_KEEP_SPECIALIZED_MIB is parsed with strtoull and shifted left by 20 without validating the input or checking overflow (core/shader/recompiler/Recompiler.cpp:1128). A sufficiently large integer can wrap the byte budget to zero or a smaller value, and invalid text is silently treated as zero. Consider validating and saturating the MiB-to-byte conversion so the configured budget behaves predictably.
  • The eviction accounting uses uint64_t addition and multiplication without overflow checks (core/shader/recompiler/Recompiler.cpp:1136). Extremely large SPIR-V modules or aggregate sizes could wrap the counter, causing retention beyond the stated budget. Consider overflow-safe accounting if this setting is intended to be a strict cap.

Not verified

  • No commands, build, or tests were run; the reported Windows 11 test results are author-provided.
  • core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp was read around the changed lines. Full text was excluded as too large. All other changed files listed in the manifest had full text available; targeted ranges were read for core/shader/recompiler/Recompiler.cpp, core/shader/recompiler/Recompiler.hpp, core/libs/prx/libSceAgcDriver/tests/cmake/agc_shader_memory_tests.cmake, and docs/dev/ENVIRONMENT.md.
  • No title performance measurements were provided; the description says performance was not measured in a title.

To get this to a good state

Nothing is required. Optional points: validate and saturate the budget parsing and make byte accounting overflow-safe.

@Doorriiaann

Copy link
Copy Markdown
Contributor

NVIDIA run on Linux: the new agc_shader_layer_specialization_kept passes and the specialization, recompiler, pipeline cache and shader memory tests do not regress.

Setup: RTX 3070 8 GB, NVIDIA 610.57.04, Ryzen 5 5600X, Debian 13 (kernel 6.12.115), GCC 13.3.0 Release, validation layer 1.4.335. Base is the merge-base 07336cc, head is 2a16f18. ANYPS5_GPU=NVIDIA ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ctest -R '(specializ|recompiler|pipeline_cache|shader_memory|layer_specialization)' -V, 2 runs each.

base this PR
agc_shader_layer_specialization_kept (new) 2/2 pass
the other 15 matching tests 30/30 pass 30/30 pass

Every Vulkan test's log selects the RTX 3070 and shows the layer inserted, none reports it missing, and no log has a VUID- line.

AI-assisted: yes

@github-actions github-actions Bot added perf Performance change perf numbers missing perf pull request without a before and after summary line build shader core/shader docs agc libSceAgc* labels Nov 22, 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.

@Helldiverr

Copy link
Copy Markdown
Contributor

Head 2a16f18467 merged onto upstream/main f5b7e1d1ac: there is no runtime defect, but there is a test gap, and the PR has no speed evidence.

  • With APS5_KEEP_SPECIALIZED_MIB set, agc_shader_memory fails, because the PR updated only one of the two release tests.
  • With the variable unset, the focused tests pass 3/3 on RDNA4 (gfx1201) with the Khronos validation layer loaded and no VUID-.

Code.

  • keepSpecializedWords (core/shader/recompiler/Recompiler.cpp) only holds strong references to words that buildSpecializedModule and specializedWords have already produced. It does not change which module serves a key.
  • specializeModule still looks a module up by variantId plus the full constant list. The prepared-plan and registration caches still look up by moduleKey.
  • A kept module therefore extends the lifetime of words already tied to that key, and is not served for another input.
  • Side effect: while a module is kept, specializedWords skips its rebuild-and-compare check ("built again from its key differs from its first build"). Rebuilds still check it.
  • The same SharedSpirv can enter the deque more than once and is counted each time, so the deque holds at most the budget, not exactly the budget. MarcZX10 already noted the unchecked strtoull << 20.
  • With the variable unset, the budget is 0 and nothing changes.
  • No code comments. The PR adds no debt fragment.

Test gap. The PR changes verifyLayerSpecializationRelease, but verifySpecializedModuleRelease (tests/ShaderMemory.cpp:441) asserts released.Expired() the same way and was not changed. On this head:

test variable unset APS5_KEEP_SPECIALIZED_MIB=1 or =1024
agc_shader_memory Passed Failed: specialized module release: the module caches kept the words of a module no result uses
agc_shader_memory_coherent_atomic_loads Passed Failed, same message

So ctest run with the variable in the environment fails, and the new _kept test does not cover the default suite.

The _kept path returns before a second Recompile, so no test checks that a kept module comes back with the same specializationId and words. verifySpecializedModuleRelease already performs that second Recompile. It could check the result instead of skipping it when the variable is set.

Probe: served words against a fresh rebuild. I made two local, uncommitted changes to the merged head:

  • Each time a cache returns live words, it also builds the words again from the current request and compares the two. This covers specializedWords (comparing with specializeWords output) and the registrationModule and prepared-plan lockedWords paths (comparing with specialize()).
  • The :441 assertion is skipped when the variable is set, so the default suite runs to the end.

The run covers 45 tests: all agc_shader_memory_tests cases, agc_shader_layer_specialization_kept, the 4 agc_driver_prepared_graphics* tests and agc_driver_vertex_fetch.

APS5_KEEP_SPECIALIZED_MIB result live-word hits (inner / outer) mismatches
unset 45/45 179 / 171 0
1024 45/45 181 / 173 0
1 45/45 181 / 173 0

All served words matched a fresh rebuild for the same input. The ring adds one hit each in agc_shader_memory, agc_shader_memory_coherent_atomic_loads and agc_shader_result_memo_budget_masked. It also removes one, because agc_shader_layer_specialization_release returns early when the variable is set. So these tests barely exercise a kept module; almost all hits come from results that are still alive without the ring. 0 VUID- in all three runs.

Speed. There is no tools/trace_digest.py summary of main and of the change. The PR says it was not measured in a title, so it does not meet the AGENTS.md rule for a perf change. I did not measure it either.

Existing runs. The author ran 16/16 on an RX 9070 (Windows, layer 1.4.363) and Doorriiaann ran on an RTX 3070. This run adds:

  • the negative control;
  • the default suite with the variable set;
  • the served-words probe.

Negative control. I copied the PR's ShaderMemory.cpp and agc_shader_memory_tests.cmake onto main. agc_shader_layer_specialization_kept fails with layer module release: APS5_KEEP_SPECIALIZED_MIB did not keep the released SPIR-V words, and agc_shader_layer_specialization_release passes.

GPU.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ctest --test-dir build -R "^(agc_shader_layer_specialization_release|agc_shader_layer_specialization_kept|agc_shader_specialized_bda_abi_none|agc_shader_memory|agc_driver_prepared_graphics|agc_driver_vertex_fetch)$" -V
run layer_specialization_release (CPU) layer_specialization_kept (CPU) specialized_bda_abi_none (CPU) shader_memory (CPU) prepared_graphics vertex_fetch
main Passed 0.01 s not on main Passed 0.01 s Passed 0.32 s Passed 0.24 s Passed 0.21 s
main + PR tests Passed 0.02 s Failed 0.01 s n/a n/a n/a n/a
head 1 Passed 0.01 s Passed 0.01 s Passed 0.01 s Passed 0.37 s Passed 0.26 s Passed 0.23 s
head 2 Passed 0.01 s Passed 0.01 s Passed 0.01 s Passed 0.35 s Passed 0.23 s Passed 0.23 s
head 3 Passed 0.01 s Passed 0.01 s Passed 0.01 s Passed 0.34 s Passed 0.22 s Passed 0.23 s

The four tests marked CPU create no Vulkan instance: the change is CPU-side. agc_driver_prepared_graphics and agc_driver_vertex_fetch select the R9700 and go through specializeModule. No test skipped.

Validation.

  • Each focused run has 2 Insert instance layer "VK_LAYER_KHRONOS_validation" lines, one per Vulkan test. Each probe run has 5.
  • was not found but was requested by env var VK_INSTANCE_LAYERS appears in none of them.
  • VUID- lines: 0 on main, 0 on each head run and 0 in every probe run.

Host:

  • GPU: AMD Radeon AI PRO R9700 (gfx1201, 1002:7551), driver 32.0.31044.16, Vulkan 1.4.349
  • Validation layer: Khronos 1.4.363 (LunarG SDK)
  • CPU: Ryzen 9 9950X3D
  • OS: Windows 11 Pro 26300
  • Toolchain: WinLibs GCC 15.2, Release
  • Commits measured: main f5b7e1d1ac; head da5cb543cb (2a16f18467 merged onto f5b7e1d1ac)

AI-assisted: yes

… both release tests

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Remi-Bon

Copy link
Copy Markdown
Contributor Author

Speed capture: keep recently specialized SPIR-V

Setup: Windows 11 (26300), AMD Radeon RX 9070, AMD proprietary driver 26.11.2 (LLPC), Ryzen 9 5950X, 32 GB. PPSA01317, Café scene, 3840x2160. Vulkan validation not loaded (speed captures).

main alone does not reach this scene (it stops at layered rendering with a depth target is unsupported, #7256), so this is not a main against change capture. It is an A/B inside one downstream tree (e2c5cb724bb5 plus uncommitted local split work, which carries this change), switching the change off or on with the setting named below. Both sides ran in the same session, after one warm-up run, one run each, APS5_TRACE_SECONDS=0:100 from the Café entry.

Common environment: APS5_ASYNC_COMPUTE_WORDS=0 APS5_SPLIT_TABLE_CALLS=1 APS5_SPLIT_DEFER_CALLEES=1 APS5_LOCAL_MSAA_STALE_READ=1 APS5_LOOP_GUARD=65536.

  • A, APS5_KEEP_SPECIALIZED_MIB unset: gpu-rounds
  • B, APS5_KEEP_SPECIALIZED_MIB=1024: keep-1024
A B
presents in the window 238 251
frame ms p50 / p90 / p99 / max 33.5 / 120.5 / 473.9 / 87437 33.3 / 121.6 / 473.0 / 88485
gpu busy ms per present 13.448 14.067

Phase totals over the window (ms, from the summary line):

phase A B change
Driver.SplitDispatch 86706 88176 +1.7 %
Driver.SplitLookup 88624 90050 +1.6 %
Driver.SplitLookup.parts_for 1891 1855 -1.9 %
Vulkan.Dispatch.shader_resources 2613 2605 -0.3 %

Result: no measurable difference in this window. The change is opt-in (default 0) and this scene did not show a gain from it.

Read this with care: one run per side, no repeat, so run-to-run noise is unmeasured. The worst frame is 87 to 94 s in all four captures (cold compile of split callee parts at Café entry), so frame percentiles above p99 say nothing about this change. tools/trace_digest.py output of both sides and the aps5-summary.jsonl lines are below; the two .json.gz traces are about 4.5 MB each, I can attach them on request.

aps5-summary.jsonl lines

APS5_KEEP_SPECIALIZED_MIB unset:

{"commit":"e2c5cb724bb5","dirty":true,"env":{"APS5_ASYNC_COMPUTE_WORDS":"0","APS5_ASYNC_DRAW_COMPILE":"1","APS5_ASYNC_PIPELINE_WORDS":"50000","APS5_BATCH_CAP":"64","APS5_DRAW_PIPELINE":"1","APS5_GPU_CHECKPOINTS":"1","APS5_LOCAL_A2C_UNDITHERED":"1","APS5_LOCAL_MSAA_STALE_READ":"1","APS5_LOCAL_RETIRE_PARTIAL_FMASK_FILL":"1","APS5_LOCAL_SKIP_STATE_REFUSALS":"1","APS5_LOOP_GUARD":"65536","APS5_MAX_COMPUTE_SPIRV_WORDS":"1000000","APS5_NO_PIPELINE_LTO":"1","APS5_PIPELINED_DRAWS":"64","APS5_SKIP_REFUSED_DISPATCHES":"1","APS5_SKIP_REFUSED_DRAWS":"1","APS5_SKIP_SHADER_FILE":"run287_skip.txt","APS5_SPLIT_CPU_ROUNDS":"1","APS5_SPLIT_DEFER_CALLEES":"1","APS5_SPLIT_TABLE_CALLS":"1","APS5_TRACE_SECONDS":"0:100","APS5_TRACE_TRIGGER_FILE":"<path>"},"gpu":"AMD Radeon RX 9070","driver":"AMD proprietary driver 26.11.2 (LLPC)","os":"Windows 10.0.26300","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":32687,"title_id":"PPSA01317","title":"Gran Turismo® 7","content_version":"01.710.000","resolution":"3840x2160","window":{"spec":"seconds 0:100","first_present":6944,"ms":100681.130},"presents":238,"frame_ms":{"p50":33.466,"p90":120.525,"p99":473.854,"max":87437.299},"gpu_busy_ms_per_present":13.448,"worker_busy_pct":{"queue worker 0x0":93.280,"queue worker 0x51":0.698,"queue worker 0x50":0.576,"queue worker 0x2a":0.210,"queue worker 0x23":0.025,"queue worker 0x2b":0.412,"queue worker 0x4a":0.130,"queue worker 0x4b":0.086},"phase_totals_ms":{"Driver.Completion":6.381,"Driver.Dispatch":91230.252,"Driver.Dispatch.capture_resources":77.307,"Driver.Dispatch.decode_key_device_setup":1134.592,"Driver.Dispatch.lookup_cache":17.133,"Driver.Dispatch.materialize":65.793,"Driver.Dispatch.prepared_invocation":11.509,"Driver.Draw":2971.715,"Driver.Draw.device_setup":34.961,"Driver.Draw.draw_handed_off":223.580,"Driver.Draw.prepare":2709.947,"Driver.DrawFinish":2531.706,"Driver.DrawFinish.draw_enqueued":789.172,"Driver.DrawFinish.post_compile_prepare":14.134,"Driver.DrawFinish.shader_compile_and_link":1587.166,"Driver.EndSubmission":250.780,"Driver.Packet":95746.916,"Driver.Packet.device_lock":11.963,"Driver.Packet.dispatch":91267.650,"Driver.Packet.draw":2980.678,"Driver.Packet.execute":74.945,"Driver.Packet.flush_between_packets":40.287,"Driver.Packet.memory_wait":1011.665,"Driver.Packet.pipeline_drain":67.820,"Driver.Packet.pipeline_prepare":17.773,"Driver.Packet.prepare_memory":203.387,"Driver.Packet.rendering_wait":0.200,"Driver.Present":274.940,"Driver.Present.acquire_image":95.088,"Driver.Present.device_setup":0.131,"Driver.Present.gpu_mutex_wait":7.579,"Driver.Present.inflight_wait":0.678,"Driver.Present.present_display_buffer":65.081,"Driver.Present.queue_present":34.265,"Driver.Present.release_and_callback":0.303,"Driver.Present.render_fence_wait":71.151,"Driver.Present.resize":0.415,"Driver.Present.validate":0.101,"Driver.Rewind":58.424,"Driver.SplitDispatch":86705.562,"Driver.SplitDispatch.capture":1.862,"Driver.SplitLookup":88624.306,"Driver.SplitLookup.parts_for":1891.350,"Driver.Suspend":3.193,"GpuMutex.wait.dispatch":212.196,"GpuMutex.wait.draw":41.956,"GpuMutex.wait.end":130.717,"GpuMutex.wait.flush":2.244,"GpuMutex.wait.hook":6.703,"GpuMutex.wait.indirect":7.242,"GpuMutex.wait.label":69.845,"GpuMutex.wait.other":0.833,"GpuMutex.wait.present":6.930,"Graphics.Draw":2624.848,"Graphics.Draw.draw_and_resource_release":2398.466,"Graphics.Draw.index_upload":29.963,"Graphics.Draw.validate":128.594,"Graphics.Draw.vertex_upload":50.608,"Graphics.DrawWithRecipe":16.283,"Graphics.DrawWithRecipe.draw_and_resource_release":14.831,"Graphics.DrawWithRecipe.index_upload":0.050,"Graphics.DrawWithRecipe.validate":0.291,"Graphics.DrawWithRecipe.vertex_upload":0.917,"Graphics.Submit":0.125,"Graphics.Submit.command_end":0.010,"Graphics.Submit.queue_submit":0.114,"Graphics.Wait":6.793,"Graphics.Wait.fence_wait":6.791,"Recorder.Reap":53.478,"Recorder.Submit":343.775,"Recorder.Sync":65328.698,"Resources.Complete":1804.937,"Resources.Prepare":1341.693,"Shader.DrawStage":1612.458,"Shader.DrawStage.capture_resources":520.906,"Shader.DrawStage.materialize":939.455,"Shader.DrawStage.prepared_invocation":91.696,"Shader.PrepareArtifact":16.322,"Shader.Register":29.131,"Shader.ResolveAbi":125.250,"Shader.ResolveGraphicsAbi":33.093,"Shader.ResolveGraphicsStagesAbi":119.655,"VideoOut.Flip":298.324,"VideoOut.Flip.completion_mutex_wait":0.293,"VideoOut.Flip.config_mutex_wait":0.032,"VideoOut.Flip.frame_limit":0.147,"VideoOut.Flip.notify_game":10.371,"VideoOut.Flip.present":273.531,"VideoOut.Flip.validate":0.290,"VideoOut.Flip.vblank_wait":0.161,"VideoOut.Flip.window_prepare":0.380,"VideoOut.Flip.window_title":12.932,"Vulkan.Acquire":94.794,"Vulkan.Acquire.acquire_fence_wait":85.237,"Vulkan.Acquire.acquire_image":8.329,"Vulkan.Acquire.fence_reset":0.742,"Vulkan.Acquire.retired_swapchains":0.373,"Vulkan.ComputePipeline":823.736,"Vulkan.Dispatch":3208.175,"Vulkan.Dispatch.command_record":585.856,"Vulkan.Dispatch.shader_resources":2612.828,"Vulkan.DispatchRecipe":158.439,"Vulkan.DispatchRecipe.command_record":157.923,"Vulkan.DrawFromRecipe":16.447,"Vulkan.Present":37.478,"Vulkan.Present.command_record_scale":22.630,"Vulkan.Present.pixel_upload":1.532,"Vulkan.Present.queue_submit":13.110,"Vulkan.QueuePresent":33.709,"Vulkan.QueuePresent.queue_present":33.327,"Vulkan.Retire":72.900,"Vulkan.Retire.wait":69.321},"top_phases_ms_per_frame":{"Driver.Packet":402.298,"Driver.Packet.dispatch":383.478,"Driver.Dispatch":383.320,"Driver.SplitLookup":372.371,"Driver.SplitDispatch":364.309,"Recorder.Sync":274.490,"Vulkan.Dispatch":13.480,"Driver.Packet.draw":12.524},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":733,"Graphics.Barrier.dcc-clear":824,"Graphics.Barrier.dcc-keys":654,"Graphics.Barrier.dispatch-lead":27528,"Graphics.Barrier.dispatch-trail":19511,"Graphics.Barrier.draw":20686,"Graphics.Barrier.indirect-args":8526,"Graphics.Barrier.label-run":16149,"Graphics.Barrier.present-blit":475,"Graphics.Barrier.shadow-publish":1126,"Graphics.Barrier.staging-in":9533,"Graphics.Barrier.staging-out":4517,"Graphics.Barrier.storage-upload":11832,"Graphics.Barrier.storage-writeback":14764,"Graphics.BarrierMerged.dispatch-lead":9035,"Graphics.BarrierMerged.label-run":64,"Graphics.BarrierMerged.shadow-publish":856,"Graphics.BarrierMerged.staging-in":4018,"Graphics.BarrierMerged.staging-out":4517,"Graphics.BarrierMerged.storage-writeback":5323,"Graphics.Copy":10131,"Graphics.Copy.bytes":9483878868,"Graphics.RenderPass":9573,"Graphics.RenderPass.Close.command":7963,"Graphics.RenderPass.Close.image":426,"Graphics.RenderPass.Close.key":188,"Graphics.RenderPass.Close.label":64,"Graphics.RenderPass.Close.new-batch":927,"Graphics.RenderPass.Continued":35315},"trace_dropped":false,"trace":"aps5-trace-e2c5cb724bb5-25064.json.gz"}

APS5_KEEP_SPECIALIZED_MIB=1024:

{"commit":"e2c5cb724bb5","dirty":true,"env":{"APS5_ASYNC_COMPUTE_WORDS":"0","APS5_ASYNC_DRAW_COMPILE":"1","APS5_ASYNC_PIPELINE_WORDS":"50000","APS5_BATCH_CAP":"64","APS5_DRAW_PIPELINE":"1","APS5_GPU_CHECKPOINTS":"1","APS5_KEEP_SPECIALIZED_MIB":"1024","APS5_LOCAL_A2C_UNDITHERED":"1","APS5_LOCAL_MSAA_STALE_READ":"1","APS5_LOCAL_RETIRE_PARTIAL_FMASK_FILL":"1","APS5_LOCAL_SKIP_STATE_REFUSALS":"1","APS5_LOOP_GUARD":"65536","APS5_MAX_COMPUTE_SPIRV_WORDS":"1000000","APS5_NO_PIPELINE_LTO":"1","APS5_PIPELINED_DRAWS":"64","APS5_SKIP_REFUSED_DISPATCHES":"1","APS5_SKIP_REFUSED_DRAWS":"1","APS5_SKIP_SHADER_FILE":"run287_skip.txt","APS5_SPLIT_CPU_ROUNDS":"1","APS5_SPLIT_DEFER_CALLEES":"1","APS5_SPLIT_TABLE_CALLS":"1","APS5_TRACE_SECONDS":"0:100","APS5_TRACE_TRIGGER_FILE":"<path>"},"gpu":"AMD Radeon RX 9070","driver":"AMD proprietary driver 26.11.2 (LLPC)","os":"Windows 10.0.26300","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":32687,"title_id":"PPSA01317","title":"Gran Turismo® 7","content_version":"01.710.000","resolution":"3840x2160","window":{"spec":"seconds 0:100","first_present":7238,"ms":102758.794},"presents":251,"frame_ms":{"p50":33.309,"p90":121.606,"p99":472.985,"max":88484.770},"gpu_busy_ms_per_present":14.067,"worker_busy_pct":{"queue worker 0x50":0.549,"queue worker 0x0":93.188,"queue worker 0x51":0.442,"queue worker 0x2a":0.308,"queue worker 0x23":0.095,"queue worker 0x2b":0.374,"queue worker 0x4a":0.132,"queue worker 0x4b":0.217},"phase_totals_ms":{"Driver.Completion":7.008,"Driver.Dispatch":93265.582,"Driver.Dispatch.capture_resources":199.388,"Driver.Dispatch.decode_key_device_setup":1230.768,"Driver.Dispatch.lookup_cache":19.410,"Driver.Dispatch.materialize":35.321,"Driver.Dispatch.prepared_invocation":13.282,"Driver.Draw":2876.221,"Driver.Draw.device_setup":38.313,"Driver.Draw.draw_handed_off":249.211,"Driver.Draw.prepare":2584.960,"Driver.DrawFinish":2352.698,"Driver.DrawFinish.draw_enqueued":875.039,"Driver.DrawFinish.post_compile_prepare":16.310,"Driver.DrawFinish.shader_compile_and_link":1294.428,"Driver.EndSubmission":197.489,"Driver.Packet":97661.082,"Driver.Packet.device_lock":12.980,"Driver.Packet.dispatch":93306.636,"Driver.Packet.draw":2886.608,"Driver.Packet.execute":145.565,"Driver.Packet.flush_between_packets":46.157,"Driver.Packet.memory_wait":803.105,"Driver.Packet.pipeline_drain":76.475,"Driver.Packet.pipeline_prepare":19.597,"Driver.Packet.prepare_memory":281.976,"Driver.Packet.rendering_wait":0.225,"Driver.Present":296.209,"Driver.Present.acquire_image":118.032,"Driver.Present.device_setup":0.128,"Driver.Present.gpu_mutex_wait":3.904,"Driver.Present.inflight_wait":0.637,"Driver.Present.present_display_buffer":66.919,"Driver.Present.queue_present":35.386,"Driver.Present.release_and_callback":0.304,"Driver.Present.render_fence_wait":70.267,"Driver.Present.resize":0.423,"Driver.Present.validate":0.072,"Driver.Rewind":63.921,"Driver.SplitDispatch":88175.860,"Driver.SplitDispatch.capture":1.849,"Driver.SplitLookup":90050.360,"Driver.SplitLookup.parts_for":1855.427,"Driver.Suspend":5.065,"GpuMutex.wait.dispatch":403.998,"GpuMutex.wait.draw":31.461,"GpuMutex.wait.end":154.539,"GpuMutex.wait.flush":3.240,"GpuMutex.wait.hook":5.990,"GpuMutex.wait.indirect":10.878,"GpuMutex.wait.label":113.449,"GpuMutex.wait.other":61.772,"GpuMutex.wait.present":3.226,"Graphics.Draw":2798.407,"Graphics.Draw.draw_and_resource_release":2585.227,"Graphics.Draw.index_upload":32.018,"Graphics.Draw.validate":100.164,"Graphics.Draw.vertex_upload":61.132,"Graphics.DrawWithRecipe":12.871,"Graphics.DrawWithRecipe.draw_and_resource_release":11.718,"Graphics.DrawWithRecipe.index_upload":0.024,"Graphics.DrawWithRecipe.validate":0.230,"Graphics.DrawWithRecipe.vertex_upload":0.751,"Graphics.Submit":0.276,"Graphics.Submit.command_end":0.017,"Graphics.Submit.queue_submit":0.256,"Graphics.Wait":18.748,"Graphics.Wait.fence_wait":18.743,"Recorder.Reap":59.623,"Recorder.Submit":369.288,"Recorder.Sync":64353.887,"Resources.Complete":1844.883,"Resources.Prepare":1150.142,"Shader.DrawStage":1324.012,"Shader.DrawStage.capture_resources":582.628,"Shader.DrawStage.materialize":575.717,"Shader.DrawStage.prepared_invocation":104.308,"Shader.PrepareArtifact":424.549,"Shader.Register":28.840,"Shader.ResolveAbi":309.662,"Shader.ResolveGraphicsAbi":35.585,"Shader.ResolveGraphicsStagesAbi":637.084,"VideoOut.Flip":315.280,"VideoOut.Flip.completion_mutex_wait":0.295,"VideoOut.Flip.config_mutex_wait":0.036,"VideoOut.Flip.frame_limit":0.130,"VideoOut.Flip.notify_game":4.317,"VideoOut.Flip.present":295.461,"VideoOut.Flip.validate":0.298,"VideoOut.Flip.vblank_wait":0.201,"VideoOut.Flip.window_prepare":0.487,"VideoOut.Flip.window_title":13.859,"Vulkan.Acquire":117.723,"Vulkan.Acquire.acquire_fence_wait":104.629,"Vulkan.Acquire.acquire_image":11.789,"Vulkan.Acquire.fence_reset":0.733,"Vulkan.Acquire.retired_swapchains":0.446,"Vulkan.ComputePipeline":638.510,"Vulkan.Dispatch":3187.720,"Vulkan.Dispatch.command_record":572.416,"Vulkan.Dispatch.shader_resources":2605.115,"Vulkan.DispatchRecipe":164.437,"Vulkan.DispatchRecipe.command_record":163.711,"Vulkan.DrawFromRecipe":13.000,"Vulkan.Present":39.776,"Vulkan.Present.command_record_scale":23.516,"Vulkan.Present.pixel_upload":1.843,"Vulkan.Present.queue_submit":14.192,"Vulkan.QueuePresent":34.761,"Vulkan.QueuePresent.queue_present":34.361,"Vulkan.Retire":71.917,"Vulkan.Retire.wait":68.356},"top_phases_ms_per_frame":{"Driver.Packet":389.088,"Driver.Packet.dispatch":371.740,"Driver.Dispatch":371.576,"Driver.SplitLookup":358.766,"Driver.SplitDispatch":351.298,"Recorder.Sync":256.390,"Vulkan.Dispatch":12.700,"Driver.Packet.draw":11.500},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":737,"Graphics.Barrier.dcc-clear":872,"Graphics.Barrier.dcc-keys":712,"Graphics.Barrier.dispatch-lead":27963,"Graphics.Barrier.dispatch-trail":20422,"Graphics.Barrier.draw":22154,"Graphics.Barrier.indirect-args":8586,"Graphics.Barrier.label-run":18166,"Graphics.Barrier.present-blit":501,"Graphics.Barrier.shadow-publish":1241,"Graphics.Barrier.staging-in":10261,"Graphics.Barrier.staging-out":4848,"Graphics.Barrier.storage-upload":12728,"Graphics.Barrier.storage-writeback":15734,"Graphics.BarrierMerged.dispatch-lead":9631,"Graphics.BarrierMerged.label-run":74,"Graphics.BarrierMerged.shadow-publish":967,"Graphics.BarrierMerged.staging-in":4284,"Graphics.BarrierMerged.staging-out":4848,"Graphics.BarrierMerged.storage-writeback":5751,"Graphics.Copy":11339,"Graphics.Copy.bytes":11081882944,"Graphics.RenderPass":10324,"Graphics.RenderPass.Close.command":8521,"Graphics.RenderPass.Close.image":484,"Graphics.RenderPass.Close.key":224,"Graphics.RenderPass.Close.label":74,"Graphics.RenderPass.Close.new-batch":1019,"Graphics.RenderPass.Continued":37961},"trace_dropped":false,"trace":"aps5-trace-e2c5cb724bb5-11128.json.gz"}
tools/trace_digest.py, `APS5_KEEP_SPECIALIZED_MIB` unset (first lines)

237 frames over 13243.8 ms (no summary line found)

Slowest frames (largest slices inside each, inclusive)

  • present 7180: 2075.3 ms at 11169 ms: Driver.WorkerWait (queue worker 0x50) 2075.2, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x50) 2075.2, Driver.WorkerWait (queue worker 0x23) 2074.8, Driver.WorkerWait (queue worker 0x2b) 2074.1
  • present 6965: 473.9 ms at 2332 ms: Driver.WorkerWait (queue worker 0x2a) 473.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x2a) 473.9, Driver.WorkerWait (queue worker 0x23) 473.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x23) 473.9
  • present 7179: 244.6 ms at 10924 ms: Driver.WorkerWait (queue worker 0x4b) 244.6, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x4b) 244.6, Driver.WorkerWait (queue worker 0x23) 244.4, Driver.WorkerWait (queue worker 0x50) 244.3
  • present 7138: 168.1 ms at 8655 ms: Driver.WorkerWait (queue worker 0x23) 168.1, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x23) 168.1, Driver.WorkerWait (queue worker 0x2b) 168.1, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x2b) 168.1
  • present 7147: 159.8 ms at 9152 ms: Driver.WorkerWait (queue worker 0x4a) 159.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x4a) 159.8, Driver.WorkerWait (queue worker 0x4b) 159.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x4b) 159.8

Persistent spikes (frame time above the fastest frame that separates it from a longer frame; one entry per stall, not per frame)

  • present 7180: 2075.3 ms at 11169 ms, persistence 2072.2 ms
  • present 6965: 473.9 ms at 2332 ms, persistence 470.8 ms
  • present 7138: 168.1 ms at 8655 ms, persistence 144.5 ms
  • present 7147: 159.8 ms at 9152 ms, persistence 130.8 ms
  • present 6947: 133.1 ms at 390 ms, persistence 118.0 ms
  • present 7167: 137.9 ms at 10147 ms, persistence 102.5 ms
  • present 7049: 75.0 ms at 5619 ms, persistence 49.8 ms
  • present 7134: 66.8 ms at 8497 ms, persistence 40.6 ms
  • present 7145: 73.3 ms at 9040 ms, persistence 33.8 ms
  • present 7143: 67.0 ms at 8939 ms, persistence 33.1 ms

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0 Vulkan.ComputePipeline 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0 Vulkan.ComputePipeline 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0 Vulkan.ComputePipeline 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0 Vulkan.ComputePipeline 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0 Vulkan.ComputePipeline 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0 Vulkan.ComputePipeline 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 55.9 0.0
queue worker 0x0 25.5 (46 %) 28.1 (50 %) 2.3 7.4 Driver.Packet 25.3, Driver.Rewind 0.2
queue worker 0x51 0.1 (0 %) 55.7 (100 %) 0.1 0.0 Driver.Packet 2.5, Driver.EndSubmission 0.4
tools/trace_digest.py, `APS5_KEEP_SPECIALIZED_MIB=1024` (first lines)

250 frames over 14274.0 ms (no summary line found)

Slowest frames (largest slices inside each, inclusive)

  • present 7487: 2315.1 ms at 11959 ms: Driver.WorkerWait (queue worker 0x23) 2314.8, Driver.WorkerWait (queue worker 0x2b) 2313.4, Driver.WorkerWait (queue worker 0x2a) 2306.6, Driver.WorkerWait (queue worker 0x50) 2291.0
  • present 7259: 473.0 ms at 2401 ms: Driver.WorkerWait (queue worker 0x2a) 473.0, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x2a) 473.0, Driver.WorkerWait (queue worker 0x23) 473.0, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x23) 473.0
  • present 7486: 245.1 ms at 11714 ms: Driver.WorkerWait (queue worker 0x4b) 245.1, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x4b) 245.1, Driver.WorkerWait (queue worker 0x50) 244.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x50) 244.8
  • present 7453: 226.8 ms at 9608 ms: Driver.WorkerWait (queue worker 0x4a) 226.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x4a) 226.8, Driver.WorkerWait (queue worker 0x4b) 226.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x4b) 226.8
  • present 7433: 183.8 ms at 8744 ms: Driver.WorkerWait (queue worker 0x23) 183.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x23) 183.8, Driver.WorkerWait (queue worker 0x2b) 183.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x2b) 183.8

Persistent spikes (frame time above the fastest frame that separates it from a longer frame; one entry per stall, not per frame)

  • present 7487: 2315.1 ms at 11959 ms, persistence 2302.7 ms
  • present 7259: 473.0 ms at 2401 ms, persistence 448.6 ms
  • present 7453: 226.8 ms at 9608 ms, persistence 196.0 ms
  • present 7433: 183.8 ms at 8744 ms, persistence 158.4 ms
  • present 7240: 149.0 ms at 274 ms, persistence 136.7 ms
  • present 7476: 169.3 ms at 10989 ms, persistence 125.3 ms
  • present 7472: 121.7 ms at 10554 ms, persistence 63.3 ms
  • present 7429: 68.5 ms at 8593 ms, persistence 43.5 ms
  • present 7438: 68.4 ms at 9043 ms, persistence 42.4 ms
  • present 7468: 65.5 ms at 10395 ms, persistence 34.3 ms

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0 Vulkan.ComputePipeline 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0 Vulkan.ComputePipeline 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0 Vulkan.ComputePipeline 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0 Vulkan.ComputePipeline 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0 Vulkan.ComputePipeline 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0 Vulkan.ComputePipeline 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0 Vulkan.ComputePipeline 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0
shader prepare 0.0 (0 %) 0.0 (0 %) 57.1 0.0
queue worker 0x50 0.3 (1 %) 56.7 (99 %) 0.1 0.2 Driver.Packet 1.8, Driver.EndSubmission 0.4
queue worker 0x0 27.3 (48 %) 27.6 (48 %) 2.2 7.4 Driver.Packet 27.1, Driver.Rewind 0.2

AI-assisted: yes

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@Remi-Bon GCC on Linux stopped at the budget lambda: return 0ull; deduces unsigned long long and the other return std::uint64_t, which is unsigned long there (MSVC accepts both, so Windows passed). I pushed 845546c, which returns std::uint64_t{0}; nothing else changes. Recompiler.cpp builds with GCC here.

@github-actions

github-actions Bot commented Nov 23, 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 19852 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L13453
PR 26800 core/shader/recompiler/Recompiler.cpp L1125

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 1896 docs/dev/ENVIRONMENT.md
PR 4472 docs/dev/ENVIRONMENT.md
PR 5371 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 5609 core/shader/recompiler/Recompiler.cpp
PR 6186 docs/dev/ENVIRONMENT.md
PR 6235 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6412 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
PR 6488 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
PR 6924 core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 7275 docs/dev/ENVIRONMENT.md
PR 7642 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_shader_memory_tests.cmake
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 7643 docs/dev/ENVIRONMENT.md
PR 7684 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 9289 docs/dev/ENVIRONMENT.md
PR 9345 docs/dev/ENVIRONMENT.md
PR 9356 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 9387 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 9508 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 9712 docs/dev/ENVIRONMENT.md
PR 9852 core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 9897 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_shader_memory_tests.cmake
core/shader/recompiler/Recompiler.cpp
PR 10193 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_shader_memory_tests.cmake
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 10359 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
PR 10442 docs/dev/ENVIRONMENT.md
PR 10652 core/shader/recompiler/Recompiler.cpp
PR 10894 docs/dev/ENVIRONMENT.md
PR 11435 docs/dev/ENVIRONMENT.md
PR 11436 docs/dev/ENVIRONMENT.md
PR 11483 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
PR 11551 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
PR 12324 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 12746 docs/dev/ENVIRONMENT.md
PR 12828 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
PR 12840 core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 12849 docs/dev/ENVIRONMENT.md
PR 12944 core/shader/recompiler/Recompiler.cpp
PR 13863 docs/dev/ENVIRONMENT.md
PR 13920 docs/dev/ENVIRONMENT.md
PR 13928 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_shader_memory_tests.cmake
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 13929 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_shader_memory_tests.cmake
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 14032 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_shader_memory_tests.cmake
core/shader/recompiler/Recompiler.cpp
PR 14262 docs/dev/ENVIRONMENT.md
PR 14853 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_shader_memory_tests.cmake
core/shader/recompiler/Recompiler.cpp
PR 14944 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_shader_memory_tests.cmake
core/shader/recompiler/Recompiler.cpp
PR 15456 docs/dev/ENVIRONMENT.md
PR 15548 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 15570 docs/dev/ENVIRONMENT.md
PR 16217 docs/dev/ENVIRONMENT.md
PR 16260 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 16391 core/shader/recompiler/Recompiler.cpp
PR 16793 docs/dev/ENVIRONMENT.md
PR 16831 docs/dev/ENVIRONMENT.md
PR 17056 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
PR 17557 docs/dev/ENVIRONMENT.md
PR 17719 docs/dev/ENVIRONMENT.md
PR 17729 docs/dev/ENVIRONMENT.md
PR 18173 docs/dev/ENVIRONMENT.md
PR 18226 docs/dev/ENVIRONMENT.md
PR 18390 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 19697 docs/dev/ENVIRONMENT.md
PR 20030 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
PR 20111 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
PR 20172 docs/dev/ENVIRONMENT.md
PR 20248 core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 20315 docs/dev/ENVIRONMENT.md
PR 20519 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 21225 docs/dev/ENVIRONMENT.md
PR 21238 docs/dev/ENVIRONMENT.md
PR 21649 docs/dev/ENVIRONMENT.md
PR 22071 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 22190 docs/dev/ENVIRONMENT.md
PR 22424 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 22434 docs/dev/ENVIRONMENT.md
PR 22546 docs/dev/ENVIRONMENT.md
PR 22647 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_shader_memory_tests.cmake
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 22692 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 22724 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 23242 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_shader_memory_tests.cmake
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 23243 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 23244 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 23975 docs/dev/ENVIRONMENT.md
PR 24327 docs/dev/ENVIRONMENT.md
PR 24445 docs/dev/ENVIRONMENT.md
PR 24631 docs/dev/ENVIRONMENT.md
PR 24661 docs/dev/ENVIRONMENT.md
PR 25010 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
PR 25443 docs/dev/ENVIRONMENT.md
PR 26165 docs/dev/ENVIRONMENT.md
PR 26582 docs/dev/ENVIRONMENT.md
PR 26613 docs/dev/ENVIRONMENT.md
PR 26913 docs/dev/ENVIRONMENT.md
PR 27133 docs/dev/ENVIRONMENT.md

@Remi-Bon

Copy link
Copy Markdown
Contributor Author

@Helldiverr @MarcZX10 Addressed in f560d7b (pushed before 845546c, thanks @oneandonlydean for the GCC return-type fix).

  • Test gap: verifySpecializedModuleRelease now has a kept mode as well, with tests agc_shader_specialized_module_release and agc_shader_specialized_module_release_kept, so agc_shader_memory no longer fails with APS5_KEEP_SPECIALIZED_MIB set.
  • Budget edge cases: the value is parsed with strtoull and an end pointer, anything that is not a plain number throws, and the byte count is capped at max >> 20 MiB before the shift, so it cannot overflow.
  • Speed: the capture is in the comment above. It is an A/B inside a downstream tree because main alone does not reach the Café scene (feat(agc): render layered draws into a depth view of several slices #7256), and it shows no measurable gain. This PR is a memory/reuse change, not a claimed speed-up.

Not covered: the same SharedSpirv entering the ring more than once, so the ring holds at most the budget, not exactly the budget.

@Helldiverr

Copy link
Copy Markdown
Contributor

Recheck of 845546c: the code and the new tests match the reply, but none of the shader-memory tests could run on this host, so the GPU part is not done. The budget parser, copied into a small program, rejects 12x and caps large values. It also accepts some values that are not plain decimal numbers.

Remi-Bon, thanks for the update. Here is what this host could check, and what it could not.

Not run on this host

Windows Defender removes agc_shader_memory_tests.exe right after it links: the post-link objcopy step fails with Invalid argument, and then the file is gone. This happens on main and on the merge alike, so it is not caused by the PR. Our earlier run at 2a16f18 used this executable, and it now fails the same way here. So the following were not run:

  • agc_shader_memory with and without APS5_KEEP_SPECIALIZED_MIB;
  • the two new tests;
  • the validation-layer runs.

A run on another Windows host or on Linux would cover them.

Read at the head

  • Test gap. verifySpecializedModuleRelease (core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp:441) and verifyLayerSpecializationRelease (:489) now expect the words to be kept exactly when APS5_KEEP_SPECIALIZED_MIB is set. After that, both call Recompile again and check that the specialization ID and the words did not change (:442-446, :490-494). The earlier _kept early return is gone, so the identity check now also runs in kept mode. That covers the second point of our earlier comment.
  • New tests. core/libs/prx/libSceAgcDriver/tests/cmake/agc_shader_memory_tests.cmake:138-141 adds agc_shader_specialized_module_release and agc_shader_specialized_module_kept. The second one runs with APS5_KEEP_SPECIALIZED_MIB=1. Your reply calls it agc_shader_specialized_module_release_kept, but the file names it agc_shader_specialized_module_kept.
  • tools/check_conventions.py --base 2bb04425d5 and tools/debt_fold.py --check pass on the merge.

Budget parser (measured outside the tree)

MarcZX10 first raised the budget edge cases. The lambda at core/shader/recompiler/Recompiler.cpp:1127-1134 was copied unchanged into a standalone program and built with the same WinLibs GCC 15.2. This tests only the parser, not the ring.

APS5_KEEP_SPECIALIZED_MIB result
0 budget 0
1, 1024 1 MiB, 1024 MiB
12x, 5 (trailing space), 08, empty throws must be a whole number of MiB
5 (leading space), 5 after a leading tab 5 MiB
+3 3 MiB
0x10 16 MiB (hex)
010 8 MiB (octal)
-1 17592186044415 MiB, the cap
17592186044415 (2^44 − 1) 17592186044415 MiB
17592186044416 (2^44), 18446744073709551615 (2^64 − 1) capped at 17592186044415 MiB
18446744073709551616 (2^64) capped at 17592186044415 MiB (strtoull sets ERANGE)
  • Overflow. The cap at max >> 20 holds: no input wraps the byte count.
  • Other accepted values. 12x and other trailing text throw. But "anything that is not a plain number throws" does not hold for base 0. Leading whitespace, a sign, hex and octal are accepted. -1 wraps to an unlimited budget, and 010 means 8. The docs/dev/ENVIRONMENT.md row says "a whole number". Base 10, together with rejecting a leading - and whitespace, would make the parser match that.

Inferred, not run

  • APS5_KEEP_SPECIALIZED_MIB=0. docs/dev/ENVIRONMENT.md says 0 holds nothing, and keepSpecializedWords returns early when the budget is 0 (Recompiler.cpp:1135). The tests at ShaderMemory.cpp:441 and :489 only check whether the variable is set, so with =0 they would expect a kept module and fail. Not run here, for the reason above.
  • Ring size. The ring can hold the same SharedSpirv more than once, which your reply lists under "Not covered". This matches our earlier comment.

Speed

As your reply says, the capture shows no measurable gain, and the PR is a memory and reuse change, not a speed claim. Speed was not measured here.

Existing runs

  • Doorriiaann ran NVIDIA on Linux at an earlier head.
  • oneandonlydean reported the GCC return-type error that f560d7b fixes.
  • The CI relinker jobs (Linux, macOS, Windows) and the conventions check pass at 845546c.

Host

  • GPU: AMD Radeon AI PRO R9700 (gfx1201, 1002:7551), driver 32.0.31044.16, Vulkan 1.4.349 (not used: no GPU test ran)
  • CPU: Ryzen 9 9950X3D
  • OS: Windows 11 Pro 26300
  • Toolchain: WinLibs GCC 15.2, Release
  • Commits: head 845546c987, merged onto main 2bb04425d5 as c1c7a0c104

AI-assisted: yes

@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.

Reviewed — comments

The review covers all four changed files at the pinned head; no blocking defect was verified, but the budget parser has an edge case worth fixing.

What I ran

Reviewed head 845546c98763dc3dbfcd54c6767767814c74fc2f. Read the prepared description, commits, manifest, and diff, plus the changed source files and targeted repository context using repo_read.py tools. No build or tests were run; test results in the description are author-reported.

Results

Check Result Note
Source review passed Four changed files read
Build and tests not run Description reports 16/16 author-run tests

Findings

Blocking

None.

Non-blocking

  • core/shader/recompiler/Recompiler.cpp:1131 accepts a leading minus sign through strtoull; for example, -1 parses as a very large unsigned value and is capped to the maximum budget. This contradicts the setting’s documented whole-number MiB budget and can unexpectedly retain a very large amount of SPIR-V. Reject a leading sign (and consider explicitly requiring decimal digits) before parsing.

Not verified

No build, tests, or physical-console measurement was performed. The author-reported test run and validation-layer output were not independently verified. core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp was read only at the changed regions; other unchanged portions were not reviewed. The full file texts for the other three changed files were present in the review bundle, but only changed regions and relevant context were read.

To get this to a good state

Nothing is required. Optional: reject signed values for APS5_KEEP_SPECIALIZED_MIB so malformed input cannot silently become the maximum budget.

@oneandonlydean
oneandonlydean merged commit e37d122 into boykopovar:main Nov 25, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build docs perf numbers missing perf pull request without a before and after summary line perf Performance change shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants