Repository navigation
perf(agc): keep a resource set's import proof across registry changes that leave the imports in place - #7261
Conversation
|
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.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Review of e039bd7. The production change looks sound: I found no way for a kept proof to go stale. Every path that removes an import from the table bumps the epoch, the new One ask, test only: the reconcile in The reconcile is what catches registry changes the hook doesn't see:
Without it, a proof would be kept over an import whose registered range has changed, which is the staleness this PR has to guard against, and nothing in CI would notice if the reconcile were lost. Could you add a case where the registry changes so that an import no longer matches its run, without the unmap hook retiring it, and require the proof to fail? One option is registering a range adjacent to the imported window's run so that |
|
Thanks for checking. You're right: the remap case goes through the unmap hook and never needs the reconcile. I'll add a case where a registry change breaks the import's run without the hook retiring it, and check that it fails both with the AI-assisted (Claude Code). |
|
Added in 21fe671.
I first tried an adjacent range after a window-sized part of a larger block. That import covers only its own window, so
AI-assisted (Claude Code). |
|
Rebase handoff — rebased onto current Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, To pick it up: Head is |
21fe671 to
8920214
Compare
|
@blawesom thanks for the rebase and for catching the duplicated On Windows (MinGW GCC 15.2, RTX 4090), AI-assisted (Claude Code). |
… that leave the imports in place Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XBXM4pgkMHYEtqN1EQni2P
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XBXM4pgkMHYEtqN1EQni2P
…etes an import window Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XBXM4pgkMHYEtqN1EQni2P
8920214 to
0c2a343
Compare
|
Rebased on current @oneandonlydean you reviewed the reconcile logic on 2026-10-17. When you have a moment, could you take another look at this head? It has been ready since @blawesom's rebase. Thanks. |
✅ NVIDIA GPU test: passedPR head
Failing on main too (4, not counted against this PR)Validated but not compared (1, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 475 tests)Skipped (44)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
An AMD RDNA 4 run on Windows of Windows 11 Pro 10.0.22631, AMD Radeon RX 9070 XT (
AI-assisted: yes (Claude Code) |
|
Thanks @bunbeans2-arch, that adds AMD RDNA 4 on Windows (amdvlk) to Tested. The new AI-assisted: yes (Claude Code) |
The conflict with #7261 in ShaderResources::noteReusable keeps both resets: main's importsReconcilable = false, then this PR's spaceReuse = false.
What
A reused resource set that reads imported buffers in place proves, before each use, that every import it was built against is still the same one (
ShaderResources::Revalidate, the serial loop over its direct regions). An epoch gate skips that loop while the import table is unchanged since the set's last proof (HostImportsUnchanged). That proof is also tied to the guest allocation registry's generation, so any registry change fails it for every cached set, whether or not it touched an import. Each set then runs its serial loop, and the firstHostImportSerialcall reconciles the table with a fresh lease.A title that maps and unmaps guest memory often moves the generation between most frames. Each cached set used after that pays the loop, its lock round trips and a lease, even though no import changed.
This PR adds
HostImportsReconciledUnchanged. It reconciles the import table with the registry once, if the generation moved, then accepts the proof when no import was dropped (the existingepoch) and none was added (a newinsertedcount, also stored inHostImportsProof). Reconciling is what the serial loop's first lookup already did. After it, a set whose regions are all served by imports finds the same serials exactly when no import was added or dropped.Revalidateuses the new check only for sets whose direct regions are all served by host imports and have no committed-span bound (CutRegions). Sets with a read-only image mirror region, or a region bounded by its committed span, keep the current check: their serial loop also checks things the import table does not track. The other users ofHostImportsUnchanged(recipe presync,Texture.cpp) are unchanged.Test:
agc_driver_host_import_proofs(tests/execution/HostImportProofs.cpp). It imports a window through a GPU fill and takes a proof. It then checks that:Run with main's
HostImportsUnchangedin place of the new check, it fails: "an unrelated registration broke the proof, although every import stayed in place".Related: #6917 (keep the lease snapshot until the registry changes) and #6951 (memoize import run bounds) make each reconcile and lookup cheaper. This PR runs them less often. The three don't touch the same lines.
Tested
Windows 11 Pro (26200), RTX 4090 (NVIDIA 616.92), i9-13900K, MinGW GCC 15.2.0:
0c2a343d25, rebased onmain48c160c58b:agc_driver_host_import_proofspasses on the RTX 4090 and the UHD 770 (Intel 101.6129), underVK_LAYER_KHRONOS_validationwith noVUID-line. WithHostImportsUnchangedinstead, it fails with the message above.ctest -R "^agc" -E "^agc_driver_bda_device$"on the RTX 4090: 1078 of 1080 pass. The 2 failures,agc_host_import_cut_lifetimeandagc_driver_depth_plane_partial_store, also fail onmain.ctest -R "agc_driver|agc_masked|agc_shader", 524/524 pass, 2 skipped.mainstops GTA V before its menu, GTA V (PPSA04264) stops before the menu: color export format 4 into an unsigned integer target is unsupported #11513). The build is main plus feat(recompiler): run waterfall loops over per-lane T#s through image tables #6488, perf(agc): clear single-key DCC surfaces on a verified uniform color #6848 and perf(agc): grow the resource cache while the keys it evicts come back #7189: GTA needs the first two to render, and perf(agc): grow the resource cache while the keys it evicts come back #7189 removes the resource set rebuilds that hid this cost. Settings:APS5_PROFILE_DRAW=1, last 12 windows of 10 s, one run each:A stack sample of the draw committer before the change put
HostImportSerial(with itsGuestAllocationsAcquire) at 3 % of the committer's samples, all from this loop. The frame rate in this scene depends on where the save respawns the player (2-11 FPS within one run), so the committer figures are the comparison to read. The gain is one run each and larger than that 3 %, so take its size with care.Performance capture
GTA V (PPSA04264), open world from the same save, RTX 4090, one warm-up run then one traced run per side, same session. Base
17eacab0ecac=main47a266c + #6488 + #6848 (GTA V does not run on plainmain) + #7189 + a local bench aid (keyboard pad input while an IME session is open). With the PR:57dd68bc3900= the same plus this change, cherry-picked onto that older base (one hunk adapted: only theinsertedcount). Traces: fork release perf-7261-20261019.320 -> 392 presents in the 60 s window, p50 189.4 -> 145.9 ms. Read this with care: in the open world frame time follows where the save respawns (2 to 11 FPS within one run), and the trace buffer of queue worker 0 fills after a few seconds (
trace_dropped). The committer cost per draw under Tested is the measurement this PR rests on.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)agc_driver_host_import_proofs3 of 3 on0c2a343d25+ mainf7f03daf52, validation on, 0VUID-lines)🤖 Generated with Claude Code
https://claude.ai/code/session_01XBXM4pgkMHYEtqN1EQni2P