[Mlir-commits] [mlir] [mlir][vector] Fix patterns for dropping leading unit dims from masks (PR #73525)

Jakub Kuderski llvmlistbot at llvm.org
Mon Nov 27 07:59:45 PST 2023


================
@@ -197,6 +197,23 @@ struct CastAwayInsertLeadingOneDim : public OpRewritePattern<vector::InsertOp> {
   }
 };
 
+static Value processTransferMask(OpBuilder &b, Location loc, Value mask,
+                                 VectorType newType, AffineMap newMap,
+                                 VectorType oldMaskType) {
+  // Infer the type of the new mask from the new map.
+  auto newMaskType = inferTransferOpMaskType(newType, newMap);
+
+  // If the new mask is broadcastable to the old result type, we can safely
+  // use a `vector.extract` to get the new mask. Otherwise the best we can
+  // do is shape cast.
+  if (mlir::vector::isBroadcastableTo(newMaskType, oldMaskType) ==
----------------
kuhar wrote:

```suggestion
  if (vector::isBroadcastableTo(newMaskType, oldMaskType) ==
```

https://github.com/llvm/llvm-project/pull/73525


More information about the Mlir-commits mailing list