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

Open
TideOPL wants to merge 9 commits from upstream-pr/5372 into main
TideOPL commented 2026-10-13 18:15:32 +00:00 (Migrated from github.com)

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. 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 16345cad6a (795a53db6b). 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 (#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 16345cad6a: 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 e25333e39. Current main aborts MCD2's boot with sceHttp2SetRedirectCallback not implemented and then sceHttp2SendRequestAsync not implemented; #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 bb04a4f1ea, 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 e90a1d180. 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 #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 77b9f7270 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 e5390612f): 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 e5390612f, 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.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4847528542 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372). Originally posted by [TideOPL](https://github.com/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. `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` 16345cad6a (795a53db6b). 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 (#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` 16345cad6a: 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` e25333e39. Current `main` aborts MCD2's boot with `sceHttp2SetRedirectCallback not implemented` and then `sceHttp2SendRequestAsync not implemented`; #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 | <details><summary>Summary lines (<code>main</code> 2, this PR 2)</summary> ``` {"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. </details> - **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` bb04a4f1ea, 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` e90a1d180. 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 #9652, bindings from a piece's start join at any size on `main`. <details><summary>Earlier results, against <code>main</code> before #9652</summary> 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` 77b9f7270 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 e5390612f): 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 e5390612f, whose widening is the path @embersas's fix closed. Their correction of 2026-10-24 explains why those numbers don't carry over. </details> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 5070, driver 610.88, Windows 11 - [x] AI-assisted: yes. Written with AI assistance (Claude Code); I reviewed and tested it.
Nesyth commented 2026-10-13 20:54:34 +00:00 (Migrated from github.com)

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+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 0214069e3 + #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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6155001262 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6155001262). Originally posted by [Nesyth](https://github.com/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+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` 0214069e3 + #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 commented 2026-10-14 05:20:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T05:20:09Z.


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?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6161503757 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6161503757). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T05:20:09Z. --- 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 commented 2026-10-14 10:54:21 +00:00 (Migrated from github.com)

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 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 0b6d033b8 and 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. 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6166733793 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6166733793). Originally posted by [TideOPL](https://github.com/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 `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` 0b6d033b8 and 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. 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.
alfalfa-star commented 2026-10-14 17:40:32 +00:00 (Migrated from github.com)

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 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6174521969 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6174521969). Originally posted by [alfalfa-star](https://github.com/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 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 commented 2026-10-14 18:02:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T18:02:10Z.


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.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6174931001 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6174931001). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T18:02:10Z. --- 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 commented 2026-10-14 18:29:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TideOPL on 2026-10-14T18:29:30Z.


@oneandonlydean thanks, both done in 68f7a2589 (rebased on main 32e810db4):

  • 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 #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.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175444761 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6175444761). Originally posted by [TideOPL](https://github.com/TideOPL) on 2026-10-14T18:29:30Z. --- @oneandonlydean thanks, both done in 68f7a2589 (rebased on `main` 32e810db4): - **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 #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 commented 2026-10-14 18:29:32 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175445627 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6175445627). Originally posted by [TideOPL](https://github.com/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.
alfalfa-star commented 2026-10-15 06:51:39 +00:00 (Migrated from github.com)

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 main does 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 operations line.

run head copies outside imports presents / 10 s after loading
2 current (68f7a2589) 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)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6186299385 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6186299385). Originally posted by [alfalfa-star](https://github.com/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 `main` does 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 operations` line. | run | head | copies outside imports | presents / 10 s after loading | |---|---|---|---| | 2 | current (68f7a2589) | 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)
AlxcBTW commented 2026-10-15 23:56:44 +00:00 (Migrated from github.com)

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 = main 636b1b93c + 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 head e5390612f, 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:

base 1 PR 1 base 2 PR 2
FPS 4.79 6.08 4.18 6.34
GPU busy / idle gaps per frame 89 / 132 ms 79 / 88 ms 134 / 114 ms 82 / 77 ms
copy per present 15.9 ms (297 MiB) 13.1 ms (282 MiB) 40.7 ms (291 MiB) 13.8 ms (279 MiB)
aborts 0 0 0 0

Base 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 copy phases (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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6204778462 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6204778462). Originally posted by [AlxcBTW](https://github.com/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 = `main` 636b1b93c + 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 head `e5390612f`, 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: | | base 1 | PR 1 | base 2 | PR 2 | |---|---|---|---|---| | FPS | 4.79 | **6.08** | 4.18 | **6.34** | | GPU busy / idle gaps per frame | 89 / 132 ms | 79 / 88 ms | 134 / 114 ms | 82 / 77 ms | | `copy` per present | 15.9 ms (297 MiB) | 13.1 ms (282 MiB) | 40.7 ms (291 MiB) | 13.8 ms (279 MiB) | | aborts | 0 | 0 | 0 | 0 | Base 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 `copy` phases (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
parl0v commented 2026-10-16 15:40:20 +00:00 (Migrated from github.com)

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):

libs rows walk FPS mean
main 5d9dcc42d + #6308 + #4472 6 1.79 1.38 1.43 3.82 1.43 1.82 1.95
main 5d9dcc42d + #6308 + this PR + #6490 + #4472 8 3.43 3.35 3.48 4.02 3.14 3.60 4.14 4.05 3.65

Without 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)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6219055685 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6219055685). Originally posted by [parl0v](https://github.com/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): | libs | rows | walk FPS | mean | |---|---|---|---| | `main` 5d9dcc42d + #6308 + #4472 | 6 | 1.79 1.38 1.43 3.82 1.43 1.82 | 1.95 | | `main` 5d9dcc42d + #6308 + **this PR** + #6490 + #4472 | 8 | 3.43 3.35 3.48 4.02 3.14 3.60 4.14 4.05 | 3.65 | Without 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)
Scramblrrrr commented 2026-10-16 18:30:56 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6222145762 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6222145762). Originally posted by [Scramblrrrr](https://github.com/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.
Scramblrrrr commented 2026-10-16 18:35:58 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6222233316 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6222233316). Originally posted by [Scramblrrrr](https://github.com/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.
Scramblrrrr commented 2026-10-16 18:43:20 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6222359313 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6222359313). Originally posted by [Scramblrrrr](https://github.com/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.
oneandonlydean commented 2026-10-16 23:29:26 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6226614175 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6226614175). Originally posted by [oneandonlydean](https://github.com/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.
TideOPL commented 2026-10-17 00:02:51 +00:00 (Migrated from github.com)

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 copy phases 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6227026840 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6227026840). Originally posted by [TideOPL](https://github.com/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 `copy` phases 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.
oneandonlydean commented 2026-10-17 00:41:54 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6227476627 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6227476627). Originally posted by [oneandonlydean](https://github.com/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.
teepean commented 2026-10-17 10:07:26 +00:00 (Migrated from github.com)

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:

Bound buffer Registered pieces it crosses Copies per 10 s (a normal and a slow run)
0x205fba0000+0x900000 (slow run) 0x870000 + 0x520000 ~8,800
0x2004590000+0x7f8000 0x4e0000 + 0x320000 ~110
0x2024d00000+0x1fe000 0x110000 + 0xf0000 ~2,000
0x2024300000+0x1fe000 0x110000 + 0xe0000 + 0x10000 ~300

The 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 <= window join it; a 16 MiB window would.

A run with that join on NVIDIA. As a lab test, joinedRun joining 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:

Build FPS Frame p50 (ms) Slow runs
main + #6814 5.8, 5.4, 5.5, 5.3, 0.9, 0.8 157.9, 177.0, 172.1, 175.9, 1108.5, 1275.0 2 of 6
+ that join 5.9, 5.8, 5.9, 6.0, 5.9, 6.1 157.7, 164.5, 155.7, 159.9, 160.4, 155.0 0 of 6

Six 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 ... failed line, 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 main of 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), and APS5_STORE_AT_FLIP=1 avoided 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).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6232639356 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6232639356). Originally posted by [teepean](https://github.com/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: | Bound buffer | Registered pieces it crosses | Copies per 10 s (a normal and a slow run) | |---|---|---| | `0x205fba0000+0x900000` (slow run) | `0x870000 + 0x520000` | ~8,800 | | `0x2004590000+0x7f8000` | `0x4e0000 + 0x320000` | ~110 | | `0x2024d00000+0x1fe000` | `0x110000 + 0xf0000` | ~2,000 | | `0x2024300000+0x1fe000` | `0x110000 + 0xe0000 + 0x10000` | ~300 | The 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 <= window` join it; a 16 MiB window would. **A run with that join on NVIDIA.** As a lab test, `joinedRun` joining 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: | Build | FPS | Frame p50 (ms) | Slow runs | |---|---|---|---| | `main` + #6814 | 5.8, 5.4, 5.5, 5.3, 0.9, 0.8 | 157.9, 177.0, 172.1, 175.9, 1108.5, 1275.0 | 2 of 6 | | + that join | 5.9, 5.8, 5.9, 6.0, 5.9, 6.1 | 157.7, 164.5, 155.7, 159.9, 160.4, 155.0 | 0 of 6 | Six 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 ... failed` line, 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 `main` of 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), and `APS5_STORE_AT_FLIP=1` avoided 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).
SleglJan commented 2026-10-17 17:37:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-17T17:37:05Z.


007 First Light (PPSA11386 v01.018.000), main menu, on main bc3c0fc13 plus 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:

  • Linux 7.2.10, Ryzen 9 7950X3D, RTX 3080 10 GB, NVIDIA 615.78.08, GCC 16.2.1, Release, bubblewrap sandbox. The title renders 3840x2160, shown in a 1500x844 window.
  • Base: main bc3c0fc13 (2026-10-16) plus four open shader PRs 007 needs on main (#5799, #6317, #6332, #6881).
  • Each arm merges the PR heads as they are now: #5372 e5390612f, #6454 1752c4a89, #6918 955e7c3c7, #6471 726ef5f9a, #6440 cdb140f49.
    • #6454's head merges the heads of #6243, #6455 and #6537, so C, E and F carry those three too.
    • In E, #6440 goes on top of #6454 with the ResourceMaterializer and ShaderMemory.cpp side of Scramblrrrr's 817a9fda4. #6340, which 817a9fda4 also merges, is not in E.
  • No other local changes, and the title's executable is not patched (no #6172 change). Scripted pad input goes through APS5_PAD_INPUT_FILE, starting from an existing save.
  • main's defaults plus APS5_PROFILE_DRAW=1 (for the [buffers] counters), APS5_TRACE_EVENTS=2097152 and SDL_VIDEODRIVER=x11. Each arm runs from its own warm shader cache, made by a warm-up run on the same build.
  • Window: 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:

arm samples frame p50 ms menu reached, s after launch
A: base 2 2219.9, 1943.0 ~1170-1280
B: + #5372 2 1497.7, 1501.0 ~900
C: + #6454 1 1213.0 ~765
D: + #6918 1 1927.0 ~1145
F: + #5372 + #6454 1 441.6 ~395
E: + #5372 + #6918 + #6454 + #6471 + #6440 2 367.8, 365.3 ~360
  • GPU busy is 177-205 ms per present in every sample except A1 (289). Queue worker 0 is busy 99.8-100% of every window, so the difference between arms is on the CPU side.
  • From A's mean, B takes 34% of the A→E gain, C 51% and F 96%. A1 and A2 are 277 ms apart; against A1 or A2 alone the shares are 28-39%, 46-54% and 95-96%.
  • D1 (1927.0) is 16 ms below A2 and has A2's counters: about 500 CPU copies and 1927 ms of Driver.Packet per present. No effect was measured for #6918 alone on this base.
  • Together, #5372 and #6454 gain 1640 ms, against 1451 ms for the two alone added up. That's 189 ms more from A's mean, 51 ms more against A1 alone, and 328 ms more against A2 alone.

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.

A B C F E
Driver.Packet 1931 1486 1199 432 355
draw 1489 1396 796 359 291
dispatch 418 85 370 70 62
capture (draw stage + dispatch) 1171 1190 115 168 91
Resources.Complete (all threads) 389 55 387 61 61
draw_enqueued (all threads) 72 41 524 81 83

[buffers] per present:

  • A, C and D copy guest memory on the CPU, all outside imports: about 495 copies and 5,800 MiB read per present.
  • B, F and E print no CPU-copy line. The line comes every 1,000 copies, so they made fewer than 1,000 in the whole run.
  • GPU copies out of imports are about 42 per present on B, F and E, against 34-35 on A, C and D.
  • No run has an import budget refusal or a failed import.

How the two interact. This is our reading of these counters; the parts were not tested apart.

  • #5372 removes the CPU copies. Dispatch drops to 85 ms, Resources.Complete to 55 ms, and the committer's time per commit from 1.37 ms (A2) to 0.22 ms. Capture stays at ~1190 ms.
  • #6454 cuts the capture from 1171 to 115 ms. Its committer still has the CPU copies: it takes 1.04 ms per commit, and draws wait 741 µs each for room in the 8-deep draw pipeline (4.2 queued ahead on average, against 2.0 on A2). About 450 ms of the saved capture time reappears in draw_enqueued (72 → 524 ms).
  • With both, the committer takes 162 µs per commit, draws wait 109 µs, and draw_enqueued is 81 ms. That fits the pair beating the sum: each PR removes the limit the other one leaves.
  • F is 75 ms slower than E. Its worker-0 capture is 77 ms higher (168 vs 91 ms), the same as its Driver.Packet difference (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:

  • C, D and F have one sample each, and the menu background is animated. A's two samples are 277 ms apart. A1's GPU busy (289 ms) is above every other sample's, which these counters don't explain.
  • Not rerun on a newer main.
  • #6243, #6455 and #6537 come with #6454's head and weren't separated from it. #6918, #6471 and #6440 weren't run one at a time on top of the pair.
  • C, E and F build without 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_untracked fails 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 after bc3c0fc13, change that test.
  • My 2026-10-15 numbers on #6454 came from another stack (main 4186f06a9 plus local changes) and frames 215-260, so they don't compare with these.
  • No gameplay, no other GPU, no Windows.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6237786803 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6237786803). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-17T17:37:05Z. --- 007 First Light (PPSA11386 v01.018.000), main menu, on `main` bc3c0fc13 plus 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: - Linux 7.2.10, Ryzen 9 7950X3D, RTX 3080 10 GB, NVIDIA 615.78.08, GCC 16.2.1, Release, bubblewrap sandbox. The title renders 3840x2160, shown in a 1500x844 window. - Base: `main` bc3c0fc13 (2026-10-16) plus four open shader PRs 007 needs on `main` (#5799, #6317, #6332, #6881). - Each arm merges the PR heads as they are now: #5372 e5390612f, #6454 1752c4a89, #6918 955e7c3c7, #6471 726ef5f9a, #6440 cdb140f49. - #6454's head merges the heads of #6243, #6455 and #6537, so C, E and F carry those three too. - In E, #6440 goes on top of #6454 with the `ResourceMaterializer` and `ShaderMemory.cpp` side of Scramblrrrr's 817a9fda4. #6340, which 817a9fda4 also merges, is not in E. - No other local changes, and the title's executable is not patched (no #6172 change). Scripted pad input goes through `APS5_PAD_INPUT_FILE`, starting from an existing save. - `main`'s defaults plus `APS5_PROFILE_DRAW=1` (for the `[buffers]` counters), `APS5_TRACE_EVENTS=2097152` and `SDL_VIDEODRIVER=x11`. Each arm runs from its own warm shader cache, made by a warm-up run on the same build. - Window: `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: | arm | samples | frame p50 ms | menu reached, s after launch | |---|---|---|---| | A: base | 2 | 2219.9, 1943.0 | ~1170-1280 | | B: + #5372 | 2 | 1497.7, 1501.0 | ~900 | | C: + #6454 | 1 | 1213.0 | ~765 | | D: + #6918 | 1 | 1927.0 | ~1145 | | F: + #5372 + #6454 | 1 | 441.6 | ~395 | | E: + #5372 + #6918 + #6454 + #6471 + #6440 | 2 | 367.8, 365.3 | ~360 | - GPU busy is 177-205 ms per present in every sample except A1 (289). Queue worker 0 is busy 99.8-100% of every window, so the difference between arms is on the CPU side. - From A's mean, B takes 34% of the A→E gain, C 51% and F 96%. A1 and A2 are 277 ms apart; against A1 or A2 alone the shares are 28-39%, 46-54% and 95-96%. - D1 (1927.0) is 16 ms below A2 and has A2's counters: about 500 CPU copies and 1927 ms of `Driver.Packet` per present. No effect was measured for #6918 alone on this base. - Together, #5372 and #6454 gain 1640 ms, against 1451 ms for the two alone added up. That's 189 ms more from A's mean, 51 ms more against A1 alone, and 328 ms more against A2 alone. 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. | | A | B | C | F | E | |---|---|---|---|---|---| | `Driver.Packet` | 1931 | 1486 | 1199 | 432 | 355 | | draw | 1489 | 1396 | 796 | 359 | 291 | | dispatch | 418 | 85 | 370 | 70 | 62 | | capture (draw stage + dispatch) | 1171 | 1190 | 115 | 168 | 91 | | `Resources.Complete` (all threads) | 389 | 55 | 387 | 61 | 61 | | `draw_enqueued` (all threads) | 72 | 41 | 524 | 81 | 83 | `[buffers]` per present: - A, C and D copy guest memory on the CPU, all outside imports: about 495 copies and 5,800 MiB read per present. - B, F and E print no CPU-copy line. The line comes every 1,000 copies, so they made fewer than 1,000 in the whole run. - GPU copies out of imports are about 42 per present on B, F and E, against 34-35 on A, C and D. - No run has an import budget refusal or a failed import. How the two interact. This is our reading of these counters; the parts were not tested apart. - #5372 removes the CPU copies. Dispatch drops to 85 ms, `Resources.Complete` to 55 ms, and the committer's time per commit from 1.37 ms (A2) to 0.22 ms. Capture stays at ~1190 ms. - #6454 cuts the capture from 1171 to 115 ms. Its committer still has the CPU copies: it takes 1.04 ms per commit, and draws wait 741 µs each for room in the 8-deep draw pipeline (4.2 queued ahead on average, against 2.0 on A2). About 450 ms of the saved capture time reappears in `draw_enqueued` (72 → 524 ms). - With both, the committer takes 162 µs per commit, draws wait 109 µs, and `draw_enqueued` is 81 ms. That fits the pair beating the sum: each PR removes the limit the other one leaves. - F is 75 ms slower than E. Its worker-0 capture is 77 ms higher (168 vs 91 ms), the same as its `Driver.Packet` difference (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: - C, D and F have one sample each, and the menu background is animated. A's two samples are 277 ms apart. A1's GPU busy (289 ms) is above every other sample's, which these counters don't explain. - Not rerun on a newer `main`. - #6243, #6455 and #6537 come with #6454's head and weren't separated from it. #6918, #6471 and #6440 weren't run one at a time on top of the pair. - C, E and F build without `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_untracked` fails 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 after bc3c0fc13, change that test. - My 2026-10-15 numbers on #6454 came from another stack (`main` 4186f06a9 plus local changes) and frames 215-260, so they don't compare with these. - No gameplay, no other GPU, no Windows. AI-assisted: yes (Claude Code)
SleglJan commented 2026-10-18 14:55:08 +00:00 (Migrated from github.com)

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 main 1b0c7cfa0 (2026-10-18). Since my earlier comment, #6243, #6537 and #6455 have merged; all three were part of #6454's head. On this base:

  • #5372 alone takes the frame p50 from 1335 to 612 ms (−54%);
  • #5372 and #6454 together take it to 456 ms (−66%).
    The same text is on #5372 and #6454. There is a note on #5372's conflict with main at the end.

Setup:

  • Linux 7.2.10, Ryzen 9 7950X3D, RTX 3080 10 GB, NVIDIA 615.78.08, GCC 16.2.1, Release, bubblewrap sandbox. The title renders 3840x2160, shown in a 1500x844 window.
  • Each arm is built from main 1b0c7cfa0 plus a local commit that logs the window-title FPS:
    • A: #5799, #6317, #6332 and #6881. #6881 has merged since.
    • B: A + #5372 at e5390612f.
    • F: B + #6454 at 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 as 209f3ce87. Against main, #6454's current head 790fe1818 differs from a508aa03c only by those two test lines and five rows in docs/dev/ENVIRONMENT.md, so F has its code.
    • E: F + #6346, #6868, #6465, #6471, #6918 and #6567. #6567 conflicts with #6454 in ShaderResources. In E it keeps #6454's SetAllocation fields, 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.
  • The title's executable is not patched (no #6172 change). Pad input is scripted through APS5_PAD_INPUT_FILE, from an existing save.
  • main's defaults plus APS5_PROFILE_DRAW=1, APS5_TRACE_EVENTS=2097152 and SDL_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.
  • Window: 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).
arm samples frame p50 ms GPU busy ms/present worker 0 Driver.Packet ms/present
A 2 1332.9, 1337.1 186.7, 181.2 1317, 1320
B: + #5372 1 611.6 185.0 606
F: + #5372 + #6454 2 455.1, 456.8 183.8, 185.3 448, 449
E: F + six more 1 362.4 181.8 353
  • The two samples of an arm are 4.2 ms apart on A and 1.7 ms on F. GPU busy is 181–187 ms in every sample, so the difference between arms is on the CPU side.
  • [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.
  • Worker 0, ms per present, A → B → F → E (two values: both samples):
    • Driver.Packet.dispatch 388/387 → 94 → 78/76 → 61;
    • Shader.DrawStage.capture_resources 248/244 → 300 → 97/156 → 85;
    • shader_compile_and_link 391/401 → 420 → 216/279 → 205. capture_resources runs inside it.
  • In F, about 60 ms moves between draw_enqueued and shader_compile_and_link from one sample to the other: 140/82 and 216/279, of which capture_resources is 97/156. Driver.Draw stays at 361/365, and the p50s agree within 1.7 ms.

Against my earlier comment, on main bc3c0fc13 with the same four PRs and harness:

  • A went from 2081 ms (mean of two) to 1335 ms on this main.
  • #5372 alone gave −28% there and −54% here.
  • F (then with #6454's older head 1752c4a89) was 442 ms there and 456 ms here.

#5372 and current main: they conflict in importJoined. #7061 replaced findImport with peekImport on the two lines where this PR drops && low->joined and && high->joined. Arms B, F and E use main's peekImport without the joined condition:
if (const auto* low = peekImport(state, begin, begin + 1); low != nullptr) begin = low->base;, and the same for high. The joinedRun line, tests/BdaResources.cpp and the debt line merge without a conflict.

Not covered:

  • B and E have one sample each, and the menu background is animated.
  • #6454 was not run without #5372 on this base (C in my earlier comment).
  • Main menu only: no gameplay, no other GPU, no Windows.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6251347878 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6251347878). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-18T14:55:08Z. --- 007 First Light (PPSA11386 v01.018.000), main menu, measured again on `main` 1b0c7cfa0 (2026-10-18). Since my earlier comment, #6243, #6537 and #6455 have merged; all three were part of #6454's head. On this base: - #5372 alone takes the frame p50 from 1335 to 612 ms (−54%); - #5372 and #6454 together take it to 456 ms (−66%). The same text is on #5372 and #6454. There is a note on #5372's conflict with `main` at the end. Setup: - Linux 7.2.10, Ryzen 9 7950X3D, RTX 3080 10 GB, NVIDIA 615.78.08, GCC 16.2.1, Release, bubblewrap sandbox. The title renders 3840x2160, shown in a 1500x844 window. - Each arm is built from `main` 1b0c7cfa0 plus a local commit that logs the window-title FPS: - A: #5799, #6317, #6332 and #6881. #6881 has merged since. - B: A + #5372 at e5390612f. - F: B + #6454 at 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 as 209f3ce87. Against `main`, #6454's current head 790fe1818 differs from a508aa03c only by those two test lines and five rows in `docs/dev/ENVIRONMENT.md`, so F has its code. - E: F + #6346, #6868, #6465, #6471, #6918 and #6567. #6567 conflicts with #6454 in `ShaderResources`. In E it keeps #6454's `SetAllocation` fields, 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. - The title's executable is not patched (no #6172 change). Pad input is scripted through `APS5_PAD_INPUT_FILE`, from an existing save. - `main`'s defaults plus `APS5_PROFILE_DRAW=1`, `APS5_TRACE_EVENTS=2097152` and `SDL_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. - Window: `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). | arm | samples | frame p50 ms | GPU busy ms/present | worker 0 `Driver.Packet` ms/present | |---|---|---|---|---| | A | 2 | 1332.9, 1337.1 | 186.7, 181.2 | 1317, 1320 | | B: + #5372 | 1 | 611.6 | 185.0 | 606 | | F: + #5372 + #6454 | 2 | 455.1, 456.8 | 183.8, 185.3 | 448, 449 | | E: F + six more | 1 | 362.4 | 181.8 | 353 | - The two samples of an arm are 4.2 ms apart on A and 1.7 ms on F. GPU busy is 181–187 ms in every sample, so the difference between arms is on the CPU side. - `[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. - Worker 0, ms per present, A → B → F → E (two values: both samples): - `Driver.Packet.dispatch` 388/387 → 94 → 78/76 → 61; - `Shader.DrawStage.capture_resources` 248/244 → 300 → 97/156 → 85; - `shader_compile_and_link` 391/401 → 420 → 216/279 → 205. `capture_resources` runs inside it. - In F, about 60 ms moves between `draw_enqueued` and `shader_compile_and_link` from one sample to the other: 140/82 and 216/279, of which `capture_resources` is 97/156. `Driver.Draw` stays at 361/365, and the p50s agree within 1.7 ms. Against my earlier comment, on `main` bc3c0fc13 with the same four PRs and harness: - A went from 2081 ms (mean of two) to 1335 ms on this `main`. - #5372 alone gave −28% there and −54% here. - F (then with #6454's older head 1752c4a89) was 442 ms there and 456 ms here. **#5372 and current `main`:** they conflict in `importJoined`. #7061 replaced `findImport` with `peekImport` on the two lines where this PR drops `&& low->joined` and `&& high->joined`. Arms B, F and E use `main`'s `peekImport` without the `joined` condition: `if (const auto* low = peekImport(state, begin, begin + 1); low != nullptr) begin = low->base;`, and the same for `high`. The `joinedRun` line, `tests/BdaResources.cpp` and the debt line merge without a conflict. Not covered: - B and E have one sample each, and the menu background is animated. - #6454 was not run without #5372 on this base (C in my earlier comment). - Main menu only: no gameplay, no other GPU, no Windows. AI-assisted: yes (Claude Code)
github-actions[bot] commented 2026-10-19 09:25:33 +00:00 (Migrated from github.com)

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 on main and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both aps5-summary.jsonl lines, attach the two traces and add the output of tools/trace_digest.py.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6263997820 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6263997820). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T09:25:33Z. --- <!-- pr-labels-perf --> This pull request is labeled `perf`, so it needs the summary line of a capture on `main` and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both `aps5-summary.jsonl` lines, attach the two traces and add the output of `tools/trace_digest.py`.
moong15 commented 2026-10-20 02:54:12 +00:00 (Migrated from github.com)

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 main e90a1d180, not the PR head: the head's power-of-two block imports are not on that base. The port is joinedRun returning the crossed run when it is at most the window, plus importJoined widening over any import the buffer starts or ends in.

The joins fire. In queue 0, over the same 90 s window:

phase main e90a1d180 with the join
Resources.Complete 21,198 calls / 7.69 s 12,887 / 0.70 s
Recorder.Sync 9.21 s 5.08 s
Vulkan.Dispatch.shader_resources 8.15 s 1.84 s
Driver.Packet.dispatch 19.24 s 13.36 s

Before 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.draw 33.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 no VUID- errors. agc_driver_bda_device segfaults at startup on main as well on this Windows build, so the BdaResources tests were not exercised here.

main:   {"commit":"e90a1d180268","presents":563,"frame_ms":{"p50":152.762,"p90":191.331,"p99":279.508,"max":430.103},"gpu_busy_ms_per_present":84.852,"worker_busy_pct":{"queue worker 0x0":98.604,"queue worker 0x20":99.748}}
change: {"commit":"7a3240f9dbae","presents":559,"frame_ms":{"p50":155.826,"p90":180.22,"p99":226.521,"max":380.523},"gpu_busy_ms_per_present":84.703,"worker_busy_pct":{"queue worker 0x0":98.382,"queue worker 0x20":99.826}}

Traces (about 40 MB each) are available if useful.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6282235645 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6282235645). Originally posted by [moong15](https://github.com/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 `main` e90a1d180, not the PR head: the head's power-of-two block imports are not on that base. The port is `joinedRun` returning the crossed run when it is at most the window, plus `importJoined` widening over any import the buffer starts or ends in. The joins fire. In queue 0, over the same 90 s window: | phase | main e90a1d180 | with the join | |---|---|---| | `Resources.Complete` | 21,198 calls / 7.69 s | 12,887 / 0.70 s | | `Recorder.Sync` | 9.21 s | 5.08 s | | `Vulkan.Dispatch.shader_resources` | 8.15 s | 1.84 s | | `Driver.Packet.dispatch` | 19.24 s | 13.36 s | Before 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.draw` 33.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 no `VUID-` errors. `agc_driver_bda_device` segfaults at startup on main as well on this Windows build, so the BdaResources tests were not exercised here. ``` main: {"commit":"e90a1d180268","presents":563,"frame_ms":{"p50":152.762,"p90":191.331,"p99":279.508,"max":430.103},"gpu_busy_ms_per_present":84.852,"worker_busy_pct":{"queue worker 0x0":98.604,"queue worker 0x20":99.748}} change: {"commit":"7a3240f9dbae","presents":559,"frame_ms":{"p50":155.826,"p90":180.22,"p99":226.521,"max":380.523},"gpu_busy_ms_per_present":84.703,"worker_busy_pct":{"queue worker 0x0":98.382,"queue worker 0x20":99.826}} ``` Traces (about 40 MB each) are available if useful.
oneandonlydean commented 2026-10-20 03:21:57 +00:00 (Migrated from github.com)

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.Complete 7.69 → 0.70 s, Recorder.Sync 9.21 → 5.08 s and Vulkan.Dispatch.shader_resources 8.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 main e90a1d180, 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6282571408 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6282571408). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T03:21:57Z. --- The numbers show the join doing its job on a Windows AMD device: `Resources.Complete` 7.69 → 0.70 s, `Recorder.Sync` 9.21 → 5.08 s and `Vulkan.Dispatch.shader_resources` 8.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 `main` e90a1d180, 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.
VicRaster commented 2026-10-20 08:18:29 +00:00 (Migrated from github.com)

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. importJoined widens its bounds to those imports; joinedRun then 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:

  • Before: 0ccc15d0af9afcfe906b539d8f404cbc40f743df plus the final test. It fails at the 8 MiB control. A separate diagnostic rerun confirms a successful 16 MiB import marked joined at bind, then the same assertion failure.
  • After: local review commit 545a8a3f9eed6c27984e760d62bb3a10a6ee44f3. Both the normal run and separate diagnostic rerun pass all three cases:
Window / original binding Corrected result
8 MiB / partial 12.5 MiB 13,107,200 bytes copied; initial contents preserved
8 MiB / exact whole 16 MiB zero copied bytes; GPU fill and surrounding bytes preserved
16 MiB / partial 12.5 MiB zero copied bytes; GPU fill and surrounding bytes preserved

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, and agc_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, and VK_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 or VUID- 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 0ccc15d0a
From 545a8a3f9eed6c27984e760d62bb3a10a6ee44f3 Mon Sep 17 00:00:00 2001
From: embersas
Date: Tue, 20 Oct 2026 18:01:15 +1000
Subject: [PATCH] fix(agc): preserve the join bound before import widening

---
 .../Graphics/src/GuestBufferMemory.cpp        |   5 +
 .../tests/execution/HostImportJoinWindow.cpp  | 120 ++++++++++++++++++
 2 files changed, 125 insertions(+)
 create mode 100644 core/libs/prx/libSceAgcDriver/tests/execution/HostImportJoinWindow.cpp

diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
index e863ee351..070e75c78 100644
--- a/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
+++ b/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
@@ -1629,10 +1629,15 @@ const HostImport* importAllocation(const Context& context, HostImports& state, s
 }
 
 const HostImport* importJoined(const Context& context, HostImports& state, std::uint64_t begin, std::uint64_t end, const GuestAllocations::Lease& lease) {
+    const auto boundBegin = begin;
+    const auto boundEnd = end;
     if (const auto* low = peekImport(state, begin, begin + 1); low != nullptr) begin = low->base;
     if (const auto* high = peekImport(state, end - 1, end); 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);
+    const bool exact = boundBegin == run.base && boundEnd == run.base + run.bytes;
+    if (!exact && run.bytes > window && !std::all_of(run.ranges.begin(), run.ranges.end(), [window](const auto& range) { return range->bytes > window; })) return nullptr;
     if (const auto failed = state.failedJoins.find(run.base); failed != state.failedJoins.end() && sameRun(failed->second, run)) return nullptr;
     return importRunAt(context, state, std::move(run), true, begin, lease, end, true, ImportRequester::Join);
 }
diff --git a/core/libs/prx/libSceAgcDriver/tests/execution/HostImportJoinWindow.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/HostImportJoinWindow.cpp
new file mode 100644
index 000000000..0afe06fcc
--- /dev/null
+++ b/core/libs/prx/libSceAgcDriver/tests/execution/HostImportJoinWindow.cpp
@@ -0,0 +1,120 @@
+#include "VulkanTestDevice.hpp"
+#include "prx/libSceAgcDriver/Execution/include/GuestMemory.hpp"
+#include "prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp"
+#include "prx/libSceAgcDriver/Graphics/include/Resources.hpp"
+#include "prx/libc/include/GuestAllocations.hpp"
+#include <cstdint>
+#include <cstdio>
+#include <cstring>
+#include <exception>
+#include <iostream>
+#include <mutex>
+#include <new>
+
+namespace {
+
+namespace Graphics = AgcDriver::Graphics;
+using Graphics::Require;
+
+constexpr std::size_t MiB = 1u << 20u;
+constexpr std::size_t PieceBytes = 4 * MiB;
+constexpr std::size_t AllocationBytes = 8 * PieceBytes;
+constexpr std::size_t BoundBytes = 12 * MiB + MiB / 2;
+
+class Pieces {
+public:
+    explicit Pieces(const Graphics::Context& context) : context(context) {
+        block = static_cast<std::uint32_t*>(::operator new(AllocationBytes, std::align_val_t{4 * PieceBytes}));
+        std::memset(block, 0x11, AllocationBytes);
+        GuestAllocations::Mutation mutation;
+        for (std::size_t index = 1; index <= 4; ++index) mutation.Add(reinterpret_cast<std::uint8_t*>(block) + index * PieceBytes, PieceBytes, true, true, true);
+    }
+
+    ~Pieces() {
+        Graphics::ClearHostImports(context.device);
+        {
+            GuestAllocations::Mutation mutation;
+            for (std::size_t index = 1; index <= 4; ++index) mutation.Remove(reinterpret_cast<std::uint8_t*>(block) + index * PieceBytes);
+        }
+        ::operator delete(block, std::align_val_t{4 * PieceBytes});
+    }
+
+    Pieces(const Pieces&) = delete;
+    Pieces& operator=(const Pieces&) = delete;
+
+    std::uint64_t Address() const { return reinterpret_cast<std::uintptr_t>(block) + PieceBytes; }
+
+    void Check(std::uint32_t pattern, std::size_t boundBytes) const {
+        for (std::size_t index = 0; index < AllocationBytes / sizeof(*block); ++index) {
+            const auto byte = index * sizeof(*block);
+            const auto expected = byte >= PieceBytes && byte < PieceBytes + boundBytes ? pattern : 0x11111111u;
+            Require(block[index] == expected, "a partial joined buffer lost GPU output or changed bytes outside its binding");
+        }
+    }
+
+private:
+    Graphics::Context context;
+    std::uint32_t* block = nullptr;
+};
+
+void CheckWindow(const Graphics::Context& context, std::size_t window, std::size_t boundBytes, bool imported) {
+    Graphics::ClearHostImports(context.device);
+    Graphics::SetHostImportWindow(window);
+    Pieces pieces(context);
+    const auto address = pieces.Address();
+    Require(Graphics::HostImportFor(context, address, 16) != nullptr, "the first registered piece was not imported");
+    Require(Graphics::HostImportFor(context, address + 4 * PieceBytes - 16, 16) != nullptr, "the last registered piece was not imported");
+    Graphics::GuestBufferMemory memory(context);
+    memory.AddWritable(address, boundBytes);
+    memory.Upload(false);
+    const auto copied = memory.CopiedBytes();
+    std::uint32_t adjustment = 0;
+    const auto view = memory.Descriptor(address, boundBytes, adjustment);
+    const auto* direct = Graphics::ExistingHostImportFor(context, address, boundBytes);
+    if (imported) {
+        Require(copied == 0 && direct != nullptr, "an eligible large binding over four pieces was copied");
+        Require(view.buffer == direct->buffer && view.offset + adjustment == address - direct->base, "the partial binding does not refer to its joined import");
+    } else {
+        Require(copied == boundBytes && direct == nullptr, "an 8 MiB window joined a partial binding spanning 16 MiB");
+        memory.WriteBack();
+        pieces.Check(0x11111111u, boundBytes);
+        std::printf("join window %zu MiB, binding %.1f MiB: %zu copied bytes; initial bytes preserved\n", window / MiB, static_cast<double>(boundBytes) / MiB, static_cast<std::size_t>(copied));
+        return;
+    }
+    constexpr std::uint32_t pattern = 0xa5b6c7d8u;
+    Graphics::CommandBatch batch(context);
+    const auto commands = batch.Handle();
+    context.Function<PFN_vkCmdFillBuffer>("vkCmdFillBuffer")(commands, view.buffer, view.offset + adjustment, boundBytes, pattern);
+    VkMemoryBarrier barrier{VK_STRUCTURE_TYPE_MEMORY_BARRIER};
+    barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
+    barrier.dstAccessMask = VK_ACCESS_HOST_READ_BIT;
+    context.Function<PFN_vkCmdPipelineBarrier>("vkCmdPipelineBarrier")(commands, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_HOST_BIT, 0, 1, &barrier, 0, nullptr, 0, nullptr);
+    batch.SubmitAndWait();
+    memory.WriteBack();
+    pieces.Check(pattern, boundBytes);
+    std::printf("join window %zu MiB, binding %.1f MiB: %zu copied bytes; GPU output and surrounding bytes preserved\n", window / MiB, static_cast<double>(boundBytes) / MiB, static_cast<std::size_t>(copied));
+}
+
+}
+
+int main() {
+    try {
+        auto device = OpenVulkanTestDevice();
+        if (!device) return VulkanTestSkipped;
+        const auto context = device->graphicsContext();
+        if (context.hostImportAlignment == 0) {
+            std::puts("skipped, the device does not support host imports");
+            return VulkanTestSkipped;
+        }
+        std::lock_guard lock(AgcDriver::GuestMemory::GpuMutex());
+        CheckWindow(context, 8 * MiB, BoundBytes, false);
+        CheckWindow(context, 8 * MiB, 4 * PieceBytes, true);
+        CheckWindow(context, 16 * MiB, BoundBytes, true);
+        Graphics::SetHostImportWindow(8 * MiB);
+        std::puts("host import join window tests passed");
+        return 0;
+    } catch (const std::exception& error) {
+        std::cerr << error.what() << '\n';
+        return 1;
+    }
+}
-- 
2.56.0.windows.2
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6286630664 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6286630664). Originally posted by [VicRaster](https://github.com/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. `importJoined` widens its bounds to those imports; `joinedRun` then 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: - Before: `0ccc15d0af9afcfe906b539d8f404cbc40f743df` plus the final test. It fails at the 8 MiB control. A separate diagnostic rerun confirms a successful 16 MiB import marked `joined at bind`, then the same assertion failure. - After: local review commit `545a8a3f9eed6c27984e760d62bb3a10a6ee44f3`. Both the normal run and separate diagnostic rerun pass all three cases: | Window / original binding | Corrected result | | --- | --- | | 8 MiB / partial 12.5 MiB | 13,107,200 bytes copied; initial contents preserved | | 8 MiB / exact whole 16 MiB | zero copied bytes; GPU fill and surrounding bytes preserved | | 16 MiB / partial 12.5 MiB | zero copied bytes; GPU fill and surrounding bytes preserved | 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`, and `agc_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`, and `VK_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 or `VUID-` 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. <details> <summary>Complete proposed patch, based directly on 0ccc15d0a</summary> ```diff From 545a8a3f9eed6c27984e760d62bb3a10a6ee44f3 Mon Sep 17 00:00:00 2001 From: embersas Date: Tue, 20 Oct 2026 18:01:15 +1000 Subject: [PATCH] fix(agc): preserve the join bound before import widening --- .../Graphics/src/GuestBufferMemory.cpp | 5 + .../tests/execution/HostImportJoinWindow.cpp | 120 ++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 core/libs/prx/libSceAgcDriver/tests/execution/HostImportJoinWindow.cpp diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp index e863ee351..070e75c78 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp @@ -1629,10 +1629,15 @@ const HostImport* importAllocation(const Context& context, HostImports& state, s } const HostImport* importJoined(const Context& context, HostImports& state, std::uint64_t begin, std::uint64_t end, const GuestAllocations::Lease& lease) { + const auto boundBegin = begin; + const auto boundEnd = end; if (const auto* low = peekImport(state, begin, begin + 1); low != nullptr) begin = low->base; if (const auto* high = peekImport(state, end - 1, end); 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); + const bool exact = boundBegin == run.base && boundEnd == run.base + run.bytes; + if (!exact && run.bytes > window && !std::all_of(run.ranges.begin(), run.ranges.end(), [window](const auto& range) { return range->bytes > window; })) return nullptr; if (const auto failed = state.failedJoins.find(run.base); failed != state.failedJoins.end() && sameRun(failed->second, run)) return nullptr; return importRunAt(context, state, std::move(run), true, begin, lease, end, true, ImportRequester::Join); } diff --git a/core/libs/prx/libSceAgcDriver/tests/execution/HostImportJoinWindow.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/HostImportJoinWindow.cpp new file mode 100644 index 000000000..0afe06fcc --- /dev/null +++ b/core/libs/prx/libSceAgcDriver/tests/execution/HostImportJoinWindow.cpp @@ -0,0 +1,120 @@ +#include "VulkanTestDevice.hpp" +#include "prx/libSceAgcDriver/Execution/include/GuestMemory.hpp" +#include "prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hpp" +#include "prx/libSceAgcDriver/Graphics/include/Resources.hpp" +#include "prx/libc/include/GuestAllocations.hpp" +#include <cstdint> +#include <cstdio> +#include <cstring> +#include <exception> +#include <iostream> +#include <mutex> +#include <new> + +namespace { + +namespace Graphics = AgcDriver::Graphics; +using Graphics::Require; + +constexpr std::size_t MiB = 1u << 20u; +constexpr std::size_t PieceBytes = 4 * MiB; +constexpr std::size_t AllocationBytes = 8 * PieceBytes; +constexpr std::size_t BoundBytes = 12 * MiB + MiB / 2; + +class Pieces { +public: + explicit Pieces(const Graphics::Context& context) : context(context) { + block = static_cast<std::uint32_t*>(::operator new(AllocationBytes, std::align_val_t{4 * PieceBytes})); + std::memset(block, 0x11, AllocationBytes); + GuestAllocations::Mutation mutation; + for (std::size_t index = 1; index <= 4; ++index) mutation.Add(reinterpret_cast<std::uint8_t*>(block) + index * PieceBytes, PieceBytes, true, true, true); + } + + ~Pieces() { + Graphics::ClearHostImports(context.device); + { + GuestAllocations::Mutation mutation; + for (std::size_t index = 1; index <= 4; ++index) mutation.Remove(reinterpret_cast<std::uint8_t*>(block) + index * PieceBytes); + } + ::operator delete(block, std::align_val_t{4 * PieceBytes}); + } + + Pieces(const Pieces&) = delete; + Pieces& operator=(const Pieces&) = delete; + + std::uint64_t Address() const { return reinterpret_cast<std::uintptr_t>(block) + PieceBytes; } + + void Check(std::uint32_t pattern, std::size_t boundBytes) const { + for (std::size_t index = 0; index < AllocationBytes / sizeof(*block); ++index) { + const auto byte = index * sizeof(*block); + const auto expected = byte >= PieceBytes && byte < PieceBytes + boundBytes ? pattern : 0x11111111u; + Require(block[index] == expected, "a partial joined buffer lost GPU output or changed bytes outside its binding"); + } + } + +private: + Graphics::Context context; + std::uint32_t* block = nullptr; +}; + +void CheckWindow(const Graphics::Context& context, std::size_t window, std::size_t boundBytes, bool imported) { + Graphics::ClearHostImports(context.device); + Graphics::SetHostImportWindow(window); + Pieces pieces(context); + const auto address = pieces.Address(); + Require(Graphics::HostImportFor(context, address, 16) != nullptr, "the first registered piece was not imported"); + Require(Graphics::HostImportFor(context, address + 4 * PieceBytes - 16, 16) != nullptr, "the last registered piece was not imported"); + Graphics::GuestBufferMemory memory(context); + memory.AddWritable(address, boundBytes); + memory.Upload(false); + const auto copied = memory.CopiedBytes(); + std::uint32_t adjustment = 0; + const auto view = memory.Descriptor(address, boundBytes, adjustment); + const auto* direct = Graphics::ExistingHostImportFor(context, address, boundBytes); + if (imported) { + Require(copied == 0 && direct != nullptr, "an eligible large binding over four pieces was copied"); + Require(view.buffer == direct->buffer && view.offset + adjustment == address - direct->base, "the partial binding does not refer to its joined import"); + } else { + Require(copied == boundBytes && direct == nullptr, "an 8 MiB window joined a partial binding spanning 16 MiB"); + memory.WriteBack(); + pieces.Check(0x11111111u, boundBytes); + std::printf("join window %zu MiB, binding %.1f MiB: %zu copied bytes; initial bytes preserved\n", window / MiB, static_cast<double>(boundBytes) / MiB, static_cast<std::size_t>(copied)); + return; + } + constexpr std::uint32_t pattern = 0xa5b6c7d8u; + Graphics::CommandBatch batch(context); + const auto commands = batch.Handle(); + context.Function<PFN_vkCmdFillBuffer>("vkCmdFillBuffer")(commands, view.buffer, view.offset + adjustment, boundBytes, pattern); + VkMemoryBarrier barrier{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; + barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + barrier.dstAccessMask = VK_ACCESS_HOST_READ_BIT; + context.Function<PFN_vkCmdPipelineBarrier>("vkCmdPipelineBarrier")(commands, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_HOST_BIT, 0, 1, &barrier, 0, nullptr, 0, nullptr); + batch.SubmitAndWait(); + memory.WriteBack(); + pieces.Check(pattern, boundBytes); + std::printf("join window %zu MiB, binding %.1f MiB: %zu copied bytes; GPU output and surrounding bytes preserved\n", window / MiB, static_cast<double>(boundBytes) / MiB, static_cast<std::size_t>(copied)); +} + +} + +int main() { + try { + auto device = OpenVulkanTestDevice(); + if (!device) return VulkanTestSkipped; + const auto context = device->graphicsContext(); + if (context.hostImportAlignment == 0) { + std::puts("skipped, the device does not support host imports"); + return VulkanTestSkipped; + } + std::lock_guard lock(AgcDriver::GuestMemory::GpuMutex()); + CheckWindow(context, 8 * MiB, BoundBytes, false); + CheckWindow(context, 8 * MiB, 4 * PieceBytes, true); + CheckWindow(context, 16 * MiB, BoundBytes, true); + Graphics::SetHostImportWindow(8 * MiB); + std::puts("host import join window tests passed"); + return 0; + } catch (const std::exception& error) { + std::cerr << error.what() << '\n'; + return 1; + } +} -- 2.56.0.windows.2 ``` </details>
oneandonlydean commented 2026-10-20 08:34:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T08:34:07Z.


@TideOPL, @embersas's case checks out against the code on 0ccc15d0af. importJoined widens begin/end to the neighbouring imports before calling joinedRun, and joinedRun'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 HostImportJoinWindow test? The new head then needs CI again before the gate.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6286894055 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#issuecomment-6286894055). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T08:34:07Z. --- @TideOPL, @embersas's case checks out against the code on `0ccc15d0af`. `importJoined` widens `begin`/`end` to the neighbouring imports before calling `joinedRun`, and `joinedRun`'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 `HostImportJoinWindow` test? The new head then needs CI again before the gate.
jotitadev commented 2026-10-30 23:11:21 +00:00 (Migrated from github.com)

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=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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5719655003 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#pullrequestreview-5719655003). Originally posted by [jotitadev](https://github.com/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=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.
MarcZX10 commented 2026-11-23 03:05:04 +00:00 (Migrated from github.com)

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 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6016114689 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5372#pullrequestreview-6016114689). Originally posted by [MarcZX10](https://github.com/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 `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 pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/5372:upstream-pr/5372'
git switch 'upstream-pr/5372'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/5372'
git switch 'upstream-pr/5372'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/5372'
git switch 'upstream-pr/5372'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/5372'
git switch 'main'
git merge --squash 'upstream-pr/5372'
git switch 'main'
git merge --ff-only 'upstream-pr/5372'
git switch 'main'
git merge 'upstream-pr/5372'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!5372
No description provided.