src/libANGLE/ResourceMap_unittest.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi b1267bf3 2024-05-15T15:05:10 Skip concurrent ResourceMap tests in Chromium Chromium builds ANGLE with locking disabled because it ensures concurrent access doesn't happen. So testing that concurrent access works in unit tests is meaningless in those builds. Bug: angleproject:8667 Change-Id: I30f36ed72d64303a590afd727bbe9875d06b3d96 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5539018 Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Shahbaz Youssefi e547126a 2024-05-15T13:46:10 Disable ResourceMapTest.ConcurrentAccessLargeIds ... until I figure out why it's failing on some bots. Bug: angleproject:8667 Change-Id: I4399739b257a8e49da0d94ed162f472ed84c41c7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5539016 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 49317d73 2024-05-10T16:11:59 Prepare resource map for being potentially thread-safe Resource maps are used for both shared and context-private resources. Context-private resource maps do not need any locking. Once glBind* and similar commands are made free of the share group lock, the resource map of the corresponding type must be made thread safe, especially for look up. This change adds the ability to the resource map to be either thread safe or not, based on the type of the resource it contains. Currently, only a test type (unsigned int) is thread safe (used in unit tests). This is achieved by a combination of the following: - For resource maps that need a lock, the flat part of the map has an initially reasonable size, but is _never_ reallocated. This makes access to that part of the map lockfree. - The hash-map that contains large ids is always protected by a mutex. Follow up changes will start enabling thread-safety for resources as their corresponding glBind command is made lockless. Bug: angleproject:8667 Change-Id: Ia4ffffee41f021d833d31f296bc883bf12f1135f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5527771 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi a1665d2f 2024-05-10T00:15:31 Reland "Document thread-unsafe iterator access to resource maps" This is a reland of commit d1bb6ed8399dd12e79484f30f9e9ded95c25625a The crash was due to another issue (disabling EGL validation in Chrome) Original change's description: > Document thread-unsafe iterator access to resource maps > > By using a proxy type, everywhere resource maps are iterated are clearly > marked as not being thread safe. In most cases, only destruction and > capture/replay iterate over these maps, which means thread safety is not > an issue (or is externally enforced). > > The only case where iterators are used in the presence of other contexts > is with ANGLE_request_extension, which is changed to explicitly require > the application to ensure thread safety. In practice, the user is > Chrome which already guarantees this. > > Bug: angleproject:8667 > Change-Id: I7af13c6433b6955d9c36f9088b3aa4c065e1cfc1 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5526428 > Reviewed-by: Charlie Lao <cclao@google.com> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> Bug: angleproject:8667 Change-Id: Id539cabac01df5f242150f6684222577003eef3f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5531278 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 4e887491 2024-05-11T18:08:03 Revert "Document thread-unsafe iterator access to resource maps" This reverts commit d1bb6ed8399dd12e79484f30f9e9ded95c25625a. Reason for revert: Checking to see if it's the reason for crbug.com/339948886 Original change's description: > Document thread-unsafe iterator access to resource maps > > By using a proxy type, everywhere resource maps are iterated are clearly > marked as not being thread safe. In most cases, only destruction and > capture/replay iterate over these maps, which means thread safety is not > an issue (or is externally enforced). > > The only case where iterators are used in the presence of other contexts > is with ANGLE_request_extension, which is changed to explicitly require > the application to ensure thread safety. In practice, the user is > Chrome which already guarantees this. > > Bug: angleproject:8667 > Change-Id: I7af13c6433b6955d9c36f9088b3aa4c065e1cfc1 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5526428 > Reviewed-by: Charlie Lao <cclao@google.com> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> Bug: angleproject:8667 Change-Id: I1245c9e57dfeb27a7f0e5718b1455614c70bc0dc No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5532187 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi d1bb6ed8 2024-05-10T00:15:31 Document thread-unsafe iterator access to resource maps By using a proxy type, everywhere resource maps are iterated are clearly marked as not being thread safe. In most cases, only destruction and capture/replay iterate over these maps, which means thread safety is not an issue (or is externally enforced). The only case where iterators are used in the presence of other contexts is with ANGLE_request_extension, which is changed to explicitly require the application to ensure thread safety. In practice, the user is Chrome which already guarantees this. Bug: angleproject:8667 Change-Id: I7af13c6433b6955d9c36f9088b3aa4c065e1cfc1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5526428 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 66e0feec 2019-09-03T18:45:43 Remove default template args in ResourceMap. Only need GLuints now for GLsyncs. Bug: angleproject:3611 Change-Id: Id8b11851d8d5d30e6743433c772b9fa85eb875f5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1783406 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 0fdb956d 2018-09-17T17:18:43 Re-land "Inline and micro-optimize more for perf tests."" Re-land fixes memory leaks. Using a custom array instead of std::vector speeds up the resource manager. One reason is because calls to size() are implemented in many implementations as a difference between two pointers. This sub size implementations are slower than storing a simple size variable in a custom class. Also includes more inlining of hot spots functions. Also includes a small unit test class for ResourceMap. And an unrelated but small test fix for TextureLimisTest. Also a small unrelated fix for a Transform Feedback test. Increase the scores of the draw call perf test with texture and buffer bindings and the buffer binding perf test. Bug: angleproject:2763 Change-Id: Ic2f0f689107b2bf05c63da2ed6bbc9f0feea63f7 Reviewed-on: https://chromium-review.googlesource.com/1229033 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Yuly Novikov 98a3e078 2018-09-17T19:40:04 Revert "Inline and micro-optimize more for perf tests." This reverts commit 57ff6f95f143bd65a0c3d12d64773f274b9935f4. Reason for revert: Memory leaks detected during roll in https://ci.chromium.org/p/chromium/builders/luci.chromium.try/linux_chromium_asan_rel_ng/100284 Original change's description: > Inline and micro-optimize more for perf tests. > > Using a custom array instead of std::vector speeds up the resource > manager. One reason is because calls to size() are implemented in many > implementations as a difference between two pointers. This sub size > implementations are slower than storing a simple size variable in a > custom class. > > Also includes more inlining of hot spots functions. > > Also includes a small unit test class for ResourceMap. And an unrelated > but small test fix for TextureLimisTest. Also a small unrelated fix for > a Transform Feedback test. > > Increase the scores of the draw call perf test with texture and buffer > bindings and the buffer binding perf test. > > Bug: angleproject:2763 > Change-Id: I41c327987db27ac45e6a62579f01e1cdc22e396c > Reviewed-on: https://chromium-review.googlesource.com/1171510 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Jamie Madill <jmadill@chromium.org> TBR=fjhenigman@chromium.org,ynovikov@chromium.org,jmadill@chromium.org,syoussefi@chromium.org Change-Id: Ie047289c9bf23a842c3cbb9692c811da0534991c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:2763 Reviewed-on: https://chromium-review.googlesource.com/1228893 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 57ff6f95 2018-09-14T12:44:52 Inline and micro-optimize more for perf tests. Using a custom array instead of std::vector speeds up the resource manager. One reason is because calls to size() are implemented in many implementations as a difference between two pointers. This sub size implementations are slower than storing a simple size variable in a custom class. Also includes more inlining of hot spots functions. Also includes a small unit test class for ResourceMap. And an unrelated but small test fix for TextureLimisTest. Also a small unrelated fix for a Transform Feedback test. Increase the scores of the draw call perf test with texture and buffer bindings and the buffer binding perf test. Bug: angleproject:2763 Change-Id: I41c327987db27ac45e6a62579f01e1cdc22e396c Reviewed-on: https://chromium-review.googlesource.com/1171510 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>