[all-commits] [llvm/llvm-project] 9b0517: [mlir] Enhance InferShapedTypeOpInterface and move...

MaheshRavishankar via All-commits all-commits at lists.llvm.org
Mon Mar 29 11:40:46 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9b0517035faee275ce1feabb03d0c7606ea7f819
      https://github.com/llvm/llvm-project/commit/9b0517035faee275ce1feabb03d0c7606ea7f819
  Author: MaheshRavishankar <ravishankarm at google.com>
  Date:   2021-03-29 (Mon, 29 Mar 2021)

  Changed paths:
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.h
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
    M mlir/include/mlir/Interfaces/InferTypeOpInterface.td
    M mlir/lib/Dialect/Linalg/IR/CMakeLists.txt
    M mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
    M mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
    M mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
    M mlir/lib/Interfaces/InferTypeOpInterface.cpp
    M mlir/test/Dialect/Linalg/canonicalize.mlir
    M mlir/test/Transforms/test-canonicalize.mlir
    M mlir/test/lib/Dialect/Test/TestDialect.cpp
    M mlir/test/lib/Dialect/Test/TestOps.td
    M mlir/test/lib/Dialect/Test/TestPatterns.cpp

  Log Message:
  -----------
  [mlir] Enhance InferShapedTypeOpInterface and move LinalgOps to use them.

A new `InterfaceMethod` is added to `InferShapedTypeOpInterface` that
allows an operation to return the `Value`s for each dim of its
results. It is intended for the case where the `Value` returned for
each dim is computed using the operands and operation attributes. This
interface method is for cases where the result dim of an operation can
be computed independently, and it avoids the need to aggregate all
dims of a result into a single shape value. This also implies that
this is not suitable for cases where the result type is unranked (for
which the existing interface methods is to be used).

Also added is a canonicalization pattern that uses this interface and
resolves the shapes of the output in terms of the shapes of the
inputs. Moving Linalg ops to use this interface, so that many
canonicalization patterns implemented for individual linalg ops to
achieve the same result can be removed in favor of the added
canonicalization pattern.

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




More information about the All-commits mailing list