src/common/FastVector.h


Log

Author Commit Date CI Message
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>
Mohan Maiya c508e707 2021-02-25T15:40:11 Vulkan: Avoid using assign with BitSets FastIntegerSet::clear() now calls reset() instead of assign(). std::vector::assign(...) invokes the copy-constructor. For better performance, especially with BitSet*, we can leverage the reset() method. This removes 1.2% CPU overhead from a Manhattan30 offscreen run Bug: angleproject:5689 Change-Id: Ib1a760587ffe18341b8ed892a732c506fc50c82b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2723494 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 6689a54d 2021-01-21T00:36:14 Vulkan: autogen for SPIR-V instruction build and parse Handwritten SPIR-V instruction parse and build code is replaced with autogenerated functions based on the SPIR-V grammar. Bug: angleproject:4889 Change-Id: I09d724fd944e79c03fe4eadca3ee3e3ef0b49872 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2644721 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Tobin Ehlis d7276586 2020-08-26T11:27:13 Vulkan:Use roundUpPow2 where possible Utility function roundUpPow2 is more optimal than roundUp so use it. Bug: b/166462979 Change-Id: I616fa9f487b818137b1b496d93e292c3bd1f428c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2377119 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Tobin Ehlis <tobine@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>
Shahbaz Youssefi 74d4bf98 2019-11-26T15:34:11 Remove !empty() assert on FastVector::data() The user of the API is allowed to call data() on an empty vector. Bug: 1026414 Change-Id: I41ea65c50b94115ace7930d75cd8f14782548d6c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1937807 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill cd0a0a3c 2018-10-18T18:41:57 Introduce SubjectBindingPointer. We can share the same pointer for the subject binding and the binding pointer. This further allows us to optimize buffer re-binding. The shared memory increases cache coherency and reduces the number of instructions needed. Bug: angleproject:2891 Change-Id: Id3162fa79de203f75989e7289ea02cb2ea1bec73 Reviewed-on: https://chromium-review.googlesource.com/c/1270217 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@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>