[all-commits] [llvm/llvm-project] 499e89: Add patterns to lower vector.multi_reduction into ...

Ahmed S. Taei via All-commits all-commits at lists.llvm.org
Fri Apr 30 10:53:39 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 499e89fc9119d901132bcc8ab460b1c161c22acc
      https://github.com/llvm/llvm-project/commit/499e89fc9119d901132bcc8ab460b1c161c22acc
  Author: Ahmed Taei <ataei at google.com>
  Date:   2021-04-30 (Fri, 30 Apr 2021)

  Changed paths:
    M mlir/include/mlir/Dialect/Vector/VectorOps.h
    M mlir/lib/Dialect/Vector/VectorTransforms.cpp
    A mlir/test/Dialect/Vector/vector-multi-reduction-lowering.mlir
    M mlir/test/lib/Transforms/TestVectorTransforms.cpp

  Log Message:
  -----------
  Add patterns to lower vector.multi_reduction into a sequence of vector.reduction

Three patterns are added to convert into vector.multi_reduction into a
sequence of vector.reduction as the following:

- Transpose the inputs so inner most dimensions are always reduction.
- Reduce rank of vector.multi_reduction into 2d with inner most
reduction dim (get the 2d canical form)
- 2D canonical form is converted into a sequence of vector.reduction.

There are two things we might worth in a follow up diff:

- An scf.for (maybe optionally) around vector.reduction instead of unrolling it.
- Breakdown the vector.reduction into a sequence of vector.reduction
(e.g tree-based reduction) instead of relying on how downstream dialects
handle it.
  Note: this will requires passing target-vector-length

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




More information about the All-commits mailing list