perf(agc): serve a buffer range that crosses host import windows in place from one joined import #22072

Merged
nicolasabosch merged 5 commits from upstream-pr/22072 into main 2026-11-20 04:48:38 +00:00
nicolasabosch commented 2026-11-17 03:55:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nicolasabosch on 2026-11-17T03:55:13Z.


What

A buffer range that starts inside one registered range and crosses into the next, across a host import window boundary, has no import that covers it, so main copies it through the CPU on every bind: a guest read that waits on the recorder's fence while holding the GPU mutex.

  • UploadFinish now joins the adjacent registered ranges such a buffer crosses into one import and binds the buffer in place, as for any range one import covers.
  • joinedRun accepts a buffer that starts inside the first crossed range when that range is no larger than the import window and the crossed ranges are at most two import windows longer than the span being joined (run.bytes <= end - begin + 2 * window). That span is the buffer, widened by importJoined to the whole of any joined import it starts or ends in, as for every join, so a buffer that ends inside an existing joined import is measured up to that import's end. This is intended: the new join replaces that import, so it must cover it. A first range larger than the window keeps the rule from #15658, whose test (a buffer bound from inside a range larger than the import window across more than a window of small ranges was joined) still passes.
  • The existing join path makes the import (alignment, import limit, budget and eviction, remembered failures and refusals), retires the per-window imports it overlaps, and findImport finds it on the next bind. Only non-sparse regions that are host-backed or writable take this join; a join that cannot be made leaves the range copied as before.
  • APS5_NO_JOIN_STRADDLE=1 turns the join off (new ENVIRONMENT.md row).
  • deviceLocalHasRoom no longer throws on a device without a device-local memory type; it reports no room instead.
  • The host-imports debt entry gains one clause for this join, through the fragment docs/dev/debt/changes/perf-agc-join-straddling-imports.md.

Overlap: #5372 relaxes the same joinedRun check for a buffer bound from inside a range (begin == run.base || run.bytes <= window) and edits the same assertion in importJoinTests. The two rules differ: #5372 caps the joined run at one window and also widens importJoined to non-joined neighbouring imports; this change keeps the widening as it is and bounds the run by the buffer's size plus two windows. Whichever merges second needs a rebase on these lines; the order is to be agreed with its author.

Tested

Windows 11 Pro, MinGW (GCC, Release), NVIDIA GeForce RTX 4070 Laptop GPU. ctest -R '^(agc_graphics_profile_draw|agc_bda_staging.*|agc_changed_copy.*|agc_driver_host_import_windows|agc_driver_host_import_alias_failure|agc_driver_partial_resident_alias)$' passed (8/8). After review (61cc86904e): deviceLocalHasRoom keeps its 250 ms throttle on a device with no device-local memory type, and the read-only V# test sorts the address ranges before checking coverage; the same 8 tests pass, with the validation layer and no VUID- error, and agc_driver_graphics and the agc_driver_bda_* tests pass too (17/17). agc_graphics_profile_draw runs the BDA import-join tests: importJoinTests now binds 32 bytes from 16 bytes before the end of one 64 KiB piece into the next and requires one joined import over both pieces, bound in place with nothing copied; spaceReadAcrossImportsTests takes a third build and requires the read-only V# across two imports to be bound in place at its offset in the joined import without dissolving the cached address space. With APS5_NO_JOIN_STRADDLE=1, agc_graphics_profile_draw fails (1 run): "a buffer bound from inside the first of two pieces no larger than the import window across the import window boundary was not joined and bound in place".

Validation layer: the same tests on main (ec9f142628) and on this branch with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer, ANYPS5_NO_SHADER_CACHE=1 and ANYPS5_REQUIRE_VULKAN=1 through ctest -V (Khronos validation layer 1.4.363.1): every log shows Insert instance layer "VK_LAYER_KHRONOS_validation" (11 times in each), none reports was not found but was requested by env var VK_INSTANCE_LAYERS, and neither run logs a VUID- error.

Performance (captured by @Logan1h on Windows 11, Ryzen 5 7500F, RTX 4070 SUPER, NVIDIA 621.24; paired 60 s captures of the same practice fight in EA SPORTS UFC 6 (PPSA23566, 01.004.000), main vs this change; traces and trace_digest.py outputs attached):

Metric main change Change
frame p50 753.153 ms 415.194 ms -44.9%
frame p90 948.136 ms 608.772 ms -35.8%
presents 86 138 +60.5%
GPU busy/present 227.081 ms 253.884 ms +11.8%

Traces and trace_digest.py outputs (both traces report trace_dropped after the queue-worker event buffer fills; the summary lines, phase totals and import counters are complete):

The GPU-busy increase comes from direct host-import reads replacing the CPU-side copies.

Second capture, of this port (with the guard for #15658's rule), on another machine (NVIDIA GeForce RTX 4070 Laptop GPU, driver 616.92, Intel Core i9-14900HX, Windows 11 Pro 26300): one 60 s capture each with APS5_TRACE_SECONDS=660:60, warm shader caches, same scripted practice fight of EA SPORTS UFC 6 (PPSA23566, 01.004.000). Both builds are main 2a8a0d1fc3 plus the pad-script commit of #22064, which only injects the scripted input.

main this change
summary line seconds 660:60 from present 11012: 55 presents, frame p50 1004.2 / p90 1086.4 / p99 5716.0 / max 5716.0 ms, GPU busy 288.6 ms per present seconds 660:60 from present 12256: 173 presents, frame p50 327.7 / p90 356.0 / p99 394.0 / max 3685.6 ms, GPU busy 286.3 ms per present

Traces and trace_digest.py outputs: main: trace, digest; this change: trace, digest.

aps5-summary.jsonl lines

main:

{"commit":"241bfd31f250","dirty":false,"env":{"APS5_LAZY_SHADER_PREPARE":"1","APS5_PAD_SCRIPT":"<path>","APS5_TRACE_SECONDS":"660:60"},"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 616.92","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-14900HX","cpu_threads":32,"memory_mib":32543,"title_id":"PPSA23566","title":"EA SPORTS™ UFC® 6","content_version":"01.004.000","resolution":"1920x1080","window":{"spec":"seconds 660:60","first_present":11012,"ms":60290.998},"presents":55,"frame_ms":{"p50":1004.223,"p90":1086.447,"p99":5716.009,"max":5716.009},"gpu_busy_ms_per_present":288.557,"worker_busy_pct":{"queue worker 0x0":98.497,"queue worker 0x29":9.422,"queue worker 0x2a":9.638,"queue worker 0x2b":9.261,"queue worker 0x2c":9.156,"queue worker 0x2d":9.287,"queue worker 0x2e":9.069,"queue worker 0x2f":9.205,"queue worker 0x28":14.485},"phase_totals_ms":{"Driver.Completion":1.369,"Driver.Dispatch":46604.504,"Driver.Dispatch.capture_resources":329.533,"Driver.Dispatch.decode_key_device_setup":1032.629,"Driver.Dispatch.lookup_cache":25.702,"Driver.Dispatch.materialize":85.816,"Driver.Dispatch.prepared_invocation":200.01,"Driver.Draw":43300.605,"Driver.Draw.device_setup":176.166,"Driver.Draw.draw_enqueued":39186.962,"Driver.Draw.post_compile_prepare":29.268,"Driver.Draw.prepare":542.715,"Driver.Draw.shader_compile_and_link":3092.764,"Driver.EndSubmission":131.14,"Driver.Packet":107197.022,"Driver.Packet.device_lock":90.675,"Driver.Packet.dispatch":46238.381,"Driver.Packet.draw":43359.308,"Driver.Packet.execute":4144.494,"Driver.Packet.flip_flush":1.678,"Driver.Packet.flush_between_packets":279.296,"Driver.Packet.memory_wait":12276.403,"Driver.Packet.pipeline_drain":135.683,"Driver.Packet.pipeline_prepare":119.436,"Driver.Packet.prepare_memory":147.483,"Driver.Packet.rendering_wait":0.044,"Driver.Present":160.045,"Driver.Present.acquire_image":0.671,"Driver.Present.device_setup":0.036,"Driver.Present.gpu_mutex_wait":0.397,"Driver.Present.inflight_wait":0.152,"Driver.Present.present_display_buffer":6.623,"Driver.Present.queue_present":23.361,"Driver.Present.release_and_callback":0.099,"Driver.Present.render_fence_wait":128.474,"Driver.Present.resize":0.17,"Driver.Present.validate":0.021,"Driver.Suspend":0.007,"GpuMutex.wait.dispatch":579.319,"GpuMutex.wait.draw":34467.577,"GpuMutex.wait.end":193.154,"GpuMutex.wait.fill":0.144,"GpuMutex.wait.flush":8.82,"GpuMutex.wait.hook":87.515,"GpuMutex.wait.indirect":1.69,"GpuMutex.wait.label":257.307,"GpuMutex.wait.other":17.339,"GpuMutex.wait.present":0.275,"GpuMutex.wait.wait":0.082,"Graphics.Draw":8776.731,"Graphics.Draw.draw_and_resource_release":8097.741,"Graphics.Draw.index_upload":349.797,"Graphics.Draw.validate":255.887,"Graphics.Draw.vertex_upload":30.893,"Graphics.DrawWithRecipe":24.054,"Graphics.DrawWithRecipe.draw_and_resource_release":23.52,"Graphics.DrawWithRecipe.index_upload":0.033,"Graphics.DrawWithRecipe.validate":0.247,"Graphics.DrawWithRecipe.vertex_upload":0.164,"Recorder.Reap":480.593,"Recorder.Submit":349.225,"Recorder.Sync":18536.37,"Recorder.WaitSerial":173.32,"Resources.Complete":41250.476,"Resources.Prepare":357.457,"Shader.DrawStage":2721.353,"Shader.DrawStage.capture_resources":1865.394,"Shader.DrawStage.materialize":529.432,"Shader.DrawStage.prepared_invocation":301.8,"Shader.PrepareArtifact":99.091,"Shader.ResolveAbi":11.236,"Shader.ResolveGraphicsAbi":15.284,"Shader.ResolveGraphicsStagesAbi":68.194,"VideoOut.Flip":162.068,"VideoOut.Flip.completion_mutex_wait":0.057,"VideoOut.Flip.config_mutex_wait":0.013,"VideoOut.Flip.frame_limit":0.049,"VideoOut.Flip.notify_game":0.773,"VideoOut.Flip.present":157.94,"VideoOut.Flip.validate":0.1,"VideoOut.Flip.vblank_wait":0.049,"VideoOut.Flip.window_prepare":0.107,"VideoOut.Flip.window_title":2.949,"VideoOut.Readiness":0.111,"VideoOut.Readiness.locks_validate":0.052,"Vulkan.Acquire":0.609,"Vulkan.Acquire.acquire_fence_wait":0.104,"Vulkan.Acquire.acquire_image":0.345,"Vulkan.Acquire.fence_reset":0.118,"Vulkan.Acquire.retired_swapchains":0.023,"Vulkan.ComputePipeline":1178.179,"Vulkan.Dispatch":41751.997,"Vulkan.Dispatch.command_record":302.137,"Vulkan.Dispatch.shader_resources":41440.951,"Vulkan.DispatchRecipe":49.353,"Vulkan.DispatchRecipe.command_record":49.075,"Vulkan.DrawFromRecipe":24.222,"Vulkan.GraphicsPipeline":3884.937,"Vulkan.GraphicsPipeline.create":3720.114,"Vulkan.GraphicsPipeline.modules_and_state":5.692,"Vulkan.GraphicsPipelineLibrary":3699.446,"Vulkan.GraphicsPipelineLink":0.068,"Vulkan.GraphicsPipelinePrebuild":160.695,"Vulkan.Present":5.044,"Vulkan.Present.command_record_scale":1.813,"Vulkan.Present.pixel_upload":0.189,"Vulkan.Present.queue_submit":3.0,"Vulkan.QueuePresent":23.274,"Vulkan.QueuePresent.queue_present":23.187,"Vulkan.Retire":128.451,"Vulkan.Retire.wait":127.082},"top_phases_ms_per_frame":{"Driver.Packet":1949.037,"Driver.Dispatch":847.355,"Driver.Packet.dispatch":840.698,"Driver.Packet.draw":788.351,"Driver.Draw":787.284,"Vulkan.Dispatch":759.127,"Vulkan.Dispatch.shader_resources":753.472,"Resources.Complete":750.009},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":275,"Graphics.Barrier.dispatch-lead":37292,"Graphics.Barrier.dispatch-trail":41021,"Graphics.Barrier.draw":63780,"Graphics.Barrier.fill":1370,"Graphics.Barrier.indirect-args":5775,"Graphics.Barrier.input-mirror":12722,"Graphics.Barrier.label-run":31300,"Graphics.Barrier.present-blit":110,"Graphics.Barrier.shadow-publish":2684,"Graphics.Barrier.staging-in":19227,"Graphics.Barrier.staging-out":10104,"Graphics.Barrier.storage-upload":6220,"Graphics.Barrier.storage-writeback":15193,"Graphics.Barrier.template-refresh":112,"Graphics.BarrierMerged.dispatch-lead":15279,"Graphics.BarrierMerged.fill":280,"Graphics.BarrierMerged.label-run":46,"Graphics.BarrierMerged.shadow-publish":2598,"Graphics.BarrierMerged.staging-in":12750,"Graphics.BarrierMerged.staging-out":10104,"Graphics.BarrierMerged.storage-writeback":5707,"Graphics.Copy":49189,"Graphics.Copy.bytes":4693849204,"Graphics.RenderPass":29821,"Graphics.RenderPass.Close.command":24136,"Graphics.RenderPass.Close.image":207,"Graphics.RenderPass.Close.key":694,"Graphics.RenderPass.Close.label":46,"Graphics.RenderPass.Close.new-batch":4738,"Graphics.RenderPass.Continued":214387},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":43.573,"events_lost":105056,"totals_full":false}},"trace":"aps5-trace-241bfd31f250-56360.json.gz"}

this change:

{"commit":"951c551bc9aa","dirty":false,"env":{"APS5_LAZY_SHADER_PREPARE":"1","APS5_PAD_SCRIPT":"<path>","APS5_TRACE_SECONDS":"660:60"},"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 616.92","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-14900HX","cpu_threads":32,"memory_mib":32543,"title_id":"PPSA23566","title":"EA SPORTS™ UFC® 6","content_version":"01.004.000","resolution":"1920x1080","window":{"spec":"seconds 660:60","first_present":12256,"ms":60007.258},"presents":173,"frame_ms":{"p50":327.693,"p90":355.977,"p99":393.988,"max":3685.623},"gpu_busy_ms_per_present":286.305,"worker_busy_pct":{"queue worker 0x0":97.075,"queue worker 0x29":6.129,"queue worker 0x2a":5.75,"queue worker 0x2b":5.647,"queue worker 0x2c":5.564,"queue worker 0x2d":5.997,"queue worker 0x2e":6.017,"queue worker 0x2f":6.119,"queue worker 0x28":6.414},"phase_totals_ms":{"Driver.Completion":5.105,"Driver.Dispatch":21000.758,"Driver.Dispatch.capture_resources":1033.387,"Driver.Dispatch.decode_key_device_setup":8231.868,"Driver.Dispatch.lookup_cache":79.466,"Driver.Dispatch.materialize":195.253,"Driver.Dispatch.prepared_invocation":128.629,"Driver.Draw":25465.232,"Driver.Draw.device_setup":502.835,"Driver.Draw.draw_enqueued":13010.736,"Driver.Draw.post_compile_prepare":95.599,"Driver.Draw.prepare":1422.206,"Driver.Draw.shader_compile_and_link":8936.42,"Driver.EndSubmission":74.439,"Driver.Packet":86757.596,"Driver.Packet.device_lock":279.236,"Driver.Packet.dispatch":20886.213,"Driver.Packet.draw":25630.148,"Driver.Packet.execute":16601.845,"Driver.Packet.flip_flush":4.597,"Driver.Packet.flush_between_packets":713.768,"Driver.Packet.memory_wait":20839.432,"Driver.Packet.pipeline_drain":445.837,"Driver.Packet.pipeline_prepare":363.48,"Driver.Packet.prepare_memory":457.171,"Driver.Packet.rendering_wait":0.127,"Driver.Present":622.309,"Driver.Present.acquire_image":2.023,"Driver.Present.device_setup":0.084,"Driver.Present.gpu_mutex_wait":0.923,"Driver.Present.inflight_wait":0.37,"Driver.Present.present_display_buffer":22.243,"Driver.Present.queue_present":69.773,"Driver.Present.release_and_callback":0.276,"Driver.Present.render_fence_wait":526.15,"Driver.Present.resize":0.297,"Driver.Present.validate":0.042,"Driver.Suspend":0.025,"GpuMutex.wait.dispatch":1440.778,"GpuMutex.wait.draw":1463.771,"GpuMutex.wait.end":41.721,"GpuMutex.wait.fill":1.473,"GpuMutex.wait.flush":7.316,"GpuMutex.wait.hook":62.989,"GpuMutex.wait.indirect":2.001,"GpuMutex.wait.label":63.899,"GpuMutex.wait.other":0.415,"GpuMutex.wait.present":0.617,"GpuMutex.wait.wait":0.224,"Graphics.Draw":24298.114,"Graphics.Draw.draw_and_resource_release":22491.769,"Graphics.Draw.index_upload":873.097,"Graphics.Draw.validate":730.447,"Graphics.Draw.vertex_upload":83.563,"Graphics.DrawWithRecipe":1228.21,"Graphics.DrawWithRecipe.draw_and_resource_release":1227.011,"Graphics.DrawWithRecipe.index_upload":0.077,"Graphics.DrawWithRecipe.validate":0.501,"Graphics.DrawWithRecipe.vertex_upload":0.395,"Recorder.Reap":269.959,"Recorder.Submit":594.874,"Recorder.Sync":1289.406,"Recorder.WaitSerial":1.813,"Resources.Complete":1529.767,"Resources.Prepare":5108.823,"Shader.DrawStage":7831.879,"Shader.DrawStage.capture_resources":5773.837,"Shader.DrawStage.materialize":1257.134,"Shader.DrawStage.prepared_invocation":723.537,"Shader.ResolveAbi":8.495,"Shader.ResolveGraphicsAbi":4.62,"Shader.ResolveGraphicsStagesAbi":33.547,"VideoOut.Flip":633.815,"VideoOut.Flip.completion_mutex_wait":0.202,"VideoOut.Flip.config_mutex_wait":0.02,"VideoOut.Flip.frame_limit":0.088,"VideoOut.Flip.notify_game":3.402,"VideoOut.Flip.present":619.439,"VideoOut.Flip.validate":0.154,"VideoOut.Flip.vblank_wait":0.09,"VideoOut.Flip.window_prepare":0.342,"VideoOut.Flip.window_title":9.921,"VideoOut.Readiness":0.34,"VideoOut.Readiness.locks_validate":0.15,"Vulkan.Acquire":1.856,"Vulkan.Acquire.acquire_fence_wait":0.303,"Vulkan.Acquire.acquire_image":1.077,"Vulkan.Acquire.fence_reset":0.307,"Vulkan.Acquire.retired_swapchains":0.11,"Vulkan.Dispatch":3191.183,"Vulkan.Dispatch.command_record":740.064,"Vulkan.Dispatch.shader_resources":2425.451,"Vulkan.DispatchRecipe":95.959,"Vulkan.DispatchRecipe.command_record":95.192,"Vulkan.DrawFromRecipe":1228.706,"Vulkan.GraphicsPipeline":3341.821,"Vulkan.GraphicsPipeline.create":3339.881,"Vulkan.GraphicsPipeline.modules_and_state":1.928,"Vulkan.GraphicsPipelineLibrary":3339.71,"Vulkan.GraphicsPipelineLink":0.072,"Vulkan.Present":17.294,"Vulkan.Present.command_record_scale":5.809,"Vulkan.Present.pixel_upload":1.804,"Vulkan.Present.queue_submit":9.541,"Vulkan.QueuePresent":69.54,"Vulkan.QueuePresent.queue_present":69.265,"Vulkan.Retire":526.052,"Vulkan.Retire.wait":522.385},"top_phases_ms_per_frame":{"Driver.Packet":501.489,"Driver.Packet.draw":148.151,"Driver.Draw":147.198,"Graphics.Draw":140.452,"Graphics.Draw.draw_and_resource_release":130.01,"Driver.Dispatch":121.392,"Driver.Packet.dispatch":120.73,"Driver.Packet.memory_wait":120.459},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":1730,"Graphics.Barrier.dispatch-lead":112832,"Graphics.Barrier.dispatch-trail":126670,"Graphics.Barrier.draw":156041,"Graphics.Barrier.fill":4329,"Graphics.Barrier.indirect-args":18165,"Graphics.Barrier.input-mirror":22081,"Graphics.Barrier.label-run":89268,"Graphics.Barrier.present-blit":346,"Graphics.Barrier.shadow-publish":3846,"Graphics.Barrier.staging-in":55934,"Graphics.Barrier.staging-out":33831,"Graphics.Barrier.storage-upload":17572,"Graphics.Barrier.storage-writeback":32467,"Graphics.Barrier.template-refresh":235,"Graphics.BarrierMerged.dispatch-lead":50168,"Graphics.BarrierMerged.fill":863,"Graphics.BarrierMerged.label-run":506,"Graphics.BarrierMerged.shadow-publish":3812,"Graphics.BarrierMerged.staging-in":46816,"Graphics.BarrierMerged.staging-out":33831,"Graphics.BarrierMerged.storage-writeback":12224,"Graphics.Copy":137616,"Graphics.Copy.bytes":16620575032,"Graphics.RenderPass":74879,"Graphics.RenderPass.Close.command":60657,"Graphics.RenderPass.Close.image":667,"Graphics.RenderPass.Close.key":1745,"Graphics.RenderPass.Close.label":506,"Graphics.RenderPass.Close.new-batch":11304,"Graphics.RenderPass.Continued":704660},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":13.956,"events_lost":804261,"totals_full":false},"draw committer":{"events_full_after_s":45.686,"events_lost":72982,"totals_full":false}},"trace":"aps5-trace-951c551bc9aa-43844.json.gz"}

Checklist

  • Based on current main; no other open PR implements the same functions (#5372 changes the same joinedRun check; see What)
  • 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 4070 Laptop GPU, driver 616.92, Windows 11 Pro 26300 (tests); RTX 4070 SUPER, driver 621.24 (captures, by @Logan1h)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5350292158 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22072). Originally posted by [nicolasabosch](https://github.com/nicolasabosch) on 2026-11-17T03:55:13Z. --- ### What A buffer range that starts inside one registered range and crosses into the next, across a host import window boundary, has no import that covers it, so `main` copies it through the CPU on every bind: a guest read that waits on the recorder's fence while holding the GPU mutex. - `UploadFinish` now joins the adjacent registered ranges such a buffer crosses into one import and binds the buffer in place, as for any range one import covers. - `joinedRun` accepts a buffer that starts inside the first crossed range when that range is no larger than the import window and the crossed ranges are at most two import windows longer than the span being joined (`run.bytes <= end - begin + 2 * window`). That span is the buffer, widened by `importJoined` to the whole of any joined import it starts or ends in, as for every join, so a buffer that ends inside an existing joined import is measured up to that import's end. This is intended: the new join replaces that import, so it must cover it. A first range larger than the window keeps the rule from #15658, whose test (`a buffer bound from inside a range larger than the import window across more than a window of small ranges was joined`) still passes. - The existing join path makes the import (alignment, import limit, budget and eviction, remembered failures and refusals), retires the per-window imports it overlaps, and `findImport` finds it on the next bind. Only non-sparse regions that are host-backed or writable take this join; a join that cannot be made leaves the range copied as before. - `APS5_NO_JOIN_STRADDLE=1` turns the join off (new `ENVIRONMENT.md` row). - `deviceLocalHasRoom` no longer throws on a device without a device-local memory type; it reports no room instead. - The host-imports debt entry gains one clause for this join, through the fragment `docs/dev/debt/changes/perf-agc-join-straddling-imports.md`. Overlap: #5372 relaxes the same `joinedRun` check for a buffer bound from inside a range (`begin == run.base || run.bytes <= window`) and edits the same assertion in `importJoinTests`. The two rules differ: #5372 caps the joined run at one window and also widens `importJoined` to non-joined neighbouring imports; this change keeps the widening as it is and bounds the run by the buffer's size plus two windows. Whichever merges second needs a rebase on these lines; the order is to be agreed with its author. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11 Pro, MinGW (GCC, Release), NVIDIA GeForce RTX 4070 Laptop GPU. `ctest -R '^(agc_graphics_profile_draw|agc_bda_staging.*|agc_changed_copy.*|agc_driver_host_import_windows|agc_driver_host_import_alias_failure|agc_driver_partial_resident_alias)$'` passed (8/8). After review (61cc86904ef): `deviceLocalHasRoom` keeps its 250 ms throttle on a device with no device-local memory type, and the read-only V# test sorts the address ranges before checking coverage; the same 8 tests pass, with the validation layer and no `VUID-` error, and `agc_driver_graphics` and the `agc_driver_bda_*` tests pass too (17/17). `agc_graphics_profile_draw` runs the BDA import-join tests: `importJoinTests` now binds 32 bytes from 16 bytes before the end of one 64 KiB piece into the next and requires one joined import over both pieces, bound in place with nothing copied; `spaceReadAcrossImportsTests` takes a third build and requires the read-only V# across two imports to be bound in place at its offset in the joined import without dissolving the cached address space. With `APS5_NO_JOIN_STRADDLE=1`, `agc_graphics_profile_draw` fails (1 run): "a buffer bound from inside the first of two pieces no larger than the import window across the import window boundary was not joined and bound in place". Validation layer: the same tests on `main` (ec9f1426283) and on this branch with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer`, `ANYPS5_NO_SHADER_CACHE=1` and `ANYPS5_REQUIRE_VULKAN=1` through `ctest -V` (Khronos validation layer 1.4.363.1): every log shows `Insert instance layer "VK_LAYER_KHRONOS_validation"` (11 times in each), none reports `was not found but was requested by env var VK_INSTANCE_LAYERS`, and neither run logs a `VUID-` error. Performance (captured by @Logan1h on Windows 11, Ryzen 5 7500F, RTX 4070 SUPER, NVIDIA 621.24; paired 60 s captures of the same practice fight in EA SPORTS UFC 6 (PPSA23566, 01.004.000), `main` vs this change; traces and `trace_digest.py` outputs attached): | Metric | main | change | Change | | --- | ---: | ---: | ---: | | frame p50 | 753.153 ms | 415.194 ms | -44.9% | | frame p90 | 948.136 ms | 608.772 ms | -35.8% | | presents | 86 | 138 | +60.5% | | GPU busy/present | 227.081 ms | 253.884 ms | +11.8% | Traces and `trace_digest.py` outputs (both traces report `trace_dropped` after the queue-worker event buffer fills; the summary lines, phase totals and import counters are complete): - main `b7aeb6f406` with read-only diagnostics: [event trace](https://github.com/Logan1h/AnyPS5/releases/download/evidence-18515-ufc6-2026-11-16/aps5-trace-3ac73c78593d-17476.json.gz), [digest](https://github.com/Logan1h/AnyPS5/releases/download/evidence-18515-ufc6-2026-11-16/digest-armA.txt) - the same base and diagnostics with this change: [event trace](https://github.com/Logan1h/AnyPS5/releases/download/evidence-18515-ufc6-2026-11-16/aps5-trace-885264da9d37-11396.json.gz), [digest](https://github.com/Logan1h/AnyPS5/releases/download/evidence-18515-ufc6-2026-11-16/digest-armD.txt) The GPU-busy increase comes from direct host-import reads replacing the CPU-side copies. Second capture, of this port (with the guard for #15658's rule), on another machine (NVIDIA GeForce RTX 4070 Laptop GPU, driver 616.92, Intel Core i9-14900HX, Windows 11 Pro 26300): one 60 s capture each with `APS5_TRACE_SECONDS=660:60`, warm shader caches, same scripted practice fight of EA SPORTS UFC 6 (PPSA23566, 01.004.000). Both builds are `main` 2a8a0d1fc33 plus the pad-script commit of #22064, which only injects the scripted input. | | `main` | this change | | --- | ---: | ---: | | summary line | `seconds 660:60 from present 11012: 55 presents, frame p50 1004.2 / p90 1086.4 / p99 5716.0 / max 5716.0 ms, GPU busy 288.6 ms per present` | `seconds 660:60 from present 12256: 173 presents, frame p50 327.7 / p90 356.0 / p99 394.0 / max 3685.6 ms, GPU busy 286.3 ms per present` | Traces and `trace_digest.py` outputs: `main`: [trace](https://github.com/nicolasabosch/AnyPS5/releases/download/perf-traces-2026-11-17/main-m1.json.gz), [digest](https://github.com/nicolasabosch/AnyPS5/releases/download/perf-traces-2026-11-17/main-m1.digest.md); this change: [trace](https://github.com/nicolasabosch/AnyPS5/releases/download/perf-traces-2026-11-17/join-m1.json.gz), [digest](https://github.com/nicolasabosch/AnyPS5/releases/download/perf-traces-2026-11-17/join-m1.digest.md). <details><summary><code>aps5-summary.jsonl</code> lines</summary> main: ```json {"commit":"241bfd31f250","dirty":false,"env":{"APS5_LAZY_SHADER_PREPARE":"1","APS5_PAD_SCRIPT":"<path>","APS5_TRACE_SECONDS":"660:60"},"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 616.92","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-14900HX","cpu_threads":32,"memory_mib":32543,"title_id":"PPSA23566","title":"EA SPORTS™ UFC® 6","content_version":"01.004.000","resolution":"1920x1080","window":{"spec":"seconds 660:60","first_present":11012,"ms":60290.998},"presents":55,"frame_ms":{"p50":1004.223,"p90":1086.447,"p99":5716.009,"max":5716.009},"gpu_busy_ms_per_present":288.557,"worker_busy_pct":{"queue worker 0x0":98.497,"queue worker 0x29":9.422,"queue worker 0x2a":9.638,"queue worker 0x2b":9.261,"queue worker 0x2c":9.156,"queue worker 0x2d":9.287,"queue worker 0x2e":9.069,"queue worker 0x2f":9.205,"queue worker 0x28":14.485},"phase_totals_ms":{"Driver.Completion":1.369,"Driver.Dispatch":46604.504,"Driver.Dispatch.capture_resources":329.533,"Driver.Dispatch.decode_key_device_setup":1032.629,"Driver.Dispatch.lookup_cache":25.702,"Driver.Dispatch.materialize":85.816,"Driver.Dispatch.prepared_invocation":200.01,"Driver.Draw":43300.605,"Driver.Draw.device_setup":176.166,"Driver.Draw.draw_enqueued":39186.962,"Driver.Draw.post_compile_prepare":29.268,"Driver.Draw.prepare":542.715,"Driver.Draw.shader_compile_and_link":3092.764,"Driver.EndSubmission":131.14,"Driver.Packet":107197.022,"Driver.Packet.device_lock":90.675,"Driver.Packet.dispatch":46238.381,"Driver.Packet.draw":43359.308,"Driver.Packet.execute":4144.494,"Driver.Packet.flip_flush":1.678,"Driver.Packet.flush_between_packets":279.296,"Driver.Packet.memory_wait":12276.403,"Driver.Packet.pipeline_drain":135.683,"Driver.Packet.pipeline_prepare":119.436,"Driver.Packet.prepare_memory":147.483,"Driver.Packet.rendering_wait":0.044,"Driver.Present":160.045,"Driver.Present.acquire_image":0.671,"Driver.Present.device_setup":0.036,"Driver.Present.gpu_mutex_wait":0.397,"Driver.Present.inflight_wait":0.152,"Driver.Present.present_display_buffer":6.623,"Driver.Present.queue_present":23.361,"Driver.Present.release_and_callback":0.099,"Driver.Present.render_fence_wait":128.474,"Driver.Present.resize":0.17,"Driver.Present.validate":0.021,"Driver.Suspend":0.007,"GpuMutex.wait.dispatch":579.319,"GpuMutex.wait.draw":34467.577,"GpuMutex.wait.end":193.154,"GpuMutex.wait.fill":0.144,"GpuMutex.wait.flush":8.82,"GpuMutex.wait.hook":87.515,"GpuMutex.wait.indirect":1.69,"GpuMutex.wait.label":257.307,"GpuMutex.wait.other":17.339,"GpuMutex.wait.present":0.275,"GpuMutex.wait.wait":0.082,"Graphics.Draw":8776.731,"Graphics.Draw.draw_and_resource_release":8097.741,"Graphics.Draw.index_upload":349.797,"Graphics.Draw.validate":255.887,"Graphics.Draw.vertex_upload":30.893,"Graphics.DrawWithRecipe":24.054,"Graphics.DrawWithRecipe.draw_and_resource_release":23.52,"Graphics.DrawWithRecipe.index_upload":0.033,"Graphics.DrawWithRecipe.validate":0.247,"Graphics.DrawWithRecipe.vertex_upload":0.164,"Recorder.Reap":480.593,"Recorder.Submit":349.225,"Recorder.Sync":18536.37,"Recorder.WaitSerial":173.32,"Resources.Complete":41250.476,"Resources.Prepare":357.457,"Shader.DrawStage":2721.353,"Shader.DrawStage.capture_resources":1865.394,"Shader.DrawStage.materialize":529.432,"Shader.DrawStage.prepared_invocation":301.8,"Shader.PrepareArtifact":99.091,"Shader.ResolveAbi":11.236,"Shader.ResolveGraphicsAbi":15.284,"Shader.ResolveGraphicsStagesAbi":68.194,"VideoOut.Flip":162.068,"VideoOut.Flip.completion_mutex_wait":0.057,"VideoOut.Flip.config_mutex_wait":0.013,"VideoOut.Flip.frame_limit":0.049,"VideoOut.Flip.notify_game":0.773,"VideoOut.Flip.present":157.94,"VideoOut.Flip.validate":0.1,"VideoOut.Flip.vblank_wait":0.049,"VideoOut.Flip.window_prepare":0.107,"VideoOut.Flip.window_title":2.949,"VideoOut.Readiness":0.111,"VideoOut.Readiness.locks_validate":0.052,"Vulkan.Acquire":0.609,"Vulkan.Acquire.acquire_fence_wait":0.104,"Vulkan.Acquire.acquire_image":0.345,"Vulkan.Acquire.fence_reset":0.118,"Vulkan.Acquire.retired_swapchains":0.023,"Vulkan.ComputePipeline":1178.179,"Vulkan.Dispatch":41751.997,"Vulkan.Dispatch.command_record":302.137,"Vulkan.Dispatch.shader_resources":41440.951,"Vulkan.DispatchRecipe":49.353,"Vulkan.DispatchRecipe.command_record":49.075,"Vulkan.DrawFromRecipe":24.222,"Vulkan.GraphicsPipeline":3884.937,"Vulkan.GraphicsPipeline.create":3720.114,"Vulkan.GraphicsPipeline.modules_and_state":5.692,"Vulkan.GraphicsPipelineLibrary":3699.446,"Vulkan.GraphicsPipelineLink":0.068,"Vulkan.GraphicsPipelinePrebuild":160.695,"Vulkan.Present":5.044,"Vulkan.Present.command_record_scale":1.813,"Vulkan.Present.pixel_upload":0.189,"Vulkan.Present.queue_submit":3.0,"Vulkan.QueuePresent":23.274,"Vulkan.QueuePresent.queue_present":23.187,"Vulkan.Retire":128.451,"Vulkan.Retire.wait":127.082},"top_phases_ms_per_frame":{"Driver.Packet":1949.037,"Driver.Dispatch":847.355,"Driver.Packet.dispatch":840.698,"Driver.Packet.draw":788.351,"Driver.Draw":787.284,"Vulkan.Dispatch":759.127,"Vulkan.Dispatch.shader_resources":753.472,"Resources.Complete":750.009},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":275,"Graphics.Barrier.dispatch-lead":37292,"Graphics.Barrier.dispatch-trail":41021,"Graphics.Barrier.draw":63780,"Graphics.Barrier.fill":1370,"Graphics.Barrier.indirect-args":5775,"Graphics.Barrier.input-mirror":12722,"Graphics.Barrier.label-run":31300,"Graphics.Barrier.present-blit":110,"Graphics.Barrier.shadow-publish":2684,"Graphics.Barrier.staging-in":19227,"Graphics.Barrier.staging-out":10104,"Graphics.Barrier.storage-upload":6220,"Graphics.Barrier.storage-writeback":15193,"Graphics.Barrier.template-refresh":112,"Graphics.BarrierMerged.dispatch-lead":15279,"Graphics.BarrierMerged.fill":280,"Graphics.BarrierMerged.label-run":46,"Graphics.BarrierMerged.shadow-publish":2598,"Graphics.BarrierMerged.staging-in":12750,"Graphics.BarrierMerged.staging-out":10104,"Graphics.BarrierMerged.storage-writeback":5707,"Graphics.Copy":49189,"Graphics.Copy.bytes":4693849204,"Graphics.RenderPass":29821,"Graphics.RenderPass.Close.command":24136,"Graphics.RenderPass.Close.image":207,"Graphics.RenderPass.Close.key":694,"Graphics.RenderPass.Close.label":46,"Graphics.RenderPass.Close.new-batch":4738,"Graphics.RenderPass.Continued":214387},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":43.573,"events_lost":105056,"totals_full":false}},"trace":"aps5-trace-241bfd31f250-56360.json.gz"} ``` this change: ```json {"commit":"951c551bc9aa","dirty":false,"env":{"APS5_LAZY_SHADER_PREPARE":"1","APS5_PAD_SCRIPT":"<path>","APS5_TRACE_SECONDS":"660:60"},"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 616.92","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-14900HX","cpu_threads":32,"memory_mib":32543,"title_id":"PPSA23566","title":"EA SPORTS™ UFC® 6","content_version":"01.004.000","resolution":"1920x1080","window":{"spec":"seconds 660:60","first_present":12256,"ms":60007.258},"presents":173,"frame_ms":{"p50":327.693,"p90":355.977,"p99":393.988,"max":3685.623},"gpu_busy_ms_per_present":286.305,"worker_busy_pct":{"queue worker 0x0":97.075,"queue worker 0x29":6.129,"queue worker 0x2a":5.75,"queue worker 0x2b":5.647,"queue worker 0x2c":5.564,"queue worker 0x2d":5.997,"queue worker 0x2e":6.017,"queue worker 0x2f":6.119,"queue worker 0x28":6.414},"phase_totals_ms":{"Driver.Completion":5.105,"Driver.Dispatch":21000.758,"Driver.Dispatch.capture_resources":1033.387,"Driver.Dispatch.decode_key_device_setup":8231.868,"Driver.Dispatch.lookup_cache":79.466,"Driver.Dispatch.materialize":195.253,"Driver.Dispatch.prepared_invocation":128.629,"Driver.Draw":25465.232,"Driver.Draw.device_setup":502.835,"Driver.Draw.draw_enqueued":13010.736,"Driver.Draw.post_compile_prepare":95.599,"Driver.Draw.prepare":1422.206,"Driver.Draw.shader_compile_and_link":8936.42,"Driver.EndSubmission":74.439,"Driver.Packet":86757.596,"Driver.Packet.device_lock":279.236,"Driver.Packet.dispatch":20886.213,"Driver.Packet.draw":25630.148,"Driver.Packet.execute":16601.845,"Driver.Packet.flip_flush":4.597,"Driver.Packet.flush_between_packets":713.768,"Driver.Packet.memory_wait":20839.432,"Driver.Packet.pipeline_drain":445.837,"Driver.Packet.pipeline_prepare":363.48,"Driver.Packet.prepare_memory":457.171,"Driver.Packet.rendering_wait":0.127,"Driver.Present":622.309,"Driver.Present.acquire_image":2.023,"Driver.Present.device_setup":0.084,"Driver.Present.gpu_mutex_wait":0.923,"Driver.Present.inflight_wait":0.37,"Driver.Present.present_display_buffer":22.243,"Driver.Present.queue_present":69.773,"Driver.Present.release_and_callback":0.276,"Driver.Present.render_fence_wait":526.15,"Driver.Present.resize":0.297,"Driver.Present.validate":0.042,"Driver.Suspend":0.025,"GpuMutex.wait.dispatch":1440.778,"GpuMutex.wait.draw":1463.771,"GpuMutex.wait.end":41.721,"GpuMutex.wait.fill":1.473,"GpuMutex.wait.flush":7.316,"GpuMutex.wait.hook":62.989,"GpuMutex.wait.indirect":2.001,"GpuMutex.wait.label":63.899,"GpuMutex.wait.other":0.415,"GpuMutex.wait.present":0.617,"GpuMutex.wait.wait":0.224,"Graphics.Draw":24298.114,"Graphics.Draw.draw_and_resource_release":22491.769,"Graphics.Draw.index_upload":873.097,"Graphics.Draw.validate":730.447,"Graphics.Draw.vertex_upload":83.563,"Graphics.DrawWithRecipe":1228.21,"Graphics.DrawWithRecipe.draw_and_resource_release":1227.011,"Graphics.DrawWithRecipe.index_upload":0.077,"Graphics.DrawWithRecipe.validate":0.501,"Graphics.DrawWithRecipe.vertex_upload":0.395,"Recorder.Reap":269.959,"Recorder.Submit":594.874,"Recorder.Sync":1289.406,"Recorder.WaitSerial":1.813,"Resources.Complete":1529.767,"Resources.Prepare":5108.823,"Shader.DrawStage":7831.879,"Shader.DrawStage.capture_resources":5773.837,"Shader.DrawStage.materialize":1257.134,"Shader.DrawStage.prepared_invocation":723.537,"Shader.ResolveAbi":8.495,"Shader.ResolveGraphicsAbi":4.62,"Shader.ResolveGraphicsStagesAbi":33.547,"VideoOut.Flip":633.815,"VideoOut.Flip.completion_mutex_wait":0.202,"VideoOut.Flip.config_mutex_wait":0.02,"VideoOut.Flip.frame_limit":0.088,"VideoOut.Flip.notify_game":3.402,"VideoOut.Flip.present":619.439,"VideoOut.Flip.validate":0.154,"VideoOut.Flip.vblank_wait":0.09,"VideoOut.Flip.window_prepare":0.342,"VideoOut.Flip.window_title":9.921,"VideoOut.Readiness":0.34,"VideoOut.Readiness.locks_validate":0.15,"Vulkan.Acquire":1.856,"Vulkan.Acquire.acquire_fence_wait":0.303,"Vulkan.Acquire.acquire_image":1.077,"Vulkan.Acquire.fence_reset":0.307,"Vulkan.Acquire.retired_swapchains":0.11,"Vulkan.Dispatch":3191.183,"Vulkan.Dispatch.command_record":740.064,"Vulkan.Dispatch.shader_resources":2425.451,"Vulkan.DispatchRecipe":95.959,"Vulkan.DispatchRecipe.command_record":95.192,"Vulkan.DrawFromRecipe":1228.706,"Vulkan.GraphicsPipeline":3341.821,"Vulkan.GraphicsPipeline.create":3339.881,"Vulkan.GraphicsPipeline.modules_and_state":1.928,"Vulkan.GraphicsPipelineLibrary":3339.71,"Vulkan.GraphicsPipelineLink":0.072,"Vulkan.Present":17.294,"Vulkan.Present.command_record_scale":5.809,"Vulkan.Present.pixel_upload":1.804,"Vulkan.Present.queue_submit":9.541,"Vulkan.QueuePresent":69.54,"Vulkan.QueuePresent.queue_present":69.265,"Vulkan.Retire":526.052,"Vulkan.Retire.wait":522.385},"top_phases_ms_per_frame":{"Driver.Packet":501.489,"Driver.Packet.draw":148.151,"Driver.Draw":147.198,"Graphics.Draw":140.452,"Graphics.Draw.draw_and_resource_release":130.01,"Driver.Dispatch":121.392,"Driver.Packet.dispatch":120.73,"Driver.Packet.memory_wait":120.459},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":1730,"Graphics.Barrier.dispatch-lead":112832,"Graphics.Barrier.dispatch-trail":126670,"Graphics.Barrier.draw":156041,"Graphics.Barrier.fill":4329,"Graphics.Barrier.indirect-args":18165,"Graphics.Barrier.input-mirror":22081,"Graphics.Barrier.label-run":89268,"Graphics.Barrier.present-blit":346,"Graphics.Barrier.shadow-publish":3846,"Graphics.Barrier.staging-in":55934,"Graphics.Barrier.staging-out":33831,"Graphics.Barrier.storage-upload":17572,"Graphics.Barrier.storage-writeback":32467,"Graphics.Barrier.template-refresh":235,"Graphics.BarrierMerged.dispatch-lead":50168,"Graphics.BarrierMerged.fill":863,"Graphics.BarrierMerged.label-run":506,"Graphics.BarrierMerged.shadow-publish":3812,"Graphics.BarrierMerged.staging-in":46816,"Graphics.BarrierMerged.staging-out":33831,"Graphics.BarrierMerged.storage-writeback":12224,"Graphics.Copy":137616,"Graphics.Copy.bytes":16620575032,"Graphics.RenderPass":74879,"Graphics.RenderPass.Close.command":60657,"Graphics.RenderPass.Close.image":667,"Graphics.RenderPass.Close.key":1745,"Graphics.RenderPass.Close.label":506,"Graphics.RenderPass.Close.new-batch":11304,"Graphics.RenderPass.Continued":704660},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":13.956,"events_lost":804261,"totals_full":false},"draw committer":{"events_full_after_s":45.686,"events_lost":72982,"totals_full":false}},"trace":"aps5-trace-951c551bc9aa-43844.json.gz"} ``` </details> ### 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 (#5372 changes the same `joinedRun` check; see What) - [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 4070 Laptop GPU, driver 616.92, Windows 11 Pro 26300 (tests); RTX 4070 SUPER, driver 621.24 (captures, by @Logan1h) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-11-17 09:08:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T09:08:25Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head reviewed: d86f2cb161de60dee98520fee81478cdb9df64e2, base main.
  • No build and no tests. The review host is Linux; the author's tests are Windows-only (MinGW).
  • Read-only reader commands against the head, for example:
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 1800 1860
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 2325 2370
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6272 6300
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6736 6762
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp 700 724
python3 repo_read.py search deviceLocalHasRoom core/libs/prx/libSceAgcDriver

Results

Check Result Note
Build and ctest (Windows) not run Author-reported only
Changed hunks read at head passed Reader, see above
Performance captures not run Author-reported, not checked

Findings

Blocking

None.

Non-blocking

  • core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp:6290: when no device-local memory type exists, deviceLocalHasRoom returns false before it stores checkedMs. The 250 ms throttle is then skipped, and the memory properties are queried on every call for that device. The case is unlikely on real hardware, so this is cosmetic.

Not verified

  • The Windows test run and the two performance captures (author-reported; I did not run them).
  • Driver behaviour of joined imports on NVIDIA and Windows, which the reader cannot show. The debt entry names the 8 MiB window as a choice that is not measured on RADV.
  • core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp:2897: the new covered loop in spaceReadAcrossImportsTests assumes AddressRanges() returns ranges in address order. I did not check that.
  • The overlap with #5372, #15658 and #22064 and the rebase order. I did not check those PRs.
  • Files read: GuestBufferMemory.cpp (changed hunks and their callers at head, through the reader), BdaResources.cpp (changed hunks and the setup it uses), ENVIRONMENT.md and perf-agc-join-straddling-imports.md (from the diff). Excluded: none.

To get this to a good state

Nothing is required.

Optional: clear checkedMs (or return before the throttle check) in the no-device-local branch of deviceLocalHasRoom, and check the ordering of AddressRanges() in the new test loop.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5935662553 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22072#pullrequestreview-5935662553). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T09:08:25Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head reviewed: `d86f2cb161de60dee98520fee81478cdb9df64e2`, base `main`. - No build and no tests. The review host is Linux; the author's tests are Windows-only (MinGW). - Read-only reader commands against the head, for example: ``` python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 1800 1860 python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 2325 2370 python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6272 6300 python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6736 6762 python3 repo_read.py cat core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp 700 724 python3 repo_read.py search deviceLocalHasRoom core/libs/prx/libSceAgcDriver ``` ## Results | Check | Result | Note | | --- | --- | --- | | Build and ctest (Windows) | not run | Author-reported only | | Changed hunks read at head | passed | Reader, see above | | Performance captures | not run | Author-reported, not checked | ## Findings **Blocking** None. **Non-blocking** - `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp:6290`: when no device-local memory type exists, `deviceLocalHasRoom` returns `false` before it stores `checkedMs`. The 250 ms throttle is then skipped, and the memory properties are queried on every call for that device. The case is unlikely on real hardware, so this is cosmetic. ## Not verified - The Windows test run and the two performance captures (author-reported; I did not run them). - Driver behaviour of joined imports on NVIDIA and Windows, which the reader cannot show. The debt entry names the 8 MiB window as a choice that is not measured on RADV. - `core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp:2897`: the new `covered` loop in `spaceReadAcrossImportsTests` assumes `AddressRanges()` returns ranges in address order. I did not check that. - The overlap with #5372, #15658 and #22064 and the rebase order. I did not check those PRs. - Files read: `GuestBufferMemory.cpp` (changed hunks and their callers at head, through the reader), `BdaResources.cpp` (changed hunks and the setup it uses), `ENVIRONMENT.md` and `perf-agc-join-straddling-imports.md` (from the diff). Excluded: none. ## To get this to a good state Nothing is required. Optional: clear `checkedMs` (or return before the throttle check) in the no-device-local branch of `deviceLocalHasRoom`, and check the ordering of `AddressRanges()` in the new test loop.
kurexw commented 2026-11-17 09:35:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kurexw on 2026-11-17T09:35:17Z.

Review: COMMENTED


Tested on macOS 27.2 on an Apple M4. This is an x86-64 build under Rosetta with Apple clang 21.0.0, on MoltenVK 1.4.2 from the LunarG Vulkan SDK 1.4.363.1.

Method. The base was main at a72186d3cf plus #22056 and #22074, which fix the macOS build of two other targets; both have since merged. I built the base and this PR merged onto it (a clean merge) in two separate build directories. I ran them alternately, base then PR, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and VK_LOADER_DEBUG=layer: three runs each. The pattern adds the tests named in the description to the BDA and graphics tests:

ctest --test-dir build -R '^agc_driver_graphics$|^agc_driver_bda_|^agc_bda_|^agc_graphics_profile_draw$|^agc_changed_copy|^agc_driver_host_import_|^agc_driver_partial_resident_alias$' -V
base (3 runs) This PR (3 runs)
Passed 22 of 23 22 of 23, the same tests
agc_graphics_profile_draw (runs importJoinTests) Passed Passed, with the PR's new straddling-buffer case
agc_driver_host_import_windows Passed Passed
agc_driver_host_import_dma_buf_watch Skipped Skipped
Layer inserts per run 23 23
was not found but was requested 0 0
VUID- lines 16, all VUID-VkDeviceCreateInfo-sType-unique 16, the same

The 16 sType-unique lines come from device creation and appear on the base as often as with the PR, so this PR adds no validation errors.

Negative control. I kept this PR's test and restored the base's GuestBufferMemory.cpp. Then agc_graphics_profile_draw fails with a buffer bound from inside the first of two pieces no larger than the import window across the import window boundary was not joined and bound in place. So the join path runs on macOS: MoltenVK's host import accepts the joined range on the M4.

Not tested: the speed claim, since I have no title or capture here. I also didn't try APS5_NO_JOIN_STRADDLE=1.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5936015602 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22072#pullrequestreview-5936015602). Originally posted by [kurexw](https://github.com/kurexw) on 2026-11-17T09:35:17Z. **Review:** COMMENTED --- Tested on macOS 27.2 on an Apple M4. This is an x86-64 build under Rosetta with Apple clang 21.0.0, on MoltenVK 1.4.2 from the LunarG Vulkan SDK 1.4.363.1. **Method.** The base was `main` at a72186d3cf plus #22056 and #22074, which fix the macOS build of two other targets; both have since merged. I built the base and this PR merged onto it (a clean merge) in two separate build directories. I ran them alternately, base then PR, with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` and `VK_LOADER_DEBUG=layer`: three runs each. The pattern adds the tests named in the description to the BDA and graphics tests: ``` ctest --test-dir build -R '^agc_driver_graphics$|^agc_driver_bda_|^agc_bda_|^agc_graphics_profile_draw$|^agc_changed_copy|^agc_driver_host_import_|^agc_driver_partial_resident_alias$' -V ``` | | base (3 runs) | This PR (3 runs) | | --- | --- | --- | | Passed | 22 of 23 | 22 of 23, the same tests | | `agc_graphics_profile_draw` (runs `importJoinTests`) | Passed | Passed, with the PR's new straddling-buffer case | | `agc_driver_host_import_windows` | Passed | Passed | | `agc_driver_host_import_dma_buf_watch` | Skipped | Skipped | | Layer inserts per run | 23 | 23 | | `was not found but was requested` | 0 | 0 | | `VUID-` lines | 16, all `VUID-VkDeviceCreateInfo-sType-unique` | 16, the same | The 16 `sType-unique` lines come from device creation and appear on the base as often as with the PR, so this PR adds no validation errors. **Negative control.** I kept this PR's test and restored the base's `GuestBufferMemory.cpp`. Then `agc_graphics_profile_draw` fails with `a buffer bound from inside the first of two pieces no larger than the import window across the import window boundary was not joined and bound in place`. So the join path runs on macOS: MoltenVK's host import accepts the joined range on the M4. Not tested: the speed claim, since I have no title or capture here. I also didn't try `APS5_NO_JOIN_STRADDLE=1`.
MarcZX10 commented 2026-11-17 15:54:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T15:54:20Z.

Review: COMMENTED


Reviewed — no blocking findings

The changed hunks show no verified defect, but the review is incomplete: no build or test was run, and the full GuestBufferMemory.cpp was not read, so this is a comment, not an approval.

Nothing blocks this; the points below are optional.

What I ran

Exact head: 61cc86904ef77b8f1273d43fa415962453761763, base main. No build, no ctest, no validation-layer run. I read the run folder (description.md, commits.md, manifest.json, diff.patch, files.json) and the house rules, then read repository code at the head with repo_read.py:

repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 1800 1850
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 1675 1690
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6268 6302
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6750 6765
repo_read.py search "hostBacked" core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
repo_read.py search "HostImportOffset" core/libs/prx/libSceAgcDriver
repo_read.py search "HostImportFor(" core/libs/prx/libSceAgcDriver/tests

Files read: GuestBufferMemory.cpp through its changed hunks in diff.patch and the ranges above, not the whole file (8124 lines, excluded from the run folder for size). tests/BdaResources.cpp, docs/dev/ENVIRONMENT.md and the debt fragment through their changed hunks in diff.patch; I did not open their full copies in files/. No file was excluded by rule.

Results

Check Result Note
Changed hunks read passed all four files in files.json
Head code read passed ranges only, listed above
Build and ctest not run author reports 8/8 and 17/17
Validation layer not run author reports no VUID- error
Performance captures not run author reports, not checked

Findings

Blocking

None verified.

Non-blocking

  • core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp:6290: on a device with no device-local memory type, deviceLocalHasRoom returns false for every bytes, including 0. The normal path returns bytes <= room, which is true for 0 when room is 0. This branch also leaves liveShadowLimit at its previous value. Impact looks small; I did not check whether any caller passes 0.

Sources

Not verified

  • No build or test was run. The ctest, validation-layer and performance figures in the description are the author's; I did not confirm them.
  • GuestBufferMemory.cpp was read only in the ranges above. Callers of joinedRun and importJoined outside those ranges were not checked.
  • continuesRun checks readable, writable and gpu, but not host-backed. The straddle gate in UploadFinish checks only the target region. I did not confirm whether a host-backed read-only region can join a neighbour that is not host-backed.
  • The debt clause is delivered through the new fragment. I did not check how the fragment is merged into the main host-imports entry.
  • The Windows alias behaviour described in the debt text was not verified.

To get this to a good state

Nothing is required.

To move this to APPROVE, the next review needs the full GuestBufferMemory.cpp read, and the author's build and ctest output for head 61cc86904ef7 attached.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5941804931 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22072#pullrequestreview-5941804931). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T15:54:20Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The changed hunks show no verified defect, but the review is incomplete: no build or test was run, and the full `GuestBufferMemory.cpp` was not read, so this is a comment, not an approval. Nothing blocks this; the points below are optional. ## What I ran Exact head: `61cc86904ef77b8f1273d43fa415962453761763`, base `main`. No build, no `ctest`, no validation-layer run. I read the run folder (`description.md`, `commits.md`, `manifest.json`, `diff.patch`, `files.json`) and the house rules, then read repository code at the head with `repo_read.py`: ``` repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 1800 1850 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 1675 1690 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6268 6302 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6750 6765 repo_read.py search "hostBacked" core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp repo_read.py search "HostImportOffset" core/libs/prx/libSceAgcDriver repo_read.py search "HostImportFor(" core/libs/prx/libSceAgcDriver/tests ``` Files read: `GuestBufferMemory.cpp` through its changed hunks in `diff.patch` and the ranges above, not the whole file (8124 lines, excluded from the run folder for size). `tests/BdaResources.cpp`, `docs/dev/ENVIRONMENT.md` and the debt fragment through their changed hunks in `diff.patch`; I did not open their full copies in `files/`. No file was excluded by rule. ## Results | Check | Result | Note | | --- | --- | --- | | Changed hunks read | passed | all four files in `files.json` | | Head code read | passed | ranges only, listed above | | Build and `ctest` | not run | author reports 8/8 and 17/17 | | Validation layer | not run | author reports no `VUID-` error | | Performance captures | not run | author reports, not checked | ## Findings ### Blocking None verified. ### Non-blocking - `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp:6290`: on a device with no device-local memory type, `deviceLocalHasRoom` returns `false` for every `bytes`, including `0`. The normal path returns `bytes <= room`, which is `true` for `0` when room is `0`. This branch also leaves `liveShadowLimit` at its previous value. Impact looks small; I did not check whether any caller passes `0`. ## Sources - `joinedRun` with the straddle clause: https://github.com/boykopovar/AnyPS5/blob/61cc86904ef77b8f1273d43fa415962453761763/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L1837-L1847 - `continuesRun`: https://github.com/boykopovar/AnyPS5/blob/61cc86904ef77b8f1273d43fa415962453761763/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L1675-L1677 - `deviceLocalHasRoom`: https://github.com/boykopovar/AnyPS5/blob/61cc86904ef77b8f1273d43fa415962453761763/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L6275-L6302 - `UploadFinish` join loop: https://github.com/boykopovar/AnyPS5/blob/61cc86904ef77b8f1273d43fa415962453761763/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L6756-L6761 - Straddle test: https://github.com/boykopovar/AnyPS5/blob/61cc86904ef77b8f1273d43fa415962453761763/core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp#L708-L718 ## Not verified - No build or test was run. The `ctest`, validation-layer and performance figures in the description are the author's; I did not confirm them. - `GuestBufferMemory.cpp` was read only in the ranges above. Callers of `joinedRun` and `importJoined` outside those ranges were not checked. - `continuesRun` checks readable, writable and gpu, but not host-backed. The straddle gate in `UploadFinish` checks only the target region. I did not confirm whether a host-backed read-only region can join a neighbour that is not host-backed. - The debt clause is delivered through the new fragment. I did not check how the fragment is merged into the main host-imports entry. - The Windows alias behaviour described in the debt text was not verified. ## To get this to a good state Nothing is required. To move this to `APPROVE`, the next review needs the full `GuestBufferMemory.cpp` read, and the author's build and `ctest` output for head `61cc86904ef7` attached.
MarcZX10 commented 2026-11-17 16:13:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T16:13:57Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head 58ef1c564bd48f92de6e100278b24af38fe64ff1, base main. No merged-preview check.
  • Read the description, the commit list, the manifest and the diff from the review folder, then the changed regions at head with the repository reader:
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 1800 1850
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 2320 2375
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6266 6280
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6730 6770
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp 2860 2884
python3 repo_read.py search HostImportOffset core/libs/prx/libSceAgcDriver
python3 repo_read.py search hostBacked core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
python3 repo_read.py search shadowBytesLimit core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
python3 repo_read.py search "include <optional>" core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
  • No build and no test run in this review.

Results

Check Result Note
Changed hunks and their callers passed read at head, see What I ran
Performance table arithmetic passed percentages recompute from the figures given
Unit tests named in the description not run author-reported, Windows and MinGW
Validation layer run not run author-reported
Performance captures not run author-reported, traces not opened

Findings

Blocking

None.

Non-blocking

  • core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp:1845: the straddle bound compares against end - begin. importJoined may widen end first (GuestBufferMemory.cpp:2335, end = high->base + high->bytes), so for a buffer that ends inside a joined import the allowed run is larger than "buffer plus two windows" in the description. The run stays bounded, so this is not a defect shown. Confirm that the wider bound is intended, or take the bound from the original end.
  • The description says this change and #5372 both edit the joinedRun check, and that the merge order must be agreed with its author. That is coordination, not a code defect.

Not verified

  • Build and tests: none run here. The agc_* test runs, the APS5_NO_JOIN_STRADDLE=1 negative control and the validation-layer run are author-reported.
  • Performance: the table arithmetic is consistent, but the captures and traces were not opened or reproduced. The second capture comes from another machine.
  • GuestBufferMemory.cpp is 8124 lines. I read the changed hunks and the functions they call (joinedRun, crossedRun, importJoined, importRunAt, deviceLocalHasRoom, and the join loop in UploadFinish). How the join interacts with refreshImports, budget eviction and failedJoins was not traced.
  • deviceLocalHasRoom with no device-local memory type: room is 0 and the shadow limit falls back to the default in shadowBytesLimit. Checked by reading; not run.
  • The definition of the dissolvedImports counter was not checked. HostImportOffset is declared in GuestBufferMemory.hpp.
  • The new debt fragment was not compared with the other files in docs/dev/debt/changes/.
  • #5372 was not read.

Sources

  • Repository paths at 58ef1c564bd4: GuestBufferMemory.cpp lines 1837–1847, 2333–2344, 6283–6299, 6756–6760; tests/BdaResources.cpp lines 708–715 and 2878–2903. No permalinks are given.

To get this to a good state

Nothing is required.

Optional:

  • Confirm the intended bound at GuestBufferMemory.cpp:1845 when end was widened.
  • Agree the merge order with #5372 and rebase whichever PR merges second.

Files: all four files in the reviewed list were covered. GuestBufferMemory.cpp was read in the ranges above, BdaResources.cpp by its diff and lines 2860–2884, and ENVIRONMENT.md and the debt fragment by their diff only. Nothing was excluded.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5942130379 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22072#pullrequestreview-5942130379). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T16:13:57Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head `58ef1c564bd48f92de6e100278b24af38fe64ff1`, base `main`. No merged-preview check. - Read the description, the commit list, the manifest and the diff from the review folder, then the changed regions at head with the repository reader: ``` python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 1800 1850 python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 2320 2375 python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6266 6280 python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6730 6770 python3 repo_read.py cat core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp 2860 2884 python3 repo_read.py search HostImportOffset core/libs/prx/libSceAgcDriver python3 repo_read.py search hostBacked core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp python3 repo_read.py search shadowBytesLimit core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp python3 repo_read.py search "include <optional>" core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp ``` - No build and no test run in this review. ## Results | Check | Result | Note | | --- | --- | --- | | Changed hunks and their callers | passed | read at head, see What I ran | | Performance table arithmetic | passed | percentages recompute from the figures given | | Unit tests named in the description | not run | author-reported, Windows and MinGW | | Validation layer run | not run | author-reported | | Performance captures | not run | author-reported, traces not opened | ## Findings ### Blocking None. ### Non-blocking - `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp:1845`: the straddle bound compares against `end - begin`. `importJoined` may widen `end` first (`GuestBufferMemory.cpp:2335`, `end = high->base + high->bytes`), so for a buffer that ends inside a joined import the allowed run is larger than "buffer plus two windows" in the description. The run stays bounded, so this is not a defect shown. Confirm that the wider bound is intended, or take the bound from the original `end`. - The description says this change and #5372 both edit the `joinedRun` check, and that the merge order must be agreed with its author. That is coordination, not a code defect. ## Not verified - Build and tests: none run here. The `agc_*` test runs, the `APS5_NO_JOIN_STRADDLE=1` negative control and the validation-layer run are author-reported. - Performance: the table arithmetic is consistent, but the captures and traces were not opened or reproduced. The second capture comes from another machine. - `GuestBufferMemory.cpp` is 8124 lines. I read the changed hunks and the functions they call (`joinedRun`, `crossedRun`, `importJoined`, `importRunAt`, `deviceLocalHasRoom`, and the join loop in `UploadFinish`). How the join interacts with `refreshImports`, budget eviction and `failedJoins` was not traced. - `deviceLocalHasRoom` with no device-local memory type: room is 0 and the shadow limit falls back to the default in `shadowBytesLimit`. Checked by reading; not run. - The definition of the `dissolvedImports` counter was not checked. `HostImportOffset` is declared in `GuestBufferMemory.hpp`. - The new debt fragment was not compared with the other files in `docs/dev/debt/changes/`. - #5372 was not read. ## Sources - Repository paths at `58ef1c564bd4`: `GuestBufferMemory.cpp` lines 1837–1847, 2333–2344, 6283–6299, 6756–6760; `tests/BdaResources.cpp` lines 708–715 and 2878–2903. No permalinks are given. ## To get this to a good state Nothing is required. Optional: - Confirm the intended bound at `GuestBufferMemory.cpp:1845` when `end` was widened. - Agree the merge order with #5372 and rebase whichever PR merges second. Files: all four files in the reviewed list were covered. `GuestBufferMemory.cpp` was read in the ranges above, `BdaResources.cpp` by its diff and lines 2860–2884, and `ENVIRONMENT.md` and the debt fragment by their diff only. Nothing was excluded.
MarcZX10 commented 2026-11-17 18:31:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T18:31:42Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head 4e740bb21f360a6f4685df024b96eeedd4602909 (base main), PR #22072, 4 files in the review folder.
  • Read the description, commit list, manifest, files.json and diff.patch from the review folder.
  • Read the changed code at head with the repository reader (repo_read.py cat on GuestBufferMemory.cpp lines 1820–1850, 6270–6305, 6740–6760; repo_read.py search for joinedRun, shadowBytesLimit, HostImportOffset, memoryTypeCount, hostBacked, #include <optional>).
  • No build, no test run, no hosted CI check in this pass.

Results

Check Result Note
Diff read passed four files, all changed hunks
Code paths at head passed join rule, room check and import pass match the description
Tests run here not run the test counts in the description are the author's
Perf captures not run numbers are author- and third-party-reported
Hosted CI not run head checks not inspected
Commands
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 1820 1850
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6270 6305
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6740 6760
repo_read.py search shadowBytesLimit core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
repo_read.py search HostImportOffset core/libs/prx/libSceAgcDriver
repo_read.py search memoryTypeCount core/libs/prx/libSceAgcDriver
repo_read.py search hostBacked core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp

Findings

Blocking

None.

Non-blocking

  • core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp:6292 — when no memory type is device-local, the new branch sets liveShadowLimit to shadowBytesLimit(0), which returns 256 MiB at head. The description says only that the check "reports no room". The room is 0, so nothing is staged there, but the shadow limit is a separate value. Say what it should be, or name the reason for 256 MiB.
  • core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp:1845 — the straddle rule reads correctly against the description: the first crossed range is at most one window, and the run is capped at the widened span plus two windows. No defect found, but the cap has no test that sits exactly at the boundary.

Not verified

  • The build and the tests named in the description (8/8, 17/17, the validation-layer runs) were not run here. They are the author's results.
  • The performance numbers and traces, from two machines, were not reproduced. The traces are external links that I did not open.
  • Hosted CI for head 4e740bb21f36 was not inspected.
  • GuestBufferMemory.cpp is 8124 lines. I read the changed hunks and the three ranges above, not the whole file. Where the diff's changed regions depend on helpers outside those ranges, I relied on the reader searches.
  • The four files were read through diff.patch. I did not open their full texts in files/.
  • The overlap with #5372 was not checked. I have no access to that PR from here.
  • The NVIDIA driver and Windows alias behaviour in the debt fragment (docs/dev/debt/changes/perf-agc-join-straddling-imports.md) was not verified.

To get this to a good state

Nothing is required.

Optional: state the shadow limit used when no device-local memory type exists (see the non-blocking point above). Rerun the listed tests on the next head, if the head changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5944341550 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22072#pullrequestreview-5944341550). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T18:31:42Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head `4e740bb21f360a6f4685df024b96eeedd4602909` (base `main`), PR #22072, 4 files in the review folder. - Read the description, commit list, manifest, `files.json` and `diff.patch` from the review folder. - Read the changed code at head with the repository reader (`repo_read.py cat` on `GuestBufferMemory.cpp` lines 1820–1850, 6270–6305, 6740–6760; `repo_read.py search` for `joinedRun`, `shadowBytesLimit`, `HostImportOffset`, `memoryTypeCount`, `hostBacked`, `#include <optional>`). - No build, no test run, no hosted CI check in this pass. ## Results | Check | Result | Note | | --- | --- | --- | | Diff read | passed | four files, all changed hunks | | Code paths at head | passed | join rule, room check and import pass match the description | | Tests run here | not run | the test counts in the description are the author's | | Perf captures | not run | numbers are author- and third-party-reported | | Hosted CI | not run | head checks not inspected | <details> <summary>Commands</summary> ``` repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 1820 1850 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6270 6305 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp 6740 6760 repo_read.py search shadowBytesLimit core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp repo_read.py search HostImportOffset core/libs/prx/libSceAgcDriver repo_read.py search memoryTypeCount core/libs/prx/libSceAgcDriver repo_read.py search hostBacked core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp ``` </details> ## Findings **Blocking** None. **Non-blocking** - `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp:6292` — when no memory type is device-local, the new branch sets `liveShadowLimit` to `shadowBytesLimit(0)`, which returns 256 MiB at head. The description says only that the check "reports no room". The room is 0, so nothing is staged there, but the shadow limit is a separate value. Say what it should be, or name the reason for 256 MiB. - `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp:1845` — the straddle rule reads correctly against the description: the first crossed range is at most one window, and the run is capped at the widened span plus two windows. No defect found, but the cap has no test that sits exactly at the boundary. ## Not verified - The build and the tests named in the description (8/8, 17/17, the validation-layer runs) were not run here. They are the author's results. - The performance numbers and traces, from two machines, were not reproduced. The traces are external links that I did not open. - Hosted CI for head `4e740bb21f36` was not inspected. - `GuestBufferMemory.cpp` is 8124 lines. I read the changed hunks and the three ranges above, not the whole file. Where the diff's changed regions depend on helpers outside those ranges, I relied on the reader searches. - The four files were read through `diff.patch`. I did not open their full texts in `files/`. - The overlap with #5372 was not checked. I have no access to that PR from here. - The NVIDIA driver and Windows alias behaviour in the debt fragment (`docs/dev/debt/changes/perf-agc-join-straddling-imports.md`) was not verified. ## To get this to a good state Nothing is required. Optional: state the shadow limit used when no device-local memory type exists (see the non-blocking point above). Rerun the listed tests on the next head, if the head changes.
MarcZX10 commented 2026-11-18 01:26:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T01:26:05Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the reviewed code supports the intended straddling import behavior, and the author-reported checks provide supporting evidence.

What I ran

Head reviewed: 7099836106bb93eb24928c11fc042b4a27f36658. I inspected the prepared diff and targeted source through repo_read.py; no commands or tests were run.

Results

Check Result Note
Diff and changed code passed Targeted paths inspected
Tests not run Results in the description are author-reported

Findings

Blocking

None.

Non-blocking

None.

Not verified

The full text of core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp was excluded because it was too large for the review folder. I read targeted ranges covering the changed join logic, import creation, device-local room check, and UploadFinish call site. The other changed files were read at their changed sections: core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp, docs/dev/ENVIRONMENT.md, and docs/dev/debt/changes/perf-agc-join-straddling-imports.md. Tests, performance captures, and physical console behavior were not independently verified; the description reports the test and capture results.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5949455295 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22072#pullrequestreview-5949455295). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-18T01:26:05Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the reviewed code supports the intended straddling import behavior, and the author-reported checks provide supporting evidence. ## What I ran Head reviewed: `7099836106bb93eb24928c11fc042b4a27f36658`. I inspected the prepared diff and targeted source through `repo_read.py`; no commands or tests were run. ## Results | Check | Result | Note | | --- | --- | --- | | Diff and changed code | passed | Targeted paths inspected | | Tests | not run | Results in the description are author-reported | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The full text of `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` was excluded because it was too large for the review folder. I read targeted ranges covering the changed join logic, import creation, device-local room check, and `UploadFinish` call site. The other changed files were read at their changed sections: `core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp`, `docs/dev/ENVIRONMENT.md`, and `docs/dev/debt/changes/perf-agc-join-straddling-imports.md`. Tests, performance captures, and physical console behavior were not independently verified; the description reports the test and capture results. ## To get this to a good state Nothing is required.
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!22072
No description provided.