[all-commits] [llvm/llvm-project] 9f0aa0: [mlir][vector] Add ElementwiseToOuterproduct (#93664)

Hugo Trachino via All-commits all-commits at lists.llvm.org
Fri Jun 21 05:34:58 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9f0aa05bfb40c077a5b1c2ea8cac88fdd51f0c5c
      https://github.com/llvm/llvm-project/commit/9f0aa05bfb40c077a5b1c2ea8cac88fdd51f0c5c
  Author: Hugo Trachino <hugo.trachino at huawei.com>
  Date:   2024-06-21 (Fri, 21 Jun 2024)

  Changed paths:
    M mlir/include/mlir/Dialect/Vector/IR/VectorOps.h
    M mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
    M mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp
    M mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
    M mlir/test/Dialect/Vector/transform-vector.mlir

  Log Message:
  -----------
  [mlir][vector] Add ElementwiseToOuterproduct (#93664)

1D multi-reduction are lowered to arith which can prevent some
optimisations. I propose `ElementwiseToOuterproduct` matching a series of
ops to generate `vector.outerproduct`.
As part of some `ElementwiseToVectorOpsPatterns`, it could allow to fuse
other elementwiseOps to vector dialect.
Originally discussed
https://discourse.llvm.org/t/on-improving-arm-sme-lowering-resilience-in-mlir/78543/24.

quote @MacDue
```
%lhsBcast = vector.broadcast %lhsCast : vector<[4]xf32> to vector<[4]x[4]xf32>
%lhsT = vector.transpose %lhsBcast, [1, 0] : vector<[4]x[4]xf32> to vector<[4]x[4]xf32>
%rhsBcast = vector.broadcast %rhs : vector<[4]xf32> to vector<[4]x[4]xf32>
%mul = arith.mulf %lhsT, %rhsBcast : vector<[4]x[4]xf32>
```

Can be rewritten as:

```
%mul = vector.outerproduct $lhs, $rhs : vector<[4]xf32>, vector<[4]xf32>
```

---------

Co-authored-by: Han-Chung Wang <hanhan0912 at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list