Skip to content

perf(agc): a DCC key proof over untracked memory holds until the next ordering point - #47

Open
Thimo188 wants to merge 4 commits into
mainfrom
upstream-pr/6209
Open

Thimo188 wants to merge 4 commits into
mainfrom
upstream-pr/6209

Conversation

@Thimo188

@Thimo188 Thimo188 commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Imported from boykopovar/AnyPS5#6209, originally opened by TheAggie.

Source commit: b00f936b31fe9ba4946ee35dd3fd9f9bc707806c. The import branch preserves this fetched upstream PR snapshot. The description and validation below are copied from upstream; no new code changes or test runs were made for this import. Original reviews, discussions, and attachments remain at the linked upstream PR.


What

Stacked on boykopovar#6187; only the last two commits are this PR. Independent of boykopovar#6192, except that both add a test at the same place in CMakeLists.txt and tests/Recorder.cpp, a trivial conflict for whichever lands second.

ProvedClearKeys and ProvedCurrentDccKeys skip the scan of a surface's DCC keys while the key range is unchanged since the last scan, proved by CollectWrites and UnchangedSince. Over keys the write watch does not cover (on Windows, every host-pointer import of the guest mapping, boykopovar#1441), CollectWrites returns 0, so no proof is ever kept and every use scans the keys again.

In RetroArch's Flycast core (PPSA99169) on Windows: 3.7 million key scans per 10 s (72 GB read, 2.2 s), with 0 proved and every one counted unstable.

  • Over untracked keys both functions take a stamp: the collect epoch, NewestStamp (driver stores into the keys), ForgetStamp (perf(agc): an untracked comparison memo holds until memory it covers is forgotten boykopovar/AnyPS5#6187) and the recorder's newest pending write note over the keys. A scan that is otherwise stable becomes the proof with that stamp, and a later call with the same stamp returns the proved keys without scanning.
  • A collect epoch of 0 or a forget in progress gives no stamp, so the scan runs as before.
  • The rule is the one untracked storage images already follow (compareUntracked, docs/dev/ARCHITECTURE.md): a CPU store into untracked memory is seen at the next ordering point. Pending GPU writes still make a scan unstable, as before.

Tested

Windows 11, NVIDIA GeForce RTX 5070 Ti, MinGW-w64 GCC 15.2.0, on main 8cd937e29 with boykopovar#6187; rebased onto main 92e50418f with boykopovar#6187 (only a CMake test list conflicted), where the full suite passes 1276 of 1296, 14 skipped, failing only the known tests below and agc_driver_multisample_fill_host_only, which passes when run alone.

  • ctest: 1233 of 1249 pass, 14 skipped. guest_call_trace_abort and windows_backtrace_report fail, and fail the same way on plain main here. agc_driver_prepared_graphics_prebuild_0/_1 and undeliverable_host_exception fail under my test runner because it skips their environment changes and pass pattern; run with those, they pass.
  • New test agc_untracked_key_proofs (agc_driver_recorder_tests --untracked-key-proofs-only): keys in an untracked allocation. In one collect epoch the second ProvedClearKeys and the second ProvedCurrentDccKeys come from the proof; after a store into the keys and a new epoch the keys are scanned again and read as changed. Without this change the test fails with "a second key proof over untracked memory in the same collect epoch scanned the keys again".
  • RetroArch (PPSA99169), Flycast, Crazy Taxi attract demo, on the local stack described in perf(agc): an untracked comparison memo holds until memory it covers is forgotten boykopovar/AnyPS5#6187: key scans per 10 s went from 3.7 million (0 proved) to about 40,000 (2.38 million proved), and the time spent scanning from 2.2 s to 38 ms. Unprofiled audio, two runs each: the ProvedClearKeys change alone did not move it measurably; with the ProvedCurrentDccKeys change as well, 65.3% and 66.9% of real time against 68.0% and 68.0% (that stack also had perf(agc): fast revalidation over untracked memory proves a surface by its stamp until the next ordering point boykopovar/AnyPS5#6192). I have no measurement of main alone.
  • Linux is untested; on Linux most key ranges are write-watched and keep the existing path.

Related: boykopovar#6060 keeps Windows imports of private write-watched memory on GetWriteWatch when a start-up probe allows it; key ranges it keeps watched never reach this path.

Checklist

🤖 Generated with Claude Code

TheAggie and others added 4 commits October 15, 2026 10:07
…is forgotten

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…son memo

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… ordering point

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t epoch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Thimo188 Thimo188 closed this Dec 2, 2026
@Thimo188 Thimo188 reopened this Dec 2, 2026
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed perf Performance change perf numbers missing perf pull request without a before and after summary line labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

This pull request is labeled perf, so it needs the summary line of a capture on main and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both aps5-summary.jsonl lines, attach the two traces and add the output of tools/trace_digest.py.

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

Labels

needs rebase Conflicts with main, rebase needed perf numbers missing perf pull request without a before and after summary line perf Performance change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants