[all-commits] [llvm/llvm-project] c95a72: [mlir][linalg] Tiling: Use loop ub in extract_slic...

Matthias Springer via All-commits all-commits at lists.llvm.org
Wed Sep 8 19:11:16 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c95a7246a38afb0a7c1f371d1591a96617aa4d73
      https://github.com/llvm/llvm-project/commit/c95a7246a38afb0a7c1f371d1591a96617aa4d73
  Author: Matthias Springer <springerm at google.com>
  Date:   2021-09-09 (Thu, 09 Sep 2021)

  Changed paths:
    M mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
    M mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
    M mlir/lib/Dialect/Linalg/Utils/Utils.cpp
    M mlir/test/Dialect/Linalg/fusion-pattern.mlir
    M mlir/test/Dialect/Linalg/fusion-sequence.mlir
    M mlir/test/Dialect/Linalg/fusion-tensor-pattern.mlir
    M mlir/test/Dialect/Linalg/fusion.mlir
    M mlir/test/Dialect/Linalg/tile-and-fuse-tensors.mlir
    M mlir/test/Dialect/Linalg/tile-conv-padding.mlir
    M mlir/test/Dialect/Linalg/tile-conv.mlir
    M mlir/test/Dialect/Linalg/tile-simple-conv.mlir
    M mlir/test/Dialect/Linalg/tile.mlir

  Log Message:
  -----------
  [mlir][linalg] Tiling: Use loop ub in extract_slice size computation if possible

When tiling a LinalgOp, extract_slice/insert_slice pairs are inserted. To avoid going out-of-bounds when the tile size does not divide the shape size evenly (at the boundary), AffineMin ops are inserted. Some ops have assumptions regarding the dimensions of inputs/outputs. E.g., in a `A * B` matmul, `dim(A, 1) == dim(B, 0)`. However, loop bounds use either `dim(A, 1)` or `dim(B, 0)`.

With this change, AffineMin ops are expressed in terms of loop bounds instead of tensor sizes. (Both have the same runtime value.) This simplifies canonicalizations.

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




More information about the All-commits mailing list