[all-commits] [llvm/llvm-project] de0312: [mlir] Add canonicalization from `tensor_cast` to ...

MaheshRavishankar via All-commits all-commits at lists.llvm.org
Thu Dec 17 14:49:45 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: de031216bf1755e61418a1515f2b0db0a9cfeddc
      https://github.com/llvm/llvm-project/commit/de031216bf1755e61418a1515f2b0db0a9cfeddc
  Author: MaheshRavishankar <ravishankarm at google.com>
  Date:   2020-12-17 (Thu, 17 Dec 2020)

  Changed paths:
    M mlir/lib/Dialect/StandardOps/IR/Ops.cpp
    M mlir/test/Dialect/Standard/canonicalize.mlir

  Log Message:
  -----------
  [mlir] Add canonicalization from `tensor_cast` to `dim` op.

Fold a `tensor_cast` -> `dim` to take the `dim` of the original tensor.

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


  Commit: 118a71565462db41cab1dbb0349200627d6e8524
      https://github.com/llvm/llvm-project/commit/118a71565462db41cab1dbb0349200627d6e8524
  Author: MaheshRavishankar <ravishankarm at google.com>
  Date:   2020-12-17 (Thu, 17 Dec 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
    M mlir/include/mlir/Interfaces/ViewLikeInterface.h
    M mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
    M mlir/lib/Interfaces/ViewLikeInterface.cpp
    M mlir/test/Dialect/Linalg/canonicalize.mlir
    M mlir/test/Dialect/Linalg/roundtrip.mlir

  Log Message:
  -----------
  [mlir][Linalg] Define a linalg.init_tensor operation.

This operation is used to materialize a tensor of a particular
shape. The shape could be specified as a mix of static and dynamic
values.

The use of this operation is to be an `init` tensor for Linalg
structured operation on tensors where the bounds of the computation
depends on the shape of the output of the linalg operation. The result
of this operation will be used as the `init` tensor of such Linalg
operations. To note,

1) The values in the tensor materialized is not used. Any operation to
   which this is an init tensor is expected to overwrite the entire
   tensor.
2) The tensor is materialized only for the shape of the output and to
   make the loop bounds depend only on operands of the structured
   operation.

Based on (1) and (2) it is assumed that these operations eventually go
away since they are only used in `dim` operations that can be
canonicalized to make this operation dead. Such canonicalization are
added here too.

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


Compare: https://github.com/llvm/llvm-project/compare/3d56644f18ee...118a71565462


More information about the All-commits mailing list