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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Apr 3 08:43:10 PDT 2025


================
@@ -164,6 +164,10 @@ AffineMap mlir::vector::getTransferMinorIdentityMap(ShapedType shapedType,
     return AffineMap::get(
         /*numDims=*/0, /*numSymbols=*/0,
         getAffineConstantExpr(0, shapedType.getContext()));
+  if (shapedType.getRank() < vectorType.getRank() - elementVectorRank) {
+    return AffineMap(); // Not enough dimensions in the shaped type to form a
----------------
douyixuan wrote:

Actually, the provided MLIR is valid, and the `elementVectorRank` calculation is tested in `test/Dialect/Vector/vector-transfer-to-vector-load-store.mlir`. Additionally, it is verified by the test case related to this issue, where the `elementVectorRank` is `0`.
```
module {
  func.func @test_vector.transfer_read(%arg1: memref<?xindex>) -> vector<3x4xi32> {
    %c3_i32 = arith.constant 3 : i32
    %0 = vector.transfer_read %arg1[%c3_i32, %c3_i32], %c3_i32 : memref<?xindex>, vector<3x4xi32>
    return %0 : vector<3x4xi32>
  }
}
```

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


More information about the Mlir-commits mailing list