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

Longsheng Mou llvmlistbot at llvm.org
Wed Apr 9 00:45:58 PDT 2025


================
@@ -4259,6 +4259,15 @@ ParseResult TransferReadOp::parse(OpAsmParser &parser, OperationState &result) {
   Attribute permMapAttr = result.attributes.get(permMapAttrName);
   AffineMap permMap;
   if (!permMapAttr) {
+    int64_t elementVectorRank = 0;
----------------
CoTinker wrote:

I think we should extract the common code to a function, such as:
```
int64_t getRealVectorRank(ShapedType shapedType, VectorType vectorType) {
  int64_t elementVectorRank = 0;
  VectorType elementVectorType =
      llvm::dyn_cast<VectorType>(shapedType.getElementType());
  if (elementVectorType)
    elementVectorRank += elementVectorType.getRank();
  return vectorType.getRank() - elementVectorRank;
}
```
The `TransferReadOp::parse`、`TransferWriteOp::parse`、`getTransferMinorIdentityMap` need invoke this function.

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


More information about the Mlir-commits mailing list