perf(agc): hand pending results over to storage images created under clear keys #14868
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14868"
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-01T21:36:07Z.
What
When a storage image is created over memory where other storage images still hold pending GPU results,
cachedStorageTexturestores those results to guest memory before the new image is uploaded. That happens even when the new image's DCC keys prove a fast clear that overwrites every byte. The same applies when the cache evicts an image because its DCC metadata address moved (MetadataMoved): the evicted image is written back at once, even though the image created in its place clears the same memory. UE4 titles reuse one allocation for several transient render targets, so this write-back then clear cycle repeats several times per frame.Image creation now applies the same conditions as the existing clear-key refresh hand-over (#7427):
When these hold, the pending results are not stored. The new image takes them over (
handedOver/handedUnits) and they stay pending until the new image's own results supersede them, or until a read, fill, label or CPU store of that memory flushes them. Both cases go through the sameFlushPendingpath as before.Hand-over after an eviction:
Detach) instead of writing it back.Flushof the new image flushes its adopted sources first.Fallback: when the conditions fail, or the created image ends up with different keys, a different unit size or results of its own, creation stores everything exactly as before.
APS5_NO_CLEAR_HAND_OVER=1still disables every hand-over.The
[storage]profile line now counts hand-overs at creation separately from those at refresh.Tested
Windows 11 Pro 26200, NVIDIA GeForce RTX 5070 (driver 616.64), WinLibs GCC 15 Release build.
agc_storage_clear_hand_overnow covers B's refresh (as before), B's creation, and B's creation after A left the cache. It runs each path in every order that applies:Each case runs with the hand-over on and off, on watched and unwatched memory, and compares guest bytes and texels between the two runs.
Vulkan validation comparison, run on
main(b2a4784765) and on this branch on the same machine:VUID-linesVUID-linesVK_LOADER_DEBUG=layershowsInsert instance layer "VK_LAYER_KHRONOS_validation").was not found but was requested by env var VK_INSTANCE_LAYERS.Performance captures with
APS5_TRACE_SECONDS=60:20, MotoGP 21 heavy 3D menu, 3840x2160, same machine and scene, mainb2a4784765against ffb12ec6a1. The summary lines,tools/trace_digest.pyoutput and traces are in this comment.Earlier interval runs, MotoGP 21, 3D main menu after the intro, 3840x2160, same machine and scene, each build twice;
tools/trace_digest.pyrows for the heavy menu:main (
e0caf13600):this PR (
e0caf13600+ this change):Steady menu windows (from 46 s) across both runs:
On main, run 1's summary stopped being written at 62 s, so only three of its menu windows are in the summary.
[storage]write-backs per 10 s at the end of run 2:This PR handed results over at 3910 image creations. Neither run logs an image destroyed with GPU results pending.
The 19 commits merged since
e0caf13600touch the pipeline cache andVulkanDevice, not the storage path. The branch is rebased onb2a4784765, and the tests above ran on the rebased branch.The remaining
storage refreshwrite-backs come from uncompressed aliases whose content does come from memory. Skipping them would need draw-level knowledge that a pass overwrites the whole target without loading it, so that work belongs in a separate 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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T09:31:53Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The creation hand-over diff and its tests are consistent at head
ffb12ec6a1f4806c1d7dde59b3289b3bf1220a44, but the required performance report still lacks the two attached trace files in the PR description.What I ran
Reviewed the complete four-file diff at head
ffb12ec6a1f4806c1d7dde59b3289b3bf1220a44against baseb2a47847651b0c1281241c5f6da51b4bdf1c83ae. The repository precheck previewed it against currentmain(88e804b0a7df1f1ac373a9e2f72fb378d925fdd4) and reported a conflict. Environment: Debian Linux, Python 3.11.2, GCC 12.2.0; no build or compilation.Results
mainPrecheck results (unedited)
The precheck deliberately does not configure, build, or compile AnyPS5.git diff --check b2a47847651b0c1281241c5f6da51b4bdf1c83ae...ffb12ec6a1f4806c1d7dde59b3289b3bf1220a44/usr/bin/python3 tools/check_conventions.py --base b2a47847651b0c1281241c5f6da51b4bdf1c83ae --head ffb12ec6a1f4806c1d7dde59b3289b3bf1220a44 --title perf(agc): hand pending results over to storage images created under clear keys --body /tmp/review-14868-precheck/pr-body.mdNegative control
Not run locally; the AGC C++ regression needs a build. The PR description reports enabled/disabled hand-over comparisons and a prior-code failure, but I did not reproduce them.
Findings
Blocking
aps5-summary.jsonlrecords andtrace_digest.pyoutput forb2a47847651band this head, but ends by saying the traces “I will attach”; it contains only filenames, not trace attachments or links. The PR body also does not contain the current-head summary records. The repository requires the matching baseline/change records and traces for aperfPR. Attach both traces and put the two current records and digest output in the PR description so the report and label check can verify them.Non-blocking
Sources
Not verified
To get this to a good state
Attach the baseline and change trace files and put the matched summary lines plus digest output in the PR description, then resolve the current-main conflict. I will rerun the precheck and review on the new head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T10:12:20Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The chained-adoption lifetime fix and its regression test are present at head
c3e47c8e310feca7051a3353242f8130d4084188, but the required performance traces are still missing and the posted change capture is for the previous head.What I ran
Reviewed all four changed files against base
88e804b0a7df1f1ac373a9e2f72fb378d925fdd4. Environment: Debian Linux 6.1, Python 3.11.2, GCC 12.2.0. No build or compile was run. The author-reported GPU run is separate from my checks and is forffb12ec6a1f4806c1d7dde59b3289b3bf1220a44, not this head.Results
mainagc_storage_clear_hand_overPrecheck table and relevant raw output
git diff --check 88e804b0a7df1f1ac373a9e2f72fb378d925fdd4...c3e47c8e310feca7051a3353242f8130d4084188tools/check_conventions.py --base 88e804b0a7df1f1ac373a9e2f72fb378d925fdd4 --head c3e47c8e310feca7051a3353242f8130d4084188 ...mainThe test-quality helper's warning was checked manually:
agc_storage_clear_hand_overis registered inagc_driver_recorder_tests.cmake. The stack report saysAll heads unchanged: TrueandPR #14868: clean against current base.Negative control
Findings
Blocking
mainatb2a47847651band the change atffb12ec6a1f4; it says the traces “will” be attached, but neither trace is attached or linked there. The reviewed head is nowc3e47c8e310feca7051a3353242f8130d4084188. Please attach both trace files and provide a matched change capture for this head, with the corresponding summary lines andtrace_digest.pyoutput. The repository requires both traces for a speed claim.Non-blocking
ffb12echead. That report does not verifyc3e47c8; the current hosted Windows job is still pending.Sources
Not verified
c3e47c8.To get this to a good state
Attach the two trace files and update the matched performance capture and digest for the current head. After that update, I will rerun the same no-build checks and re-review the exact new head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T01:58:57Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The current code diff has no blocking finding from this review, but the required performance evidence does not identify or attach a capture from the current head.
What I ran
Reviewed all four changed files at head
cfb31bae6912efaae772d90199106f959bc83e32. The PR API reports basea4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8; its merge base with currentmain(7feb37ee3e30e10139b483fb4df689d5b5b69ab8) isb28bb772177768f99874ca38f6252cd0139acf2a. The precheck merge preview was clean. Environment: Debian Linux 6.1, Python 3.11.2, GCC 12.2.0. I did not build or compile.Results
Raw check output
Precheck report:
gh pr checksoutput:Negative control
Not run locally: the changed regression tests require a C++ build and GPU-capable test setup. The PR's reported GPU runs are author-supplied and do not cover this head.
Findings
Blocking
e0caf13600 + this change; the newest trace comment names a change capture fromffb12ec6a1f4and says the trace files will be attached. Neither supplies summary records and trace attachments for headcfb31bae6912efaae772d90199106f959bc83e32. The repository requires matchedmainand change summary lines from the same title, scene and machine, with both traces andtrace_digest.pyoutput. Please attach the baseline and current-head traces and include their raw summary lines and digest output.Non-blocking
Sources
ffb12ec6a1f4and says the files will be attached: performance comment.Not verified
To get this to a good state
Add matched captures for
mainand headcfb31bae6912efaae772d90199106f959bc83e32, paste bothaps5-summary.jsonllines, attach both traces, and includetools/trace_digest.pyoutput. On the new head I will rerun the precheck andgh pr checks 14868 --repo boykopovar/AnyPS5, then review the complete diff again.