[all-commits] [llvm/llvm-project] bd6a24: [mlir][SCF] Add support for peeling the first iter...

Vivian via All-commits all-commits at lists.llvm.org
Thu Dec 14 17:04:05 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bd6a2452aef627467034c5d41b9cf89905ef0c9b
      https://github.com/llvm/llvm-project/commit/bd6a2452aef627467034c5d41b9cf89905ef0c9b
  Author: Vivian <zhyuhang88 at gmail.com>
  Date:   2023-12-14 (Thu, 14 Dec 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td
    M mlir/include/mlir/Dialect/SCF/Transforms/Passes.td
    M mlir/include/mlir/Dialect/SCF/Transforms/Transforms.h
    M mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp
    M mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
    A mlir/test/Dialect/SCF/for-loop-peeling-front.mlir
    M mlir/test/Dialect/SCF/transform-ops.mlir

  Log Message:
  -----------
  [mlir][SCF] Add support for peeling the first iteration out of the loop (#74015)

There is a use case that we need to peel the first iteration out of the
for loop so that the peeled forOp can be canonicalized away and the
fillOp can be fused into the inner forall loop. For example, we have
nested loops as below

```
  linalg.fill ins(...) outs(...)
  scf.for %arg = %lb to %ub step %step
    scf.forall ...
```

After the peeling transform, it is expected to be

```
  scf.forall ...
    linalg.fill ins(...) outs(...)
  scf.for %arg = %(lb + step) to %ub step %step
    scf.forall ...
```

This patch makes the most use of the existing peeling functions and adds
support for peeling the first iteration out of the loop.




More information about the All-commits mailing list