[all-commits] [llvm/llvm-project] e07149: [mlir][linalg] Add option to generate rank-reducin...

Matthias Springer via All-commits all-commits at lists.llvm.org
Wed Dec 14 05:10:24 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e07149c91f4bb43c1413bc1fbe19dc6eff2fcde6
      https://github.com/llvm/llvm-project/commit/e07149c91f4bb43c1413bc1fbe19dc6eff2fcde6
  Author: Matthias Springer <springerm at google.com>
  Date:   2022-12-14 (Wed, 14 Dec 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/Linalg/Passes.td
    M mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
    M mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
    M mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
    M mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
    M mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
    M mlir/test/Dialect/Linalg/drop-unit-extent-dims.mlir

  Log Message:
  -----------
  [mlir][linalg] Add option to generate rank-reducing slices in DropUnitDims

This change extends the `ReplaceUnitExtents` pattern so that users can choose between of two strategies for generating rank reductions:
* CollapseShapeOp / ExpandShapeOp (was already implemented but code was cleaned up; default strategy)
* rank-reducing ExtractSliceOp / InsertSliceOp

Also add helper functions to the memref dialect that we already have on the tensor dialect: `getMixedSizes`, `createCanonicalRankReducingSubViewOp`, `rankReduceIfNeeded`.

We are using ReassociationIndices instead of ReassoicationExprs in many other places and this makes the code easier to read. Also adding a new test case (that also passed before).

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




More information about the All-commits mailing list