fix(agc): retain GPU copy buffers before fallible diagnostics #10141
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10141"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by VicRaster on 2026-10-23T10:42:11Z.
What
With
APS5_CAPTURE_GPU_COPIES=1, diagnostic readback allocation can fail after an input copy is recorded. Retain its destination before recording the copy, and retain diagnostic readback storage before recording commands that use it, so exception unwinding cannot return pending buffers to the pool.Replaces #8667, which closed after I accidentally deleted the contributor fork. The original commit was recovered from its retained PR ref and applied to current main.
Addresses the review on #8667: current main's execution-test discovery builds and registers
CopyInputLifetime.cpp, including skip code 77; the mock regression is now registered on both platforms and usesGuestAllocations::Mutationwithout a Windows-only test body. No experimental memory policy is included.Tested
Refreshed on 1 November 2026 against main
cae3edaf11db8c6c1694c2d772d07c079755a71f; tested headd08d4ab7a39d1056b383663411bced714e4b9666.Resolved the CMake registration conflict using upstream's
tools/agc_test_split.py resolve: the mock registration now lives intests/cmake/agc_driver_graphics_tests.cmake, and the Vulkan test settings intests/cmake/agc_driver_copy_input_lifetime_tests.cmake. The production lifetime fix applied cleanly; reviewed its ordering against the current recorder.Windows 11 Pro build 26300, Ryzen 9 3900X, NVIDIA GeForce RTX 3080 Ti 12 GB, driver 610.88, WinLibs MinGW-w64 GCC 15.2.0, Release.
Both phases used identical refreshed regression fixtures and registration. For the baseline, only
GuestBufferMemory.cppwas restored byte-for-byte from pinned main; the fixed phase used the clean refreshed head. Rebuilt the AGC library and focused test targets for each phase.agc_copy_input_failure_lifetimeagc_driver_copy_input_lifetimeagc_buffer_poolagc_driver_graphicsagc_copy_input_kept_bytesThe Vulkan successful-readback control passes on both sides. The allocation-refusal path records one refusal on both sides, with
early_reuse=1on baseline andearly_reuse=0after the fix. Fixed selection: 5/5 passed, none skipped.Both verbose CTest runs used
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, andVK_LOADER_DEBUG=layer. Both logs identify the RTX 3080 Ti and positively show Khronos validation layer insertion, with zeroVUID-errors and no missing-layer warnings. The lifetime fixtures also enableAPS5_CAPTURE_TRACE=1andAPS5_CAPTURE_GPU_COPIES=1. Binary SHA-256 hashes recorded for both phases.Focused command:
ctest --test-dir build -R '^(agc_buffer_pool|agc_driver_graphics|agc_copy_input_kept_bytes|agc_copy_input_failure_lifetime|agc_driver_copy_input_lifetime)$' -V.Convention and whitespace checks pass. Targeted open-PR searches for the diagnostic lifetime correction found no duplicate implementation; the earlier full overlap audit remains historical and was not rerun for this refresh.
Not tested locally in this refresh: Linux, other GPUs, the full repository suite, completion-callback registration allocation failure, game compatibility, or performance. The separate contributor NVIDIA/Linux and AMD/Windows reports below apply to the previous head.
AI-assisted refresh, conflict resolution, testing and report: Codex.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T10:55:43Z.
Review: APPROVED
Reviewed the production lifetime ordering, portable mock regression, real Vulkan execution test, and the earlier #8667 review history. This replacement addresses the prior blockers:
CopyInputLifetime.cppis built and registered with skip-77 handling, and the mock regression is registered on both platforms using guest-allocation mutation rather than a Windows-only body. The destination buffer is retained before the recorded input copy; the diagnostic readback is retained before its commands use it. The earlier #8667 evidence reports both regressions failing on baseline and passing after the fix, including independent RTX 4080 SUPER runs and an integration validation run. I did not run the GPU-dependent target locally in this environment. No blocking issue found.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T11:44:40Z.
Review: CHANGES_REQUESTED
Correction to my earlier approval after checking the exact head against current
main777bdbb4f80bcc03e870dfda0d292c0c6410fd6a: this branch is 73 commits behind, with merge basec188e01a4286bfc402519df2ceb56441479cc835. Since that base,mainhas changed all three overlapping paths:Graphics/src/GuestBufferMemory.cpp,tests/Graphics.cpp, andCMakeLists.txt(plus added execution tests under the same tree). The reported before/after and validation-layer runs are qualified against the older base, so they do not establish the new regression and lifetime ordering in the current recorder/test-registration context. Please rebase onto currentmain, resolve the semantic overlap, and rerun the focused mock and Vulkan lifetime tests on currentmainand the refreshed head with the AGC validation-layer comparison required by CONTRIBUTING. I am changing my review to CHANGES_REQUESTED until that evidence is available. The existing Windows RTX 3080 Ti runs remain useful for the earlier base; I am not discounting them.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T02:36:03Z.
Review: APPROVED
Re-checked — new head, looks good
The rebase resolves the stale test-registration overlap, and the refreshed production fix retains each buffer before recording commands that use it.
What I ran
Reviewed head
d08d4ab7a39d1056b383663411bced714e4b9666against basecae3edaf11db8c6c1694c2d772d07c079755a71f; the merge preview against currentmaincf79276fee2f042feb6a7c71d0d6a27e9cfe2592is clean. Environment: Debian Linux x86-64, Python 3.11.2; no local C++ or GPU build.Results
Keep-before-copy ordering and registers the mock and Vulkan tests in the current CMake fragments.Negative control
GuestBufferMemory.cppbyte-for-byte while keeping the refreshed fixtures.Findings
Blocking
None found in the refreshed head.
Non-blocking
Linux, other GPUs, completion-callback registration allocation failure, and the full suite were not tested in this refresh. The detailed Windows runs and baseline control are author-reported.
Sources
Not verified
I did not run a local build, CTest, Vulkan validation, or the baseline control. The Windows test run and negative control are author-reported.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-11-09T18:55:51Z.
Review: CHANGES_REQUESTED
The production change looks right, but the full Build on this head fails on the test this PR adds:
agc_driver_copy_input_lifetime(Linux job on lavapipe, run 42489330618). Output:core/libs/prx/libSceAgcDriver/tests/execution/CopyInputLifetime.cpp, finalRequire(checked && !earlyReuse, ...): in the success scenario (fail=0) the copy destination is never found in the pool afterrecorder.Sync(), socheckedstays 0 and the test aborts even thoughearly_reuse=0. The CI host is llvmpipe without/dev/udmabuf, so the buffer path differs from the NVIDIA/RADV/Windows runs that passed. The test needs to pass there too (queue's Linux job is the gate); either don't require the destination to reappear in the pool (assert onearlyReuseand read back through a handle the test owns), or make the check hold on that driver.Once the test passes on the Linux CI job it should be good to merge.