Repository navigation
feat(agc): place device buffers in host memory when device memory runs out - #5513
Merged
adriadam10 merged 1 commit intoOct 14, 2026
Conversation
…s out Device buffers now choose their memory type as sampled textures and storage images do since boykopovar#4108: when the allocation does not fit in the budget VK_EXT_memory_budget reports for the device-local heap, it goes to a memory type on another heap. A buffer placed so is destroyed on release instead of entering the device tier of the pool, so later requests do not reuse host memory as device memory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 tasks done
|
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.
|
Collaborator
|
Checked: |
12 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
#4108 places sampled textures and storage images in host memory when the device-local heap's
VK_EXT_memory_budgetbudget cannot hold them, and leaves device buffers toBufferPool::AllocateMemory's trim on failure. On a 2 GB GPU that trim is not enough: PPSA12361 (Transport Fever 2: Console Edition) allocates 176 MiB device buffers once a map loads, the pool recovers one of them by releasing 270 MiB and then fails withDeviceBuffernow picks its memory type withContext::DeviceMemoryType, as textures and storage images do: the device-local type while the allocation fits in the reported budget, otherwise a type on a heap that is not device-local. WithoutVK_EXT_memory_budget, or with no budget reported, nothing changes. Placements are logged by the existing[gpu] device buffer: ... placed in host memoryline.Once usage is over the budget every new device buffer goes to host memory and is not pooled, so allocations are made and freed more often there. #4472, which stops the pool keeping device buffers over the budget, addresses the related retention side.
Tested
Windows 11, MinGW-w64 GCC 15.2.0, NVIDIA GeForce MX450 2 GB (driver 581.83).
agc_buffer_pool_tests: newHostPlacementreports 1600 of a 1620 MiB budget used and requests a 176 MiB device buffer; it is allocated from the host memory type and freed on release, not kept. With usage at 200 MiB the same request is device-local, is kept, and serves the next request. Without the change both host checks fail. All buffer pool tests pass.agc_device_memory_fallback_testsandagc_driver_graphics_testspass.mainat8d98e8851.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)