perf(agc): read unit-shadow slabs in place for read-only address builds #24510

Open
ashwin280802 wants to merge 2 commits from upstream-pr/24510 into main
ashwin280802 commented 2026-11-20 18:17:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ashwin280802 on 2026-11-20T18:17:03Z.


What

Before an address-based build runs, GuestBufferMemory::UploadFinish copies every live unit-shadow unit over the mapped heaps from its slab into the host import ("address-based heaps"). On Platform 8 (PPSA24944) that copy took about 17 ms of GPU time per frame.

This PR skips that copy for a build that meets all three conditions:

  • its programs store through no address (bdaReadOnly);
  • it records no descriptor writes;
  • it is not a space-reuse candidate.

Instead, the live units are mapped read-only to their slab's device address in the build's BDA table. Slabs get SHADER_DEVICE_ADDRESS when the device supports it.

  • Descriptor reads over shadowed units are still published first.
  • The overlays are clipped to the table's coverage, so unmapped bytes still fault.
  • A build with overlays skips the cached address table and space reuse.
  • The read is recorded under GpuMutex into the same recorder and queue the copy used, and Recorder::Keep holds the slab.
  • Slab writers in StorageTexture::writeBackWindows record behind barriers with an ALL_COMMANDS source (Texture.cpp around lines 4528, 4553 and 4576).
  • Divergence: a retile recorded between UploadFinish and the draw is now seen by the draw. It is recorded in the debt file.
  • APS5_NO_SHADOW_READS=1 restores the copy.

Performance. Platform 8 (PPSA24944) in the idle scene from launch, an RTX 5070 with driver 621.24 at 3840x2160, audio muted. Six pairs of 150 s runs, alternating the order of main (907fe8fd31) and this patch, with the median of the last ten 10 s windows of each run:

pair 1: change 118 vs main 100 presents/10s (+18.6%), GPU busy 60.2 vs 75.2 ms
pair 2: change 114 vs main 52 presents/10s (+118.3%), GPU busy 63.5 vs 73.2 ms
pair 3: change 109 vs main 94 presents/10s (+16.6%), GPU busy 61.6 vs 76.6 ms
pair 4: change 106 vs main 92 presents/10s (+15.2%), GPU busy 62.5 vs 75.8 ms
pair 5: change 102 vs main 90 presents/10s (+13.9%), GPU busy 62.2 vs 77.1 ms
pair 6: change 105 vs main 92 presents/10s (+13.5%), GPU busy 62.7 vs 76.8 ms
6 pairs: mean +32.7%, median +15.9%, min +13.5%, sd 42.0, 95% CI -11.4% .. +76.7%

In pair 2 the main arm presented nothing for about 80 s before recovering (the same presents stall I saw in earlier arms of main), so its median is 52. Without that pair:

5 pairs: mean +15.6%, median +15.2%, min +13.5%, sd 2.1, 95% CI +13.0% .. +18.1%
GPU busy per frame: change mean 61.8 ms, main mean 76.3 ms (-14.5 ms)

Every pair is positive, GPU busy time per frame drops by 11 to 15 ms in every pair, and the gain is above 13% in each of the other five.

Performance trace. The measured commit is 164151fb99d9. The current head is the same commit rebased onto newer main: the two commits add and remove the same 297 lines in the same files. A 100 s capture of each build with APS5_TRACE_SECONDS=60:20, this host and scene, main first and the change second (the full tools/trace_digest.py output of both is in this gist; the traces are attached as main and the change, 6.7 and 7.3 MB):

  • seconds 60:20 from present 518: 200 presents, frame p50 98.8 / p90 106.6 / p99 133.5 / max 142.0 ms, GPU busy 74.5 ms per present
  • seconds 60:20 from present 560: 220 presents, frame p50 90.0 / p90 98.2 / p99 112.1 / max 123.7 ms, GPU busy 62.3 ms per present

Both traces overflowed their buffers (31,501 events lost on main, 115,680 on this patch), so the summary lines are the evidence and slice timings cover retained events only.

{"commit":"907fe8fd315c","dirty":false,"env":{"APS5_CRASH_INDIRECT_MEMORY":"1","APS5_LOG_TIMESTAMPS":"1","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_PROFILE_DRAW":"1","APS5_PROFILE_GPU":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_EXIT":"1","APS5_TRACE_SECONDS":"60:20","APS5_TRACE_SUMMARY_EVERY":"30"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 621.24","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i5-14600K","cpu_threads":20,"memory_mib":16147,"title_id":"PPSA24944","title":"Platform 8","content_version":"01.003.000","resolution":"3840x2160","window":{"spec":"seconds 60:20","first_present":518,"ms":20043.409},"presents":200,"frame_ms":{"p50":98.815,"p90":106.625,"p99":133.495,"max":142.020},"gpu_busy_ms_per_present":74.477,"worker_busy_pct":{"queue worker 0x0":96.248,"queue worker 0x20":81.476},"phase_totals_ms":{"Driver.Completion":10.739,"Driver.Dispatch":14804.190,"Driver.Dispatch.capture_resources":964.322,"Driver.Dispatch.decode_key_device_setup":5651.898,"Driver.Dispatch.lookup_cache":138.979,"Driver.Dispatch.materialize":91.183,"Driver.Dispatch.prepared_invocation":59.300,"Driver.Draw":1920.917,"Driver.Draw.device_setup":65.096,"Driver.Draw.draw_enqueued":361.733,"Driver.Draw.post_compile_prepare":18.000,"Driver.Draw.prepare":235.457,"Driver.Draw.shader_compile_and_link":1025.858,"Driver.EndSubmission":81.809,"Driver.Packet":35529.347,"Driver.Packet.device_lock":40.941,"Driver.Packet.dispatch":15357.251,"Driver.Packet.draw":1945.921,"Driver.Packet.execute":220.191,"Driver.Packet.flip_flush":8.213,"Driver.Packet.flush_between_packets":291.730,"Driver.Packet.memory_wait":13637.063,"Driver.Packet.pipeline_drain":3115.789,"Driver.Packet.pipeline_prepare":62.596,"Driver.Packet.prepare_memory":505.730,"Driver.Packet.rendering_wait":0.276,"Driver.Present":113.763,"Driver.Present.acquire_image":2.928,"Driver.Present.device_setup":0.108,"Driver.Present.gpu_mutex_wait":4.169,"Driver.Present.inflight_wait":0.461,"Driver.Present.present_display_buffer":32.995,"Driver.Present.queue_present":67.862,"Driver.Present.release_and_callback":0.180,"Driver.Present.render_fence_wait":4.389,"Driver.Present.resize":0.468,"Driver.Present.validate":0.052,"Driver.Suspend":0.138,"GpuMutex.wait.copy":0.000,"GpuMutex.wait.dispatch":212.670,"GpuMutex.wait.draw":183.868,"GpuMutex.wait.end":39.708,"GpuMutex.wait.fill":1064.403,"GpuMutex.wait.flush":14.413,"GpuMutex.wait.hook":162.091,"GpuMutex.wait.indirect":282.955,"GpuMutex.wait.label":178.488,"GpuMutex.wait.other":413.388,"GpuMutex.wait.present":3.604,"Graphics.Draw":2354.517,"Graphics.Draw.draw_and_resource_release":2012.232,"Graphics.Draw.index_upload":109.738,"Graphics.Draw.validate":108.456,"Graphics.Draw.vertex_upload":101.700,"Graphics.DrawWithRecipe":139.496,"Graphics.DrawWithRecipe.draw_and_resource_release":112.375,"Graphics.DrawWithRecipe.index_upload":14.032,"Graphics.DrawWithRecipe.validate":2.263,"Graphics.DrawWithRecipe.vertex_upload":2.588,"Recorder.Reap":121.939,"Recorder.Submit":444.920,"Recorder.Sync":1399.261,"Resources.Complete":2013.768,"Resources.Prepare":529.234,"Shader.DrawStage":780.068,"Shader.DrawStage.capture_resources":412.021,"Shader.DrawStage.materialize":254.567,"Shader.DrawStage.prepared_invocation":104.148,"VideoOut.Flip":174.301,"VideoOut.Flip.completion_mutex_wait":1.382,"VideoOut.Flip.config_mutex_wait":0.020,"VideoOut.Flip.frame_limit":0.101,"VideoOut.Flip.notify_game":22.570,"VideoOut.Flip.present":114.654,"VideoOut.Flip.validate":0.189,"VideoOut.Flip.vblank_wait":0.121,"VideoOut.Flip.window_prepare":0.409,"VideoOut.Flip.window_title":34.250,"VideoOut.Readiness":0.437,"VideoOut.Readiness.locks_validate":0.181,"Vulkan.Acquire":2.709,"Vulkan.Acquire.acquire_fence_wait":0.341,"Vulkan.Acquire.acquire_image":1.788,"Vulkan.Acquire.fence_reset":0.438,"Vulkan.Acquire.retired_swapchains":0.078,"Vulkan.Dispatch":4519.802,"Vulkan.Dispatch.command_record":689.490,"Vulkan.Dispatch.shader_resources":3811.619,"Vulkan.DispatchRecipe":130.722,"Vulkan.DispatchRecipe.command_record":129.566,"Vulkan.DrawFromRecipe":140.816,"Vulkan.Present":19.307,"Vulkan.Present.command_record_scale":7.667,"Vulkan.Present.pixel_upload":4.476,"Vulkan.Present.queue_submit":6.908,"Vulkan.QueuePresent":66.606,"Vulkan.QueuePresent.queue_present":66.264,"Vulkan.Retire":4.349,"Vulkan.Retire.wait":2.076},"top_phases_ms_per_frame":{"Driver.Packet":177.647,"Driver.Packet.dispatch":76.786,"Driver.Dispatch":74.021,"Driver.Packet.memory_wait":68.185,"Driver.Dispatch.decode_key_device_setup":28.259,"Vulkan.Dispatch":22.599,"Vulkan.Dispatch.shader_resources":19.058,"Driver.Packet.pipeline_drain":15.579},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":10547,"Graphics.Barrier.dcc-clear":23600,"Graphics.Barrier.dcc-keys":7786,"Graphics.Barrier.dispatch-lead":94382,"Graphics.Barrier.dispatch-trail":54818,"Graphics.Barrier.draw":79803,"Graphics.Barrier.fill":15294,"Graphics.Barrier.fill-clear":800,"Graphics.Barrier.indirect-args":26212,"Graphics.Barrier.input-mirror":272,"Graphics.Barrier.label-run":103067,"Graphics.Barrier.present-blit":400,"Graphics.Barrier.shadow-publish":18209,"Graphics.Barrier.staging-in":67488,"Graphics.Barrier.staging-out":32418,"Graphics.Barrier.storage-upload":25058,"Graphics.Barrier.storage-writeback":75694,"Graphics.BarrierMerged.copy":198,"Graphics.BarrierMerged.dispatch-lead":12860,"Graphics.BarrierMerged.fill":13108,"Graphics.BarrierMerged.label-run":534,"Graphics.BarrierMerged.shadow-publish":17803,"Graphics.BarrierMerged.staging-in":29766,"Graphics.BarrierMerged.staging-out":32418,"Graphics.BarrierMerged.storage-writeback":26186,"Graphics.Copy":81104,"Graphics.Copy.bytes":83069658524,"Graphics.RenderPass":26768,"Graphics.RenderPass.Close.command":20052,"Graphics.RenderPass.Close.image":3255,"Graphics.RenderPass.Close.key":981,"Graphics.RenderPass.Close.label":534,"Graphics.RenderPass.Close.new-batch":1946,"Graphics.RenderPass.Continued":34322},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":17.828,"events_lost":31501,"totals_full":false},"gpu":{"events_lost":104227,"totals_full":false}},"trace":"aps5-trace-907fe8fd315c-91224.json.gz"}
{"commit":"164151fb99d9","dirty":false,"env":{"APS5_CRASH_INDIRECT_MEMORY":"1","APS5_LOG_TIMESTAMPS":"1","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_PROFILE_DRAW":"1","APS5_PROFILE_GPU":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_EXIT":"1","APS5_TRACE_SECONDS":"60:20","APS5_TRACE_SUMMARY_EVERY":"30"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 621.24","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i5-14600K","cpu_threads":20,"memory_mib":16147,"title_id":"PPSA24944","title":"Platform 8","content_version":"01.003.000","resolution":"3840x2160","window":{"spec":"seconds 60:20","first_present":560,"ms":20021.709},"presents":220,"frame_ms":{"p50":90.032,"p90":98.227,"p99":112.114,"max":123.674},"gpu_busy_ms_per_present":62.336,"worker_busy_pct":{"queue worker 0x0":96.119,"queue worker 0x20":79.829},"phase_totals_ms":{"Driver.Completion":12.691,"Driver.Dispatch":13374.180,"Driver.Dispatch.capture_resources":1103.810,"Driver.Dispatch.decode_key_device_setup":2421.248,"Driver.Dispatch.lookup_cache":161.204,"Driver.Dispatch.materialize":115.582,"Driver.Dispatch.prepared_invocation":77.725,"Driver.Draw":2481.817,"Driver.Draw.device_setup":88.816,"Driver.Draw.draw_enqueued":494.894,"Driver.Draw.post_compile_prepare":23.111,"Driver.Draw.prepare":281.547,"Driver.Draw.shader_compile_and_link":1252.879,"Driver.EndSubmission":68.665,"Driver.Packet":35146.324,"Driver.Packet.device_lock":51.068,"Driver.Packet.dispatch":14135.427,"Driver.Packet.draw":2514.241,"Driver.Packet.execute":260.720,"Driver.Packet.flip_flush":8.736,"Driver.Packet.flush_between_packets":309.778,"Driver.Packet.memory_wait":12584.451,"Driver.Packet.pipeline_drain":4018.782,"Driver.Packet.pipeline_prepare":75.689,"Driver.Packet.prepare_memory":670.037,"Driver.Packet.rendering_wait":0.364,"Driver.Present":120.728,"Driver.Present.acquire_image":3.214,"Driver.Present.device_setup":0.154,"Driver.Present.gpu_mutex_wait":3.908,"Driver.Present.inflight_wait":0.484,"Driver.Present.present_display_buffer":33.854,"Driver.Present.queue_present":73.924,"Driver.Present.release_and_callback":0.244,"Driver.Present.render_fence_wait":4.302,"Driver.Present.resize":0.400,"Driver.Present.validate":0.049,"Driver.Suspend":0.146,"GpuMutex.wait.copy":0.002,"GpuMutex.wait.dispatch":243.807,"GpuMutex.wait.draw":255.738,"GpuMutex.wait.end":19.164,"GpuMutex.wait.fill":608.658,"GpuMutex.wait.flush":15.665,"GpuMutex.wait.hook":184.800,"GpuMutex.wait.indirect":461.345,"GpuMutex.wait.label":229.937,"GpuMutex.wait.other":565.875,"GpuMutex.wait.present":3.355,"Graphics.Draw":4100.753,"Graphics.Draw.draw_and_resource_release":3612.780,"Graphics.Draw.index_upload":157.836,"Graphics.Draw.validate":152.501,"Graphics.Draw.vertex_upload":145.582,"Graphics.DrawWithRecipe":216.049,"Graphics.DrawWithRecipe.draw_and_resource_release":187.269,"Graphics.DrawWithRecipe.index_upload":19.351,"Graphics.DrawWithRecipe.validate":3.746,"Graphics.DrawWithRecipe.vertex_upload":4.057,"Recorder.Reap":175.067,"Recorder.Submit":556.584,"Recorder.Sync":1567.121,"Recorder.WaitSerial":208.692,"Resources.Complete":3311.127,"Resources.Prepare":697.227,"Shader.DrawStage":941.385,"Shader.DrawStage.capture_resources":489.991,"Shader.DrawStage.materialize":309.671,"Shader.DrawStage.prepared_invocation":129.439,"VideoOut.Flip":166.256,"VideoOut.Flip.completion_mutex_wait":0.430,"VideoOut.Flip.config_mutex_wait":0.016,"VideoOut.Flip.frame_limit":0.116,"VideoOut.Flip.notify_game":18.678,"VideoOut.Flip.present":121.839,"VideoOut.Flip.validate":0.217,"VideoOut.Flip.vblank_wait":0.123,"VideoOut.Flip.window_prepare":0.352,"VideoOut.Flip.window_title":23.140,"VideoOut.Readiness":0.556,"VideoOut.Readiness.locks_validate":0.215,"Vulkan.Acquire":3.009,"Vulkan.Acquire.acquire_fence_wait":0.407,"Vulkan.Acquire.acquire_image":1.996,"Vulkan.Acquire.fence_reset":0.400,"Vulkan.Acquire.retired_swapchains":0.105,"Vulkan.Dispatch":5693.802,"Vulkan.Dispatch.command_record":923.002,"Vulkan.Dispatch.shader_resources":4745.211,"Vulkan.DispatchRecipe":173.575,"Vulkan.DispatchRecipe.command_record":171.936,"Vulkan.DrawFromRecipe":217.942,"Vulkan.Present":20.325,"Vulkan.Present.command_record_scale":8.599,"Vulkan.Present.pixel_upload":1.982,"Vulkan.Present.queue_submit":9.493,"Vulkan.QueuePresent":73.063,"Vulkan.QueuePresent.queue_present":72.700,"Vulkan.Retire":4.228,"Vulkan.Retire.wait":1.696},"top_phases_ms_per_frame":{"Driver.Packet":159.756,"Driver.Packet.dispatch":64.252,"Driver.Dispatch":60.792,"Driver.Packet.memory_wait":57.202,"Vulkan.Dispatch":25.881,"Vulkan.Dispatch.shader_resources":21.569,"Graphics.Draw":18.640,"Driver.Packet.pipeline_drain":18.267},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":11930,"Graphics.Barrier.dcc-clear":25960,"Graphics.Barrier.dcc-keys":8924,"Graphics.Barrier.dispatch-lead":104037,"Graphics.Barrier.dispatch-trail":60312,"Graphics.Barrier.draw":86066,"Graphics.Barrier.fill":16896,"Graphics.Barrier.fill-clear":880,"Graphics.Barrier.indirect-args":28834,"Graphics.Barrier.input-mirror":329,"Graphics.Barrier.label-run":117305,"Graphics.Barrier.present-blit":440,"Graphics.Barrier.shadow-publish":19274,"Graphics.Barrier.staging-in":74634,"Graphics.Barrier.staging-out":35672,"Graphics.Barrier.storage-upload":27970,"Graphics.Barrier.storage-writeback":83521,"Graphics.BarrierMerged.copy":219,"Graphics.BarrierMerged.dispatch-lead":13943,"Graphics.BarrierMerged.fill":14336,"Graphics.BarrierMerged.label-run":299,"Graphics.BarrierMerged.shadow-publish":19232,"Graphics.BarrierMerged.staging-in":32382,"Graphics.BarrierMerged.staging-out":35672,"Graphics.BarrierMerged.storage-writeback":28628,"Graphics.Copy":89021,"Graphics.Copy.bytes":90938128812,"Graphics.RenderPass":30653,"Graphics.RenderPass.Close.command":23066,"Graphics.RenderPass.Close.image":3537,"Graphics.RenderPass.Close.key":1046,"Graphics.RenderPass.Close.label":299,"Graphics.RenderPass.Close.new-batch":2705,"Graphics.RenderPass.Continued":37767},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":13.910,"events_lost":115680,"totals_full":false},"gpu":{"events_lost":145373,"totals_full":false}},"trace":"aps5-trace-164151fb99d9-57128.json.gz"}

Overlap. #23234 narrows the same copy to the heap ranges and edits the same UploadFinish lines. The two combine, and whichever lands second rebases that hunk. Among the open PRs whose titles mention shadows or publishes, only #23234 touches this path.

Tested

Windows 11, MinGW-W64 GCC 15.2.0 (Release), RTX 5070 with driver 621.24. Commit 164151fb99.

The new tests are --bda-shadow-reads-in-place-only in three variants (the default, APS5_NO_ADDRESS_SPACE_CACHE=1 and APS5_NO_SHADOW_READS=1) and --bda-shadow-reads-in-place-retiles-only in two. They check:

  • that no copy is made;
  • that the table maps each live run to its slab;
  • that the slab holds the stored results;
  • that a descriptor read or store, a CPU-written unit, and a published unit still use the import;
  • that the read-only gate (ShaderResources::ReadsShadowsInPlace) refuses a storing build and a space-reuse candidate;
  • that descriptor reads over sub-ranges (both prefix and interior) publish only their overlapping units into the import and slice the address table, keeping untouched units mapped to their slab;
  • that table clipping and replacement properly slice copied regions inside mapped heaps into interleaved import and slab entries.

The tests that depend on libSceAgcDriver (2,273) ran with ctest --tests-from-file:

2237/2273 Test #2934: agc_driver_bda_reads_shadow_in_place_per_build ........................   Passed    0.47 sec
2238/2273 Test #2936: agc_driver_bda_reads_shadow_in_place_retiles ..........................   Passed    0.49 sec
2239/2273 Test #2937: agc_driver_bda_reads_shadow_in_place_retiles_per_build ................   Passed    0.51 sec
2240/2273 Test #2933: agc_driver_bda_reads_shadow_in_place ..................................   Passed    0.49 sec
2247/2273 Test #2935: agc_driver_bda_reads_shadow_in_place_off ..............................   Passed    0.36 sec

Windows failures that also fail on origin/main 907fe8fd31 on this machine: agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_driver_bda_device, agc_driver_store_over_untracked, and agc_storage_write_back_host_retile (intermittent). agc_driver_cached_image_multisample_guard fails under parallel load and passes alone, here and on main.

Vulkan validation used the same tests on main and on this change, with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. The new tests ran on the change alone.

RESULT: PASS
layer: loaded
diagnostics: change 0, baseline 0, new 0

I changed 20 conditions and statements one at a time, and the tests failed on 14. The six that survive do not change which bytes a draw reads:

  • two reserve calls;

  • merging adjacent table pieces and adjacent slab runs (the same bytes in fewer entries);

  • an early return when unit shadows are off, which the registry makes redundant;

  • the live-unit count in ShadowReadRuns, a hint that every reader re-checks per unit, so a count left too high costs a scan.

  • Not covered by a test: the call site of the read-only gate in ShaderResources::buildComplete. Only a full build reaches it, and no test runs a storing build over a live shadow. The gate's condition itself is tested.

  • Not verified: Linux, which I did not run locally for the final commit (the Docker VM on my machine crashes under load), so I am relying on the project's Linux CI; AMD and Intel GPUs; and the performance on a base newer than 907fe8fd31.

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, driver 621.24, Windows 11 (validation layer loaded)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5418194571 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24510). Originally posted by [ashwin280802](https://github.com/ashwin280802) on 2026-11-20T18:17:03Z. --- ### What Before an address-based build runs, `GuestBufferMemory::UploadFinish` copies every live unit-shadow unit over the mapped heaps from its slab into the host import (`"address-based heaps"`). On Platform 8 (PPSA24944) that copy took about 17 ms of GPU time per frame. This PR skips that copy for a build that meets all three conditions: - its programs store through no address (`bdaReadOnly`); - it records no descriptor writes; - it is not a space-reuse candidate. Instead, the live units are mapped read-only to their slab's device address in the build's BDA table. Slabs get `SHADER_DEVICE_ADDRESS` when the device supports it. - Descriptor reads over shadowed units are still published first. - The overlays are clipped to the table's coverage, so unmapped bytes still fault. - A build with overlays skips the cached address table and space reuse. - The read is recorded under `GpuMutex` into the same recorder and queue the copy used, and `Recorder::Keep` holds the slab. - Slab writers in `StorageTexture::writeBackWindows` record behind barriers with an `ALL_COMMANDS` source (`Texture.cpp` around lines 4528, 4553 and 4576). - Divergence: a retile recorded between `UploadFinish` and the draw is now seen by the draw. It is recorded in the debt file. - `APS5_NO_SHADOW_READS=1` restores the copy. **Performance.** Platform 8 (PPSA24944) in the idle scene from launch, an RTX 5070 with driver 621.24 at 3840x2160, audio muted. Six pairs of 150 s runs, alternating the order of main (907fe8fd315) and this patch, with the median of the last ten 10 s windows of each run: ``` pair 1: change 118 vs main 100 presents/10s (+18.6%), GPU busy 60.2 vs 75.2 ms pair 2: change 114 vs main 52 presents/10s (+118.3%), GPU busy 63.5 vs 73.2 ms pair 3: change 109 vs main 94 presents/10s (+16.6%), GPU busy 61.6 vs 76.6 ms pair 4: change 106 vs main 92 presents/10s (+15.2%), GPU busy 62.5 vs 75.8 ms pair 5: change 102 vs main 90 presents/10s (+13.9%), GPU busy 62.2 vs 77.1 ms pair 6: change 105 vs main 92 presents/10s (+13.5%), GPU busy 62.7 vs 76.8 ms 6 pairs: mean +32.7%, median +15.9%, min +13.5%, sd 42.0, 95% CI -11.4% .. +76.7% ``` In pair 2 the main arm presented nothing for about 80 s before recovering (the same presents stall I saw in earlier arms of main), so its median is 52. Without that pair: ``` 5 pairs: mean +15.6%, median +15.2%, min +13.5%, sd 2.1, 95% CI +13.0% .. +18.1% GPU busy per frame: change mean 61.8 ms, main mean 76.3 ms (-14.5 ms) ``` Every pair is positive, GPU busy time per frame drops by 11 to 15 ms in every pair, and the gain is above 13% in each of the other five. **Performance trace.** The measured commit is `164151fb99d9`. The current head is the same commit rebased onto newer `main`: the two commits add and remove the same 297 lines in the same files. A 100 s capture of each build with `APS5_TRACE_SECONDS=60:20`, this host and scene, `main` first and the change second (the full `tools/trace_digest.py` output of both is in [this gist](https://gist.github.com/ashwin280802/ccb0f8ef4dc1dc592981e8ada76cbc7c); the traces are attached as [`main`](https://github.com/ashwin280802/AnyPS5/releases/download/pr-24510-traces/aps5-trace-907fe8fd315c-91224.json.gz) and [the change](https://github.com/ashwin280802/AnyPS5/releases/download/pr-24510-traces/aps5-trace-164151fb99d9-57128.json.gz), 6.7 and 7.3 MB): - seconds 60:20 from present 518: 200 presents, frame p50 98.8 / p90 106.6 / p99 133.5 / max 142.0 ms, GPU busy 74.5 ms per present - seconds 60:20 from present 560: 220 presents, frame p50 90.0 / p90 98.2 / p99 112.1 / max 123.7 ms, GPU busy 62.3 ms per present Both traces overflowed their buffers (31,501 events lost on `main`, 115,680 on this patch), so the summary lines are the evidence and slice timings cover retained events only. ```json {"commit":"907fe8fd315c","dirty":false,"env":{"APS5_CRASH_INDIRECT_MEMORY":"1","APS5_LOG_TIMESTAMPS":"1","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_PROFILE_DRAW":"1","APS5_PROFILE_GPU":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_EXIT":"1","APS5_TRACE_SECONDS":"60:20","APS5_TRACE_SUMMARY_EVERY":"30"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 621.24","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i5-14600K","cpu_threads":20,"memory_mib":16147,"title_id":"PPSA24944","title":"Platform 8","content_version":"01.003.000","resolution":"3840x2160","window":{"spec":"seconds 60:20","first_present":518,"ms":20043.409},"presents":200,"frame_ms":{"p50":98.815,"p90":106.625,"p99":133.495,"max":142.020},"gpu_busy_ms_per_present":74.477,"worker_busy_pct":{"queue worker 0x0":96.248,"queue worker 0x20":81.476},"phase_totals_ms":{"Driver.Completion":10.739,"Driver.Dispatch":14804.190,"Driver.Dispatch.capture_resources":964.322,"Driver.Dispatch.decode_key_device_setup":5651.898,"Driver.Dispatch.lookup_cache":138.979,"Driver.Dispatch.materialize":91.183,"Driver.Dispatch.prepared_invocation":59.300,"Driver.Draw":1920.917,"Driver.Draw.device_setup":65.096,"Driver.Draw.draw_enqueued":361.733,"Driver.Draw.post_compile_prepare":18.000,"Driver.Draw.prepare":235.457,"Driver.Draw.shader_compile_and_link":1025.858,"Driver.EndSubmission":81.809,"Driver.Packet":35529.347,"Driver.Packet.device_lock":40.941,"Driver.Packet.dispatch":15357.251,"Driver.Packet.draw":1945.921,"Driver.Packet.execute":220.191,"Driver.Packet.flip_flush":8.213,"Driver.Packet.flush_between_packets":291.730,"Driver.Packet.memory_wait":13637.063,"Driver.Packet.pipeline_drain":3115.789,"Driver.Packet.pipeline_prepare":62.596,"Driver.Packet.prepare_memory":505.730,"Driver.Packet.rendering_wait":0.276,"Driver.Present":113.763,"Driver.Present.acquire_image":2.928,"Driver.Present.device_setup":0.108,"Driver.Present.gpu_mutex_wait":4.169,"Driver.Present.inflight_wait":0.461,"Driver.Present.present_display_buffer":32.995,"Driver.Present.queue_present":67.862,"Driver.Present.release_and_callback":0.180,"Driver.Present.render_fence_wait":4.389,"Driver.Present.resize":0.468,"Driver.Present.validate":0.052,"Driver.Suspend":0.138,"GpuMutex.wait.copy":0.000,"GpuMutex.wait.dispatch":212.670,"GpuMutex.wait.draw":183.868,"GpuMutex.wait.end":39.708,"GpuMutex.wait.fill":1064.403,"GpuMutex.wait.flush":14.413,"GpuMutex.wait.hook":162.091,"GpuMutex.wait.indirect":282.955,"GpuMutex.wait.label":178.488,"GpuMutex.wait.other":413.388,"GpuMutex.wait.present":3.604,"Graphics.Draw":2354.517,"Graphics.Draw.draw_and_resource_release":2012.232,"Graphics.Draw.index_upload":109.738,"Graphics.Draw.validate":108.456,"Graphics.Draw.vertex_upload":101.700,"Graphics.DrawWithRecipe":139.496,"Graphics.DrawWithRecipe.draw_and_resource_release":112.375,"Graphics.DrawWithRecipe.index_upload":14.032,"Graphics.DrawWithRecipe.validate":2.263,"Graphics.DrawWithRecipe.vertex_upload":2.588,"Recorder.Reap":121.939,"Recorder.Submit":444.920,"Recorder.Sync":1399.261,"Resources.Complete":2013.768,"Resources.Prepare":529.234,"Shader.DrawStage":780.068,"Shader.DrawStage.capture_resources":412.021,"Shader.DrawStage.materialize":254.567,"Shader.DrawStage.prepared_invocation":104.148,"VideoOut.Flip":174.301,"VideoOut.Flip.completion_mutex_wait":1.382,"VideoOut.Flip.config_mutex_wait":0.020,"VideoOut.Flip.frame_limit":0.101,"VideoOut.Flip.notify_game":22.570,"VideoOut.Flip.present":114.654,"VideoOut.Flip.validate":0.189,"VideoOut.Flip.vblank_wait":0.121,"VideoOut.Flip.window_prepare":0.409,"VideoOut.Flip.window_title":34.250,"VideoOut.Readiness":0.437,"VideoOut.Readiness.locks_validate":0.181,"Vulkan.Acquire":2.709,"Vulkan.Acquire.acquire_fence_wait":0.341,"Vulkan.Acquire.acquire_image":1.788,"Vulkan.Acquire.fence_reset":0.438,"Vulkan.Acquire.retired_swapchains":0.078,"Vulkan.Dispatch":4519.802,"Vulkan.Dispatch.command_record":689.490,"Vulkan.Dispatch.shader_resources":3811.619,"Vulkan.DispatchRecipe":130.722,"Vulkan.DispatchRecipe.command_record":129.566,"Vulkan.DrawFromRecipe":140.816,"Vulkan.Present":19.307,"Vulkan.Present.command_record_scale":7.667,"Vulkan.Present.pixel_upload":4.476,"Vulkan.Present.queue_submit":6.908,"Vulkan.QueuePresent":66.606,"Vulkan.QueuePresent.queue_present":66.264,"Vulkan.Retire":4.349,"Vulkan.Retire.wait":2.076},"top_phases_ms_per_frame":{"Driver.Packet":177.647,"Driver.Packet.dispatch":76.786,"Driver.Dispatch":74.021,"Driver.Packet.memory_wait":68.185,"Driver.Dispatch.decode_key_device_setup":28.259,"Vulkan.Dispatch":22.599,"Vulkan.Dispatch.shader_resources":19.058,"Driver.Packet.pipeline_drain":15.579},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":10547,"Graphics.Barrier.dcc-clear":23600,"Graphics.Barrier.dcc-keys":7786,"Graphics.Barrier.dispatch-lead":94382,"Graphics.Barrier.dispatch-trail":54818,"Graphics.Barrier.draw":79803,"Graphics.Barrier.fill":15294,"Graphics.Barrier.fill-clear":800,"Graphics.Barrier.indirect-args":26212,"Graphics.Barrier.input-mirror":272,"Graphics.Barrier.label-run":103067,"Graphics.Barrier.present-blit":400,"Graphics.Barrier.shadow-publish":18209,"Graphics.Barrier.staging-in":67488,"Graphics.Barrier.staging-out":32418,"Graphics.Barrier.storage-upload":25058,"Graphics.Barrier.storage-writeback":75694,"Graphics.BarrierMerged.copy":198,"Graphics.BarrierMerged.dispatch-lead":12860,"Graphics.BarrierMerged.fill":13108,"Graphics.BarrierMerged.label-run":534,"Graphics.BarrierMerged.shadow-publish":17803,"Graphics.BarrierMerged.staging-in":29766,"Graphics.BarrierMerged.staging-out":32418,"Graphics.BarrierMerged.storage-writeback":26186,"Graphics.Copy":81104,"Graphics.Copy.bytes":83069658524,"Graphics.RenderPass":26768,"Graphics.RenderPass.Close.command":20052,"Graphics.RenderPass.Close.image":3255,"Graphics.RenderPass.Close.key":981,"Graphics.RenderPass.Close.label":534,"Graphics.RenderPass.Close.new-batch":1946,"Graphics.RenderPass.Continued":34322},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":17.828,"events_lost":31501,"totals_full":false},"gpu":{"events_lost":104227,"totals_full":false}},"trace":"aps5-trace-907fe8fd315c-91224.json.gz"} ``` ```json {"commit":"164151fb99d9","dirty":false,"env":{"APS5_CRASH_INDIRECT_MEMORY":"1","APS5_LOG_TIMESTAMPS":"1","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_PROFILE_DRAW":"1","APS5_PROFILE_GPU":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_EXIT":"1","APS5_TRACE_SECONDS":"60:20","APS5_TRACE_SUMMARY_EVERY":"30"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 621.24","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i5-14600K","cpu_threads":20,"memory_mib":16147,"title_id":"PPSA24944","title":"Platform 8","content_version":"01.003.000","resolution":"3840x2160","window":{"spec":"seconds 60:20","first_present":560,"ms":20021.709},"presents":220,"frame_ms":{"p50":90.032,"p90":98.227,"p99":112.114,"max":123.674},"gpu_busy_ms_per_present":62.336,"worker_busy_pct":{"queue worker 0x0":96.119,"queue worker 0x20":79.829},"phase_totals_ms":{"Driver.Completion":12.691,"Driver.Dispatch":13374.180,"Driver.Dispatch.capture_resources":1103.810,"Driver.Dispatch.decode_key_device_setup":2421.248,"Driver.Dispatch.lookup_cache":161.204,"Driver.Dispatch.materialize":115.582,"Driver.Dispatch.prepared_invocation":77.725,"Driver.Draw":2481.817,"Driver.Draw.device_setup":88.816,"Driver.Draw.draw_enqueued":494.894,"Driver.Draw.post_compile_prepare":23.111,"Driver.Draw.prepare":281.547,"Driver.Draw.shader_compile_and_link":1252.879,"Driver.EndSubmission":68.665,"Driver.Packet":35146.324,"Driver.Packet.device_lock":51.068,"Driver.Packet.dispatch":14135.427,"Driver.Packet.draw":2514.241,"Driver.Packet.execute":260.720,"Driver.Packet.flip_flush":8.736,"Driver.Packet.flush_between_packets":309.778,"Driver.Packet.memory_wait":12584.451,"Driver.Packet.pipeline_drain":4018.782,"Driver.Packet.pipeline_prepare":75.689,"Driver.Packet.prepare_memory":670.037,"Driver.Packet.rendering_wait":0.364,"Driver.Present":120.728,"Driver.Present.acquire_image":3.214,"Driver.Present.device_setup":0.154,"Driver.Present.gpu_mutex_wait":3.908,"Driver.Present.inflight_wait":0.484,"Driver.Present.present_display_buffer":33.854,"Driver.Present.queue_present":73.924,"Driver.Present.release_and_callback":0.244,"Driver.Present.render_fence_wait":4.302,"Driver.Present.resize":0.400,"Driver.Present.validate":0.049,"Driver.Suspend":0.146,"GpuMutex.wait.copy":0.002,"GpuMutex.wait.dispatch":243.807,"GpuMutex.wait.draw":255.738,"GpuMutex.wait.end":19.164,"GpuMutex.wait.fill":608.658,"GpuMutex.wait.flush":15.665,"GpuMutex.wait.hook":184.800,"GpuMutex.wait.indirect":461.345,"GpuMutex.wait.label":229.937,"GpuMutex.wait.other":565.875,"GpuMutex.wait.present":3.355,"Graphics.Draw":4100.753,"Graphics.Draw.draw_and_resource_release":3612.780,"Graphics.Draw.index_upload":157.836,"Graphics.Draw.validate":152.501,"Graphics.Draw.vertex_upload":145.582,"Graphics.DrawWithRecipe":216.049,"Graphics.DrawWithRecipe.draw_and_resource_release":187.269,"Graphics.DrawWithRecipe.index_upload":19.351,"Graphics.DrawWithRecipe.validate":3.746,"Graphics.DrawWithRecipe.vertex_upload":4.057,"Recorder.Reap":175.067,"Recorder.Submit":556.584,"Recorder.Sync":1567.121,"Recorder.WaitSerial":208.692,"Resources.Complete":3311.127,"Resources.Prepare":697.227,"Shader.DrawStage":941.385,"Shader.DrawStage.capture_resources":489.991,"Shader.DrawStage.materialize":309.671,"Shader.DrawStage.prepared_invocation":129.439,"VideoOut.Flip":166.256,"VideoOut.Flip.completion_mutex_wait":0.430,"VideoOut.Flip.config_mutex_wait":0.016,"VideoOut.Flip.frame_limit":0.116,"VideoOut.Flip.notify_game":18.678,"VideoOut.Flip.present":121.839,"VideoOut.Flip.validate":0.217,"VideoOut.Flip.vblank_wait":0.123,"VideoOut.Flip.window_prepare":0.352,"VideoOut.Flip.window_title":23.140,"VideoOut.Readiness":0.556,"VideoOut.Readiness.locks_validate":0.215,"Vulkan.Acquire":3.009,"Vulkan.Acquire.acquire_fence_wait":0.407,"Vulkan.Acquire.acquire_image":1.996,"Vulkan.Acquire.fence_reset":0.400,"Vulkan.Acquire.retired_swapchains":0.105,"Vulkan.Dispatch":5693.802,"Vulkan.Dispatch.command_record":923.002,"Vulkan.Dispatch.shader_resources":4745.211,"Vulkan.DispatchRecipe":173.575,"Vulkan.DispatchRecipe.command_record":171.936,"Vulkan.DrawFromRecipe":217.942,"Vulkan.Present":20.325,"Vulkan.Present.command_record_scale":8.599,"Vulkan.Present.pixel_upload":1.982,"Vulkan.Present.queue_submit":9.493,"Vulkan.QueuePresent":73.063,"Vulkan.QueuePresent.queue_present":72.700,"Vulkan.Retire":4.228,"Vulkan.Retire.wait":1.696},"top_phases_ms_per_frame":{"Driver.Packet":159.756,"Driver.Packet.dispatch":64.252,"Driver.Dispatch":60.792,"Driver.Packet.memory_wait":57.202,"Vulkan.Dispatch":25.881,"Vulkan.Dispatch.shader_resources":21.569,"Graphics.Draw":18.640,"Driver.Packet.pipeline_drain":18.267},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":11930,"Graphics.Barrier.dcc-clear":25960,"Graphics.Barrier.dcc-keys":8924,"Graphics.Barrier.dispatch-lead":104037,"Graphics.Barrier.dispatch-trail":60312,"Graphics.Barrier.draw":86066,"Graphics.Barrier.fill":16896,"Graphics.Barrier.fill-clear":880,"Graphics.Barrier.indirect-args":28834,"Graphics.Barrier.input-mirror":329,"Graphics.Barrier.label-run":117305,"Graphics.Barrier.present-blit":440,"Graphics.Barrier.shadow-publish":19274,"Graphics.Barrier.staging-in":74634,"Graphics.Barrier.staging-out":35672,"Graphics.Barrier.storage-upload":27970,"Graphics.Barrier.storage-writeback":83521,"Graphics.BarrierMerged.copy":219,"Graphics.BarrierMerged.dispatch-lead":13943,"Graphics.BarrierMerged.fill":14336,"Graphics.BarrierMerged.label-run":299,"Graphics.BarrierMerged.shadow-publish":19232,"Graphics.BarrierMerged.staging-in":32382,"Graphics.BarrierMerged.staging-out":35672,"Graphics.BarrierMerged.storage-writeback":28628,"Graphics.Copy":89021,"Graphics.Copy.bytes":90938128812,"Graphics.RenderPass":30653,"Graphics.RenderPass.Close.command":23066,"Graphics.RenderPass.Close.image":3537,"Graphics.RenderPass.Close.key":1046,"Graphics.RenderPass.Close.label":299,"Graphics.RenderPass.Close.new-batch":2705,"Graphics.RenderPass.Continued":37767},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":13.910,"events_lost":115680,"totals_full":false},"gpu":{"events_lost":145373,"totals_full":false}},"trace":"aps5-trace-164151fb99d9-57128.json.gz"} ``` **Overlap.** #23234 narrows the same copy to the heap ranges and edits the same `UploadFinish` lines. The two combine, and whichever lands second rebases that hunk. Among the open PRs whose titles mention shadows or publishes, only #23234 touches this path. ### Tested Windows 11, MinGW-W64 GCC 15.2.0 (Release), RTX 5070 with driver 621.24. Commit `164151fb99`. The new tests are `--bda-shadow-reads-in-place-only` in three variants (the default, `APS5_NO_ADDRESS_SPACE_CACHE=1` and `APS5_NO_SHADOW_READS=1`) and `--bda-shadow-reads-in-place-retiles-only` in two. They check: - that no copy is made; - that the table maps each live run to its slab; - that the slab holds the stored results; - that a descriptor read or store, a CPU-written unit, and a published unit still use the import; - that the read-only gate (`ShaderResources::ReadsShadowsInPlace`) refuses a storing build and a space-reuse candidate; - that descriptor reads over sub-ranges (both prefix and interior) publish only their overlapping units into the import and slice the address table, keeping untouched units mapped to their slab; - that table clipping and replacement properly slice copied regions inside mapped heaps into interleaved import and slab entries. The tests that depend on `libSceAgcDriver` (2,273) ran with `ctest --tests-from-file`: ``` 2237/2273 Test #2934: agc_driver_bda_reads_shadow_in_place_per_build ........................ Passed 0.47 sec 2238/2273 Test #2936: agc_driver_bda_reads_shadow_in_place_retiles .......................... Passed 0.49 sec 2239/2273 Test #2937: agc_driver_bda_reads_shadow_in_place_retiles_per_build ................ Passed 0.51 sec 2240/2273 Test #2933: agc_driver_bda_reads_shadow_in_place .................................. Passed 0.49 sec 2247/2273 Test #2935: agc_driver_bda_reads_shadow_in_place_off .............................. Passed 0.36 sec ``` Windows failures that also fail on origin/main 907fe8fd315 on this machine: `agc_driver_stencil_plane_memory`, `agc_driver_msaa_dcc_unwatch`, `agc_driver_bda_device`, `agc_driver_store_over_untracked`, and `agc_storage_write_back_host_retile` (intermittent). `agc_driver_cached_image_multisample_guard` fails under parallel load and passes alone, here and on main. Vulkan validation used the same tests on main and on this change, with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`. The new tests ran on the change alone. ``` RESULT: PASS layer: loaded diagnostics: change 0, baseline 0, new 0 ``` I changed 20 conditions and statements one at a time, and the tests failed on 14. The six that survive do not change which bytes a draw reads: - two `reserve` calls; - merging adjacent table pieces and adjacent slab runs (the same bytes in fewer entries); - an early return when unit shadows are off, which the registry makes redundant; - the live-unit count in `ShadowReadRuns`, a hint that every reader re-checks per unit, so a count left too high costs a scan. - Not covered by a test: the call site of the read-only gate in `ShaderResources::buildComplete`. Only a full build reaches it, and no test runs a storing build over a live shadow. The gate's condition itself is tested. - Not verified: Linux, which I did not run locally for the final commit (the Docker VM on my machine crashes under load), so I am relying on the project's Linux CI; AMD and Intel GPUs; and the performance on a base newer than 907fe8fd315. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 5070, driver 621.24, Windows 11 (validation layer loaded) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-11-20 19:04:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T19:04:58Z.

Review: COMMENTED


Reviewed — comments

The changed hunks reviewed show no verified blocking defect, but the sparse-mirror and copied-region overlay behavior still lacks test coverage.

What I ran

Reviewed head 986c002c362851fa929bb95590b4df77aaf9bf49 using the prepared diff and pinned repository reader. I ran no build or tests; no merged-preview check was performed.

Results

Check Result Note
Changed-hunk review passed Reviewed all nine changed files
Tests run by reviewer not run No command execution available
Author-reported tests not run Description reports five targeted tests passed
Negative control not run Not performed in this review

Findings

Blocking

None verified in the changed hunks reviewed.

Non-blocking

  • The new tests cover live shadow runs and several publication paths, but do not exercise sparse-mirror heaps or copied regions inside mapped heaps. The debt note calls out these overlays as untested. Add coverage for these cases to help verify the clipping and table replacement behavior (core/libs/prx/libSceAgcDriver/tests/Recorder.cpp:8045).

Sources

Not verified

No tests or builds were run by the reviewer, and console behavior was not verified. Reviewed changed hunks in all nine changed files. Full file text was included for six; GuestBufferMemory.cpp, ShaderResources.cpp, and Recorder.cpp were excluded from the review folder as too large, so only targeted ranges were read through the pinned reader. The author reports Windows test and Vulkan validation results in the PR description; those results were not independently verified.

To get this to a good state

Nothing is required. Optionally, add tests for sparse-mirror heaps and copied regions within mapped heaps.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5997955527 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24510#pullrequestreview-5997955527). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T19:04:58Z. **Review:** COMMENTED --- # Reviewed — comments The changed hunks reviewed show no verified blocking defect, but the sparse-mirror and copied-region overlay behavior still lacks test coverage. ## What I ran Reviewed head `986c002c362851fa929bb95590b4df77aaf9bf49` using the prepared diff and pinned repository reader. I ran no build or tests; no merged-preview check was performed. ## Results | Check | Result | Note | |---|---|---| | Changed-hunk review | passed | Reviewed all nine changed files | | Tests run by reviewer | not run | No command execution available | | Author-reported tests | not run | Description reports five targeted tests passed | | Negative control | not run | Not performed in this review | ## Findings ### Blocking None verified in the changed hunks reviewed. ### Non-blocking - The new tests cover live shadow runs and several publication paths, but do not exercise sparse-mirror heaps or copied regions inside mapped heaps. The debt note calls out these overlays as untested. Add coverage for these cases to help verify the clipping and table replacement behavior (`core/libs/prx/libSceAgcDriver/tests/Recorder.cpp:8045`). ## Sources - [GuestBufferMemory changes](https://github.com/boykopovar/AnyPS5/blob/986c002c362851fa929bb95590b4df77aaf9bf49/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L7116) - [UnitShadow changes](https://github.com/boykopovar/AnyPS5/blob/986c002c362851fa929bb95590b4df77aaf9bf49/core/libs/prx/libSceAgcDriver/Graphics/src/UnitShadow.cpp#L651) - [New test coverage](https://github.com/boykopovar/AnyPS5/blob/986c002c362851fa929bb95590b4df77aaf9bf49/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp#L8045) ## Not verified No tests or builds were run by the reviewer, and console behavior was not verified. Reviewed changed hunks in all nine changed files. Full file text was included for six; `GuestBufferMemory.cpp`, `ShaderResources.cpp`, and `Recorder.cpp` were excluded from the review folder as too large, so only targeted ranges were read through the pinned reader. The author reports Windows test and Vulkan validation results in the PR description; those results were not independently verified. ## To get this to a good state Nothing is required. Optionally, add tests for sparse-mirror heaps and copied regions within mapped heaps.
MarcZX10 commented 2026-11-20 20:26:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T20:26:32Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this; the points below are optional.

What I ran

Reviewed head 4cc78f4f6a4546b606cda191ea2e29d023d39a49 using the prepared diff, manifest, description, commits, and repo_read.py at the pinned head. No build or tests were run; reported test and performance results are author supplied.

Results

Check Result Note
Diff and targeted source review passed Read the changed logic and related declarations
Build and tests not run Results in the PR description were not independently run
Performance measurements not run Hardware captures are author supplied

Findings

Blocking

None.

Non-blocking

None.

Not verified

Full text was read for GuestBufferMemory.hpp, ShaderResources.hpp, UnitShadow.hpp, UnitShadow.cpp, agc_driver_recorder_tests.cmake, ENVIRONMENT.md, and perf-agc-shadow-reads-in-place.md. Targeted ranges were read through repo_read.py for GuestBufferMemory.cpp and ShaderResources.cpp; full text was not read. Recorder.cpp was not read; its full text was excluded from the review folder. The reviewer did not run build/tests or verify the reported Windows, Linux CI, Vulkan validation, console, or performance results.

To get this to a good state

Nothing is required. The reported behavior and scope are covered by targeted code review; the build, tests, and measurements remain author-reported.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5998892641 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24510#pullrequestreview-5998892641). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T20:26:32Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this; the points below are optional. ## What I ran Reviewed head `4cc78f4f6a4546b606cda191ea2e29d023d39a49` using the prepared diff, manifest, description, commits, and `repo_read.py` at the pinned head. No build or tests were run; reported test and performance results are author supplied. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Read the changed logic and related declarations | | Build and tests | not run | Results in the PR description were not independently run | | Performance measurements | not run | Hardware captures are author supplied | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Full text was read for `GuestBufferMemory.hpp`, `ShaderResources.hpp`, `UnitShadow.hpp`, `UnitShadow.cpp`, `agc_driver_recorder_tests.cmake`, `ENVIRONMENT.md`, and `perf-agc-shadow-reads-in-place.md`. Targeted ranges were read through `repo_read.py` for `GuestBufferMemory.cpp` and `ShaderResources.cpp`; full text was not read. `Recorder.cpp` was not read; its full text was excluded from the review folder. The reviewer did not run build/tests or verify the reported Windows, Linux CI, Vulkan validation, console, or performance results. ## To get this to a good state Nothing is required. The reported behavior and scope are covered by targeted code review; the build, tests, and measurements remain author-reported.
ligmaSec commented 2026-12-03 21:46:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T21:46:04Z.

Review: COMMENTED


I followed the eligibility gate, clipping to mapped BDA coverage, and the recorder reference that retains a slab through execution. The retile-after-prepare case is especially important because the new path reads the live slab at execution instead of the published copy. Please keep that case alongside the disabled and per-build table controls. The paired recorder tests are queued on lavapipe. I did not repeat the title timing.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6179160878 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24510#pullrequestreview-6179160878). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T21:46:04Z. **Review:** COMMENTED --- I followed the eligibility gate, clipping to mapped BDA coverage, and the recorder reference that retains a slab through execution. The retile-after-prepare case is especially important because the new path reads the live slab at execution instead of the published copy. Please keep that case alongside the disabled and per-build table controls. The paired recorder tests are queued on lavapipe. I did not repeat the title timing. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/24510:upstream-pr/24510'
git switch 'upstream-pr/24510'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/24510'
git switch 'upstream-pr/24510'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/24510'
git switch 'upstream-pr/24510'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/24510'
git switch 'main'
git merge --squash 'upstream-pr/24510'
git switch 'main'
git merge --ff-only 'upstream-pr/24510'
git switch 'main'
git merge 'upstream-pr/24510'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!24510
No description provided.