Repository navigation
perf(agc): rule out pending write overlaps from the published union - #6609
Merged
adriadam10 merged 1 commit intoOct 19, 2026
Merged
Conversation
This was referenced Oct 15, 2026
|
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.
|
11 tasks done
11 tasks done
This was referenced Oct 16, 2026
This was referenced Oct 19, 2026
Collaborator
|
Checked the published-union fast path against |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Recorder::PendingWriteOverlapsanswers whether a range overlaps a GPU write the recorder has noted for its open or in-flight batches. It walks every noted write of every batch, and the draw path asks it from 25 places (in-place draw inputs, texture refreshes, DCC keys, descriptor builds among them).The recorder already merges those writes into the snapshot it publishes (
publishPendingWrites). It now also keeps the union it last published,published, for as long as that union covers every write noted since:publishPendingWritessets it to the union it publishes;noteWriteandnoteWriteOn, which add every batch write, drop it when the new write falls outside it;PendingWriteOverlapsanswers no overlap from that union with one binary search when the range is clear of it, and walks the batches otherwise. The union may still hold the writes of batches that finished since it was built; that only sends a query to the walk. #4889'spublishedWriteRangesis a weak reference that only lets the next publish extend the snapshot, and it is not dropped when a write falls outside it, so this keeps its own strong pointer.On the S2 page of Sonic Origins Plus's main menu,
PendingWriteOverlapscost the queue worker (APS5 sampler, 15 s, samples per frame):That is about 1% of the worker's frame (34 to 37 samples), so the frame times below move within run-to-run noise.
Tested
Windows 11 (10.0.26300), WinLibs GCC 15.2.0 (UCRT), Release, NVIDIA GeForce RTX 2080 Ti, driver 617.14.
agc_driver_gpu_indirect_arguments_misaligned_writer_aheadis not run: main itself does not compile it with MinGW (alignas(65536)).agc_driver_multisample_fill_host_onlyfailed once ("the sentinel fill did not land"). That is main's own race, agc_driver_multisample_fill_host_only fails intermittently: the sentinel fill after an absorbed multisampled clear does not land #6512, which fix(agc): record a multisampled target's commands on its own device #6522 fixes. With this change it failed 42 of 200 runs (8 at a time), as main does (46 of 200 on b7cedd9). With fix(agc): record a multisampled target's commands on its own device #6522's line added it failed 0 of 200.APS5_TRACE_SECONDS=200:15on the same machine in one session, caches warm. Traces attached.The FPS shown in the title went from 9.38 to 9.53 (median of six readings). The p90 gap comes from slower frames in the baseline's window; the median moved within noise.
I captured the baseline twice. The first window caught a stretch where the page's draws repeated exactly and the draw cache hit: frames of 74 ms, no
shader_compile_and_linkphase, and the GPU fence as the limit. The second, used above, shows the moving background like the change's window.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)Traces and summary lines (baseline e3b8d1c, whose summary says a21a3ce; this change a0dd42c, whose summary says e3b8d1c):
union-traces.zip