[Mlir-commits] [mlir] [mlir][linalg] Fix getSourceSkipUnary to only skip cast-like ops (PR #198725)
Hocky Yudhiono
llvmlistbot at llvm.org
Wed May 27 21:20:30 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(
----------------
hockyy wrote:
do we need to skip the cast here as well on the reduction? Some generalization patterns didn't produce cast on this
https://github.com/llvm/llvm-project/pull/198725
More information about the Mlir-commits
mailing list