perf(agc): scope pending texture snapshots to unwatched units #18940
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18940"
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 JJenkx on 2026-11-12T14:38:02Z.
What
Scope the saved guest baseline of a pending storage texture to the tracking units intersecting the range leaving the write watch. Previously unwatching one 64 KiB unit of a four-unit pending texture copied all 256 KiB, even though the remaining units stayed watched.
The remaining units retain write-watch stamps. Refresh and write-back query those units separately when the whole texture spans watched and unwatched memory; units that left the watch use their saved bytes. This preserves later CPU writes without eagerly copying unrelated pending units. Whole-span tracked and compared fast paths remain.
Five focused physical-GPU regressions cover tiled and linear arrays, refresh before write-back, and a partial-unit unwatch boundary. They check GPU output in untouched units and CPU writes in both an unwatched unit and a still-watched unit. The read guard counts actual snapshot bytes rather than elapsed synthetic timing: 262144 on the control, 65536 on the change. Both preserve the expected CPU/GPU contents; the control fails the new scope assertion.
Tested
Independent NVIDIA qualification: Doorriiaann reports RTX 3070 results at this exact head, with validation layer 1.4.335 and no VUID or missing-layer messages across three runs. All 19 storage cases pass on both sides, including
agc_storage_pending_key_refreshandagc_storage_clear_hand_over, which were unavailable on the RX 6650 XT. All five new scope cases pass with the change and fail with the expected 262144-byte copy on the matched test-only control. These are the contributor's reported runs, not locally reproduced NVIDIA results.Linux 7.2.14-arch1-1, Ryzen 9 7950X, AMD Radeon RX 6650 XT (RADV NAVI23), Mesa 26.2.6-arch1.1, Release. Full baseline/candidate library builds succeeded. Conventions and whitespace checks passed.
Same 36-case focused Recorder/storage selection against both frozen providers, with
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer, and verbose CTest. Validation layer 1.4.363 was inserted in both; no missing-layer message or VUID errors. The candidate passes all 34 supported cases. Two cases are unavailable in both because this hardware/fixture imports the backing memory (agc_storage_pending_key_refresh,agc_storage_clear_hand_over); they are excluded from coverage. The control has five expected new scope-assertion failures and two expected assertions identifying the actual unwatched unit rather than the old coarse unit-zero refusal. The remaining 27 supported cases pass on the control.The two refusal assertions still require the refusal and its cause. The per-unit write-watch query now correctly diagnoses the last deliberately unhooked unit, so the tests no longer permit the earlier coarse unit-zero diagnosis.
Native comparison
In Sound Mind PPSA04921 v01.000.009, 1920x1080, stationary opening Trash Room loaded from the same private save. Both arms start from identical warmed shader/pipeline caches. Original game assets are read-only; module outputs, saves and runtime data are private. No own compiler work runs during the native capture.
Qualified native banks use main
b842d79fdaacplus the required gather fix #18826 on both sides: control301371760acc, change3757f141ef6e. The control includes test fixtures but no AGC production changes. Bare main cannot reach this scene without the gather fix; these are explicitly main-plus-common-prerequisite results. The source PR itself does not depend on #18826.The submitted branch is rebased on
e89685fe6e2a. The AGC runtime files, test registration and complete new fixture namespace are byte-identical to the qualified source. The only upstream change among the four touched files is unrelated Recorder host-import test maintenance. Native banks remain frozen at the exact commits reported in their summaries.Order: change, then control; each complete native arm enters the shared FIFO separately. Only
APS5_TRACE_SECONDS=140:8and the trace output directory are set for capture; no extra profiling flags or trace-capacity override. Each process has a PTY. Both runs exit normally with original assets, normalized inputs, warm-cache/save seeds, frozen SDKs and kernel settings unchanged/restored. No heavy compiler jobs were observed in the sampled host checks.301371760acc3757f141ef6eBoth traces are complete, with no dropped events. This is one short pair with similar throughput; it does not establish a reliable title FPS improvement. The supported performance claim is the focused fixture's 75% reduction in bytes copied at the first unwatch. The initial diagnostic 10s pair also had a small median difference, but used extra profiling flags and is not pooled with this clean pair. A 20s attempt filled the default trace buffer after 11.224s; that dropped capture is excluded.
Both arms show the same stationary room camera and geometry at 120s and 160s. Both HUDs are legible at 120s; at 160s the control window readbacks show clipped HUD/tutorial text while the candidate retains the full text. This is a comparison limitation, not a claimed graphics fix: capture lag/HUD animation has not been separated from rendering. The attached X11/composite readbacks are neither physical scanout nor native GPU-frame captures.
Complete aps5-summary.jsonl lines
Traces, official trace digests, captures, verbose GPU test logs/XML, source patches/pins and cleanup qualification — 32 members, 15,902,482 bytes; SHA-256
472c6558fe36cef03ff8521e23148faa26d3217e01aa2d7a34804996da38b0c0. Game binaries, modules, saves and raw sampled stack memory are excluded.Overlap review
The official open-PR scan found contextual conflicts with #12792 and #17788. #12792 handles failed page-walk/unknown stamps, while this patch handles mixed watched/unwatched coverage; its changed-block query still rejects a range not wholly covered by the watch. #17788 renews the small-image generation baseline after a GPU store; retain its renewal loop alongside this patch's range-scoped snapshot call. Neither implements the scoped copy change, and neither is a functional prerequisite. I will rebase this branch if either merges first, preserving their behavior.
A directed manual check of 41 shared-file heads that could not be cleanly compared found no other scoped pending-snapshot implementation. #16483 additionally installs a multisample-DCC unwatch hook; that separate hook must remain if integrated. This is a targeted source review, not proof that every unmergeable PR is behaviorally disjoint.
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)