[mlir][StorageUniquer] Refactor parametric storage to use sharded dense sets
authorRiver Riddle <riddleriver@gmail.com>
Tue, 27 Oct 2020 02:31:04 +0000 (19:31 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Tue, 27 Oct 2020 02:40:19 +0000 (19:40 -0700)
commit67f52f35d62b25f929646e972287c7b5397a044e
treedfc739ef487472a74a7409d5e081e5e82af7d174
parente20d64c3d9d81cad701f31d8481367222c76c787
[mlir][StorageUniquer] Refactor parametric storage to use sharded dense sets

This revisions implements sharding in the storage of parametric instances to decrease lock contention by sharding out the allocator/mutex/etc. to use for a specific storage instance based on the hash key. This is a somewhat common approach to reducing lock contention on data structures, and is used by the concurrent hashmaps provided by folly/java/etc. For several compilations tested, this removed all/most lock contention from profiles and reduced compile time by several seconds.

Differential Revision: https://reviews.llvm.org/D89659
mlir/include/mlir/Support/StorageUniquer.h
mlir/lib/Support/StorageUniquer.cpp