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-19 22:04:47 -08:00
2022-10-13 20:33:24 -05:00
2023-04-27 06:00:48 +00:00
2022-12-29 12:03:32 +01:00
2023-04-19 18:39:54 +00:00
2022-11-29 15:35:02 +01:00
2023-01-14 01:25:58 -08:00
2023-03-10 11:37:54 +01:00
2023-02-10 16:14:17 +00:00
2023-04-27 06:00:48 +00:00
2022-12-21 10:57:14 +01:00
2022-10-03 13:58:52 +09:00
2022-12-14 15:18:37 +00:00
2023-04-28 11:46:32 +09:00
2022-11-29 03:36:54 +00:00
2023-02-17 08:57:52 +01:00