perf(agc-driver): join a buffer bound from inside a range across the ranges it crosses #5372
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5372"
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 TideOPL on 2026-10-13T18:15:32Z.
A buffer bound from inside one registered range into the next is now joined with the ranges it crosses, when the run fits the 8 MiB import window.
maincopies it on the CPU for every bind.What
Since #9652,
mainjoins a buffer bound from the start of a range across adjacent ranges, at any size. That covers the case this PR was first written for (Minecraft Dungeons II binds from a piece's start), so the PR now carries only whatmainstill copies: a binding that starts inside a range. Stellar Blade, Stray and 007 First Light bind such buffers every frame; the numbers are in the comments below and summarised under Tested.The branch is merged with
main16345cad6a(795a53db6b). The code is @embersas's adaptation from the thread, unchanged:joinedRunalso returns the crossed run when it is no larger than the window:if (begin == run.base || run.bytes <= window) return run;.importJoinedwidens the binding to any import it starts or ends in, not only joined ones, so binds across an import and its neighbour merge into one import instead of retiring each other.mainadmits stays admitted. Otherwise the buffer is copied and no import is retired. This closes the bypass @embersas found on the previous head, where widening to the imports at both ends of a 12.5 MiB binding made it look exact and joined 16 MiB under an 8 MiB window.main(2,980 characters); this adds 121.Tested
Windows 11, Ryzen 7 7800X3D, RTX 5070 (NVIDIA 610.88), WinLibs GCC 15.2, Release.
importJoinTests(agc_driver_graphics). It binds 32 bytes from 16 bytes before the end of one 64 KiB piece into the next and requires one import over both, with nothing copied. Withmain'sGuestBufferMemory.cppit fails witha buffer bound from inside one piece into the next, both no larger than the import window, was not imported over both pieces. The test also checks that the following prefix bind uses the same import.agc_driver_host_import_join_window(execution test, @embersas's, adapted tomain's prefix rule). Four adjacent 4 MiB pieces, the first and last imported:mainan eligible large binding over four pieces was copied)Suites.
ctest -R "^agc_driver|^guest_memory|^guest_allocations"on this head: 828 of 828 pass, 8 skipped (as onmain).Conventions.
tools/check_conventions.pyreports only the debt-length warning above.Minecraft Dungeons II (PPSA16064), Squid Coast spawn,
mainvs this PR.main16345cad6a: one as is, one with this PR'sGuestBufferMemory.cppchange. Both carry three local patches: a window-placement switch; a trigger that opens the trace window at the gameplay HUD; andlibSceHttp2as ofmaine25333e39. Currentmainaborts MCD2's boot withsceHttp2SetRedirectCallback not implementedand thensceHttp2SendRequestAsync not implemented; #11575 implements the first.APS5_TRACE_SECONDS=25:15withAPS5_TRACE_EVENTS=1048576. Warm-up boot per side, then interleaved runs.mainalready joins. The twomainruns differ by 36 ms p50, so the pair only shows the profiles match:Driver.Packet/memory_wait/Graphics.Drawms/framemain1main2Summary lines (
main2, this PR 2)tools/trace_digest.pyon both traces gives the same largest slices within 2 % (Driver.Packet259.8 / 263.2,memory_wait85.7 / 87.9,Graphics.Draw60.9 / 62.0,Driver.Packet.dispatch57.9 / 57.5 ms per frame). The traces are not attached; I can share them on request.Titles that bind from inside a range (other testers, details in the comments):
mainbb04a4f1ea, A/B/B/A. Frame p50 was 610 / 608 ms onmainand 451 / 505 ms with the change. Their baseline failed the new interior-join test, as it should.maine90a1d180. Over 90 s,Resources.Completewent from 7.69 to 0.70 s,Recorder.Syncfrom 9.21 to 5.08 s andVulkan.Dispatch.shader_resourcesfrom 8.15 to 1.84 s. Presents didn't change (563 vs 559): queue 0 is draw-bound there.mainand 273 MiB with the change. Mean presents per 10 s went from 20.1 to 24.5, andUploadFinishwrite-back waits went from 230–254 per 10 s to 0.Not run.
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation): the layer isn't installed on this machine.main.Earlier results, against
mainbefore #9652These measured earlier heads, when this PR also joined bindings from a range's start;
mainnow does that itself.main77b9f7270plus the open PRs MCD2 needed: frame p50 92–97 ms with the change, against 100–131 ms in runs that hit the slow mode. In that mode one 1.4–1.5 MiB buffer was copied about 40,000 times in 25 s.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)Imported from boykopovar/AnyPS5. Originally posted by Nesyth on 2026-10-13T20:54:34Z.
Same bug in a second title: Ready or Not (PPSA18605, UE5), Windows 11, RX 7900 XTX.
The case. A 768 KiB buffer the title binds on nearly every draw starts at a 640 KiB registered range and runs 128 KiB into the next one, a 256 KiB range (
0x3290df0000+0xc0000over0xa0000 | 0x40000in one session). Both lie in one 8 MiB window that is only partly registered, sojoinedRunrefuses the bind. Where the buffer lands changes from launch to launch; it straddled in 9 of my last 12 sessions.What it costs, scene, 30 s profile windows, my bring-up build (
main0214069e3+ #4515 + #4517 + other local changes):With this PR (2 sessions, driver built from your head):
0x3245dc0000+0x280000over0x210000 | 0x1f0000), about 2.7 GB per session. So the broader rule pays off here.One question. Joins here have no size bound, and a join is re-imported whole each time a bound buffer crosses into a new piece. The host-import debt entry says the 8 MiB window was introduced because runs re-imported on every growth made the NVIDIA driver (610.57.04, 615.78.08) refuse imports or lose the device. Ready or Not's joins stay under 3 MiB, so it doesn't exercise that. Has this run on NVIDIA with a title that grows a heap in pieces? If a cap turns out to be needed, the window-bounded check is one line in
joinedRun, and I can share it with its tests.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T05:20:09Z.
The full build of this merged with current
mainfailsagc_driver_graphicson Linux and Windows at the new check inBdaResources.cpp:312:a bind into a piece registered after the joined pieces did not grow their import. Please rebase and look at it with #290 in. Also, Nesyth's question is still open: with no size bound, has this run on NVIDIA with a title that grows a heap in pieces?Imported from boykopovar/AnyPS5. Originally posted by TideOPL on 2026-10-14T10:54:21Z.
@oneandonlydean thanks, reproduced. With #290 in, a new piece that completes a window is imported as that window, which isn't a joined import, so
importJoineddidn't widen over it: a bind across the older boundary joined pieces 1–2 and retired the window, the next bind across 2–3 imported the window again, and so on, with a fresh import on every alternating bind. Rebased onmain0b6d033b8and added a commit (eb0e2e6c2): the join now widens over any import the bound buffer starts or ends in, and falls back to the crossed ranges when that wider join can't be made. The test now requires the binds to settle on one import across both boundaries. Fullctestpasses 1133/1133 on Windows; Linux not run.@Nesyth on NVIDIA: tested only on an RTX 5070 (driver 610.88, Windows 11). In MCD2 there were no import failures or device loss, with joins up to about 16 MiB. Not tested: Linux NVIDIA, and a title that grows a heap in many small pieces under bound buffers, which is the case that made the 8 MiB window necessary. If you can share the window-bounded cap and its tests, I'm happy to take it into this PR so a join never outgrows the window.
Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-14T17:40:32Z.
Kena: Bridge of Spirits (PPSA01802) hits the same case. Tested on Linux (Arch, kernel 7.2.9), RX 9070 XT (RADV, Mesa 26.2.4), with the three commits cherry-picked onto a local Kena stack (main from 2026-10-14 plus unmerged GPU PRs and stand-ins Kena needs to reach gameplay; plain main does not reach the title scene, so this is not a plain-main capture).
Same save, 120 s runs,
APS5_PROFILE_DRAW=1, last[buffers] ... completed CPU-copy operationsline of each run:Example lines from one run each:
In the slow windows the builds that copied cost 380 to 880 µs each (
[draws] ... build 883 (1242)), against 37 to 39 µs with the PR, andguest readin[buffers]went from 2.7 to 3.7 s per 10 s to 7 to 272 ms. Gameplay windows went from about 90 to 115 to 150 to 178 presents per 10 s together with other local changes; the copies were the largest single part of it. No GPU resets in any run.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T18:02:10Z.
Thanks for the rebase. The
agc_driver_graphicsfailure is gone with the third range registered writable, so the V# again crosses two imports that stay apart. Two things are still open:importJoinedstill retries with the crossed ranges when the wider join gives no run (if (run.ranges.empty() && (from != begin || to != end)) run = joinedRun(lease, begin, end);). That is a fallback. Please choose the run before importing (the wider one when it can be joined, otherwise say which case takes the crossed ranges and why) and let a failed join stay a failure.joinedRunno longer has any size bound, and the debt entry now says a heap grown in pieces under bound buffers is re-imported once per piece. That is the pattern that made NVIDIA (610.57.04, 615.78.08) refuse imports or lose the device, and it has not been run. Please keep the join within the import window (or a stated cap), or show a run of a title that grows a heap in pieces on NVIDIA without import failures.Imported from boykopovar/AnyPS5. Originally posted by TideOPL on 2026-10-14T18:29:30Z.
@oneandonlydean thanks, both done in 68f7a2589 (rebased on
main32e810db4):importJoinedwidens over the imports the bound buffer starts or ends in and joins that run, or fails. There is no second try with the crossed ranges: when the widened run can't be joined, the buffer is copied and the imports it would have retired are kept, so a failed join can't retire a window import that the next bind would re-import.joinedRunkeeps #4517's two rules as they were (runs of ranges each larger than the window, and a buffer bound exactly over its ranges) and otherwise joins only runs no larger than the import window (8 MiB). A heap grown in small pieces under bound buffers is therefore re-imported at most once per piece until its run reaches the window, and copied past it, the same bound the window gives today. The debt entry says so. The cases in this PR stay inside it: MCD2's binds join under 2 MiB, Ready or Not's under 3 MiB.a bind across a grown heap joined more than the import window or retired the newer import) and passes here. Fullctestpasses 1209/1209 on Windows; Linux not run.Imported from boykopovar/AnyPS5. Originally posted by TideOPL on 2026-10-14T18:29:32Z.
@alfalfa-star thank you for the Kena runs, that's the first RADV result for this and a third title with the same straddle. I've added it to the description. One note: since your run, the join is capped at the 8 MiB import window (68f7a2589, from the review above), so a Kena join larger than that would be copied again. If you get a chance to rerun with the current head, it would show whether any of Kena's joins hit the cap.
Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-15T06:51:39Z.
@TideOPL I reran Kena: Bridge of Spirits (PPSA01802) with the current head. No join hit the 8 MiB cap.
Setup as before: Linux (Arch, kernel 7.2.9), RX 9070 XT (RADV, Mesa 26.2.4), my local Kena stack (main from 2026-10-14 plus unmerged GPU PRs and stand-ins; plain
maindoes not reach the title scene). On that stack I added 68f7a2589 on top of the earlier three commits; the join code (joinedRun,importJoined) now matches the PR head. The control is the same stack with the previous head (9c64e198a). Runs alternated, all from the same save, 120 s each,APS5_PROFILE_DRAW=1. Copies are from the last[buffers] ... completed CPU-copy operationsline.One current-head run (run 3) aborted during loading. RADV printed
radv/amdgpu: Not enough memory for command submission.and the nextvkQueueSubmitreturnedVK_ERROR_DEVICE_LOST. I haven't seen that in any earlier Kena run, but one occurrence in three runs isn't enough to tie it to this change, and the other current-head runs were clean. Update: twenty minutes later the same kernel error (amdgpu: Not enough memory for command submission!) stopped RIDE 4 (PPSA01599) onmainplus #5781, a build without this PR. So the abort isn't caused by this change; it looks like a system-side condition on my machine today. It never appeared in yesterday's runs.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-15T23:56:44Z.
Gameplay A/B on Minecraft Dungeons II (PPSA16064 01.100.100), RTX 5070 Laptop 8 GB, Ryzen AI 9 365, NVIDIA 617.42, Windows 11, on AC. Base =
main636b1b93c+ lab diagnostics + the world-load fix of #6308 (as a lab switch, on for both sides; without it the world load aborts here), PR = the same + this PR's heade5390612f, both built on our fork CI. Both start from a save inside the first world ("Escape from Squid Coast") and walk for 180 s with the HUD up (scripted pad input,APS5_NO_PAD_INPUT=1), storage budget forced to 3072 MiB on both sides. Separate run directories keep each side's caches warm; one cold row per side first, then alternating warm rows. Means over the 10 s windows of the walk:copyper presentBase 4.49 FPS against 6.21 with this PR (+38 %; per pair +27 % and +52 %). The idle time per frame falls by 40 to 45 ms, and the PR rows never showed the slow
copyphases (the same bytes at 34 to 44 ms per present) that one base row here and two base rows of an earlier job had. At the title screen of the same game parl0v measured no change with this PR (working group AlxcBTW/AnyPS5#56); that fits, since the title makes no new imports after loading. Not checked: other titles, other scenes of this one, the test target.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-16T15:40:20Z.
@TideOPL a second machine for the gameplay side, with a caveat on how clean it is: RTX 4060 8 GB (NVIDIA 617.42), i5-14400F, Windows 10, Minecraft Dungeons II (PPSA16064 01.100.100), first world load from a save without a character + 120 s scripted walk,
APS5_TEXTURE_CACHE_MIB=3072, #4472 in both arms (on and off rows pooled here). The two arms ran as consecutive batches, not interleaved, and the second also has #6490 (worth about 5 % at the title on this card):main5d9dcc42d+ #6308 + #4472main5d9dcc42d+ #6308 + this PR + #6490 + #4472Without this PR the walk mostly sat at 1.4-1.8 FPS; with it 3.1-4.1. #6490 can't account for that size of gap, so it points the same way as AlxcBTW's interleaved rows on the 5070 Laptop.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-16T18:30:56Z.
007 PPSA11386 Windows cross-test lead (RTX5070Ti617.42, main93e54cedd plus title/shared-table stack): the dominant repeated CPU-copied bound buffer is 12.5MiB, starts inside a2MiB registration and crosses adjacent2MiB registrations. On the current stack ~79GiB had already been copied from its bucket by9,000 total CPU-copy operations during boot. I initially misclassified it as one owner due to a diagnostic bug; allocation bounds corrected that. No raw title bytes or requests attached.
Your current e5390612f has the right cross-registration mechanism, but its8MiB cap will still reject this span (end falls inside the final registration). SleglJan reports much lower Linux copy counts with an uncapped local version plus12GiBimports, but those are confounded stacks/settings. Do you have a current bounded larger-window experiment or advice for a16MiB join cross-test? I will preserve the existing cap/held-import tests and not propose an unconditional uncapped copy. #6457 addresses adjacent aligned blocks but retains the window bound as far as I can see. Current4GiB import budget is also a possible constraint here, so no FPS attribution yet. AI-assisted: Codex.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-16T18:35:58Z.
Prepared bounded cross-test branch https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-joined-window16-current at c70803a19 (mainf26eb67c8 + our public007/shared-table stack + your exact e5390612f). APS5_TEST_IMPORT_WINDOW_16M=1 opts into16MiB; otherwise your8MiB/default remains. This is a lab experiment, no new upstream join PR.
Added public synthetic case: one12.5MiB bound view starts inside seven adjacent2MiB registrations (14MiB total, not a full16MiB window). It must copy under8MiB and bind an import with zero copied bytes under16MiB. Removing only
if (run.bytes <= window) return run;makes this unchanged fixture fail at the12.5MiB assertion (0.48s). Restored/rebuilt36selectednativechecksPASS16.70s, noskips, Windows11/RTX5070Ti617.42,16MiBflag and opt-in copy sampler on; existing grown/alternating-boundary8MiB cap and lifetime checks retained. Title run starting with same4GiBimportbudget/guards. No title performance conclusion yet. AI-assisted: Codex.Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-16T18:43:20Z.
Title follow-up for c70803a19 + opt-in16MiB window: correct offline menu144presents/79.914s=1.80194FPS versus preceding1.06878FPS (single moving-menu samples; combined experiment, not isolated PR/alternating A/B). At34000uploads guest read693ms vs12784ms and allocation51ms vs3769ms; repeated dominant12.5MiB copied span no longer appears in the bounded sampler. The window flag does not bound the existing exact-cover/large-range join exceptions; larger joined imports are still present. Details and qualifications: https://github.com/boykopovar/AnyPS5/discussions/5714#discussioncomment-18980803 . User requested a break, so owned stop after menu measurement, no Resume/level test. 36native checks remain green. No new upstream join PR, no title patch/time scaling, no raw title data uploaded. AI-assisted: Codex.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-16T23:29:26Z.
The 8 MiB bound is what I asked for on the 14th, and I'd keep it in this PR: it's the case MCD2, Ready or Not and Kena were measured under, and it holds on the NVIDIA drivers that refused imports before. Scramblrrrr's 007 case (a 12.5 MiB bound buffer across adjacent 2 MiB registrations) misses it, and their opt-in 16 MiB lab window removed that copy. That's a combined stack, though, not an isolated A/B. I'd take a larger window as a follow-up PR on top of this one, with the run I asked for on the 14th at the new size: a title that grows a heap in pieces on NVIDIA, without import failures or device loss.
Imported from boykopovar/AnyPS5. Originally posted by TideOPL on 2026-10-17T00:02:51Z.
Thanks @AlxcBTW and @parl0v. Two more machines with the same direction: the interleaved MCD2 rows on the 5070 Laptop (4.49 → 6.21 FPS, the slow
copyphases gone) and the walk on the 4060 (about 1.95 → 3.65 FPS). It's good to see it reproduce outside our setup.@oneandonlydean agreed: this PR keeps the 8 MiB window. That's the bound the MCD2, Ready or Not and Kena numbers were measured under, and the one that held on the NVIDIA drivers that refused larger imports.
@Scramblrrrr thanks for the 007 case and the synthetic 12.5 MiB fixture. I'll take a larger window up as a follow-up PR on top of this one. It needs the run Dean asked for: a title that grows a heap in pieces on NVIDIA, with no import failures or device loss.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T00:41:54Z.
Agreed: 8 MiB stays here, and the larger window follows as its own PR with @Scramblrrrr's 12.5 MiB fixture and the NVIDIA run at the new size. The 5070 Laptop and 4060 rows are noted.
Imported from boykopovar/AnyPS5. Originally posted by teepean on 2026-10-17T10:07:26Z.
@TideOPL a data point for the larger-window follow-up: Stray (PPSA02100) hits this race on current
main(6a32550fd+ #6814), and its run is 13.6 MiB, so the 8 MiB bound here leaves it out (going by the code; I haven't run this head on Stray).What a slow run copies. A small counter in
copyRegion, plus a line naming the registered ranges each CPU-copied region of 1 MiB or more overlaps, showed every large copied region as a buffer bound from the start of one registered piece to inside the next, with the same access:0x205fba0000+0x900000(slow run)0x870000 + 0x5200000x2004590000+0x7f80000x4e0000 + 0x3200000x2024d00000+0x1fe0000x110000 + 0xf00000x2024300000+0x1fe0000x110000 + 0xe0000 + 0x10000The slow runs (3 of 10 in fixed-length batches) are the ones in which the 9 MiB buffer straddles a piece boundary: about 1,000 draws per frame copy it, about 90 GB per 10 s, and the frame rate falls from ~5.7 to ~1 FPS for the rest of the run. Its pieces add up to 13.6 MiB and only the first is larger than the window, so neither #4517's rules nor
run.bytes <= windowjoin it; a 16 MiB window would.A run with that join on NVIDIA. As a lab test,
joinedRunjoining when the binding starts at the first crossed piece, uncapped (if (begin == run.base) return run;in place of the exact-match line), on the same tree. Alternating runs, stock engine.ini, DeadCity start, frame p50 from the official trace:main+ #6814Six more runs with it had no slow run either, and CPU copies fell to ~55 MiB per 10 s (~5.5 GB in normal runs without it). In those 12 runs (Linux, RTX 3090, NVIDIA 615.78.08): no
host import ... failedline, no device loss, no Xid. I'm not proposing it uncapped; it's the Stray side of the case for the follow-up.One more data point, from Stray runs on
mainof 2026-10-15 with an older head of this PR: the world froze after the opening cutscene in about half the runs (never without the PR), andAPS5_STORE_AT_FLIP=1avoided it. The runs above load a save past that cutscene, so they don't tell whether either version still does that.AI-assisted: yes (analysis and text written with Claude Code; the runs are from my machine).
Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-17T17:37:05Z.
007 First Light (PPSA11386 v01.018.000), main menu, on
mainbc3c0fc13plus four open shader PRs: #5372 and #6454 together cut the frame p50 from 2081 to 442 ms. That's 4.7×, from one sample of the pair. #5372 alone takes 582 ms off, #6454 alone 868 ms, and the two together 1640 ms. The same text is on #5372 and #6454.Setup:
mainbc3c0fc13(2026-10-16) plus four open shader PRs 007 needs onmain(#5799, #6317, #6332, #6881).1752c4a89, #6918955e7c3c7, #6471726ef5f9a, #6440 cdb140f49.ResourceMaterializerandShaderMemory.cppside of Scramblrrrr's 817a9fda4. #6340, which 817a9fda4 also merges, is not in E.APS5_PAD_INPUT_FILE, starting from an existing save.main's defaults plusAPS5_PROFILE_DRAW=1(for the[buffers]counters),APS5_TRACE_EVENTS=2097152andSDL_VIDEODRIVER=x11. Each arm runs from its own warm shader cache, made by a warm-up run on the same build.APS5_TRACE_SECONDS=1320:180, i.e. 180 s in the main menu. Every sample reaches the menu before the window opens, from about 50 s before it (A1) to 16 min before (E).Main menu, frame p50 per sample:
Driver.Packetper present. No effect was measured for #6918 alone on this base.Queue worker 0, ms per present, one sample each (A2 / B1 / C1 / F1 / E2). The rows nest: draw and dispatch are inside
Driver.Packet, and capture is inside them.Driver.PacketResources.Complete(all threads)draw_enqueued(all threads)[buffers]per present:How the two interact. This is our reading of these counters; the parts were not tested apart.
Resources.Completeto 55 ms, and the committer's time per commit from 1.37 ms (A2) to 0.22 ms. Capture stays at ~1190 ms.draw_enqueued(72 → 524 ms).draw_enqueuedis 81 ms. That fits the pair beating the sum: each PR removes the limit the other one leaves.Driver.Packetdifference (432 vs 355). F lacks #6918, #6471 and #6440, and capture is the path #6440 changes. But C1 captures in 115 ms on the same #6454 code without #6440, so these runs don't pin the 75 ms on any of the three.Not covered:
main.agc_shader_memory_tests: #6881's new test doesn't compile against #6454's snapshot layout (noted on #6881). Their ctest otherwise passes like the base.agc_driver_store_over_untrackedfails on every arm, base included, at "the result did not reach a block the CPU left alone", the Linux failure reported on #5671. #6359 and #6385, merged afterbc3c0fc13, change that test.main4186f06a9plus local changes) and frames 215-260, so they don't compare with these.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-18T14:55:08Z.
007 First Light (PPSA11386 v01.018.000), main menu, measured again on
main1b0c7cfa0(2026-10-18). Since my earlier comment, #6243, #6537 and #6455 have merged; all three were part of #6454's head. On this base:The same text is on #5372 and #6454. There is a note on #5372's conflict with
mainat the end.Setup:
main1b0c7cfa0plus a local commit that logs the window-title FPS:a508aa03c, plus a two-line test adaptation of #6881's fixture to #6454's shared columns (tests only). That adaptation is the same change as Scramblrrrr's 913b93635, which #6454 now carries as209f3ce87. Againstmain, #6454's current head790fe1818differs froma508aa03conly by those two test lines and five rows indocs/dev/ENVIRONMENT.md, so F has its code.ShaderResources. In E it keeps #6454'sSetAllocationfields, and fills their variable count on the two pooled-pool returns instead of adding its own field. The other conflicts on this base (#6317, #6881, #6868) are in docs and tests only.APS5_PAD_INPUT_FILE, from an existing save.main's defaults plusAPS5_PROFILE_DRAW=1,APS5_TRACE_EVENTS=2097152andSDL_VIDEODRIVER=x11. Each arm runs from its own warm shader cache, made by a warm-up run on the same build; all warm-ups started from one common cache.APS5_TRACE_SECONDS=1320:180, 180 s. Every sample is in the menu before the window opens, from about 8.5 min before it (A) to 16.5 min (E).Driver.Packetms/present[buffers]on the CPU: A copies guest memory on the CPU, all outside imports: about 496 copies and 5.7 GiB per present. B, F and E print no CPU-copy line. That line comes every 1,000 copies, so they made fewer than 1,000 in the whole run.[buffers]on the GPU, copies out of imports, regions and MiB per present: A 34.5/34.3 and 19.2/19.1, B 42.7 and 31.0, F 44.1/43.5 and 32.0/31.5, E 42.5 and 30.8.Driver.Packet.dispatch388/387 → 94 → 78/76 → 61;Shader.DrawStage.capture_resources248/244 → 300 → 97/156 → 85;shader_compile_and_link391/401 → 420 → 216/279 → 205.capture_resourcesruns inside it.draw_enqueuedandshader_compile_and_linkfrom one sample to the other: 140/82 and 216/279, of whichcapture_resourcesis 97/156.Driver.Drawstays at 361/365, and the p50s agree within 1.7 ms.Against my earlier comment, on
mainbc3c0fc13with the same four PRs and harness:main.1752c4a89) was 442 ms there and 456 ms here.#5372 and current
main: they conflict inimportJoined. #7061 replacedfindImportwithpeekImporton the two lines where this PR drops&& low->joinedand&& high->joined. Arms B, F and E usemain'speekImportwithout thejoinedcondition:if (const auto* low = peekImport(state, begin, begin + 1); low != nullptr) begin = low->base;, and the same forhigh. ThejoinedRunline,tests/BdaResources.cppand the debt line merge without a conflict.Not covered:
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T09:25:33Z.
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 moong15 on 2026-10-20T02:54:12Z.
Stellar Blade, playable area, RX 9070 XT (AMD 26.8.1, Windows), 3840x2160. One main-vs-change pair,
APS5_TRACE_SECONDS=400:90, same machine and scene, warm shader cache.The change side is this PR's join logic ported onto
maine90a1d180, not the PR head: the head's power-of-two block imports are not on that base. The port isjoinedRunreturning the crossed run when it is at most the window, plusimportJoinedwidening over any import the buffer starts or ends in.The joins fire. In queue 0, over the same 90 s window:
e90a1d180Resources.CompleteRecorder.SyncVulkan.Dispatch.shader_resourcesDriver.Packet.dispatchBefore the change, about 11.5k dispatches per 90 s missed the resource cache, synced and copied a 1–2.5 MiB buffer that started in one registered piece and ended in the next. Older profiled runs show these copies with the reason "window incomplete".
Frame rate does not move on this title: 563 presents (6.26 fps) on main, 559 (6.21 fps) with the change. GPU busy is 84.9 vs 84.7 ms per present. Queue 0 stays about 98% busy in both runs, because its draw packets took the time back (
Driver.Packet.draw33.4 → 39.5 s, on 5% more draws per present in that window). Stellar Blade is draw-bound on queue 0, so this removes about 6 s of dispatch CPU per 90 s without raising fps here.Focused tests with
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, run on main and on the change on the same machine: identical results and noVUID-errors.agc_driver_bda_devicesegfaults at startup on main as well on this Windows build, so the BdaResources tests were not exercised here.Traces (about 40 MB each) are available if useful.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T03:21:57Z.
The numbers show the join doing its job on a Windows AMD device:
Resources.Complete7.69 → 0.70 s,Recorder.Sync9.21 → 5.08 s andVulkan.Dispatch.shader_resources8.15 → 1.84 s per 90 s, with presents unchanged (563 vs 559) because queue 0 is draw-bound. A main/change pair on the same machine, scene and warm cache is what makes that usable.One scope note for the record: the change side is the join logic ported onto
maine90a1d180, not this head, since the head's power-of-two block imports aren't on that base. So this is evidence for the join; the head itself still stands on its own test and gate runs.Imported from boykopovar/AnyPS5. Originally posted by VicRaster on 2026-10-20T08:18:29Z.
I found a way for the widened join to bypass the agreed 8 MiB partial-join cap on head
0ccc15d0af9afcfe906b539d8f404cbc40f743df.The synthetic case registers four adjacent 4 MiB pieces, imports the first and last, then binds 12.5 MiB starting at the first piece. The binding ends inside the fourth piece.
importJoinedwidens its bounds to those imports;joinedRunthen treats the widened request as exact and joins all 16 MiB, even with an 8 MiB window.A five-line correction retains the original binding bounds and checks the final widened run. The exact-whole-run exception requires the original binding to cover that final run; the exception for ranges each larger than the window is preserved. A rejected widened join does not retry a smaller run or retire the existing imports.
I independently rebuilt and ran the final synthetic test directly against this exact PR head, then against the standalone correction based solely on that head. This comparison does not depend on the earlier current-main integration:
0ccc15d0af9afcfe906b539d8f404cbc40f743dfplus the final test. It fails at the 8 MiB control. A separate diagnostic rerun confirms a successful 16 MiB import markedjoined at bind, then the same assertion failure.545a8a3f9eed6c27984e760d62bb3a10a6ee44f3. Both the normal run and separate diagnostic rerun pass all three cases:The test checks the entire 32 MiB backing allocation, including the unused tail inside the joined import and the surrounding guards. The fallback case checks copying and unchanged initial contents; the two direct-import cases execute GPU fills through the returned buffer view and offset.
The same five existing tests pass before and after:
agc_driver_graphics(mock),agc_driver_bda_device,agc_driver_bda_span_reads,agc_driver_guest_memory_lifetime, andagc_driver_host_import_windows. The mock suite also covers the larger-piece exception and retention/reuse of imports when a grown-heap join is refused.Setup: Ryzen 9 3900X, RTX 3080 Ti 12 GB, NVIDIA 610.88, Windows 11 Pro 10.0.26300, supported WinLibs GCC 15.2.0 r7, Release. Both sides used
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1, andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. Loader diagnostics confirm validation 1.4.363 was actually inserted for every GPU test. Full logs contain no skips, missing-layer warnings orVUID-errors. The new test takes under half a second here.The patch below applies to your exact head and contains only five added production lines and the 120-line synthetic test. Conventions and whitespace checks pass against those exact Git objects. It leaves the default window at 8 MiB. The fixture contains no game data or captures. SF6 speedup, gameplay correctness and prevention of real-game device loss remain unproven; no title benchmark is claimed.
AI-assisted code, review and testing.
Complete proposed patch, based directly on
0ccc15d0aImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T08:34:07Z.
@TideOPL, @embersas's case checks out against the code on
0ccc15d0af.importJoinedwidensbegin/endto the neighbouring imports before callingjoinedRun, andjoinedRun's "exact whole run" exception compares against those widened bounds. So a binding that only partly covers a run of small pieces, but has imports at both ends, is treated as exact and joined past the 8 MiB window.Could you fold in the correction from that comment (keep the binding's original bounds for the exactness check, keep the exception for runs whose pieces are each larger than the window) together with its
HostImportJoinWindowtest? The new head then needs CI again before the gate.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-30T23:11:21Z.
Review: COMMENTED
Linux run of head
795a53db6b. The description lists Linux, AMD and the validation layer as not run, so this covers Linux and the layer, on NVIDIA and lavapipe.Setup: Ubuntu 26.04, GCC 15.2, Release. RTX 3070 (NVIDIA 595.99.02) and lavapipe (Mesa 26.0.3), one at a time via
VK_DRIVER_FILES. Khronos validation layer 1.4.341 (VK_LOADER_DEBUG=layershows it inserted),ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1,ctest -j1. The head merged--no-ffonto currentmainde96e3efbdwith no conflicts.main+ only this PR's two test filesagc_driver_graphicsfails witha buffer bound from inside one piece into the next, both no larger than the import window, was not imported over both pieces;agc_driver_host_import_join_windowfails withan eligible large binding over four pieces was copiedagc_driver_graphics,agc_driver_host_import_join_window, the otherhost_import*tests andguest_memory*(16 tests)VUID-VUID-^agcsuite without display/flip/lds_atomics64, no layer,--timeout 60agc_driver_pipeline_journalhitting the 60 s timeout while the machine was loaded. It passes on this merge when re-run alone (2 of 2, 5 to 9 s), and it takes 30 s onmainon lavapipe as well.ninja allplus everyagc*_teststarget builds without warnings from the touched files.VUID-VkDeviceCreateInfo-pNext-pNext, which that layer reports onmaintoo.Not run: AMD, and a title.
GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02, Linux); lavapipe (Mesa 26.0.3, Linux).
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T03:05:04Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
795a53db6bdb174a76de2995ec3612844623b009againstmain. I readdescription.md,commits.md,manifest.json, and all four changed files listed in the manifest. I inspected the import joining logic and relevant call sites. I did not run commands or tests. The execution test and suite results below are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not run the reported tests, conventions check, or physical title measurements. Linux, AMD hardware, and Vulkan validation layers were not tested per the description. No files were excluded from review in the manifest.
To get this to a good state
Nothing is required.
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.