commit | 720af81d72309a22e0d647f9a3acc79bd6de0d9e | [log] [tgz] |
---|---|---|
author | Ulysse Beaugnon <ulysse@google.com> | Thu Dec 02 23:49:02 2021 +0100 |
committer | Copybara-Service <copybara-worker@google.com> | Thu Dec 02 14:51:22 2021 -0800 |
tree | e5d5fe2d15ca17f4cb13eb3775c7cdc03134aa79 | |
parent | 087c10958b1bdf9b2de07f08d061bf2b290d22da [diff] |
[MLIR] Use a shared uniquer for affine maps and integer sets. Affine maps and integer sets previously relied on a single lock for creating unique instances. In a multi-threaded setting, this lock becomes a contention point. This commit updates AffineMap and IntegerSet to use StorageUniquer instead. StorageUniquer internally uses sharded locks and thread-local caches to reduce contention. It is already used for affine expressions, types and attributes. On my local machine, this gives me a 5X speedup for an application that manipulates a lot of affine maps and integer sets. This commit also removes the integer set uniquer threshold. The threshold was used to avoid adding integer sets with a lot of constraints to the hash_map containing unique instances, but the constraints and the integer set were still allocated in the same allocator and never freed, thus not saving any space expect for the hash-map entry. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D114942 GitOrigin-RevId: e45705ad5051247e1cb2355094ef77316ae24c37
See https://mlir.llvm.org/ for more information.