fix(agc): report arena host holes as stored over on Windows #4131

Merged
oneandonlydean merged 1 commit from upstream-pr/4131 into main 2026-10-12 00:29:18 +00:00
oneandonlydean commented 2026-10-11 23:51:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T23:51:25Z.


What

agc_write_tracking fails in the Windows job on main since #3594 (run 38181250683, 2 of 908 tests fail, this is one of them):

write tracking test failed: an unwatched range reads as not stored over

The fix is the one @screamm proposed in #4087, with his lines unchanged: StoredOver returns true for a range that overlaps a host region inside the guest arena interval.

#3594 made Watched, CollectWrites, UnchangedSince and UnchangedSinceAll treat those host regions as unwatched. StoredOver was left out. On Windows the tracker's coverage spans the whole arena interval, host regions included, so StoredOver passed its coverage check, found no newer stamps on blocks that are never stamped and answered "not stored over". The test's last check takes a buffer on the main thread's stack, which on Windows lies in such a host region: Watched now says no and StoredOver still gave a proof.

Outside the test, StoredOver is called by the CMASK proof in Draw.cpp, which collects first and so already rejects such a range since #3594, and by the edge-unit checks in Texture.cpp, which sit behind ChangedBlocks. Guest surfaces are not placed in host regions, so no title-visible change is expected; the tracker just stops contradicting itself.

Only Windows is affected. On Linux and macOS the coverage check asks the write watch for registered ranges, an unregistered range is never covered, and StoredOver already returns true for it. The same check in agc_write_tracking runs and passes there, so no new test case is added: the existing one fails on Windows main and covers the change.

The other stamp readers #4087 lists (ChangedBlocks, WrittenSince, MarkWritten, ImportWatched) are not changed here.

Tested

Windows was not run here. @screamm reports in #4087 that agc_write_tracking passes with these lines on Windows 11 (WinLibs GCC 15.2.0) and fails without them; the Windows job on this pull request is the check.

Linux (CachyOS, GCC 16, Release, CI's configure flags) on main bca7a29d, where the added lines are compiled out:

  • full build and libs;
  • agc_write_tracking passes;
  • ctest -R "agc_write|guest_kernel|guest_memory|write": 26 of 26 pass.

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)

Fixes #4087.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4823317548 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4131). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T23:51:25Z. --- ### What `agc_write_tracking` fails in the Windows job on `main` since #3594 ([run 38181250683](https://github.com/boykopovar/AnyPS5/actions/runs/38181250683), 2 of 908 tests fail, this is one of them): ``` write tracking test failed: an unwatched range reads as not stored over ``` The fix is the one @screamm proposed in #4087, with his lines unchanged: `StoredOver` returns `true` for a range that overlaps a host region inside the guest arena interval. #3594 made `Watched`, `CollectWrites`, `UnchangedSince` and `UnchangedSinceAll` treat those host regions as unwatched. `StoredOver` was left out. On Windows the tracker's coverage spans the whole arena interval, host regions included, so `StoredOver` passed its coverage check, found no newer stamps on blocks that are never stamped and answered "not stored over". The test's last check takes a buffer on the main thread's stack, which on Windows lies in such a host region: `Watched` now says no and `StoredOver` still gave a proof. Outside the test, `StoredOver` is called by the CMASK proof in `Draw.cpp`, which collects first and so already rejects such a range since #3594, and by the edge-unit checks in `Texture.cpp`, which sit behind `ChangedBlocks`. Guest surfaces are not placed in host regions, so no title-visible change is expected; the tracker just stops contradicting itself. Only Windows is affected. On Linux and macOS the coverage check asks the write watch for registered ranges, an unregistered range is never covered, and `StoredOver` already returns `true` for it. The same check in `agc_write_tracking` runs and passes there, so no new test case is added: the existing one fails on Windows `main` and covers the change. The other stamp readers #4087 lists (`ChangedBlocks`, `WrittenSince`, `MarkWritten`, `ImportWatched`) are not changed here. ### Tested Windows was not run here. @screamm reports in #4087 that `agc_write_tracking` passes with these lines on Windows 11 (WinLibs GCC 15.2.0) and fails without them; the Windows job on this pull request is the check. Linux (CachyOS, GCC 16, Release, CI's configure flags) on `main` bca7a29d, where the added lines are compiled out: - full build and `libs`; - `agc_write_tracking` passes; - `ctest -R "agc_write|guest_kernel|guest_memory|write"`: 26 of 26 pass. ### 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] AI-assisted: yes (Claude Code) Fixes #4087.
LeandroLP23 commented 2026-10-12 00:14:58 +00:00 (Migrated from github.com)

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


Windows run of this head (5864ee583, which already includes #4021): Windows 11 (26300), Radeon 860M, WinLibs GCC 15.2.0 r7, Release, full build.

  • agc_write_tracking and agc_driver_graphics pass 3/3. Without this change (main ae7dbfa9c + #4021), agc_write_tracking fails 3/3 with an unwatched range reads as not stored over.
  • I had opened #4155 with the broader option from #4087: the host-hole exclusion inside WriteTracker::covers(), so every reader answers the same way. I've closed it in favour of this PR, which came first. With this PR alone, extra host-hole checks on UnchangedSinceCollected and StoredOver in the BdaResources.cpp regression also pass, so I found no other reader that gives a wrong answer today. The covers() variant stays on LeandroLP23:fix/agc-write-tracker-host-holes in case it's wanted later.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6115485991 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4131#issuecomment-6115485991). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-12T00:14:58Z. --- Windows run of this head (`5864ee583`, which already includes #4021): Windows 11 (26300), Radeon 860M, WinLibs GCC 15.2.0 r7, Release, full build. - `agc_write_tracking` and `agc_driver_graphics` pass 3/3. Without this change (`main` `ae7dbfa9c` + #4021), `agc_write_tracking` fails 3/3 with `an unwatched range reads as not stored over`. - I had opened #4155 with the broader option from #4087: the host-hole exclusion inside `WriteTracker::covers()`, so every reader answers the same way. I've closed it in favour of this PR, which came first. With this PR alone, extra host-hole checks on `UnchangedSinceCollected` and `StoredOver` in the `BdaResources.cpp` regression also pass, so I found no other reader that gives a wrong answer today. The `covers()` variant stays on [`LeandroLP23:fix/agc-write-tracker-host-holes`](https://github.com/LeandroLP23/AnyPS5/tree/fix/agc-write-tracker-host-holes) in case it's wanted later.
AlxcBTW commented 2026-10-12 00:22:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-12T00:22:50Z.


Windows check of this change (WinLibs GCC 15.2.0, Release, non-GPU node). Base: main bab7b3285 with #4021's Socket.cpp guard applied locally, since main doesn't compile on MinGW without it.

agc_write_tracking (--repeat until-fail:5) full non-GPU ctest
base fails on the first run: write tracking test failed: an unwatched range reads as not stored over 3 failures: log_macros, guest_kernel_stack_protect, agc_write_tracking
base + this PR 5/5 pass 2 failures: log_macros, guest_kernel_stack_protect, both also failing on the base

So this fixes agc_write_tracking on Windows and changes nothing else in the non-GPU suite.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6115554658 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4131#issuecomment-6115554658). Originally posted by [AlxcBTW](https://github.com/AlxcBTW) on 2026-10-12T00:22:50Z. --- Windows check of this change (WinLibs GCC 15.2.0, Release, non-GPU node). Base: `main` bab7b3285 with #4021's `Socket.cpp` guard applied locally, since `main` doesn't compile on MinGW without it. | | `agc_write_tracking` (`--repeat until-fail:5`) | full non-GPU `ctest` | |---|---|---| | base | **fails** on the first run: `write tracking test failed: an unwatched range reads as not stored over` | 3 failures: `log_macros`, `guest_kernel_stack_protect`, `agc_write_tracking` | | base + this PR | **5/5 pass** | 2 failures: `log_macros`, `guest_kernel_stack_protect`, both also failing on the base | So this fixes `agc_write_tracking` on Windows and changes nothing else in the non-GPU suite. AI-assisted: yes (Claude Code)
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!4131
No description provided.