perf(agc): reuse read-only sparse buffer address uploads #27991

Merged
kteal merged 1 commit from upstream-pr/27991 into main 2026-12-04 00:19:26 +00:00
kteal commented 2026-11-28 01:28:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kteal on 2026-11-28T01:28:11Z.


What

Repeated read-only draws can share one unchanged Vulkan buffer, avoiding a request for another backing buffer, a guest-to-host copy and a hole clear. In a 220 MiB upload with 79 of 80 backed spans write-tracked, this reduced median host time per upload from 16.25–17.49 ms to 0.36–0.41 ms on an RTX 4070 Laptop.

A sparse buffer can have a shader device address even when every use of that address is read-only. The opt-in sparse comparison cache previously excluded every addressable buffer. Planet Zoo's Animal Market repeatedly uploaded large ranges with identical backing and bytes.

Allow a fresh sparse upload into the existing comparison cache when the address table grants no write permission and no declared shader write overlaps the full guest range. Addressable snapshots stay immutable. A live GPU write is flushed before validation. Spans without a valid unchanged-generation proof are compared byte for byte. A mismatch or inaccessible span falls back to the ordinary upload. A single backed span that already fills the trimmed allocation stays on the normal copy path. Matching device, usage, extent and backed layout are still required. The optimization uses the existing APS5_COMPARE_SPARSE_UPLOADS=1 switch.

#27451 covers a sparse piece that disappears between registration and upload. The addressable comparison here can only return an unchanged buffer. The existing upload path determines how to handle an inaccessible piece. Warm-cache integration review

Tested

Planet Zoo (PPSA18026), Goodwin House loading, RTX 4070 Laptop at 1920×1080. Four fresh processes used the same title executable, runtime libraries, preset, warm shader-cache seed and screen-triggered 60-second capture. Only the graphics driver changed. The measured revisions were 8c02bb89f41c and d39c2210ebf5. The submitted patch has the same stable Git patch ID after rebasing onto 4814cae85517. All four native traces retained every event. A separate, later 140-second window on main ended when the title exited before writing a summary and is excluded.

Run order Build Presents Seconds per present
1 main 138 0.75
2 feature 88 1.10
3 feature 77 1.00
4 main 131 0.56

Across the four windows the pooled frame time was 0.66 s on main and 1.05 s on the feature (60.4% higher). The mix of quick loading-screen presents and long scene-transition frames varied across launches, limiting what these means say about park performance. The public Perfetto extracts retain the native present markers and presentation and resource-completion durations on anonymous tracks. Frame digests · Summary lines

Two additional fresh processes used the submitted revisions and the same shader seed, GPU, settings and Goodwin scene. They requested a 30-second capture starting 110 seconds after confirming the loading screen.

Rebased build Presents Seconds per present
main 4814cae85517 1 36.88
feature 7042da5d054c 2 30.12

The later window has a small sample count because each heavy loading frame can exceed the requested window length.

Host cost per upload. One reader held the original snapshot. Four fresh RTX processes per layout each timed ten registrations and Upload(true) calls, in main / feature / feature / main order. The table reports each process median after discarding its first two samples. The 80-span layouts have 220 MiB of data across a 300 MiB guest range, with a 1 MiB hole after each backed span.

Backing Main medians (ms) Feature medians (ms)
192 MiB contiguous, trimmed tail 10.95, 10.95 10.93, 10.92
80 unwatched backed spans 16.26, 16.18 14.89, 15.82
Same layout, 79 spans write-tracked 17.49, 16.25 0.36, 0.41

On each 80-span layout, the feature returned the held Vulkan buffer in all 20 timed uploads. Main returned a buffer distinct from the held reader in all 20. On the trimmed dense control both revisions used the ordinary path for all 20 uploads. Comparing that dense buffer had been slower in an exploratory build, which motivated the fully backed check. Individual samples

Animal Market prototype. In five consecutive ten-present windows on the earlier park-capable renderer, enabling read-only address reuse saved 9.8% and 12.0% against adjacent controls. Those measurements used a separate integration build with the warm-decommit fix and allowed refresh of exclusively owned buffers. The submitted implementation keeps addressable snapshots immutable. The park percentages apply to the prototype.

GPU correctness. On Windows 11, the sparse-hole and read-only flush tests passed on each tested adapter on main and the feature. The read-only flush test also passed with sparse comparison explicitly enabled on both revisions. The feature fixture checks equal handles, a guest CPU mutation, GPU readback of the old and new snapshots, and exclusion of an overlapping shader write. The validation layer was loaded, the shader cache disabled, Vulkan required, and these runs logged zero VUIDs.

As a separate diagnostic, forcing the comparison cache on in the non-addressable pool-identity test on Intel caused the shortened upload to miss the pre-primed Vulkan handle on both main and this patch. Both diagnostic runs then logged the same device-destruction VUID during cleanup. The pool test passes under its normal settings on both revisions and GPUs.

Summary extracts and trace links

Run 1 · Run 2 · Run 3 · Run 4 · Run 5 · Run 6

{"commit":"8c02bb89f41c","dirty":null,"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 621.24","os":"Windows 10.0.26200","resolution":"1920x1080","title_id":"PPSA18026","window":{"spec":"seconds 0:60","first_present":777,"ms":103179.029},"presents":138,"frame_ms":{"p50":157.189,"p90":174.438,"p99":785.943,"max":80849.852},"gpu_busy_ms_per_present":44.954,"trace_dropped":false,"env":{"APS5_COMPARE_SPARSE_UPLOADS":"1","APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_TRACE_SECONDS":"0:60","APS5_UNIFORM_INDIRECT_RECORDS":"1"},"trace":"sparse-addr-main-8c02bb89f41c.json.gz","worker_busy_pct":{},"top_phases_ms_per_frame":{}}
{"commit":"d39c2210ebf5","dirty":null,"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 621.24","os":"Windows 10.0.26200","resolution":"1920x1080","title_id":"PPSA18026","window":{"spec":"seconds 0:60","first_present":916,"ms":96570.268},"presents":88,"frame_ms":{"p50":168.941,"p90":200.88,"p99":45925.886,"max":45925.886},"gpu_busy_ms_per_present":56.746,"trace_dropped":false,"env":{"APS5_COMPARE_SPARSE_UPLOADS":"1","APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_TRACE_SECONDS":"0:60","APS5_UNIFORM_INDIRECT_RECORDS":"1"},"trace":"sparse-addr-feature-d39c2210ebf5.json.gz","worker_busy_pct":{},"top_phases_ms_per_frame":{}}
{"commit":"d39c2210ebf5","dirty":null,"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 621.24","os":"Windows 10.0.26200","resolution":"1920x1080","title_id":"PPSA18026","window":{"spec":"seconds 0:60","first_present":941,"ms":77120.347},"presents":77,"frame_ms":{"p50":153.031,"p90":192.132,"p99":32455.733,"max":32455.733},"gpu_busy_ms_per_present":50.011,"trace_dropped":false,"env":{"APS5_COMPARE_SPARSE_UPLOADS":"1","APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_TRACE_SECONDS":"0:60","APS5_UNIFORM_INDIRECT_RECORDS":"1"},"trace":"sparse-addr-feature-repeat-d39c2210ebf5.json.gz","worker_busy_pct":{},"top_phases_ms_per_frame":{}}
{"commit":"8c02bb89f41c","dirty":null,"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 621.24","os":"Windows 10.0.26200","resolution":"1920x1080","title_id":"PPSA18026","window":{"spec":"seconds 0:60","first_present":895,"ms":73328.283},"presents":131,"frame_ms":{"p50":207.497,"p90":235.691,"p99":1029.028,"max":44996.214},"gpu_busy_ms_per_present":51.297,"trace_dropped":false,"env":{"APS5_COMPARE_SPARSE_UPLOADS":"1","APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_TRACE_SECONDS":"0:60","APS5_UNIFORM_INDIRECT_RECORDS":"1"},"trace":"sparse-addr-main-repeat-8c02bb89f41c.json.gz","worker_busy_pct":{},"top_phases_ms_per_frame":{}}
{"commit":"4814cae85517","dirty":null,"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 621.24","os":"Windows 10.0.26200","resolution":"1920x1080","title_id":"PPSA18026","window":{"spec":"seconds 0:30","first_present":1055,"ms":36876.862},"presents":1,"frame_ms":{"p50":36876.862,"p90":36876.862,"p99":36876.862,"max":36876.862},"gpu_busy_ms_per_present":739.905,"trace_dropped":false,"env":{"APS5_COMPARE_SPARSE_UPLOADS":"1","APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_TRACE_SECONDS":"0:30","APS5_UNIFORM_INDIRECT_RECORDS":"1"},"trace":"sparse-current-main-late-4814cae85517.json.gz","worker_busy_pct":{},"top_phases_ms_per_frame":{}}
{"commit":"7042da5d054c","dirty":null,"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 621.24","os":"Windows 10.0.26200","resolution":"1920x1080","title_id":"PPSA18026","window":{"spec":"seconds 0:30","first_present":1023,"ms":60236.436},"presents":2,"frame_ms":{"p50":30635.496,"p90":30635.496,"p99":30635.496,"max":30635.496},"gpu_busy_ms_per_present":752.627,"trace_dropped":false,"env":{"APS5_COMPARE_SPARSE_UPLOADS":"1","APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_TRACE_SECONDS":"0:30","APS5_UNIFORM_INDIRECT_RECORDS":"1"},"trace":"sparse-current-feature-late-7042da5d054c.json.gz","worker_busy_pct":{},"top_phases_ms_per_frame":{}}

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: Windows 11 build 26200, Intel Iris Xe Graphics (32.0.101.7088) and NVIDIA GeForce RTX 4070 Laptop GPU (32.0.16.2124, NVIDIA 621.24)
  • AI-assisted: yes

Summary by CodeRabbit

  • Performance
    • Read-only sparse uploads can now reuse cached buffers in additional safe cases, reducing unnecessary buffer allocations.
  • Bug Fixes
    • Writable uploads no longer reuse read-only snapshots, helping ensure changed data is reflected correctly.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5535368092 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27991). Originally posted by [kteal](https://github.com/kteal) on 2026-11-28T01:28:11Z. --- ### What Repeated read-only draws can share one unchanged Vulkan buffer, avoiding a request for another backing buffer, a guest-to-host copy and a hole clear. In a 220 MiB upload with 79 of 80 backed spans write-tracked, this reduced median host time per upload from 16.25–17.49 ms to 0.36–0.41 ms on an RTX 4070 Laptop. A sparse buffer can have a shader device address even when every use of that address is read-only. The opt-in sparse comparison cache previously excluded every addressable buffer. Planet Zoo's Animal Market repeatedly uploaded large ranges with identical backing and bytes. Allow a fresh sparse upload into the existing comparison cache when the address table grants no write permission and no declared shader write overlaps the full guest range. Addressable snapshots stay immutable. A live GPU write is flushed before validation. Spans without a valid unchanged-generation proof are compared byte for byte. A mismatch or inaccessible span falls back to the ordinary upload. A single backed span that already fills the trimmed allocation stays on the normal copy path. Matching device, usage, extent and backed layout are still required. The optimization uses the existing `APS5_COMPARE_SPARSE_UPLOADS=1` switch. #27451 covers a sparse piece that disappears between registration and upload. The addressable comparison here can only return an unchanged buffer. The existing upload path determines how to handle an inaccessible piece. [Warm-cache integration review](https://github.com/boykopovar/AnyPS5/pull/27451#pullrequestreview-6094597278) ### Tested **Planet Zoo (PPSA18026), Goodwin House loading, RTX 4070 Laptop at 1920×1080.** Four fresh processes used the same title executable, runtime libraries, preset, warm shader-cache seed and screen-triggered 60-second capture. Only the graphics driver changed. The measured revisions were `8c02bb89f41c` and `d39c2210ebf5`. The submitted patch has the same stable Git patch ID after rebasing onto `4814cae85517`. All four native traces retained every event. A separate, later 140-second window on main ended when the title exited before writing a summary and is excluded. | Run order | Build | Presents | Seconds per present | |---|---|---:|---:| | 1 | main | 138 | 0.75 | | 2 | feature | 88 | 1.10 | | 3 | feature | 77 | 1.00 | | 4 | main | 131 | 0.56 | Across the four windows the pooled frame time was **0.66 s on main and 1.05 s on the feature** (60.4% higher). The mix of quick loading-screen presents and long scene-transition frames varied across launches, limiting what these means say about park performance. The public Perfetto extracts retain the native present markers and presentation and resource-completion durations on anonymous tracks. [Frame digests](https://github.com/kteal/AnyPS5/releases/download/goodwin-sparse-address-d39c2210ebf5/frame-digests.md) · [Summary lines](https://github.com/kteal/AnyPS5/releases/download/goodwin-sparse-address-d39c2210ebf5/frame-summary.jsonl) Two additional fresh processes used the submitted revisions and the same shader seed, GPU, settings and Goodwin scene. They requested a 30-second capture starting 110 seconds after confirming the loading screen. | Rebased build | Presents | Seconds per present | |---|---:|---:| | main `4814cae85517` | 1 | 36.88 | | feature `7042da5d054c` | 2 | 30.12 | The later window has a small sample count because each heavy loading frame can exceed the requested window length. **Host cost per upload.** One reader held the original snapshot. Four fresh RTX processes per layout each timed ten registrations and `Upload(true)` calls, in main / feature / feature / main order. The table reports each process median after discarding its first two samples. The 80-span layouts have 220 MiB of data across a 300 MiB guest range, with a 1 MiB hole after each backed span. | Backing | Main medians (ms) | Feature medians (ms) | |---|---:|---:| | 192 MiB contiguous, trimmed tail | 10.95, 10.95 | 10.93, 10.92 | | 80 unwatched backed spans | 16.26, 16.18 | 14.89, 15.82 | | Same layout, 79 spans write-tracked | 17.49, 16.25 | 0.36, 0.41 | On each 80-span layout, the feature returned the held Vulkan buffer in all 20 timed uploads. Main returned a buffer distinct from the held reader in all 20. On the trimmed dense control both revisions used the ordinary path for all 20 uploads. Comparing that dense buffer had been slower in an exploratory build, which motivated the fully backed check. [Individual samples](https://github.com/kteal/AnyPS5/releases/download/goodwin-sparse-address-d39c2210ebf5/upload-cost.json) **Animal Market prototype.** In five consecutive ten-present windows on the earlier park-capable renderer, enabling read-only address reuse saved 9.8% and 12.0% against adjacent controls. Those measurements used a separate integration build with the warm-decommit fix and allowed refresh of exclusively owned buffers. The submitted implementation keeps addressable snapshots immutable. The park percentages apply to the prototype. **GPU correctness.** On Windows 11, the sparse-hole and read-only flush tests passed on each tested adapter on main and the feature. The read-only flush test also passed with sparse comparison explicitly enabled on both revisions. The feature fixture checks equal handles, a guest CPU mutation, GPU readback of the old and new snapshots, and exclusion of an overlapping shader write. The validation layer was loaded, the shader cache disabled, Vulkan required, and these runs logged zero VUIDs. As a separate diagnostic, forcing the comparison cache on in the non-addressable pool-identity test on Intel caused the shortened upload to miss the pre-primed Vulkan handle on both main and this patch. Both diagnostic runs then logged the same device-destruction VUID during cleanup. The pool test passes under its normal settings on both revisions and GPUs. <details><summary>Summary extracts and trace links</summary> [Run 1](https://github.com/kteal/AnyPS5/releases/download/goodwin-sparse-address-d39c2210ebf5/sparse-addr-main-8c02bb89f41c.json.gz) · [Run 2](https://github.com/kteal/AnyPS5/releases/download/goodwin-sparse-address-d39c2210ebf5/sparse-addr-feature-d39c2210ebf5.json.gz) · [Run 3](https://github.com/kteal/AnyPS5/releases/download/goodwin-sparse-address-d39c2210ebf5/sparse-addr-feature-repeat-d39c2210ebf5.json.gz) · [Run 4](https://github.com/kteal/AnyPS5/releases/download/goodwin-sparse-address-d39c2210ebf5/sparse-addr-main-repeat-8c02bb89f41c.json.gz) · [Run 5](https://github.com/kteal/AnyPS5/releases/download/goodwin-sparse-address-d39c2210ebf5/sparse-current-main-late-4814cae85517.json.gz) · [Run 6](https://github.com/kteal/AnyPS5/releases/download/goodwin-sparse-address-d39c2210ebf5/sparse-current-feature-late-7042da5d054c.json.gz) ```json {"commit":"8c02bb89f41c","dirty":null,"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 621.24","os":"Windows 10.0.26200","resolution":"1920x1080","title_id":"PPSA18026","window":{"spec":"seconds 0:60","first_present":777,"ms":103179.029},"presents":138,"frame_ms":{"p50":157.189,"p90":174.438,"p99":785.943,"max":80849.852},"gpu_busy_ms_per_present":44.954,"trace_dropped":false,"env":{"APS5_COMPARE_SPARSE_UPLOADS":"1","APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_TRACE_SECONDS":"0:60","APS5_UNIFORM_INDIRECT_RECORDS":"1"},"trace":"sparse-addr-main-8c02bb89f41c.json.gz","worker_busy_pct":{},"top_phases_ms_per_frame":{}} {"commit":"d39c2210ebf5","dirty":null,"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 621.24","os":"Windows 10.0.26200","resolution":"1920x1080","title_id":"PPSA18026","window":{"spec":"seconds 0:60","first_present":916,"ms":96570.268},"presents":88,"frame_ms":{"p50":168.941,"p90":200.88,"p99":45925.886,"max":45925.886},"gpu_busy_ms_per_present":56.746,"trace_dropped":false,"env":{"APS5_COMPARE_SPARSE_UPLOADS":"1","APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_TRACE_SECONDS":"0:60","APS5_UNIFORM_INDIRECT_RECORDS":"1"},"trace":"sparse-addr-feature-d39c2210ebf5.json.gz","worker_busy_pct":{},"top_phases_ms_per_frame":{}} {"commit":"d39c2210ebf5","dirty":null,"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 621.24","os":"Windows 10.0.26200","resolution":"1920x1080","title_id":"PPSA18026","window":{"spec":"seconds 0:60","first_present":941,"ms":77120.347},"presents":77,"frame_ms":{"p50":153.031,"p90":192.132,"p99":32455.733,"max":32455.733},"gpu_busy_ms_per_present":50.011,"trace_dropped":false,"env":{"APS5_COMPARE_SPARSE_UPLOADS":"1","APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_TRACE_SECONDS":"0:60","APS5_UNIFORM_INDIRECT_RECORDS":"1"},"trace":"sparse-addr-feature-repeat-d39c2210ebf5.json.gz","worker_busy_pct":{},"top_phases_ms_per_frame":{}} {"commit":"8c02bb89f41c","dirty":null,"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 621.24","os":"Windows 10.0.26200","resolution":"1920x1080","title_id":"PPSA18026","window":{"spec":"seconds 0:60","first_present":895,"ms":73328.283},"presents":131,"frame_ms":{"p50":207.497,"p90":235.691,"p99":1029.028,"max":44996.214},"gpu_busy_ms_per_present":51.297,"trace_dropped":false,"env":{"APS5_COMPARE_SPARSE_UPLOADS":"1","APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_TRACE_SECONDS":"0:60","APS5_UNIFORM_INDIRECT_RECORDS":"1"},"trace":"sparse-addr-main-repeat-8c02bb89f41c.json.gz","worker_busy_pct":{},"top_phases_ms_per_frame":{}} {"commit":"4814cae85517","dirty":null,"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 621.24","os":"Windows 10.0.26200","resolution":"1920x1080","title_id":"PPSA18026","window":{"spec":"seconds 0:30","first_present":1055,"ms":36876.862},"presents":1,"frame_ms":{"p50":36876.862,"p90":36876.862,"p99":36876.862,"max":36876.862},"gpu_busy_ms_per_present":739.905,"trace_dropped":false,"env":{"APS5_COMPARE_SPARSE_UPLOADS":"1","APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_TRACE_SECONDS":"0:30","APS5_UNIFORM_INDIRECT_RECORDS":"1"},"trace":"sparse-current-main-late-4814cae85517.json.gz","worker_busy_pct":{},"top_phases_ms_per_frame":{}} {"commit":"7042da5d054c","dirty":null,"gpu":"NVIDIA GeForce RTX 4070 Laptop GPU","driver":"NVIDIA 621.24","os":"Windows 10.0.26200","resolution":"1920x1080","title_id":"PPSA18026","window":{"spec":"seconds 0:30","first_present":1023,"ms":60236.436},"presents":2,"frame_ms":{"p50":30635.496,"p90":30635.496,"p99":30635.496,"max":30635.496},"gpu_busy_ms_per_present":752.627,"trace_dropped":false,"env":{"APS5_COMPARE_SPARSE_UPLOADS":"1","APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_TRACE_SECONDS":"0:30","APS5_UNIFORM_INDIRECT_RECORDS":"1"},"trace":"sparse-current-feature-late-7042da5d054c.json.gz","worker_busy_pct":{},"top_phases_ms_per_frame":{}} ``` </details> <!-- 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. --> ### 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 <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: Windows 11 build 26200, Intel Iris Xe Graphics (32.0.101.7088) and NVIDIA GeForce RTX 4070 Laptop GPU (32.0.16.2124, NVIDIA 621.24) <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Performance** * Read-only sparse uploads can now reuse cached buffers in additional safe cases, reducing unnecessary buffer allocations. * **Bug Fixes** * Writable uploads no longer reuse read-only snapshots, helping ensure changed data is reflected correctly. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Plyxen commented 2026-11-28 07:01:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-11-28T07:01:38Z.

Review: APPROVED


Checked head 7042da5d05. All on Windows 11 with WinLibs GCC 15.2 (Release), applied to main 4c7578e0a4 together with #28006, #27985, #28002, #28001, #27987, #28007, #27994. tools/check_conventions.py --head and tools/debt_fold.py --check passed and the full build succeeded. In the full CPU suite (5,135 tests) the only failure is windows_read_trap_unknown, which fails on main too (fixed in #28028). The full GPU suite (2,249 tests) on both GPUs, with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer and the 1.4.363 layer inserted, matches main on the same machine. The GPUs were an NVIDIA RTX 5080 (621.24) and an AMD Radeon gfx1036 iGPU (26.11.2). Only agc_driver_linear_target_import_creation fails, as on main (fixed in #28029), and neither log has a VUID- or SYNC-HAZARD line.

agc_driver_upload_cache_read_only_flush, which sets APS5_COMPARE_SPARSE_UPLOADS and runs CheckSparseAddressReads when buffer device addresses are available, passes on both GPUs.

One non-blocking note: the whole-title table shows the feature at 1.05 s per present against 0.66 s on main. So the title-level gain isn't shown yet, only the per-upload one. Since the path stays behind APS5_COMPARE_SPARSE_UPLOADS, the default is unchanged.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6096379322 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27991#pullrequestreview-6096379322). Originally posted by [Plyxen](https://github.com/Plyxen) on 2026-11-28T07:01:38Z. **Review:** APPROVED --- Checked head `7042da5d05`. All on Windows 11 with WinLibs GCC 15.2 (Release), applied to `main` `4c7578e0a4` together with #28006, #27985, #28002, #28001, #27987, #28007, #27994. `tools/check_conventions.py --head` and `tools/debt_fold.py --check` passed and the full build succeeded. In the full CPU suite (5,135 tests) the only failure is `windows_read_trap_unknown`, which fails on `main` too (fixed in #28028). The full GPU suite (2,249 tests) on both GPUs, with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer` and the 1.4.363 layer inserted, matches `main` on the same machine. The GPUs were an NVIDIA RTX 5080 (621.24) and an AMD Radeon gfx1036 iGPU (26.11.2). Only `agc_driver_linear_target_import_creation` fails, as on `main` (fixed in #28029), and neither log has a `VUID-` or `SYNC-HAZARD` line. `agc_driver_upload_cache_read_only_flush`, which sets `APS5_COMPARE_SPARSE_UPLOADS` and runs `CheckSparseAddressReads` when buffer device addresses are available, passes on both GPUs. One non-blocking note: the whole-title table shows the feature at 1.05 s per present against 0.66 s on `main`. So the title-level gain isn't shown yet, only the per-upload one. Since the path stays behind `APS5_COMPARE_SPARSE_UPLOADS`, the default is unchanged. AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-11-28 07:29:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T07:29:29Z.

Review: APPROVED


Reviewed — looks good

The read-only sparse upload reuse is guarded by address write permissions and write overlap checks, and the added test exercises cache reuse, mutation, and writable separation.

What I ran

Reviewed head 7042da5d054c33622b5f9704acc964960d2305bc. I inspected the prepared diff, changed source context, and the added execution test through repo_read.py; I ran no build or tests.

Results

Check Result Note
Diff and source review passed Two changed files read
Build and runtime tests not run No commands run

Findings

Blocking

None.

Non-blocking

None.

Not verified

No build or runtime test was run in this review. The author reports GPU tests and performance measurements, which I did not independently verify. The manifest lists two changed files; both were read. GuestBufferMemory.cpp was excluded from the review folder due to size and read through repo_read.py.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6096514331 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27991#pullrequestreview-6096514331). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-28T07:29:29Z. **Review:** APPROVED --- # Reviewed — looks good The read-only sparse upload reuse is guarded by address write permissions and write overlap checks, and the added test exercises cache reuse, mutation, and writable separation. ## What I ran Reviewed head `7042da5d054c33622b5f9704acc964960d2305bc`. I inspected the prepared diff, changed source context, and the added execution test through `repo_read.py`; I ran no build or tests. ## Results | Check | Result | Note | |---|---|---| | Diff and source review | passed | Two changed files read | | Build and runtime tests | not run | No commands run | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified No build or runtime test was run in this review. The author reports GPU tests and performance measurements, which I did not independently verify. The manifest lists two changed files; both were read. `GuestBufferMemory.cpp` was excluded from the review folder due to size and read through `repo_read.py`. ## To get this to a good state Nothing is required.
ligmaSec commented 2026-12-03 20:46:00 +00:00 (Migrated from github.com)

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

Review: COMMENTED


The new fixture checks that a guest byte change creates a new sparse address upload while the earlier upload remains intact. Could the same fixture also change the committed pieces with the guest range otherwise unchanged, then verify the newly absent bytes read as zero? That tests the pieces check on the addressable cache lookup.

Source review at 7042da5d05. The head trial-merges onto 700fae9438. Paired Vulkan execution is queued.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6178223852 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27991#pullrequestreview-6178223852). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T20:46:00Z. **Review:** COMMENTED --- The new fixture checks that a guest byte change creates a new sparse address upload while the earlier upload remains intact. Could the same fixture also change the committed pieces with the guest range otherwise unchanged, then verify the newly absent bytes read as zero? That tests the `pieces` check on the addressable cache lookup. Source review at `7042da5d05`. The head trial-merges onto `700fae9438`. Paired Vulkan execution is queued. AI-assisted: yes.
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!27991
No description provided.