[Mlir-commits] [mlir] [mlir][vector] Restore assert and fix typos (PR #68581)

Andrzej WarzyƄski llvmlistbot at llvm.org
Mon Oct 9 05:24:45 PDT 2023


https://github.com/banach-space created https://github.com/llvm/llvm-project/pull/68581

Follow-up for #68400 - restoring an assert that was accidentally removed and fixed a typo in a diagnostic.

>From 2fec2514b9acdcabe2cbe6737b849767d27cf48e Mon Sep 17 00:00:00 2001
From: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: Mon, 9 Oct 2023 12:26:54 +0100
Subject: [PATCH] [mlir][vector] Restore assert and fix typos

Follow-up for #68400 - restoring an assert that was accidentally removed
and fixed a typo in a diagnostic.
---
 mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp b/mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp
index 311e589547b89bc..5463a7bd8f4c840 100644
--- a/mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp
@@ -432,6 +432,9 @@ struct UnrolledOuterProductGenerator
       return failure();
 
     int reductionSize = lhsType.getDimSize(reductionDim);
+    assert(reductionSize > 0 &&
+           "Reduction dim must be a known static size to allow unrolling");
+
     // Incremental support for masking.
     if (mask && !maybeMask.has_value())
       return failure();
@@ -997,7 +1000,7 @@ FailureOr<Value> ContractionOpLowering::lowerParallel(PatternRewriter &rewriter,
       });
     if (lhsType.getScalableDims()[lhsIndex])
       return rewriter.notifyMatchFailure(op, [&](Diagnostic &diag) {
-        diag << "Unrolloing scalable dimension (lhsIndex=" << lhsIndex
+        diag << "Unrolling scalable dimension (lhsIndex=" << lhsIndex
              << ") is not supported yet";
       });
     dimSize = lhsType.getDimSize(lhsIndex);
@@ -1005,7 +1008,7 @@ FailureOr<Value> ContractionOpLowering::lowerParallel(PatternRewriter &rewriter,
     iterIndex = iMap[1].getDimPosition(rhsIndex);
     if (rhsType.getScalableDims()[rhsIndex])
       return rewriter.notifyMatchFailure(op, [&](Diagnostic &diag) {
-        diag << "Unrolloing scalable dimension (lhsIndex=" << lhsIndex
+        diag << "Unrolling scalable dimension (rhsIndex=" << rhsIndex
              << ") is not supported yet";
       });
     dimSize = rhsType.getDimSize(rhsIndex);



More information about the Mlir-commits mailing list