src/libANGLE/renderer/vulkan/vk_mem_alloc_wrapper.h


Log

Author Commit Date CI Message
Charlie Lao 83a670ab 2021-10-29T09:12:26 Vulkan: Implement BufferPool using VMA's virtual allocator VMA's allocation calls used to be sub-allocating a pool of memory. What we really want is sub-allocate a VkBuffer object. VMA recently added support to expose the underlying range allocation algorithm via APIs, which user can use it to sub-allocate any object. This CL uses that new virtual allocation API to sub-allocate from a pool of VkBuffers. In this CL we only switched BufferVk::mBuffer to sub-allocate from the BufferPool object. Bug: b/205337962 Change-Id: Ia6ef00c22e58687e375b31bc12ac515fd89f3488 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3266146 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 421dbf20 2021-10-26T19:06:19 Revert "Vulkan: Use different strategy for buffer memory allocation" This reverts commit 0dbe308d91a3526e28fecd9014d873c649f4ef71. Reason for revert: crbug.com/1253325 Original change's description: > Vulkan: Use different strategy for buffer memory allocation > > This CL uses different memory allocation strategy based on the requested > size. If the requested size exceeds 1M, we use dedicated memory > allocation to avoid memory waste associated with the sub-allocator. > Otherwise we uses VMA's sub-allocator pool. This CL creates two sets of > customized pool so that we uses different allocation strategy for each > set of pool: the small pool uses buddy algorithm which favors speed over > memory and large pool uses default algorithm that favors memory saving > over speed. This CL also replaces vmaFindMemoryTypeIndexForBufferInfo > with vmaFindMemoryTypeIndex to avoid create and destroy VkBuffer object > just try to find memoryTypeIndex. > > Bug: b/195588159 > Change-Id: I2bddbfffd77ba2ce6b9389d83a31051c4b748c4d > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2939490 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> Bug: b/195588159 Change-Id: I2c8fe8cb2930d16f5212570d32be68e7c6a6e5f3 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3244258 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Charlie Lao 0dbe308d 2021-07-16T14:26:20 Vulkan: Use different strategy for buffer memory allocation This CL uses different memory allocation strategy based on the requested size. If the requested size exceeds 1M, we use dedicated memory allocation to avoid memory waste associated with the sub-allocator. Otherwise we uses VMA's sub-allocator pool. This CL creates two sets of customized pool so that we uses different allocation strategy for each set of pool: the small pool uses buddy algorithm which favors speed over memory and large pool uses default algorithm that favors memory saving over speed. This CL also replaces vmaFindMemoryTypeIndexForBufferInfo with vmaFindMemoryTypeIndex to avoid create and destroy VkBuffer object just try to find memoryTypeIndex. Bug: b/195588159 Change-Id: I2bddbfffd77ba2ce6b9389d83a31051c4b748c4d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2939490 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao 8ef1b2a2 2021-07-15T15:27:15 Vulkan: Add BufferMemoryAllocator class BufferMemoryAllocator class will be responsible for memory allocation for vkBuffers. The original Allocator class remains the wrapper for vmaAllocator. Bug: b/195588159 Change-Id: I26d016e2f8d13ba459d0aa0bd4e1ebf4d0d48251 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3036256 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Tim Van Patten 1e435d07 2020-10-14T13:33:10 Vulkan: Support dumping VMA stats string This CL adds support for dumping the VMA stats string, which can be given to VmaDumpVis.py to visualize the allocations that the VMA has performed. To enable dumping the string, set: RendererVk.cpp rx::kOutputVmaStatsString = true Copy the desired JSON output into a text file, and pass that to VmaDumpVis.py: python3 \ third_party/vulkan_memory_allocator/tools/VmaDumpVis/VmaDumpVis.py \ -o stats.png stats.txt The legend for the visualization is available at: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/tree/master/tools/VmaDumpVis Bug: angleproject:2162 Test: Manual verification Change-Id: Ic8c1002805dd57e594df724bcf1cdbc1d1599a3e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2472525 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
David Reveman 9a19a996 2020-08-26T09:00:50 Vulkan: Use 4 MB as preferredLargeHeapBlockSize for allocator. This reduces preferredLargeHeapBlockSize from the default value of 256 MB to 4 MB, which reduces the initial block size from 32 MB to 512 KB. 4 MB is the same size as used by Chromium and Skia. It seems to be a good compromise of not wasting unused allocated space and not making too many small allocations. This change is limited to non-Qualcomm GPUs as a number of tests are failing on Qualcomm after this change and the initial investigation indicates a potential driver bug. See http://anglebug.com/4995 for more details. Bug: chromium:1122718 Bug: fuchsia:58959 Change-Id: Ifdaf863ef38e72098a04ee57dec46ee71cab6ac3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2376891 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: David Reveman <reveman@chromium.org>
Stuart Morgan 5dba723d 2020-06-16T09:29:16 Add newline-eof to warnings Bug: angleproject:4757 Change-Id: I8ff6cb1277bf31ed8d6af667aa59ab8029633fe0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2247488 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Antonio Maiorano 13816d2d 2020-06-16T14:27:04 Move vulkan_headers/entry_points to common/vulkan This will allow us to move common headers, such as extension headers, to common/vulkan. Bug: b/159027603 Bug: b/154620295 Change-Id: I1ff73dc5b7ee8f7dfb3ac0c5f30bd4b3a8183aeb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2248205 Commit-Queue: Jamie Madill <jmadill@chromium.org> Commit-Queue: Antonio Maiorano <amaiorano@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 17b4a877 2020-05-26T17:02:48 Vulkan: Pass API version to VMA. This apparently can save on memory usage in the allocator. Reported by penghuang@chromium.org. Bug: angleproject:4685 Change-Id: I6f29280e3fe16f3388c4f8412e0acb09d7f16e58 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2216714 Reviewed-by: Tobin Ehlis <tobine@google.com> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6c158164 2020-05-28T15:19:51 Vulkan: Fix XFB invalid accesses in buffer OOM. This uses the "null" buffer in the Renderer to bind an empty buffer handle so ANGLE can maintain a consistent state. Bug: chromium:1086532 Change-Id: I1912a1d1cb64433a285fcfced80a675619690a0b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2219140 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Jonah Ryan-Davis 3cb9c4be 2020-03-13T13:56:47 Statically link vulkan-loader on Mac Disable angle_shared_libvulkan on Mac since we are the only client. Re-add codepaths to support this. Bug: angleproject:4477 Change-Id: Ie128c83adaae741636541bbfd6105d160d874a8d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2102954 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Tobin Ehlis <tobine@google.com>
Mohan Maiya b7d6949b 2020-04-17T13:36:14 Vulkan: Enable persistently mapped buffer objects The VMA allocator has a handy feature where during memory allocation we can request persistently mapped memory. This saves IOCTL overhead for apps that update buffers frequently. Bug: angleproject:2162 Change-Id: I870d880033beec343efae6de06f1c5935de4c2c1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2155131 Reviewed-by: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com>
Hyunchang Kim 6e0d718a 2020-03-31T18:41:57 Vulkan: Implement device memory sub-allocation Use AMD Vulkan Memory Allocator for device memory sub-allocation. We now have a mempool from which all glBuffer memory is allocated. The CPU overhead involved in repeated IOCTL calls to the kernel is reduced significantly. Bug: angleproject:2162 Change-Id: Id7681ffe2ac3d2853141ebe34c7df7b7fdd0d55e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2124519 Reviewed-by: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Jamie Madill 76d52be3 2020-04-07T09:14:29 Vulkan: Add VulkanMemoryAllocator to DEPS. Bug: angleproject:2162 Change-Id: If91ae40c1fe818a59d775bb2fa066227dd52859d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2139992 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>