fix(agc): reuse one tiled and one linear texture upload scratch per recorded batch #10773
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10773"
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 fma-rc on 2026-10-24T23:54:41Z.
What
Every texture upload recorded into the open batch allocated two device buffers of its own, the tiled copy of the guest bytes and the linear output of the detiler, and kept both until the batch completed. A batch that uploads many textures held all of them at once. In Death Stranding 2 (PPSA02015) while it loads, these two buffers were the largest device allocations after the textures, storage images and shadow copies: 1301 MiB live at 900 s.
The open batch now keeps one tiled and one linear scratch buffer, and every upload recorded into it reuses them. A scratch smaller than the upload is replaced by one of exactly the upload's size; the old one stays with the batch, which already records its use. An upload without a recorder (the dump aid,
APS5_SYNC_TEXTURE_UPLOAD, tests) still allocates its own buffers and waits for them.Reusing the scratch puts a write after the previous upload's reads and writes of the same buffer, so the barrier before the staging copy now also waits on the transfer and compute stages and covers the transfer write.
Tested
New test
agc_recorder_upload_scratch: five linear uploads of 64, 32, 64, 128 and 128 pixels into one open batch. Each upload no larger than an earlier one adds only its staging bytes to the batch's kept bytes, the larger one keeps a grown scratch, and each texture samples back its own value.maina texture upload no larger than an earlier one of its batch allocated scratch of its ownWith the Khronos validation layer's synchronization checks on lavapipe and RADV, the test reports no hazard.
Rebased onto
mainabed035468(2026-10-27), keepingmain's newagc_recorder_failed_checknext to this test: all nineagc_recorder_*tests pass on the RTX 5080, RADV (Radeon 610M) and lavapipe, and the Windows build and ctest show no failure the merge base lacks.Death Stranding 2, 900 s of loading on the RTX 5080, with the local fixes it needs to get that far,
main's upload path against this PR's:Astro's Playroom (PPSA01325) into its first level and Animal Well (PPSA22520) in its first room: the same picture as
main, and the same speed (Playroom 3684 frames against 3685 over a 170 s run, Animal Well 14311 against 14305 over 240 s).Full ctest on RADV and on Windows (MinGW GCC) shows no failure that
mainlacks. Arch Linux.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-24T23:59:22Z.
Review: APPROVED
Reviewed exact head
1b752939dc84b69a65e195c5a9b569c847b6aecc. The scratch lifetime stays with the recording batch: each buffer is retained when first allocated, and a grown buffer replaces the active slot without releasing the older buffer before earlier commands complete. The unrecorded, dump, and synchronous-upload paths still allocate private buffers. The barriers provide the needed ordering between prior transfer/compute uses and the next reuse. The regression covers reuse at equal/smaller sizes, growth, and sampling each upload afterward.git diff --check upstream/main...HEADandtools/check_conventions.py --base upstream/main --head HEADpass. I could not run the full CMake/AGC test target locally: this worktree has uninitialized third-party submodules, and compiling the recorder source directly stops at the generatedMeshArguments_spv.h. Hosted product-test jobs are path-skipped. The PR records the focused GPU test and synchronization-validation results on NVIDIA, RADV, and lavapipe, plus the game capture comparison. I found no blocking issue in the source review.