[all-commits] [llvm/llvm-project] 0cbfd6: [MLIR]Extend vector.gather to support n-D result

Jerry Wu via All-commits all-commits at lists.llvm.org
Tue Aug 23 09:59:39 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0cbfd6fd1633a075dcfd1bcd8a11e1c6d2785fa8
      https://github.com/llvm/llvm-project/commit/0cbfd6fd1633a075dcfd1bcd8a11e1c6d2785fa8
  Author: Che-Yu Wu <cheyuw at google.com>
  Date:   2022-08-23 (Tue, 23 Aug 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
    M mlir/lib/Conversion/LLVMCommon/VectorPattern.cpp
    M mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
    M mlir/lib/Dialect/Vector/IR/VectorOps.cpp
    M mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir
    M mlir/test/Dialect/Vector/invalid.mlir
    M mlir/test/Dialect/Vector/ops.mlir

  Log Message:
  -----------
  [MLIR]Extend vector.gather to support n-D result

Currently vector.gather only supports reading memory into a 1-D result vector.
This patch extends it to support an n-D result vector with the indices, masks,
and passthroughs in n-D vectors.

As we are trying to vectorize tensor.extract with vector.gather
(https://github.com/iree-org/iree/issues/9198), it will need to gather the
elements into an n-D vector. Having vector.gather with n-D results allows us
to avoid flatten and reshape at the vectorization stage. The backends can then
decide the optimal ways to lower the vector.gather op.

Note that this is different from n-D gathering, which is about reading n-D
memory with the n-D indices. The indices here are still only 1-D offsets on
the base.

Reviewed By: dcaballe

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




More information about the All-commits mailing list