[Mlir-commits] [mlir] [mlir][linalg] Support subtracting accumulation in partial reduction … (PR #214033)

Ege Beysel llvmlistbot at llvm.org
Fri Aug 7 02:45:10 PDT 2026


================
@@ -534,6 +534,28 @@ static InitSliceInfo getInitSliceInfo(MLIRContext *context,
       partialReductionMap, initOperandShape);
 }
 
+/// Returns true if `combinerOp` accumulates into `accumulator` by subtracting
+/// the reduced value from it, i.e. it reduces the negated inputs.
+static bool isSubtractingAccumulation(Operation *combinerOp,
+                                      Value accumulator) {
+  if (!isa<arith::SubFOp, arith::SubIOp>(combinerOp))
+    return false;
+  return combinerOp->getOperand(0) == accumulator;
----------------
egebeysel wrote:

might be worthwhile adding a quick reasoning from the summary on why the acc should be at operand 0

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


More information about the Mlir-commits mailing list