fix(agc): rebind moved read-only buffers in place instead of snapshotting them #19131
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19131"
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 relativespace2K on 2026-11-12T20:56:45Z.
What
A dispatch-cache hit that moves a read-only buffer now binds the host import serving the buffer at its new address instead of snapshotting its bytes into device memory.
MovedDispatchBuffersaccepts such a buffer regardless ofAPS5_DISPMOVE_MAX_KIB, so the 1 MiB snapshot limit no longer refuses a moved read-only buffer that an import serves, and a buffer too large to snapshot (the 4 GiB descriptor heap in #18186) can take the hit instead of rebuilding.DrawBindingscarries the imported buffer, offset and range, andMarkGpuWritesnotes the rebound ranges as in-place reads, so a CPU store into them after the record waits like any other in-place read. The import is resolved per use throughHostImportView, which returns its serial: a retired or replaced import (a re-registered range) is picked up by the next dispatch instead of being bound stale. A range whose descriptor offset would need an adjustment keeps the snapshot path, as the build's patches are not recomputed here.As discussed in #18186, this is the correctness PR for the
DispatchMoveBytes()limit, for the limit's own sake. It is not a performance change; the per-dispatch resources cost stays in #18186.Tested
Windows 11 IoT Enterprise LTSC 26100, Ryzen 5 5600, RX 6800 XT (RDNA2, subgroup 64), AMD proprietary driver 26.10.1, Vulkan 1.4.315, WinLibs GCC 15.2, Release. AGC tests with
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layerandctest -V, from one build directory.mainb99796f81b:agc_driver_dispatch_move,agc_driver_dispatch_move_depth,agc_driver_dispatch_cache_defaults,agc_driver_dispatch_data_hit_words,agc_driver_address_draw_space_reuseand its_off,_transitions,_verify,_heldvariants: 9 of 9 pass.47d76d23a5: the same 9 plus the newagc_driver_dispatch_rebind: 10 of 10 pass.Insert instance layer "VK_LAYER_KHRONOS_validation", neither containswas not found but was requested by env var VK_INSTANCE_LAYERS, and neither has aVUID-line.agc_driver_dispatch_rebindmoves a 2 MiB read-only buffer between host-imported guest ranges and requires the move to be taken in place (no snapshot, no rebuild). It then writes the guest range from the CPU between two dispatches and requires the next dispatch to read the new bytes, and re-registers the range (a new import) and requires the dispatch after it to read the new bytes again.PPSA24096 (
Cronos: The New Dawn), the intro cinematicv001_cinebink.bk2, 3840x2160, warm caches,APS5_REGISTRATION_PREPARE_COMMIT_GB=24, trace window anchored on the file open and 180 s long, same machine and scene. These aremainf57c971559and the change at15569ffec809(its head before the rebase onto currentmain; the rebase did not touch the change):Two 180 s windows per side. Neutral on frame time, as expected: the rotating heap is not what bounds this scene.
[dispmove]in the same scene: 2556 of 2569 moved read-only buffers per 10 s bind in place (none before this change), and theover the limitrefusals fall from 354 to 54 per 10 s. Captured 4K frames matchmain: no right-edge text column and no corner icon artifact from the earlier prototype.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)