Skip to content

fix(agc): refresh settling imports after synchronous write-back - #1953

Closed
ToyuAU wants to merge 2 commits into
boykopovar:mainfrom
ToyuAU:fix/windows-import-settle-writeback
Closed

ToyuAU wants to merge 2 commits into
boykopovar:mainfrom
ToyuAU:fix/windows-import-settle-writeback

Conversation

@ToyuAU

@ToyuAU ToyuAU commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

What

Superseded by #1847 commit 9a4b70f4. The prerequisite now refreshes settle snapshots in storeOwn's completed-store stamping, covering the synchronous-store gap and paths that do not walk. Its CheckImportSettle regression includes the same own-store/late-mark case, plus a CPU store after an asynchronous GPU write. Linux and Windows CI pass on that prerequisite head. This follow-up is closed to avoid a duplicate implementation; its branch and the historical validation below are preserved. Direct asynchronous GPU completion-time snapshot refresh remains unimplemented in #1847, as documented there.

A synchronous driver write-back during the import settle period changes guest bytes but leaves #1847's settle copy at the old value. A later driver dirty mark over those bytes then compares unequal and is classified as a CPU store, recreating the write-back problem that settling is intended to prevent. This addresses the synchronous-store gap reported at #1847 (comment).

Let Driver walks refresh every overlapping settle copy while retaining the Driver stamp kind. ImportWindow walks retain their existing behavior. Later unchanged pages are classified maybe written; real CPU edits still update the copy and are classified CPU.

Extend CheckImportSettle with a StoreOwnBytes write, a subsequent same-byte dirty mark, and a real CPU edit after that write. TechnicalDebt explicitly records that asynchronous GPU writes notified by MarkWritten do not have completion-time snapshot refresh and still need separate synchronization work.

Depends on #1847, head ec961ed. This branch is based on that PR; its prerequisite changes are part of the upstream diff until #1847 merges. The follow-up itself changes three files with 15 added and two removed lines.

Tested

macOS arm64, AppleClang 17:

  • An isolated harness compiles the actual settlingKind function extracted from the prerequisite and follow-up source with -Wall -Wextra -Werror and ASan/UBSan. It uses accessible synthetic pages and a minimal tracker; it does not emulate Windows write-watch APIs.
  • Prerequisite fails the own-store/late-mark case. Follow-up passes it, real CPU edit classification, and updating both overlapping snapshots before removing one.
  • Conventions pass against commit a6d85fb relative to fix(agc): keep Windows host imports watched while late driver marks settle #1847, including this PR title/body.
  • Documentation checker: zero errors. Committed diff whitespace check passes.

GitHub Actions Build run 37872407962 passes on Linux and Windows, including building patched libs. Windows: 488 registered tests, 285 passed and 203 skipped; agc_write_tracking (including the new Windows settle case) and agc_recorder_kept_bytes pass. Linux: 497 registered tests, 472 passed and 25 skipped; the first-write GPU regression passes with the CI software Vulkan driver.

Draft pending Windows GPU validation of the original late-write regressions and affected title performance. Windows GPU tests, including agc_driver_dcc_keys_first_write, were skipped by the CI runner. No physical-hardware execution or frame-rate improvement is claimed for this follow-up. The prerequisite's snapshot caps, settling-time assumption, large-import fallback and import-retirement gap remain.

Checklist

JAB-dev and others added 2 commits October 8, 2026 23:45
…ettle

boykopovar#1441 compares every Windows host import because a driver can mark
imported pages written again shortly after the import window (1.2-2 ms on
the NVIDIA driver in boykopovar#1434), and those marks dropped GPU results. The
comparisons make PPSA22520 spend 6.8 s of every 10 s revalidating
resources: about 7.5 FPS instead of 59.

Imports stay watched. Each import keeps a copy of its bytes for a settle
period (1 s, APS5_IMPORT_SETTLE_MS): a page marked in that period whose
bytes still equal the copy is stamped maybe written, like the import
window's own marks, and a page whose bytes changed is a CPU store. One
walk of the import at the next collect after the period applies the same
rule to the rest. An import whose copy would exceed 256 MiB, or 512 MiB
with the copies already kept, is compared, as is every import under
APS5_IMPORT_SETTLE_MS=0 or APS5_WRITE_WATCH_IMPORTS=unwatch, which is now
read on Windows too; =watch keeps plain watching. Unwatching a range or
giving it fresh private backing drops its copy.

On Windows the DCC first-write test now rewrites the imported block with
its own bytes between the import and the write-back, so it reproduces
boykopovar#1434 on every driver: it fails in every run with plain watching.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1860 docs/dev/TechnicalDebt.md L244
#1918 core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp L770
docs/dev/TechnicalDebt.md L243-244
#1960 core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp L1021-1022, L1176, L1178
#1994 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp L271, L284, L290, L292
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp L1694-1696
docs/dev/TechnicalDebt.md L244
#1995 docs/dev/TechnicalDebt.md L243-244

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the full PR and the incremental diff atop its declared dependency #1847. The driver-stamp path now refreshes the settle snapshots, and the regression covers a synchronous driver store followed by a late same-byte mark and a real CPU edit. The reported Linux/Windows checks pass on this stacked head. One integration item remains: the overlap check also lists #1960 in GuestMemory.cpp, but this PR only declares #1847 as a dependency. Please document whether #1953 must be rebased/integrated with #1960, then run checks on the combined final head before merge. The current checks validate the #1847 stack, not a combination with #1960; I am leaving approval open pending that integration evidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants