[all-commits] [llvm/llvm-project] e45705: [MLIR] Use a shared uniquer for affine maps and in...

Ulysse Beaugnon via All-commits all-commits at lists.llvm.org
Thu Dec 2 14:49:46 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e45705ad5051247e1cb2355094ef77316ae24c37
      https://github.com/llvm/llvm-project/commit/e45705ad5051247e1cb2355094ef77316ae24c37
  Author: Ulysse Beaugnon <ulysse at google.com>
  Date:   2021-12-02 (Thu, 02 Dec 2021)

  Changed paths:
    M mlir/include/mlir/IR/IntegerSet.h
    M mlir/lib/IR/AffineMapDetail.h
    M mlir/lib/IR/IntegerSet.cpp
    M mlir/lib/IR/IntegerSetDetail.h
    M mlir/lib/IR/MLIRContext.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list