[all-commits] [llvm/llvm-project] 1ee114: [mlir][Linalg][Vector] Add forwarding patterns bet...

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Fri May 29 05:10:37 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 1ee114322cb251f851028c72e7974bf85e707e55
      https://github.com/llvm/llvm-project/commit/1ee114322cb251f851028c72e7974bf85e707e55
  Author: Nicolas Vasilache <ntv at google.com>
  Date:   2020-05-29 (Fri, 29 May 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
    M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
    A mlir/test/Dialect/Linalg/forward-vector-transfers.mlir
    M mlir/test/lib/Transforms/TestLinalgTransforms.cpp

  Log Message:
  -----------
  [mlir][Linalg][Vector] Add forwarding patterns between linalg.copy and vector.transfer

This revision adds custom rewrites for patterns that arise during linalg structured
ops vectorization. These patterns allow the composition of linalg promotion,
vectorization and removal of redundant copies.

The patterns are voluntarily limited and restrictive atm.
More robust behavior will be implemented once more powerful side effect modeling and analyses are available on view/subview.

On the transfer_read side, the following pattern is rewritten:
```
   %alloc = ...
   [optional] %view = std.view %alloc ...
   %subView = subview %allocOrView ...
   [optional] linalg.fill(%allocOrView, %cst) ...
   ...
   linalg.copy(%in, %subView) ...
   vector.transfer_read %allocOrView[...], %cst ...
```
into
```
   [unchanged] %alloc = ...
   [unchanged] [optional] %view = std.view %alloc ...
   [unchanged] [unchanged] %subView = subview %allocOrView ...
   ...
   vector.transfer_read %in[...], %cst ...
```

On the transfer_write side, the following pattern is rewriten:
```
   %alloc = ...
   [optional] %view = std.view %alloc ...
   %subView = subview %allocOrView...
   ...
   vector.transfer_write %..., %allocOrView[...]
   linalg.copy(%subView, %out)
```

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




More information about the All-commits mailing list