perf(agc): settle Windows private imports larger than 64 KiB at the import #10443

Merged
Dripl1x merged 1 commit from upstream-pr/10443 into main 2026-11-24 09:10:34 +00:00
Dripl1x commented 2026-10-24 00:30:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dripl1x on 2026-10-24T00:30:38Z.


What

On Windows a host import of private memory under 1 MiB is compared until its deferred settle, and the deferred return to the write watch is skipped while a live storage image overlaps the range (the rewatch stamps it as a CPU store, which the image would take as a write over its results). SuperTuxKart (PPSA69421) views its small textures (96 KiB to 352 KiB) from storage images, so they stayed compared for good and every draw sampling one took the full revalidation walk with a byte compare.

  • Imports larger than one 64 KiB block now settle at the import, as the 1 MiB ones did, and stay in the write watch. 64 KiB imports, the size a title maps around every submission, keep the deferred settle.
  • The cost moves to the import: each new private import from 128 KiB up to 1 MiB waits for its settle read (the [buffers] line's "settled inside their window" counts them). In SuperTuxKart they are made once; a title that makes such imports every frame would pay a wait per import.
  • APS5_SETTLE_FLOOR_KIB sets the floor (1024 restores the old one). The retire test needs a 128 KiB import on the deferred path and sets it to 1024; with the default floor, an import replaced while its deferred read runs is now only reached by 64 KiB imports and has no test of its own.

SuperTuxKart main menu with the tutorial prompt (about 59 draws a frame), on a stack based on main a0900b9d99 (#7464, #9402, two local direct-memory changes and three other local changes), APS5_PROFILE_DRAW over 10 s, the old floor against this one on the same build:

revalidations time full walks draw recorded in
APS5_SETTLE_FLOOR_KIB=1024 33583 1339 ms 19435 (19355 for a failed collect) 104 us
this PR 18287 315 ms 204 (audits only) 82 us

Dumped menu frames 0 to 6 of both matched within a mean difference of 0.001. The menu runs at the title's 60 FPS cap either way, so this shows as spare time per frame, not FPS: on current heads (main 9d4fb4fb70 + #7464 + #9402 + this and three other local changes, the menu without the tutorial prompt, about 33 draws a frame) 59.94 FPS with and without it, the longest idle gap of queue worker 0 and the committer per frame 6.7–7.0 ms (median) with it against 5.9 and 6.2 ms without (a third run without it lost the window focus and is left out).

Overlap: #9941 also changes importRunAt (it marks partial-block imports settleOnDemand and settles them on demand before an initial multisampled DCC import, for #9724). With this PR a private import of more than 64 KiB, partial or not, settles at the import, which may already cover #9724's 784 KiB import; that was not tested on those titles. Whichever lands second needs a small rebase there.

Tested

This head: main 9d4fb4fb70 + this commit; merges cleanly into 5e6ae6e3d0. Windows 11 Pro 26300, Ryzen 7 5800H, RTX 3070 Laptop GPU (NVIDIA 621.01), WinLibs GCC 15.2.0 r7, Release: every ctest entry of agc_driver_recorder_tests (86, the agc_import_settle_* entries included), agc_driver_host_import_windows_tests, agc_driver_host_import_at_map_tests, agc_driver_host_import_teardown_tests, agc_host_import_retire_tests and agc_driver_guest_memory_lifetime_tests (6) passes.

Linux (Ubuntu 26.04 in WSL, llvmpipe), on the measurement stack: agc_driver_recorder passes (the change is Windows-only code).

Titles: SuperTuxKart menu as above. vkQuake (PPSA99010), on the earlier stack: 27 imports settled at the import over a run, 82–85 FPS with this series and without it. Not run: the full CTest suite, other titles, other GPUs.

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
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • 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
  • Unblocks: none
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4990991395 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10443). Originally posted by [Dripl1x](https://github.com/Dripl1x) on 2026-10-24T00:30:38Z. --- ### What On Windows a host import of private memory under 1 MiB is compared until its deferred settle, and the deferred return to the write watch is skipped while a live storage image overlaps the range (the rewatch stamps it as a CPU store, which the image would take as a write over its results). SuperTuxKart (PPSA69421) views its small textures (96 KiB to 352 KiB) from storage images, so they stayed compared for good and every draw sampling one took the full revalidation walk with a byte compare. - Imports larger than one 64 KiB block now settle at the import, as the 1 MiB ones did, and stay in the write watch. 64 KiB imports, the size a title maps around every submission, keep the deferred settle. - The cost moves to the import: each new private import from 128 KiB up to 1 MiB waits for its settle read (the `[buffers]` line's "settled inside their window" counts them). In SuperTuxKart they are made once; a title that makes such imports every frame would pay a wait per import. - `APS5_SETTLE_FLOOR_KIB` sets the floor (1024 restores the old one). The retire test needs a 128 KiB import on the deferred path and sets it to 1024; with the default floor, an import replaced while its deferred read runs is now only reached by 64 KiB imports and has no test of its own. SuperTuxKart main menu with the tutorial prompt (about 59 draws a frame), on a stack based on `main` `a0900b9d99` (#7464, #9402, two local direct-memory changes and three other local changes), `APS5_PROFILE_DRAW` over 10 s, the old floor against this one on the same build: | | revalidations | time | full walks | draw recorded in | |---|---|---|---|---| | `APS5_SETTLE_FLOOR_KIB=1024` | 33583 | 1339 ms | 19435 (19355 for a failed collect) | 104 us | | this PR | 18287 | 315 ms | 204 (audits only) | 82 us | Dumped menu frames 0 to 6 of both matched within a mean difference of 0.001. The menu runs at the title's 60 FPS cap either way, so this shows as spare time per frame, not FPS: on current heads (`main` `9d4fb4fb70` + #7464 + #9402 + this and three other local changes, the menu without the tutorial prompt, about 33 draws a frame) 59.94 FPS with and without it, the longest idle gap of queue worker 0 and the committer per frame 6.7–7.0 ms (median) with it against 5.9 and 6.2 ms without (a third run without it lost the window focus and is left out). Overlap: #9941 also changes `importRunAt` (it marks partial-block imports `settleOnDemand` and settles them on demand before an initial multisampled DCC import, for #9724). With this PR a private import of more than 64 KiB, partial or not, settles at the import, which may already cover #9724's 784 KiB import; that was not tested on those titles. Whichever lands second needs a small rebase there. ### Tested This head: `main` `9d4fb4fb70` + this commit; merges cleanly into `5e6ae6e3d0`. Windows 11 Pro 26300, Ryzen 7 5800H, RTX 3070 Laptop GPU (NVIDIA 621.01), WinLibs GCC 15.2.0 r7, Release: every ctest entry of `agc_driver_recorder_tests` (86, the `agc_import_settle_*` entries included), `agc_driver_host_import_windows_tests`, `agc_driver_host_import_at_map_tests`, `agc_driver_host_import_teardown_tests`, `agc_host_import_retire_tests` and `agc_driver_guest_memory_lifetime_tests` (6) passes. Linux (Ubuntu 26.04 in WSL, llvmpipe), on the measurement stack: `agc_driver_recorder` passes (the change is Windows-only code). Titles: SuperTuxKart menu as above. vkQuake (PPSA99010), on the earlier stack: 27 imports settled at the import over a run, 82–85 FPS with this series and without it. Not run: the full CTest suite, other titles, other GPUs. ### Checklist - [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) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] Unblocks: none - [x] AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-10-24 22:00:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T22:00:29Z.

Review: CHANGES_REQUESTED


Reviewed exact head 90b9574ad52da6ecf26c1cec51bd1fea2587d592 against refreshed upstream main c8d34aa8f4d8058d57169cc1e423ba6db00faaf0.

The threshold change is narrowly scoped to Windows private imports and preserves the 64 KiB deferred-settle path; the new 128 KiB retirement case restores the old 1 MiB floor for that test. The recorded Windows suite and SuperTuxKart measurements are useful, but they were run on a stack based on 9d4fb4fb70 with three additional local changes. The current branch is based on that same 9d4fb4fb70 commit, while current main has 20 commits not present here, including subsequent AGC import/write-watch changes. A merge-tree preview is clean, but that does not verify the changed settle behavior with the current integrated import paths.

Please update this branch to current main and rerun the focused Windows tests on the final composition: the recorder suite, host-import Windows/map/teardown suites, retire and guest-memory lifetime tests. Report which tests actually ran and whether the existing GPU/title comparison still holds on that base. Keep the environment floor override exercised so the retire test still covers deferred settling.

Local review: current-main merge-tree is clean; current-main conventions and diff-check pass. Hosted eligibility, intake, labels, report, and conventions pass; hosted product/relinker jobs are skipped. I cannot reproduce Windows/GPU tests locally. This request is for fresh integration evidence, not a claim that the implementation is incorrect.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5640193083 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10443#pullrequestreview-5640193083). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T22:00:29Z. **Review:** CHANGES_REQUESTED --- Reviewed exact head `90b9574ad52da6ecf26c1cec51bd1fea2587d592` against refreshed upstream `main` `c8d34aa8f4d8058d57169cc1e423ba6db00faaf0`. The threshold change is narrowly scoped to Windows private imports and preserves the 64 KiB deferred-settle path; the new 128 KiB retirement case restores the old 1 MiB floor for that test. The recorded Windows suite and SuperTuxKart measurements are useful, but they were run on a stack based on `9d4fb4fb70` with three additional local changes. The current branch is based on that same `9d4fb4fb70` commit, while current main has 20 commits not present here, including subsequent AGC import/write-watch changes. A merge-tree preview is clean, but that does not verify the changed settle behavior with the current integrated import paths. Please update this branch to current main and rerun the focused Windows tests on the final composition: the recorder suite, host-import Windows/map/teardown suites, retire and guest-memory lifetime tests. Report which tests actually ran and whether the existing GPU/title comparison still holds on that base. Keep the environment floor override exercised so the retire test still covers deferred settling. Local review: current-main merge-tree is clean; current-main conventions and diff-check pass. Hosted eligibility, intake, labels, report, and conventions pass; hosted product/relinker jobs are skipped. I cannot reproduce Windows/GPU tests locally. This request is for fresh integration evidence, not a claim that the implementation is incorrect.
MarcZX10 commented 2026-11-20 09:31:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T09:31:15Z.

Review: COMMENTED


Reviewed — no blocking findings

The changed logic and added test show no verified blocking defect; the author’s reported checks were not run in this review.

What I ran

Reviewed head 17cee297fbae905fb15bafd76ce5528b0a6f84c8 using the prepared review bundle and repo_read.py at the pinned head. No tests or other commands were run.

Results

Check Result Note
Changed code review passed Read the relevant implementation and test regions
Author-reported tests not run Results are reported in the PR description
Full CTest suite not run Not run in this review

Findings

Blocking

None.

Non-blocking

None.

Not verified

The author reports passing Windows and Linux checks and title runs in the PR description; these were not independently verified. The full test suite, other titles, and other GPUs were not run. Recorder.cpp was excluded from the prepared files because it was too large; I read its changed test region through the pinned reader. The changed files reviewed were core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp, core/libs/prx/libSceAgcDriver/tests/Recorder.cpp, core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake, and docs/dev/ENVIRONMENT.md.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5990446151 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10443#pullrequestreview-5990446151). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T09:31:15Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The changed logic and added test show no verified blocking defect; the author’s reported checks were not run in this review. ## What I ran Reviewed head `17cee297fbae905fb15bafd76ce5528b0a6f84c8` using the prepared review bundle and `repo_read.py` at the pinned head. No tests or other commands were run. ## Results | Check | Result | Note | |---|---|---| | Changed code review | passed | Read the relevant implementation and test regions | | Author-reported tests | not run | Results are reported in the PR description | | Full CTest suite | not run | Not run in this review | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The author reports passing Windows and Linux checks and title runs in the PR description; these were not independently verified. The full test suite, other titles, and other GPUs were not run. `Recorder.cpp` was excluded from the prepared files because it was too large; I read its changed test region through the pinned reader. The changed files reviewed were `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp`, `core/libs/prx/libSceAgcDriver/tests/Recorder.cpp`, `core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake`, and `docs/dev/ENVIRONMENT.md`. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-20 23:02:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T23:02:12Z.

Review: APPROVED


Reviewed — looks good

The review covers head 71dad17b46b484e92643878c2de04aea20e2187c; I found no verified blocking defect, and the author reports the relevant Windows test suites passed.

What I ran

Read the prepared diff and the changed code around the new threshold, test, CMake properties, and environment documentation. No commands or tests were run in this review.

Results

Check Result Note
Changed-line review passed All changed lines were read
Programmatic checks not run Windows test results are author-reported

Findings

Blocking

None.

Non-blocking

None.

Not verified

The author reports successful Windows 11 tests and a Linux recorder test, but those runs were not independently verified. I did not inspect the full contents of GuestBufferMemory.cpp or Recorder.cpp; I read the changed lines and relevant surrounding functions. No other files were excluded by the review bundle.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6000528561 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10443#pullrequestreview-6000528561). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T23:02:12Z. **Review:** APPROVED --- # Reviewed — looks good The review covers head `71dad17b46b484e92643878c2de04aea20e2187c`; I found no verified blocking defect, and the author reports the relevant Windows test suites passed. ## What I ran Read the prepared diff and the changed code around the new threshold, test, CMake properties, and environment documentation. No commands or tests were run in this review. ## Results | Check | Result | Note | |---|---|---| | Changed-line review | passed | All changed lines were read | | Programmatic checks | not run | Windows test results are author-reported | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The author reports successful Windows 11 tests and a Linux recorder test, but those runs were not independently verified. I did not inspect the full contents of `GuestBufferMemory.cpp` or `Recorder.cpp`; I read the changed lines and relevant surrounding functions. No other files were excluded by the review bundle. ## 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!10443
No description provided.