[all-commits] [llvm/llvm-project] 4521b1: [mlir][Linalg] Reimplement hoisting on tensors as ...

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Mon Feb 27 08:26:15 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4521b113978d9ddaaae038e3cdd9d8902e2392f9
      https://github.com/llvm/llvm-project/commit/4521b113978d9ddaaae038e3cdd9d8902e2392f9
  Author: Nicolas Vasilache <nicolas.vasilache at gmail.com>
  Date:   2023-02-27 (Mon, 27 Feb 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
    M mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h
    M mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
    M mlir/include/mlir/Dialect/Utils/StaticValueUtils.h
    M mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
    M mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
    M mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
    A mlir/lib/Dialect/Linalg/Transforms/SubsetHoisting.cpp
    M mlir/lib/Dialect/Utils/StaticValueUtils.cpp
    M mlir/test/Dialect/Linalg/hoisting.mlir

  Log Message:
  -----------
  [mlir][Linalg] Reimplement hoisting on tensors as a subset-based transformation

This revision significantly rewrites hoisting on tensors.
Previously, `vector.transfer_read/write` and `tensor.extract/insert_slice` would
be clumped together when looking for candidate pairs.
This would significantly increase the complexity of the logic and would not apply
independently to `tensor.extract/insert_slice`.

The new implementation decouples the cases and starts to cast the problem
as a generic matching subset extract/insert, which will be future proof when
other such operation pairs are introduced.

Lastly, the implementation makes the distinction clear between `vector.transfer_read/write` for
which we allow bypasses of the disjoint subsets from `tensor.extract/insert_slice` for which we
do not yet allow it.

This can be extended in the future and unified once we have subset disjunction implemented more generally.

The algorithm can be rewritten to be less of a fixed point with interspersed canonicalizations.
As a consequence, the test explicitly adds a canonicalization to clean up the IR and verify we end up in the same state.

That extra canonicalization exhibited that one of the uses in one of the tests was dead, so we fix the appropriate test.

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




More information about the All-commits mailing list