[all-commits] [llvm/llvm-project] 56d6b5: [mlir][vector] Relax the requirements on broadcast...

Andrzej Warzyński via All-commits all-commits at lists.llvm.org
Thu Oct 3 23:41:43 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 56d6b567394abfc07ea4d3c92fa534bbf58e1942
      https://github.com/llvm/llvm-project/commit/56d6b567394abfc07ea4d3c92fa534bbf58e1942
  Author: Andrzej Warzyński <andrzej.warzynski at arm.com>
  Date:   2024-10-04 (Fri, 04 Oct 2024)

  Changed paths:
    M mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
    M mlir/include/mlir/Interfaces/VectorInterfaces.td
    M mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
    M mlir/lib/Dialect/Vector/IR/VectorOps.cpp
    M mlir/test/Conversion/VectorToSCF/vector-to-scf.mlir
    M mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir
    M mlir/test/Dialect/Affine/SuperVectorize/vectorize_2d.mlir
    M mlir/test/Dialect/Affine/SuperVectorize/vectorize_affine_apply.mlir
    M mlir/test/Dialect/Linalg/hoisting.mlir
    M mlir/test/Dialect/Linalg/vectorization.mlir
    M mlir/test/Dialect/Vector/invalid.mlir
    M mlir/test/Dialect/Vector/ops.mlir
    M mlir/test/Dialect/Vector/vector-transfer-permutation-lowering.mlir
    M mlir/test/Dialect/Vector/vector-transfer-unroll.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/transfer-read-1d.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/transfer-read-2d.mlir
    M mlir/test/Integration/Dialect/Vector/CPU/transfer-read-3d.mlir

  Log Message:
  -----------
  [mlir][vector] Relax the requirements on broadcast dims (#99341)

NOTE: This is a follow-up for #97049 in which the `in_bounds` attribute
was made mandatory.

This PR updates the semantics of the `in_bounds` attribute so that
broadcast dimensions are no longer required to be "in bounds".
Specifically, these xfer_read/xfer_write Ops become valid after this
change:

```mlir
  %read = vector.transfer_read %A[%base1, %base2], %pad
      {in_bounds = [false], permutation_map = affine_map<(d0, d1) -> (0)>}
      {permutation_map = affine_map<(d0, d1) -> (0)>}
      : memref<?x?xf32>, vector<9xf32>

  vector.transfer_write %vec, %A[%base1, %base2],
      {in_bounds = [false], permutation_map = affine_map<(d0, d1) -> (0)>}
      {permutation_map = affine_map<(d0, d1) -> (0)>}
      : vector<9xf32>, memref<?x?xf32>
```

Note that the value `false` merely means "may run out-of-bounds", i.e.,
the corresponding access can still be "in bounds". In fact, the folder
for xfer Ops is also updated (*) and will update the attribute value
corresponding to broadcast dims to `true` if all non-broadcast dims
are marked as "in bounds". 

Note that this PR doesn't change any of the lowerings. The changes in
"SuperVectorize.cpp", "Vectorization.cpp" and "AffineMap.cpp" are simple
reverts of recent changes in #97049. Those were only meant to facilitate
making `in_bounds` mandatory and to work around the extra requirements
for broadcast dims (those requirements ere removed in this PR). All
changes in tests are also reverts of changes from #97049.

For context, here's a PR in which "broadcast" dims where forced to
always be "in-bounds":
  * https://reviews.llvm.org/D102566

(*) See `foldTransferInBoundsAttribute`.



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