[Mlir-commits] [mlir] [mlir][vector] Fix a `target-rank=0` unrolling (PR #73365)

Cullen Rhodes llvmlistbot at llvm.org
Mon Nov 27 04:34:45 PST 2023


================
@@ -1207,23 +1207,30 @@ struct UnrollTransferWriteConversion
   /// accesses, and broadcasts and transposes in permutation maps.
   LogicalResult matchAndRewrite(TransferWriteOp xferOp,
                                 PatternRewriter &rewriter) const override {
-    if (xferOp.getVectorType().getRank() <= options.targetRank)
+    VectorType inputVectorTy = xferOp.getVectorType();
+
+    if (inputVectorTy.getRank() <= options.targetRank)
       return failure();
+
+    // When target-rank=0, unrolling would cause the vector input argument
+    // into `transfer_write` to become a scalar.
----------------
c-rhodes wrote:

this fixes the crash but doesn't address the lowering. I think this could be fixed by splatting the extracted scalar to a rank-0 vector (xfer write source).

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


More information about the Mlir-commits mailing list