Commit 5a0615588a1ab8cda51df8974541a77d64f27f10

Amirali Abdolrashidi 2024-01-31T13:05:59

Vulkan: Update dynamic buffer size policy When allocating a dynamic buffer, it is checked if the new data can fit in an existing allocation. However, if the size of the new data exceeds that of the current buffer, a new one is allocated. To avoid using too much memory, if the data size is less than a threshold (a fraction of the current buffer size, a smaller size will be used for the new buffer. However, with a specific pattern for the new sizes, combined with the threshold value, there could be many allocations and deallocations, which can affect the performance. In this CL, the policy to update the dynamic buffer size is updated to avoid this issue. * Instead of using a smaller buffer when the required size is less than 1/4 of the current buffer size, it is done when the average required size is less than 1/8 of the current size. * Added a decaying average required size for the DynamicBuffer object. * mSizeInRecentHistory * For each new buffer allocation, the new required size is used with the average size to calculate the new average. * For each calculation, kDecayCoeffPercent is used as the weight for the existing average, and the rest is the new required size, plus rounding. * kDecayCoeffPercent is currently set to 20%. * sizeIgnoringHistory renamed to minRequiredBlockSize for more clarity. Bug: b/322216767 Change-Id: Idcabbbe50f656910fe2103925e4d6d8602ca3425 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5254218 Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>