perf(agc): reuse read-only address-based draw builds over their cached address space #13858

Merged
EagleBearerYS merged 25 commits from upstream-pr/13858 into main 2026-11-04 08:31:53 +00:00
EagleBearerYS commented 2026-10-31 09:46:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-31T09:46:10Z.


What

Builds on @Raghav314's space reuse from #9508. With his agreement (comment), the first commit takes spaceReuse, RetakeSpace, SnapshotsServedInPlace and their hit path out of his 1be42301d4. It keeps his authorship, with my co-authorship line as in his commit. Stacked on #8963.

A recorded draw whose stages only read through the BDA table, and whose bindings all lie in its cached address space, now reuses its build instead of building its resources again for every draw. Today every address-based draw builds anew. In Resident Evil Village (PPSA01556)'s menu that's about 4,300 draws per 10 s on the draw committer.

  • What the reuse proves: the cached build's snapshots must be served in place from the same space (#9508's containment proof), and the space is retaken for the use.
    • A moved read-only buffer inside the space is rebound per draw (#9508's usesBda lift).
    • Any other change refuses the reuse and builds as today: a snapshot outside the space, a partial overlap, a snapshot changed, a moved buffer under a pending write, a patched data word, a space or epoch change, a build in use, or a failed revalidation.
    • A build that stores through an address is never reused.
  • On by default. APS5_NO_ADDRESS_DRAW_REUSE=1 builds every draw anew. Its row in ENVIRONMENT.md replaces the APS5_GPU_HEAP gate the pieces had in #9508.
  • The commits:
    1. ee52ec9ef9 (@Raghav314): the reuse over the cached space, behind his APS5_GPU_HEAP gate.
    2. b4947ff328: on by default, plus the hit-path fixes the default needs. A hit that retook the space gives it back on every path, so the cached build never pins the space's allocations and a free never waits out APS5_PIN_WAIT_MS:
      • a hit that throws before it is served releases the space, through a guard;
      • a draw that ends without being recorded releases it;
      • the transition path's fresh build releases it;
      • a second ReleaseSpace no longer resets the released space;
      • no draw recipe is made from a space-reuse build, since a recipe's proof neither retakes the space nor checks the snapshots.
    3. 79ba14fcfe: each use of a reused build gets its own BDA fault record. This is #8971's mechanism adapted to draws. The first use in flight takes the build's own #8963 slot. A concurrent use takes its own slot and sets, and each completion checks and clears its record, so a fault is reported once, at its own use.
    4. ac1980aa7f: counters. With APS5_PROFILE_DRAW, [rescache] address-based draws (10 s): reused N, built M; refused: … counts every address-based draw under exactly one outcome.
    5. 93dfd64f76: recorded writes first. A hit completes recorded GPU writes over its snapshot ranges before the containment proof. It also adds the technical-debt entry.
    6. 69a10da544: a merge of main (0835ec8bdc). The only conflict was ENVIRONMENT.md, where both rows are kept.
    7. 7122193668: a merge of #8963's own merge of main (d958699e8b, main 6a691f69ee).
      • The one conflict is noteReusable's condition, against #8105's pending HTILE clear rule. Both are kept: a build carrying a pending HTILE clear is never reusable, and that includes a space reuse (spaceReusable requires !htileClear.has_value()).
    8. 48347d94ed: the debt entry moves under ### Functional, since the reuse is on by default. It now describes the one title the reuse was measured in, Resident Evil Village (PPSA01556)'s menu, as that run was made.
    9. d214fad61a: the GPU lock, asserted. RetakeSpace, ReleaseSpace and SpaceHeld read and write the space of a build that SharedResourceCache() shares between draws.
      • Where they're called: only inside Graphics::Draw (resolveDrawResources, keepRecordedDraw, the transition path's rebuild, and the HeldSpace cleanup).
      • The lock: GuestMemory::GpuMutex(). The driver reaches Graphics::Draw only through VulkanDevice::Draw, and every caller of that holds the mutex: Driver::finishDraw through lockForDraw(), before the indirect and direct inline draws, and Driver::commitDraw through its lock_guard, for pipelined draws. The HeldSpace cleanup runs inside Draw, so it's under the lock too.
      • Paths that never reach them: the recipe path, since no recipe is made from a space-reuse build, and dispatches, since spaceReuse is set for draw builds only.
      • The asserts: all three now call GuestMemory::AssertGpuLockHeld, so a caller without the mutex aborts under APS5_ASSERT_GPU_LOCK=1.
    10. 86b29f0d72: APS5_VERIFY_ADDRESS_DRAW_REUSE. Every served hit's resources are built anew, and the draw throws on the first difference.
      • What it compares: whether the fresh build is itself a space-reuse build, the BDA table bytes, every snapshot lying in readable table ranges, every snapshot's bytes against guest memory, and the textures, storage images and set layouts.
      • What it doesn't compare: buffer descriptors, since a moved read-only buffer is rebound at record time, and push constants. Textures are compared by identity, not contents.
      • It costs a full build per hit, so it's a diagnosis switch.
    11. 8a85451640: the HeldSpace cleanup no longer allocates or throws.
      • A recorded draw reserves the keep for its retaken space through the checked Recorder::Keep, once it holds the command buffer it records into. The release then moves into that holder.
      • Every other way out of Draw() makes the same checked reservation in a catch-and-rethrow.
      • The cleanup only does noexcept moves. If no holder could be reserved, the build keeps the space until the recorder's serial that was open at the failure has completed.
    12. a142526a55: a hit rechecks its BDA table against new multisample targets. A build now keeps the multisample-target guard generation its table was filtered at.
      • When that has moved: the hit reruns ExcludeMultisampleTargetRanges, the function a fresh build calls, over the build's space ranges. It keeps the hit if the result matches the table, and refuses it as a space or epoch change if not.
      • What it closes: a resident multisample target that appears inside the space no longer leaves a hit binding a table that still covers it.
    13. 8139afd48f: a held space is retained until its batch completes, for @oneandonlydean's correction (comment).
      • The gap: the HeldSpace cleanup's fallback (item 11) left the space's one owner in the cache entry. The entry can leave the shared resource cache while the space is held: Remove, RemoveImage, eviction, or a fresh build of the same key replacing it. The space then went with it.
      • The retention: every place that attaches a space (RetakeSpace, the cached hit and a fresh build) first allocates the build's retention node. ~GuestBufferMemory moves a held space into that node and pushes it onto a lock-free list, without allocating.
      • The hold records the recorder's id with its serial, since a serial means nothing on another recorder.
      • The release: a retained space goes once that recorder has completed the serial, or no longer exists. That's checked at the next cached lookup, in the pin waiter after its sync, and at device teardown. The pin waiter's check keeps a free inside a retained space from waiting out APS5_PIN_WAIT_MS.
      • The lock: two threads never touch one cache entry's space at once. Every read and write of it (RetakeSpace, ReleaseSpace, SpaceHeld, HoldSpaceThrough, ReleaseCompletedSpace and the retention's release) runs under the GPU lock, GuestMemory::GpuMutex(), and asserts it (item 9). The one exception is ~GuestBufferMemory. It runs when the entry's last reference goes, so no other thread can reach its space, and the release thread may run it without the lock, which is why its hand-over is a lock-free push.
    14. 5479721abf: tests for a failed keep. Two test hooks make the keep reservation fail (SetSpaceKeepFailuresForTest) and stop a draw after its resources resolve (SetDrawStopAfterResolveForTest). agc_driver_address_draw_space_reuse_held runs two cases, each for an unrecorded early return, an exception during preparation and a recorded draw, with the keep failing.
      • held-space-retaken: the bad_alloc reaches the caller. Once the held serial completes, the same build retakes its space and is served without a build.
      • held-space-in-use: before the held serial completes, the next draw is refused as in use and builds. When that fresh build replaces the holding build in the cache, the space stays retained until the batch completes, and is released after it.
      • APS5_RELEASE_ON_UNLOCK=1 is set on the registration, for the test's determinism only; it masks no fix. Without it, the replaced build is still retained the same way, but it is released later on the release thread, so the test's retention count would race with it.

Overlap:

  • #9508 (@Raghav314) carries the same pieces in his own commit, and now also commit 2's hit-path fixes, as his 1817bbed4b, 270d43a865 and 758d23c805. No landing order is needed, as he wrote: whichever lands second drops the shared pieces when it refreshes.

  • Our own #7642, and @Celegans12's #10193, carry 1be42301d4 too, through #9508, and the same holds for them.

  • #13610 (@ntamas94) relocates cached draws across moved user-data V#s, upstream of this build. It merges cleanly with this change, and the two compose.

  • #5609 (@TheAggie) relocates cached draw stages whose descriptor words differ only in buffer base addresses, in the draw cache. This change reuses the resource build of draws that read only through the BDA table, so the two apply to different draws and compose. They share CMakeLists.txt and Graphics/src/Draw.cpp, and #5609's conflicts with main are the same with this branch merged (15 files either way).

  • #12745 and #12840 (ours) each have one small resolution against this change:

    • #12745: its per-element texture rebinding (rebound) goes into the writeDrawSets that commit 3 moved the sets into;
    • #12840: ShaderResources.hpp keeps its StorePages() beside this change's SpaceReuse().
  • Earlier attempts:

    • our #6636 matched address-based draws by index, and reused 0 of 17,613 Village draws because their constant rings move. This change serves the moved rings from the space instead;
    • our #8971 did the same per-use fault record for dispatches.
  • Related: #7895 (the draw committer bounds draw-heavy titles).

Tested

  • Tests: agc_driver_address_draw_space_reuse (tests/execution/AddressDrawSpaceReuse.cpp), with _off (APS5_NO_ADDRESS_DRAW_REUSE=1) and _transitions (APS5_DRAW_TRANSITIONS=1) registrations. The scene is a full-screen draw whose pixel shader loads its constant through a user-data pointer, with its shader code in a registered allocation.

    case commit checks red
    unchanged 2 twice unchanged, served without a build on 1: "built its resources again (1 builds)"
    cpu-write 2 a CPU write is seen, and served reuse off: 1 build
    idle-free 2 a free inside the space while idle returns at once without the release, the free waits the full 4,000 ms pin wait
    no-recipe 2 no recipe is made from a space-reuse build the recipe rule removed: a recipe is made
    moved-vertices 2 renders after a vertex move, and a free returns at once
    fault-per-use 3 each fault in a pair of concurrent uses is reported once, at its own address on 2: the faulting use's fault is reported twice
    counters 4 each refusal under its reason; the outcomes add up to the draws
    pending-snapshot-write 5 a fill over a captured pointer, then the draw in the same batch: snapshot changed, rebuilt on 4: "counted reused 1 and 0 builds"
    ring-same-constants, ring-own-constants 5 an 8-slot constant ring with the slot as the snapshot: 15 of 15 reused, each draw with its own value reuse off: 15 builds
    ring-old-slot-write 5 a CPU write to the previous slot after its draw is recorded leaves that draw's result alone; 7 of 7 reused reuse off
    ring-refusals 5 a moved snapshot outside the space: "snapshot outside"; a moved V# inside: reused; a moved V# under a pending fill: refused reuse off
    held-space-retaken (_held) 14 a failed keep in an early return, a throw and a recorded draw: the bad_alloc reaches the caller, and the held space is retaken and served after its serial completes none: the old code passes these checks too, since nothing in them uses the space on the GPU
    held-space-in-use (_held) 14 the same three: refused as in use before the serial completes; a fresh build replacing the holder leaves the space retained until then, and released after the retention count needs commit 13's code
    • Linux (Ubuntu 24.04, GCC 13.3, Release, lavapipe, as an unprivileged user): the three registrations passed 20 of 20 at 93dfd64f76. ^agc: 1130 passed, 74 skipped, 0 failed.
  • GitHub ×10 on the head 7122193668 (^agc_driver_address_draw_space_reuse, ^agc_driver_bda, ^agc_bda, which takes #8963's tests too) (run):

    • Linux: 50 tests, 10 of 10 passed, 0 skipped.
    • Windows: 49 tests, 10 of 10 passed, 11 skipped (no Vulkan device on the runner).
    • The libc and libkernel suites: 0 failed (Linux 199 and 308, Windows 226 and 330).
    • On 69a10da544, before #8963's main merge (run): Linux 50 tests passed 10 of 10 with 0 skipped; Windows 49 passed 10 of 10 with 11 skipped (no Vulkan device on the runner). The libc and libkernel suites ran with 0 failed (Linux 199 and 308, Windows 226 and 330).
  • A full ^agc sweep on the head 7122193668, once each on GitHub's runners (run):

    • Windows: 1,185 tests, 357 passed, 828 skipped, 0 failed.
    • Linux: 1,150 tests, 1,074 passed, 75 skipped, 1 failed. The failure was agc_driver_pipeline_journal, which timed out at 120 s.
    • That test's first run is slow on its own. Run alone, its first run took 108.3 s on this head and 102.9 s on #8963's main merge (d958699e8b), one run each. Every later run took 7.9 s on both heads. It passed 5 of 5 here (run) and 3 of 3 on d958699e8b (run).
  • Validation comparison (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, ctest -V; main against this change, GitHub's Linux runner, llvmpipe), on 69a10da544, the head before #8963's main merge (run):

    • the layer loaded in both logs, and was not found appears 0 times in each;
    • the only VUID is VUID-VkDeviceCreateInfo-pNext-pNext, in both, so the change adds none;
    • the GPU was llvmpipe (LLVM 20.1.2), Mesa 25.2.8, on Ubuntu 24.04.5;
    • 50 tests passed with the change. On Windows, where the layer isn't run, 49 passed and 11 skipped.
  • Windows on an AMD GPU, by @JJenkx (comment): the head 7122193668 merged locally onto main c3c45d73ab (clean). Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, Radeon RX 6700 XT with AMD's driver 26.10.1 (Vulkan 1.4.315), WinLibs GCC 15.2.0, Release, with the Khronos validation layer 1.4.363 requested for every test.

    • The 44 tests of agc_driver_address_draw_space_reuse_tests, agc_driver_bda_device_tests and agc_driver_graphics_tests, the binaries this PR's test files build into, pass 3 of 3 runs each, with none skipped.
    • The layer was inserted 15 times across the runs and reported no VUIDs.
  • Resident Evil Village (PPSA01556), Windows, on our Village measurement tree, not main. That tree is cd88cee814, a local measurement tree: an older main (merge base 949c9cf477) with #12745, #12478, #12921, #11580, #10304, #9243, #9248 and #1896 merged, plus #8963 and this PR's five commits (697706893b).

    • Machine: NVIDIA GeForce RTX 3070 Laptop GPU, driver 617.42, Windows 11 (10.0.26300). GPU clocks were not held.

    • Profiled boot (APS5_PROFILE_DRAW=1, menu +5 to +15 min, medians per 10 s): reused 3,336 (2,183 to 4,387), built 8, refused "not space-only" 152 and "space or epoch change" 768, and 0 snapshot refusals, of about 4,264 address-based draws. It renders like the same tree without this change.

    • Unprofiled pair, A B B A, the same libraries in both arms:

      • Arms: A has the reuse off (APS5_NO_ADDRESS_DRAW_REUSE=1), and B has it on. So this measures this change over #8963, with nothing else differing.
      • Env: APS5_LAZY_SHADER_PREPARE=1 APS5_NO_GPL=1 APS5_HOST_IMPORT_MIB=6400 APS5_TABLE_INDEX=1 APS5_PIPELINE_INDIRECT=1 APS5_DRAW_CACHE_INDIRECT=1 APS5_DRAW_CACHE_PUSH_WORD=1 and the pad script. Warm shader cache, the same key in all four runs, 0 cache misses.
      run A1 (off) B1 (on) B2 (on) A2 (off)
      fps, menu +5 to +15 min 0.858 0.970 0.933 0.833
      p50 / p90 frame 1.13 / 1.45 s 0.99 / 1.18 s 1.04 / 1.27 s 1.17 / 1.48 s
      non-game CPU 42.2 % 37.0 % 42.1 % 40.0 %
      • The gain: B's mean is 12.5 % above A's, and both B runs are above both A runs. The two A runs are 2.9 % apart.
      • The load caveat: non-game CPU spans 5.2 points, and B1 ran lighter. At matched load, B2 (42.1 %) is 10.3 % above A's mean.
      • Per frame, B against A: Driver.Packet.draw −13.8 %, Graphics.Draw −15.2 %. Renders match by a static-region pixel diff at menu +5 and +10 min.
    • Traces, captured as the Performance report form describes. One boot per arm with only APS5_TRACE_SECONDS=960:30 added: a 30 s window, 16 min into the menu hold.

      • The results: A's frame p50 and p90 are 1,021 and 1,317 ms, and B's are 900 and 1,131 ms, so B is 11.9 % lower at p50 and 14.1 % lower at p90.
      • The caveat: it's one window per arm, so not pair-grade. B also ran under 5.6 points less non-game CPU (30.8 % against 36.4 %).
      • Both summary lines have the same commit, because the arms differ only in the switch:
      {"commit":"697706893b77","dirty":false,"env":{"APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_HOST_IMPORT_MIB":"6400","APS5_LAZY_SHADER_PREPARE":"1","APS5_NO_ADDRESS_DRAW_REUSE":"1","APS5_NO_GPL":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINE_INDIRECT":"1","APS5_TABLE_INDEX":"1","APS5_TRACE_SECONDS":"960:30"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 9 5900HS with Radeon Graphics","cpu_threads":16,"memory_mib":15776,"title_id":"PPSA01556","title":"Resident Evil Village","content_version":"01.210.000","resolution":"3840x2160","window":{"spec":"seconds 960:30","first_present":3010,"ms":30030.909},"presents":28,"frame_ms":{"p50":1021.251,"p90":1317.312,"p99":1486.142,"max":1486.142},"gpu_busy_ms_per_present":246.597,"worker_busy_pct":{"queue worker 0x0":99.385,"queue worker 0x38":0.073,"queue worker 0x20":86.352,"queue worker 0x28":92.349},"top_phases_ms_per_frame":{"Driver.Packet":2977.678,"Driver.Packet.memory_wait":1668.358,"Graphics.Draw":731.397,"Graphics.Draw.draw_and_resource_release":713.428,"Driver.Packet.draw":639.264,"Driver.Draw":638.291,"Driver.Packet.dispatch":621.523,"Driver.Dispatch":482.170},"trace_dropped":false,"trace":"aps5-trace-697706893b77-10224.json.gz"}
      {"commit":"697706893b77","dirty":false,"env":{"APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_HOST_IMPORT_MIB":"6400","APS5_LAZY_SHADER_PREPARE":"1","APS5_NO_GPL":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINE_INDIRECT":"1","APS5_TABLE_INDEX":"1","APS5_TRACE_SECONDS":"960:30"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 9 5900HS with Radeon Graphics","cpu_threads":16,"memory_mib":15776,"title_id":"PPSA01556","title":"Resident Evil Village","content_version":"01.210.000","resolution":"3840x2160","window":{"spec":"seconds 960:30","first_present":2105,"ms":30558.779},"presents":32,"frame_ms":{"p50":899.783,"p90":1131.300,"p99":1614.083,"max":1614.083},"gpu_busy_ms_per_present":254.399,"worker_busy_pct":{"queue worker 0x0":99.326,"queue worker 0x38":0.072,"queue worker 0x20":84.794,"queue worker 0x28":91.311},"top_phases_ms_per_frame":{"Driver.Packet":2625.941,"Driver.Packet.memory_wait":1436.447,"Graphics.Draw":615.152,"Driver.Packet.dispatch":603.060,"Graphics.Draw.draw_and_resource_release":596.195,"Driver.Packet.draw":540.361,"Driver.Draw":539.426,"Driver.Dispatch":467.563},"trace_dropped":false,"trace":"aps5-trace-697706893b77-28528.json.gz"}
      
  • a142526a55, the five review commits above, on GitHub's runners:

    • ×10 of ^agc_driver_address_draw_space_reuse, ^agc_driver_bda and ^agc_bda (run), agc_driver_address_draw_space_reuse_verify included:
      • Linux: 51 run, 51 pass, 0 skip, 0 fail.
      • Windows: 50 run, 38 pass, 12 skip (no Vulkan device), 0 fail.
    • Validation, main against this head, the same tests, on GitHub's Linux runner (layer 1.3.275) (run):
      • they pass on both arms;
      • the loader inserted the layer 8 times on main and 12 with this head, and neither log has was not found;
      • both report only VUID-VkDeviceCreateInfo-pNext-pNext, so the change adds none.
    • ^agc once (run):
      • Linux: 1,151 run, 1,075 pass, 75 skip, 1 fail. agc_driver_pipeline_journal timed out at 120 s, the cold-compile timeout this PR's earlier sweep also hit. Alone ×5 (run) it passes 5 of 5: 62.13 s for the first run, and about 5.1 s for each after.
      • Windows: 1,186 run, 357 pass, 829 skip (no Vulkan device), 0 fail.
  • The review commits on a cloud Linux machine (lavapipe, LLVM 20.1.2, Mesa 25.2.8), this PR's set ×10 after each commit:

    • d214fad61a (the lock):
      • The reuse tests pass 10 of 10 with APS5_ASSERT_GPU_LOCK=1.
      • Over ^agc with that switch, 447 of 1,150 tests abort at asserts that were already there, in harnesses that drive the device without the GPU lock: Recorder::Commands 255, TextureDetiler::BeginBatch 174, Recorder::Submit 6, CommandBatch 6, the heap mirror transfer 1 and KeepThroughHold 1. None abort at the three new asserts.
      • An earlier abort in such a harness could hide a later lock-less call, so the caller chain in item 9 is what shows the lock is held on the driver paths.
    • 86b29f0d72 (the verify switch):
      • agc_driver_address_draw_space_reuse_verify runs the default cases with the switch on and requires every served hit to be verified. At a142526a55 it verifies 76 of 76.
      • The red is a local change, not committed: with the snapshot byte compare removed, the switch stops with "a served address-based draw hit disagrees with a fresh build or guest memory in its snapshot bytes", while without it the stale hits are served.
    • 8a85451640 (the cleanup): a standalone probe with a Recorder::Keep that throws std::bad_alloc covers three cases: an unrecorded early return, an exception during preparation, and a failed recording.
      • With the old cleanup, all three end in terminate called after throwing an instance of 'std::bad_alloc' (exit 134).
      • With the new code, the bad_alloc reaches the caller in all three.
    • a142526a55 (the multisample recheck): multisample-target-inside places a resident 4x target in the draw's registered allocation, 32 KiB from the word the draw reads, between two draws.
      • Without the fix it fails with "a draw after a resident multisample target appeared inside its address space counted reused 1 and 0 builds, expected one refusal for a space change and a build".
      • With it, the hit is refused as a space change, and the draw builds anew.
      • multisample-target-outside keeps the hit with and without the fix.
      • What the test checks: the refusal and the rebuild, not a fault on the target's address. Placed over the read word, the fresh build's SGPR-base global_load_dword crashes llvmpipe instead of reporting a fault. That crash also happens with the reuse off and with no multisample target, so it's outside this change.
    • At a142526a55: ctest -R '^(agc|shader)' 1,163 passed, 75 skipped, 0 failed.
  • Grand Theft Auto V (PPSA04263) and Diablo II: Resurrected, by @mrfelek (comment), on main 02c8efdbcb with #11580 and this PR's 7122193668. Linux, Ryzen 9 5950X, RTX 3080 Ti (NVIDIA 615.71.09), Release; GPU clocks not reported.

    • GTA V, at North Yankton's bank, 3840x2160, warm caches:
      • [rescache] address-based draws (10 s): reused 58, built 0, with every refusal at 0. That's about 2 address-based draws per frame of about 865, every one reused.
      • Off (APS5_NO_ADDRESS_DRAW_REUSE=1) and on, alternating, gave 60, 61, 61 and 61 presents per 20 s. That's level, as expected with this few draws on the path.
    • Diablo II: Resurrected, main menu: no address-based draws line, so none of its draws take this path.
    • No failures or rendering problems in any run.
  • ba0b958b1c, a merge of main 0836dfdf4f (run). #12862 moved libSceAgcDriver's test registrations into tests/cmake/; the conflict in CMakeLists.txt is resolved with tools/agc_test_split.py resolve, which moves this PR's _off, _transitions and _verify registrations into a new tests/cmake/agc_driver_address_draw_space_reuse_tests.cmake (+20). Nothing else conflicted. #7642 creates a fragment of the same name for its own variants, so whichever of the two lands second keeps both sets there. Apart from the move, this PR's diff is unchanged. With -DBUILD_TESTING=ON, ctest -N gives 3079 tests: main's 3075 plus its 4 tests, each listed once. The 12 tests matching ^agc_driver_address_draw_space_reuse|^agc_driver_bda|^agc_bda pass 10 runs in a row. Linux: 12 run, 12 pass, 0 skip, 0 fail. Windows: 12 run, 1 pass, 11 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (199 and 308) and on Windows (226 and 330). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.

  • 023b4a26d8, a merge of main 5f0857ee2e, which brings tibzejoker's #7261 (×10, validation).

    • The one conflict was the first lines of ShaderResources::noteReusable, where #7261 resets importsReconcilable and this PR resets spaceReuse on the same line. The merge keeps both resets, main's first. The two flags are independent: importsReconcilable is set again on the direct-regions path, and spaceReuse on the space-reuse return. Nothing else conflicted, and this PR's diff is unchanged.
    • ×10: the tests above with #7261's agc_driver_host_import_proofs. Linux: 13 run, 13 pass, 0 skip, 0 fail. Windows: 13 run, 1 pass, 12 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (206 and 308) and on Windows (233 and 330). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
    • Validation (VK_LAYER_KHRONOS_validation on GitHub's Linux runner), main 5f0857ee2e against this merge, for the same tests. The layer was inserted in both arms, 9 times on main and 13 with this merge. The only VUID in either arm is VUID-VkDeviceCreateInfo-pNext-pNext, so the merge adds none.
  • NVIDIA RTX 2000 Ada Generation at 023b4a26d8, from TechLevelZero's NVIDIA bot (report): this head merged onto main e6f5730, driver 595.99.02, Ubuntu 26.04.1, 2,536 of 3,148 tests selected.

    • 2,484 passed, 7 failed and 45 skipped. None of the failures is new: 3 also fail on main, and 4 are unstable on main.
    • With VK_LAYER_KHRONOS_validation, no new validation IDs over 935 GPU tests. This PR's agc_driver_address_draw_space_reuse passed on the GPU; it isn't in main's baseline, so its validation wasn't compared. agc_driver_draw_cache_reuse and agc_driver_draw_cache_relocation passed too.
  • 7aeb568a2d, a merge of main 88e804b0a7 (run). Two conflicts, each a pair of additions at the same place, and the merge keeps both: this PR's BdaResources.hpp include in Recorder.cpp beside main's ReferenceStorage.hpp include, and this PR's "Reused address-based draw builds" entry in docs/dev/debt/libSceAgcDriver.md beside main's new pixel-interlock entry. This PR's diff over main is unchanged. The address-draw reuse, BDA and host-import proof tests (^agc_driver_address_draw_space_reuse, ^agc_driver_bda, ^agc_bda and ^agc_driver_host_import_proofs) pass 10 runs in a row. Linux: 14 run, 14 pass, 0 skip, 0 fail. Windows: 14 run, 2 pass, 12 skip (the Vulkan tests; no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (210 and 310) and on Windows (237 and 331). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners. TechLevelZero's NVIDIA bot ran this head merged onto main 88e804b on an RTX 2000 Ada (report): 2,554 passed, 4 failed, none new (3 also fail on main, 1 unstable on main), 45 skipped, with no new validation IDs (974 tests on the GPU).

  • 831bf996ca, a merge of #8963's 972242f204, oneandonlydean's merge of main a4eca2a056 into #8963. It merged without conflicts: #8963's merge already holds both docs/dev/ENVIRONMENT.md rows, #8963's APS5_NO_SHARED_FAULT_SLOTS and Gonic0's APS5_NO_SHARED_GDS from #13159, which were added at the same place. This PR's diff over #8963 is unchanged. On GitHub's runners (run, on dbbaaadddd, our direct merge of main a4eca2a056 into 7aeb568a2d, which has the same tree), the address-draw reuse, BDA and host-import proof tests (^agc_driver_address_draw_space_reuse, ^agc_driver_bda, ^agc_bda and ^agc_driver_host_import_proofs) pass 10 runs in a row. Linux: 14 run, 14 pass, 0 skip, 0 fail. Windows: 14 run, 2 pass, 12 skip (the Vulkan tests; no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (235 and 319) and on Windows (262 and 340). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.

  • 8d2bb9899c names the reuse measurement's title by its ID only in the debt entry (PPSA01556's menu), as the debt files do, at @oneandonlydean's ask.

  • 0b8260120b, a merge of main 5cb015caaa (run). The one conflict was in docs/dev/debt/libSceAgcDriver.md, where main's #12764 adds three compute scratch pool entries at the place this PR's reuse entry sits. The merge keeps both, main's first. This PR's diff over main is unchanged. The address-draw reuse, BDA and host-import proof tests (^agc_driver_address_draw_space_reuse, ^agc_driver_bda, ^agc_bda and ^agc_driver_host_import_proofs) pass 10 runs in a row. Linux: 14 run, 14 pass, 0 skip, 0 fail. Windows: 14 run, 2 pass, 12 skip (the Vulkan tests; no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (279 and 321) and on Windows (306 and 342). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.

  • 8139afd48f and 5479721abf, the retention and its tests, on the merge 0b8260120b. The address-draw reuse tests with the new _held registration, and the BDA, host-import and write-tracking tests (^agc_driver_address_draw_space_reuse, ^agc_driver_bda, ^agc_bda, ^agc_host_import, ^agc_write_tracking, ^agc_driver_host_import_proofs), pass 10 runs in a row on GitHub's runners (run). Linux: 20 run, 19 pass, 1 skip (agc_host_import_sparse, no /dev/udmabuf), 0 fail. Windows: 25 run, 7 pass, 18 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (279 and 321) and on Windows (306 and 342). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners. ^agc once (run): Windows 1,295 run, 397 pass, 898 skip (no Vulkan device), 0 fail. Linux 1,258 run, 1,176 pass, 80 skip, 2 fail, both also on main: agc_driver_image_sample_lod_clamp_shader_lane (main's #12980 test, which fails the same with main's code) and agc_driver_pipeline_journal, which timed out at 120 s on its cold compile, as in this PR's earlier sweeps.

  • 8942229a70 and cfec53d781, merges of main 086c0686c8 and 04a9eb4fa2, on oneandonlydean's merge of main 4f41f4c375 (a80d36f86c).

    • The conflicts, both in Graphics/src/Draw.cpp:
      • In recordDraw, JAB-dev's #11557 adds || !record.staged.empty() to the StartDrawPass condition, the line before this PR's spaceKeep reservation. The merge takes main's condition and keeps the reservation after it.
      • In prepareDraw, JAB-dev's #13021 notes the depth surface write right after the draw's resources are resolved, where this PR's injected stop after resolve sits. Both stay, the stop first, so an injected failure notes no depth write.
    • This PR's diff over main is otherwise unchanged.
    • ×10 (run), at cfec53d781: the address-draw reuse, BDA, host-import, write-tracking, packed UNORM and agc_driver_graphics tests, with #13021's agc_driver_native_depth_publication. Linux: 27 run, 26 pass, 1 skip (agc_host_import_sparse), 0 fail. Windows: 32 run, 9 pass, 23 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 300 and 324 tests on Linux and 330 and 342 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners. The set without #13021's test, which isn't in main 086c0686c8, passed 10 runs on 8942229a70 alone (run).
    • NVIDIA RTX 2000 Ada Generation at a80d36f86c, from TechLevelZero's NVIDIA bot (report): 2,770 passed, 6 failed (none new: 3 also fail on main, 3 unstable on main), 48 skipped. The bot's selection that run didn't include this PR's agc_driver_address_draw_space_reuse_* tests, so they haven't run on that GPU at this head.
    • NVIDIA RTX 2000 Ada Generation at cfec53d781, from TechLevelZero's NVIDIA bot (report): this head merged onto main 1c8c0ef, driver 595.99.02. 2,788 passed, 7 failed (none new: 3 also fail on main, 4 unstable on main), 50 skipped. No new validation IDs over 956 GPU tests. Of this PR's tests, agc_driver_address_draw_space_reuse ran and passed. The _held, _off, _transitions and _verify registrations weren't in the bot's selection.
    • AMD Radeon RX 6300 (RADV NAVI24) at cfec53d781, from TechLevelZero's AMD bot (report): the same merge, Mesa 25.2.8. 2,775 passed, 9 failed (none new: 7 also fail on main, 2 unstable on main), 61 skipped. No new validation IDs over 956 GPU tests. agc_driver_address_draw_space_reuse passed (2.95 s), and again the other four weren't selected.
  • c6daa9a3f2 and 342b06eb3a, by oneandonlydean: a merge of main c2eafe4461, without conflicts, and test(libSceAgcDriver): give each held-batch completion fill a new pattern. meh7an's #10668 makes FillBuffer skip a fill whose range already holds the same pattern, so the held-batch test's repeated zero fill recorded nothing and never submitted the batch holding the space. Each completion fill now has a new pattern.

    • ×10 at 342b06eb3a (run), the same tests as on cfec53d781. Linux: 27 run, 26 pass, 1 skip (agc_host_import_sparse), 0 fail. Windows: 32 run, 9 pass, 23 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 301 and 325 tests on Linux and 331 and 343 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.

Checklist

  • Based on current main; no other open PR implements the same functions (see Overlap: #9508's pieces are taken with its author's agreement)
  • 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: n/a, none added. The reuse's unmeasured cases are in its debt entry
  • 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: n/a, none
  • Generic behaviour, not specific to one title
  • Depends on: #8963
  • Fixes: none
  • Unblocks: none claimed (speed only; see the Resident Evil Village (PPSA01556) runs above)
  • GPUs tested: llvmpipe (lavapipe) on a Linux machine and on GitHub's Linux runner; NVIDIA GeForce RTX 3070 Laptop GPU, driver 617.42, Windows 11 (10.0.26300) (the Resident Evil Village runs); AMD Radeon RX 6700 XT, AMD driver 26.10.1 (Vulkan 1.4.315), Windows 11 (JJenkx's run); NVIDIA GeForce RTX 3080 Ti, driver 615.71.09, Linux (mrfelek's runs); NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Ubuntu 26.04.1 (TechLevelZero's NVIDIA bot); AMD Radeon RX 6300 (RADV NAVI24), Mesa 25.2.8, Ubuntu 26.04.1 (TechLevelZero's AMD bot); Windows build and tests on GitHub's runner
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5096432632 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13858). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-31T09:46:10Z. --- ### What Builds on @Raghav314's space reuse from #9508. With his agreement ([comment](https://github.com/boykopovar/AnyPS5/pull/9508#issuecomment-6536221058)), the first commit takes `spaceReuse`, `RetakeSpace`, `SnapshotsServedInPlace` and their hit path out of his 1be42301d4. It keeps his authorship, with my co-authorship line as in his commit. Stacked on #8963. A recorded draw whose stages only read through the BDA table, and whose bindings all lie in its cached address space, now reuses its build instead of building its resources again for every draw. Today every address-based draw builds anew. In Resident Evil Village (PPSA01556)'s menu that's about 4,300 draws per 10 s on the draw committer. - **What the reuse proves:** the cached build's snapshots must be served in place from the same space (#9508's containment proof), and the space is retaken for the use. - **A moved read-only buffer inside the space** is rebound per draw (#9508's `usesBda` lift). - **Any other change refuses the reuse** and builds as today: a snapshot outside the space, a partial overlap, a snapshot changed, a moved buffer under a pending write, a patched data word, a space or epoch change, a build in use, or a failed revalidation. - **A build that stores through an address** is never reused. - **On by default.** `APS5_NO_ADDRESS_DRAW_REUSE=1` builds every draw anew. Its row in `ENVIRONMENT.md` replaces the `APS5_GPU_HEAP` gate the pieces had in #9508. - **The commits:** 1. **ee52ec9ef9** (@Raghav314): the reuse over the cached space, behind his `APS5_GPU_HEAP` gate. 2. **b4947ff328: on by default, plus the hit-path fixes the default needs.** A hit that retook the space gives it back on every path, so the cached build never pins the space's allocations and a free never waits out `APS5_PIN_WAIT_MS`: - a hit that throws before it is served releases the space, through a guard; - a draw that ends without being recorded releases it; - the transition path's fresh build releases it; - a second `ReleaseSpace` no longer resets the released space; - no draw recipe is made from a space-reuse build, since a recipe's proof neither retakes the space nor checks the snapshots. 3. **79ba14fcfe: each use of a reused build gets its own BDA fault record.** This is #8971's mechanism adapted to draws. The first use in flight takes the build's own #8963 slot. A concurrent use takes its own slot and sets, and each completion checks and clears its record, so a fault is reported once, at its own use. 4. **ac1980aa7f: counters.** With `APS5_PROFILE_DRAW`, `[rescache] address-based draws (10 s): reused N, built M; refused: …` counts every address-based draw under exactly one outcome. 5. **93dfd64f76: recorded writes first.** A hit completes recorded GPU writes over its snapshot ranges before the containment proof. It also adds the technical-debt entry. 6. **69a10da544:** a merge of `main` (0835ec8bdc). The only conflict was `ENVIRONMENT.md`, where both rows are kept. 7. **7122193668:** a merge of #8963's own merge of `main` (d958699e8b, `main` 6a691f69ee). - **The one conflict** is `noteReusable`'s condition, against #8105's pending HTILE clear rule. Both are kept: a build carrying a pending HTILE clear is never reusable, and that includes a space reuse (`spaceReusable` requires `!htileClear.has_value()`). 8. **48347d94ed: the debt entry** moves under `### Functional`, since the reuse is on by default. It now describes the one title the reuse was measured in, Resident Evil Village (PPSA01556)'s menu, as that run was made. 9. **d214fad61a: the GPU lock, asserted.** `RetakeSpace`, `ReleaseSpace` and `SpaceHeld` read and write the space of a build that `SharedResourceCache()` shares between draws. - **Where they're called:** only inside `Graphics::Draw` (`resolveDrawResources`, `keepRecordedDraw`, the transition path's rebuild, and the `HeldSpace` cleanup). - **The lock:** `GuestMemory::GpuMutex()`. The driver reaches `Graphics::Draw` only through `VulkanDevice::Draw`, and every caller of that holds the mutex: `Driver::finishDraw` through `lockForDraw()`, before the indirect and direct inline draws, and `Driver::commitDraw` through its `lock_guard`, for pipelined draws. The `HeldSpace` cleanup runs inside `Draw`, so it's under the lock too. - **Paths that never reach them:** the recipe path, since no recipe is made from a space-reuse build, and dispatches, since `spaceReuse` is set for draw builds only. - **The asserts:** all three now call `GuestMemory::AssertGpuLockHeld`, so a caller without the mutex aborts under `APS5_ASSERT_GPU_LOCK=1`. 10. **86b29f0d72: `APS5_VERIFY_ADDRESS_DRAW_REUSE`.** Every served hit's resources are built anew, and the draw throws on the first difference. - **What it compares:** whether the fresh build is itself a space-reuse build, the BDA table bytes, every snapshot lying in readable table ranges, every snapshot's bytes against guest memory, and the textures, storage images and set layouts. - **What it doesn't compare:** buffer descriptors, since a moved read-only buffer is rebound at record time, and push constants. Textures are compared by identity, not contents. - It costs a full build per hit, so it's a diagnosis switch. 11. **8a85451640: the `HeldSpace` cleanup no longer allocates or throws.** - **A recorded draw** reserves the keep for its retaken space through the checked `Recorder::Keep`, once it holds the command buffer it records into. The release then moves into that holder. - **Every other way out of `Draw()`** makes the same checked reservation in a catch-and-rethrow. - **The cleanup** only does noexcept moves. If no holder could be reserved, the build keeps the space until the recorder's serial that was open at the failure has completed. 12. **a142526a55: a hit rechecks its BDA table against new multisample targets.** A build now keeps the multisample-target guard generation its table was filtered at. - **When that has moved:** the hit reruns `ExcludeMultisampleTargetRanges`, the function a fresh build calls, over the build's space ranges. It keeps the hit if the result matches the table, and refuses it as a space or epoch change if not. - **What it closes:** a resident multisample target that appears inside the space no longer leaves a hit binding a table that still covers it. 13. **8139afd48f: a held space is retained until its batch completes**, for @oneandonlydean's correction ([comment](https://github.com/boykopovar/AnyPS5/pull/13858#issuecomment-6588244801)). - **The gap:** the `HeldSpace` cleanup's fallback (item 11) left the space's one owner in the cache entry. The entry can leave the shared resource cache while the space is held: `Remove`, `RemoveImage`, eviction, or a fresh build of the same key replacing it. The space then went with it. - **The retention:** every place that attaches a space (`RetakeSpace`, the cached hit and a fresh build) first allocates the build's retention node. `~GuestBufferMemory` moves a held space into that node and pushes it onto a lock-free list, without allocating. - **The hold** records the recorder's id with its serial, since a serial means nothing on another recorder. - **The release:** a retained space goes once that recorder has completed the serial, or no longer exists. That's checked at the next cached lookup, in the pin waiter after its sync, and at device teardown. The pin waiter's check keeps a free inside a retained space from waiting out `APS5_PIN_WAIT_MS`. - **The lock:** two threads never touch one cache entry's `space` at once. Every read and write of it (`RetakeSpace`, `ReleaseSpace`, `SpaceHeld`, `HoldSpaceThrough`, `ReleaseCompletedSpace` and the retention's release) runs under the GPU lock, `GuestMemory::GpuMutex()`, and asserts it (item 9). The one exception is `~GuestBufferMemory`. It runs when the entry's last reference goes, so no other thread can reach its space, and the release thread may run it without the lock, which is why its hand-over is a lock-free push. 14. **5479721abf: tests for a failed keep.** Two test hooks make the keep reservation fail (`SetSpaceKeepFailuresForTest`) and stop a draw after its resources resolve (`SetDrawStopAfterResolveForTest`). `agc_driver_address_draw_space_reuse_held` runs two cases, each for an unrecorded early return, an exception during preparation and a recorded draw, with the keep failing. - **`held-space-retaken`:** the `bad_alloc` reaches the caller. Once the held serial completes, the same build retakes its space and is served without a build. - **`held-space-in-use`:** before the held serial completes, the next draw is refused as in use and builds. When that fresh build replaces the holding build in the cache, the space stays retained until the batch completes, and is released after it. - **`APS5_RELEASE_ON_UNLOCK=1`** is set on the registration, for the test's determinism only; it masks no fix. Without it, the replaced build is still retained the same way, but it is released later on the release thread, so the test's retention count would race with it. **Overlap:** - **#9508 (@Raghav314)** carries the same pieces in his own commit, and now also commit 2's hit-path fixes, as his 1817bbed4b, 270d43a865 and 758d23c805. No landing order is needed, as he wrote: whichever lands second drops the shared pieces when it refreshes. - **Our own #7642, and @Celegans12's #10193,** carry 1be42301d4 too, through #9508, and the same holds for them. - **#13610 (@ntamas94)** relocates cached draws across moved user-data V#s, upstream of this build. It merges cleanly with this change, and the two compose. - **#5609 (@TheAggie)** relocates cached draw stages whose descriptor words differ only in buffer base addresses, in the draw cache. This change reuses the resource build of draws that read only through the BDA table, so the two apply to different draws and compose. They share `CMakeLists.txt` and `Graphics/src/Draw.cpp`, and #5609's conflicts with `main` are the same with this branch merged (15 files either way). - **#12745 and #12840 (ours)** each have one small resolution against this change: - #12745: its per-element texture rebinding (`rebound`) goes into the `writeDrawSets` that commit 3 moved the sets into; - #12840: `ShaderResources.hpp` keeps its `StorePages()` beside this change's `SpaceReuse()`. - **Earlier attempts:** - our #6636 matched address-based draws by index, and reused 0 of 17,613 Village draws because their constant rings move. This change serves the moved rings from the space instead; - our #8971 did the same per-use fault record for dispatches. - **Related:** #7895 (the draw committer bounds draw-heavy titles). ### Tested - **Tests:** `agc_driver_address_draw_space_reuse` (`tests/execution/AddressDrawSpaceReuse.cpp`), with `_off` (`APS5_NO_ADDRESS_DRAW_REUSE=1`) and `_transitions` (`APS5_DRAW_TRANSITIONS=1`) registrations. The scene is a full-screen draw whose pixel shader loads its constant through a user-data pointer, with its shader code in a registered allocation. | case | commit | checks | red | |---|---|---|---| | `unchanged` | 2 | twice unchanged, served without a build | on 1: "built its resources again (1 builds)" | | `cpu-write` | 2 | a CPU write is seen, and served | reuse off: 1 build | | `idle-free` | 2 | a free inside the space while idle returns at once | without the release, the free waits the full 4,000 ms pin wait | | `no-recipe` | 2 | no recipe is made from a space-reuse build | the recipe rule removed: a recipe is made | | `moved-vertices` | 2 | renders after a vertex move, and a free returns at once | | | `fault-per-use` | 3 | each fault in a pair of concurrent uses is reported once, at its own address | on 2: the faulting use's fault is reported twice | | `counters` | 4 | each refusal under its reason; the outcomes add up to the draws | | | `pending-snapshot-write` | 5 | a fill over a captured pointer, then the draw in the same batch: snapshot changed, rebuilt | on 4: "counted reused 1 and 0 builds" | | `ring-same-constants`, `ring-own-constants` | 5 | an 8-slot constant ring with the slot as the snapshot: 15 of 15 reused, each draw with its own value | reuse off: 15 builds | | `ring-old-slot-write` | 5 | a CPU write to the previous slot after its draw is recorded leaves that draw's result alone; 7 of 7 reused | reuse off | | `ring-refusals` | 5 | a moved snapshot outside the space: "snapshot outside"; a moved V# inside: reused; a moved V# under a pending fill: refused | reuse off | | `held-space-retaken` (`_held`) | 14 | a failed keep in an early return, a throw and a recorded draw: the `bad_alloc` reaches the caller, and the held space is retaken and served after its serial completes | none: the old code passes these checks too, since nothing in them uses the space on the GPU | | `held-space-in-use` (`_held`) | 14 | the same three: refused as in use before the serial completes; a fresh build replacing the holder leaves the space retained until then, and released after | the retention count needs commit 13's code | - **Linux** (Ubuntu 24.04, GCC 13.3, Release, lavapipe, as an unprivileged user): the three registrations passed 20 of 20 at 93dfd64f76. `^agc`: 1130 passed, 74 skipped, 0 failed. - **GitHub ×10 on the head 7122193668** (`^agc_driver_address_draw_space_reuse`, `^agc_driver_bda`, `^agc_bda`, which takes #8963's tests too) ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41178165657)): - **Linux:** 50 tests, 10 of 10 passed, 0 skipped. - **Windows:** 49 tests, 10 of 10 passed, 11 skipped (no Vulkan device on the runner). - **The libc and libkernel suites:** 0 failed (Linux 199 and 308, Windows 226 and 330). - **On 69a10da544, before #8963's main merge** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41168181479)): Linux 50 tests passed 10 of 10 with 0 skipped; Windows 49 passed 10 of 10 with 11 skipped (no Vulkan device on the runner). The libc and libkernel suites ran with 0 failed (Linux 199 and 308, Windows 226 and 330). - **A full `^agc` sweep on the head 7122193668,** once each on GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41178195116)): - **Windows:** 1,185 tests, 357 passed, 828 skipped, 0 failed. - **Linux:** 1,150 tests, 1,074 passed, 75 skipped, 1 failed. The failure was `agc_driver_pipeline_journal`, which timed out at 120 s. - **That test's first run is slow on its own.** Run alone, its first run took 108.3 s on this head and 102.9 s on #8963's main merge (d958699e8b), one run each. Every later run took 7.9 s on both heads. It passed 5 of 5 here ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41183327734)) and 3 of 3 on d958699e8b ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41186667755)). - **Validation comparison** (`VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, `ctest -V`; `main` against this change, GitHub's Linux runner, llvmpipe), on 69a10da544, the head before #8963's main merge ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41168219169)): - the layer loaded in both logs, and `was not found` appears 0 times in each; - the only VUID is `VUID-VkDeviceCreateInfo-pNext-pNext`, in both, so **the change adds none**; - the GPU was llvmpipe (LLVM 20.1.2), Mesa 25.2.8, on Ubuntu 24.04.5; - 50 tests passed with the change. On Windows, where the layer isn't run, 49 passed and 11 skipped. - **Windows on an AMD GPU, by @JJenkx** ([comment](https://github.com/boykopovar/AnyPS5/pull/13858#issuecomment-6542023821)): the head 7122193668 merged locally onto `main` c3c45d73ab (clean). Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, Radeon RX 6700 XT with AMD's driver 26.10.1 (Vulkan 1.4.315), WinLibs GCC 15.2.0, Release, with the Khronos validation layer 1.4.363 requested for every test. - The 44 tests of `agc_driver_address_draw_space_reuse_tests`, `agc_driver_bda_device_tests` and `agc_driver_graphics_tests`, the binaries this PR's test files build into, pass 3 of 3 runs each, with none skipped. - The layer was inserted 15 times across the runs and reported no VUIDs. - **Resident Evil Village (PPSA01556), Windows,** on our Village measurement tree, not `main`. That tree is cd88cee814, a local measurement tree: an older `main` (merge base 949c9cf477) with #12745, #12478, #12921, #11580, #10304, #9243, #9248 and #1896 merged, plus #8963 and this PR's five commits (697706893b). - **Machine:** NVIDIA GeForce RTX 3070 Laptop GPU, driver 617.42, Windows 11 (10.0.26300). GPU clocks were not held. - **Profiled boot** (`APS5_PROFILE_DRAW=1`, menu +5 to +15 min, medians per 10 s): reused **3,336** (2,183 to 4,387), built 8, refused "not space-only" 152 and "space or epoch change" 768, and **0 snapshot refusals**, of about 4,264 address-based draws. It renders like the same tree without this change. - **Unprofiled pair, A B B A,** the same libraries in both arms: - **Arms:** A has the reuse off (`APS5_NO_ADDRESS_DRAW_REUSE=1`), and B has it on. So this measures this change over #8963, with nothing else differing. - **Env:** `APS5_LAZY_SHADER_PREPARE=1 APS5_NO_GPL=1 APS5_HOST_IMPORT_MIB=6400 APS5_TABLE_INDEX=1 APS5_PIPELINE_INDIRECT=1 APS5_DRAW_CACHE_INDIRECT=1 APS5_DRAW_CACHE_PUSH_WORD=1` and the pad script. Warm shader cache, the same key in all four runs, 0 cache misses. | run | A1 (off) | B1 (on) | B2 (on) | A2 (off) | |---|---|---|---|---| | fps, menu +5 to +15 min | 0.858 | 0.970 | 0.933 | 0.833 | | p50 / p90 frame | 1.13 / 1.45 s | 0.99 / 1.18 s | 1.04 / 1.27 s | 1.17 / 1.48 s | | non-game CPU | 42.2 % | 37.0 % | 42.1 % | 40.0 % | - **The gain:** B's mean is **12.5 %** above A's, and both B runs are above both A runs. The two A runs are 2.9 % apart. - **The load caveat:** non-game CPU spans 5.2 points, and B1 ran lighter. At matched load, B2 (42.1 %) is 10.3 % above A's mean. - **Per frame,** B against A: `Driver.Packet.draw` −13.8 %, `Graphics.Draw` −15.2 %. Renders match by a static-region pixel diff at menu +5 and +10 min. - **Traces,** captured as the Performance report form describes. One boot per arm with only `APS5_TRACE_SECONDS=960:30` added: a 30 s window, 16 min into the menu hold. - **The results:** A's frame p50 and p90 are 1,021 and 1,317 ms, and B's are 900 and 1,131 ms, so B is 11.9 % lower at p50 and 14.1 % lower at p90. - **The caveat:** it's one window per arm, so not pair-grade. B also ran under 5.6 points less non-game CPU (30.8 % against 36.4 %). - **Both summary lines have the same commit,** because the arms differ only in the switch: ``` {"commit":"697706893b77","dirty":false,"env":{"APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_HOST_IMPORT_MIB":"6400","APS5_LAZY_SHADER_PREPARE":"1","APS5_NO_ADDRESS_DRAW_REUSE":"1","APS5_NO_GPL":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINE_INDIRECT":"1","APS5_TABLE_INDEX":"1","APS5_TRACE_SECONDS":"960:30"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 9 5900HS with Radeon Graphics","cpu_threads":16,"memory_mib":15776,"title_id":"PPSA01556","title":"Resident Evil Village","content_version":"01.210.000","resolution":"3840x2160","window":{"spec":"seconds 960:30","first_present":3010,"ms":30030.909},"presents":28,"frame_ms":{"p50":1021.251,"p90":1317.312,"p99":1486.142,"max":1486.142},"gpu_busy_ms_per_present":246.597,"worker_busy_pct":{"queue worker 0x0":99.385,"queue worker 0x38":0.073,"queue worker 0x20":86.352,"queue worker 0x28":92.349},"top_phases_ms_per_frame":{"Driver.Packet":2977.678,"Driver.Packet.memory_wait":1668.358,"Graphics.Draw":731.397,"Graphics.Draw.draw_and_resource_release":713.428,"Driver.Packet.draw":639.264,"Driver.Draw":638.291,"Driver.Packet.dispatch":621.523,"Driver.Dispatch":482.170},"trace_dropped":false,"trace":"aps5-trace-697706893b77-10224.json.gz"} {"commit":"697706893b77","dirty":false,"env":{"APS5_DRAW_CACHE_INDIRECT":"1","APS5_DRAW_CACHE_PUSH_WORD":"1","APS5_HOST_IMPORT_MIB":"6400","APS5_LAZY_SHADER_PREPARE":"1","APS5_NO_GPL":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINE_INDIRECT":"1","APS5_TABLE_INDEX":"1","APS5_TRACE_SECONDS":"960:30"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 9 5900HS with Radeon Graphics","cpu_threads":16,"memory_mib":15776,"title_id":"PPSA01556","title":"Resident Evil Village","content_version":"01.210.000","resolution":"3840x2160","window":{"spec":"seconds 960:30","first_present":2105,"ms":30558.779},"presents":32,"frame_ms":{"p50":899.783,"p90":1131.300,"p99":1614.083,"max":1614.083},"gpu_busy_ms_per_present":254.399,"worker_busy_pct":{"queue worker 0x0":99.326,"queue worker 0x38":0.072,"queue worker 0x20":84.794,"queue worker 0x28":91.311},"top_phases_ms_per_frame":{"Driver.Packet":2625.941,"Driver.Packet.memory_wait":1436.447,"Graphics.Draw":615.152,"Driver.Packet.dispatch":603.060,"Graphics.Draw.draw_and_resource_release":596.195,"Driver.Packet.draw":540.361,"Driver.Draw":539.426,"Driver.Dispatch":467.563},"trace_dropped":false,"trace":"aps5-trace-697706893b77-28528.json.gz"} ``` - **The traces, summary lines and `trace_digest.py` outputs of both arms** are at https://github.com/EagleBearerYS/AnyPS5/releases/tag/traces-bf325b. - **a142526a55, the five review commits above, on GitHub's runners:** - **×10** of `^agc_driver_address_draw_space_reuse`, `^agc_driver_bda` and `^agc_bda` ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41203741233)), `agc_driver_address_draw_space_reuse_verify` included: - Linux: 51 run, 51 pass, 0 skip, 0 fail. - Windows: 50 run, 38 pass, 12 skip (no Vulkan device), 0 fail. - **Validation**, `main` against this head, the same tests, on GitHub's Linux runner (layer 1.3.275) ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41203749681)): - they pass on both arms; - the loader inserted the layer 8 times on `main` and 12 with this head, and neither log has `was not found`; - both report only `VUID-VkDeviceCreateInfo-pNext-pNext`, so the change adds none. - **`^agc` once** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41203758516)): - Linux: 1,151 run, 1,075 pass, 75 skip, 1 fail. `agc_driver_pipeline_journal` timed out at 120 s, the cold-compile timeout this PR's earlier sweep also hit. Alone ×5 ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41206961525)) it passes 5 of 5: 62.13 s for the first run, and about 5.1 s for each after. - Windows: 1,186 run, 357 pass, 829 skip (no Vulkan device), 0 fail. - **The review commits on a cloud Linux machine (lavapipe, LLVM 20.1.2, Mesa 25.2.8),** this PR's set ×10 after each commit: - **d214fad61a (the lock):** - The reuse tests pass 10 of 10 with `APS5_ASSERT_GPU_LOCK=1`. - Over `^agc` with that switch, 447 of 1,150 tests abort at asserts that were already there, in harnesses that drive the device without the GPU lock: `Recorder::Commands` 255, `TextureDetiler::BeginBatch` 174, `Recorder::Submit` 6, `CommandBatch` 6, the heap mirror transfer 1 and `KeepThroughHold` 1. None abort at the three new asserts. - An earlier abort in such a harness could hide a later lock-less call, so the caller chain in item 9 is what shows the lock is held on the driver paths. - **86b29f0d72 (the verify switch):** - `agc_driver_address_draw_space_reuse_verify` runs the default cases with the switch on and requires every served hit to be verified. At a142526a55 it verifies 76 of 76. - The red is a local change, not committed: with the snapshot byte compare removed, the switch stops with "a served address-based draw hit disagrees with a fresh build or guest memory in its snapshot bytes", while without it the stale hits are served. - **8a85451640 (the cleanup):** a standalone probe with a `Recorder::Keep` that throws `std::bad_alloc` covers three cases: an unrecorded early return, an exception during preparation, and a failed recording. - With the old cleanup, all three end in `terminate called after throwing an instance of 'std::bad_alloc'` (exit 134). - With the new code, the `bad_alloc` reaches the caller in all three. - **a142526a55 (the multisample recheck):** `multisample-target-inside` places a resident 4x target in the draw's registered allocation, 32 KiB from the word the draw reads, between two draws. - Without the fix it fails with "a draw after a resident multisample target appeared inside its address space counted reused 1 and 0 builds, expected one refusal for a space change and a build". - With it, the hit is refused as a space change, and the draw builds anew. - `multisample-target-outside` keeps the hit with and without the fix. - **What the test checks:** the refusal and the rebuild, not a fault on the target's address. Placed over the read word, the fresh build's SGPR-base `global_load_dword` crashes llvmpipe instead of reporting a fault. That crash also happens with the reuse off and with no multisample target, so it's outside this change. - **At a142526a55:** `ctest -R '^(agc|shader)'` 1,163 passed, 75 skipped, 0 failed. - **Grand Theft Auto V (PPSA04263) and Diablo II: Resurrected, by @mrfelek** ([comment](https://github.com/boykopovar/AnyPS5/pull/13858#issuecomment-6542740234)), on `main` 02c8efdbcb with #11580 and this PR's 7122193668. Linux, Ryzen 9 5950X, RTX 3080 Ti (NVIDIA 615.71.09), Release; GPU clocks not reported. - **GTA V,** at North Yankton's bank, 3840x2160, warm caches: - `[rescache] address-based draws (10 s): reused 58, built 0`, with every refusal at 0. That's about 2 address-based draws per frame of about 865, every one reused. - Off (`APS5_NO_ADDRESS_DRAW_REUSE=1`) and on, alternating, gave 60, 61, 61 and 61 presents per 20 s. That's level, as expected with this few draws on the path. - **Diablo II: Resurrected,** main menu: no `address-based draws` line, so none of its draws take this path. - No failures or rendering problems in any run. - **ba0b958b1c, a merge of `main` 0836dfdf4f** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41247227491)). #12862 moved `libSceAgcDriver`'s test registrations into `tests/cmake/`; the conflict in `CMakeLists.txt` is resolved with `tools/agc_test_split.py resolve`, which moves this PR's `_off`, `_transitions` and `_verify` registrations into a new `tests/cmake/agc_driver_address_draw_space_reuse_tests.cmake` (+20). Nothing else conflicted. #7642 creates a fragment of the same name for its own variants, so whichever of the two lands second keeps both sets there. Apart from the move, this PR's diff is unchanged. With `-DBUILD_TESTING=ON`, `ctest -N` gives 3079 tests: `main`'s 3075 plus its 4 tests, each listed once. The 12 tests matching `^agc_driver_address_draw_space_reuse|^agc_driver_bda|^agc_bda` pass 10 runs in a row. Linux: 12 run, 12 pass, 0 skip, 0 fail. Windows: 12 run, 1 pass, 11 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (199 and 308) and on Windows (226 and 330). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **023b4a26d8, a merge of `main` 5f0857ee2e**, which brings tibzejoker's #7261 ([×10](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41281714854), [validation](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41281719793)). - **The one conflict** was the first lines of `ShaderResources::noteReusable`, where #7261 resets `importsReconcilable` and this PR resets `spaceReuse` on the same line. The merge keeps both resets, `main`'s first. The two flags are independent: `importsReconcilable` is set again on the direct-regions path, and `spaceReuse` on the space-reuse return. Nothing else conflicted, and this PR's diff is unchanged. - **×10:** the tests above with #7261's `agc_driver_host_import_proofs`. Linux: 13 run, 13 pass, 0 skip, 0 fail. Windows: 13 run, 1 pass, 12 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (206 and 308) and on Windows (233 and 330). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **Validation** (`VK_LAYER_KHRONOS_validation` on GitHub's Linux runner), `main` 5f0857ee2e against this merge, for the same tests. The layer was inserted in both arms, 9 times on `main` and 13 with this merge. The only VUID in either arm is `VUID-VkDeviceCreateInfo-pNext-pNext`, so the merge adds none. - **NVIDIA RTX 2000 Ada Generation** at 023b4a26d8, from TechLevelZero's NVIDIA bot ([report](https://github.com/boykopovar/AnyPS5/pull/13858#issuecomment-6561248015)): this head merged onto `main` e6f5730, driver 595.99.02, Ubuntu 26.04.1, 2,536 of 3,148 tests selected. - 2,484 passed, 7 failed and 45 skipped. None of the failures is new: 3 also fail on `main`, and 4 are unstable on `main`. - With `VK_LAYER_KHRONOS_validation`, no new validation IDs over 935 GPU tests. This PR's `agc_driver_address_draw_space_reuse` passed on the GPU; it isn't in `main`'s baseline, so its validation wasn't compared. `agc_driver_draw_cache_reuse` and `agc_driver_draw_cache_relocation` passed too. - **7aeb568a2d, a merge of `main` 88e804b0a7** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41417574730)). Two conflicts, each a pair of additions at the same place, and the merge keeps both: this PR's `BdaResources.hpp` include in `Recorder.cpp` beside `main`'s `ReferenceStorage.hpp` include, and this PR's "Reused address-based draw builds" entry in `docs/dev/debt/libSceAgcDriver.md` beside `main`'s new pixel-interlock entry. This PR's diff over `main` is unchanged. The address-draw reuse, BDA and host-import proof tests (`^agc_driver_address_draw_space_reuse`, `^agc_driver_bda`, `^agc_bda` and `^agc_driver_host_import_proofs`) pass 10 runs in a row. Linux: 14 run, 14 pass, 0 skip, 0 fail. Windows: 14 run, 2 pass, 12 skip (the Vulkan tests; no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (210 and 310) and on Windows (237 and 331). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. TechLevelZero's NVIDIA bot ran this head merged onto `main` 88e804b on an RTX 2000 Ada ([report](https://github.com/boykopovar/AnyPS5/pull/13858#issuecomment-6577278461)): 2,554 passed, 4 failed, none new (3 also fail on `main`, 1 unstable on `main`), 45 skipped, with no new validation IDs (974 tests on the GPU). - **831bf996ca, a merge of #8963's 972242f204**, oneandonlydean's merge of `main` a4eca2a056 into #8963. It merged without conflicts: #8963's merge already holds both `docs/dev/ENVIRONMENT.md` rows, #8963's `APS5_NO_SHARED_FAULT_SLOTS` and Gonic0's `APS5_NO_SHARED_GDS` from #13159, which were added at the same place. This PR's diff over #8963 is unchanged. On GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41492658427), on dbbaaadddd, our direct merge of `main` a4eca2a056 into 7aeb568a2d, which has the same tree), the address-draw reuse, BDA and host-import proof tests (`^agc_driver_address_draw_space_reuse`, `^agc_driver_bda`, `^agc_bda` and `^agc_driver_host_import_proofs`) pass 10 runs in a row. Linux: 14 run, 14 pass, 0 skip, 0 fail. Windows: 14 run, 2 pass, 12 skip (the Vulkan tests; no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (235 and 319) and on Windows (262 and 340). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **8d2bb9899c** names the reuse measurement's title by its ID only in the debt entry (`PPSA01556's menu`), as the debt files do, at @oneandonlydean's ask. - **0b8260120b, a merge of `main` 5cb015caaa** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41540169797)). The one conflict was in `docs/dev/debt/libSceAgcDriver.md`, where `main`'s #12764 adds three compute scratch pool entries at the place this PR's reuse entry sits. The merge keeps both, `main`'s first. This PR's diff over `main` is unchanged. The address-draw reuse, BDA and host-import proof tests (`^agc_driver_address_draw_space_reuse`, `^agc_driver_bda`, `^agc_bda` and `^agc_driver_host_import_proofs`) pass 10 runs in a row. Linux: 14 run, 14 pass, 0 skip, 0 fail. Windows: 14 run, 2 pass, 12 skip (the Vulkan tests; no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (279 and 321) and on Windows (306 and 342). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **8139afd48f and 5479721abf, the retention and its tests,** on the merge 0b8260120b. The address-draw reuse tests with the new `_held` registration, and the BDA, host-import and write-tracking tests (`^agc_driver_address_draw_space_reuse`, `^agc_driver_bda`, `^agc_bda`, `^agc_host_import`, `^agc_write_tracking`, `^agc_driver_host_import_proofs`), pass 10 runs in a row on GitHub's runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41541444418)). Linux: 20 run, 19 pass, 1 skip (`agc_host_import_sparse`, no `/dev/udmabuf`), 0 fail. Windows: 25 run, 7 pass, 18 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (279 and 321) and on Windows (306 and 342). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. `^agc` once ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41541599056)): Windows 1,295 run, 397 pass, 898 skip (no Vulkan device), 0 fail. Linux 1,258 run, 1,176 pass, 80 skip, 2 fail, both also on `main`: `agc_driver_image_sample_lod_clamp_shader_lane` (main's #12980 test, which fails the same with `main`'s code) and `agc_driver_pipeline_journal`, which timed out at 120 s on its cold compile, as in this PR's earlier sweeps. - **8942229a70 and cfec53d781, merges of `main` 086c0686c8 and 04a9eb4fa2,** on oneandonlydean's merge of `main` 4f41f4c375 (a80d36f86c). - **The conflicts,** both in `Graphics/src/Draw.cpp`: - In `recordDraw`, JAB-dev's #11557 adds `|| !record.staged.empty()` to the `StartDrawPass` condition, the line before this PR's `spaceKeep` reservation. The merge takes `main`'s condition and keeps the reservation after it. - In `prepareDraw`, JAB-dev's #13021 notes the depth surface write right after the draw's resources are resolved, where this PR's injected stop after resolve sits. Both stay, the stop first, so an injected failure notes no depth write. - This PR's diff over `main` is otherwise unchanged. - **×10** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41721515214)), at cfec53d781: the address-draw reuse, BDA, host-import, write-tracking, packed UNORM and `agc_driver_graphics` tests, with #13021's `agc_driver_native_depth_publication`. Linux: 27 run, 26 pass, 1 skip (`agc_host_import_sparse`), 0 fail. Windows: 32 run, 9 pass, 23 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 300 and 324 tests on Linux and 330 and 342 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. The set without #13021's test, which isn't in `main` 086c0686c8, passed 10 runs on 8942229a70 alone ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41703760515)). - **NVIDIA RTX 2000 Ada Generation** at a80d36f86c, from TechLevelZero's NVIDIA bot ([report](https://github.com/boykopovar/AnyPS5/pull/13858#issuecomment-6615541188)): 2,770 passed, 6 failed (none new: 3 also fail on `main`, 3 unstable on `main`), 48 skipped. The bot's selection that run didn't include this PR's `agc_driver_address_draw_space_reuse_*` tests, so they haven't run on that GPU at this head. - **NVIDIA RTX 2000 Ada Generation** at cfec53d781, from TechLevelZero's NVIDIA bot ([report](https://github.com/boykopovar/AnyPS5/pull/13858#issuecomment-6621566317)): this head merged onto `main` 1c8c0ef, driver 595.99.02. 2,788 passed, 7 failed (none new: 3 also fail on `main`, 4 unstable on `main`), 50 skipped. No new validation IDs over 956 GPU tests. Of this PR's tests, `agc_driver_address_draw_space_reuse` ran and passed. The `_held`, `_off`, `_transitions` and `_verify` registrations weren't in the bot's selection. - **AMD Radeon RX 6300 (RADV NAVI24)** at cfec53d781, from TechLevelZero's AMD bot ([report](https://github.com/boykopovar/AnyPS5/pull/13858#issuecomment-6622212289)): the same merge, Mesa 25.2.8. 2,775 passed, 9 failed (none new: 7 also fail on `main`, 2 unstable on `main`), 61 skipped. No new validation IDs over 956 GPU tests. `agc_driver_address_draw_space_reuse` passed (2.95 s), and again the other four weren't selected. - **c6daa9a3f2 and 342b06eb3a, by oneandonlydean:** a merge of `main` c2eafe4461, without conflicts, and `test(libSceAgcDriver): give each held-batch completion fill a new pattern`. meh7an's #10668 makes `FillBuffer` skip a fill whose range already holds the same pattern, so the held-batch test's repeated zero fill recorded nothing and never submitted the batch holding the space. Each completion fill now has a new pattern. - **×10** at 342b06eb3a ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41777267295)), the same tests as on cfec53d781. Linux: 27 run, 26 pass, 1 skip (`agc_host_import_sparse`), 0 fail. Windows: 32 run, 9 pass, 23 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 301 and 325 tests on Linux and 331 and 343 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. ### 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 (see Overlap: #9508's pieces are taken with its author's agreement) - [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: n/a, none added. The reuse's unmeasured cases are in its debt entry - [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: n/a, none - [x] Generic behaviour, not specific to one title - [x] Depends on: #8963 - [x] Fixes: none - [x] Unblocks: none claimed (speed only; see the Resident Evil Village (PPSA01556) runs above) - [x] GPUs tested: llvmpipe (lavapipe) on a Linux machine and on GitHub's Linux runner; NVIDIA GeForce RTX 3070 Laptop GPU, driver 617.42, Windows 11 (10.0.26300) (the Resident Evil Village runs); AMD Radeon RX 6700 XT, AMD driver 26.10.1 (Vulkan 1.4.315), Windows 11 (JJenkx's run); NVIDIA GeForce RTX 3080 Ti, driver 615.71.09, Linux (mrfelek's runs); NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Ubuntu 26.04.1 (TechLevelZero's NVIDIA bot); AMD Radeon RX 6300 (RADV NAVI24), Mesa 25.2.8, Ubuntu 26.04.1 (TechLevelZero's AMD bot); Windows build and tests on GitHub's runner - [x] AI-assisted: yes
MarcZX10 commented 2026-10-31 10:00:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T10:00:10Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The performance report compares the feature toggle on and off at the same commit, so it does not provide the required main versus PR-change captures.

What I ran

Reviewed head 7122193668bb31c5282e80152b240d8e1990720e against the PR's recorded base c3c45d73abd34dca81da6bad87cb6d36ea437a66. I also checked against current main at 45f4f82449a72e31aa9fd3120bd82820211dea41; both the PR and its declared dependency #8963 have clean merge previews there. Environment: Linux, Python 3.11.2; no C/C++ compiler or build was run.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13858
python3 tools/pr_stack_check.py 13858 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13858-7122193668bb/stack
git diff --check 45f4f82449a72e31aa9fd3120bd82820211dea41...7122193668bb31c5282e80152b240d8e1990720e
python3 tools/check_conventions.py --base 45f4f82449a72e31aa9fd3120bd82820211dea41 --head 7122193668bb31c5282e80152b240d8e1990720e --title 'perf(agc): reuse read-only address-based draw builds over their cached address space' --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13858-7122193668bb/pr-body.md
python3 tools/performance_compare.py /tmp/anyps5-13858-perf/A-reuse-off-aps5-summary.jsonl /tmp/anyps5-13858-perf/B-reuse-on-aps5-summary.jsonl --require-matching-context
python3 tools/trace_digest.py /tmp/anyps5-13858-perf/A/aps5-trace-697706893b77-10224.json.gz --summary /tmp/anyps5-13858-perf/A/aps5-summary.jsonl
python3 tools/trace_digest.py /tmp/anyps5-13858-perf/B/aps5-trace-697706893b77-28528.json.gz --summary /tmp/anyps5-13858-perf/B/aps5-summary.jsonl

Results

Check Result
Head/base freshness Precheck confirmed both unchanged at completion.
Diff and conventions Passed.
PR merge previews Against current main 45f4f82449a72e31aa9fd3120bd82820211dea41, both #13858 and dependency #8963 are clean; #13858 includes #8963's current head.
Precheck ABI/test-quality helpers Could not run: those helper scripts are absent from the isolated PR checkout. This is a tooling limitation, not a PR-source failure.
Performance context comparison Failed with exit 2: the summaries differ in APS5_NO_ADDRESS_DRAW_REUSE and window.first_present. Both summaries also name the same commit.
Trace digests Regenerated digest outputs for A and B each match the corresponding attached digest output line-for-line.
Hosted CI Eligibility, conventions, library-portability, intake, labels and report passed. Windows passed at the final refresh; Linux and specialized jobs were skipped.
Relevant raw output
All conventions checks passed.
performance_compare.py: recorded configuration differs: env.APS5_NO_ADDRESS_DRAW_REUSE, window.first_present
exit=2
A: regenerated digest equals posted digest: True
B: regenerated digest equals posted digest: True
# PR stack check — fresh

Target: https://github.com/boykopovar/AnyPS5/pull/13858
Target branch tip: `45f4f82449a72e31aa9fd3120bd82820211dea41`
All heads unchanged: **True**
Dependency order: #8963 → #13858

## Individual merge previews

- PR #8963: **clean** against current base; head `d958699e8b7cb503f83ab6f3031340e349c0a4e1`; changed paths: none reported
- PR #13858: **clean** against current base; head `7122193668bb31c5282e80152b240d8e1990720e`; changed paths: none reported
/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13858-7122193668bb/head-7122193668bb-d4fa1180/tools/pr_abi_audit.py': [Errno 2] No such file or directory
/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13858-7122193668bb/head-7122193668bb-d4fa1180/tools/pr_test_quality.py': [Errno 2] No such file or directory

Findings

Blocking

The perf PR's two summary records are an on/off toggle comparison from the same source commit (697706893b77); the PR description also says the measurement tree includes this change. The repository requires a main capture and a change capture from the same machine and scene, and the records must name different commits. The perf numbers missing label remains present. Please add the main and PR-head summary lines, their traces, and trace_digest.py outputs using the same machine, title, scene, resolution, and capture settings. The existing toggle pair can remain as supplemental evidence.

Non-blocking

No additional blocking source issue was established in the inspected diff. Local build/CTest and platform-specific runtime behavior were not independently checked.

Sources

Not verified

No local build, CTest, Linux product job, or console run was performed. The Windows hosted job was still in progress at the final refresh; the skipped Linux and specialized jobs provide no result. Author-reported test runs were not independently repeated.

To get this to a good state

Add the compliant main/PR-head performance evidence described above. I will rerun the relevant report, trace, and freshness checks on the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5722267043 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13858#pullrequestreview-5722267043). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T10:00:10Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The performance report compares the feature toggle on and off at the same commit, so it does not provide the required `main` versus PR-change captures. ## What I ran Reviewed head `7122193668bb31c5282e80152b240d8e1990720e` against the PR's recorded base `c3c45d73abd34dca81da6bad87cb6d36ea437a66`. I also checked against current `main` at `45f4f82449a72e31aa9fd3120bd82820211dea41`; both the PR and its declared dependency #8963 have clean merge previews there. Environment: Linux, Python 3.11.2; no C/C++ compiler or build was run. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13858 python3 tools/pr_stack_check.py 13858 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13858-7122193668bb/stack git diff --check 45f4f82449a72e31aa9fd3120bd82820211dea41...7122193668bb31c5282e80152b240d8e1990720e python3 tools/check_conventions.py --base 45f4f82449a72e31aa9fd3120bd82820211dea41 --head 7122193668bb31c5282e80152b240d8e1990720e --title 'perf(agc): reuse read-only address-based draw builds over their cached address space' --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13858-7122193668bb/pr-body.md python3 tools/performance_compare.py /tmp/anyps5-13858-perf/A-reuse-off-aps5-summary.jsonl /tmp/anyps5-13858-perf/B-reuse-on-aps5-summary.jsonl --require-matching-context python3 tools/trace_digest.py /tmp/anyps5-13858-perf/A/aps5-trace-697706893b77-10224.json.gz --summary /tmp/anyps5-13858-perf/A/aps5-summary.jsonl python3 tools/trace_digest.py /tmp/anyps5-13858-perf/B/aps5-trace-697706893b77-28528.json.gz --summary /tmp/anyps5-13858-perf/B/aps5-summary.jsonl ``` ## Results | Check | Result | |---|---| | Head/base freshness | Precheck confirmed both unchanged at completion. | | Diff and conventions | Passed. | | PR merge previews | Against current `main` `45f4f82449a72e31aa9fd3120bd82820211dea41`, both #13858 and dependency #8963 are clean; #13858 includes #8963's current head. | | Precheck ABI/test-quality helpers | Could not run: those helper scripts are absent from the isolated PR checkout. This is a tooling limitation, not a PR-source failure. | | Performance context comparison | Failed with exit 2: the summaries differ in `APS5_NO_ADDRESS_DRAW_REUSE` and `window.first_present`. Both summaries also name the same commit. | | Trace digests | Regenerated digest outputs for A and B each match the corresponding attached digest output line-for-line. | | Hosted CI | Eligibility, conventions, library-portability, intake, labels and report passed. Windows passed at the final refresh; Linux and specialized jobs were skipped. | <details> <summary>Relevant raw output</summary> ```text All conventions checks passed. ``` ```text performance_compare.py: recorded configuration differs: env.APS5_NO_ADDRESS_DRAW_REUSE, window.first_present exit=2 ``` ```text A: regenerated digest equals posted digest: True B: regenerated digest equals posted digest: True ``` ```text # PR stack check — fresh Target: https://github.com/boykopovar/AnyPS5/pull/13858 Target branch tip: `45f4f82449a72e31aa9fd3120bd82820211dea41` All heads unchanged: **True** Dependency order: #8963 → #13858 ## Individual merge previews - PR #8963: **clean** against current base; head `d958699e8b7cb503f83ab6f3031340e349c0a4e1`; changed paths: none reported - PR #13858: **clean** against current base; head `7122193668bb31c5282e80152b240d8e1990720e`; changed paths: none reported ``` ```text /usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13858-7122193668bb/head-7122193668bb-d4fa1180/tools/pr_abi_audit.py': [Errno 2] No such file or directory /usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13858-7122193668bb/head-7122193668bb-d4fa1180/tools/pr_test_quality.py': [Errno 2] No such file or directory ``` </details> ## Findings ### Blocking The `perf` PR's two summary records are an on/off toggle comparison from the same source commit (`697706893b77`); the PR description also says the measurement tree includes this change. The repository requires a `main` capture and a change capture from the same machine and scene, and the records must name different commits. The `perf numbers missing` label remains present. Please add the `main` and PR-head summary lines, their traces, and `trace_digest.py` outputs using the same machine, title, scene, resolution, and capture settings. The existing toggle pair can remain as supplemental evidence. ### Non-blocking No additional blocking source issue was established in the inspected diff. Local build/CTest and platform-specific runtime behavior were not independently checked. ## Sources - [Performance-evidence requirement in CONTRIBUTING.md, pinned to current main](https://github.com/boykopovar/AnyPS5/blob/45f4f82449a72e31aa9fd3120bd82820211dea41/CONTRIBUTING.md#L71) - [Performance report form, pinned to current main](https://github.com/boykopovar/AnyPS5/blob/45f4f82449a72e31aa9fd3120bd82820211dea41/.github/ISSUE_TEMPLATE/performance.yml) ## Not verified No local build, CTest, Linux product job, or console run was performed. The Windows hosted job was still in progress at the final refresh; the skipped Linux and specialized jobs provide no result. Author-reported test runs were not independently repeated. ## To get this to a good state Add the compliant `main`/PR-head performance evidence described above. I will rerun the relevant report, trace, and freshness checks on the updated head.
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!13858
No description provided.