Skip to content

perf(agc-driver): join a buffer bound from inside a range across the ranges it crosses - #5372

Open
TideOPL wants to merge 9 commits into
boykopovar:mainfrom
TideOPL:perf/host-import-join-partial
Open

TideOPL wants to merge 9 commits into
boykopovar:mainfrom
TideOPL:perf/host-import-join-partial

Conversation

@TideOPL

@TideOPL TideOPL commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

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. main copies it on the CPU for every bind.

What

Since #9652, main joins 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 what main still 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 main 16345ca (795a53d). The code is @embersas's adaptation from the thread, unchanged:

  • joinedRun also returns the crossed run when it is no larger than the window: if (begin == run.base || run.bytes <= window) return run;.
  • importJoined widens 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.
  • Window cap. A widened run larger than the window (and not made only of ranges each larger than the window) is taken only when the old joined-only widening already gave that same run from its first range's start, so a run main admits 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.
  • Debt. The host-imports entry gains one clause for the interior join. The entry is already over the 1,000-character guideline on 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. With main's GuestBufferMemory.cpp it fails with a 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 to main's prefix rule). Four adjacent 4 MiB pieces, the first and last imported:

    window binding expected main this PR
    8 MiB 12.5 MiB from 64 KiB into the first piece copied, bytes outside it untouched passes passes
    8 MiB 12.5 MiB from the first piece's start imported (perf(agc): join the imports of a buffer bound from the start of adjacent ranges #9652) passes passes
    8 MiB all 16 MiB imported passes passes
    16 MiB 12.5 MiB from 64 KiB into the first piece imported, GPU fill lands, bytes outside it untouched fails (an eligible large binding over four pieces was copied) passes
  • Suites. ctest -R "^agc_driver|^guest_memory|^guest_allocations" on this head: 828 of 828 pass, 8 skipped (as on main).

  • Conventions. tools/check_conventions.py reports only the debt-length warning above.

  • Minecraft Dungeons II (PPSA16064), Squid Coast spawn, main vs this PR.

    • Two builds from main 16345ca: one as is, one with this PR's GuestBufferMemory.cpp change. Both carry three local patches: a window-placement switch; a trigger that opens the trace window at the gameplay HUD; and libSceHttp2 as of main e25333e. Current main aborts MCD2's boot with sceHttp2SetRedirectCallback not implemented and then sceHttp2SendRequestAsync not implemented; feat(http2): deliver redirect callbacks and follow HTTPS redirects #11575 implements the first.
    • APS5_TRACE_SECONDS=25:15 with APS5_TRACE_EVENTS=1048576. Warm-up boot per side, then interleaved runs.
    • No change on this title, as expected. MCD2's crossing bindings start at a piece's base, which main already joins. The two main runs differ by 36 ms p50, so the pair only shows the profiles match:
    run frame p50 / p90 / p99 ms presents GPU busy ms/present Driver.Packet / memory_wait / Graphics.Draw ms/frame
    main 1 97.5 / 116.5 / 181.4 146 29.3 195.9 / 64.8 / 46.0
    this PR 1 trace not written (game reached gameplay, 10.24 FPS in the title bar)
    main 2 133.6 / 149.0 / 225.9 112 29.9 259.8 / 85.7 / 60.9
    this PR 2 135.1 / 148.4 / 217.7 110 29.8 263.2 / 87.9 / 62.0
    Summary lines (main 2, this PR 2)
    {"commit":"ba0ee16b5a6a","dirty":false,"env":{"APS5_STAGING_POOL_MIB":"1024","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"25:15"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 610.88","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 7800X3D 8-Core Processor","cpu_threads":16,"memory_mib":31893,"title_id":"PPSA16064","title":"Minecraft Dungeons II","content_version":"01.100.100","resolution":"3840x2160","window":{"spec":"seconds 25:15","first_present":1805,"ms":15182.32},"presents":112,"frame_ms":{"p50":133.557,"p90":149.024,"p99":225.915,"max":259.031},"gpu_busy_ms_per_present":29.937,"worker_busy_pct":{"queue worker 0x0":99.058,"queue worker 0x20":98.299},"top_phases_ms_per_frame":{"Driver.Packet":267.359,"Driver.Packet.memory_wait":85.777,"Graphics.Draw":61.205,"Driver.Packet.dispatch":58.155,"Driver.Dispatch":57.017,"Driver.Packet.pipeline_drain":55.839,"Graphics.Draw.draw_and_resource_release":53.577,"Driver.Packet.draw":44.415},"trace_dropped":false,"trace":"aps5-trace-ba0ee16b5a6a-7336.json.gz"}
    {"commit":"4397246d19fc","dirty":false,"env":{"APS5_STAGING_POOL_MIB":"1024","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"25:15"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 610.88","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 7800X3D 8-Core Processor","cpu_threads":16,"memory_mib":31893,"title_id":"PPSA16064","title":"Minecraft Dungeons II","content_version":"01.100.100","resolution":"3840x2160","window":{"spec":"seconds 25:15","first_present":1788,"ms":15069.729},"presents":110,"frame_ms":{"p50":135.121,"p90":148.42,"p99":217.703,"max":234.268},"gpu_busy_ms_per_present":29.783,"worker_busy_pct":{"queue worker 0x0":99.015,"queue worker 0x20":98.772},"top_phases_ms_per_frame":{"Driver.Packet":270.711,"Driver.Packet.memory_wait":88.017,"Graphics.Draw":62.263,"Driver.Packet.dispatch":57.775,"Driver.Dispatch":56.572,"Driver.Packet.pipeline_drain":55.504,"Graphics.Draw.draw_and_resource_release":54.456,"Driver.Packet.draw":45.258},"trace_dropped":false,"trace":"aps5-trace-4397246d19fc-46444.json.gz"}
    

    tools/trace_digest.py on both traces gives the same largest slices within 2 % (Driver.Packet 259.8 / 263.2, memory_wait 85.7 / 87.9, Graphics.Draw 60.9 / 62.0, Driver.Packet.dispatch 57.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):

    • 007 First Light (PPSA11386), main menu, RTX 3080 Ti, Windows: @embersas ran exactly this code on main bb04a4f, A/B/B/A. Frame p50 was 610 / 608 ms on main and 451 / 505 ms with the change. Their baseline failed the new interior-join test, as it should.
    • Stellar Blade, RX 9070 XT, Windows: @moong15 ported the join onto main e90a1d1. Over 90 s, Resources.Complete went from 7.69 to 0.70 s, Recorder.Sync from 9.21 to 5.08 s and Vulkan.Dispatch.shader_resources from 8.15 to 1.84 s. Presents didn't change (563 vs 559): queue 0 is draw-bound there.
    • Stray (PPSA02100), Apple M4 Pro, MoltenVK: @imellag measured 43.4 GB of CPU copies of guest buffers on main and 273 MiB with the change. Mean presents per 10 s went from 20.1 to 24.5, and UploadFinish write-back waits went from 230–254 per 10 s to 0.
  • Not run.

    • Vulkan validation layers (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation): the layer isn't installed on this machine.
    • Linux and AMD here.
    • A title that grows a heap in pieces under bound buffers on NVIDIA; the window cap bounds that case.
    • Larger windows (Stray's 13.6 MiB run, 007's 12.5 MiB bindings from a piece's start) are the agreed follow-up. Since perf(agc): join the imports of a buffer bound from the start of adjacent ranges #9652, bindings from a piece's start join at any size on main.
Earlier results, against main before #9652

These measured earlier heads, when this PR also joined bindings from a range's start; main now does that itself.

  • MCD2, Squid Coast spawn, main 77b9f72 plus 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.
  • MCD2 on other machines (head e539061): AlxcBTW, RTX 5070 Laptop, 4.79 / 4.18 to 6.08 / 6.34 FPS. parl0v, RTX 4060, 1.95 to 3.65 FPS.
  • Ready or Not (PPSA18605), RX 7900 XTX (Nesyth), and Kena: Bridge of Spirits (PPSA01802), RX 9070 XT, RADV (alfalfa-star): CPU copies outside imports went to 0.
  • 007 First Light (SleglJan, 2026-10-17/18): measured at e539061, whose widening is the path @embersas's fix closed. Their correction of 2026-10-24 explains why those numbers don't carry over.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 5070, driver 610.88, Windows 11
  • AI-assisted: yes. Written with AI assistance (Claude Code); I reviewed and tested it.

@Nesyth

Nesyth commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

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+0xc0000 over 0xa0000 | 0x40000 in one session). Both lie in one 8 MiB window that is only partly registered, so joinedRun refuses 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 (main 0214069 + #4515 + #4517 + other local changes):

  • Without a join: 18,000-23,000 draw builds per 10 s fail on that buffer, and each one copies its 768 KiB, 85-93 GB per session. About 45% of draws reuse their resources. 2.67 and 2.90 FPS.
  • With the straddle joined (I used a narrower version of your rule that joins only inside one 8 MiB window): 10 MiB copied, about 98% reused. 4.53, 4.43 and 4.47 FPS.

With this PR (2 sessions, driver built from your head):

  • 0 MiB copied outside imports. That includes a second straddle my narrower rule still copies, a buffer across a window boundary (0x3245dc0000+0x280000 over 0x210000 | 0x1f0000), about 2.7 GB per session. So the broader rule pays off here.
  • Both sessions happened to get the layout without the hot straddle, and I ran them with a heavy import trace, so I don't have a clean FPS number for this PR yet.
  • A unit test with that geometry passes on your branch: a view 2.5 pieces long from the start of a 2-piece range into a 1-piece range, inside a partly registered window. It binds in place with nothing copied.

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.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

The full build of this merged with current main fails agc_driver_graphics on Linux and Windows at the new check in BdaResources.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?

@TideOPL
TideOPL force-pushed the perf/host-import-join-partial branch from 201218a to eb0e2e6 Compare October 14, 2026 05:52
@TideOPL

TideOPL commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

@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 importJoined didn'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 on main 0b6d033 and added a commit (eb0e2e6): 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. Full ctest passes 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.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 14, 2026
@TideOPL
TideOPL force-pushed the perf/host-import-join-partial branch from eb0e2e6 to 2764743 Compare October 14, 2026 12:47
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 14, 2026
@alfalfa-star

Copy link
Copy Markdown
Contributor

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 operations line of each run:

runs copies outside imports per run bytes
without #5372 17 3,000 to 72,496 1.8 to 55 GiB
with #5372 7 0 0

Example lines from one run each:

without: [buffers] 86000 completed CPU-copy operations: ... 54971 outside imports (30800 MiB): 0x2020000000:2906/7931MiB 0x2040000000:25394/6746MiB 0x20d0000000:2681/4225MiB ...
with:    [buffers] 43000 completed CPU-copy operations: ... 0 outside imports (0 MiB)

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, and guest read in [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.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks for the rebase. The agc_driver_graphics failure is gone with the third range registered writable, so the V# again crosses two imports that stay apart. Two things are still open:

  • importJoined still 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.
  • joinedRun no 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.

@TideOPL
TideOPL force-pushed the perf/host-import-join-partial branch from 2764743 to 68f7a25 Compare October 14, 2026 18:28
@TideOPL

TideOPL commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

@oneandonlydean thanks, both done in 68f7a25 (rebased on main 32e810d):

  • No fallback. importJoined widens 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.
  • Size bound. joinedRun keeps perf(agc-driver): join the imports of adjacent ranges of any size that a buffer is bound exactly over #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.
  • Test. The grown-heap check now uses a heap one piece larger than the window: a bind into the new piece stays in place on its window import, a bind across the older boundary is copied without retiring it, and alternating binds never re-import. It fails on the previous head (a bind across a grown heap joined more than the import window or retired the newer import) and passes here. Full ctest passes 1209/1209 on Windows; Linux not run.

@TideOPL

TideOPL commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

@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 (68f7a25, 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.

@alfalfa-star

alfalfa-star commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

@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 main does not reach the title scene). On that stack I added 68f7a25 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 operations line.

run head copies outside imports presents / 10 s after loading
2 current (68f7a25) 0 (0 MiB) 56 46 67 67 78 79 103 98
2 previous 0 (0 MiB) 57 44 53 50 53 84 97 37
3 current – (aborted at ~33 s, see below) –
3 previous 0 (0 MiB) 28 62 65 94 101 120 102 102
  • A first pair, run before I noticed that a reboot had reset my udmabuf limits, also had 0 copies on both heads.
  • Frame rates are within run-to-run noise between the two heads.
  • No GPU reset in any run.

One current-head run (run 3) aborted during loading. RADV printed radv/amdgpu: Not enough memory for command submission. and the next vkQueueSubmit returned VK_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) on main plus #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)

@fogydes

fogydes commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Verdict

stale+rebase

Findings

  1. [verified] Merge conflicts against current origin/main (0a2cda921d): git merge-tree --write-tree origin/main 30868735e82c6f9f95d7c3385205214c3549c6ec fails with exit code 1. The branch is 8,204 commits behind main and conflicts on 3 files:
    • core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
    • core/libs/prx/libSceAgcDriver/tests/BdaResources.cpp
    • docs/dev/debt/libSceAgcDriver.md
  2. [verified] Conventions check warning: python tools/check_conventions.py --base cd64efea1af5d6b0198df85b3b48df62b075078f in a scratch worktree reports 1 finding:
    • docs/dev/debt/libSceAgcDriver.md:155: warning: [debt-length] Technical debt entry over 1000 characters: state the gap first (what differs from the console, what is unverified, what throws) and keep only the behaviour it needs: 3782 characters
  3. [read-only] Missing speed claim artifacts: The PR is titled perf(agc-driver): ... and makes extensive frame rate and latency claims ("frame p50 92–97 ms in every run, against 100–131 ms..."). Per AGENTS.md, "A speed claim shows tools/trace_digest.py summaries of main and of the change from the same machine and scene" (including the two aps5-summary.jsonl lines). Traces are noted as unattached; the summaries and summary lines are required in the PR description.
  4. [read-only] Vulkan validation layer comparison requirement: Per AGENTS.md, AGC changes require running the same focused tests on main and the branch with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and comparing logs to verify no new VUID- validation errors are logged. This comparison is not present in the PR description.
  5. [read-only] Missing PR checklist line: The PR checklist omits one required template line from .github/pull_request_template.md:
    • - [ ] Fixes: <!-- issue it closes as Fixes #N, or none -->
      Per AGENTS.md, all checklist lines must be kept and answered (Fixes: none if no issue is closed).
  6. [author-reported] Author reports MCD2 gameplay benchmarks and test passes on Windows 11 with RTX 5070 (driver 610.88), as well as multi-tester rows from Ready or Not and Kena: Bridge of Spirits.

Freshness envelope

  • Head: 30868735e82c6f9f95d7c3385205214c3549c6ec
  • Base: cd64efea1af5d6b0198df85b3b48df62b075078f
  • Behind origin/main: 8,204 commits
  • Merge-tree: exit 1 (conflicts in GuestBufferMemory.cpp, BdaResources.cpp, docs/dev/debt/libSceAgcDriver.md)

Cross-PR ledger

@VicRaster

VicRaster commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Tested a local adaptation of this PR at 30868735e8 onto bb04a4f1ea, with #10935, #6782 and #11485 present in both arms. This was not an unchanged build of the PR head: the port preserves current main's prefix-import behaviour and keeps the configured import window/budget limits. The standalone test was adjusted to distinguish interior partial joins from existing prefix admission.

Two warmed, validation-off menu captures per arm, in A/B/B/A order:

Build Frame p50, ms
Baseline 610 / 608
Local adaptation 451 / 505

Same Windows Ryzen 9 3900X / RTX 3080 Ti, 3840×2160, draw pipeline off, APS5_LAZY_SHADER_PREPARE=1, APS5_NO_LIBRARY_PREBUILD=1. Each capture used 600:30, a fresh process with warmed caches, only the standard trace flags, and no redirected application log. No dropped trace data.

The final adaptation passed 17/17 focused tests with validation enabled, including GPU output/guard-byte checks. A baseline negative control failed the new eligible interior-join case as expected.

Promising menu evidence, but only two short captures per arm, animated content and some run-to-run variation. Gameplay and longer stability remain untested. Large above-window buffer copies still persist; this does not establish that the current PR head is ready to merge.

Exact production-code adaptation, relative to bb04a4f1ea plus the three PRs listed above, in core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp:

diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
index 64de3d8c8d..b5274cbb0a 100644
--- a/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
+++ b/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
@@ -1559,7 +1559,7 @@ ImportRun joinedRun(const GuestAllocations::Lease& lease, std::uint64_t begin, s
     auto run = crossedRun(lease, begin, end);
     if (run.ranges.empty()) return run;
     if (std::all_of(run.ranges.begin(), run.ranges.end(), [window](const auto& range) { return range->bytes > window; })) return run;
-    if (begin == run.base) return run;
+    if (begin == run.base || run.bytes <= window) return run;
     return {};
 }
 
@@ -1972,10 +1972,19 @@ std::vector<ImportPiece> budgetedImportPieces(const Context& context, HostImport
 }
 
 const HostImport* importJoined(const Context& context, HostImports& state, std::uint64_t begin, std::uint64_t end, const GuestAllocations::Lease& lease) {
-    if (const auto* low = peekImport(state, begin, begin + 1); low != nullptr && low->joined) begin = low->base;
-    if (const auto* high = peekImport(state, end - 1, end); high != nullptr && high->joined) end = high->base + high->bytes;
+    const auto* low = peekImport(state, begin, begin + 1);
+    const auto* high = peekImport(state, end - 1, end);
+    const auto previousBegin = low != nullptr && low->joined ? low->base : begin;
+    const auto previousEnd = high != nullptr && high->joined ? high->base + high->bytes : end;
+    if (low != nullptr) begin = low->base;
+    if (high != nullptr) end = high->base + high->bytes;
     auto run = joinedRun(lease, begin, end);
     if (run.ranges.empty()) return nullptr;
+    const auto window = importWindow.load(std::memory_order_relaxed);
+    if (run.bytes > window && !std::all_of(run.ranges.begin(), run.ranges.end(), [window](const auto& range) { return range->bytes > window; })) {
+        const auto previous = crossedRun(lease, previousBegin, previousEnd);
+        if (previousBegin != previous.base || !sameRun(previous, run)) return nullptr;
+    }
     if (const auto failed = state.failedJoins.find(run.base); failed != state.failedJoins.end() && sameRun(failed->second, run)) return nullptr;
     const auto existing = state.imports.find(run.base);
     const bool existed = existing != state.imports.end() && sameRun(existing->second, run);

previousBegin/previousEnd reproduce the old joined-only widening before either bound is changed. The new widening considers any existing import. If its resulting run exceeds the window and is not composed entirely of pieces individually larger than the window, it is accepted only when the old range started at its first registered piece and the old and new runs are identical. Thus an already admitted prefix remains admitted, but new widening cannot use that prefix exception to enlarge an above-window run. Existing failure memoisation, epoch increments and ownership logic below this hunk are unchanged.

For the standalone regression fixture, I used a 64 KiB interior offset for the 12.5 MiB view: it must copy with an 8 MiB window and import with a 16 MiB window. I separately retained the existing whole-prefix 16 MiB view admission with an 8 MiB window, and checked GPU output plus surrounding guard bytes.

AI-assisted investigation and local adaptation.

main now joins a binding that starts at a range's base at any size. Keep
that, and take embersas's adaptation from the PR thread for the rest: a
binding from inside a range joins the ranges it crosses when the run,
widened to the imports it starts and ends in, fits the window; a wider run
is taken only when the joined-only widening already gave that same run
from its first range's start. The tests bind from inside a piece, which
main copies.
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 30, 2026
@TideOPL TideOPL changed the title perf(agc-driver): join every range a bound buffer crosses perf(agc-driver): join a buffer bound from inside a range across the ranges it crosses Oct 30, 2026
@github-actions github-actions Bot removed the perf numbers missing perf pull request without a before and after summary line label Oct 30, 2026

@jotitadev jotitadev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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=layer shows it inserted), ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, ctest -j1. The head merged --no-ff onto current main de96e3efbd with no conflicts.

RTX 3070 lavapipe
main + only this PR's two test files agc_driver_graphics fails with a 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_window fails with an eligible large binding over four pieces was copied same two failures
merged: agc_driver_graphics, agc_driver_host_import_join_window, the other host_import* tests and guest_memory* (16 tests) 16/16, 3 of 3 runs, 0 VUID- 16/16, 3 of 3 runs, 0 VUID-
merged: ^agc suite without display/flip/lds_atomics64, no layer, --timeout 60 1130/1130 1129/1130
  • The one lavapipe failure is agc_driver_pipeline_journal hitting 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 on main on lavapipe as well.
  • ninja all plus every agc*_tests target builds without warnings from the touched files.
  • With the older layer the NVIDIA CI uses (1.3.275), the focused set also passes. The only messages are VUID-VkDeviceCreateInfo-pNext-pNext, which that layer reports on main too.

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.

@TechLevelZero

TechLevelZero commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 795a53d merged onto main 88e804b · tested 2026-11-02 13:30 UTC · 23 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,497 passed · 6 failed (0 new, 3 also fail on main, 3 unstable on main) · 45 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,548 of 3,234 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (971 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.2 s, ⚠️ agc_driver_graphics_maps_fallback 31.0 s, ⚠️ agc_driver_graphics 30.3 s
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 2 of the last 10 main runs
agc_submit_progress: failed in 8 of the last 10 main runs
agc_submit_progress_no_timeline: failed in 8 of the last 10 main runs
Failing on main too (3, not counted against this PR)
agc_driver_image_table
guest_mmap_executable
guest_socket_options_multicast
Validated but not compared (1, not in the main baseline's validation pass)
agc_driver_host_import_join_window
Validation IDs already present on main (4 IDs in 497 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (497 tests): agc_driver, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, and 489 more
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkShaderModuleCreateInfo-pCode-08737 (1 test): agc_driver_image_sample_derivatives
Skipped (45)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_dcc: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_deferred: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_main: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fps_limit: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_o
Reproduce
git fetch origin 795a53db6bdb174a76de2995ec3612844623b009 88e804b0a7df1f1ac373a9e2f72fb378d925fdd4
git checkout 88e804b0a7df1f1ac373a9e2f72fb378d925fdd4 && git merge --no-ff 795a53db6bdb174a76de2995ec3612844623b009
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@fogydes

fogydes commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Correction: Previous review flagged verdict stale+rebase with 3 merge conflicts at head 30868735e82c. Head has since updated to 795a53db6bd via merge with main, cleanly resolving all merge conflicts against current origin/main (clean merge-tree exit 0). Verdict updates from stale+rebase to should-fix.

should-fix

Findings

  1. [verified] python tools/check_conventions.py --base 16345cad6a in scratch worktree passes with 0 errors and 1 warning:
    • docs/dev/debt/libSceAgcDriver.md:203: warning: [debt-length] Technical debt entry over 1000 characters: state the gap first (what differs from the console, what is unverified, what throws) and keep only the behaviour it needs: 3101 characters
  2. [verified] Branch history contains four non-conventional merge commits: 795a53db6bd, 30868735e82, 0ccc15d0af9, and 25530397116. Repository conventions require a linear commit history; please rebase the topic commits directly onto origin/main without merge commits.
  3. [read-only] PR description checklist is missing three required template lines from .github/pull_request_template.md:
    • - [ ] Fixes: none
    • - [ ] Unblocks: none
    • - [ ] GPUs tested: <!-- vendor, model, driver and OS of each GPU tested --> (Required for AGC driver changes per CONTRIBUTING.md#branches-and-pull-requests).
  4. [read-only] Vulkan validation layer comparison: Per AGENTS.md, AGC driver changes require running focused tests on main and the branch with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and comparing logs to verify no new VUID- validation errors are logged.
  5. [author-reported] Author reports MCD2 gameplay benchmarks and test passes on Windows 11 with RTX 5070 (driver 610.88), importJoinTests, and agc_driver_host_import_join_window.

Freshness envelope

  • Head SHA: 795a53db6bdb174a76de2995ec3612844623b009
  • Base SHA: 16345cad6a692bc37e682150f11c7ab635788941
  • Commits behind origin/main: 1,930
  • Commits ahead of origin/main: 9
  • git merge-tree --write-tree origin/main 795a53db6bd: clean merge (exit code 0, tree b0c266cda5d40696e25e2c4bd5228f5402b2f474)

Cross-PR ledger

@hugodearaujo

Copy link
Copy Markdown
Contributor

007 First Light (PPSA11386 01.018.000) on AMD/Linux, at head 795a53d, and data for the larger-window follow-up discussed above. This PR alone joins only 007's small straddles. The binding that costs most still copies, and joining it takes the first launch options screen from 458 to 141 ms per frame.

Setup. Arch Linux, kernel 7.2.11, Ryzen 7 9800X3D, Radeon RX 9070 XT (RADV GFX1201, Mesa 26.2.6), Release, 3840x2160. Every arm also carries #4449 (1f7640b, merged locally onto main 369d293). Without it, these joined runs over scattered direct memory fail on amdgpu:

[gpu] host import of 0x3f01200000+0x8000000 failed at vkAllocateMemory (-1000072003); falling back to copies, requested by join

That leaves the copy in place no matter what joinedRun decides.

Each run used a fresh run directory (cold shader cache), with APS5_TRACE_SUMMARY_EVERY=10 and APS5_TRACE_SECONDS=300:60, for 600 s, pressing Cross every 30 s. The rows below are the summary intervals in which the title shows FIRST LAUNCH OPTIONS (checked with screenshots), because the arms reach that screen at different times.

arm intervals fps frame p50 (median) Resources.Complete ms/frame GPU busy ms/present
main 369d293 5 1.86 538 ms 454 61.8
main + #4449 16 1.92 516 ms 433 67.8
main + #4449 + this PR 10 2.18 458 ms 363 70.9
same build, joins up to 128 MiB (lab switch below) 39 6.99 141 ms not in the top 8 76.5

The traced window of the last two arms falls on that same screen:

  • This PR: seconds 300:60 from present 751: 131 presents, frame p50 455.2 / p90 484.2 / p99 514.4, draw committer Resources.Complete 295 ms per present.
  • With the lab switch: seconds 300:60 from present 4197: 422 presents, frame p50 140.1 / p90 168.0 / p99 175.7, draw committer Graphics.Draw 22 ms per present.

What is copied. A diagnostic build logs each distinct region copyRegion reads outside imports. Of 150 distinct regions, 147 are writable descriptor regions that start inside one registered range and end inside the next. [buffers] puts 97% of the bytes in the 0x3f00000000 bucket: 281,397 copies and 3,454 GiB in 423 s, 12.3 MiB per copy on average. That is this binding:

[copydiag] region 0x3f00094200+0xc80000 writable 1 hostBacked 0 sparse 0 addressable 0; import at begin 0x3f00000000+0x200000, at end 0x3f00200000+0xc00000, 2 imports overlap, failed join overlaps 0
[copydiag] region 0x3f010a9d10+0x6000000 writable 1 hostBacked 0 sparse 0 addressable 0; import at begin 0x3f01000000+0x200000, at end 0x3f01200000+0x6000000, 2 imports overlap, failed join overlaps 0

The first is the 12.5 MiB view @Scramblrrrr described, over a 2 MiB range plus a 12 MiB range (a 14 MiB run). The second is a 96 MiB view over a 2 MiB range plus a 96 MiB range (a 98 MiB run). Both runs are larger than the 8 MiB window, so importJoined refuses them on this head.

Lab switch. APS5_EXP_JOIN_WINDOW_MIB replaces the window in this PR's run.bytes <= window (in joinedRun) and in the cap check in importJoined with max(window, N). Nothing else changes: block sizes, range windows and the all-ranges-larger rule are untouched. At N=128, over 600 s:

  • no host import failures, no device loss and no abort;
  • peak per-process memory of 12.6 GiB VRAM and 7.3 GiB GTT (amdgpu fdinfo), against 12.9 / 8.3 GiB with this PR alone and 13.6 / 10.3 GiB on main over 1800 s;
  • the lowest free memory on the device was 2.8 GiB VRAM and 8.2 GiB GTT.

This is one AMD machine with #4449 underneath, not the NVIDIA run requested for the follow-up.

Later in the game, same lab build. I ran 1800 s from the same run directory (shader cache warm from the run above), with APS5_EXP_JOIN_WINDOW_MIB=128, and handled the EULA and offline prompts by hand. The run reached the opening helicopter cutscene by 600 s. From 600 to 1190 s it held 1.44 fps (frame p50 638 ms, GPU busy 181 ms per present). main + #4449 alone runs that cutscene at 0.34 fps (frame p50 2,850 ms), and there Resources.Complete is 2,246 ms of each frame.

At 1290 s, in the next scene (GPU busy 800-1,076 ms per present), our desktop memory guard stopped the run: gpuguard KILL pid 3763083: vram_free=1333 MiB gtt_free=3057 MiB. The process held 14.9 GiB of VRAM and 11.6 GiB of GTT. On a 16 GiB card, memory is the next limit once the copies are gone.

@TideOPL is anyone already on the larger-window follow-up? If not, I can open it on top of this PR with @Scramblrrrr's 12.5 MiB fixture and the 98 MiB case above, and ask for an NVIDIA run at the new size.

AI-assisted: yes (Claude Code)

@mrfelek

mrfelek commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

@TideOPL #15658 changes the same line of joinedRun, for a case that doesn't overlap with this one. It covers a bind from inside a range that is larger than the window, running into following ranges that together fit the window (PPSA22408: 12 MiB + 2 MiB). This PR covers runs that fit the window entirely.

One interaction: this PR's cap in importJoined would refuse that case, since the run is over the window and doesn't start at its base. If this one lands first, I'll rebase #15658 and exempt the case from the cap. If #15658 lands first, the conflict is one line in joinedRun plus the debt entry. Either order works for me.

AI-assisted.

@github-actions github-actions Bot added the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Nov 4, 2026
@github-actions github-actions Bot removed the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Nov 5, 2026
@relativespace2K

Copy link
Copy Markdown
Contributor

Independent check on Windows/AMD. Head 795a53db6b (merged with main 16345cad6a), WinLibs GCC 15.2, Release; main today is 11673672d9.

A/B on an RX 6800 XT (Windows 11 IoT Enterprise LTSC 26100, Ryzen 5 5600, AMD 26.10.1, Vulkan 1.4.315). Same tree, only GuestBufferMemory.cpp swapped:

tree agc_driver_host_import_join_window_tests agc_driver_graphics_tests
main 16345cad6a fails: an eligible large binding over four pieces was copied (16 MiB interior case) fails: a buffer bound from inside one piece into the next, both no larger than the import window, was not imported over both pieces
this PR passes; 8 MiB interior = 13,107,200 copied, the other three cases 0 copied with GPU fill landed and surrounding bytes untouched passes

tools/check_conventions.py --base origin/main: only the existing debt-length warning (3,101 characters, 121 more than main), no errors. The new test is picked up by the tests/execution/*.cpp glob, so CI runs it.

Order with #15658: that PR adds a neighbouring condition to the same line (first range larger than the window, the rest fits). The window cap here refuses exactly that case, and its author says they will rebase and exempt it if this lands first. Settle the order before merging either.

The spaceReadAcrossImports* change (range == guest + 2 * piece) is covered by its own commit (4bdf153147, cross imports that differ in access), so no question there.

@relativespace2K

Copy link
Copy Markdown
Contributor

Re-checked on current main 11673672d9, and the PR no longer passes the full AGC graphics suite there, although it did on the base it was verified against (16345cad6a).

  • agc_driver_host_import_join_window passes (0.5 s).
  • agc_driver_graphics fails in importWindowKeepsJoinTests: a view across a window edge was not imported as one joined block. main alone passes that binary here (11.9 s); with this head it aborts at 1.3 s.
  • Cause is the widening to imports that are not joined: if (low != nullptr) begin = low->base; and if (high != nullptr) end = high->base + high->bytes;. When an import sits at the end of the binding, the run is extended past the binding's own ranges; in that test it becomes three 64 KiB pieces (192 KiB), still within the 256 KiB window, so the cap admits it and the import ends up three pieces where the test expects two (base + 3 * piece, 2 * piece).
  • With the low->joined and high->joined guards restored on those two lines, both agc_driver_graphics and agc_driver_host_import_join_window pass on current main.

Is widening to a non-joined import needed for the scenario this PR targets? If it is, importWindowKeepsJoinTests needs to expect the wider import; if not, restoring the guards fixes the current-main failure. The branch needs a rebase either way.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Hi @TideOPL,

Thanks for the PR. On current main it no longer passes agc_driver_graphics, as @relativespace2K reported above. The reason is a main test that landed after this branch's base: importWindowKeepsJoinTests, added on 5 Nov by d3d11a7 ("keep joined host imports when an address-based build picks a window block").

The cause is in GuestBufferMemory.cpp. This PR widens the run to the neighbouring imports with no check on whether they are joined:

if (low != nullptr) begin = low->base;
if (high != nullptr) end = high->base + high->bytes;

Main only widens to imports that are joined (low->joined / high->joined). In that test the run grows to three 64 KiB pieces, which still fits the window, so the import covers three pieces where the test expects two.

Could you pick one of these?

  1. If the case this PR targets doesn't need widening to a non-joined import, keep the ->joined checks on those two lines. With them, both agc_driver_graphics and agc_driver_host_import_join_window pass on current main.
  2. If it does need it, please explain why, and update importWindowKeepsJoinTests to expect the wider import.

Either way, please merge current main into the branch so the run covers the new test.

@Scramblrrrr

Copy link
Copy Markdown
Contributor

Coordination on the remaining large interior-start case: I have ported our previously Windows-tested extension onto main d642b4e as WIP Scramblrrrr/AnyPS5:codex/large-interior-host-import-nov16 at 5aacd8f099e86a7a5acf7e25051daa5939f3f1a8.

The predicate allows end - begin >= window as well as a run-start binding, while retaining main's newer large-first-range case. It targets a 12.5 MiB view starting inside a small owner and crossing several small owners. #5372's run.bytes <= window rule covers a complementary small-run case; this port deliberately retains main's small crossing refusal. The regression covers acquired owners, overlapping grown joins, retirement, repeated views and actual GPU readback.

This refreshed head is source-only and has not been built or title-tested yet; no new upstream PR or FPS claim. The October head had native positive/production-negative/restored proof. Full overlap review also found the straddling experiment in #18515, which I am coordinating separately. Let me know if your scope already includes this large case; I want to avoid duplicating it. AI-assisted: Codex.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this; the points below are optional.

What I ran

Reviewed head 795a53db6bdb174a76de2995ec3612844623b009 against main. I read description.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

Check Result Note
Diff and changed files passed All four reviewed files read
Reported test suites not run 828 passed and 8 skipped, per description
Execution test not run Reported on Windows 11 and RTX 5070

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs needs rebase Conflicts with main, rebase needed perf Performance change

Projects

None yet

Development

Successfully merging this pull request may close these issues.