fix(agc): treat arena host holes as uncovered in every write tracker query #4155

Closed
LeandroLP23 wants to merge 1 commit from upstream-pr/4155 into main
LeandroLP23 commented 2026-10-12 00:07:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-12T00:07:21Z.


What

Fixes #4087. On Windows, agc_write_tracking has failed since #3594 (an unwatched range reads as not stored over). #3594 excluded the host regions inside the guest arena from Watched, collectWrites, UnchangedSince and UnchangedSinceAll. StoredOver, UnchangedSinceCollected, WrittenSince, ChangedBlocks and ImportWatched still passed WriteTracker::covers() for those regions. A host hole was therefore reported as unwatched and, at the same time, proven not stored over.

This is the broader option @screamm suggested in #4087, which has the analysis and the bisection. The exclusion moves into WriteTracker::covers(), which every query goes through, so a host hole answers like any other uncovered range. The four per-function checks it replaces are removed. storeOwn keeps its own check, since that one tests the page-rounded range. The size guards #3594 added stay.

The #3594 regression in BdaResources.cpp now also checks UnchangedSinceCollected and StoredOver on an arena host hole.

Tested

Windows 11 (26300), Radeon 860M, WinLibs GCC 15.2.0 r7, Release, full build. main ae7dbfa9c does not build on Windows without #4021, so the local runs and the fork CI branch apply #4021 on top. This PR does not include it.

  • agc_write_tracking, agc_driver_graphics, agc_driver_bda_device, agc_driver_bda_span_reads, agc_recorder_kept_bytes and agc_driver_wait_shutdown: 6/6 pass in 3 runs.
  • With GuestMemory.cpp reverted to main, two tests fail:
    • agc_write_tracking: an unwatched range reads as not stored over;
    • agc_driver_graphics: AGC graphics: an arena host hole was proven not stored over, the new check.
  • Full ctest: 905/906 pass. The one failure, guest_kernel_stack_protect, also fails on main without this change; that is #4088.
  • Fork CI, with #4021: the Windows job passes everything except guest_kernel_stack_protect (#4088). The Linux job fails agc_vector_window and agc_driver_prepared_shaders_registered_workgroup_sync. Every line this PR changes is inside #ifdef _WIN32, so on Linux the build is the same as main.

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
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4823399558 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4155). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-12T00:07:21Z. --- ### What Fixes #4087. On Windows, `agc_write_tracking` has failed since #3594 (`an unwatched range reads as not stored over`). #3594 excluded the host regions inside the guest arena from `Watched`, `collectWrites`, `UnchangedSince` and `UnchangedSinceAll`. `StoredOver`, `UnchangedSinceCollected`, `WrittenSince`, `ChangedBlocks` and `ImportWatched` still passed `WriteTracker::covers()` for those regions. A host hole was therefore reported as unwatched and, at the same time, proven not stored over. This is the broader option @screamm suggested in #4087, which has the analysis and the bisection. The exclusion moves into `WriteTracker::covers()`, which every query goes through, so a host hole answers like any other uncovered range. The four per-function checks it replaces are removed. `storeOwn` keeps its own check, since that one tests the page-rounded range. The size guards #3594 added stay. The #3594 regression in `BdaResources.cpp` now also checks `UnchangedSinceCollected` and `StoredOver` on an arena host hole. ### Tested Windows 11 (26300), Radeon 860M, WinLibs GCC 15.2.0 r7, Release, full build. `main` `ae7dbfa9c` does not build on Windows without #4021, so the local runs and the fork CI branch apply #4021 on top. This PR does not include it. - `agc_write_tracking`, `agc_driver_graphics`, `agc_driver_bda_device`, `agc_driver_bda_span_reads`, `agc_recorder_kept_bytes` and `agc_driver_wait_shutdown`: 6/6 pass in 3 runs. - With `GuestMemory.cpp` reverted to `main`, two tests fail: - `agc_write_tracking`: `an unwatched range reads as not stored over`; - `agc_driver_graphics`: `AGC graphics: an arena host hole was proven not stored over`, the new check. - Full `ctest`: 905/906 pass. The one failure, `guest_kernel_stack_protect`, also fails on `main` without this change; that is #4088. - [Fork CI](https://github.com/LeandroLP23/AnyPS5/actions/runs/38184798261), with #4021: the Windows job passes everything except `guest_kernel_stack_protect` (#4088). The Linux job fails `agc_vector_window` and `agc_driver_prepared_shaders_registered_workgroup_sync`. Every line this PR changes is inside `#ifdef _WIN32`, so on Linux the build is the same as `main`. ### 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) - [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] AI-assisted: yes (Claude Code)
LeandroLP23 commented 2026-10-12 00:14:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-12T00:14:59Z.


Closing in favour of #4131, which was opened first and fixes #4087 the same way for the failing reader. Windows results are posted there.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6115486152 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4155#issuecomment-6115486152). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-12T00:14:59Z. --- Closing in favour of #4131, which was opened first and fixes #4087 the same way for the failing reader. Windows results are posted there.

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