perf(agc): maintain draw fingerprints on register writes #1312
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1312"
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 TibixDev on 2026-10-07T23:14:54Z.
What
Maintain draw-register fingerprints on writes, using the current draw dependency ranges. Runtime user words stay live; device serial and shader registry identity remain in the final key. Copy, restore, erase, clear and PM4 writes keep the fingerprint consistent.
APS5_VERIFY_REGISTER_KEYS=1checks it against full recomputation.Rebuilt directly on main
d146ec1b6, removing the old #1311 stack and its draw-plan API. This is a single-topic, seven-file change using the current prepared-shader draw path.Tested
Fedora 44, GCC 16.2.1, Release:
No new isolated in-game performance claim. Plain main currently stops this Skyrim boot at unsupported NGS reverb channel conversion; a shared experimental NGS integration baseline is being checked separately. Windows and full platform CI were not run locally; those require the repository's collaborator-dispatched workflow.
Checklist
Title artifact correction
A binary-hash audit found that the earlier title runtime copies all contained the same patched main AGC library. Those runs establish the main + experimental NGS baseline only. They do not validate #1312/#1313 in-game. The separately built CTests and CPU benchmarks used the new unpatched libraries/source and remain valid. The earlier PR-specific title claim is withdrawn; corrected results follow.
Verified runtime rerun
Corrected runtime result: the NID-patched #1312 library has SHA-256
a15e22c1b1305f79ab39089c7640ab9b6dd0fb9e6bffc0910d053cddfc7d51eb, differs from baseline, and contains the fingerprint verification code./procconfirms the game loaded that file and the shared experimental NGS library. A fresh 120-second run withAPS5_VERIFY_REGISTER_KEYS=1reported at least 1,706 register-key lookups, no fingerprint mismatch, and presented frames. It stopped at the imposed timeout (124). No performance comparison is claimed with this verification enabled.Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-08T07:10:29Z.
Rebased on
c081eb90. Updated #1311 after #1134 merged. Non-indexed mesh draws retain the upstream null index descriptor; retained plans and their invalidation coverage remain intact.Fedora 44 Release:
agc_driver_draw_plan_tests,agc_driver_tests,agc_driver_graphics_tests,agc_driver_pm4_testsbuild; the targeted tests and contribution checks pass. Windows CI is pending.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T10:32:27Z.
Review: CHANGES_REQUESTED
Not mergeable as is, and I can't rebase it mechanically:
main: #639 replacedcompileDrawStagewithmaterializeDrawStage(built from invocations prepared at registration), so the draw path this PR extends no longer exists. As @oneandonlydean already noted, the retained compile results from #1311 have to be redone on top of it, and this PR sits on that work.mainand keep this PR to its own commit.main(the fingerprint maintenance on register writes), not against the pre-#639 tree: with shader compilation at registration, the per-draw cost profile changed.Happy to review again once it's on top of
main.Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-12T04:47:28Z.
Reworked this directly on main
d146ec1b6in748d8d3af; #1311 and the old draw-plan stack are no longer dependencies. The fingerprint now feeds the existing draw key, preserving the current device/shader registry inputs and prepared-shader path.Register-key differential/mutation tests, PM4, graphics and prepared graphics pass with
APS5_VERIFY_REGISTER_KEYS=1; GPU tests use RADV core/synchronization validation. The new proxy also preserves compound writes and snapshot reads used by the graphics fixtures.For an isolated comparison, I compiled separate benchmarks using main's exact register container and this branch's container. Six ABBA runs per side, pinned CPU, process CPU time, including writes: 24 live user words cost 1.386 → 0.144 µs; with 256 additional writes, 3.028 → 2.032 µs. Intermediate 1/16/64-write cases also improve. These are warm component numbers; the body no longer relies on combined-fork Helgen evidence or implies a measured title gain.
Full Linux/Windows CI still needs the collaborator-dispatched workflow. AI-assisted update.
Artifact correction: the title runtime copies were subsequently found to contain the same patched main AGC library. The saved PRESS ANY BUTTON frame therefore validates the main + experimental NGS integration, not #1312 or #1313. The CTests/CPU benchmarks used the new unpatched builds and remain valid. The earlier PR-specific title claim is withdrawn; corrected results follow.
Corrected runtime result: the NID-patched #1312 library has SHA-256
a15e22c1b1305f79ab39089c7640ab9b6dd0fb9e6bffc0910d053cddfc7d51eb, differs from baseline, and contains the fingerprint verification code./procconfirms the game loaded that file and the shared experimental NGS library. A fresh 120-second run withAPS5_VERIFY_REGISTER_KEYS=1reported at least 1,706 register-key lookups, no fingerprint mismatch, and presented frames. It stopped at the imposed timeout (124). No performance comparison is claimed with this verification enabled.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T00:35:31Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/tests/Pm4.cppL4core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppL8-9, L28-38Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T08:55:07Z.
Review: APPROVED
Checked on current main: merged tree builds,
agc_driver_graphics,agc_driver_pm4,agc_driver_prepared_*and the newagc_driver_register_keypass. The new test does not compile without the change, and dropping the fingerprint update inRegisters::erasemakes it fail ("incremental fingerprint missed a mutation"). TheReferenceproxy also keeps any rawuint32_t&write from bypassing the fingerprint at compile time.Note: #4943 touches
DrawRegisterKey.cpptoo and conflicts with this one, so whichever lands second needs a rebase. Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T10:47:32Z.
The full Build failed on Windows only in
agc_driver_register_key(exit code 0xc0000135, DLL not found at start-up); the other 1051 tests passed. The new test target linked onlylibSceAgcDriver, while the sibling AGC driver tests (agc_driver_pm4_tests,agc_driver_graphics_tests) also linklibcandlibkernel.Added on top of your commit, rebased on current main:
core/libs/prx/libSceAgcDriver/CMakeLists.txt:agc_driver_register_key_testsnow linkslibcandlibkernellike its siblings.Merging once the full Build is green on the new head.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T12:59:47Z.
The full Build on the previous head still failed on Windows only in
agc_driver_register_key(0xc0000135, DLL not found at start-up). Linkinglibcandlibkernelwas not enough: the sibling AGC driver tests also getPATH=path_list_prepend:$<TARGET_FILE_DIR:libc>on Windows from theagcTestloop, and this test did not.Added on top of your commit, rebased on current main:
core/libs/prx/libSceAgcDriver/CMakeLists.txt:agc_driver_register_keyprepends libc's directory toPATHon Windows, like its siblings.Merging once the full Build is green on the new head.