[Mlir-commits] [mlir] [mlir][vector] Clarify the semantics of BroadcastOp (PR #101928)

Andrzej Warzyński llvmlistbot at llvm.org
Tue Aug 6 09:32:55 PDT 2024


================
@@ -2406,16 +2422,24 @@ mlir::vector::isBroadcastableTo(Type srcType, VectorType dstVectorType,
 }
 
 LogicalResult BroadcastOp::verify() {
-  std::pair<int, int> mismatchingDims;
+  std::pair<VectorDim, VectorDim> mismatchingDims;
   BroadcastableToResult res = isBroadcastableTo(
       getSourceType(), getResultVectorType(), &mismatchingDims);
   if (res == BroadcastableToResult::Success)
     return success();
   if (res == BroadcastableToResult::SourceRankHigher)
     return emitOpError("source rank higher than destination rank");
-  if (res == BroadcastableToResult::DimensionMismatch)
-    return emitOpError("dimension mismatch (")
-           << mismatchingDims.first << " vs. " << mismatchingDims.second << ")";
+  if (res == BroadcastableToResult::DimensionMismatch) {
+    std::string msg = (Twine("dimension mismatch (") +
+                       (mismatchingDims.first.isScalable ? "[" : "") +
+                       std::to_string(mismatchingDims.first.dim) +
----------------
banach-space wrote:

haha, that worked 😅 Thanks!

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


More information about the Mlir-commits mailing list