[all-commits] [llvm/llvm-project] b870d9: [mlir] Optimize Op definitions and registration to...

River Riddle via All-commits all-commits at lists.llvm.org
Mon Nov 2 14:46:22 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b870d9ec8334523a902e0abc04fd49a5a95dbc43
      https://github.com/llvm/llvm-project/commit/b870d9ec8334523a902e0abc04fd49a5a95dbc43
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-11-02 (Mon, 02 Nov 2020)

  Changed paths:
    M mlir/include/mlir/IR/Dialect.h
    M mlir/include/mlir/IR/OpDefinition.h
    M mlir/include/mlir/IR/OperationSupport.h
    M mlir/lib/IR/MLIRContext.cpp
    M mlir/lib/IR/Operation.cpp

  Log Message:
  -----------
  [mlir] Optimize Op definitions and registration to optimize for code size

This revision refactors the base Op/AbstractOperation classes to reduce the amount of generated code size when defining a new operation. The current scheme involves taking the address of functions defined directly on Op and Trait classes. This is problematic because even when these functions are empty/unused we still result in these functions being defined in the main executable. In this revision, we switch to using SFINAE and template type filtering to remove remove functions that are not needed/used. For example, if an operation does not define a custom `print` method we shouldn't define a templated `printAssembly` method for it. The same applies to parsing/folding/verification/etc. This dropped MLIR code size for a large downstream library by ~10%(~1 mb in an opt build).

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




More information about the All-commits mailing list