Repository navigation
fix(agc): bound the upload buffers that recorder batches keep alive - #1113
Merged
Merged
Conversation
|
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.
|
This was referenced Oct 7, 2026
A sampled texture upload keeps its staging, tiled and linear buffers until the batch that recorded it completes. A draw whose image table uploads thousands of textures records them all into one open batch, so in PPSA26344 6.6 GiB of device buffers were live when the next texture allocation failed with VK_ERROR_OUT_OF_DEVICE_MEMORY. Recorder::Keep now takes the bytes an object holds, and the sampled upload and the storage upload and write-back scratch paths pass theirs. Before each sampled or storage texture lookup, BoundKeptBytes submits the open batch once it keeps 512 MiB. While the batches in flight and those a sync or reap of this hold already finished keep more than twice that, it destroys the finished ones' objects, then waits for the oldest in flight and releases its objects at once instead of at the unlock. agc_recorder_kept_bytes checks these bounds on a mock device.
Celegans12
force-pushed
the
fix/agc-batch-kept-bytes
branch
from
October 7, 2026 20:42
4d0a2f0 to
9af8e9e
Compare
Collaborator
|
Checked on current |
This was referenced Oct 8, 2026
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
maine2b527b: 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)