Repository navigation
perf(agc): re-check only the host imports a registry change can reach - #9402
Conversation
|
This pull request is labeled |
|
Summary files (
GitHub does not accept |
|
Traces of the two windows whose summary lines are in the description: main + #8091 (0c6a5bd) and this PR + #8091 (ceefc5b), |
|
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.
|
MarcZX10
left a comment
There was a problem hiding this comment.
This is a substantial performance investigation. The report includes same-machine SuperTuxKart comparisons, traces, an equivalence check across millions of skipped validations, a large focused test set, and paired Vulkan validation results with matching VUIDs. git diff --check passes; GitHub reports the head mergeable, and eligibility, conventions, intake, labels, and report checks pass.
I’m requesting changes for the remaining contribution-rule items:
- The benchmark and test descriptions use bases
0c6a5bd593andeaff87674c; currentmainis4a17c71757. Please rebase onto currentmain, rerun the focused AGC tests on the same machine and GPU with the required validation-layer settings on both current main and the change, compare VUIDs, and refresh the performance summaries/traces against that base. - Please coordinate the shared refresh-loop behavior with #8926 before merge. Your overlap analysis notes that #8926 re-inserts imports in this loop and that the incremental path must add those imports to
pendingImportsif both changes land. Agree on order with its author and reflect any prerequisite inDepends on:. Also refresh the overlap check and coordinate any actual same-line overlaps found in the import insertion, test registration, and debt entry with their authors; the current body records adjacent conflicts with #7261, #6820/#8104, and #7844, while the current overlap scan did not complete in my shared checkout due concurrent temporary-ref updates.
No local AGC test or GPU run was possible in this review environment. The reported older-base results are useful evidence, but the repository requires current-main validation for this change before it is ready.
ceefc5b to
3b7c43e
Compare
|
Summary files of the six SuperTuxKart runs and the traces of the two windows in the description, on |
|
@MarcZX10 rebased onto On the overlaps: I moved the new lines away from the neighbouring edits in |
…ves guest memory alone An unimported queue-0 label synced the recorder before its CPU store, so every batch had finished first. Only what that work does to guest memory can tell the two orders apart: a batch that reads guest memory in place (a store landing first would be read), writes it (the guest would read the old bytes after seeing the label), or has completion actions. Work that leaves guest memory alone, such as draws from copied inputs into host-side targets, cannot be observed by the guest before or after the label. Recorder::UnfinishedGuestTouch reports what the open batch and the in-flight batches whose fences have not signaled still do: in-place reads, noted writes and labels, stores or sample dumps still to record, and completion actions (also of signaled batches, and of batches another thread is finishing). WriteLabelOnGpu stores the label at once (reason 7) when nothing is reported, and syncs as before otherwise. APS5_NO_EARLY_LABELS=1 always syncs. APS5_PROFILE_DRAW prints an [early-labels] line with the counts by reason. The open batch is left open and the reap of finished batches is put off: nothing depends on either before the store. The caller submits and reaps through SubmitAfterEarlyLabel once the label is stored, its waiters woken and an end-of-pipe interrupt delivered; every caller that stores a reason-7 label calls it (the committer's label commit through submitDueAfterCommit). With no completion action in any unfinished batch the reap neither changes the import table nor what the label waits for. Draws noted every in-place region of their resources as read, also the regions of read-only elements that PrepareDrawBindings bound to snapshots, which the GPU never reads in place. MarkGpuWrites now leaves out a region that only snapshotted allocations overlap (every buffer element is a descriptor of one allocation; a BDA build gets no draw bindings and keeps noting every region). SuperTuxKart (PPSA69421) main menu without the tutorial prompt (about 33 draws a frame) on Windows 11, RTX 3070 Laptop, Ryzen 7 5800H; main 9d4fb4f with boykopovar#7464 and boykopovar#9402, this commit and three other local changes (an idle spin of the queue worker and committer, Windows imports over 64 KiB settled at the import, import refresh spans diffed in place); protocol runs interleaved, 3 each. With APS5_NO_EARLY_LABELS=1: 58.69 / 59.28 / 57.44 FPS, 8 / 7 / 18 present intervals over 20 ms, and 38 / 171 / 8 of about 470 frames waited for their vblank. With early labels: 59.94 FPS in all three (the title's vblank cap), no interval over 20 ms, every frame waited for its vblank, and the longest idle gap of queue worker 0 and the committer per frame went from 0.4 ms to 6.7-7.0 ms (median). APS5_PROFILE_DRAW, cumulative over a run: 27090 labels stored at once, 58 waited (42 for an in-place read, 1 for a write, 15 for completion actions). boykopovar#7464's branch on the same main (with boykopovar#7465 under it, without boykopovar#9402 and the other changes): 48.75-49.89 FPS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mport A Windows import of private memory under 1 MiB was compared until its deferred settle, and the deferred return to the write watch is skipped while a live storage image overlaps the range (the rewatch stamps it as a CPU store, which the image would take as a write over its results). SuperTuxKart views its small textures (96 KiB to 352 KiB) from storage images, so they stayed compared for good and every draw sampling one took the full revalidation walk with a byte compare. Imports larger than one 64 KiB block now settle at the import, as the 1 MiB ones did, and stay in the write watch; 64 KiB imports, the size a title maps around every submission, keep the deferred settle. The cost moves to the import: each new private import from 128 KiB up to 1 MiB waits for its settle read (the [buffers] line's "settled inside their window" counts them). APS5_SETTLE_FLOOR_KIB sets the floor (1024 restores the old one), and the retire test, which needs a 128 KiB import on the deferred path, sets it so. SuperTuxKart (PPSA69421) main menu without the tutorial prompt (about 33 draws a frame) on Windows 11, RTX 3070 Laptop, Ryzen 7 5800H; main 9d4fb4f with boykopovar#7464, boykopovar#9402 and three local changes (early unimported labels, an idle spin of the queue worker and committer, import refresh spans diffed in place) plus this one; protocol runs interleaved. With APS5_SETTLE_FLOOR_KIB=1024: 59.94 / 59.94 FPS (a third run lost the window focus and is left out), the same as with this change at the title's vblank cap, and the longest idle gap of queue worker 0 and the committer per frame 5.9 and 6.2 ms (median) against 6.7-7.0 ms. On an earlier stack (main a0900b9 with boykopovar#7464, boykopovar#9402, two local direct-memory changes and the other three changes named above; the menu with the tutorial prompt, about 59 draws a frame), APS5_PROFILE_DRAW over 10 s with the old floor against this one: revalidations 33583 in 1339 ms with 19435 full walks (19355 for a failed collect) against 18287 in 315 ms with 204 (audits only), a draw recorded in 104 us against 82, and dumped menu frames 0 to 6 of both matched within a mean difference of 0.001. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@janzezno a small follow-up idea for Instead of building a new Tested on Windows 11, RTX 3070 Laptop, on your head plus this commit: every ctest entry of AI-assisted: yes (Claude Code). |
adriadam10
left a comment
There was a problem hiding this comment.
Checked the incremental refresh against the current main (5e6ae6e3d): changedSpans, the window test, the predecessor and cursor across spans, pendingImports, and the keys of the remembered failures and refusals. No defect found in the code. Before merge:
- The branch merges cleanly on current
main, but the validation runs were onb7d1d47a5f.GuestBufferMemory.cppchanged onmainsince then (completeSpaceWrites,MarkDirectWrites,WriteBack). Please rerunctest --test-dir build -R "agc|shader|recompiler" -VwithANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationon currentmainand on this change, same machine and GPU, and compare the VUIDs. - Refresh the SuperTuxKart summaries and traces against that base, as requested in the review.
- Put the agreed order with #8926 in the description once its author confirms it.
The open CHANGES_REQUESTED review needs a re-review after these before it can merge.
3b7c43e to
c952eee
Compare
|
@Dripl1x thanks for looking at |
|
@adriadam10 thanks for checking the code. I rebased onto
Edit: the SuperTuxKart numbers, traces and summaries are from a rerun with this PR built from the pushed head |
c952eee to
90b365b
Compare
|
@adriadam10 @MarcZX10 #8926 merged, so this is rebased onto
The body has the digests, the summary lines and the Could you take another look when you have time? |
Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.
|
Windows run of 90b365b merged onto
Each log shows
Not run: SuperTuxKart or any other title, and the performance comparison. AI-assisted: yes |
90b365b to
aca41a2
Compare
refreshImports checked every live host import, failure and refusal again at each guest allocation registry change. A title that maps memory often (SuperTuxKart, ~1650 maps a second) paid a walk that grew with the live imports: ~34 FPS with ~1.1 GiB of imports on RADV. The import table now keeps a weak_ptr snapshot of the ranges it was last checked against and diffs it with the new lease. Only imports whose import window touches a changed span, and imports made since the last refresh, are checked again. Every import is checked when the window is 0 or the window or budget changed. SuperTuxKart's menu goes from ~34 to ~45 FPS with the same imports live.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
aca41a2 to
6bbc37b
Compare
6bbc37b to
a6eeb21
Compare
|
@adriadam10 thanks for the rebase and the Windows After that push the overlap bot started listing eight PRs (#6182, #6185, #6186, #9565, #9712, #9875, #9898, #11451). Each of them adds its own test to the same Windows
|
|
One correction to my last comment: I haven't run the new |
|
Re-checked against current |
…mport A Windows import of private memory under 1 MiB was compared until its deferred settle, and the deferred return to the write watch is skipped while a live storage image overlaps the range (the rewatch stamps it as a CPU store, which the image would take as a write over its results). SuperTuxKart views its small textures (96 KiB to 352 KiB) from storage images, so they stayed compared for good and every draw sampling one took the full revalidation walk with a byte compare. Imports larger than one 64 KiB block now settle at the import, as the 1 MiB ones did, and stay in the write watch; 64 KiB imports, the size a title maps around every submission, keep the deferred settle. The cost moves to the import: each new private import from 128 KiB up to 1 MiB waits for its settle read (the [buffers] line's "settled inside their window" counts them). APS5_SETTLE_FLOOR_KIB sets the floor (1024 restores the old one), and the retire test, which needs a 128 KiB import on the deferred path, sets it so. SuperTuxKart (PPSA69421) main menu without the tutorial prompt (about 33 draws a frame) on Windows 11, RTX 3070 Laptop, Ryzen 7 5800H; main 9d4fb4f with boykopovar#7464, boykopovar#9402 and three local changes (early unimported labels, an idle spin of the queue worker and committer, import refresh spans diffed in place) plus this one; protocol runs interleaved. With APS5_SETTLE_FLOOR_KIB=1024: 59.94 / 59.94 FPS (a third run lost the window focus and is left out), the same as with this change at the title's vblank cap, and the longest idle gap of queue worker 0 and the committer per frame 5.9 and 6.2 ms (median) against 6.7-7.0 ms. On an earlier stack (main a0900b9 with boykopovar#7464, boykopovar#9402, two local direct-memory changes and the other three changes named above; the menu with the tutorial prompt, about 59 draws a frame), APS5_PROFILE_DRAW over 10 s with the old floor against this one: revalidations 33583 in 1339 ms with 19435 full walks (19355 for a failed collect) against 18287 in 315 ms with 204 (audits only), a draw recorded in 104 us against 82, and dumped menu frames 0 to 6 of both matched within a mean difference of 0.001. Rebased onto main as one commit from 90b9574, 63e9ee1 and 17cee29; the initial DCC committer test added on main since gets the same 1 MiB floor as the initial DCC test.
…ves guest memory alone An unimported queue-0 label synced the recorder before its CPU store, so every batch had finished first. Only what that work does to guest memory can tell the two orders apart: a batch that reads guest memory in place (a store landing first would be read), writes it (the guest would read the old bytes after seeing the label), or has completion actions. Work that leaves guest memory alone, such as draws from copied inputs into host-side targets, cannot be observed by the guest before or after the label. Recorder::UnfinishedGuestTouch reports what the open batch and the in-flight batches whose fences have not signaled still do: in-place reads, noted writes and labels, stores or sample dumps still to record, and completion actions (also of signaled batches, and of batches another thread is finishing). WriteLabelOnGpu stores the label at once (reason 7) when nothing is reported, and syncs as before otherwise. APS5_NO_EARLY_LABELS=1 always syncs. APS5_PROFILE_DRAW prints an [early-labels] line with the counts by reason. The open batch is left open and the reap of finished batches is put off: nothing depends on either before the store. The caller submits and reaps through SubmitAfterEarlyLabel once the label is stored, its waiters woken and an end-of-pipe interrupt delivered; every caller that stores a reason-7 label calls it (the committer's label commit through submitDueAfterCommit). With no completion action in any unfinished batch the reap neither changes the import table nor what the label waits for. Draws noted every in-place region of their resources as read, also the regions of read-only elements that PrepareDrawBindings bound to snapshots, which the GPU never reads in place. MarkGpuWrites now leaves out a region that only snapshotted allocations overlap (every buffer element is a descriptor of one allocation; a BDA build gets no draw bindings and keeps noting every region). SuperTuxKart (PPSA69421) main menu without the tutorial prompt (about 33 draws a frame) on Windows 11, RTX 3070 Laptop, Ryzen 7 5800H; main 9d4fb4f with boykopovar#7464 and boykopovar#9402, this commit and three other local changes (an idle spin of the queue worker and committer, Windows imports over 64 KiB settled at the import, import refresh spans diffed in place); protocol runs interleaved, 3 each. With APS5_NO_EARLY_LABELS=1: 58.69 / 59.28 / 57.44 FPS, 8 / 7 / 18 present intervals over 20 ms, and 38 / 171 / 8 of about 470 frames waited for their vblank. With early labels: 59.94 FPS in all three (the title's vblank cap), no interval over 20 ms, every frame waited for its vblank, and the longest idle gap of queue worker 0 and the committer per frame went from 0.4 ms to 6.7-7.0 ms (median). APS5_PROFILE_DRAW, cumulative over a run: 27090 labels stored at once, 58 waited (42 for an in-place read, 1 for a write, 15 for completion actions). boykopovar#7464's branch on the same main (with boykopovar#7465 under it, without boykopovar#9402 and the other changes): 48.75-49.89 FPS.
…ves guest memory alone An unimported queue-0 label synced the recorder before its CPU store, so every batch had finished first. Only what that work does to guest memory can tell the two orders apart: a batch that reads guest memory in place (a store landing first would be read), writes it (the guest would read the old bytes after seeing the label), or has completion actions. Work that leaves guest memory alone, such as draws from copied inputs into host-side targets, cannot be observed by the guest before or after the label. Recorder::UnfinishedGuestTouch reports what the open batch and the in-flight batches whose fences have not signaled still do: in-place reads, noted writes and labels, stores or sample dumps still to record, and completion actions (also of signaled batches, and of batches another thread is finishing). WriteLabelOnGpu stores the label at once (reason 7) when nothing is reported, and syncs as before otherwise. APS5_NO_EARLY_LABELS=1 always syncs. APS5_PROFILE_DRAW prints an [early-labels] line with the counts by reason. The open batch is left open and the reap of finished batches is put off: nothing depends on either before the store. The caller submits and reaps through SubmitAfterEarlyLabel once the label is stored, its waiters woken and an end-of-pipe interrupt delivered; every caller that stores a reason-7 label calls it (the committer's label commit through submitDueAfterCommit). With no completion action in any unfinished batch the reap neither changes the import table nor what the label waits for. Draws noted every in-place region of their resources as read, also the regions of read-only elements that PrepareDrawBindings bound to snapshots, which the GPU never reads in place. MarkGpuWrites now leaves out a region that only snapshotted allocations overlap (every buffer element is a descriptor of one allocation; a BDA build gets no draw bindings and keeps noting every region). SuperTuxKart (PPSA69421) main menu without the tutorial prompt (about 33 draws a frame) on Windows 11, RTX 3070 Laptop, Ryzen 7 5800H; main 9d4fb4f with boykopovar#7464 and boykopovar#9402, this commit and three other local changes (an idle spin of the queue worker and committer, Windows imports over 64 KiB settled at the import, import refresh spans diffed in place); protocol runs interleaved, 3 each. With APS5_NO_EARLY_LABELS=1: 58.69 / 59.28 / 57.44 FPS, 8 / 7 / 18 present intervals over 20 ms, and 38 / 171 / 8 of about 470 frames waited for their vblank. With early labels: 59.94 FPS in all three (the title's vblank cap), no interval over 20 ms, every frame waited for its vblank, and the longest idle gap of queue worker 0 and the committer per frame went from 0.4 ms to 6.7-7.0 ms (median). APS5_PROFILE_DRAW, cumulative over a run: 27090 labels stored at once, 58 waited (42 for an in-place read, 1 for a write, 15 for completion actions). boykopovar#7464's branch on the same main (with boykopovar#7465 under it, without boykopovar#9402 and the other changes): 48.75-49.89 FPS.
What
refreshImportsre-checked every live host import, and every remembered failure and refusal, each time the guest allocation registry changed. A title that maps memory often pays that walk constantly. SuperTuxKart (PPSA69421) maps about 1650 times a second at its menu. With #8091's budget fix, about 440 imports (~1.1 GiB) stay live there, and the walk alone costs ~118 ms of CPU per second on the frame's critical path. The frame rate falls as the import budget grows: ~34 FPS with the default budget, ~48 FPS withAPS5_HOST_IMPORT_MIB=128.This PR makes the refresh incremental:
(address, bytes, weak_ptr)of every range in the lease it was last checked against. The snapshot holdsweak_ptrs because a lease pins its ranges: unmap waits whileuse_count() != 1.owner_before, assameRundoes). The result is the address spans whose ranges were added, removed or replaced, whatever mutation did it, including backing renewals.[base / window * window, max(that + window, base + bytes))) touches a changed span are checked again. These are found with alower_boundon the import map plus one predecessor; imports never overlap, aspeekImportalready relies on.importRun,exactRunandjoinedRunread only ranges inside that span. The scan carries a cursor across the changed spans, so each import is checked at most once per refresh even when several separate spans fall in one window.pendingImports); retiring an import removes its base, so the set never holds more than the live imports.checkis the only place either walk retires an import, so fix(agc): put a retired import's unchanged ranges back in the write watch #8926's handling of retired imports (now onmain) sits there:checknotes the unwatched ranges of each import it retires, and those ranges go back in the write watch once after both walks.sameRun, so this is cleanup only.One behaviour differs, and it is recorded in
docs/dev/debt/libSceAgcDriver.md. An unchanged import whose run could now be larger, because a remembered refusal no longer holds, is kept until its window changes. A request that needs the larger run still retires it (wouldRetireImport). Onmain, any registry change anywhere retired it. Under a 128 MiB budget in SuperTuxKart,mainretired and re-made the same three still-valid single-range imports about 1650 times a second for this reason.New test
agc_windowed_import_refresh(128 KiB window, three windows):It passes on
mainand on this PR. It fails when the window query is narrowed tolower_bound(begin): "an import whose window gained a continuing range was kept".Two local probes (not in this PR) checked the review follow-ups:
Tested
Arch Linux (kernel 7.2.11), Ryzen 5 7500F, AMD Radeon RX 7900 GRE, RADV Mesa 26.2.5, on
main716cb74e08. SuperTuxKart (PPSA69421 00.001.000, catalog sha256f2240bf0…b712a), relinked with--trap-sdk-syscall-stubs. Main menu with no input, headlessgamescope --backend headless -W 1920 -H 1080,APS5_TRACE_SUMMARY_EVERY=10, 70 s runs. Each side's first run creates the game's configuration and starts in a different first-launch scene, so it only warms the shader caches and is not counted. Then four rounds of one run per side, main first. The FPS is the presents in the last 8 s of each run (VideoOut telemetry).Why #8091 is applied on both sides. On RADV, plain
mainlowers the import budget after memfd-backed imports are refused (#8091). The menu then randomly settles in a GPU-bound ~3 FPS mode, with GPU ~90% busy and a CPU nearly idle, or a fast mode with ~74 MiB of imports. Both sides do this: on plainmaineaff876, main ran 2.9 / 2.7 / 3.3 FPS and this PR 1.0 / 3.2 / 53.7 FPS. That noise hides the walk. Both builds below therefore carry #8091's one-line production change inimportRunAt. This PR does not depend on #8091.Round 1 started right after this PR's build finished (load average 12.7) and is slower on both sides, so it is listed apart; the fourth round was added for that reason. On the previous base
1e20650e84the same protocol gave 32.3 / 32.3 / 32.2 onmainand 39.7 / 38.5 / 38.5 with this PR, and onb7d1d47a5f37.2 / 35.9 / 36.8 and 51.8 / 54.0 / 53.2.mainwas built from716cb74e08and this PR from its pushed head90b365b5b9, each with #8091's one-line change uncommitted, so both sides' summary lines show as dirty.tools/trace_digest.pyof the first clean run (round 2) of each side (summary files of all runs attached):main + #8091
6 intervals, 0.0 to 60.1 s, 1790 presents
AMD Radeon RX 7900 GRE (RADV NAVI31), radv Mesa 26.2.5-arch1.1, Linux 7.2.11-arch1-1, 1920x1080, commit 716cb74 (dirty)
this PR + #8091
6 intervals, 0.0 to 60.1 s, 2051 presents
AMD Radeon RX 7900 GRE (RADV NAVI31), radv Mesa 26.2.5-arch1.1, Linux 7.2.11-arch1-1, 1920x1080, commit 90b365b (dirty)
Trace windows for the perf check.
APS5_TRACE_SECONDS=40:10, same scene, machine and builds as the runs above. Two windows per side: main 322 / 326 presents, p50 31.1 / 30.7 ms, p99 32.2 / 31.6 ms; this PR 370 / 364 presents, p50 26.7 / 27.3 ms, p99 33.1 / 30.9 ms. The first PR window has one 43 ms frame, which puts its p99 and max abovemain's; the second does not. The first window of each side, with its trace attached (aps5-trace-716cb74e0871-151594ismain,aps5-trace-90b365b5b9f0-151903is this PR):main + #8091:
{"commit":"716cb74e0871","dirty":true,"env":{"APS5_NO_PAD_INPUT":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:10","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"AMD Radeon RX 7900 GRE (RADV NAVI31)","driver":"radv Mesa 26.2.5-arch1.1","os":"Linux 7.2.11-arch1-1","cpu":"AMD Ryzen 5 7500F 6-Core Processor","cpu_threads":12,"memory_mib":31744,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:10","first_present":1149,"ms":10026.366},"presents":322,"frame_ms":{"p50":31.120,"p90":31.659,"p99":32.202,"max":33.652},"gpu_busy_ms_per_present":1.884,"worker_busy_pct":{"queue worker 0x0":4.131},"top_phases_ms_per_frame":{"Graphics.Draw":2.800,"Vulkan.DrawFromRecipe":2.614,"Graphics.DrawWithRecipe":2.598,"Graphics.DrawWithRecipe.draw_and_resource_release":2.591,"Graphics.Draw.draw_and_resource_release":2.099,"Recorder.Submit":1.968,"Driver.Packet":1.267,"Driver.Packet.draw":0.863},"trace_dropped":false,"trace":"aps5-trace-716cb74e0871-151594.json.gz"}this PR + #8091:
{"commit":"90b365b5b9f0","dirty":true,"env":{"APS5_NO_PAD_INPUT":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:10","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"AMD Radeon RX 7900 GRE (RADV NAVI31)","driver":"radv Mesa 26.2.5-arch1.1","os":"Linux 7.2.11-arch1-1","cpu":"AMD Ryzen 5 7500F 6-Core Processor","cpu_threads":12,"memory_mib":31744,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:10","first_present":1328,"ms":10022.000},"presents":370,"frame_ms":{"p50":26.698,"p90":29.304,"p99":33.106,"max":43.172},"gpu_busy_ms_per_present":1.885,"worker_busy_pct":{"queue worker 0x0":4.573},"top_phases_ms_per_frame":{"Recorder.Submit":1.885,"Graphics.Draw":1.777,"Vulkan.DrawFromRecipe":1.494,"Graphics.DrawWithRecipe":1.479,"Graphics.DrawWithRecipe.draw_and_resource_release":1.472,"Graphics.Draw.draw_and_resource_release":1.471,"Driver.Packet":1.220,"Driver.Packet.draw":0.830},"trace_dropped":false,"trace":"aps5-trace-90b365b5b9f0-151903.json.gz"}tools/trace_digest.py, main + #8091seconds 40:10 from present 1149: 322 presents, frame p50 31.1 / p90 31.7 / p99 32.2 / max 33.7 ms, GPU busy 1.9 ms per present
AMD Radeon RX 7900 GRE (RADV NAVI31), radv Mesa 26.2.5-arch1.1, Linux 7.2.11-arch1-1, 1920x1080, commit 716cb74 (dirty), dropped: no
{"commit":"716cb74e0871","dirty":true,"env":{"APS5_NO_PAD_INPUT":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:10","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"AMD Radeon RX 7900 GRE (RADV NAVI31)","driver":"radv Mesa 26.2.5-arch1.1","os":"Linux 7.2.11-arch1-1","cpu":"AMD Ryzen 5 7500F 6-Core Processor","cpu_threads":12,"memory_mib":31744,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:10","first_present":1149,"ms":10026.366},"presents":322,"frame_ms":{"p50":31.12,"p90":31.659,"p99":32.202,"max":33.652},"gpu_busy_ms_per_present":1.884,"worker_busy_pct":{"queue worker 0x0":4.131},"top_phases_ms_per_frame":{"Graphics.Draw":2.8,"Vulkan.DrawFromRecipe":2.614,"Graphics.DrawWithRecipe":2.598,"Graphics.DrawWithRecipe.draw_and_resource_release":2.591,"Graphics.Draw.draw_and_resource_release":2.099,"Recorder.Submit":1.968,"Driver.Packet":1.267,"Driver.Packet.draw":0.863},"trace_dropped":false,"trace":"aps5-trace-716cb74e0871-151594.json.gz"}Slowest frames (largest slices inside each, inclusive)
Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): Driver.WorkerWait 29.7, Driver.WorkerWait.idle_and_completion_poll 29.7, Graphics.Draw 2.8, Vulkan.DrawFromRecipe 2.6, Graphics.DrawWithRecipe 2.6, Graphics.DrawWithRecipe.draw_and_resource_release 2.6, Graphics.Draw.draw_and_resource_release 2.1, Recorder.Submit 2.0, batch 1.9, Graphics.Draw.validate 0.7
Longest waits
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)
tools/trace_digest.py, this PR + #8091seconds 40:10 from present 1328: 370 presents, frame p50 26.7 / p90 29.3 / p99 33.1 / max 43.2 ms, GPU busy 1.9 ms per present
AMD Radeon RX 7900 GRE (RADV NAVI31), radv Mesa 26.2.5-arch1.1, Linux 7.2.11-arch1-1, 1920x1080, commit 90b365b (dirty), dropped: no
{"commit":"90b365b5b9f0","dirty":true,"env":{"APS5_NO_PAD_INPUT":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:10","APS5_TRACE_SUMMARY_EVERY":"10","APS5_VIDEOOUT_TELEMETRY_DIR":"<path>"},"gpu":"AMD Radeon RX 7900 GRE (RADV NAVI31)","driver":"radv Mesa 26.2.5-arch1.1","os":"Linux 7.2.11-arch1-1","cpu":"AMD Ryzen 5 7500F 6-Core Processor","cpu_threads":12,"memory_mib":31744,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:10","first_present":1328,"ms":10022.0},"presents":370,"frame_ms":{"p50":26.698,"p90":29.304,"p99":33.106,"max":43.172},"gpu_busy_ms_per_present":1.885,"worker_busy_pct":{"queue worker 0x0":4.573},"top_phases_ms_per_frame":{"Recorder.Submit":1.885,"Graphics.Draw":1.777,"Vulkan.DrawFromRecipe":1.494,"Graphics.DrawWithRecipe":1.479,"Graphics.DrawWithRecipe.draw_and_resource_release":1.472,"Graphics.Draw.draw_and_resource_release":1.471,"Driver.Packet":1.22,"Driver.Packet.draw":0.83},"trace_dropped":false,"trace":"aps5-trace-90b365b5b9f0-151903.json.gz"}Slowest frames (largest slices inside each, inclusive)
Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): Driver.WorkerWait 25.7, Driver.WorkerWait.idle_and_completion_poll 25.7, batch 1.9, Recorder.Submit 1.9, Graphics.Draw 1.8, Vulkan.DrawFromRecipe 1.5, Graphics.DrawWithRecipe 1.5, Graphics.DrawWithRecipe.draw_and_resource_release 1.5, Graphics.Draw.draw_and_resource_release 1.5, Driver.Packet 0.4
Longest waits
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)
tools/performance_compare.pyPerformance comparison
Configuration differences
Frame and GPU times (ms)
Top phases (ms per frame)
perf, measured on the previous base, 10 s from 40 s into a run, same scene, on
1e20650e84+ #8091: onmain,_Rb_tree_increment3.0%,importRunBounds1.9%,leasedIndexContaining1.5%,walkRun1.1% andsameRange0.7% of samples. With this PR,_Rb_tree_incrementis 2.2%,refreshImportsitself 0.8%, andimportRunBounds,leasedIndexContaining,walkRunandsameRangeare each 0.2% or less.clock_gettimeis about 22% on both sides.Other measurements (same machine and scene, menu,
maineaff876 + #8091):APS5_PROFILE_GPU=1shows the same recorded GPU time per present on both sides (2.4 ms in 59 batches), andAPS5_NO_DRAW_INPUTS_IN_PLACE=1changes nothing. So this is not perf: Red Dead Redemption (PPSA30528) G-buffer draws spend ~100x their GPU time reading vertex/index data in place from host imports #5895's in-place read cost.importRun4.3%,_Rb_tree_increment2.3%,leasedIndexContaining1.8% andsameRange1.6% of user samples. With this PR,importRun,leasedIndexContainingandsameRangestay under 0.3%.refreshImportsitself is 1.7%: the lease diff is linear in the ~800 registered ranges, and the remembered failures and refusals are still iterated.sameRangefor every import the incremental refresh skipped. With the default budget it found 0 differences in ~3.4M skipped checks. None of the skippedunwatchedimports were back in the write watch, and no imports overlapped. With a 128 MiB budget, the only differences were the refusal-dependent run shapes described above.AGC, shader recompiler:
ctest --test-dir build -R "agc|shader|recompiler" -V -j6withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, onmain7903201bb4and on this change applied to it, same machine, without #8091.mainhas since moved to716cb74e08with documentation changes only. Neither log containswas not found but was requested by env var VK_INSTANCE_LAYERS.main: 1045 of 1046 passed. This PR: 1046 of 1047, with the new test.agc_driver_tessellation(segfault, Mesa 26.2, agc_driver_tessellation segfaults on RADV with Mesa 26.2+: nir_opt_varyings corrupts the TCS input offset's use list (Mesa bug) #5444) fails on both.VkPipelineColorBlendStateCreateInfo-pAttachments-00605×26.Overlap with open pull requests, from
tools/pr_overlap.pyon3c4aab5acc, which reports none:checkand after both walks, as described above.refreshImportskeeps itsstate.gateRefusals.clear()after the generation check, before this PR's window test. Its color-target imports are made inimportRunAt, which records them inpendingImports, so the incremental walk checks them.agc_windowed_import_refreshgets its WindowsPATHin its ownif(WIN32)block after its registration, not in the sharedset_tests_propertieslist that fix(agc): retire the window imports that pin a range a guest unmap waits for #6182, fix(agc): copy only the dwords a shader changed back from a GPU-copied buffer #6185, fix(agc): keep CPU stores made after a deferred DCC key store was recorded #6186, fix(agc): free a completed batch's command buffer instead of keeping it #9565, perf(agc): keep draw snapshots in resizable BAR memory #9712, perf(agc): copy only the vertex records a draw fetches #9875, perf(agc): keep constant RAM dumps and unregistered labels on the GPU without draining #9898 and perf(agc): bind moved read-only words from the draw upload chunk #11451 also extend.main, memoizesimportRun's run bounds, which lowers the cost of each check. This PR lowers how many checks run.refreshImports,retireImport,importRunAtorClearHostImports:GuestMemory::Unwatchline in the import loop, which this PR moves intocheck, and notes every import it re-unwatches. With this PR only re-checked imports are re-unwatched. Write watching only comes back on a range through a registry change (a new mapping, or a remap, whoseProtectreplaces the ranges), through a settle that marks its import watched, or through fix(agc): put a retired import's unchanged ranges back in the write watch #8926's rewatch of a retired import's ranges, which skips ranges a live unwatched import still covers. So a skipped import is never back in the write watch, as the check mode above also found.importRunAtmakes an import, not the refresh; perf(agc): remember structural host import misses #7457 only readsrefreshedGeneration.importRunAtcreates a dma-buf import; the import is still added through the sameemplace, which records it inpendingImports.refreshImportscall with the whole acquired lease, as the other callers pass, and makes its joined import throughimportRunAt, sopendingImportsrecords it.ClearHostImports; it does not touch the line this PR adds there.retireImport,importRunAt,refreshImportsandClearHostImportsnext to this PR's lines (its epoch counter), not the lines themselves.mainadded onerefreshImportscaller since the last base (WatchedAfterSettle, 44141f9); it passes the whole acquired lease, as the others do.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)