feat(agc): reuse unchanged untracked storage snapshots #13809
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13809"
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 Celegans12 on 2026-10-31T07:37:13Z.
What
Large untracked storage buffers marked read only are copied again after each collection epoch. Reuse an exact copy while native write-watch tokens and independent AGC proof hold. Flush the full adjusted range before lookup, capture proof before copying, and retain that original proof. Entries share the existing storage pool.
Selected Windows ranges bypass the epoch memo even if arming refuses; unchanged refused ranges therefore copy again. The old memo can return stale bytes after an untracked CPU write within the same epoch. Unsupported hosts keep the previous memo path. Refresh shared stamps after a flush and exclude owned entries from tracked containing-range reuse. Image proofs in #12921 remain separate. Trace summaries separate storage from draw counts for arms, proof checks, requested blocks, reuse, invalidation and capacity evictions. Requested blocks are an upper bound, not exact syscall counts. No title or performance claim.
#13784 and #13793 have merged, so this is one commit on
main. TheCopyDrawInputgate from #17889 keeps working: storage entries are counted by the same owned-entry counter, raised inKeepOwnedDrawInputand lowered ineraseDrawSnapshot. #9875 changes draw-range metadata; #9712 changes snapshot allocation; #7642 adds image-table lookup; #10442 tracks snapshotted reads; #12921 covers shader-resource proofs. The overlap scan could not complete 101 shared-file comparisons, including 43 with implementation files; review composition if those branches land.Tested
Based on
main92b4c42543(rebased 2026-11-15;trace_digestkeeps main's graphics-track table from #18949 next to the storage counts, and the summary line carriesowned_storage_countsnext to main'sgraphics_track). On that tip, the recorder, owned draw/storage, performance-trace,trace_digestandperformance_comparetests (145 in all) passed three times on Windows/NVIDIA RTX 3080 Laptop / 621.14 with validation 1.4.363 loaded and no VUIDs; only the twotrace_digestsymlink-loop cases skip on Windows. Linux was not rerun.Earlier rounds, exact merge with main
93dbd0f82a: Windows 11 / MinGW-w64 GCC 15.2.0, NVIDIA RTX 3080 Laptop, validation 1.4.363: ten focused tests passed three times; Ubuntu llvmpipe, validation 1.3.275: seven passed three times. No reported VUIDs or skips. Linux lacked asynchronous UFFD write protection and uses the non-owned fallback.Trace fixtures check separate draw/storage counts, an unbound event and storage entry-cap eviction. On earlier head
28ba6a5716, flush-stamp and containing-lookup mutants failed both storage tests; a test-only forced old memo returned stale bytes after a CPU write. Restored tests passed. The pinned refusal case is Windows-only.Not tested: macOS runtime, title scenes, console behavior, title performance or tracing overhead. No real-scene block or eviction rate is claimed.
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 CnRJay on 2026-11-01T19:48:17Z.
Review: COMMENTED
Correction (2026-11-01): the title-ID/log demand below is not a CONTRIBUTING requirement;
Unblocks: noneis allowed. The technical points below are unaffected.Same series as #13784/#13793, so the same blocking points apply here.
No title, no number: "No title or performance claim", "Unblocks: none". This is a default-on change to the storage-buffer path (read-only untracked storage > the existing pool). It needs a title ID plus
tools/trace_digest.pysummaries of main and the change from the same machine and scene showing the copies being skipped and the frame cost moving. Without that it is added state and added checks per storage binding with no measured return."Selected Windows ranges bypass the epoch memo even if arming refuses." That reads as a regression for the refused case: a range that was previously served by the per-epoch memo is now recopied every time arming fails (pending writes, pins, host access, non-resident blocks). Is there a test where arming is refused and the old memo still serves the range? If not, this can turn a memo hit into a full copy of a large storage buffer per draw.
The owned entries share the existing storage pool, and the tracked containing-range reuse now excludes owned entries (
!entry->second.owned.words.empty()continue). Two consequences worth stating with numbers: a large owned entry is invisible to the containing-range lookup that would have served sub-ranges, and it can evict other entries from the shared budget. Please add counters for reuse, refusal and eviction so a trace shows the net effect.As with the parents, the negative controls are against the historical 6a691f build and several earlier controls were not rerun on this head. The risk here is serving stale storage contents, so the mutants should be rerun on the submitted commit.
Please sequence after #13784 and #13793 and carry the evidence on whichever PR claims the benefit.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T04:38:47Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: separate storage proof counts from the owned draw input counter so storage eviction cannot disable draw-input reuse.
What I ran
Reviewed head
7cf278b2ff76b8e26326f7fa76e06958fe62c3ed. Read the prepared description, commits, manifest and diff, then targeted source and test ranges throughrepo_read.py. No test commands were run; author-reported test results are not independently verified.Results
Findings
Blocking
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp:302allows storage snapshots to be kept as owned entries, while:199routes them through the same pool as the owned draw snapshots. The changed code increments the sharedownedDrawInputscounter for storage entries, and the existingeraseDrawSnapshotdecrements it for every owned entry. However,CopyDrawInputuses this counter as a gate before looking up an owned vertex/index snapshot. When storage entries are evicted or invalidated, the counter can reach zero while an owned draw input still exists, disabling reuse until another draw input is kept. Keep the shared counter’s semantics limited to draw inputs, or add a distinct storage count and update the gate.Non-blocking
None.
Not verified
Did not run tests or builds. The author-reported Windows and Linux test runs were not independently verified. Did not read full text for
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpporcore/libs/prx/libSceAgcDriver/tests/Recorder.cpp; reviewed the relevant changed hunks and targeted ranges throughrepo_read.py. All other changed files listed in the manifest were included in the review folder; no additional full-file reads were needed.To get this to a good state
Separate storage ownership accounting from the counter used to gate draw-input reuse, then rerun the owned storage and owned draw input tests.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T06:54:17Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: fix the environment switch test setup so the override actually disables owned snapshots.
What I ran
efcfac0fccb78e0a88558cdbd402754a941d43f6; base ismain. No tests or build commands were run.repo_read.py.Results
Findings
Blocking
trueonly after the staticowneddecision has already been computed for the currentPrepareDrawBindingscall. Its subsequent epoch bump does not affect this test's first draw, and the test does not actually establish that the environment switch prevents owned reuse as claimed. The switch must be set before the decision is evaluated (or the test must exercise a freshShaderResourcesinstance after setting it).core/libs/prx/libSceAgcDriver/tests/Recorder.cpp:6741Non-blocking
Not verified
ShaderResources.cppandRecorder.cppwas excluded as too large and only targeted ranges were inspected. The other changed-file contents were read in the prepared diff or targeted ranges; excluded files are documented in the manifest.To get this to a good state
PrepareDrawBindingsmakes its owned-path decision, then run the focused test.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T06:35:21Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this review; the change’s core reuse path and trace-digest handling appear sound in the inspected code.
What I ran
No commands or tests were run. I reviewed head
ca24aa1a04f8b05e2adeefed90802591e5006ed5using the prepared diff andrepo_read.pysource reads.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full text of
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppandcore/libs/prx/libSceAgcDriver/tests/Recorder.cppwas excluded as oversized; the relevant changed hunks were inspected indiff.patch. No tests were run, and runtime behavior on Windows, Linux, macOS, or console hardware was not verified. The description reports Windows test runs, but these were not performed in this review.Files read:
review/description.md,review/commits.md,review/manifest.json,review/diff.patch; targeted ranges ofcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp,core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp,core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp,core/libs/prx/libSceAgcDriver/Execution/include/PerformanceTrace.hpp, andtools/trace_digest.py. Excluded by bundle size: fullShaderResources.cppandtests/Recorder.cpp.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T12:14:51Z.
Review: APPROVED
Reviewed — looks good
The reviewed changes look consistent with the stated goal; I did not run checks, and the PR description’s test results are author reported.
What I ran
Reviewed head
86042155c3177dc269c8f5f306ce382975a49979. No commands or checks were run. I read the prepared diff and targeted source at the pinned head; no merged preview was checked.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full text of
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppandcore/libs/prx/libSceAgcDriver/tests/Recorder.cppwas excluded from the review folder; I read only the relevant ranges through the pinned reader. No runtime, test, build, console, title-scene, or performance checks were performed. The author’s reported test runs were not independently verified.Files read:
review/description.md,review/commits.md,review/manifest.json,review/diff.patch; all 16 changed files listed inreview/manifest.jsonwere reviewed through the diff and targeted source ranges where relevant.review/files.jsonwas not present in the prepared folder listing.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:50:07Z.
Review: COMMENTED
The trial merge onto
c1601e56d5conflicts in recorder, draw and trace files. Preserve the proof taken before copying, the refused-arming control, and the containing-range refusal when rebasing. The optional prefix and last byte both belong to the adjusted copy, so the existing protection tests for those positions are useful. Move the direct AGC debt edit into a fragment.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.