[all-commits] [llvm/llvm-project] 8dffb7: [mlir][VectorOps] Add lowering for vector.shape_ca...

Benjamin Maxwell via All-commits all-commits at lists.llvm.org
Thu Sep 7 09:00:24 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8dffb71cbada73c5f9c1e9df7891566be0ff762d
      https://github.com/llvm/llvm-project/commit/8dffb71cbada73c5f9c1e9df7891566be0ff762d
  Author: Benjamin Maxwell <benjamin.maxwell at arm.com>
  Date:   2023-09-07 (Thu, 07 Sep 2023)

  Changed paths:
    M mlir/lib/Dialect/Vector/Transforms/LowerVectorShapeCast.cpp
    A mlir/test/Dialect/Vector/vector-shape-cast-lowering-scalable-vectors.mlir

  Log Message:
  -----------
  [mlir][VectorOps] Add lowering for vector.shape_cast of scalable vectors

This adds a lowering similar to the general shape_cast lowering, but
instead moves elements a (scalable) subvector at a time via
vector.scalable.extract/insert. It is restricted to the case where both
the source and result vector types have a single trailing scalable
dimension (due to limitations of the insert/extract ops).

The current lowerings are now disabled for scalable vectors, as they
produce incorrect results at runtime (due to assuming a fixed number
of elements).

Examples of casts that now work:

  // Flattening:
  %v = vector.shape_cast %arg0 : vector<4x[8]xi8> to vector<[32]xi8>

  // Un-flattening:
  %v = vector.shape_cast %arg0 : vector<[8]xi32> to vector<2x1x[4]xi32>

Reviewed By: awarzynski, nicolasvasilache

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




More information about the All-commits mailing list