fix(agc): give copied guest buffer regions transfer-source usage #7961
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7961"
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 milescoviello on 2026-10-19T16:09:46Z.
What
A guest buffer region that is copied rather than imported gets a buffer with storage usage, plus device-address usage when it is addressable, and nothing else. Host imports, sparse imports and chunk imports also carry
VK_BUFFER_USAGE_TRANSFER_SRC_BIT, so a buffer view of imported guest memory can be read back withvkCmdCopyBuffer, but a view of a copied region can't.agc_sparse_run_import_copieddoes exactly that readback. The Khronos validation layer reportsVUID-vkCmdCopyBuffer-srcBuffer-00118for it, which the sweep ofmain's^agc_tests under the layer turned up.GuestBufferMemory::copyRegionnow adds transfer-source usage to the copied region's buffer.Tested
Ubuntu 24.04, GCC 13.3, NVIDIA RTX 4070 Ti (595.99.02).
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -V,^agc_sparse_run_import, throughVK_LAYER_PATH. Neither log reports the layer missing.main6762694735reportsVUID-vkCmdCopyBuffer-srcBuffer-00118×3; this change reports none.mainreports00118×2 over^agc_sparse_run_import|sparse_buffer_holes; this change reports none.^agc_driver_recorder|sparse|import|guest_buffer|buffer_memory|bda|mirror|^agc_driver_graphics$pass, as onmain6762694735. Before the test seeds were updated,agc_driver_sparse_buffer_holesandagc_sparse_buffer_holesfailed onthe upload did not reuse the primed buffer, which shows the pool reuse they check is keyed on usage.mainb106f6f8c0without conflicts.054cf42202merged ontomainc6145997ef: under Ubuntu's 1.3.275 validation layer,^agc_sparse_run_import,agc_sparse_run_import_copied,agc_driver_sparse_buffer_holesandagc_driver_graphicsreportVUID-vkCmdCopyBuffer-srcBuffer-00118×1 onmainand none with this PR, and pass 4 of 4 on both. The full suite gives 1735 of 1736 with and without this PR, with the same one failure (agc_driver_guest_memory_lifetime, #7784) and no JUnit entry added, skipped or removed.054cf42202:agc_driver_sparse_buffer_holespasses 3 of 3. With onlyGraphics/src/GuestBufferMemory.cppfrom the merge base, the same test fails 3 of 3 (the upload did not reuse the primed buffer at the expected extent).agc_*tests under the 1.4.363 layer onmain27fabb6b7and with this PR merged into it. Onmain,agc_sparse_run_import_copiedlogsVUID-vkCmdCopyBuffer-srcBuffer-00118forcopyRegion's buffer. With this PR, that error is gone and the validation output is otherwise identical. The same 6 tests fail on both sides, none of them related to this change.agc_driver_*_testsonmain950388bfd:00118is reported once, only fromagc_sparse_run_import_copied. With this change that test passes with no00118. One run.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T16:26:01Z.
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.
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/tests/BdaResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/tests/BdaResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/tests/BdaResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/tests/BdaResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/tests/BdaResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/tests/BdaResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/tests/BdaResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppImported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-20T20:59:35Z.
First AMD run of this PR, on Linux with RADV. Head
054cf4220merged ontomainc6145997e(clean merge), built in full and compared with the samemain, on the same machine.AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release.
With the Khronos validation layer (Ubuntu's 1.3.275,
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1) overagc_sparse_run_import,agc_sparse_run_import_copied,agc_driver_sparse_buffer_holesandagc_driver_graphics:mainmain+ this PRVUID-vkCmdCopyBuffer-srcBuffer-00118Full suite (
ANYPS5_REQUIRE_VULKAN=1 ctest -j8) at07a5d3d16: 1735/1736 with this PR, against 1735/1736 onmain. The one failure is the same on both, so this PR adds none:agc_driver_guest_memory_lifetime(#7784). Comparing the JUnit output withmain, no entry is added, skipped or removed.GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T21:06:26Z.
Thanks @DavidAmsellem, that's the first AMD coverage for this one. I added your run to the description: the VUID goes from 1 to 0 under RADV, and the full suite has no new failure or skip.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T07:13:07Z.
Independent Windows run of this PR with a baseline (data only).
Environment: Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, NVIDIA GeForce RTX 4080 SUPER (the log shows
Selected GPU name=NVIDIA GeForce RTX 4080 SUPER vendor=0x10de device=0x2702 subgroup=32, picked withANYPS5_GPU=4080), WinLibs GCC 15.2.0 (MinGW-w64 UCRT), Release. PR head054cf42202; merge-tree againstmainis clean. I builtagc_driver_sparse_buffer_holes_testsonly.Results (3 runs each):
agc_driver_sparse_buffer_holespasses 3/3.tests/execution/SparseBufferHoles.cppand replaced onlyGraphics/src/GuestBufferMemory.cppwith its version from the merge base6762694735, then rebuilt. The test fails 3/3 withAGC graphics: sparse buffer holes GPU: readable interior: the upload did not reuse the primed buffer at the expected extent. I restored the PR'sGuestBufferMemory.cppafterwards.Not run: other GPUs (no AMD card for this PR), other platforms, the other tests, the full repository CTest, and any title or console run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T07:18:10Z.
Thanks @xXPBSXx. The fail on the merge base's
GuestBufferMemory.cppwith the PR's test is the check I didn't have for Windows. I added your run to the Tested section and the GPU line.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-21T11:35:09Z.
Independent run with the Khronos validation layer on AMD. It confirms the layer-reported error this PR removes, with no other change across the AGC tests.
Setup: Windows 11 Pro 26200, AMD Radeon 680M (RDNA 2 iGPU), AMD driver 32.0.21030.2001, WinLibs GCC 15.2.0 r7, Release, full build.
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(SDK 1.4.363),ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1.mainis27fabb6b7; the PR is this head merged into that same commit.ctest -R '^agc_' -j 4 -V(875 tests) on both.main:agc_sparse_run_import_copiedlogsVUID-vkCmdCopyBuffer-srcBuffer-00118:srcBuffer ... was created with VK_BUFFER_USAGE_2_STORAGE_BUFFER_BIT|VK_BUFFER_USAGE_2_SHADER_DEVICE_ADDRESS_BIT but requires VK_BUFFER_USAGE_2_TRANSFER_SRC_BIT. The buffer iscopyRegion's.agc_sparse_run_import_copied,agc_driver_sparse_buffer_holesandagc_sparse_buffer_holespass.agc_*tests, the validation errors are identical on both sides except for the one removedsrcBuffer-00118. The same 6 tests fail on both (agc_reimport_bench,agc_driver_tessellation,agc_driver_sample_orderand two of its variants, andagc_driver_image_array_window_past_layer_limit, which doesn't build on Windows). These failures are known onmainon this device and unrelated to this change.was not found but was requested by env var VK_INSTANCE_LAYERS).For reference, the GPU-copy path for the same
Region::buffer(stagingBuffer(..., gpuCopyUsage(addressable))and theBuffermade withgpuCopyUsage(addressable)) already carriesTRANSFER_SRC|TRANSFER_DST, so this change bringscopyRegionin line with it.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T11:45:27Z.
Thanks @DavidSamir, that's the first AMD run of this PR under the layer, and the first across the whole
agc_*suite. It shows exactly the onesrcBuffer-00118removed and nothing else changed. I added it to the Tested section and the GPU line.About the unrelated failures:
agc_driver_sample_orderand two of its variants fail onmainon my RTX 4070 Ti as well. There the cause is in the tests: they bind a multisampled depth surface's own view as a sampled image, and a surface sampled through its shadow image has noSAMPLEDusage (VUID-VkWriteDescriptorSet-descriptorType-00337). #9056 makes them read a sampled copy instead, and then they pass here. If those are the variants failing on the 680M, #9056 may fix them there too.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T19:52:09Z.
Validation-layer data point for this PR (data only; follow-up to my earlier RTX note).
Setup: Linux (WSL2 Ubuntu 24.04, GCC 13.3, Release), llvmpipe,
vulkan-validationlayers1.3.275.0-1 from the Ubuntu archive (older than the SDK a driver ships with),VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation.main950388bfd; this PR's three-line change (taken asgit diff upstream/main...refs/pr/7961) applied on top of it.Before (
main): across all 483 builtagc_driver_*_teststhe layer reportsVUID-vkCmdCopyBuffer-srcBuffer-00118once, fromagc_sparse_run_import_copied: "srcBuffer ... was created with VK_BUFFER_USAGE_2_STORAGE_BUFFER_BIT_KHR|VK_BUFFER_USAGE_2_SHADER_DEVICE_ADDRESS_BIT_KHR but requires VK_BUFFER_USAGE_TRANSFER_SRC_BIT".After (this PR):
agc_sparse_run_import_copiedrun again with the layer: 0 reports of that VUID, test passes.One run each, on llvmpipe only. I did not run the other tests with the change under the layer.
Not run: other GPUs for the layer run, other platforms.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T19:53:37Z.
Thanks @xXPBSXx. That confirms
agc_sparse_run_import_copiedis the only test in the 483 that hits00118onmain. I added the run to the Tested section and lavapipe to the GPU line.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-22T07:54:19Z.
Windows/NVIDIA reproduction on current main
d6eafa54dAGC code (our only additional initial change was SystemService parameter100):agc_sparse_run_import_copiedpasses its output assertion but emits00118 under official Khronos1.4.363. The log shows the copied source buffer has STORAGE_BUFFER|SHADER_DEVICE_ADDRESS and lacks TRANSFER_SRC. We found your existing fix while checking this; no duplicate implementation or issue opened.I have merged published054cf42202 cleanly into the next 007 WIP alongside #9565 atc4162b2156. It is source-only/UNBUILT: our pinned current-main 007 baseline is still compiling changed pipelines, so no concurrent builds/native tests. I will run the sparse copied/imported and buffer-hole controls with the same layer before any runtime change. No Windows fix-pass or FPS claim yet. AI-assisted: Codex.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-22T08:27:27Z.
@milescoviello, merged, thanks. Full CI on
054cf42was green on Linux and Windows, and agc_sparse_run_import_copied and agc_driver_sparse_buffer_holes pass on Linux. Thanks also to @DavidAmsellem, @xXPBSXx, @DavidSamir and @Scramblrrrr for the runs on RADV, NVIDIA and AMD under the validation layer.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-22T09:14:25Z.
@oneandonlydean thanks for merging. @Scramblrrrr thanks for the Windows/NVIDIA reproduction under the 1.4.363 layer: the copied source buffer lacking
TRANSFER_SRCon currentmainis exactly the case this fixes.AI-assisted: yes (Claude Code)