[all-commits] [llvm/llvm-project] 6dd696: [mlir][Linalg] Extend fusion to support WAW atm on...

hanhanW via All-commits all-commits at lists.llvm.org
Tue Mar 31 21:34:49 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6dd696ae4fa1b1564e76e5531c268724d2c8b98f
      https://github.com/llvm/llvm-project/commit/6dd696ae4fa1b1564e76e5531c268724d2c8b98f
  Author: Hanhan Wang <hanchung at google.com>
  Date:   2020-03-31 (Tue, 31 Mar 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOpsInterface.td
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgTraits.h
    M mlir/lib/Dialect/Linalg/Analysis/DependenceAnalysis.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
    M mlir/test/Dialect/Linalg/fusion.mlir

  Log Message:
  -----------
  [mlir][Linalg] Extend fusion to support WAW atm on buffers.

Summary:
The RAW fusion happens only if the produecer block dominates the consumer block.
The WAW pattern also works with the precondition. I.e., if a producer can
dominate the consumer, they can fairly fuse together.

Since they are all tilable, we can think the pattern like this way:

Input:
```
linalg_op1 view

tile_loop
  subview_2
  linalg_op2 subview_2
```

Tile the first Linalg op as same as the second Linalg.
```
tile_loop
  subview_1
  linalg_op1 subview_1

tile_loop
  subview_2
  liangl_op2 subview_2
```

Since the first Linalg op is tilable in the same way and the computation are
independently, it's fair to fuse it with the second Linalg op.
```
tile_loop
  subview_1
  linalg_op1 subview_1
  linalg_op2 subview_2
```

In short, this patch includes:
- Handling both RAW and WAW pattern.
- Adding a interface method to get input and output buffers.
- Exposing a method to get a StringRef of a dependency type.
- Fixing existing WAW tests and add one more use case: initialize the buffer
  before conv op.

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




More information about the All-commits mailing list