[all-commits] [llvm/llvm-project] efc0ba: [MLIR][Transform] Introduce loop.coalesce transfor...

Amy Wang via All-commits all-commits at lists.llvm.org
Tue Jan 17 06:41:52 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: efc0ba0275bd39fe0fb7548345139e9183fce20d
      https://github.com/llvm/llvm-project/commit/efc0ba0275bd39fe0fb7548345139e9183fce20d
  Author: Amy Wang <kai.ting.wang at huawei.com>
  Date:   2023-01-17 (Tue, 17 Jan 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/Affine/LoopUtils.h
    M mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td
    M mlir/include/mlir/Dialect/SCF/Utils/Utils.h
    M mlir/lib/Dialect/Affine/Transforms/LoopCoalescing.cpp
    M mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
    M mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp
    M mlir/lib/Dialect/SCF/Utils/Utils.cpp
    A mlir/test/Dialect/SCF/transform-op-coalesce.mlir
    A mlir/test/Dialect/SCF/transform-ops-invalid.mlir
    M mlir/test/Dialect/SCF/transform-ops.mlir

  Log Message:
  -----------
  [MLIR][Transform] Introduce loop.coalesce transform op.

This patch made a minor refactor of LoopCoalescing.cpp's walkLoops
templated method and placed it in Affine's LoopUtils.cpp/h.
This method is also renamed as coalescePerfectlyNestedLoops method. This
minor change enables this method to be invoked
by both the original LoopCoalescing pass as well as the newly introduced
loop.coalesce transform op.

The loop.coalesce transform op has the ability to coalesce affine, and
scf loop nests, leveraging existing LoopCoalescing
mechanism. I have created it inside the SCFTransformOps.td instead of
AffineTransformOps.td as it feels to be similar
in spirit as the loop.unroll op that can handle both scf and affine
loops. Please let me know if you feel that this op
should be moved into AffineTransformOps.td instead.

The testcase added illustrates loop.coalesce transform op working for
scf, affine loops (inner, outer) as well as
coalesced loop can be further unrolled (achieving composibility).

Reviewed By: ftynse

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




More information about the All-commits mailing list