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

Jakub Kuderski llvmlistbot at llvm.org
Tue Aug 6 07:35:44 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) +
----------------
kuhar wrote:

Doesn't `Twine` allow for concatenating numbers directly? I'd think that we can construct a `Twine` out of a number and then add it to the previous `Twine`

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


More information about the Mlir-commits mailing list