[all-commits] [llvm/llvm-project] b838b6: [mlir][MemRef][Transform] Don't apply multibuffer ...

qcolombet via All-commits all-commits at lists.llvm.org
Mon Feb 13 05:22:19 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b838b62876179a5fac8edeccbd0d9a225a3fa922
      https://github.com/llvm/llvm-project/commit/b838b62876179a5fac8edeccbd0d9a225a3fa922
  Author: Quentin Colombet <quentin.colombet at gmail.com>
  Date:   2023-02-13 (Mon, 13 Feb 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/MemRef/TransformOps/MemRefTransformOps.td
    M mlir/lib/Dialect/MemRef/TransformOps/CMakeLists.txt
    M mlir/lib/Dialect/MemRef/TransformOps/MemRefTransformOps.cpp
    M mlir/test/Dialect/MemRef/transform-ops.mlir
    M utils/bazel/llvm-project-overlay/mlir/BUILD.bazel

  Log Message:
  -----------
  [mlir][MemRef][Transform] Don't apply multibuffer on "useless" allocs

`alloc`s that have users outside of loops are guaranteed to fail in
`multibuffer`.

Instead of exposing ourselves to that failure in the transform dialect,
filter out the `alloc`s that fall in this category.

To be able to do this filtering we have to change the `multibuffer`
transform op from `TransformEachOpTrait` to a plain `TransformOp`. This is
because `TransformEachOpTrait` expects that every successful `applyToOne`
returns a non-empty result.

Couple of notes:
- I changed the assembly syntax to make sure we only get `alloc` ops as
  input. (And added a test case to make sure we reject invalid inputs.)
- `multibuffer` can still fail pretty easily when you know its limitations.
  See the updated `op failed to multibuffer` test case for instance.
  Longer term, instead of leaking/coupling the actual implementation (in
  this case the checks normally done in `memref::multiBuffer`) with the
  transform dialect (the added check in `::apply`), we may want to refactor
  how we structure the underlying implementation. E.g., we could imagine a
  `canApply` method for all the implementations that we want to hook up in
  the transform dialect.
  This has some implications on how not to duplicate work between
  `canApply` and the actual implementation but I thought I throw that here
  to have us think about it :).

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




More information about the All-commits mailing list