[all-commits] [llvm/llvm-project] 2e69f4: [mlir][vector] Fix illegal vector.transfer + tenso...

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Thu Dec 30 06:56:00 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2e69f4f0126d49a1199703b23050ad71024fb52c
      https://github.com/llvm/llvm-project/commit/2e69f4f0126d49a1199703b23050ad71024fb52c
  Author: Nicolas Vasilache <nicolas.vasilache at gmail.com>
  Date:   2021-12-30 (Thu, 30 Dec 2021)

  Changed paths:
    M mlir/lib/Dialect/Vector/VectorOps.cpp
    M mlir/test/Dialect/Vector/canonicalize.mlir

  Log Message:
  -----------
  [mlir][vector] Fix illegal vector.transfer + tensor.insert/extract_slice folding

vector.transfer operations do not have rank-reducing semantics.

Bail on illegal rank-reduction: we need to check that the rank-reduced
dims are exactly the leading dims. I.e. the following is illegal:
```
   %0 = vector.transfer_write %v, %t[0,0], %cst :
     vector<2x4xf32>, tensor<2x4xf32>
   %1 = tensor.insert_slice %0 into %tt[0,0,0][2,1,4][1,1,1] :
     tensor<2x4xf32> into tensor<2x1x4xf32>
```

Cannot fold into:
```
   %0 = vector.transfer_write %v, %t[0,0,0], %cst :
     vector<2x4xf32>, tensor<2x1x4xf32>
```
For this, check the trailing `vectorRank` dims of the insert_slice result
tensor match the trailing dims of the inferred result tensor.

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




More information about the All-commits mailing list