Repository navigation
Conversation
Keep a bounded allocation-free history of complete result identities. One-use results bypass LRU insertion and its second source lock, while repeated results retain the existing cache and lifetime contract. Use an exact collision-resolving history so small hot sets cannot be starved by slot collisions. Cover collision chains, bounded eviction, concurrent requests, and retained results. Written with AI assistance.
|
Rebased on Fedora 44 Release: |
19591f8 to
2a2141f
Compare
adriadam10
left a comment
There was a problem hiding this comment.
Thanks for the PR. Findings:
-
The claimed gain does not reproduce. I ran this PR's own
agc_result_memo_tests --benchmark(3 runs each, same machine, same binary built with and without the admission check; baseline =admitforced totrue):- one-use: PR 0.317–0.341 µs, baseline 0.302–0.308 µs
- repeated64: PR 0.060–0.098 µs, baseline 0.050–0.051 µs
So the PR is slower in both rows here. Both numbers are also sub-microsecond CPU microbenchmarks, which
CONTRIBUTINGdoesn't accept as a reason for a perf PR on their own. Please post before/after numbers on the same tree (main vs main + PR), several runs, ideally from a real draw/dispatch profile (APS5_PROFILE_DRAW) showing the memo's eviction actually costs something. -
Cost vs. benefit. It adds a 69-line custom open-addressing hash plus a 159-line test to save at most a few hundredths of a microsecond per call, and every first occurrence of a result is now rebuilt once more before it is retained. Please show a workload where evictions of one-use results hurt hit rate; otherwise this isn't worth the code.
-
Conflicts with
main:materializeMemoizedwas split intomaterializePreparedMemoized(variant->artifact.variantId) andlibSceAgcDriver/CMakeLists.txtchanged. Needs a rebase. -
agc_result_memoshows as "Not Run" in a scoped ctest unlessagc_result_memo_testsis built explicitly; it is registered correctly, just noting it.
Happy to look again with measurements that show a gain.
|
Review-pass update: Current main still has a 256-entry per-source result memo, but the insertion point is now The earlier unique/repeated microbenchmarks do not demonstrate the proposed benefit: the reviewer reproduced a slowdown in both. The needed comparison is a mixed hot-set plus one-use stream that actually evicts useful results, followed by a title profile showing that eviction/Populate cost matters. No such isolated title gain has been established. I have removed the description's implication that the older component numbers justify landing it; no new code push or merge-readiness claim. A subsequent 180-second Skyrim run with the same main-based experimental NGS library reached recurring draws/dispatches. In three later 10-second memo intervals, main recorded 154/182/208 evictions and only 1.4/1.2/1.2 ms total Populate time. This confirms that evictions occur, but does not show that admission would improve hit rate or materially reduce frame time; the hot-set-versus-stream trace and isolated A/B are still missing. I have updated the PR description to match this status. The PR remains open; the outstanding review requirements are not being marked resolved. AI-assisted audit. |
|
A title workload for the comparison asked for above: Astro's Playroom (PPSA01325) in its first level evicts on practically every memo miss. This is main's own
The title needs more than Measured since: a larger memo does not help here. With These two runs are on the same stack with one more local memo change (a miss reuses the storage of the evicted result). I have not run this PR's policy on it. |
|
Closing for now: the author found no demonstrated gain from the memo. With the queue this large we're closing stalled perf PRs that don't show a gain in a title; reopen it with before/after numbers from a title scene (the summary lines from the performance report form) if you pick it up again. |
Status after review
Awaiting a demonstrated memo-eviction workload.
Current main still has a 256-entry per-source result memo, but the insertion point is now
materializePreparedMemoizedkeyed byvariant->artifact.variantId. This policy would need to move there. I confirmed that main already reports memo hits, misses, evictions and Populate time underAPS5_PROFILE_DRAW, so another instrumentation API is not needed.The earlier unique/repeated microbenchmarks do not demonstrate the proposed benefit: the reviewer reproduced a slowdown in both. The needed comparison is a mixed hot-set plus one-use stream that actually evicts useful results, followed by a title profile showing that eviction/Populate cost matters. No such isolated title gain has been established. I have removed the description's implication that the older component numbers justify landing it; no new code push or merge-readiness claim.
A subsequent 180-second Skyrim run with the same main-based experimental NGS library reached recurring draws/dispatches. In three later 10-second memo intervals, main recorded 154/182/208 evictions and only 1.4/1.2/1.2 ms total Populate time. This confirms that evictions occur, but does not show that admission would improve hit rate or materially reduce frame time; the hot-set-versus-stream trace and isolated A/B are still missing.
What
Results used once fill the shader-result cache and evict useful entries. Retain a result only after its key occurs twice. A fixed history of 256 keys avoids allocation and preserves the existing result lifetime.
Tested
Earlier branch-specific tests and measurements remain in the discussion. They have not been rerun on a redesigned current-main version of this PR. The review audit and shared NGS-assisted title exploration do not establish that this head is merge-ready. No full Linux/Windows platform CI was dispatched in this pass.
Checklist