Skip to content

fix(agc): return a synchronous draw's render target memory to the image pool - #9188

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
thuanquang:fix/render-target-image-pool
Nov 2, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
thuanquang:fix/render-target-image-pool

Conversation

@thuanquang

@thuanquang thuanquang commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What

A synchronous draw (a draw into a color target that has no resident image) renders into a RenderTarget, a per-draw image of the target's size. RenderTarget takes its memory from the image pool (AllocateImageMemory) but freed it with vkFreeMemory, so the pool never got the memory back. Every synchronous draw therefore created and freed device memory of the whole target's size.

It now keeps the allocation's size and memory type and returns the memory with ReleaseImageMemory, as OwnedImage does. The next synchronous draw of the same size takes it from the pool. The image is still destroyed before its memory is released. Today the only production RenderTarget is the synchronous draw's, and it is destroyed after SubmitAndWait.

Tested

Rechecked merged onto main 14c99b52ac (2026-10-26, AMD Windows driver 32.0.21045.16010):

  • RenderTargetMemoryReuse fails with main's Resources.cpp (the two FAIL: lines below) in 3 of 3 rounds; with this change it passes 3 of 3.
  • 15 tests pass 3 of 3: the 12 listed below and three more that make synchronous draws, agc_driver_cmask_fast_clear, agc_driver_srgb8_color_target and agc_driver_packed_unorm4444_color_target.
  • Under the validation layer (inserted in all 14 GPU test processes, no "was not found" line), the only VUID- errors are 3 of VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 in agc_driver_srgb8_color_target. Plain main 14c99b52ac reports the same 3 there (fix(agc): enable independentBlend for color targets with different blend states #6782 enables independentBlend).

Rebased onto main 513ca7e558 (head fc74d9349f) for the needs-rebase conflict: #7919 added the agc_snapshot_copy_failure test block next to agc_buffer_pool_tests, whose target_sources line this PR extends with Resources.cpp. Both are kept and the PR's change is unchanged (git range-diff). On this head, built clean: the 12 tests below, 3 rounds, all pass; under the Khronos validation layer 12 of 12 pass with 0 VUID- lines, the layer inserted 11 times, no "was not found" line.

New test case: RenderTargetMemoryReuse in agc_buffer_pool (mock device, CPU only). It checks that a released render target's memory stays in the image pool and that the next render target of the same size takes it.

  • To build it, agc_buffer_pool_tests now also compiles Resources.cpp.
  • main f90a3f7297 with only the test fails:
    FAIL: a released render target freed its image memory instead of returning it to the image pool
    FAIL: a second render target of the same size allocated new image memory instead of the pooled one
    
  • With this change it passes 3 of 3.

RX 6700 XT (gfx1031), AMD Windows driver 32.0.21045.5002, Windows 11 26200, MinGW GCC 15.2 Release:

  • 12 tests, 3 rounds, all pass: agc_buffer_pool, 10 tests that draw through non-resident color targets and agc_driver_linear_target_resident, whose target is imported and resident:
    • agc_driver_uint8x4_color_target_no_resident
    • agc_driver_color1555_target, agc_driver_color565_target
    • agc_driver_packed_float_color_target, agc_driver_packed_unorm_color_target, agc_driver_packed_mip_tail_target
    • agc_driver_pixel32_ar_export, agc_driver_pixel_uint16_export
    • agc_driver_pixel_ancillary_word, agc_driver_pixel_fixed_point_position
    • agc_driver_linear_target_resident

Khronos validation layer A/B (VK_LOADER_DEBUG=layer shows the layer inserted in all 11 GPU test processes on both sides, with no "was not found" line), same 12 tests:

  • main with only the new test: 11 of 12 pass (the new case fails as above), 0 VUID- lines.
  • This PR: 12 of 12 pass, 0 VUID- lines.

PPSA14363 (METAL GEAR SOLID Master Collection Vol. 1, own dump), RX 6700 XT:

  • Workload. The title draws its PS1 games into three linear 3072x2048 R8G8B8A8 color targets that have no host import, so all those draws are synchronous. The PS1 intro makes up to about 80 of them per frame.
  • Runs. One run each, 150 s, APS5_PROFILE_DRAW=1, warm shader cache, the same scripted input (title screen, Game Selection, Start Game).
  • Local change on both sides: stop 1, sceNpTrophy2GetTrophyInfo: trophy 19 is not in .../trophy00.ucp, was bypassed locally; fix(libSceNpTrophy2): return INVALID_TROPHY_ID for a trophy that is not in the title's data #9115 fixes it.
  • Results. From the [draws] and [bufferpool] lines, per 10 s window in the PS1 section:
main f90a3f7297 this PR
synchronous draws per window 80 to 162 261 to 596
average synchronous draw 27.3 to 49.5 ms 13.6 to 15.8 ms
prepare phase per synchronous draw (allocation and image creation) 5.5 to 12.1 ms 0.03 to 0.05 ms
writeBack phase per synchronous draw (includes the free) 12.6 to 17.3 ms 7.0 to 7.3 ms
image pool over the run 667 hits, 1287 misses 6502 hits, 37 misses

The game reached its 3000th guest flip (flip counts of the [packets] lines, PS1 logos) after 107.9 s on main and 69.4 s with this change. On both sides the host stopped presenting about 60 s into the run, while the guest kept flipping. That happened with APS5_PROFILE_DRAW=1 on this unattended desktop, so treat the flip times as rough. The per-draw rows above don't depend on it.

Gameplay, 2026-10-22: main 6ef5a1c4c9 + #9115 + #9373 on both sides. libSceAgcDriver.prx was built with and without #9188 and #9202; nothing else differs. Two 600 s runs per side, alternating, with the same scripted input and APS5_PROFILE_DRAW=1:

without #9188 and #9202 with both
MGS1 opening and codec, presents per 10 s 38 to 74 168 to 190
average synchronous draw 17.7 to 27.1 ms (one window 76 ms) 4.6 to 7.4 ms in the opening and codec, 1.3 to 2.1 ms at the Dock
codec line "The Codec's receiver directly stimulates the small bones of your ear." at 440 s and 538 s at 183 s and 204 s
Dock gameplay, radar on screen not reached in 600 s (both runs) at 237 s and 268 s

No run stopped. The second run with both changes was slower at the Dock (107 to 147 presents per 10 s, against 124 to 196 in the first). These runs held only this PC's GPU lock, so other work on the PC may have slowed it. The title's progress is tracked in its bring-up discussion, #9615.

With #9879: #9879 creates the host import of these three targets. In our runs with its branch (2026-10-23), the PS1 part made no synchronous draws on the RX 6700 XT, so once #9879 is merged this change no longer affects PPSA14363 on that GPU. It still applies to every target #9879 keeps synchronous (listed in #9879). The two PRs don't depend on each other and merge cleanly in either order.

Other GPUs, from reviewers: @MaxLikesCode, NVIDIA GeForce RTX 4090, driver 617.42, Windows 11 Pro 26200, head c9a9831f7 merged onto main 38d3c0858:

Not tested: AMD GPUs other than the RX 6700 XT, Linux. The PS1 section is still far from 60 fps: each synchronous draw also copies the whole 24 MiB target in and out. That is a separate change.

Overlap: #10194 (@harry-z-kang) adds allocation accounting on the same render-target release path in Resources.cpp; agreed order: this PR first, then #10194 rebases around its ReleaseImageMemory call.

Checklist

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

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 21, 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 11920 core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp L141-142

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 4472 core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp
PR 6553 core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/include/Resources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp
PR 9712 core/libs/prx/libSceAgcDriver/Graphics/include/Resources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp
core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp

@thuanquang
thuanquang force-pushed the fix/render-target-image-pool branch from 5640d84 to c9a9831 Compare October 21, 2026 16:26
@MaxLikesCode

Copy link
Copy Markdown
Contributor

RTX 4090 (Ada) on Windows, head c9a9831f7 merged onto main 38d3c0858 (clean).

NVIDIA GeForce RTX 4090, driver 617.42, Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. The 12 tests from the description (agc_buffer_pool and the 11 that draw through non-resident color targets) with ANYPS5_REQUIRE_VULKAN=1 and ANYPS5_NO_SHADER_CACHE=1, 3 runs without and 3 with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan-ValidationLayers vulkan-sdk-1.4.363.0, implicit layers disabled). The loader log shows the layer inserted in all 11 GPU test processes, and no log has was not found but was requested by env var VK_INSTANCE_LAYERS.

Build Without the layer With the layer VUID-
main 12 of 12 pass, 3 of 3 runs 12 of 12 pass, 3 of 3 runs none
main + #9188 12 of 12 pass, 3 of 3 runs 12 of 12 pass, 3 of 3 runs none

tools/select_tests.py on the merged tree: 1166 of the 1169 selected tests pass. The 3 failures are agc_driver_sample_order, _grid_reference and _recipe_depth_locations, which fail the same way on main on this GPU (#9313, fixed by #9056). agc_driver_image_array_window_past_layer_limit is left out: it does not compile with MinGW (#8310).

AI-assisted: yes (Claude Code)

…ge pool

RenderTarget, the per-draw image of a synchronous draw, took its memory from
the image pool but freed it with vkFreeMemory, so the pool never got it back
and every synchronous draw created and freed device memory of the target's
size. It now keeps the allocation's size and memory type and returns the
memory with ReleaseImageMemory, as OwnedImage does.

Co-Authored-By: Claude <noreply@anthropic.com>
@thuanquang
thuanquang force-pushed the fix/render-target-image-pool branch from c9a9831 to fc74d93 Compare October 23, 2026 10:58
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
@harry-z-kang

Copy link
Copy Markdown
Contributor

@thuanquang Draft #10194 adds opt-in allocation accounting for #10041. The overlap audit flags the render-target release path in Resources.cpp.

The combined code should keep your ReleaseImageMemory(context, memory, memoryBytes, memoryType) call: my pool hooks already distinguish retained memory from actual frees. Replacing it with the direct accounting/free wrapper would lose your pooling change.

I propose your PR first, then rebasing accounting around that release path. Your PR does not need to wait for #10194. Does that order work for you? If accounting lands first, I can help resolve the overlap here. Test results are in #10194. AI-assisted: yes.

@thuanquang

Copy link
Copy Markdown
Contributor Author

@harry-z-kang, that order works for me: this PR first, then #10194 rebases its accounting around the release path. Keeping the ReleaseImageMemory(context, memory, memoryBytes, memoryType) call is right: that call is what returns the render target's memory to the pool. This PR doesn't need anything from #10194, so I've left its Depends on at none and added the order to the description. #10194 can list Depends on: #9188.

@thuanquang

thuanquang commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor Author

(Duplicate of the reply above, sent at the same time; nothing to add.)

@oneandonlydean oneandonlydean self-assigned this Oct 23, 2026
@cadenasynyster

Copy link
Copy Markdown
Contributor

Windows 11 (10.0.26300), RTX 5070 Ti, NVIDIA driver 617.42, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, Ninja. Head fc74d93 merged onto main 6cd36e6 (clean); full build, ninja exit 0.

Title: ASTRO BOT (PPSA21567, v01.018, own dump), skipping the intro through the menu. Both builds with APS5_PROFILE_DRAW=1, warm shader cache, same scene, one run each. Baseline is main b64df51 (the previous main, same scene).

In this scene the game runs at about 1 fps, and #9188 does not change it:

10 s windows, ~140-360 s main main + #9188
image pool hits 35 24
image pool misses 3,158 (172 s), 9,942 (271 s) 9,450 (252 s), 17,083 (361 s)
image misses per second about 68 about 68
[draw] pipelined, time per commit 864-889 us 782-879 us
queue 0 DRAW_INDEX_OFFSET_2 x1,812-2,222, 6.3-6.8 s x1,920-2,222, 6.4-6.8 s

The run ended cleanly: 361 s, 0 error lines.

In a committer sample of main in this scene, none of the 15,372 samples has a RenderTarget function in its stack. The image allocations come from BufferPool::AllocateMemory under Graphics::DepthSurfaceTexture, and the pool misses without any hit. So this PR isn't expected to help this title, and it doesn't make it worse. Why that path doesn't reuse its memory I haven't determined.

Not run: the PR's own tests on this GPU, the validation layer, PPSA14363 (the title this PR was measured on), AMD, Linux, and a main-vs-PR comparison on the same main commit (the baseline is the previous main).

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@cadenasynyster I checked these counters against the scope of #9188. The miss totals are cumulative and sampled at different times: the two intervals work out to about 68.5 misses/s on main and 70.0/s with the PR, rather than a several-fold increase. With one run per side and different main commits, that is not enough to attribute a regression or establish no harm. The sampled DepthSurfaceTexture allocations also differ from the synchronous RenderTarget path this patch returns to the pool; the lack of a sampled RenderTarget stack is consistent with the unchanged frame rate here. So this does not contradict the scoped reuse fix or establish an Astro speedup. The depth-surface reuse question remains separate; a same-main comparison with matched windows and allocation/release counts would help isolate that path.

@thuanquang

Copy link
Copy Markdown
Contributor Author

@oneandonlydean, a status note now that #9879 is on main, so you can decide on this one.

  • PPSA14363: as the body says, with perf(agc): create the host import of a linear color target in registered memory #9879 the PS1 part makes no synchronous draws on the RX 6700 XT, so this change no longer affects it there.
  • PPSA05110 (Persona 5 Royal): it makes none either. All 23 of our runs with APS5_PROFILE_DRAW=1 (2026-10-25 to 2026-10-27; title, New Game, opening movie and casino gameplay) report 0 synchronous in every one of their 684 [draws] windows of 10 s.

So no title we run needs this change on main today. What it fixes is still there: a synchronous draw takes its target-sized memory from the image pool and frees it with vkFreeMemory, for the targets #9879 keeps synchronous. Keep it or close it, whichever you prefer; I'm fine with either.

AI-assisted: yes (Claude Code)

@TechLevelZero

TechLevelZero commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head fc74d93 merged onto main 9f748f4 · tested 2026-10-30 20:20 UTC · 21 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,393 passed · 5 failed (0 new, 2 also fail on main, 3 unstable on main) · 42 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,440 of 3,021 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (910 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_bda_device 54.3 s, ⚠️ agc_driver_graphics_maps_fallback 31.4 s, ⚠️ agc_driver_graphics 30.5 s
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_submit_progress: failed in 5 of the last 9 main runs
agc_submit_progress: failed in 5 of the last 9 main runs
agc_submit_progress_no_timeline: failed in 7 of the last 9 main runs
Failing on main too (2, not counted against this PR)
guest_mmap_executable
guest_socket_options_multicast
Validation IDs already present on main (4 IDs in 425 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (425 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_passes_draw_transitions, agc_driver_address_passes_targets_split, agc_driver_array_layer_target_cpu, agc_driver_bda_span_reads_draw_pipeline, agc_driver_bitfield_mask, agc_driver_buffer_atomic_csub, and 417 more
VUID-vkCmdCopyImage-srcImage-01548 (13 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 5 more
VUID-vkCmdCopyImage-srcImage-01551 (13 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 5 more
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
Skipped (42)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_msaa_dcc_compared_import_2: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_4: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_8: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_main: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fresh: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or plat
Reproduce
git fetch origin fc74d9349f87e22942973901ee4f1ffe3fa9b876 9f748f4d8e36ce3714f3b95f3386316e110a9b22
git checkout 9f748f4d8e36ce3714f3b95f3386316e110a9b22 && git merge --no-ff fc74d9349f87e22942973901ee4f1ffe3fa9b876
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

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

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@thuanquang thanks for checking. Since #9879 landed, neither title we run makes synchronous draws, so this no longer changes anything they do. The fix is still correct, though. A synchronous draw keeps its target-sized memory out of the image pool until the draw's batch retires, and returning it is right whichever title triggers it. So we'll judge this PR as a correctness change. That means review plus exact-head CI, with no title A/B; the registered tests cover the path. If you'd rather close it, that's fine too.

@thuanquang

Copy link
Copy Markdown
Contributor Author

@oneandonlydean thanks, please keep it open as a correctness change. The head is still fc74d9349f (no change since the NVIDIA GPU run above), and GitHub reports it merges cleanly onto current main 8c8b998620.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 31, 2026
# Conflicts:
#	core/libs/prx/libSceAgcDriver/CMakeLists.txt
#	core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 1, 2026
@thuanquang

Copy link
Copy Markdown
Contributor Author

@oneandonlydean thanks for merging main in. I had resolved the same two conflicts locally on main dc9dc7eaae (38b29a4171), and your merge f53c877a87 has identical Resources.cpp, Resources.hpp, tests/BufferPool.cpp and tests/cmake/agc_buffer_pool_tests.cmake, so I won't push mine. On that tree (RX 6700 XT, AMD driver 32.0.21045.5002, Windows 11 26200, full build):

  • the 12 tests from the description pass 12 of 12 in each of 3 runs, and under the Khronos validation layer (inserted 11 times, no "was not found" line) with 0 VUID- lines;
  • with main's Resources.cpp and Resources.hpp and this PR's test, agc_buffer_pool fails: FAIL: a released render target freed its image memory instead of returning it to the image pool and FAIL: a second render target of the same size allocated new image memory instead of the pooled one.

The merged head itself (on c674f8c14d) was not built here.

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head f53c877 merged onto main e6f5730 · tested 2026-11-01 16:24 UTC · 25 min

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

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

@oneandonlydean
oneandonlydean merged commit 334d46e into boykopovar:main Nov 2, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants