Repository navigation
Conversation
|
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 ( What it costs, scene, 30 s profile windows, my bring-up build (
With this PR (2 sessions, driver built from your head):
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 |
11fd229 to
1682f90
Compare
1682f90 to
201218a
Compare
|
The full build of this merged with current |
201218a to
eb0e2e6
Compare
|
@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 @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. |
eb0e2e6 to
2764743
Compare
|
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,
Example lines from one run each: In the slow windows the builds that copied cost 380 to 880 µs each ( |
|
Thanks for the rebase. The
|
2764743 to
68f7a25
Compare
|
@oneandonlydean thanks, both done in 68f7a25 (rebased on
|
|
@alfalfa-star thank you for the Kena runs, that's the first RADV result for this and a third title with the same straddle. I've added it to the description. One note: since your run, the join is capped at the 8 MiB import window (68f7a25, from the review above), so a Kena join larger than that would be copied again. If you get a chance to rerun with the current head, it would show whether any of Kena's joins hit the cap. |
|
@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
One current-head run (run 3) aborted during loading. RADV printed AI-assisted: yes (Claude Code) |
Verdictstale+rebase Findings
Freshness envelope
Cross-PR ledger
|
|
Tested a local adaptation of this PR at Two warmed, validation-off menu captures per arm, in A/B/B/A order:
Same Windows Ryzen 9 3900X / RTX 3080 Ti, 3840×2160, draw pipeline off, The final adaptation passed 17/17 focused tests with validation enabled, including GPU output/guard-byte checks. A baseline negative control failed the new eligible interior-join case as expected. Promising menu evidence, but only two short captures per arm, animated content and some run-to-run variation. Gameplay and longer stability remain untested. Large above-window buffer copies still persist; this does not establish that the current PR head is ready to merge. Exact production-code adaptation, relative to diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
index 64de3d8c8d..b5274cbb0a 100644
--- a/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
+++ b/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
@@ -1559,7 +1559,7 @@ ImportRun joinedRun(const GuestAllocations::Lease& lease, std::uint64_t begin, s
auto run = crossedRun(lease, begin, end);
if (run.ranges.empty()) return run;
if (std::all_of(run.ranges.begin(), run.ranges.end(), [window](const auto& range) { return range->bytes > window; })) return run;
- if (begin == run.base) return run;
+ if (begin == run.base || run.bytes <= window) return run;
return {};
}
@@ -1972,10 +1972,19 @@ std::vector<ImportPiece> budgetedImportPieces(const Context& context, HostImport
}
const HostImport* importJoined(const Context& context, HostImports& state, std::uint64_t begin, std::uint64_t end, const GuestAllocations::Lease& lease) {
- if (const auto* low = peekImport(state, begin, begin + 1); low != nullptr && low->joined) begin = low->base;
- if (const auto* high = peekImport(state, end - 1, end); high != nullptr && high->joined) end = high->base + high->bytes;
+ const auto* low = peekImport(state, begin, begin + 1);
+ const auto* high = peekImport(state, end - 1, end);
+ const auto previousBegin = low != nullptr && low->joined ? low->base : begin;
+ const auto previousEnd = high != nullptr && high->joined ? high->base + high->bytes : end;
+ if (low != nullptr) begin = low->base;
+ if (high != nullptr) end = high->base + high->bytes;
auto run = joinedRun(lease, begin, end);
if (run.ranges.empty()) return nullptr;
+ const auto window = importWindow.load(std::memory_order_relaxed);
+ if (run.bytes > window && !std::all_of(run.ranges.begin(), run.ranges.end(), [window](const auto& range) { return range->bytes > window; })) {
+ const auto previous = crossedRun(lease, previousBegin, previousEnd);
+ if (previousBegin != previous.base || !sameRun(previous, run)) return nullptr;
+ }
if (const auto failed = state.failedJoins.find(run.base); failed != state.failedJoins.end() && sameRun(failed->second, run)) return nullptr;
const auto existing = state.imports.find(run.base);
const bool existed = existing != state.imports.end() && sameRun(existing->second, run);
For the standalone regression fixture, I used a 64 KiB interior offset for the 12.5 MiB view: it must copy with an 8 MiB window and import with a 16 MiB window. I separately retained the existing whole-prefix 16 MiB view admission with an 8 MiB window, and checked GPU output plus surrounding guard bytes. AI-assisted investigation and local adaptation. |
main now joins a binding that starts at a range's base at any size. Keep that, and take embersas's adaptation from the PR thread for the rest: a binding from inside a range joins the ranges it crosses when the run, widened to the imports it starts and ends in, fits the window; a wider run is taken only when the joined-only widening already gave that same run from its first range's start. The tests bind from inside a piece, which main copies.
jotitadev
left a comment
There was a problem hiding this comment.
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_journalhitting the 60 s timeout while the machine was loaded. It passes on this merge when re-run alone (2 of 2, 5 to 9 s), and it takes 30 s onmainon lavapipe as well. ninja allplus everyagc*_teststarget builds without warnings from the touched files.- 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 onmaintoo.
Not run: AMD, and a title.
GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02, Linux); lavapipe (Mesa 26.0.3, Linux).
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
✅ NVIDIA GPU test: passedPR head
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validated but not compared (1, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 497 tests)Skipped (45)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
Correction: Previous review flagged verdict should-fix Findings
Freshness envelope
Cross-PR ledger
|
|
007 First Light (PPSA11386 01.018.000) on AMD/Linux, at head 795a53d, and data for the larger-window follow-up discussed above. This PR alone joins only 007's small straddles. The binding that costs most still copies, and joining it takes the first launch options screen from 458 to 141 ms per frame. Setup. Arch Linux, kernel 7.2.11, Ryzen 7 9800X3D, Radeon RX 9070 XT (RADV GFX1201, Mesa 26.2.6), Release, 3840x2160. Every arm also carries #4449 (1f7640b, merged locally onto That leaves the copy in place no matter what Each run used a fresh run directory (cold shader cache), with
The traced window of the last two arms falls on that same screen:
What is copied. A diagnostic build logs each distinct region The first is the 12.5 MiB view @Scramblrrrr described, over a 2 MiB range plus a 12 MiB range (a 14 MiB run). The second is a 96 MiB view over a 2 MiB range plus a 96 MiB range (a 98 MiB run). Both runs are larger than the 8 MiB window, so Lab switch.
This is one AMD machine with #4449 underneath, not the NVIDIA run requested for the follow-up. Later in the game, same lab build. I ran 1800 s from the same run directory (shader cache warm from the run above), with At 1290 s, in the next scene (GPU busy 800-1,076 ms per present), our desktop memory guard stopped the run: @TideOPL is anyone already on the larger-window follow-up? If not, I can open it on top of this PR with @Scramblrrrr's 12.5 MiB fixture and the 98 MiB case above, and ask for an NVIDIA run at the new size. AI-assisted: yes (Claude Code) |
|
@TideOPL #15658 changes the same line of One interaction: this PR's cap in AI-assisted. |
|
Independent check on Windows/AMD. Head A/B on an RX 6800 XT (Windows 11 IoT Enterprise LTSC 26100, Ryzen 5 5600, AMD 26.10.1, Vulkan 1.4.315). Same tree, only
Order with #15658: that PR adds a neighbouring condition to the same line (first range larger than the window, the rest fits). The window cap here refuses exactly that case, and its author says they will rebase and exempt it if this lands first. Settle the order before merging either. The |
|
Re-checked on current
Is widening to a non-joined import needed for the scenario this PR targets? If it is, |
|
Hi @TideOPL, Thanks for the PR. On current main it no longer passes The cause is in if (low != nullptr) begin = low->base;
if (high != nullptr) end = high->base + high->bytes;Main only widens to imports that are joined ( Could you pick one of these?
Either way, please merge current main into the branch so the run covers the new test. |
|
Coordination on the remaining large interior-start case: I have ported our previously Windows-tested extension onto main d642b4e as WIP The predicate allows This refreshed head is source-only and has not been built or title-tested yet; no new upstream PR or FPS claim. The October head had native positive/production-negative/restored proof. Full overlap review also found the straddling experiment in #18515, which I am coordinating separately. Let me know if your scope already includes this large case; I want to avoid duplicating it. AI-assisted: Codex. |
MarcZX10
left a comment
There was a problem hiding this comment.
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.
A buffer bound from inside one registered range into the next is now joined with the ranges it crosses, when the run fits the 8 MiB import window.
maincopies it on the CPU for every bind.What
Since #9652,
mainjoins a buffer bound from the start of a range across adjacent ranges, at any size. That covers the case this PR was first written for (Minecraft Dungeons II binds from a piece's start), so the PR now carries only whatmainstill copies: a binding that starts inside a range. Stellar Blade, Stray and 007 First Light bind such buffers every frame; the numbers are in the comments below and summarised under Tested.The branch is merged with
main16345ca (795a53d). The code is @embersas's adaptation from the thread, unchanged:joinedRunalso returns the crossed run when it is no larger than the window:if (begin == run.base || run.bytes <= window) return run;.importJoinedwidens the binding to any import it starts or ends in, not only joined ones, so binds across an import and its neighbour merge into one import instead of retiring each other.mainadmits stays admitted. Otherwise the buffer is copied and no import is retired. This closes the bypass @embersas found on the previous head, where widening to the imports at both ends of a 12.5 MiB binding made it look exact and joined 16 MiB under an 8 MiB window.main(2,980 characters); this adds 121.Tested
Windows 11, Ryzen 7 7800X3D, RTX 5070 (NVIDIA 610.88), WinLibs GCC 15.2, Release.
importJoinTests(agc_driver_graphics). It binds 32 bytes from 16 bytes before the end of one 64 KiB piece into the next and requires one import over both, with nothing copied. Withmain'sGuestBufferMemory.cppit fails witha buffer bound from inside one piece into the next, both no larger than the import window, was not imported over both pieces. The test also checks that the following prefix bind uses the same import.agc_driver_host_import_join_window(execution test, @embersas's, adapted tomain's prefix rule). Four adjacent 4 MiB pieces, the first and last imported:mainan eligible large binding over four pieces was copied)Suites.
ctest -R "^agc_driver|^guest_memory|^guest_allocations"on this head: 828 of 828 pass, 8 skipped (as onmain).Conventions.
tools/check_conventions.pyreports only the debt-length warning above.Minecraft Dungeons II (PPSA16064), Squid Coast spawn,
mainvs this PR.main16345ca: one as is, one with this PR'sGuestBufferMemory.cppchange. Both carry three local patches: a window-placement switch; a trigger that opens the trace window at the gameplay HUD; andlibSceHttp2as ofmaine25333e. Currentmainaborts MCD2's boot withsceHttp2SetRedirectCallback not implementedand thensceHttp2SendRequestAsync not implemented; feat(http2): deliver redirect callbacks and follow HTTPS redirects #11575 implements the first.APS5_TRACE_SECONDS=25:15withAPS5_TRACE_EVENTS=1048576. Warm-up boot per side, then interleaved runs.mainalready joins. The twomainruns differ by 36 ms p50, so the pair only shows the profiles match:Driver.Packet/memory_wait/Graphics.Drawms/framemain1main2Summary lines (
main2, this PR 2)tools/trace_digest.pyon both traces gives the same largest slices within 2 % (Driver.Packet259.8 / 263.2,memory_wait85.7 / 87.9,Graphics.Draw60.9 / 62.0,Driver.Packet.dispatch57.9 / 57.5 ms per frame). The traces are not attached; I can share them on request.Titles that bind from inside a range (other testers, details in the comments):
mainbb04a4f, A/B/B/A. Frame p50 was 610 / 608 ms onmainand 451 / 505 ms with the change. Their baseline failed the new interior-join test, as it should.maine90a1d1. Over 90 s,Resources.Completewent from 7.69 to 0.70 s,Recorder.Syncfrom 9.21 to 5.08 s andVulkan.Dispatch.shader_resourcesfrom 8.15 to 1.84 s. Presents didn't change (563 vs 559): queue 0 is draw-bound there.mainand 273 MiB with the change. Mean presents per 10 s went from 20.1 to 24.5, andUploadFinishwrite-back waits went from 230–254 per 10 s to 0.Not run.
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation): the layer isn't installed on this machine.main.Earlier results, against
mainbefore #9652These measured earlier heads, when this PR also joined bindings from a range's start;
mainnow does that itself.main77b9f72 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.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)