Skip to content

fix(agc): give a vertex copy headroom when its range keeps growing - #19100

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
videogamer10293:fix/agc-growing-vertex-copy
Nov 24, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
videogamer10293:fix/agc-growing-vertex-copy

Conversation

@videogamer10293

@videogamer10293 videogamer10293 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What

A draw whose vertex range starts at the same address as a kept copy, but reaches a little further, cannot reuse that copy. A vertex lookup takes only a kept copy at least as long as the read (Recorder.cpp#L3700). So draws that walk through one large vertex buffer in consecutive windows copy the whole range again on every draw. Where vertex input is copied rather than read in place, each copy is a new host buffer, and a burst of them can push the host heap over its budget. NVIDIA's Windows driver is such a case: DrawInputsInPlaceUsable is false for it, so only inputs of up to 1024 bytes with few reads are bound in place.

With this change, when a vertex copy misses only because the kept copy at the same address is unchanged but shorter, the new copy is made longer than the read. The next draws in the sequence then reuse it.

  • Recorder::ShorterDrawSnapshotKept tells whether such a copy is kept. It must have the same address and use, be shorter, come from the current allocation registry, not be an owned-input copy, and be unchanged since it was made, from where its bytes start (a copy can start past its address, perf(agc): copy only the vertex records a draw fetches #9875).
  • CopyDrawInput takes a growLimit. It grows only vertex copies, only past such a kept copy, by at most a quarter of the read, never past the limit, and never past DrawInputBudget (a longer copy would not be kept). The grown range is collected with the read, so the kept copy's generation covers all of it.
  • The draw does not read the extra bytes, so they are taken only when nothing has to be done first. They must be accessible. They must have no pending GPU write, label or queued store (Recorder::GuestWritesPendingIn), no storage image with pending results, and no unpublished unit shadow. They must not overlap a resident depth surface or host-only samples (HostOnlySampleRanges). These checks are queries only. The read itself still goes through GuestMemory::Read; the extra bytes are then copied directly, without its flush and read guard.
  • The vertex path passes the end of the attribute descriptors' range as the limit (VertexDescriptorEnd), using the smallest end when a copy merges several attributes. The limit is cut at any color, depth, stencil or HTILE address past the read. Indirect draws and index copies do not grow.
  • A grown copy's device mirror (perf(agc): mirror reused vertex and index snapshots in device memory #16760) mirrors the whole copy, so it takes the same extra bytes in device memory.

Why a quarter. It bounds the extra bytes when the descriptor is much larger than the read. In the earlier Sky Garden runs below, the limit, not the quarter, capped the growth: the second copy grew by about 9 %, which was enough for 22 copies of 32 MiB or more to become 3. A range that grows by more than its headroom on every draw gets copies longer than on main that are never reused. That costs memory and gains nothing.

This PR claims no speed change. PPSA21564 (ASTRO BOT) stopped on these copies in Sky Garden on Windows with NVIDIA (traced below); two more levels stop on main on a full host heap and reach the cap with this change.

Tested

Windows only: Windows 10 Pro 10.0.19045, Ryzen 5 7600X, 31893 MiB of RAM, RTX 5070 Ti, NVIDIA 621.24, WinLibs GCC 15.2.0 (UCRT), Release, BUILD_TESTING=ON. Head e78ae2ee05 on main 3c07e1d05e; every result below is from this head and that main. Both build trees carried the same local test-only edit, not committed: a Windows _putenv_s in UploadCacheReadOnlyFlush.cpp, which does not build on Windows on this main (#19899, #22373).

Others ran older heads: relativespace2K (RX 6800 XT) and JJenkx (RX 6700 XT) on Windows, and blawesom on Linux with RADV (comment). In blawesom's run the unit-shadow check skipped itself, since its block was not imported and watched; it ran here.

main has since moved to e35c90cfe3. Among this PR's files it changed only tests/Graphics.cpp and tests/Recorder.cpp, and the branch merges with it without a conflict. I did not rerun the tests on that merge.

Tests

  • tools/select_tests.py with the 19 files that differed from upstream/main at the time (the 9 of this PR and 10 from a newer main) selects 6171 tests; the 9 alone select 3245 of them. With tools/select_tests.py ctest build, the same 3 fail on both sides: agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch and agc_driver_bda_device. On main, agc_driver_image_table_packed_guards also failed once; it passed 3 of 3 runs alone on each side. After every build, the staged .prx copies next to the test executables matched the rebuilt libraries.
  • growingVertexCopyTests, in agc_driver_recorder, uses a real device and a write-watched block. It checks that:
    • a first copy takes no headroom;
    • a longer read past an unchanged shorter copy gets a quarter more;
    • a later read inside the headroom reuses the grown copy, both as a host read and as a draw's read, which may get a device mirror, although a store landed in the headroom before that copy was made (only the grown collect saw it);
    • a read whose headroom holds a pending GPU write does not grow;
    • a read past the headroom grows again;
    • the limit caps the growth;
    • a changed shorter copy, a zero limit and an index copy take none;
    • a kept copy that starts past its address lets a longer one grow after a store below its start.
  • grownVertexCopyShadowTests, in agc_driver_recorder: a copy whose headroom ends before a fresh unit shadow grows; one whose headroom reaches it does not.
  • validationTests, in agc_graphics_profile_draw, checks without a device: VertexDescriptorEnd; GrownVertexCopyBytes (the quarter, the limit, the DrawInputBudget cap); VertexCopyGrowEnd (color, depth, stencil and HTILE cuts).
  • VertexPlanScratchEmptiesEveryList, in agc_exclusive_scratch, covers the two new plan lists.
  • 16 breaks of the change, one at a time, with the tests kept: 14 fail agc_driver_recorder, agc_graphics_profile_draw or agc_exclusive_scratch; the unchanged head passes before and after. Two pass:
    • prepareDrawInputs passing no limit. No unit test draws through that call; the title runs below do.
    • The guarded read also covering the headroom. It gives the same bytes as the direct copy, so no test can tell them apart; the direct copy only skips the flush and read guard over bytes the draw does not read.
  • Not tested one by one: the accessible, storage-image, resident-depth and host-only-sample checks on the headroom, and the registry and owned-input conditions of ShorterDrawSnapshotKept. The cut looks only at the address where a target starts; a target that starts below the read's end and reaches into the headroom is left to the pending-write and resident-depth checks.
  • Validation: agc_driver_recorder under ctest -V with VK_ADD_LAYER_PATH set to the layer, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_LAYERS_DISABLE=~implicit~ VK_LOADER_DEBUG=layer and the Khronos Windows layer 1.4.368. On both sides it passes, the loader inserts the layer and no implicit layer:
    [Vulkan Loader] INFO | LAYER:   Insert instance layer "VK_LAYER_KHRONOS_validation" (C:\AnyPS5Dev\tools\vvl-nightly-13e1d19f\layer\VkLayer_khronos_validation.dll)
    
    Neither log has was not found but was requested by env var VK_INSTANCE_LAYERS or a VUID- line. The same settings over the 25 tests matching ^(agc_driver_recorder|agc_draw_inputs_.*|agc_owned_draw_inputs.*|agc_driver_vertex.*|agc_driver_draw_offset.*|agc_draw_snapshot.*)$ give the same on both sides: no VUID- line, 24 pass and agc_driver_vertex_elected_atomic_max skips. The loader inserts the layer in 22 of them; agc_driver_vertex_table_read_order, agc_driver_vertex_table_read_order_counts_off and agc_draw_inputs_in_place_driver print no loader line. The other new checks run without a device: agc_graphics_profile_draw uses MockVulkan.

Title. PPSA21564 01.007.000, no input, muted, 300 s cap, 2 runs per level and side. One run dir and relinked executable from main 3c07e1d05e; the sides differ only in libSceAgcDriver.prx. Runs alternate main, PR, main, PR, and share one shader cache, which was empty before the first hero_ape_escape run. No local print lines. The same two levels behaved the same on an older head, with pad input (comment).

level main 3c07e1d05e this PR e78ae2ee05
hero_ape_escape stop at 75 s and 33 s 300 s cap, both runs
path_maker_mana_tree stop at 52 s and 34 s 300 s cap, both runs

Times are the launcher's wall time. Every main run ends on a failed buffer allocation in heap 1, then terminate called on a MemoryAllocationError. The first hero_ape_escape run:

[gpu] driver failure: AGC graphics: vkAllocateMemory buffer: allocation=117440512 memoryType=3 reclaimed=0 released=229900288 initialResult=-2 attempts=2; heap 0 5217/15229 MiB; heap 1 15359/15085 MiB; heap 2 129/84 MiB: Vulkan result -2

At every stop, heap 1 (the host heap, 15947 MiB here) was over its budget of 15084 to 15085 MiB. No run of this PR printed a failed allocation. I did not trace the copies in these two levels; the A/B shows only that the stop goes away with this change. Not tested with more RAM.

Earlier runs: Sky Garden, on older heads

PPSA21564 01.007.000, -lvl underwater_aerial_garden, no input, 3840x2160, 600 s cap, shader cache warmed by one discarded run. B1 is main + #18356 (4a69efb803). Every arm carried a local print line, not committed, that logs each draw input copy of 32 MiB or more. "End" is the launcher's wall time.

main arm end copies of 32 MiB or more
d4d6b64710 B1 stop at 348 s 22
d4d6b64710 B1 + this PR (067d9cb616, a local commit, not pushed) 600 s cap 3
d91bb06af9 B1 stop at 353 s 22
d91bb06af9 B1 + earlier version 600 s cap 3
d91bb06af9 B1 + earlier version 600 s cap 3
d91bb06af9 B1 stop at 326 s 22
d91bb06af9 main stopped; launcher time not recorded (log last written 572 s after start) 20
d91bb06af9 main + earlier version 600 s cap 0

The "earlier version" rows are 77f76c2429, a local commit, not pushed: no unit-shadow check, a multisample query in place of HostOnlySampleRanges, and the whole range read through GuestMemory::Read. The main + earlier version run made no copy of 32 MiB or more, so that pair shows nothing either way. Local print lines on main 3c8b74996f + #18356 showed that all 23 copies of 32 MiB or more start at 0x1078e68ca0 and grow from 76 to 133 MiB, about 2.9 GiB in all, within 1.48 s before the stop. In a later run they came from ordinary draws, and every lookup after the first found the previous copy kept, from the current registry and unchanged, but shorter.

Overlap. tools/pr_overlap.py --branch on this head finds three open pull requests that change the same lines, each for another purpose: #9915 (vertex out-of-bounds range checks), #19620 (unbounded indirect vertex inputs) and #21923 (queue worker lock contention). None gives a copy headroom; whichever merges second can rebase. It could not compare 65 others, which conflict with main. A search of their diffs for the copy, keep and lookup functions and the vertex copy plan finds three; the diffs of #7642 and #9508 (308 and 366 files) could not be fetched. #9712 and #15570 change the line in CopyDrawInput that creates the copy's buffer, and the draft #20315 adds a GPU copy before CopyDrawInput for ranges with a pending GPU write.

#16879 replaces a kept snapshot's registryGeneration, which ShorterDrawSnapshotKept reads, with a forgetSerial; winstrex agreed that it goes first, and this PR takes that change when it rebases onto it.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: perf(libSceAgcDriver): invalidate draw input snapshots by range #16879
  • Fixes: none
  • Unblocks: PPSA21564 Astro Bot (PPSA21564) #357
  • GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 621.24, Windows 10 Pro 10.0.19045
  • AI-assisted: yes. Claude Code traced the stop with local print lines (not committed), wrote the change and the tests, rebased them, and ran the tests, mutation checks, validation runs and title A/B above.

🤖 Generated with Claude Code

@relativespace2K

Copy link
Copy Markdown
Contributor

Windows/AMD validation on RDNA 2: both covered tests pass.

  • AMD Radeon RX 6800 XT (gfx1030, subgroup 64), AMD proprietary driver 26.10.1, Windows 11 IoT Enterprise LTSC 26100, head d525745354, Release, WinLibs GCC 15.2.
  • ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation.
  • agc_driver_recorder passes in 2.88 s, carrying growingVertexCopyTests (first copy no headroom, quarter growth, reuse inside headroom, pending-write refusal, second growth, limit cap, and the no-growth cases).
  • agc_graphics_profile_draw passes in 12.19 s, carrying the VertexDescriptorEnd checks.
  • No VUID- line and the layer loaded.

The PR says Linux, macOS and non-NVIDIA GPUs were not tested; this adds a Windows AMD run. I did not run the mutation builds or the 2754-test selection.

@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Nov 12, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head d5257453547598b651ce41f02b7ca4b5e4caaf03 (PR 19100 against main). Read the title and description, the commit, the manifest, and the full diff.
  • Checked the code at the head around each changed hunk with the reader:
repo_read.py search "CopyGuestBytes" core/libs/prx/libSceAgcDriver
repo_read.py search "DrawInputBudget" core/libs/prx/libSceAgcDriver
repo_read.py search "GuestWritesPendingIn" core/libs/prx/libSceAgcDriver
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp 1462 1500
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp 1940 2030
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp 3300 3345
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp 112 140
repo_read.py cat core/libs/prx/libSceAgcDriver/tests/Graphics.cpp 12262 12276
  • No build and no test was run in this review.

Results

Check Result Note
Diff read passed All hunks in the 7 reviewed files
Names and signatures the diff uses passed Found at head
Description claims against the code passed Caps, cut addresses and guards match; see Findings
Build not run
Unit tests not run Author reports them on Windows only

Findings

Blocking

None.

Non-blocking

  1. core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:2018 — The cut at render-target, depth, stencil and HTILE addresses (lines 2018–2024) has no test. The author's mutation checks say the same. If the cut were dropped, the two new tests would still pass. The DrawInputBudget cap (Draw.cpp:1485), the unit-shadow check (Draw.cpp:1453) and the tail copy (Draw.cpp:1496) are untested too.

Sources

Not verified

  • Build and tests were not run. The author's results (agc_driver_recorder and agc_graphics_profile_draw on the rebased head d525745354, and the ctest run of 2732 passes) are author reports, not runs by this review.
  • The performance figures and the title A/B table in the description are not checked. The PR claims no speed change.
  • The tail copy at Draw.cpp:1496 skips the GuestMemory::Read guard. Its safety depends on the generation collected at Draw.cpp:1486 before the copy. I did not check the write-watch timing.
  • The cut at Draw.cpp:2016 covers only addresses at or above the read end. A depth, stencil or HTILE surface that starts lower and reaches into the headroom relies on ResidentDepthGuardOverlaps_nid_no_patch and the pending-write checks. Not verified.
  • Files read: the changed hunks of all 7 reviewed files, and head ranges through the reader. tests/Graphics.cpp and tests/Recorder.cpp were read only as diff hunks; their full text is too large for the review folder and was not read.
  • The overlapping PRs named in the description (#9712, #16760, #18287, #9875, #9915, #13809, #15570) were not checked.

To get this to a good state

Nothing is required. The test-coverage point in Findings is optional.

@github-actions github-actions Bot added the agc libSceAgc* label Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 19620 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L2133
PR 21923 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L1483, L2165
PR 23919 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L1483, L2165
PR 26041 core/libs/prx/libSceAgcDriver/Graphics/include/VertexInput.hpp L330-331

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4448 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6186 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6192 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6209 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6235 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6280 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6481 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6995 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7002 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7085 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7275 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 9356 core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9387 core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9508 core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 9712 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 9852 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 9895 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9897 core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9915 core/libs/prx/libSceAgcDriver/Graphics/include/VertexInput.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 10193 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 10497 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 11444 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
PR 11452 core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 11551 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 11825 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 12840 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 13148 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13251 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 13589 core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/VertexInput.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/VertexPlanScratch.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/ExclusiveScratch.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 13863 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 13920 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 13928 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 13929 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 14032 core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 14262 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 14473 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 14944 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 15136 core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 15570 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 18173 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 20172 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
PR 20315 core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 20519 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
PR 20845 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 22190 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 22424 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
PR 22434 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 22647 core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
PR 22787 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp
PR 23252 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 23258 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 23281 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 24049 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp

@JJenkx

JJenkx commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Windows check of head d525745354. Setup: Windows 11 Enterprise 22621, AMD RX 6700 XT, AMD driver 26.10.1, MinGW-w64 GCC 15.2 UCRT, Release.

The 182 AGC tests that cover the changed files:

  • GPU, through the shared Windows GPU FIFO with ANYPS5_REQUIRE_VULKAN=1, merged onto main 58860906d5 (merge c6e72f23c0): all 182 passed in 3 of 3 runs, 546 of 546 outcomes. The binaries matched the hashes recorded at preparation, and the receipt shows exit 0 and app_count=0.
  • CPU, Vulkan hidden, merged onto main 59f3a64cf6 (merge b80b5e6d7a): 64 passed and 118 skipped (they need a device), 0 failed, in 3 of 3 runs.

AI-assisted: yes.

@videogamer10293
videogamer10293 force-pushed the fix/agc-growing-vertex-copy branch from d525745 to 20d136c Compare November 12, 2026 23:38
@videogamer10293

Copy link
Copy Markdown
Contributor Author

The cut at render targets, the DrawInputBudget cap and the unit-shadow check are tested now, in 20d136c337. The two calls of the new helpers and the tail copy still are not, for the reasons below.

The cut at render-target, depth, stencil and HTILE addresses (lines 2018–2024) has no test. The author's mutation checks say the same. If the cut were dropped, the two new tests would still pass. The DrawInputBudget cap (Draw.cpp:1485), the unit-shadow check (Draw.cpp:1453) and the tail copy (Draw.cpp:1496) are untested too.

@MarcZX10, review. Thanks for reading it this closely.

  • The cut and the cap. 20d136c337 moves the headroom arithmetic into GrownVertexCopyBytes and the cut into VertexCopyGrowEnd, with the same behaviour, so validationTests checks both without a device. 14 new breaks of them each fail agc_graphics_profile_draw:
    • growth with no room past the read;
    • the cap removed, or checked with <;
    • no cut, a cut only past the read's end, a cut at targets below it, or a cut without its target < limit bound;
    • each target kind ignored, or an unbound color target cutting;
    • a limit below the read's end kept.
  • The unit-shadow check. grownVertexCopyShadowTests marks one unit of a watched 4 MiB host import fresh with MarkShadowed. A copy whose headroom reaches that unit takes none, and removing the check fails agc_driver_recorder.
  • Still not caught. Dropping the VertexCopyGrowEnd call in prepareDrawInputs passes, so your point stands for the call itself: no test draws with a render target inside the headroom of a growing vertex range. Inlining the growth without the cap in CopyDrawInput also passes; testing that at the call needs a vertex copy of more than 800 MiB.
  • The tail copy. Growth happens only when the checks find nothing pending in the tail. Then GuestMemory::Read and the direct copy give the same bytes, and I found no way to tell them apart in a test. The direct copy only avoids running the flush and the read guard over bytes the draw does not read.
  • A depth, stencil or HTILE surface that starts below the read's end (your "Not verified" point). The cut looks only at where a target starts, and the test checks that a color target below the read's end does not move the limit. Depth, stencil and HTILE go through the same check. A surface reaching into the headroom from below is left to the pending-write checks, which are tested, and to ResidentDepthGuardOverlaps_nid_no_patch, which is not.

The branch is rebased onto main 673c517827. The description has the new results. Six tests failed in the test selection on e0e6754f60, this head before the shadow test and two cut checks were added. Run one at a time, three of them fail on main too, and the other three pass in both branch runs. The description also names #16879: git merges it with this branch without a conflict, but the two do not build together, and it gives the change for whichever lands second.

AI-assisted: yes. Claude Code wrote the tests and this reply, and ran the builds and checks on my machine.

@videogamer10293

Copy link
Copy Markdown
Contributor Author

On main, two more ASTRO BOT levels stop when a host-heap allocation fails, in 2 of 2 runs each: hero_ape_escape and path_maker_mana_tree. With this head's driver, both ran to the 300 s cap in 2 of 2 runs each.

The description's title runs are Sky Garden on older commits, so this is the first title A/B on the current head.

PPSA21564 01.007.000, -lvl <level>, 3840x2160, 300 s cap.
A Cross press about every 6 s through tools/pad_input.py, starting at 20 s.
ANYPS5_VOLUME=0, APS5_PAD_INPUT_FILE, APS5_SCREENSHOT_TRIGGER, ANYPS5_SCREENSHOTS, APS5_TRACE_CALLS=all with APS5_TRACE_CALLS_FILE (no effect: not relinked with --trace-imports).
Windows 10 Pro 10.0.19045, Ryzen 5 7600X, RTX 5070 Ti, NVIDIA 616.92, WinLibs GCC 15.2.0, Release.
A: main 70eb0a4fa9.
B: A, with libSceAgcDriver.prx built from 3633754ec2 (this head, 20d136c337, merged onto A). Every other library is A's.
One run directory and shader cache for all runs. It was empty for the first run (A, hero_ape_escape); the first A run of path_maker_mana_tree had 90 misses, later runs 6 or fewer.
Counted runs in order: A ape, A mana, then B ape, B mana, B ape, B mana, then A ape, A mana. The uncounted runs below came between the first A runs and the B runs.
Level Arm End (launcher time) Failed allocation heap 1 used/budget
hero_ape_escape A stop at 138 s 117440512 bytes, memoryType=3 15347/15017 MiB
hero_ape_escape A stop at 64 s 117440512 bytes, memoryType=3 15432/15015 MiB
hero_ape_escape B 300 s cap (302 s), 2 of 2 runs none
path_maker_mana_tree A stop at 90 s 184549376 bytes, memoryType=3 15282/15019 MiB
path_maker_mana_tree A stop at 60 s 184549376 bytes, memoryType=3 15286/15015 MiB
path_maker_mana_tree B 300 s cap (302 s), 2 of 2 runs none
  • Every A stop is [videoout] presentation failed: AGC graphics: vkAllocateMemory buffer: ... Vulkan result -2, then exit 0xC0000409.
  • Every counted run logged Level has started for its level. The A runs stopped before their first [present] line after it. The B runs kept presenting until the cap: 25 to 47 presents per 10 s, after the first window.
  • I did not trace these runs, so I have not shown that the failed allocation is a growing vertex copy. The description shows that for Sky Garden.
  • Not counted:
    • One run with this head that also carried a local diagnostic in libSceAgc and the local skip below in the driver. It had a 150 s cap and reached it in hero_ape_escape.
    • Five main runs. Three carried a local skip for indirect draws from a base under 0x10000, which was never hit; they stopped the same way at 79 to 87 s. I stopped the other two, at 16 s and 73 s, before any stop.
  • These levels came out of a 24-level sweep on an older main, posted in Astro Bot (PPSA21564) #357.
  • Not covered: other GPUs and OSes, and perf(libSceAgcDriver): invalidate draw input snapshots by range #16879, which this PR depends on. No speed comparison: A logged no [present] window inside the level.

AI-assisted: yes. Claude Code ran the A/B on my machine, read the logs and wrote this comment.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed — no blocking findings

Nothing blocks this change; the source inspected supports the copy headroom guards, and the author reports focused tests and validation on this head.

What I ran

Read the prepared diff and source context at head 20d136c3379fd699fd01d8996e94dc3798748e02. No commands or tests were run.

Results

Check Result Note
Source review passed Core copy and recorder logic inspected
Tests not run Test results are author reported
Changed tests not verified Full test files excluded from review folder

Findings

Blocking

None.

Non-blocking

None.

Not verified

tests/Graphics.cpp and tests/Recorder.cpp were excluded from the prepared review folder because they were too large. Their diff hunks were read, but their surrounding test code was not. No build, tests, or title run was performed by me. The description reports focused tests, mutation checks, and Vulkan validation on this head; those results were not independently verified. description.md, commits.md, manifest.json, diff.patch, Draw.hpp, Recorder.hpp, VertexInput.hpp, Draw.cpp, and Recorder.cpp were read; no changed files were omitted from the manifest.

To get this to a good state

Nothing is required. Optional: add or retain call-site coverage for the render-target cut and budget cap, which the description says are not exercised by tests at the draw call.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 14, 2026
@blawesom

Copy link
Copy Markdown
Contributor

Validation run — item 57 (queue index 46): PR #19100 fix(agc): give a vertex copy headroom when its range keeps growing

Environment

  • Machine: CachyOS, kernel 7.3.4-1-cachyos, Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (RADV GFX1201) + AI PRO R9700, /dev/kfd present
  • GPU used: ANYPS5_GPU='AMD Radeon RX 9070 XT' (selected in logs: Physical device selected ... name=AMD Radeon RX 9070 XT (RADV GFX1201))
  • Validation layer: VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_ADD_LAYER_PATH=/home/benj/scratch/vvl-layer (layer .so at /home/benj/.local/opt/vulkan-validation-layers/usr/lib/libVkLayer_khronos_validation.so)
  • Parallelism capped at 12 (CMAKE_BUILD_PARALLEL_LEVEL=12, cmake --build build --parallel 12)

SHAs

  • PR head tested: 20d136c3379fd699fd01d8996e94dc3798748e02 (branch fix/agc-growing-vertex-copy; fix commit be554df5e3b, test commit 20d136c3379); PR state OPEN, not locked, head matches queue
  • Base: origin/main = a9f291040088cac6babfbe270c50f344a4f6f27d (worktree /home/benj/scratch/wt5/base-main, clean, reused existing build read-only)
  • PR worktree: /home/benj/scratch/wt5/pr-19100 at the exact head SHA, submodules git submodule update --init --recursive OK

Build (PR tree)

  • cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBUILD_TESTING=ON → exit 0, 11 s (log q57-pr19100-configure.log)
  • cmake --build build --parallel 12 → exit 0, wall 345 s, 9630/9630 steps (log q57-pr19100-build.log)

Focused test pattern (identical matched set in both trees)

Pattern (anchored alternation, saved in q57-pattern.txt): 40 tests covering the PR's area — agc_driver_recorder, agc_driver_graphics, agc_graphics_profile_draw (default suites containing the new vertex-copy-headroom tests), the vertex-copy/draw-input recorder tests (agc_driver_vertex_target_range_copied/imported, agc_draw_inputs_*, agc_changed_copy, agc_owned_draw_inputs*, agc_draw_snapshot_*, agc_copy_input_*, agc_*_kept_bytes, agc_mapped_copy_*, agc_snapshot_copy_failure, agc_driver_copied_writer_copy*, agc_recorder_kept_bytes) and vertex-fetch neighbors (agc_vertex_input*, agc_driver_vertex_fetch, agc_driver_indexed_copy*, agc_driver_zero_stride_vertex_fetch, agc_embedded_vertex_fetch*, …).

  • Verified with ctest --test-dir build -N -R '<pattern>' in both trees: 40 names each, diff empty (q57-pattern-base-names.txt / q57-pattern-pr-names.txt). Three vertex/copy/range-named tests that exist only on main (agc_driver_barycentric_patch_vertex_layer, agc_driver_frame_replay_allocation_ranges, agc_driver_pm4_rewind_copy) are excluded because the PR branch is 793 commits behind origin/main.

Test command (identical on both trees, timeout 3600)

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
VK_ADD_LAYER_PATH=/home/benj/scratch/vvl-layer VK_LOADER_DEBUG=layer ANYPS5_GPU='AMD Radeon RX 9070 XT' \
ctest --test-dir build -R '<pattern>' -V

Logs: q57-tests-base.log, q57-tests-pr.log.

Results

tree ctest exit wall passed failed skipped
base a9f29104 0 13 s 40/40 0 0
PR 20d136c3 0 14 s 40/40 0 0

Per-test pass/fail comparison: identical — 40/40 Passed on both trees, 0 status diffs (all timings within noise; heaviest: agc_driver_graphics ~5.0 s, agc_graphics_profile_draw ~5.0 s, agc_driver_recorder ~1.0 s).

Vulkan validation-layer checks (per AGENTS.md)

  • was not found but was requested by env var VK_INSTANCE_LAYERS: ABSENT in both logs
  • Insert instance layer "VK_LAYER_KHRONOS_validation": PRESENT in both logs (25 occurrences each)
  • VUID- / SYNC-HAZARD- / bracketed validation IDs: 0 in base, 0 in PR → no new IDs, none removed

PR coverage confirmation

The PR's new tests ran inside agc_driver_recorder on the PR tree (PR-only log line: the test block is not imported and watched: vertex copy headroom over a unit shadow not tested — the unit-shadow sub-case self-skips in this environment on both trees; the Require-based headroom assertions in growingVertexCopyTests/grownVertexCopyShadowTests and the GrownVertexCopyBytes/VertexCopyGrowEnd checks in agc_driver_graphics all passed).

Push

  • git push fork +20d136c3379fd699fd01d8996e94dc3798748e02:refs/heads/validation/pr-19100 → OK; fork ref refs/heads/validation/pr-19100 = 20d136c3379fd699fd01d8996e94dc3798748e02

Verdict

PASS — PR tree builds clean and the focused 40-test AGC vertex-copy/draw-input set is 40/40 green on both base and PR on Linux/AMD RX 9070 XT with the Khronos validation layer active, with no new VUID-/SYNC-HAZARD diagnostics.

Limitations

  • Linux + AMD RADV (GFX1201) only; no NVIDIA/Intel/AMD-PRO or Windows coverage. RADV itself reports "not a conformant Vulkan implementation, testing use only".
  • The unit-shadow variant of the new headroom test self-skips here (test block not imported/watched in this environment); it is covered only by its non-shadow paths on this machine.
  • Single run per tree (no repetition), so intermittent faults are not excluded; the PR branch is 793 commits behind origin/main, so the comparison is against the branch's own base, and three main-only test names were excluded from the pattern to keep the matched sets identical.

videogamer10293 and others added 2 commits November 19, 2026 01:32
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d unit shadows

GrownVertexCopyBytes and VertexCopyGrowEnd now hold the headroom arithmetic
and the cut at color, depth, stencil and HTILE addresses, with the same
behaviour, so validationTests checks them without a device: the quarter, the
limit, the DrawInputBudget cap at and past its edge, and targets below, at,
inside and past the headroom. grownVertexCopyShadowTests checks that a vertex
copy takes no headroom over a fresh unit shadow.
growingVertexCopyTests also checks that a kept vertex window that starts
past its address still lets a longer window grow after a store below it.
A draw's read inside the headroom, which may be served by a device mirror,
is checked to reuse the grown copy and hold the guest bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@videogamer10293
videogamer10293 force-pushed the fix/agc-growing-vertex-copy branch from 20d136c to e78ae2e Compare November 19, 2026 04:46
@videogamer10293

Copy link
Copy Markdown
Contributor Author

Rebased onto main 3c07e1d05e; head is now e78ae2ee05. MarcZX10's review and the runs by relativespace2K, JJenkx and blawesom were on older heads.

main gained #9875 (copy only the vertex records a draw fetches), #16760 (device mirrors of reused snapshots) and #18287 (the vertex plan in per-thread scratch). What changed in c6c8b8edcb to fit them:

  • CopyDrawInput keeps their from and hostOnly parameters; growLimit comes after them. The guarded read covers the bytes from from to the read's end; the headroom follows it.
  • ShorterDrawSnapshotKept checks a kept copy only from where its bytes start, as ReusableDrawSnapshot does.
  • The two new vectors live in VertexPlanScratch, and clear() empties them.
  • GuestWritesPendingIn checks queued labels behind QueuedLabelsOnThread, as the flush hook now does.

In the tests:

  • A reused vertex copy can now be a device mirror. The test of a read inside the headroom compares buffers through a host read (c6c8b8edcb), and e78ae2ee05 adds a draw's read, checked for reuse and bytes.
  • e78ae2ee05 adds a check that a kept copy that starts past its address still lets a longer read grow after a store below its start.

The description has the tests, mutation checks, validation and title A/B, all on this head and main 3c07e1d05e. The two levels from my earlier comment stop on main and reach the cap with this change, as they did then.

AI-assisted: yes. Claude Code rebased the branch, adapted it, ran the checks and wrote this comment.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed — no blocking findings

Nothing blocks this change based on the code inspected; approval is not justified because two changed test files were not fully read and no checks were run.

What I ran

  • Reviewed head e78ae2ee05b9de7e0146afcb5e14af11aa1412ab using the pinned repo_read.py reader.
  • Read the prepared description, commits, manifest, diff, and all seven changed files included in the review folder. Read targeted ranges from the two excluded test files.
  • No build or test commands were run.

Results

Check Result Note
Diff and source review passed Core change and targeted context inspected
Build and tests not run Author reports test results in the description
Excluded test files not run Targeted ranges only; full files not read

Findings

Blocking

None identified in the code inspected.

Non-blocking

None.

Not verified

  • The full contents of tests/Graphics.cpp and tests/Recorder.cpp were excluded from the review folder; only relevant ranges were read through the reader. The remaining portions of those files were not reviewed.
  • Build, tests, validation-layer checks, and title runs were not performed by this review. Results described by the author were not independently verified.
  • No merged-preview check was performed against the newer main head mentioned in the description.

To get this to a good state

Nothing is required.

@github-actions github-actions Bot added review queue Next in the maintainer review queue: checks pass, no open change request, no conflict and removed needs rebase Conflicts with main, rebase needed labels Nov 19, 2026
@domx4q

domx4q commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

NVIDIA Linux run with the Khronos validation layer of the current head e78ae2ee05; Tested is Windows only, and the NVIDIA runs in the thread are of older heads.

Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor 0x10de, device 0x2684, Ada), proprietary driver 620.70.06, Vulkan 1.4.357, Khronos validation layer 1.4.363.1. Head e78ae2ee05 merged onto main 40206fe50d with --no-ff (clean, as 58cf450a16). Main baseline is a Release build of 40206fe50d on the same machine.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer \
ctest --test-dir build -R '^(agc_exclusive_scratch|agc_driver_graphics.*|agc_driver_recorder.*|agc_recorder_.*)$' -V
main 40206fe50d this PR
Result 19 of 19 passed 19 of 19 passed
Insert instance layer "VK_LAYER_KHRONOS_validation" 16 16
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0
VUID- none none

The pattern covers every test built from the three test files this PR changes (ExclusiveScratch.cpp, Graphics.cpp, Recorder.cpp): 19 tests, the same 19 on both sides. main runs main's versions of those files; the merge runs this PR's, with the new vertex copy headroom cases. The layer is inserted 16 times on each side, and every device created was the RTX 4090.

No VUID- errors on either side; all 19 focused tests pass on Ada.

AI-assisted: yes (Claude Code)

@ShootanoJumper

Copy link
Copy Markdown
Contributor

Windows 11 23H2 (22631), Ryzen 7 5700X, NVIDIA RTX 4060 (driver 616.56), WinLibs GCC 15.2.0 r7, Release, merged into main ed1def4dd4 with git merge --no-ff.

Of the 208 tests the change reaches, the only failures are ones main also fails on this GPU (#23942).
No validation layer is installed here, so this says nothing about VUID- errors.

@Superseabas Superseabas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Windows check of head e78ae2ee05 with GCC 16, on an NVIDIA GPU and on an AMD one. The AMD runs in the thread are of older heads. Merged onto main e493612311 (clean merge).

Setup: Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (x86_64-ucrt-posix-seh, r3), Release full build, run from PowerShell with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. GPUs, each picked with ANYPS5_GPU: NVIDIA GeForce RTX 5070 Ti (621.01) and the Ryzen 7 7700X's integrated AMD Radeon (1002:164e, Adrenalin 26.10.2). This was built together with #24906, which touches other files.

  • agc_driver_recorder (with growingVertexCopyTests), agc_driver_graphics and agc_exclusive_scratch: all pass on both GPUs, on main and with this PR, in 3 of 3 runs, with no VUID- lines.
  • Red check: with GrownVertexCopyBytes never growing (if (growLimit <= bytes) return bytes; → return bytes;), agc_driver_recorder fails on the Radeon with "a vertex copy past an unchanged shorter one took no headroom".

The growth conditions read well to me. It only grows a vertex copy past an unchanged, shorter kept copy at the same address, by at most a quarter, within DrawInputBudget and the attribute descriptors' end. It stops at any color, depth, stencil or HTILE address, and only when the extra bytes have no pending write, storage result, unpublished unit shadow, resident depth or host-only samples. The extra bytes are collected with the read, so the kept copy's generation covers them.

AI-assisted: yes (Claude Code)

@oneandonlydean
oneandonlydean merged commit 5f1b0ec into boykopovar:main Nov 24, 2026
14 of 16 checks passed
@github-actions github-actions Bot removed the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants