Matthias Springer
77124386fe
[mlir][tensor] Add transform to make tensor.pad loop-independent
Add a transform to make `tensor.pad` and `tensor.empty` ops independent of SCF loop IVs. Such ops can then be hoisted.
E.g.:
```
scf.for %iv = %lb to %ub step %step {
%high = affine.apply affine_map<(d0)[s0] -> (s0 - d0)> (%i)[%ub]
%p = tensor.pad %t low[5] high[%high] ...
...
}
```
Is transformed to:
```
%high_new = affine.apply affine_map<()[s0, s1] -> (-s0 + s1)> ()[%lb, %ub]
%p_hoistable = tensor.pad %t low[5] high[%high_new]
%dim = tensor.dim %t, %c0
%size = affine.apply affine_map<(d0)[s0, s1] -> (-d0 + s0 + s1 + 5)>(%iv)[%ub, %dim]
%slice = tensor.extract_slice %p_hoistable [0] [%size] [1]
```
Differential Revision: https://reviews.llvm.org/D143910
2023-04-28 11:46:32 +09:00
..
2023-02-02 11:34:03 +01:00
2023-03-30 11:30:06 +02:00
2023-02-17 09:59:39 +01:00
2023-03-21 11:59:25 +01:00
2022-12-07 23:01:34 +01:00
2023-01-11 13:51:49 -08:00
2023-02-17 09:59:39 +01:00
2023-04-14 09:34:11 -07:00
2023-04-06 13:22:10 +09:00
2022-12-02 15:38:02 +01:00
2023-04-16 09:34:43 +09:00
2022-11-28 15:26:30 -08:00
2023-01-12 08:46:45 +01:00
2023-02-23 10:35:00 -08:00
2023-04-28 11:46:32 +09:00
2023-04-07 11:35:02 +09:00