[mlir][Interfaces] Optimize the implementation of InterfaceMap to reduce generated...
authorRiver Riddle <riddleriver@gmail.com>
Tue, 27 Oct 2020 23:03:22 +0000 (16:03 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Tue, 27 Oct 2020 23:16:51 +0000 (16:16 -0700)
commiteacac2679ddb2b53025a11933eb222eaf75812ef
tree031fb4eb7e520e041b741699c29aeddf6d67d84c
parentef728eaf6e8de17b9f5bac89c972a94e37e4f09e
[mlir][Interfaces] Optimize the implementation of InterfaceMap to reduce generated code size.

An InterfaceMap is generated for every single operation type, and is responsible for a large amount of the code size from MLIR given that its internals highly utilize templates. This revision refactors the internal implementation to use bare malloc/free for interface instances as opposed to static variables and moves as much code out of templates as possible. This led to a decrease of over >1mb (~12% of total MLIR related code size) for a downstream MLIR library with a large amount of operations.

Differential Revision: https://reviews.llvm.org/D90086
mlir/include/mlir/Support/InterfaceSupport.h