[all-commits] [llvm/llvm-project] 8da0f8: [mlir] Optimize the allocation of resizable operan...

River Riddle via All-commits all-commits at lists.llvm.org
Sun Apr 26 21:37:35 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8da0f85ea56f31a600b0ebcfa83e5ef300cfaac9
      https://github.com/llvm/llvm-project/commit/8da0f85ea56f31a600b0ebcfa83e5ef300cfaac9
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-04-26 (Sun, 26 Apr 2020)

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

  Log Message:
  -----------
  [mlir] Optimize the allocation of resizable operand lists

This revision optimizes resizable operand lists by allocating them in the same location as the trailing operands. This has numerous benefits:
* If the operation has at least one operand at construction time, there is 0 additional memory overhead to the resizable storage.
* There is less pointer arithmetic necessary as the resizable storage is now only used when the operands are dynamically allocated.

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


  Commit: 4dfd1b5fcb7316d5e8393183dd303352ca65d4ac
      https://github.com/llvm/llvm-project/commit/4dfd1b5fcb7316d5e8393183dd303352ca65d4ac
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-04-26 (Sun, 26 Apr 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/Affine/IR/AffineOps.td
    M mlir/include/mlir/IR/OpBase.td
    M mlir/include/mlir/IR/Operation.h
    M mlir/include/mlir/IR/OperationSupport.h
    M mlir/include/mlir/TableGen/Operator.h
    M mlir/lib/Dialect/Affine/IR/AffineOps.cpp
    M mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
    M mlir/lib/IR/Operation.cpp
    M mlir/lib/IR/OperationSupport.cpp
    M mlir/lib/Parser/Parser.cpp
    M mlir/lib/TableGen/Operator.cpp
    M mlir/lib/Transforms/Utils/Utils.cpp
    M mlir/test/mlir-tblgen/op-operand.td
    M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
    M mlir/tools/mlir-tblgen/OpFormatGen.cpp
    M mlir/unittests/IR/OperationSupportTest.cpp

  Log Message:
  -----------
  [mlir] Optimize operand storage such that all operations can have resizable operand lists

This revision refactors the structure of the operand storage such that there is no additional memory cost for resizable operand lists until it is required. This is done by using two different internal representations for the operand storage:
* One using trailing operands
* One using a dynamically allocated std::vector<OpOperand>

This allows for removing the resizable operand list bit, and will free up APIs from needing to workaround non-resizable operand lists.

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


  Commit: 1956a8a7cb79e94dbe073e36eba2d6b003f91046
      https://github.com/llvm/llvm-project/commit/1956a8a7cb79e94dbe073e36eba2d6b003f91046
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-04-26 (Sun, 26 Apr 2020)

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

  Log Message:
  -----------
  [mlir] Don't allocate an operand storage if the operation is known to never have operands

Certain classes of operations, such as FuncOp, are known to never have operands. This revision adds a bit to operation to detect this case and avoid allocating the unnecessary operand storage. This saves 1 word for each instance of these operations.

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


Compare: https://github.com/llvm/llvm-project/compare/8296bcf76f26...1956a8a7cb79


More information about the All-commits mailing list