src/libANGLE/renderer/vulkan/Suballocation.h


Log

Author Commit Date CI Message
Charlie Lao c402ea1c 2023-02-15T12:01:38 Vulkan: Rename hasUnfinishedUse to hasResourceUseFinished Most usage of hasUnfinishedUse is for !hasUnfinishedUse, and there was feedback that negative API is not preferred. This CL changes it to positive API name. Similarly renamed hasUnsubmittedUse to hasResourceUseSubmitted. Bug: b/267348918 Change-Id: Idb10b0f998ec50116ffb6aada19a98a516e87824 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4257105 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi 48e40ef6 2023-01-06T13:35:21 Add per-heap memory allocation trackers * For each member of MemoryAllocationType, we now have a per-heap counter to keep track of the allocation size in each available heap. * mActivePerHeapMemoryAllocationsSize * mActivePerHeapMemoryAllocationsCount (debug mode only) * Added the memory type index to onMemoryAlloc() and onMemoryDealloc() as an input. It can then be used to determine the used memory heap index for that allocation using the memory properties defined in the renderer. * checkForCurrentMemoryAllocations() will now log the heap index of the current memory allocations in debug mode and during an OOM crash. * logPendingMemoryAllocation() will now log the heap index of the pending allocation during an OOM crash. * Renamed constexpr values used for tracking for more consistency. * kTrackMemoryAllocation -> kTrackMemoryAllocationSizes * kDebugMemoryAllocationLogs -> kTrackMemoryAllocationDebug Bug: b/262029018 Change-Id: I178a3556b3107edc0c72c6b23ea2f2d6b12da947 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4149431 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Ivan Neulander <ineula@google.com>
Charlie Lao 2e5ca217 2022-11-18T10:44:49 Vulkan: Let each current context has its own QueueSerial. This CL makes every current context has its own queueSerial. At context creation time or when context becomes current, it allocates a QueueIndex from renderer. When it becomes non-current, it releases QueueIndex for others to reuse. This way we significantly reduces the max number of QueueIndexs for reasonable usage. Each CommandBuffer has its own unique QueueSerial and we use that to determine if a resource is being used by the given CommandBuffer. The QueueSerial for RenderPassCommands is deferred until renderPass starts, and when we generate queueSerial for renderPassCommands, we also reserve a range of serials for outsideRenderPassCommands so that we can do incremental submission of outsideRenderPassCommands without need to close renderPassCommands. In rare situation, if that reserved serials runs out, we also close renderPassCommands to ensure the ordering of serials matches ordering of command buffers. With per current context queue serial, this CL is able to set resource queue serial as it is being used. This CL completely removes usage of ResourceUseList class since it was introduced due to deferred setSerial. This CL also get rid of refCount from ResourceUse since there we no longer add it to a ResourceUseList. With that, we also able to remove SharedResourceUse class since access to ResourceUse itself is now thread safe since we are able to make a copy of it when we add it to GarbageList. Because RenderPassCommands now has its own unique QueueSerial as it encodes command, we can use it to detect if a resource is being used by it or not, thus this CL also removes usage of CommandBufferID. Bug: b/255414841 Change-Id: I36dcbeaa7bc996f04e6c04bf9ad44cd0d630f61a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4038096 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Amirali Abdolrashidi b2f55ec3 2022-11-14T16:07:19 Vulkan: Add memory allocation/deallocation counter * Added a counter to the renderer object to keep track of the memory allocations and deallocations per allocation type. * The counters are updated with the functions onMemoryAlloc() and onMemoryDealloc(), which can be added next to the allocation or deallocation point. * Currently used for buffer memory and image memory. * Removed some of the redundant arguments from vk_helper and suballocation functions. Bug: b/242641395 Change-Id: I58b38f619df7bef0ba5fa3373a8db5aed0ef142c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4014164 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 8378032e 2022-11-15T11:47:55 Vulkan: Remove get API for mLastCompletedQueueSerial In preparation for per context queue serial, this CL makes mLastSubmittedQueueSerial and mLastCompletedQueueSerial private to CommandQueue. Before this CL, we have a get function to return the last submitted serial and last completed serial and passing these serials around. This works because the serial is a single uint64_t number. With per context queue serial, this will be an array of serials and there is potential risk associated with access it from different threads. This CL makes these serials private to CommandQueue and when you want to know if GPU is completed with resource, you ask RendererVk/CommandQueue directly. This way we can ensure they have thread safe access in the CommandQueue (no lock is necessary, but all access will be restricted to one class). Bug: b/255414841 Change-Id: Ica565decce4a80588e0b447e179a2b634b55d7c3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4021676 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao b9bc09cb 2022-08-24T13:15:45 Vulkan: Always enable mVirtualBlockMutex Right now this is only enabled if async queue submission is enabled. I think this is a bug that we have to always enable the lock, since suballocation destroy could come from any threads. Bug: b/236098131 Change-Id: I0fda61e5db3ff60f776b8d4917a9f10dafed6b1a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3855203 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com>
Charlie Lao c7459a46 2022-07-15T09:55:03 Vulkan: Destroy descriptorSet cache when BufferBlock destroyed When a new cache entry has been created, we record the cache entry in the BufferBlock. When BufferBlock is destroyed, we also immediately destroy the cache entry since the cache will no longer reused. This CL also removes DescriptorCacheResult from various APIs since it is now redundant with newSharedCacheKey argument. Bug: b/237686097 Change-Id: I14fa8906fdbe7d9226c8e8ecddef2beb05fbaa5c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3756694 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Auto-Submit: Charlie Lao <cclao@google.com>
Charlie Lao 8df0c53e 2022-07-11T16:56:26 Vulkan: Split suballocation out into it's own file Right now Suballocation and BufferBlock classes are in vk_utils.h, which is included by other header files. This made it difficult to have these two classes use variables defined in other headers. And vk_utils.h is really designed for utilities, it isn't the best place for bufferBlock/suballocation by definition. This CL split out suballocation code into its own file to make future CLs much easier. No functional change is expected other than move the code around. Bug: b/237686097 Change-Id: I36733468b4bed152a19d9c9bca8e7459c11c3b43 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3756761 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>