llvm-project/mlir
Tung D. Le a2186277be [mlir][affine-loop-fusion] Fix a bug that AffineIfOp prevents fusion of the other loops
The presence of AffineIfOp inside AffineFor prevents fusion of the other loops to happen. For example:

```
  affine.for %i0 = 0 to 10 {
    affine.store %cf7, %a[%i0] : memref<10xf32>
  }
  affine.for %i1 = 0 to 10 {
    %v0 = affine.load %a[%i1] : memref<10xf32>
    affine.store %v0, %b[%i1] : memref<10xf32>
  }
  affine.for %i2 = 0 to 10 {
    affine.if #set(%i2) {
      %v0 = affine.load %b[%i2] : memref<10xf32>
    }
  }
```

The first two loops were not be fused because of `affine.if` inside the last `affine.for`.

The issue seems to come from a conservative constraint that does not allow fusion if there are ops whose number of regions != 0 (affine.if is one of them).

This patch just removes such a constraint when`affine.if` is inside `affine.for`.  The existing `canFuseLoops` method is able to handle `affine.if` correctly.

Reviewed By: bondhugula, vinayaka-polymage

Differential Revision: https://reviews.llvm.org/D105963
2021-07-30 15:22:46 +05:30
..
cmake/modules [MLIR][python] Disable SONAME on extensions. 2021-07-30 00:47:11 +00:00
docs [mlir] Remove the default isDynamicallyLegal hook 2021-07-29 11:00:57 +02:00
examples [mlir] factor memref-to-llvm lowering out of std-to-llvm 2021-07-09 14:49:52 +02:00
include [mlir][spirv] Fix crash in convert-gpu-to-spirv pass with memrefs with affine maps 2021-07-30 12:46:13 +03:00
lib [mlir][affine-loop-fusion] Fix a bug that AffineIfOp prevents fusion of the other loops 2021-07-30 15:22:46 +05:30
python [MLIR][python] Export CAPI headers. 2021-07-29 19:06:32 +00:00
test [mlir][affine-loop-fusion] Fix a bug that AffineIfOp prevents fusion of the other loops 2021-07-30 15:22:46 +05:30
tools [mlir] Fix CMake option for enabling SPIR-V CPU runner 2021-07-29 16:34:09 -04:00
unittests [mlir] Set the namespace of the BuiltinDialect to 'builtin' 2021-07-28 21:00:10 +00:00
utils [vscode-mlir] Add support for restarting the server on setting/server changes 2021-06-29 00:08:44 +00:00
.clang-format
.clang-tidy NFC: .clang-tidy: Inherit configs from parents to improve maintainability 2021-06-08 08:25:59 -07:00
CMakeLists.txt [MLIR] Drop old cmake var names 2021-05-24 15:30:01 +05:30
LICENSE.TXT
README.md

README.md

Multi-Level Intermediate Representation

See https://mlir.llvm.org/ for more information.