fix(agc): bound the upload buffers that recorder batches keep alive #1113
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1113"
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 Celegans12 on 2026-10-07T12:54:51Z.
What
A recorded texture upload keeps its staging, tiled and linear buffers until its batch completes, and nothing limited how much a batch keeps.
Recorder::Keeptakes an optional byte count, passed by the sampled upload (Textureconstructor) and theStorageTextureupload and write-back scratch buffers.Recorder::BoundKeptBytesruns at the start ofcachedTextureandcachedStorageTexture, before anything is recorded (the flush hook'sSyncThroughcan already submit there). It submits the open batch once it keepsKeptBytesBudget(512 MiB). While the batches in flight plus those this thread already finished in the hold (Sync,Reap) keep more than twice that, it destroys the finished ones' objects, then waits for the oldest in flight and destroys its objects, not at the unlock, so the buffers return toBufferPoolwithin a hold.DRAW_INDIRECTuploads ~10.6k BC textures for its image table into one batch during a 10-12 s hold; at 219 s a 0.7 MiB texture allocation fails withVK_ERROR_OUT_OF_DEVICE_MEMORY(6.6 GiB of device buffers live) and the draw is skipped.Tested
maine2b527bb: configure-DBUILD_TESTING=ON, full build,--target libs,ctest:ctest --output-on-failure)VK_DRIVER_FILES): 385/385 pass;agc_driver_flat_storeis left out there because it takes several minutes on Windows llvmpipeagc_recorder_kept_bytes(mock device): a batch is submitted at the budget, not below; six budget batches leave two in flight and the four oldest released under the GPU mutex, and six synced one by one in one hold leave at most two alive. Does not compile onmain.DRAW_INDIRECTrecords 585k texture uploads; device buffers peak at 2.7 GiB. A 1,500 s run without it failed at the first such burst (~700 s, 6.6 GiB of device buffers live).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T19:36:37Z.
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.
main)core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppL89-96core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppL315-317, L1492core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppL285-286Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T07:39:53Z.
Checked on current
main: build + full ctest (424/424,agc_recorder_kept_bytesincluded); the new test doesn't compile without the change; every path that takes a batch out ofinFlightgoes throughfinish, so the byte count stays consistent. CI is green on the current head. Merging.