[all-commits] [llvm/llvm-project] f6fb0a: [mlir] Make patterns for folding tensor.empty opti...

Alexander Belyaev via All-commits all-commits at lists.llvm.org
Wed Dec 7 14:02:00 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f6fb0a4f35d152d154aeb8a8e3d47ff1392c1bad
      https://github.com/llvm/llvm-project/commit/f6fb0a4f35d152d154aeb8a8e3d47ff1392c1bad
  Author: Alexander Belyaev <pifon at google.com>
  Date:   2022-12-07 (Wed, 07 Dec 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/Tensor/Transforms/Transforms.h
    M mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
    M mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
    M mlir/lib/Dialect/Tensor/Transforms/CMakeLists.txt
    A mlir/lib/Dialect/Tensor/Transforms/EmptyOpPatterns.cpp
    M mlir/test/Dialect/Linalg/canonicalize.mlir
    M mlir/test/Dialect/Tensor/canonicalize.mlir
    A mlir/test/Dialect/Tensor/fold-empty-op.mlir
    M mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp

  Log Message:
  -----------
  [mlir] Make patterns for folding tensor.empty optional.

At the moment, they are a part of EmptyOp::getCanonicalizationPatterns. When
extract_slice(tensor.empty) is rewritten as a new tensor.empty, it could
happen that we end up with two tensor.empty ops, since the original
tensor.empty can have two users. After bufferization such cases result in two
allocations.

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




More information about the All-commits mailing list