[Mlir-commits] [mlir] [mlir][vector] Fix parser of vector.transfer_read (PR #133721)

Andrzej WarzyƄski llvmlistbot at llvm.org
Mon Apr 7 10:35:07 PDT 2025


================
@@ -4260,6 +4264,17 @@ ParseResult TransferReadOp::parse(OpAsmParser &parser, OperationState &result) {
   AffineMap permMap;
   if (!permMapAttr) {
     permMap = getTransferMinorIdentityMap(shapedType, vectorType);
+    if (!permMap) {
+      int64_t elementVectorRank = 0;
+      VectorType elementVectorType =
+          llvm::dyn_cast<VectorType>(shapedType.getElementType());
+      if (elementVectorType)
+        elementVectorRank += elementVectorType.getRank();
+      if (shapedType.getRank() < vectorType.getRank() - elementVectorRank)
+        return parser.emitError(typesLoc,
+                                "expected a custom permutation_map when source "
+                                "rank is less than required for vector rank");
----------------
banach-space wrote:

```suggestion
                                "expected a custom permutation_map when rank(source) != rank (destination)";
```

Same comment for the `transfer_write` part. This way these conditions are identical and can later be extracted to a helper function (I can do it in a separate PR).

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


More information about the Mlir-commits mailing list