perf(agc): compile uncached draws ahead of queue 0 #6188
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6188"
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 mitul72 on 2026-10-15T01:19:49Z.
What
Six commits. Draws whose register key is new (per-frame ring addresses in user data make most keys new every frame) captured and recompiled their stages on the queue-0 thread, and each draw snapshotted its small inputs through the full buffer path.
DrawStageRequest,DrawStageVariant), and insert the variants into the draw cache. Queue 0 validates them as any cached variant, against current memory.Graphics::PrepareDrawcomputes the vertex input layout, pipeline stage mask and resource content key on the worker; they are stored on the entry, tied by weak reference to the exact variants compiled. Queue 0 uses them only for a non-indirect draw whose stages refreshed no data words; otherwise it builds them as before.Worker count: a quarter of the hardware threads, clamped to 1-4. Without a working kernel copy no workers run. Draws whose compilation consumes packet-derived inputs (mesh draws, instanced tessellation, indirect draws) are not compiled ahead.
Validation of cache hits now dominates queue 0's lookup cost, since nearly every draw hits; the last commit tests validated runs against the pending images' merged range index, takes the shadow registry's mutex once per run list, and checks a run list against queued pipelined commits under one lock (
DrawPipeline::OverlapsAny, same answer as the per-run check).Admission follows the driver's own rule: every entry compiled ahead goes on probation, in its own list bounded by the cache size, so it pushes out only other probation entries. Promotion happens only through queue 0's own sighting under main's admission rule and exclusions, in one step with queue 0's insert decision, so a key is admitted at the same execution that would admit it without compile-ahead. Worker variants record their stage capture and pure-data word positions, so they take part in stage data hits.
Speculative reads: under
GuestMemory::SpeculativeReadScope,Readcopies through the kernel (process_vm_readv/ReadProcessMemory) into the capture's private buffer, so a concurrent store is not a data race and an unmapped page fails the copy instead of faulting. All other guest memory access in that scope throws (SpeculativeReadRefused). The variant records the words it was compiled from; queue 0 compares them with memory after its waits and flushes. Every guest read and cache insertion of a job is pinned to its draw; queue 0 passes a draw before executing it and retires the submission when it ends.Speculative failures never surface: any exception in the scan, resolve, decode, capture, compile or
PrepareDrawonly means the draw has no precomputed result. Queue 0 then performs the draw as without draw-ahead on current memory. The serial path remains authoritative and throws on genuine errors; what the speculation saw (stale, torn or unmapped memory, an unfollowable context stack) is not an error of the draw.Tests:
DrawAhead,DrawAheadRaw,DrawAheadScan,Recorderadditions. They include a draw with an invalid buffer descriptor repaired before the draw, a table mapped only after the worker's read, a draw after a CONTEXT_STATE push in a skipped COND_EXEC, an indexed draw of restart indices only with a stride beyond the device limit, and a refused read of an inaccessible range.Tested
Linux, RX 9060 XT (RADV GFX12, local Mesa). Full
ctestpasses exceptagc_driver_tessellation, which segfaults inside RADV while linking pipeline libraries on unmodified upstream main as well.Astro Bot crash-site hub on main
4eb91eacd(pipelined draws on), 3 x 10 s windows, gamescope headless, one run each, nothing else running:Per 10 s: 196k draw records published, 196k used, 186k draws compiled ahead, 1.3k jobs dropped. With
APS5_PROFILE_DRAW=1a[draw-ahead]line reports these counts. Single runs of the base varied by about 0.3 fps.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-15T01:29:51Z.
Review: COMMENTED
macOS portability note on head b7798715d (static review, no full build).
Two calls in the non-Windows branches are Linux-only, so they will not compile for macOS (the port in #1 builds this driver with Apple clang):
Execution/src/Driver/Draw/DrawAhead.cpp:28:pthread_setname_np(pthread_self(), name);-- macOS only has the one-argument form, which names the calling thread.Execution/src/GuestMemory.cpp:2014:process_vm_readv(getpid(), ...)-- not available on macOS.Neither is used anywhere else in
maintoday, so these would be the first ones. Checked with Apple clang 21 (clang++ -std=c++20 -arch x86_64 -c) on the two functions copied as they are:A drop-in for macOS that keeps the same semantics, verified on the same machine for arm64 and x86_64:
(
<mach/mach.h>,<mach/mach_vm.h>). With it, theSpeculativeReadsSupported()probe succeeds, and a read of aPROT_NONEpage, of an unmapped page, and of a range that straddles into aPROT_NONEpage each fails cleanly instead of faulting, which is whatSpeculativeReadRefusedrelies on. If you prefer not to add a macOS branch here, guarding both with__linux__and lettingcopyThroughKernelreturn false elsewhere would just turn the draw-ahead workers off on macOS.Written with AI assistance (Claude Code). I ran the checks above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by mitul72 on 2026-10-15T01:34:08Z.
Thanks, applied both macOS branches as suggested (
pthread_setname_np(name)andmach_vm_read_overwrite) in 15647ffa9. Linux builds and the draw-ahead tests pass; I can't build for macOS here, so a check on your side would be welcome.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-15T02:31:41Z.
Review: COMMENTED
Checked on 15647ffa9 (Apple M2 Max, macOS 27.2, Apple clang 21):
NameThreadandcopyThroughKernelcopied verbatim from this head, with the include block, compile cleanly for arm64 and x86_64. On both, the thread gets its name, theSpeculativeReadsSupported()probe succeeds, and reads of aPROT_NONEpage, an unmapped page and a range straddling intoPROT_NONEreturn false without faulting. Not a full driver build (maindoesn't link on macOS yet), but the two macOS branches look good.Written with AI assistance (Claude Code). I ran the checks above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-15T03:59:29Z.
I measured head 15647ffa9 against its base
ab9a47684in Astro's Playroom on Linux (RTX 5080, heavy in-game scene, three alternating runs of 20 s each,APS5_PROFILE_DRAW=1). Frame rate does not move here: 7.78 / 7.64 / 7.68 FPS with the PR against 7.88 / 7.52 / 7.59 without.The work does leave queue 0, but about as much comes back in the lookup:
Graphics::DrawMemo hits go from 1-3% to 42%, so the entries compiled ahead are being used; capture staying at about 5 us suggests many draws still capture on queue 0. Frame dumps from both builds show the same picture in the scene. Its draw-ahead tests, with the recorder and draw-cache tests (8 in all), pass on NVIDIA, RADV (Ryzen 7800X3D integrated Radeon) and lavapipe.
Imported from boykopovar/AnyPS5. Originally posted by mitul72 on 2026-10-15T04:50:50Z.
Thanks for measuring. 15647ffa9 had dropped the small-snapshot arena in a rebase; it is back in 0eb0d8903, and hit validation got cheaper (the pending-image check now uses the pending list's range index; key/lookup/validate 4.4 -> 3.0 us per draw in Astro Bot). With
APS5_PROFILE_DRAW=1a new[draw-ahead]line shows published, used, compiled and dropped counts. If you can rerun Playroom on the new head, that line (with[draw-cache]) would show why capture still costs ~5 us per draw there; my guess is that queue 0 reaches many draws before their worker compile commits.Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-15T05:22:43Z.
Reran Playroom on 0eb0d8903 against its base
d92a8dad3, same scene and setup, one run each: 8.37 FPS against 7.33, and the frames match where both reach the scene.d92a8dad3Graphics::DrawPer 10 s,
[draw-ahead]reads 243-245k records published, 243-244k used, 231-233k entries compiled ahead, 166-217 jobs dropped.[draw-cache]register key: 243,038 lookups, 83,313 hits, 159,468 partial (state, pixel and programs from the entry).So queue 0 does find nearly every entry; it does not seem to arrive before the compile. About two thirds are partial hits, and those still capture. On main, nearly every register-key miss in this scene differs only in user-data words (per-frame pointers,
APS5_TRACE_DRAW_CACHE), so most of the remaining capture looks like stages whose user words moved after the entry was compiled.Update: with #5656 (8267abd21) stacked on 0eb0d8903, same scene, one run: 12.77 FPS, against 8.37 for 0eb0d8903 alone and 7.57 for
d92a8dad3. The frames match. Register-key hits go to 372k of 373k lookups per 10 s, and capture, recompile and decode on queue 0 drop to 0.1, 0.0 and 0.4 us per draw, soGraphics::Draw(16.2 us) is what is left. In the merge I also applied 5656's user-word mask incompileDrawAhead.Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-15T06:44:47Z.
Review: CHANGES_REQUESTED
agc_draw_snapshotsfails here on NVIDIA (RTX 5080, driver 615.78.08, Linux) at 0eb0d8903, and at every commit of the PR from 1aee516ed on, where it is added:That is
tests/Recorder.cpp:2711: after the CPU rewrites the element with 0x22, the snapshot still holds 0x11.agc_draw_snapshots_no_collect_memopasses, and so does--draw-snapshots-onlywithAPS5_NO_COLLECT_MEMO=1, so the write collect memo seems to hide that CPU write from the snapshot reuse check. On RADV the case is skipped (storage buffer offset alignment 4: misaligned draw snapshots not tested), and on lavapipe too (host imports are compared, not watched: draw snapshot reuse not tested), so CI on llvmpipe would not see it. The linux job on this PR was skipped anyway.If the test is right, a draw can read stale bytes after a CPU write on a GPU with watched host imports, the GPU my Playroom numbers above were measured on.
Imported from boykopovar/AnyPS5. Originally posted by SoRadGaming on 2026-10-15T09:54:22Z.
Windows / AMD results for this head (
0eb0d8903), in the scene from the description: ASTRO BOT (PPSA21564 01.007.000),-lvl hub_crashsite.Host: Windows 11 Pro 26200, Ryzen 7 5800X3D (8 cores, 16 threads, so 4 draw-ahead workers), Radeon RX 9070 XT (AMD proprietary driver 32.0.23033.1002), 32 GB, WinLibs GCC 15.2.0 r7, Release.
Builds.
mainc0be1f69b, plus #6060 (head290be5626, which keeps Windows imports of resident direct memory watched) and #6273.libSceAgcDriversource list inCMakeLists.txt, where both sides add a file.GuestMemory.hppchange rebuilds the libraries that include it.Method. No input, warm shader cache (1,904 hits, 0 misses),
APS5_NO_SNAPSHOT_CHECK=1 APS5_RESOURCE_CACHE_ENTRIES=4096, no profiling switches. FPS is the window's present counter over 120 s, after a 120 s settle onceLevel has started: hub_crashsiteis logged. Runs alternate.So on this machine and scene the gain is larger than on your RX 9060 XT (+43 %) or JJenkx's RX 6650 XT (+54 %). Queue worker 0 is the limit in this scene. In traces of
mainab9a47684+ #6060, it was 99 % busy, with the GPU busy about 150 of 330 ms per frame.Frames. I took GPU frame dumps (
APS5_DUMP_FRAMES, every 100th present) through the hub in both builds. Both show the same sequence: the arrival, the level banner's shape wipe, a cleanCRASH SITEtitle card, then Astro idling. I saw no missing or stale geometry, textures or text in D.No stops or errors in 4 launches with the PR.
One note for anyone combining this with #1201: they do not merge mechanically. Both restructure
Driver::draw, and the queue-0 validation of entries compiled ahead reads guest memory where the pipeline's drain hooks don't look. I kept the two apart.AI-assisted (Claude Code); the builds and runs are on my machine.
Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-15T13:22:40Z.
@mitul72 #6359 corrects the
RunSecondStorewait that your range-list assertions extend. The old predicate can return whileFindPendingdoes not identify the expected live image (#6347).Proposed order: merge #6359 first, then keep your assertions inside its stricter identity gate. I tested that fixture-only compositiona12910c4e: target rebuilt,5/5 fresh-process runs on RTX5080/610.62 and AMD Radeon Graphics/32.0.21036.18, Windows11 Enterprise26200, GCC15.2 Release, shader cache disabled, max0.591s. The four internal watch-transition omissions remain. This does not validate your full production stack.
Your published head and my submission are unchanged. The overlap and exact pins are now in #6359's description. AI-assisted: Codex.
Imported from boykopovar/AnyPS5. Originally posted by mitul72 on 2026-10-15T21:50:46Z.
@fma-rc thanks, reproduced on RADV with
APS5_WRITE_WATCH_IMPORTS=watch. It is a test-order problem, not stale bytes reaching a draw: the failing check takes main's own reuse path (8 KiB input), and the arena test before it left a collect epoch open, so the CPU store in the reuse test was not collected until a new epoch, which is main's documented rule for both paths. The arena test now runs last, and a new ctest (agc_draw_snapshots_watched_imports) runs the reuse test with watched imports so RADV covers it. Rebased onto4eb91eacd; that rebase also fixed compile-ahead against main's lazy shader pages, and the description has fresh numbers on that main.@SoRadGaming thanks for the Windows/RX 9070 XT run and the frame dumps.
@Amoenus our assertions now sit after the
heldLivegate, so this PR and #6359 merge cleanly in either order.Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-15T22:00:55Z.
Review: APPROVED
Rechecked a4a4e2201 on
main5d9dcc42d:agc_draw_snapshotsand the newagc_draw_snapshots_watched_importspass on an RTX 5080, on a Radeon 610M (RADV) and on lavapipe, so the NVIDIA failure from my earlier review is gone. Together with the Playroom numbers from before, that clears what I had against it.Imported from boykopovar/AnyPS5. Originally posted by SP4C3B4R-8 on 2026-10-16T11:42:36Z.
@mitul72 a measurement on Windows with this PR's head (
95ddd71bd, merged ontomain5d9dcc42dtogether with #6763 and #6764), Astro Bot (PPSA21564)-lvl hub_crashsite, RTX 5070 Ti / 7800X3D: thanks to the draw-ahead the frame is now limited by queue 0's committer, andPrepareDrawBindingstakes 7.6 us of its ~34 us per draw, 6 us of it in the snapshot loop (about 7 snapshots per draw).Of 1.1 M slice paths per 10 s, 154 k were epoch-memo hits, 208 k
ReusableDrawSlicehits and 731 k fresh copies; the average slice is 251 bytes. Per slice:CollectWrites0.31 us,ReusableDrawSlice0.09,KeepDrawSlice0.04, but the copy itself (AllocateSnapshot+memcpy) 0.07. So for small slices the collect and the generation memo cost more than copying again.The change below copies a slice of up to 1 KiB directly (no collect, no generation memo), and still notes the epoch memo when the tracker generation is unchanged. With
APS5_VERIFY_DRAW_SNAPSHOTS=1, 1.4 M fast slice answers were checked with 0 differing; the 16 snapshot/slice/draw-input/recorder ctests pass.recordwent 2030 -> 1666 ms per 10 s, and the scene 9.12-9.30 -> 9.42-9.53 fps (two 60 s windows each, no profiling). Since the arena is yours, feel free to take it into this PR if it fits:Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-18T09:06:52Z.
A 007 First Light cross-test lead on Windows: our current integration 8bdc43094f996d1334776dac7dc71ca2092915f7 (base main
e5c2b3c325, #6454a508aa03c+ required public boot/resource fixes) reaches the correctly rendered offline menu. Before #6763, six fully contained periodic trace intervals gave 114 presents / 61.21878 s = 1.86217 FPS at 3840x2160. GPU busy averaged 176.97 ms/present.Shader.DrawStagewas about 177–192 ms/frame andDriver.Draw.shader_compile_and_linkabout 257–310 ms/frame in the nearby menu intervals. Those phases are nested, not additive. No isolated PR speed claim.I am finishing an imported/copied-input A/B first. Your 95ddd71bd8 is a promising next CPU experiment; a read-only merge preview against this stack has 11 conflicts, chiefly the current draw/cache/capture interfaces, lifecycle, VulkanDevice, ShaderResources and Recorder/CMake. I have not forced a partial port or tested it on 007. If you have a newer current-main/shared-table integration, please point me at it; otherwise I can resolve the integration after this A/B while retaining your ownership of the change. The exact current stack is on Scramblrrrr/AnyPS5 branch codex/first-light-oct18-current. Raw title data stays local. AI-assisted: Codex.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-18T11:08:55Z.
WIP integration for your review/cross-test: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-drawahead-oct18 at c774f5f742e8c89d100c8189251baca82d0227fe, merging exact95ddd71bd8 onto our ad3586f18 007 stack. Source conventions pass and tree is clean/pushed, but it is still BUILDING and UNTESTED/UNSTAGED; no title or speed result.
The eleven conflict files are resolved retaining both topics: queue-0 relocation learning and aliases stay; the published plain register key is used only when aliasFirst is false. The new shapeHasOtherEntry probation rule stays in admission alongside existing relocation sightings. insertDrawEntry uses your resolved/present accounting and SameCapturedWords for shared columns. DrawStageVariant now calls Driver::tagVariantRuns rather than flattening the captures; both ordinary and ahead capture populate userDataUse/supplied blocks, retaining the shared-word references and relocation partitions (#6454 + sparse tagging #7508). Capture verification retains our existing relocation-aware content/forwarded-word comparison. Shutdown resets drawAhead before stopping Queue0. New prepared draw/context and arena paths retained, plus main's journal replay start and movedOnly argument. Both sets of tests stay, including copied inputs, pipelined dispatch, table snapshots and the arena.
Please flag any semantic concern in that combination. I have not taken SP4C3B4R-8's additional small-slice proposal; this is your published head's behavior. Preparing focused DrawAhead/Raw/Scan, probation/verify, snapshots, cache/relocation/shared-table, indirect and lifecycle checks before a title run. Runtime remains the tested ad358 modules and no game process is active while building. The current 007 level fault is #6172's streaming class; no claim this PR fixes it. Raw title data stays local. AI-assisted: Codex.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-18T11:14:09Z.
WIP c774f5f742e8c89d100c8189251baca82d0227fe now builds on Windows11Pro26200 / WinLibsGCC15.2 / RTX5070Ti617.42. 85/85 selected controls PASS39.66s, zero skips, ANYPS5_REQUIRE_VULKAN=1. Includes all five DrawAhead/Raw/Scan/verify/small-cache modes, four snapshot modes (including watched imports and no collect memo), shared table/image-table/shader-memory checks, draw-cache relocation/mesh relocation, sparse indirect indices, the new #7476 texel regression and the driver shutdown/wait/preparation/committer/helper/cache-writer cases. The full source-built native test executables were rebuilt against this candidate. Conventions pass, source remains clean/pushed.
Matched patched AgcDriver/Agc/VideoOut modules are now staged in the separate Oct18 runtime; previous tested modules are backed up. Starting 007 with your default draw-ahead behavior, drawcache1024, imported inputs, resourcecache16 and unchanged RAM guards. APS5_SYNC_DRAWS and spanned mode are off. No title/FPS claim yet; the recompiler header change selects a new shader-cache source version, so cold preparation will be excluded from any later menu comparison. No builds/native tests while the title runs. AI-assisted: Codex; raw title data stays local.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-18T11:27:39Z.
Pausing after the current milestone at the user's request. Integration c774f5f742e8c89d100c8189251baca82d0227fe renders the title/offline menu correctly, but shows no FPS gain in this 007 scene. Six fully contained no-input intervals:105presents/61.648018s=1.70322FPS, GPU busy177.406ms/present. Preceding 8e0bd2cc6 menu:121/61.639091s=1.96304FPS, GPU177.998ms/present. This is one moving-menu sample per arm on the public integration stack, not an isolated main comparison or repeated same-binary A/B; the candidate includes my merge adaptations. Startup/cold compilation excluded.
Draw-ahead is actually active: recent10s windows published
8.4k–8.8k records, the queue used8.4k–8.8k, and6.3k–6.5k entries compiled ahead. Cache hits were6.9k–7.1k of~8.4k–8.8klookups, but this does not translate into a faster frame here. A bounded350-PC sample AFTER the measurement found40in the driver/267in ntdll;13driver samples were in ResolveImageTables' fill loop. This is a wall-PC sample, not exact CPU attribution or proof of contention. GPU time is similar; next work should distinguish worker overhead and resolution reuse, rather than call the cache-hit rate a speed result.85/85nativecontrolsPASS39.66s, zero skips as above. Owned stop11:26:41.146UTC, exit-1record11:26:41.294UTC, not a crash/guard. Peak sampled private24.67GiB/minfree3.96GiB, one bounded trim. Resume/gameplay NOT attempted on this candidate; #6172 remains unresolved. Same budgets/settings otherwise, no title/time patch. Source clean/pushed; old tested source/modules retained. Raw title data stays local. AI-assisted: Codex.
Official trace_digest outputs follow; raw traces remain local.
Baseline8e0bd2cc6:
6 intervals, 257.4 to 319.1 s, 121 presents
NVIDIA GeForce RTX 5070 Ti, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit 8e0bd2cc640e
Candidatec774f5f74:
6 intervals, 307.7 to 369.4 s, 105 presents
NVIDIA GeForce RTX 5070 Ti, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit c774f5f742e8
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-18T17:03:49Z.
Review: CHANGES_REQUESTED
This PR now conflicts with
mainin ten files, and the conflicts are in logic, not adjacency:core/libs/prx/libSceAgcDriver/CMakeLists.txtExecution/include/Driver/Driver.hpp,Execution/include/VulkanDevice.hpp,Execution/src/VulkanDevice.cppExecution/src/Driver/Draw/Draw.cpp,DrawCache.cpp,DrawCapture.cpp,Execution/src/Driver/Lifecycle.cppGraphics/src/ShaderResources.cpptests/Recorder.cppThe change adds worker threads, speculative guest reads and a probation list in the draw cache, so a rebase done by someone else would be guesswork. Please rebase onto current
main, then rerun theDrawAhead*andagc_draw_snapshots*tests and the Astro Bot comparison on the new base, since the draw cache changed under you. The full Build will run on the rebased head when it is queued.Imported from boykopovar/AnyPS5. Originally posted by SoRadGaming on 2026-10-19T03:10:31Z.
Draw keys in ASTRO BOT change every frame, so draw-ahead compiles every draw every frame
Measured on main
a62c724c3with this PR at 95ddd71bd (plus #6273 #6266 #6505 #6503 #6617 #6609 #6566 #6292 #6615 and some local experiments, all switched off for these counters), ASTRO BOT (PPSA21564) Crash Site hub, Windows 11, Ryzen 7 5800X3D, RX 9070 XT, Adrenalin 26.8.1. Counters per 10 s of the hub (~83 frames, ~3,000 draws per frame):[draw-ahead]: 182,092 draw records published, 181,043 used by the queue, 172,175 entries compiled ahead, 1,049 jobs dropped. That is every draw, every frame.[draw-cache]: 181,315 lookups, 178,186 hits, 174,192 inserts, 8,192 entries, about 150k evictions per 10 s. WithAPS5_DRAW_CACHE_ENTRIES=32768the cache fills to 46,072 entries at the same insert rate, so this is not a capacity problem.APS5_TRACE_DRAW_CACHE=1: of the register-key misses, 161-173k per 10 s changed in user data, ~12k in stable registers, ~2.5k in auxiliary registers, 0 in the device and ~0 in the shader set. The user SGPR words (per-frame ring-buffer pointers, by the look of it) are mixed into the exact key raw, so a draw's key is new each frame.findDrawRecipecalls find the entry without records, because the entry is the one compiled ahead for this frame's key. Prepared draws are in the same position.Main's draw relocation (#4943) is meant for moving user words, but in this run it never reported (
[draw-relocate]only prints after 100,000 alias lookups with relocated patches, so its absence does not say why). It learns in the queue-0 miss branch, which draw-ahead makes rare; with draw-ahead disabled locally it still did not engage, so there is more to it than that.A key that leaves out user words whose content the stage variants already validate (or an alias like #4943's that draw-ahead also consults) would let the cache, recipes and prepared draws survive across frames for titles like this one. Happy to run any counters or a branch on this title.
Written with AI assistance (Claude); measured on the machine above.
Imported from boykopovar/AnyPS5. Originally posted by mitul72 on 2026-10-20T18:02:16Z.
Thanks everyone for the measurements and cross-tests, and @adriadam10 for the review. I've been a little busy lately, but I'll work on this today: rebase onto current
main, resolve the conflicts you listed, and go through the comments.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T01:23:21Z.
This pull request is labeled
perf, so it needs the summary line of a capture onmainand one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste bothaps5-summary.jsonllines, attach the two traces and add the output oftools/trace_digest.py.Imported from boykopovar/AnyPS5. Originally posted by mitul72 on 2026-10-21T01:23:23Z.
@adriadam10 Rebased onto
maind97361bd0and went through the conflicts myself. Notes on the result:3518eb8de) now does the same job, soSnapshotArenaand itsagc_draw_snapshots*tests are gone.CaptureInvocation/tagVariantRuns. Depth remap and user-data masks are handled. Lists with invalid indirect registers stop the scan. Under speculation, the table memo returns no stamp, so workers fall back to comparing.admitDrawKeyadmits the key. The old probation list is gone. Inserts went from ~237k to ~4k per 10 s on Astro Bot, which matchesmain.verify()can copy guest bytes.Tests: the
DrawAhead*tests pass 30 repeats under-j8. Of theagctests, 836/839 pass. The three failures (guest_memory_lifetime,image_array_window_past_layer_limit,tessellation) fail the same way on plainmainhere (RX 9060 XT, RADV).Astro Bot hub, one run each:
maind97361bd0The CPU saving per draw holds, but there's no fps change: on current
mainthis scene is GPU-bound (GPU busy ~66 ms of an ~85 ms frame). @SoRadGaming's per-frame keys are real. The user SGPRs carry buffer and texture descriptors whose contents change every frame, so relocation can't match them, and fixing that needs recompiler analysis of which descriptor fields only affect bindings. That would be a separate PR. Up to you whether the CPU saving alone is worth the complexity.Thanks @SP4C3B4R-8 for the small-slice patch. The arena it touched is gone after the rebase, so it would need porting to main's upload chunk as a separate change.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-23T13:19:38Z.
Review: CHANGES_REQUESTED
Thanks for the rebase and for dropping the arena and the probation list.
mainhas moved again and the PR conflicts with it in logic, not adjacency (git merge-treeagainst currentmain):Execution/include/Driver/Draw/DrawCache.hpp,DrawPipeline.hpp,Execution/include/Driver/Driver.hppExecution/src/Driver/Draw/Draw.cpp,DrawCache.cpp,DrawCapture.cpp,DrawPipeline.cpp,DrawPrecheck.cpp,Execution/src/Driver/Lifecycle.cppGraphics/src/Draw.cpp,Texture.cpp,UnitShadow.cppWith worker threads and speculative guest reads involved, please resolve these yourself and rerun the
DrawAhead*tests on the new base.Two more points before this can merge:
perflabel, and the numbers so far are one run in a table. Please paste theaps5-summary.jsonllines ofmainand of the change from the same title, scene and machine, and thetools/trace_digest.pyoutput, as the label bot asks.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T02:58:37Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected draw-ahead paths show no verified blocking defect, but the review is incomplete because not all changed files were read and no checks were run.
What I ran
Reviewed head
aa699de9126da33d654d20c27553138549269546using the prepared diff and pinned repository reader. No build or tests were run.Results
Findings
Blocking
None verified in the code inspected.
Non-blocking
None.
Not verified
The review folder listed 36 changed files. I read the description, commits, manifest, and portions of the diff, and inspected targeted code around draw scanning, speculative reads, cache admission, and prepared draw state. I did not read every changed file or every changed hunk.
core/libs/prx/libSceAgcDriver/tests/Recorder.cppwas excluded from the review folder; I did not inspect it through the reader. Build and test results reported in the PR description were not independently verified.To get this to a good state
Nothing is required. Optional: complete review of the remaining changed code and run the relevant build and tests before making a formal approval decision.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.