src/common/FastVector_unittest.cpp


Log

Author Commit Date CI Message
Geoff Lang b25ffe5a 2023-12-07T16:36:29 Optimize HandleAllocator for fast ID churning. Instead of calculating ranges of IDs and the overhead with updating them every allocation/release, store a released ID list in a small FastVector. Optimize the allocate path for the "good case" of no reserved IDs so that it either pops the last released ID or incriments a next value and returns it. Release has a similar cost of just a push_back when there are no reserved IDs. This adds a small fixed memory cost due to the FastVector and a dynamic memory cost of mReleasedList having up to N elements where N is the maxmimum total handles allocated at one time. Bug: angleproject:8434 Change-Id: I7c5aa126b5303c105cd2464d0d0933b922cc2b8f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5101509 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 014e584f 2023-08-21T15:51:30 Vulkan: Separate out XFB data from ShaderInterfaceVariableInfo Right now the transform feedback data is embedded in the ShaderInterfaceVariableInfo. This caused ShaderInterfaceVariableInfo becomes non-trivial copy-able. This CL moves transform feedback related data out and into its own array, and entire vector of ShaderInterfaceVariableInfo is now memcpied. Further, most programs don't use transform feedback. Right now because transform feedback data is embedded in the ShaderInterfaceVariableInfo, it bloated the size of ShaderInterfaceVariableInfo even if you do not use XFB. This CL makes transform feedback variable info data a std::unique_ptr so that if not used, it is just a nullptr. When we load/save the structure, the ones that has nullptr gets skipped. Bug: b/296433003 Change-Id: I61940a683611717ab0445fcbf44b89b1b7166ee4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4799344 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com>
Shahbaz Youssefi 7adf6532 2023-06-20T16:31:34 Remove unused helper classes Bug: angleproject:6954 Change-Id: I325f6a67b1f2f1dffdf051f83a8d4f29c4fe25dd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4628678 Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Igor Nazarov 98735ee0 2023-03-10T16:37:12 Revert "Fixed bugs in "FastVector" class." This reverts commit 94ff37bb2110f838b92c5bae22a657982ccb48ff. Alternative fix will be in the follow up CL. Bug: angleproject:8021 Bug: chromium:1417087 Change-Id: Ib34cd14b6cf36f474cc0ae09605ef1490aed82f8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4328285 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Igor Nazarov 94ff37bb 2023-01-17T19:11:50 Fixed bugs in "FastVector" class. Bugs: - items resources may not be freed after resizing to a lesser size. - reusing capacity may use old values for the new items. Fixed by resting removed items to default values. Alternative fix is to disallow dangerous operations on non trivially constructible/destructible types. Bug: angleproject:8021 Test: angle_unittests --gtest_filter="FastVector.DestroyOldItems" Test: angle_unittests --gtest_filter="FastVector.ReuseCapacity" Change-Id: I8bc616a9476608c9301e3f7af3a0d504e7e2d2db Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4249960 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Mohan Maiya b267c009 2022-05-26T16:36:31 Add support for comparison operator in FlatUnorderedSet Overload operator== so FlatUnorderedSet objects can be used as values in a hashmap. Tests: FlatUnorderedSet.Comparison* Bug: angleproject:5033 Change-Id: Ica746adf87f7c603789593e726051e4562d6a931 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3671826 Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill c82513af 2022-04-14T05:04:11 Add FastMap class. We can use this class in a few cases where we can know that the integer key index won't exceed a fixed small boundary. Bug: angleproject:4524 Bug: angleproject:6776 Change-Id: Ic380e1ce8f4dc591504603ade376d9b1e8a3c1c4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3579865 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill c874943b 2022-02-18T15:29:14 Rename FastUnordered types to FlatUnordered. These names are consistent with the common parlance. Flat indicates the values are packed in memory, while fast indicates that lookup is as fast as possible. Bug: angleproject:6776 Change-Id: I7b56af26d7fdbf5956872be5033c3aa3f6b1b8c7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3484978 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Auto-Submit: Jamie Madill <jmadill@chromium.org>
Steven Noonan 9e8c929e 2021-10-20T17:19:02 FastVector: fix stack read overrun in ensure_capacity mSize should not be set until *after* calling ensure_capacity, otherwise we will read past the end of our statically allocated buffer when initializing the new array. This was caught by AddressSanitizer during one of the Vulkan BasicDraw tests, when compiling a shader to SPIR-V. Bug: angleproject:6600 Change-Id: I9ddb326d03ce5cda23973110e63d30b8829da2f6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3235901 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Peter Kasting 4f2b2995 2021-09-23T09:50:46 Fix -Wshadow. This still disables the warning for glmark2 instead of fixing it, to avoid needing to upstream a patch. Bug: chromium:794619 Change-Id: Ice602996041d6090c9b09ee81c8ed095c4fa6b2e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3179860 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi c072daec 2021-05-26T14:26:28 Add FastVector constructor with begin/end iterators Useful to construct a FastVector out of a subrange of another container. Bug: angleproject:4889 Change-Id: I0e62b601c7d171167343d526d198fa21ba52f0f9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2920191 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Courtney Goeltzenleuchter d19c08c9 2020-08-25T08:07:31 Fix ASAN issue with FastIntegerMap.BasicUsage ASAN bot caught bug in FastIntegerMap.BasicUsage test. The end() iterator points past the end of the list, accessing end()->first is invalid. rbegin() points at the last element of the list which is what this test intended. Bug: b/166255370 Change-Id: I06e098143d3de9658088cda6f10761d41b17a520 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2375305 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Mohan Maiya f9a062c9 2020-08-16T14:09:41 Vulkan: Add FastIntegerSet and FastIntegerMap class Add FastIntegerSet container to enable fast contains operation for a set of integer keys. The class uses a BitSet vector to achieve performance. Add FastIntegerMap container to improve buffer serial tracking performance. FastIntegerMap uses FastIntegerSet container to track buffer serial keys. It also provides an ensureCapacity method to reserve space, for the expected buffer count, upfront. CommandBufferHelper::mUsedBuffers and ContextVk::descriptorSetCache are now FastIntegerMap CommandBufferHelper::mRenderPassUsedImages is now a FastIntegerSet Based on a CL by Jamie Bug: angleproject:4950 Test: angle_unittests.exe --gtest_filter=FastInteger* Change-Id: Ib58be20143f588baab99acadac796f2435f72d54 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2369466 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Jamie Madill 5b4f6e31 2020-08-15T23:03:34 Vulkan: Add overlay widget for RP buffer count. Can help evaluate when scenes stress out the resource tracking in the RenderPass command buffer. Bug: angleproject:4950 Bug: angleproject:4965 Change-Id: I7da2ad0101a840c5441f2112db4bb61f564afcef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2358521 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Jamie Madill d201ed8b 2020-08-02T16:29:35 Vulkan: Track used Images in RenderPass. Adding a simple ImageSerial tracking map in our RenderPass allows us to know when we do or do not need to close the RenderPass on a new Image access. This simple tracking scheme improves Manhattan performance by up to 25% on Android. The improved perf comes from reducing our RenderPass count (23->18 RenderPasses in our capture scene). Adds a FastUnorderedSet class to manage the used RP Image serials. Updates the Query helpers to explicitly flush the RP before inserting queries. Bug: angleproject:4911 Change-Id: I0c34fc8e307514ebdf3e81e08d8e5aedb70ebe8f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2334346 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 5e5b7537 2020-08-10T21:02:50 Vulkan: Optimize resource tracking in CommandBufferHelper. Introduces a FastUnorderedMap class that uses FastVector. This type uses static storage for up to a small fixed number of elements and uses dynamic storage for anything larger. Local testing shows this almost fully solves the regression from using unordered_map. It's still slightly slower than using no tracking (<5%). Very degenerate cases which track dozens or more buffers will still have significant overhead. For almost all applications that use only a few buffers per RenderPass this will be very fast. Test: angle_perftests, *vulkan_null_index_buffer_changed_ushort Bug: angleproject:4950 Bug: angleproject:4429 Change-Id: I39edeaaa159124167f1ea23ad2e6eac5e9220d0b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2348108 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 20c01390 2018-09-19T15:43:28 Fix FastVector::resize when count < size. Also update a test to trigger the bug. Bug: angleproject:2763 Change-Id: I8e6735320a34dcc4cc8beee1b7a22b768912f24f Reviewed-on: https://chromium-review.googlesource.com/1234338 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill bf7cfbea 2018-09-19T03:56:20 Re-land "Add FastVector for simple dynamic vector cases." Re-land fixes memory leak and adds inline to a few more methods. This optimized vector keeps an initial fixed size storage but has unbounded growth like a normal std::vector. It operates like a FixedVector initially but then switches the storage to an allocated pool when the element count exceeds the array limit. This gives fast performance in the small case since no dynamic allocation is needed. It also handles the "slow" big case. Bug: angleproject:2763 Change-Id: Ib3cc7b652a14ed346528bf15820023ab0b5317ce Reviewed-on: https://chromium-review.googlesource.com/1233453 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Yuly Novikov dc8fb937 2018-09-19T01:35:59 Revert "Add FastVector for simple dynamic vector cases." This reverts commit 4d45e7dc7553b071b0c2a054bdb59bfd844012fe. Reason for revert: Memory leak detected during roll in https://ci.chromium.org/p/chromium/builders/luci.chromium.try/linux_chromium_asan_rel_ng/101750 Original change's description: > Add FastVector for simple dynamic vector cases. > > This optimized vector keeps an initial fixed size storage but has > unbounded growth like a normal std::vector. It operates like a > FixedVector initially but then switches the storage to an allocated > pool when the element count exceeds the array limit. > > This gives fast performance in the small case since no dynamic > allocation is needed. It also handles the "slow" big case. > > Bug: angleproject:2763 > Change-Id: I9c002b205bd4ac9fc171d1fdc42bc8ea5fe8dabe > Reviewed-on: https://chromium-review.googlesource.com/1227794 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Jamie Madill <jmadill@chromium.org> TBR=ynovikov@chromium.org,jmadill@chromium.org,syoussefi@chromium.org Change-Id: Iaec76244cc736a8469b80bfc8534fb0fd6c49e11 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:2763 Reviewed-on: https://chromium-review.googlesource.com/1232978 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 4d45e7dc 2018-09-18T11:32:41 Add FastVector for simple dynamic vector cases. This optimized vector keeps an initial fixed size storage but has unbounded growth like a normal std::vector. It operates like a FixedVector initially but then switches the storage to an allocated pool when the element count exceeds the array limit. This gives fast performance in the small case since no dynamic allocation is needed. It also handles the "slow" big case. Bug: angleproject:2763 Change-Id: I9c002b205bd4ac9fc171d1fdc42bc8ea5fe8dabe Reviewed-on: https://chromium-review.googlesource.com/1227794 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>