Skip to content

perf(agc): read the import only for words a staged copy-back changes - #20292

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
AlexFigas:perf/agc-copy-back-reads-changed-words
Nov 15, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
AlexFigas:perf/agc-copy-back-reads-changed-words

Conversation

@AlexFigas

Copy link
Copy Markdown
Contributor

What

The changed-byte copy-back kernels (StagingCopyBack.comp, StagingCopyBackBound.comp) load the target word for every word of a staged range. The target is in the host import, in system memory. Where the shader changed no byte of a word, the kernel stores nothing and counts nothing, whatever the target holds. The kernels now return before that load for such words. What they store and count is unchanged.

APS5_CHANGED_COPY_ALWAYS still loads and stores every word. agc_changed_copy_always and agc_bound_changed_copy_always run the two existing copy-back tests with it set.

Tested

Windows 10.0.26300, AMD Ryzen 5 9600X, NVIDIA GeForce RTX 5070 Ti, driver 621.14, 2026-11-14. The title runs compare main 4aa2f8b694 with 6ac4cb33af (that main plus this commit). The head, deb34c9adc, is that commit rebased on e4742e6522, plus the Windows PATH setting for the two new tests; no commit in between touches the files this PR changes.

PPSA21564 01.007.000: over four alternating runs per side, the mean frame p50 went from 83.8 to 78.8 ms and the mean GPU busy time from 66.7 to 60.9 ms per present. Every run of the change was faster than every run of main.

  • Scene: -lvl timestop_casino, default settings, 3840x2160 output, caches warm. The window falls in the ship flight that opens the level, the only part of the level my runs reach before the device lost (next item). Input only to get there: from 10 to 27 s after start, Cross, then L2+R2 held for 3.5 s, about every 5 s (tools/pad_input.py). In every run the last 3.5 s hold was queued 25.9 s after start; the window starts 32 s after the first present, so more than 32 s after start. The flight follows the controller: of two runs of main with a frame dumped every 50 presents, the one with input to the end was about 100 presents further along (its dumps 16 and 17 match dumps 18 and 19 of the other; screenshots in the gist). Without input it flies on by itself, so the window measures the flight with no input.
  • Capture: APS5_TRACE_SECONDS=32:8 and APS5_TRACE_DIR, no other APS5_TRACE_* or APS5_PROFILE_* switch, log not redirected, ANYPS5_GPU=NVIDIA, ANYPS5_DISPLAY_INDEX=1, ANYPS5_VOLUME=0. The NVIDIA output reported 2560x1440 at 164 Hz. Order main, change, four times; no trace dropped events. Each run was stopped 62 s after start: the level ends in VK_ERROR_DEVICE_LOST on main too (4 runs on this machine ended with it, 75 to 123 s after start).
  • Local change on both sides, not part of this PR: libSceAudioPropagation.prx built from fix(libSceAudioPropagation): find no path without rays and set audio paths #19326 (head 43a3893170). With its own library main stopped at the level on the title's assert after sceAudioPropagationSourceCalculateAudioPaths failed : 0x8a700001 (one run on af13412d22, 51 s after start).
  • Only libSceAgcDriver.prx differs in behaviour between the two library sets. libc, libkernel and libSceVideoOut differ by the commit they embed for the run report, libSceJson2 by its link timestamp only.
run commit presents frame p50 p90 p99 GPU busy per present
main 1 4aa2f8b69447 97 81.7 87.8 118.0 66.7
change 1 6ac4cb33afb6 102 77.6 83.3 86.5 60.7
main 2 4aa2f8b69447 95 84.2 89.2 113.2 67.0
change 2 6ac4cb33afb6 101 78.3 84.3 92.6 61.1
main 3 4aa2f8b69447 93 85.8 90.7 116.5 66.7
change 3 6ac4cb33afb6 102 78.3 82.9 85.9 60.6
main 4 4aa2f8b69447 96 83.6 88.7 113.0 66.4
change 4 6ac4cb33afb6 99 81.2 86.2 113.1 61.1

Summary lines of round 2 (all eight lines, the traces and their trace_digest.py output are in this gist):

{"commit":"4aa2f8b69447","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"32:8"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 621.14","os":"Windows 10.0.26300","cpu":"AMD Ryzen 5 9600X 6-Core Processor","cpu_threads":12,"memory_mib":31861,"title_id":"PPSA21564","title":"ASTRO BOT","content_version":"01.007.000","resolution":"3840x2160","window":{"spec":"seconds 32:8","first_present":790,"ms":8035.956},"presents":95,"frame_ms":{"p50":84.168,"p90":89.151,"p99":113.239,"max":113.239},"gpu_busy_ms_per_present":66.972,"worker_busy_pct":{"queue worker 0x0":97.698,"queue worker 0x40":99.209,"queue worker 0x48":95.660,"queue worker 0x46":1.621},"phase_totals_ms":{"Driver.Completion":9.173,"Driver.Dispatch":1140.884,"Driver.Dispatch.capture_resources":111.316,"Driver.Dispatch.decode_key_device_setup":20.101,"Driver.Dispatch.lookup_cache":17.473,"Driver.Dispatch.materialize":7.942,"Driver.Dispatch.prepared_invocation":6.307,"Driver.Draw":4019.003,"Driver.Draw.device_setup":173.243,"Driver.Draw.draw_enqueued":1235.830,"Driver.Draw.post_compile_prepare":28.418,"Driver.Draw.prepare":490.758,"Driver.Draw.shader_compile_and_link":1947.864,"Driver.EndSubmission":100.712,"Driver.Packet":23530.935,"Driver.Packet.device_lock":45.874,"Driver.Packet.dispatch":1632.428,"Driver.Packet.draw":4064.279,"Driver.Packet.execute":208.564,"Driver.Packet.flip_flush":3.592,"Driver.Packet.flush_between_packets":230.712,"Driver.Packet.memory_wait":14697.921,"Driver.Packet.pipeline_drain":140.005,"Driver.Packet.pipeline_prepare":62.427,"Driver.Packet.prepare_memory":1674.758,"Driver.Packet.rendering_wait":0.113,"Driver.Present":57.600,"Driver.Present.acquire_image":1.363,"Driver.Present.device_setup":0.041,"Driver.Present.gpu_mutex_wait":0.396,"Driver.Present.inflight_wait":0.245,"Driver.Present.present_display_buffer":14.428,"Driver.Present.queue_present":35.089,"Driver.Present.release_and_callback":0.103,"Driver.Present.render_fence_wait":5.689,"Driver.Present.resize":0.164,"Driver.Present.validate":0.034,"Driver.Suspend":0.066,"GpuMutex.wait.dispatch":102.161,"GpuMutex.wait.draw":358.411,"GpuMutex.wait.end":16.698,"GpuMutex.wait.fill":1.490,"GpuMutex.wait.flush":1.803,"GpuMutex.wait.hook":24.946,"GpuMutex.wait.indirect":0.029,"GpuMutex.wait.label":73.879,"GpuMutex.wait.present":0.171,"GpuMutex.wait.wait":3.284,"Graphics.Draw":3113.249,"Graphics.Draw.draw_and_resource_release":2491.932,"Graphics.Draw.index_upload":156.862,"Graphics.Draw.validate":169.379,"Graphics.Draw.vertex_upload":180.222,"Graphics.DrawWithRecipe":506.541,"Graphics.DrawWithRecipe.draw_and_resource_release":475.911,"Graphics.DrawWithRecipe.index_upload":3.929,"Graphics.DrawWithRecipe.validate":12.996,"Graphics.DrawWithRecipe.vertex_upload":9.226,"Recorder.Reap":204.724,"Recorder.Submit":295.233,"Recorder.WaitSerial":1184.787,"Resources.Complete":85.113,"Resources.Prepare":130.047,"Shader.DrawStage":1406.019,"Shader.DrawStage.capture_resources":970.171,"Shader.DrawStage.materialize":264.352,"Shader.DrawStage.prepared_invocation":153.663,"Shader.PrepareArtifact":0.010,"Shader.ResolveAbi":15.851,"Shader.ResolveGraphicsAbi":5.158,"Shader.ResolveGraphicsStagesAbi":90.834,"VideoOut.Flip":71.705,"VideoOut.Flip.completion_mutex_wait":0.113,"VideoOut.Flip.config_mutex_wait":0.008,"VideoOut.Flip.frame_limit":0.057,"VideoOut.Flip.notify_game":8.470,"VideoOut.Flip.present":56.888,"VideoOut.Flip.validate":0.102,"VideoOut.Flip.vblank_wait":0.060,"VideoOut.Flip.window_prepare":0.143,"VideoOut.Flip.window_title":5.773,"VideoOut.Readiness":0.234,"VideoOut.Readiness.locks_validate":0.090,"Vulkan.Acquire":1.264,"Vulkan.Acquire.acquire_fence_wait":0.166,"Vulkan.Acquire.acquire_image":0.853,"Vulkan.Acquire.fence_reset":0.175,"Vulkan.Acquire.retired_swapchains":0.042,"Vulkan.Dispatch":427.130,"Vulkan.Dispatch.command_record":107.965,"Vulkan.Dispatch.shader_resources":317.566,"Vulkan.DispatchRecipe":37.733,"Vulkan.DispatchRecipe.command_record":37.521,"Vulkan.DrawFromRecipe":520.405,"Vulkan.Present":10.091,"Vulkan.Present.command_record_scale":4.352,"Vulkan.Present.pixel_upload":0.220,"Vulkan.Present.queue_submit":5.442,"Vulkan.QueuePresent":34.950,"Vulkan.QueuePresent.queue_present":34.802,"Vulkan.Retire":5.654,"Vulkan.Retire.wait":4.029},"top_phases_ms_per_frame":{"Driver.Packet":247.694,"Driver.Packet.memory_wait":154.715,"Driver.Packet.draw":42.782,"Driver.Draw":42.305,"Graphics.Draw":32.771,"Graphics.Draw.draw_and_resource_release":26.231,"Driver.Draw.shader_compile_and_link":20.504,"Driver.Packet.prepare_memory":17.629},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":1140,"Graphics.Barrier.dcc-clear":950,"Graphics.Barrier.dcc-keys":950,"Graphics.Barrier.dispatch-lead":8811,"Graphics.Barrier.dispatch-trail":8455,"Graphics.Barrier.draw":232759,"Graphics.Barrier.fill":2666,"Graphics.Barrier.fill-clear":1520,"Graphics.Barrier.indirect-args":665,"Graphics.Barrier.label-run":27322,"Graphics.Barrier.present-blit":190,"Graphics.Barrier.shadow-publish":570,"Graphics.Barrier.staging-in":11622,"Graphics.Barrier.staging-out":5014,"Graphics.Barrier.storage-upload":3420,"Graphics.Barrier.storage-writeback":15771,"Graphics.BarrierMerged.dispatch-lead":974,"Graphics.BarrierMerged.fill":750,"Graphics.BarrierMerged.label-run":58,"Graphics.BarrierMerged.shadow-publish":380,"Graphics.BarrierMerged.staging-in":3610,"Graphics.BarrierMerged.staging-out":5014,"Graphics.BarrierMerged.storage-writeback":2451,"Graphics.Copy":64492,"Graphics.Copy.bytes":46502897056,"Graphics.RenderPass":50913,"Graphics.RenderPass.Close.command":47024,"Graphics.RenderPass.Close.image":253,"Graphics.RenderPass.Close.key":269,"Graphics.RenderPass.Close.label":58,"Graphics.RenderPass.Close.new-batch":3309,"Graphics.RenderPass.Continued":201644},"trace_dropped":false,"trace":"aps5-trace-4aa2f8b69447-852.json.gz"}
{"commit":"6ac4cb33afb6","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"32:8"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 621.14","os":"Windows 10.0.26300","cpu":"AMD Ryzen 5 9600X 6-Core Processor","cpu_threads":12,"memory_mib":31861,"title_id":"PPSA21564","title":"ASTRO BOT","content_version":"01.007.000","resolution":"3840x2160","window":{"spec":"seconds 32:8","first_present":796,"ms":8025.189},"presents":101,"frame_ms":{"p50":78.269,"p90":84.308,"p99":92.555,"max":107.611},"gpu_busy_ms_per_present":61.092,"worker_busy_pct":{"queue worker 0x0":97.658,"queue worker 0x40":99.223,"queue worker 0x48":95.466,"queue worker 0x46":1.653},"phase_totals_ms":{"Driver.Completion":9.416,"Driver.Dispatch":1203.041,"Driver.Dispatch.capture_resources":111.445,"Driver.Dispatch.decode_key_device_setup":18.888,"Driver.Dispatch.lookup_cache":18.000,"Driver.Dispatch.materialize":8.337,"Driver.Dispatch.prepared_invocation":6.503,"Driver.Draw":4164.892,"Driver.Draw.device_setup":172.522,"Driver.Draw.draw_enqueued":1318.477,"Driver.Draw.post_compile_prepare":28.809,"Driver.Draw.prepare":497.198,"Driver.Draw.shader_compile_and_link":2000.811,"Driver.EndSubmission":109.576,"Driver.Packet":23474.995,"Driver.Packet.device_lock":48.398,"Driver.Packet.dispatch":1717.020,"Driver.Packet.draw":4209.080,"Driver.Packet.execute":214.809,"Driver.Packet.flip_flush":3.676,"Driver.Packet.flush_between_packets":261.057,"Driver.Packet.memory_wait":14589.588,"Driver.Packet.pipeline_drain":142.649,"Driver.Packet.pipeline_prepare":65.292,"Driver.Packet.prepare_memory":1413.458,"Driver.Packet.rendering_wait":0.211,"Driver.Present":61.701,"Driver.Present.acquire_image":1.427,"Driver.Present.device_setup":0.041,"Driver.Present.gpu_mutex_wait":0.402,"Driver.Present.inflight_wait":0.255,"Driver.Present.present_display_buffer":15.286,"Driver.Present.queue_present":36.536,"Driver.Present.release_and_callback":0.103,"Driver.Present.render_fence_wait":7.402,"Driver.Present.resize":0.168,"Driver.Present.validate":0.032,"Driver.Suspend":0.034,"GpuMutex.wait.dispatch":121.729,"GpuMutex.wait.draw":396.639,"GpuMutex.wait.end":23.363,"GpuMutex.wait.fill":1.700,"GpuMutex.wait.flush":2.537,"GpuMutex.wait.hook":46.378,"GpuMutex.wait.label":75.841,"GpuMutex.wait.other":0.001,"GpuMutex.wait.present":0.220,"GpuMutex.wait.wait":3.917,"Graphics.Draw":3269.286,"Graphics.Draw.draw_and_resource_release":2588.329,"Graphics.Draw.index_upload":165.539,"Graphics.Draw.validate":179.405,"Graphics.Draw.vertex_upload":192.357,"Graphics.DrawWithRecipe":497.004,"Graphics.DrawWithRecipe.draw_and_resource_release":466.504,"Graphics.DrawWithRecipe.index_upload":3.794,"Graphics.DrawWithRecipe.validate":13.278,"Graphics.DrawWithRecipe.vertex_upload":8.883,"Recorder.Reap":202.714,"Recorder.Submit":307.465,"Recorder.WaitSerial":859.877,"Resources.Complete":98.370,"Resources.Prepare":133.259,"Shader.DrawStage":1444.182,"Shader.DrawStage.capture_resources":995.201,"Shader.DrawStage.materialize":277.590,"Shader.DrawStage.prepared_invocation":152.937,"Shader.PrepareArtifact":0.009,"Shader.ResolveAbi":16.395,"Shader.ResolveGraphicsAbi":5.112,"Shader.ResolveGraphicsStagesAbi":93.385,"VideoOut.Flip":70.969,"VideoOut.Flip.completion_mutex_wait":0.114,"VideoOut.Flip.config_mutex_wait":0.007,"VideoOut.Flip.frame_limit":0.054,"VideoOut.Flip.notify_game":3.655,"VideoOut.Flip.present":61.226,"VideoOut.Flip.validate":0.114,"VideoOut.Flip.vblank_wait":0.070,"VideoOut.Flip.window_prepare":0.150,"VideoOut.Flip.window_title":5.506,"VideoOut.Readiness":0.244,"VideoOut.Readiness.locks_validate":0.096,"Vulkan.Acquire":1.320,"Vulkan.Acquire.acquire_fence_wait":0.174,"Vulkan.Acquire.acquire_image":0.892,"Vulkan.Acquire.fence_reset":0.179,"Vulkan.Acquire.retired_swapchains":0.043,"Vulkan.Dispatch":453.003,"Vulkan.Dispatch.command_record":111.674,"Vulkan.Dispatch.shader_resources":339.527,"Vulkan.DispatchRecipe":37.938,"Vulkan.DispatchRecipe.command_record":37.710,"Vulkan.DrawFromRecipe":511.011,"Vulkan.Present":10.654,"Vulkan.Present.command_record_scale":4.543,"Vulkan.Present.pixel_upload":0.235,"Vulkan.Present.queue_submit":5.796,"Vulkan.QueuePresent":36.395,"Vulkan.QueuePresent.queue_present":36.248,"Vulkan.Retire":7.370,"Vulkan.Retire.wait":5.864},"top_phases_ms_per_frame":{"Driver.Packet":232.426,"Driver.Packet.memory_wait":144.451,"Driver.Packet.draw":41.674,"Driver.Draw":41.237,"Graphics.Draw":32.369,"Graphics.Draw.draw_and_resource_release":25.627,"Driver.Draw.shader_compile_and_link":19.810,"Driver.Packet.dispatch":17.000},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":1212,"Graphics.Barrier.dcc-clear":1010,"Graphics.Barrier.dcc-keys":1010,"Graphics.Barrier.dispatch-lead":9368,"Graphics.Barrier.dispatch-trail":8989,"Graphics.Barrier.draw":231070,"Graphics.Barrier.fill":2838,"Graphics.Barrier.fill-clear":1616,"Graphics.Barrier.indirect-args":707,"Graphics.Barrier.label-run":28838,"Graphics.Barrier.present-blit":202,"Graphics.Barrier.shadow-publish":606,"Graphics.Barrier.staging-in":12345,"Graphics.Barrier.staging-out":5336,"Graphics.Barrier.storage-upload":3636,"Graphics.Barrier.storage-writeback":16766,"Graphics.BarrierMerged.dispatch-lead":1035,"Graphics.BarrierMerged.fill":798,"Graphics.BarrierMerged.label-run":29,"Graphics.BarrierMerged.shadow-publish":404,"Graphics.BarrierMerged.staging-in":3865,"Graphics.BarrierMerged.staging-out":5336,"Graphics.BarrierMerged.storage-writeback":2626,"Graphics.Copy":64737,"Graphics.Copy.bytes":49528344024,"Graphics.RenderPass":51033,"Graphics.RenderPass.Close.command":46652,"Graphics.RenderPass.Close.image":572,"Graphics.RenderPass.Close.key":279,"Graphics.RenderPass.Close.label":29,"Graphics.RenderPass.Close.new-batch":3501,"Graphics.RenderPass.Continued":211624},"trace_dropped":false,"trace":"aps5-trace-6ac4cb33afb6-22896.json.gz"}

One more run per side with APS5_PROFILE_GPU=1 (input to 35 s after start, stopped 59 s after start), not part of the comparison: in the three 10 s windows inside the level, the staging-out class took 8.5, 9.3 and 9.4 ms per present on main and 3.7, 4.4 and 4.3 ms with the change. Its copy-back ranges covered 222 to 235 MiB per present on both sides; the traffic itself was not measured. The other classes stayed within 1 ms per present. The [gputime] lines are in the gist.

Tests:

  • tools/select_tests.py for the four changed files: 2969 tests on the change and 2967 on main (the change adds two). The same three fail on both: pr_overlap_tools, conventions_doc_links, and agc_driver_upload_cache_read_only_flush, which does not build on Windows (setenv; fix(tests): set the upload cache test's environment with _putenv_s on Windows #19899 is open for it).
  • ctest -R 'changed_copy|staging|copy_back|copied_write' -V on 4aa2f8b694 and e4742e6522 (15 tests) and on 6ac4cb33af and deb34c9adc (17, with the two new ones), with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer, implicit layers disabled, validation layer 1.4.368: all pass in all four. agc_adaptive_staging and agc_buffer_pool_small_device_no_staging make no Vulkan instance; every other test's log shows Insert instance layer "VK_LAYER_KHRONOS_validation". No log shows was not found or any VUID- message.
  • agc_changed_copy and agc_bound_changed_copy check every word and the counter, including words the shader left alone and the CPU changed. Four wrong early returns in each kernel (return when changed, return always, return unless the whole word changed, return without checking always) each fail at least one of that kernel's two tests; the commit passes them.

tools/pr_overlap.py --branch found no overlap with the 61 open PRs it could merge. It could not compare 36 that conflict with main and share the test files; I read their diffs, and none has a hunk in the two changed-copy tests. One of them, #6186, also lists StagingCopyBack.comp, but its copy is the file main already has (blob a950cfef8d).

Not covered: other GPUs, Linux, and other titles. How many words the kernels skip was not counted.

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: NVIDIA GeForce RTX 5070 Ti, driver 621.14, Windows 10.0.26300
  • AI-assisted: yes

The changed-byte copy-back kernels read the target word, which lies in the host import, for every word of the range. Where the shader changed no byte of a word nothing is stored and nothing is counted, whatever the target holds, so the kernels now return before that read. APS5_CHANGED_COPY_ALWAYS still stores every word; the copy-back tests now also run with it set.
@github-actions github-actions Bot added the perf Performance change label Nov 15, 2026

@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 — looks good

Nothing blocks this change; the optional performance evidence is noted below.

What I ran

Reviewed head deb34c9adc3bb167149f36de8a93aad9ab000a2d. No commands or tests were run; I reviewed the prepared diff and targeted source ranges using repo_read.py.

Results

Check Result Note
Changed shader logic passed Early return preserves always-copy path
Test additions passed Always-copy expectation and CTest setup inspected
Runtime checks not run Results in the description are author-reported

Findings

Blocking

None.

Non-blocking

  • The reported performance comparison and test results are author-provided; I did not independently run or inspect their traces.

Not verified

  • Read: StagingCopyBack.comp, StagingCopyBackBound.comp, Recorder.cpp lines 1115–1245, and agc_driver_recorder_tests.cmake lines 385–405.
  • Excluded: full Recorder.cpp beyond the targeted range and all unchanged repository files. The prepared bundle lists all four changed files; the diff and relevant ranges were inspected.
  • Runtime behavior, test execution, and performance claims were not independently verified.

To get this to a good state

Nothing is required. The author-reported runtime and performance evidence is optional context.

@github-actions github-actions Bot added build agc libSceAgc* labels Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

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/tests/Recorder.cpp
PR 1395 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 4448 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 5925 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6186 core/libs/prx/libSceAgcDriver/Graphics/shaders/StagingCopyBack.comp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 6188 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6192 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6209 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 7642 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 9712 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 9852 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 10049 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 10193 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 10442 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 13251 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 13928 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 13929 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 13963 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 14262 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 15136 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 15529 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 15570 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 16831 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 18029 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 18076 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 18078 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 18082 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 18173 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 18369 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 18390 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 18515 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 19071 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 19100 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp

@tablefrogpillow

Copy link
Copy Markdown
Contributor

Verified on two real AMD generations with a negative control (Mesa 26.2.6, validation 1.4.363, ANYPS5_REQUIRE_VULKAN=1, GPU ids confirmed real, not llvmpipe). Shaders are glslang-compiled to embedded SPV with a DEPENDS on the .comp, so no stale-build risk (checksums tracked below).

Correctness — all four changed-copy tests, 2 runs/gen:

Test RDNA2 (RAPHAEL, gfx1036) RDNA3 (NAVI31, gfx1100)
agc_changed_copy PASS PASS
agc_bound_changed_copy PASS PASS
agc_changed_copy_always PASS PASS
agc_bound_changed_copy_always PASS PASS

The early-return is correctness-preserving — it fires only when changed == 0 && always == 0, exactly where stored = changed & ~kept is already 0, so the original stored nothing and only the target load is saved — and real AMD confirms it.

Negative control (proves the two new *_always tests guard the scoping): dropping the && parameters.always == 0u guard → if (changed == 0u) return; (wrongly fires in always-mode). SPV regenerated (StagingCopyBack_spv.h e89424ef→3d5898ab, StagingCopyBackBound_spv.h 346b5d83→6eaa892b, binary relinked). On RDNA2:

  • agc_changed_copy_always → FAIL: changed copy word 5: 387294069, expected 387276917
  • agc_bound_changed_copy_always → FAIL: bound changed copy word 1 … 2246822468, expected 2246822520
  • the two non-always tests still PASS.

Restoring the guard rebuilt the SPV back to the original checksums and all four pass again. So the always-mode tests fail precisely when the early-return is mis-scoped and pass when it isn't — they genuinely cover the path the optimization bypasses. Head at deb34c9.

AI-assisted: yes

@oneandonlydean
oneandonlydean merged commit 0f69b6b into boykopovar:main Nov 15, 2026
14 checks passed
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.

4 participants