perf(agc): fast revalidation over untracked memory proves a surface by its stamp until the next ordering point #14262
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14262"
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 oneandonlydean on 2026-11-01T05:05:48Z.
What
Stacked on #14261 (the first four commits are that PR's); only the last four commits are this PR. Based on #6192 by @TheAggie, with the main-based port by @tibzejoker as the starting point. The two original commits keep TheAggie's authorship.
A cached resource template is reused only after
ShaderResources::Revalidateproves its textures and storage images current. The fast proof (fastRevalidate) answers from write stamps; a surface in memory the write watch does not cover (on Windows, every host-pointer import of the guest mapping, #1441) has none, soCollectWritesreturns 0, the fast proof fails withcollect, and the full walk runs.captureValidation), each surface over untracked memory also records a stamp: the collect epoch,NewestStamp(driver stores into the range),ForgetStamp(#6187) and the recorder's newest pending write note over the range. Storage images get the same, instorageUntracked.fastRevalidateaccepts such a surface while its stamp is unchanged, instead of failing withcollect, and leaves it out of theUnchangedSinceAllquery. The keys, the pending-image scan and the cache checks still run as before.compareUntrackedalready uses for untracked memory: a CPU store there is seen at the next ordering point (docs/dev/ARCHITECTURE.md, "Untracked storage image comparisons"). A collect epoch of 0 or a forget in progress gives no stamp, so the full walk runs.APS5_VERIFY_UNTRACKED_PROOFS=1runs the full walk beside every fast proof that involved an untracked surface and reports how often it disagreed; it now also prints the totals when the process exits.Changes against the original PR:
main(the test registration moved totests/cmake/agc_driver_recorder_tests.cmake). Main'scountCollectRefusaldiagnostic is kept: a surface proven fast by its untracked stamp is not counted as a collect refusal, and the count still fires when the stamp check fails.agc_untracked_revalidatenow also covers a storage image and a forget that must drop an existing fast proof, and skips (77) instead of passing when it cannot run.Tested
Linux (kernel 7.2.3), GCC 16.2.1, on main
b08c539c50(with #6187); the stack also merges clean with mainb865ce7a93.agc_untracked_revalidatepasses under lavapipe in all three write-watch modes (default probe,watch,unwatch). WithAPS5_VERIFY_UNTRACKED_PROOFS=1it prints[verify-untracked] at exit: 6 fast proofs over untracked memory checked by the full walk, 0 disagreed. Only the Recorder test target was built on this base; on16452da934the wholectest -R agcset passed under lavapipe (1146 passed, 73 skipped).16452da934with the stack ata3f4f30d51(an A/B against plain main, cold start then warm, Linux, RTX 4090 driver 610.57.04):APS5_VERIFY_UNTRACKED_PROOFS=1, the totals read from a progress print added to the run build only): PPSA02929 unwatch 21,579 fast proofs checked by the full walk, 0 disagreed; PPSA21564 unwatch 75,004 checked, 0 disagreed. Under watch the fast untracked path is never used (0 checked), so the 0 there says nothing.b4cd566a8c(on mainb08c539c50), one verification run per gate title underunwatch(APS5_VERIFY_UNTRACKED_PROOFS=1, totals from the same run-build-only progress print, read at the last print before the run's time limit, so lower bounds): 81,668 and 70,006 fast proofs checked by the full walk, 0 disagreed.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T05:11:47Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Please add the required matched performance and Vulkan-validation evidence, and clarify the landing order for the open stack this branch carries.
What I ran
Reviewed head
b4cd566a8cfeb112776c4b53feeeea4d4327f9da. The PR's recorded base isf377753dd22fa839d7a9071509ae97c3afaafad2; the currentmaintip at the final check was5e936063e3a74b7f03ff06905be04c5a00be60a7. A local merge preview of the PR head onto that currentmaincompleted cleanly (tree67a0b3a9031cc36bcd1d650838bb045586c9a085). Environment: Debian Linux 6.1.0-54, Python 3.11.2, GCC 12.2.0 / g++ 12.2.0.Results
git diff --checkreturned 0 with no output.agc_untracked_revalidateis explicitly registered intests/cmake/agc_driver_recorder_tests.cmakeat line 299. The local heuristic's unregistered-test warning is a false positive.5e936063e3a74b7f03ff06905be04c5a00be60a7. This is a local preview, not a branch update.main; the PR description also says its first four commits are from open #14261. See the blocking stack-order finding below.Unedited local output
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14262:The precheck's ABI and test-quality subprocesses could not find those workspace-only helper scripts in its detached PR checkout; I ran the helpers directly against the exact base/head below. Its dependency check found the declared #6187 head absent from the PR branch.
/usr/bin/python3 tools/check_conventions.py ...:python3 tools/pr_abi_audit.py ... --json:python3 /marc/AnyPS5/tools/pr_test_quality.py ... --json core/libs/prx/libSceAgcDriver/tests/Recorder.cpp:Current-main merge preview:
gh pr checks 14262 -R boykopovar/AnyPS5:Findings
Blocking
perf(agc)PR and the description supplies timing figures, but it has no pairedaps5-summary.jsonllines, trace attachments, ortrace_digest.pyoutput. Please attach themainand change captures from the same title, scene, settings, machine and session, with both summary lines and the digest output. The existing measurements are useful context but do not satisfy the repository's performance-report format.mainand this exact head withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, nor confirm that the layer loaded and that the change adds noVUID-errors. Please provide that comparison and run the newagc_untracked_revalidatetest on this head under the same validation settings; the posted lavapipe/game results do not establish those checks.Depends on: #6187; both PRs are open. The current #6187 head (a049317f3e4d538805b9e81a90d5552d791ab3bf) is not in this branch and conflicts with currentmain. Please correct the checklist and overlap note to state the intended landing order and coordinate that order with the authors of the overlapping work, as the repository contribution rules require.Non-blocking
agc_untracked_revalidateinvokes the new mode and treats return code 77 as a skip.Sources
Not verified
To get this to a good state
Please add the paired captures/digests, the matched Vulkan-validation test comparison, and an unambiguous dependency order. I will rerun the relevant no-build checks and recheck the new exact head when updated.
Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:47:52Z.
Review: COMMENTED
This is a
perf(agc)change, and the evidence given for the speed claim does not support it.1. No
tools/trace_digest.pysummaries. The A/B is raw frame-time percentiles from one run per arm, with "other builds were running on the host". On PPSA21564 the numbers are inside that noise: cold p50 58.7 vs 57.7 ms, warm p50 52.8 vs 54.4 ms (worse with the stack), cold p99 81.1 vs 116.5 ms (worse), warm p99 1222.5 vs 79.6 ms. PPSA02929 is pinned at the 60 fps cap on both arms, so it shows nothing. Please posttrace_digest.pysummaries ofmainand of the branch from the same machine and scene, repeated enough to separate the change from the run-to-run spread.2. The path only exists on Windows, and Windows is untested. The description says the fast proof over untracked memory matters for host-pointer imports (#1441), and that under
watch"the fast untracked path is never used". The Linux numbers were all taken with the write watch forced tounwatch, which is not what a Linux user runs. The Windows measurements are only referenced from #6187 and #6192 on older bases. A speed claim for Windows needs a Windows run on currentmain.3. Unexplained +0.6 GB of video memory on PPSA02929 (4.81/4.96 GB vs 5.44/5.60 GB). "Not explained, one A/B, not repeated" is not good enough for a change that adds no device allocation: either it is noise in the harness, which undermines the other figures from the same harness, or the change keeps something alive longer. Please repeat it and find out which.
4. Cost of the new stamp.
ForgetStamp(from #14261) walks one atomic slot per 64 KiB block of the range, up to 65,536 loads, andcaptureValidation/fastRevalidateevaluate it per untracked surface. A 256 MiB surface is 4,096 loads per call. Please show the per-draw cost of this walk on a scene with large untracked surfaces, or bound it.5. Validation. AGC changes need the focused tests on
mainand on the change withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, with theVUID-comparison. The Tested section shows lavapipe unit tests and game runs without that comparison.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T09:40:15Z.
Review: COMMENTED
Reviewed — no blocking findings
This review could not inspect the prepared change because the required reader and review-folder contents were not available through the provided tools.
What I ran
No reader commands ran. The required
repo_read.pyinvocation and review folder reads were unavailable.Results
Findings
Blocking
None verified.
Non-blocking
None.
Not verified
The description, commits, diff, manifest, changed-file contents, and repository context were not read. No files can be reported as reviewed or excluded.
To get this to a good state
Provide the review inputs and reader access so the change can be inspected.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-03T19:47:42Z.
Review: COMMENTED
Actionable comments
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp, lines5261· 🚀 Performance & Scalability · 💤 Low valueanyUntrackedscans run on every fast revalidation that reaches this block, including whenAPS5_VERIFY_UNTRACKED_PROOFSis unset. Each scan walksvalidatedTexturesandstorageUntrackedin full when no entry is untracked. Evaluate the scan only when verification is enabled and the fast proof was accepted. The result of the check does not change.Suggested fix
f4a96e28-20fe-48ff-9af1-a8b0672d88baReviewing files that changed from the base of the PR and between
b5ca744fd3and2c35142ee2.core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmakedocs/dev/ENVIRONMENT.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T20:15:09Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
2c35142ee2a5043ac30f168cba3bfea5f7702d94. Inspected the prepared description, commit list, manifest, diff, and files; usedrepo_read.pyto inspect changed hunks and targeted source context. No build or tests were run.Results
Negative control
Not run; no tests were invoked.
Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp:4329introduces the fast proof over untracked surfaces. The description reports a p99 regression in one warm workload and an unexplained VRAM increase, but provides no matched native captures, summary records, traces, or digest output to assess them. The repository performance guidance calls for captures ofmainand the change forperfPRs. Consider attaching the paired artifacts and repeating the memory and p99 measurements. Performance guidanceSources
Not verified
No build or tests were run. Windows behavior was not verified. The five files listed under
reviewedwere inspected at their changed hunks; full text forShaderResources.cppandRecorder.cppwas not bundled, so relevant ranges and context were read throughrepo_read.py.files.jsonlists no rule-excluded files.To get this to a good state
Nothing is required. Optionally, add the paired performance artifacts and repeat the anomalous measurements.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:49:48Z.
Review: COMMENTED
The trial merge onto
c1601e56d5was clean. The fast proof for unwatched memory now depends on the ordering-point stamp, which changes when earlier CPU/GPU work must become visible. Please preserve coverage with an actual write across that ordering boundary and with no write before it. Both cases are needed to distinguish a stale proof from a proof that never reuses anything. Paired lavapipe controls are pending.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.