perf(agc): reuse immutable buffer copies and batch uploads #1364

Closed
TibixDev wants to merge 10 commits from upstream-pr/1364 into main
TibixDev commented 2026-10-08 00:23:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-08T00:23:09Z.


Status after review

Needs topic split and isolated title measurements.

The body now lists the legacy integration dependencies raised in review: #1324, #1357, #1359, #1360 and #1361. #1334 is merged and is not an open prerequisite. Current main's descriptor, snapshot and import-lifetime changes must be preserved; the historical branch copies cannot be treated as current dependencies.

The requested split remains necessary: copied-buffer version retention, batched upload pages, and shader-data streaming are three separate changes. The old combined 25 → 15.5 µs result cannot establish any one's benefit. The new main + experimental NGS Skyrim loading profile does identify expensive uploads, but it neither isolates immutable read-only reuse nor separates page batching from streaming. It is a useful lead, not before/after evidence for this head. No speculative large rebase or claim that its budget fix resolves the architectural/performance review.

What

Reuse immutable copies of read-only guest buffers. Upload small inputs and shader data into aligned batch pages. Keep each slice alive through GPU completion, preserve descriptor offsets, and invalidate cached copies only when their contents or backing change.

Tested

Earlier branch-specific tests and measurements remain in the discussion. They have not been rerun on a redesigned current-main version of this PR. The review audit and shared NGS-assisted title exploration do not establish that this head is merge-ready. No full Linux/Windows platform CI was dispatched in this pass.

Checklist

  • Current-main implementation and outstanding review requirements complete.
  • Isolated title benefit / reference validation established where required.
  • Depends on: #1324, #1357, #1359, #1360, #1361 (legacy integration; split/redesign required).
  • AI-assisted: yes.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4780094895 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1364). Originally posted by [TibixDev](https://github.com/TibixDev) on 2026-10-08T00:23:09Z. --- ### Status after review **Needs topic split and isolated title measurements.** The body now lists the legacy integration dependencies raised in review: #1324, #1357, #1359, #1360 and #1361. #1334 is merged and is not an open prerequisite. Current main's descriptor, snapshot and import-lifetime changes must be preserved; the historical branch copies cannot be treated as current dependencies. The requested split remains necessary: copied-buffer version retention, batched upload pages, and shader-data streaming are three separate changes. The old combined 25 → 15.5 µs result cannot establish any one's benefit. The new main + experimental NGS Skyrim loading profile does identify expensive uploads, but it neither isolates immutable read-only reuse nor separates page batching from streaming. It is a useful lead, not before/after evidence for this head. No speculative large rebase or claim that its budget fix resolves the architectural/performance review. ### What Reuse immutable copies of read-only guest buffers. Upload small inputs and shader data into aligned batch pages. Keep each slice alive through GPU completion, preserve descriptor offsets, and invalidate cached copies only when their contents or backing change. ### Tested Earlier branch-specific tests and measurements remain in the discussion. They have not been rerun on a redesigned current-main version of this PR. The review audit and shared NGS-assisted title exploration do not establish that this head is merge-ready. No full Linux/Windows platform CI was dispatched in this pass. ### Checklist - [ ] Current-main implementation and outstanding review requirements complete. - [ ] Isolated title benefit / reference validation established where required. - [x] Depends on: #1324, #1357, #1359, #1360, #1361 (legacy integration; split/redesign required). - [x] AI-assisted: yes.
TibixDev commented 2026-10-08 07:31:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-08T07:31:06Z.


Rebased on 1e1e1390. Preserved the #1113 batch memory budget and included retained draw-upload pages in its byte count. The upload fixture checks each buffer is counted once and that completion removes the bytes. Existing snapshot, mapping, and descriptor coverage remains intact.

Fedora 44 Release: agc_driver_graphics_tests, agc_driver_pm4_tests, guest_mapping_history_tests, agc_driver_recorder_tests, agc_recorder_kept_bytes_tests build; the targeted tests and contribution checks pass. Windows CI is pending.
RADV and lavapipe: --copied-buffers-only, --shader-data-only, --draw-upload-only, --draw-snapshot-only, --draw-descriptors-only pass with core and synchronization validation; no validation errors.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6054953749 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1364#issuecomment-6054953749). Originally posted by [TibixDev](https://github.com/TibixDev) on 2026-10-08T07:31:06Z. --- Rebased on `1e1e1390`. Preserved the #1113 batch memory budget and included retained draw-upload pages in its byte count. The upload fixture checks each buffer is counted once and that completion removes the bytes. Existing snapshot, mapping, and descriptor coverage remains intact. Fedora 44 Release: `agc_driver_graphics_tests`, `agc_driver_pm4_tests`, `guest_mapping_history_tests`, `agc_driver_recorder_tests`, `agc_recorder_kept_bytes_tests` build; the targeted tests and contribution checks pass. Windows CI is pending. RADV and lavapipe: `--copied-buffers-only`, `--shader-data-only`, `--draw-upload-only`, `--draw-snapshot-only`, `--draw-descriptors-only` pass with core and synchronization validation; no validation errors.
adriadam10 commented 2026-10-11 11:40:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:40:25Z.

Review: CHANGES_REQUESTED


Thanks for the work here. This can't be merged as is:

  • It is stacked on #1324, #1357, #1359, #1360 and #1361. All five are still open and conflict with main, so nothing here can land before them. The Depends on line lists #1334 (already merged) and #1360; please list the whole stack.
  • This head also conflicts with main (ShaderResources.hpp/.cpp, Recorder.cpp, GuestBufferMemory.cpp, GuestAllocations.cpp, tests/Recorder.cpp) after the recent descriptor and snapshot changes, so it needs the author rather than a mechanical rebase.
  • The gain is a component timing (16 KiB resource batches ~25 → 15.5 µs per draw, on your combined fork). Please name a title and scene where this shows up, with before/after frame times on current main; on #1324 @oneandonlydean measured no frame-time change and that question is still open.
  • At +1367 lines with a 694-line test change, please split it once the bases land (copied-buffer retention vs. batched upload pages vs. shader-data streaming) so each PR keeps one topic.

Please rebase once the base PRs are merged and we will review it again.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5483161102 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1364#pullrequestreview-5483161102). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T11:40:25Z. **Review:** CHANGES_REQUESTED --- Thanks for the work here. This can't be merged as is: - It is stacked on #1324, #1357, #1359, #1360 and #1361. All five are still open and conflict with `main`, so nothing here can land before them. The **Depends on** line lists #1334 (already merged) and #1360; please list the whole stack. - This head also conflicts with `main` (`ShaderResources.hpp/.cpp`, `Recorder.cpp`, `GuestBufferMemory.cpp`, `GuestAllocations.cpp`, `tests/Recorder.cpp`) after the recent descriptor and snapshot changes, so it needs the author rather than a mechanical rebase. - The gain is a component timing (16 KiB resource batches ~25 → 15.5 µs per draw, on your combined fork). Please name a title and scene where this shows up, with before/after frame times on current `main`; on #1324 @oneandonlydean measured no frame-time change and that question is still open. - At +1367 lines with a 694-line test change, please split it once the bases land (copied-buffer retention vs. batched upload pages vs. shader-data streaming) so each PR keeps one topic. Please rebase once the base PRs are merged and we will review it again.
TibixDev commented 2026-10-12 04:52:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-12T04:52:19Z.


Review-pass update:

The body now lists the legacy integration dependencies raised in review: #1324, #1357, #1359, #1360 and #1361. #1334 is merged and is not an open prerequisite. Current main's descriptor, snapshot and import-lifetime changes must be preserved; the historical branch copies cannot be treated as current dependencies.

The requested split remains necessary: copied-buffer version retention, batched upload pages, and shader-data streaming are three separate changes. The old combined 25 → 15.5 µs result cannot establish any one's benefit. The new main + experimental NGS Skyrim loading profile does identify expensive uploads, but it neither isolates immutable read-only reuse nor separates page batching from streaming. It is a useful lead, not before/after evidence for this head. No speculative large rebase or claim that its budget fix resolves the architectural/performance review.

I have updated the PR description to match this status. The PR remains open; the outstanding review requirements are not being marked resolved. AI-assisted audit.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6117977499 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1364#issuecomment-6117977499). Originally posted by [TibixDev](https://github.com/TibixDev) on 2026-10-12T04:52:19Z. --- Review-pass update: The body now lists the legacy integration dependencies raised in review: #1324, #1357, #1359, #1360 and #1361. #1334 is merged and is not an open prerequisite. Current main's descriptor, snapshot and import-lifetime changes must be preserved; the historical branch copies cannot be treated as current dependencies. The requested split remains necessary: copied-buffer version retention, batched upload pages, and shader-data streaming are three separate changes. The old combined 25 → 15.5 µs result cannot establish any one's benefit. The new main + experimental NGS Skyrim loading profile does identify expensive uploads, but it neither isolates immutable read-only reuse nor separates page batching from streaming. It is a useful lead, not before/after evidence for this head. No speculative large rebase or claim that its budget fix resolves the architectural/performance review. I have updated the PR description to match this status. The PR remains open; the outstanding review requirements are not being marked resolved. AI-assisted audit.
oneandonlydean commented 2026-10-14 05:09:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T05:09:48Z.


Closing for now: it carries three topics on a stack, and the author said it needs a redesign. With the queue this large we're closing stalled perf PRs that don't show a gain in a title; reopen it with before/after numbers from a title scene (the summary lines from the performance report form) if you pick it up again.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6161381008 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1364#issuecomment-6161381008). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T05:09:48Z. --- Closing for now: it carries three topics on a stack, and the author said it needs a redesign. With the queue this large we're closing stalled perf PRs that don't show a gain in a title; reopen it with before/after numbers from a title scene (the summary lines from the performance report form) if you pick it up again.

Pull request closed

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!1364
No description provided.