[all-commits] [llvm/llvm-project] bf897d: [mlir][vector] Extend TransferReadDropUnitDimsPatt...

Cullen Rhodes via All-commits all-commits at lists.llvm.org
Mon Nov 20 00:40:02 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bf897d5d77e974486e37d33e83f50f5ea95390fa
      https://github.com/llvm/llvm-project/commit/bf897d5d77e974486e37d33e83f50f5ea95390fa
  Author: Cullen Rhodes <cullen.rhodes at arm.com>
  Date:   2023-11-20 (Mon, 20 Nov 2023)

  Changed paths:
    M mlir/lib/Dialect/Vector/Transforms/VectorTransferOpTransforms.cpp
    M mlir/test/Dialect/Vector/vector-transfer-drop-unit-dims-patterns.mlir

  Log Message:
  -----------
  [mlir][vector] Extend TransferReadDropUnitDimsPattern to support partially-static memrefs (#72142)

This patch extends TransferReadDropUnitDimsPattern to support dropping
unit dims from partially-static memrefs, for example:

%v = vector.transfer_read %base[%c0, %c0], %pad {in_bounds = [true, true]} :
  memref<?x1xi8, strided<[?, ?], offset: ?>>, vector<[16]x1xi8>

Is rewritten as:

%dim0 = memref.dim %base, %c0 : memref<?x1xi8, strided<[?, ?], offset: ?>>
%subview = memref.subview %base[0, 0] [%dim0, 1] [1, 1] :
  memref<?x1xi8, strided<[?, ?], offset: ?>> to memref<?xi8, #map1>
%v = vector.transfer_read %subview[%c0], %pad {in_bounds = [true]}
  : memref<?xi8, #map1>, vector<[16]xi8>

Scalable vectors are now also supported, the scalable dims were being
dropped when creating the rank-reduced vector type. The xfer op can also
have a mask of type 'vector.create_mask', which gets rewritten as long
as the mask of the unit dim is a constant of 1.




More information about the All-commits mailing list