[mlir] Refactor InterfaceMap to use a sorted vector of interfaces, as opposed to...
authorRiver Riddle <riddleriver@gmail.com>
Tue, 23 Feb 2021 22:22:23 +0000 (14:22 -0800)
committerRiver Riddle <riddleriver@gmail.com>
Tue, 23 Feb 2021 22:36:45 +0000 (14:36 -0800)
commit65a3197a8fa2e5d1deb8707bda13ebd21e1dedb3
treefae54fe858dd7ace80ac5ad30055fdf593dbba7d
parent8fa2bbaed9252b217105ea332be8a0a85492099b
[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
mlir/include/mlir/IR/OperationSupport.h
mlir/include/mlir/Support/InterfaceSupport.h
mlir/lib/IR/Operation.cpp