[Mlir-commits] [mlir] [mlir] Canonicalize tensor.extract_slice (linalg.fill) (PR #112619)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Oct 25 19:22:47 PDT 2024


MaheshRavishankar wrote:


> **BEFORE (2 uses)**:
> 
> ```
> %empty = tensor.empty
> %fill = linalg.fill %empty
> %res_1 = tensor.extract_slice %fill
> %res_2 = tensor.extract_slice %fill
> ```
> 
> **AFTER (2 uses)**:
> 
> ```
> %empty_1 = tensor.empty
> %res_1 = linalg.fill %empty_1
> %empty_2 = tensor.empty
> %res_2 = linalg.fill %empty_2
> ```
> 

@banach-space  how about this change for this example

```
%empty = tensor.empty
%extract_slice1 = tensor.extract_slice %empty
%extract_slice2 = tensor.extract_slice %empty
%res1 = linalg.fill (...) outs(%extract_slice1)
%res2 = linalg.fill (...) outs(%extract_slice2)
```

That seems like that should fall in the always good to do category. Again I am not advocating one way or another, just thinking aloud.

https://github.com/llvm/llvm-project/pull/112619


More information about the Mlir-commits mailing list