[all-commits] [llvm/llvm-project] 65a319: [mlir] Refactor InterfaceMap to use a sorted vecto...

River Riddle via All-commits all-commits at lists.llvm.org
Tue Feb 23 14:37:25 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 65a3197a8fa2e5d1deb8707bda13ebd21e1dedb3
      https://github.com/llvm/llvm-project/commit/65a3197a8fa2e5d1deb8707bda13ebd21e1dedb3
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2021-02-23 (Tue, 23 Feb 2021)

  Changed paths:
    M mlir/include/mlir/IR/OperationSupport.h
    M mlir/include/mlir/Support/InterfaceSupport.h
    M mlir/lib/IR/Operation.cpp

  Log Message:
  -----------
  [mlir] Refactor InterfaceMap to use a sorted vector of interfaces, as opposed to a DenseMap

A majority of operations have a very small number of interfaces, which means that the cost of using a hash map is generally larger for interface lookups than just a binary search. In the future when there are a number of operations with large amounts of interfaces, we can switch to a hybrid approach that optimizes lookups based on the number of interfaces. For now, however, a binary search is the best approach.

This dropped compile time on a largish TF MLIR module by 20%(half a second).

Differential Revision: https://reviews.llvm.org/D96085


  Commit: abd3c6f24c823be6fb316b501482d8637c4a0724
      https://github.com/llvm/llvm-project/commit/abd3c6f24c823be6fb316b501482d8637c4a0724
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2021-02-23 (Tue, 23 Feb 2021)

  Changed paths:
    M mlir/lib/Transforms/Inliner.cpp

  Log Message:
  -----------
  [mlir][Inliner] Use llvm::parallelForEach instead of llvm::parallelTransformReduce

llvm::parallelTransformReduce does not schedule work on the caller thread, which becomes very costly for
the inliner where a majority of SCCs are small, often ~1 element. The switch to llvm::parallelForEach solves this,
and also aligns the implementation with the PassManager (which realistically should share the same implementation).

This change dropped compile time on an internal benchmark by ~1(25%) second.

Differential Revision: https://reviews.llvm.org/D96086


Compare: https://github.com/llvm/llvm-project/compare/8fa2bbaed925...abd3c6f24c82


More information about the All-commits mailing list