[all-commits] [llvm/llvm-project] 2bac72: [mlir][vector] Take dim sizes into account in Drop...

Han-Chung Wang via All-commits all-commits at lists.llvm.org
Fri Nov 10 09:28:13 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2bac7201018dcab549895c30c0eb26bee45d842f
      https://github.com/llvm/llvm-project/commit/2bac7201018dcab549895c30c0eb26bee45d842f
  Author: Han-Chung Wang <hanhan0912 at gmail.com>
  Date:   2023-11-10 (Fri, 10 Nov 2023)

  Changed paths:
    M mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
    M mlir/test/Dialect/Vector/vector-transfer-collapse-inner-most-dims.mlir

  Log Message:
  -----------
  [mlir][vector] Take dim sizes into account in DropInnerMostUnitDims. (#71752)

The `stride == 1` does not imply that we can drop it. Because it could
load more than 1 elements. We should also take source sizes and vector
sizes into account. Otherwise it generates invalid IRs. E.g.,

```mlir
func.func @foo(%arg0: memref<1x1xf32>) -> vector<4x8xf32> {
  %c0 = arith.constant 0 : index
  %cst = arith.constant 0.000000e+00 : f32
  %0 = vector.transfer_read %arg0[%c0, %c0], %cst : memref<1x1xf32>, vector<4x8xf32>
  return %0 : vector<4x8xf32>
}
```

Fixes https://github.com/openxla/iree/issues/15493




More information about the All-commits mailing list