perf(agc): reuse completed write observations across overlapping ranges #17542
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17542"
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 PrivacyOnion on 2026-11-08T21:16:14Z.
What
Replace the exact-start per-worker collection memo with an ordered union of completed, page-rounded observations. A fully contained request can reuse the observation even when it starts inside an earlier range, or when several successful adjacent/overlapping walks jointly cover it. Holes still require collection. The union is private to the worker and is discarded whenever its collection epoch, unwatch serial or mapping generation changes. Failed walks never publish coverage; fresh/uncached collection, the 64-entry ring and shared-memo mode retain their behavior. Lockless hits return the last fully published
tracker.stablegeneration, not a concurrent walk's generation.Reject wrapped page-rounded bounds before all memo lookups. The new extreme-address regression exposed an existing ring-cache hit for a wrapped range.
No descriptor-content check, CPU/GPU write stamp, backing lifetime, resource residency check or GPU dependency is removed. There are no title-specific addresses, exceptions or new switches. This is a small observation-layer change, separate from descriptor-heap and write-subscription PRs.
The branch is based on main
0bae53facde88e56d2859f4d39cece93c9aab761; final head99c145ed4684f18c1b82086348bfd70273d78d5a. The captured integration uses pinned main095ff72367c43bd3111f5c96ff56d87a720cd8f2. The subsequent main commits change title-run tooling and unrelated voice/text-to-speech libraries; AGC, shader recompiler, libc and libkernel source are identical across those main bases.Tested
Windows 11 build 26200, Release, WinLibs GCC 15.2.0; Ryzen 5 5600, 16 GiB RAM; NVIDIA GeForce RTX 5070, NVIDIA driver 616.64.
Focused validation logs, test results and overlap review are attached with the timing evidence. The identical GPU test selection is run on current main with the regression fixtures and on the final candidate, with
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_LAYERS_DISABLE=~implicit~, usingctest --test-dir C:/Users/playl/AppData/Local/Temp/ap5p15 -R <pattern> -V.The coverage tests exercise interior containment after ring eviction, adjacent ranges in both orders, bridge/overlap/containing ranges, holes, empty/overflowing addresses, new epochs, unwatch/mapping invalidation, a second worker, explicit driver writes and mandatory uncached collection. Existing mapping-history, draw-descriptor and resource-cache tests remain included.
Performance scene: Sniper Ghost Warrior Contracts 2, PPSA03131, 01.004.000, stationary initial tutorial position at 3840x2160. Same machine, original savedata seed, scripted controller inputs and default game settings. Owned title relinked with
--windows --no-patches; offline and dummy audio. Both variants completed warm runs in the same scene before measurement. Retained order A1, B1-retry, A2, B2; onlyAPS5_TRACE_SECONDS=240:40and its output directory enabled for timing. No diagnostic profiling switches, game-log redirection, frame dumps, compilation, GPU tests or overlap scans during retained captures. B1 was closed accidentally by the user before its capture completed; it produced no completed timing window and is explicitly excluded, then repeated in place.Pure main stops at the tutorial's independent dual-source MIN blend, so gameplay comparison uses identical prerequisites on both sides: #17187, #17157, #16286 and #17255. A is clean integration
504135cf2b198ffca60257e6fffe4bcc13d3b15e; B isa2ab9931fac4cdd1ee7e7c4453a7e4a51b02659a. Production source differs only in this PR'sGuestMemory.cpp, which is identical to the final public implementation. All staged libraries exceptlibSceAgcDriver.prxare byte-identical. The fork'sperf/sniper-observation-coveragebranch contains both integration commits. These common title prerequisites are not carried in this PR.The two pairs show +3.25% and +2.49% mean FPS in this scene. This is a modest repeated scene-specific gain; no title unlock, campaign-wide gain or reduction in worst-frame latency is claimed. Tails vary in both directions between runs.
tools/performance_compare.py --require-matching-contextaccepts both pairs. Event buffers fill early: complete frame summaries are retained, while slice inventories are partial (totals_full=false). Missing event slices are not treated as idle time or full-window scope totals. The digests preserve the warnings.A1,
tools/trace_digest.py:seconds 240:40 from present 10221: 412 presents, frame p50 96.6 / p90 101.1 / p99 108.1 / max 120.5 ms, GPU busy 24.3 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit 504135cf2b19, dropped: yes
B1-retry,
tools/trace_digest.py:seconds 240:40 from present 6896: 426 presents, frame p50 92.6 / p90 99.0 / p99 124.0 / max 184.3 ms, GPU busy 24.1 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit a2ab9931fac4, dropped: yes
A2,
tools/trace_digest.py:seconds 240:40 from present 6905: 415 presents, frame p50 95.0 / p90 103.8 / p99 133.9 / max 147.0 ms, GPU busy 24.3 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit 504135cf2b19, dropped: yes
B2,
tools/trace_digest.py:seconds 240:40 from present 6839: 425 presents, frame p50 93.6 / p90 97.4 / p99 107.7 / max 128.7 ms, GPU busy 24.3 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit a2ab9931fac4, dropped: yes
Evidence archive: timing traces, digests, comparisons and validation logs
Final validation: candidate
99c145ed4684f18c1b82086348bfd70273d78d5apasses 12/12; current-main production plus the identical regression fixtures (f6ca157aeca61ebdc9dff356be62265e863aa02b) passes all 9 existing tests, while the 3 new coverage cases fail at their intended reuse/wrapped-range assertions. Neither log hasVUID-errors, a missing requested validation layer or skipped CTest tests. Linux-only fake-watch cases were not run locally; no Linux claim is made.Final overlap check scanned 1,970 open PRs, 28 sharing files. The tool exits 2 for 14 conflicted comparisons: #5021, #6186, #6188, #6192, #6209, #7604, #7642, #10193, #12840, #13928, #13929, #15136, #15529 and #15807. Their full patches were manually reviewed and their fetched heads are unchanged at this final check; none modifies
EpochCollectMap,epochCollectMaporcollectWrites. No duplicate interval-union implementation was found. This does not duplicate #12745's write subscriptions, #17226's content hashes or #9508's descriptor heap/queue batching.python tools/check_conventions.py --base origin/mainwas run as required: the fork's old main comparison reports 123 findings/18 errors in pre-existing upstream changes. The same source check against actualupstream/mainpasses. The final PR title/body are checked against actual main before publication. No fork-main update or unrelated source fix is included.The automatic GitHub checks were queued when opened. A manual full Linux/Windows build dispatch was attempted and GitHub returned HTTP 403: this repository requires administrator rights to dispatch that workflow. The local Windows GPU validation above is completed; no completed full CI build is claimed for this PR.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)