[Mlir-commits] [mlir] [mlir][linalg] Fix getSourceSkipUnary to only skip cast-like ops (PR #198725)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu May 28 00:27:02 PDT 2026


================
@@ -331,25 +332,25 @@ bool mlir::linalg::detail::isContractionBody(
     return false;
   }
 
-  Value yielded = getSourceSkipUnary(terminator->getOperand(0));
+  Value yielded = getSourceSkipCast(terminator->getOperand(0));
   Operation *reductionOp = yielded.getDefiningOp();
   if (!reductionOp || reductionOp->getNumResults() != 1 ||
       reductionOp->getNumOperands() != 2) {
     errs << "expected reduction op to be binary";
     return false;
   }
 
-  Value reductionLHS = getSourceSkipUnary(reductionOp->getOperand(0));
-  Value reductionRHS = getSourceSkipUnary(reductionOp->getOperand(1));
+  Value reductionLHS = getSourceSkipCast(reductionOp->getOperand(0));
+  Value reductionRHS = getSourceSkipCast(reductionOp->getOperand(1));
 
   if (reductionLHS != block.getArgument(2) &&
       reductionRHS != block.getArgument(2)) {
     errs << "expected reduction to take block argument #2 as one of the "
-            "operands (modulo unary casts)";
+            "operands (modulo supported contraction casts)";
     return false;
   }
 
-  Value contributed = getSourceSkipUnary(
+  Value contributed = getSourceSkipCast(
----------------
Chennesxu wrote:

sure

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


More information about the Mlir-commits mailing list