fix(agc): save pending results when a fresh write collect fails #7432
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7432"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T06:18:48Z.
What
Carries plokmklo’s two commits from
contrib/7017-palworld, preserving the original commit authorship, and rebases the fix onto currentmain.When
MarkWrittencannot collect fresh write-watch data for a covered 64 KiB block, it now releases the tracker lock, runs the existing unwatch hook over that block, then reacquires the lock before removing the range from the watch. This saves pending storage-image bytes before they become inaccessible to the write tracker. A Windows-only regression makes the fresh collect fail over aPAGE_NOACCESSpage and checks that the hook covers the affected block without unwinding neighboring blocks.This addresses the failed-collect path reported in #7017. It does not claim to reproduce Palworld’s title run or resolve the other unsaved-result paths described there. It is distinct from #6308’s import-fallback path and #7048’s storage-image write-back handling; those PRs touch adjacent code and should be reviewed together for composition.
Tested
git diff --check upstream/main...HEADpasses.python3 tools/check_conventions.py --base upstream/mainpasses.PAGE_NOACCESScollect failure.Checklist
main; no open PR implements the failed-collect pathImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T06:20:18Z.
I rebased the two contributor-authored commits onto current
main(ccb0c0926); both commit authors remain plokmklo. Current checks pass for conventions, eligibility, intake, and reporting. The Build workflow skips all build jobs because its write-watch path selector does not includecore/libs/prx/libSceAgcDriver/tests/WriteTracking.cpp. A manual dispatch is also unavailable to this account (GitHub returned 403: admin rights required). The Windows-only regression therefore still needs a maintainer-enabled Windows run.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T06:28:43Z.
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.
main)docs/dev/debt/libSceAgcDriver.mdL95-96core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppL1667Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
docs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/tests/WriteTracking.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/tests/WriteTracking.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/tests/WriteTracking.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/tests/WriteTracking.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/tests/WriteTracking.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/tests/WriteTracking.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/WriteTracking.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T12:03:51Z.
Rebased onto current
mainat0d078f75d. Both original commits remain authored by plokmklo. I resolved the debt-doc overlap against the current wording and kept this PR’s additional case where results land after the range left the watch while nothing was pending.git diff --check upstream/main...HEADandpython3 tools/check_conventions.py --base upstream/mainpass. The Windows-only failed-collect regression still needs a Windows run; the current Linux host cannot exercise Windows write-watch behavior.Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-18T16:13:25Z.
Windows run of the new regression: it fails, and on
mainthe rest ofagc_write_trackingpasses.Radeon 860M (RDNA 3.5), Ryzen AI 7 350, Windows 11 26300, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON.main6efb7261bwith #7432, #6912 and #6893 merged on top (no conflicts, disjoint files).agc_write_trackingmain(test file withoutCheckFailedCollectUnwatch)fda9dc9f6)write tracking test failed: a collect that failed over a no-access page still produced trusted stampsSo
MarkWrittenreturned a nonzero generation: the fresh collect completed over thePAGE_NOACCESSpage instead of failing. On WindowsMarkWrittencollects throughcollectWindowsWritesandGuestArenaCollectFreshWrites_nid_postfix, notGuestWriteWatchCollectFresh_nid_postfix. That goes toWindowsMappings::collectResidentwithCollection::Fresh, which skipsGetWriteWatchand reports pages from the collected bitmap. Nothing there reads the page protection, so changing it withGuestArenaSetProtection_nid_postfixdoes not make the collect fail. The fix's!completebranch is not reached by this test on Windows. It needs another way to make the Windows collect return false, or a test seam on the collect itself.AI-assisted
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T17:27:55Z.
Thanks for testing this on Windows. The no-access-page setup was not a valid way to force
GuestArenaCollectFreshWritesto fail: the Windows fresh collector intentionally enumerates its collected bitmap without checking page protection. I replaced that setup with a Windows-only fresh-collect test hook, so the regression deterministically exercises the actual!completebranch. It still verifies thatMarkWrittenreturns no trusted generation, the affected block is unwatched, neighboring blocks remain watched, and the pre-unwatch hook receives the block span. The Linux and MinGW WriteTracking test translation units compile; the Windows GuestMemory translation unit also cross-compiles when using a temporary compatibility shim for this container's older MinGWPROCESSOR_RELATIONSHIP::EfficiencyClassheaders. Conventions and diff checks pass against current upstream main. The full Windows test still needs a native run.Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-18T17:32:20Z.
Native Windows run of
9485188a1, merged alone ontomain6efb7261b(clean). Radeon 860M, Windows 11 26300, WinLibs GCC 15.2.0 r7, Release.agc_write_trackingbeforeUnwatchlines inMarkWrittenremoved (hook and test kept)write tracking test failed: a failed collect did not run the unwatch hook over its blockSo the fresh-collect hook now reaches the
!completebranch on Windows, and the test catches the change.AI-assisted
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T18:44:00Z.
Thanks for the native Windows retest. The 3/3 pass on
9485188a1, plus the negative control failing when the threebeforeUnwatchlines are removed, confirms the regression reaches and protects the!completepath on Windows. This resolves the Windows-specific validation gap I noted earlier. I have not rerun the test locally; this is your reported Radeon 860M / Windows 11 26300 / WinLibs GCC 15.2.0 result.Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-19T06:35:48Z.
Intel and AMD Windows data:
agc_write_trackingpasses with this PR on an Intel UHD 770 and an AMD RX 9070 XT.Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built,
ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, withVkCacheemptied first. This head9485188a1merged intomain07377573f.agc_write_trackingThe test files don't build on
mainwithout the rest of the PR, so there is no before-run.I also ran full CTest with this PR and the 13 other open AGC and shader PRs I tested in the same batch merged together (#7668, #7659, #7504, #7426, #7413, #7480, #7465, #7466, #7464, #7449, #7489, #7673, #7560). Neither GPU showed a failure beyond
main's own: the five image-table tests (#6647) andagc_driver_sample_multisample_target(#6957) on the UHD 770, andagc_driver_layered_volume_vertex_no_gpl(#4768) on the RX 9070 XT.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-19T08:10:38Z.
Rebase handoff — rebased onto current
main(authorship unchanged). One docs conflict: the debt entry now carriesmain's newer explicit-size file-writes sentence alongside your rewritten unwatch-hook paragraph.One judgment call to review: your fix commit as authored also deleted
main's unrelated "Windows host-pointer imports…" debt line — unrelated to this change and unmentioned in the message — so I restored it in the rebase. If the deletion was intentional, drop the line again when you pick it up.Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV): builds; conventions pass; full suite green apart from the four knownmainregressions (#5444 Mesa, #7584 BDA, #7766, #7784), none from this PR.To pick it up:
Head is
3a2906e3c.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T16:52:21Z.
Thank you for preparing the rebase and running the full Linux suite. I agree the unrelated “Windows host-pointer imports” debt entry should be preserved. I have not yet adopted the handoff branch, so I’ll inspect its diff and current base before claiming the PR includes that rebase. The reported
agc_write_trackingpasses on both Windows GPUs are useful; the full-suite result also clearly isolates the four known main failures.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T19:32:41Z.
I inspected the current PR diff at
0e03a753cd07. The unrelated “Windows host-pointer imports” debt entry is still present; the docs change is limited to the pending storage-image results entry. The latest head also includes the failed-collection regression test commit. That resolves the preservation concern I raised earlier.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T21:44:14Z.
Rebased onto current
main(conflict indocs/dev/debt/libSceAgcDriver.md) and restored the "Windows host-pointer imports…" debt line that the debt commit deleted without mention; the unwatch-hook paragraph is kept as written. Checked the lock release/reacquire aroundbeforeUnwatchinMarkWrittenand the Windows regression, confirmed by the native Windows runs here (passes; fails with the hook calls removed); merged.