[Mlir-commits] [mlir] [mlir][linalg] Support subtracting accumulation in partial reduction … (PR #214033)
Ege Beysel
llvmlistbot at llvm.org
Fri Aug 7 02:45:09 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;
+}
+
+/// Creates the operation combining two partial results of the subtracting
+/// accumulation performed by `combinerOp`, preserving its fast-math flags and
+/// rounding mode. Integer overflow flags are dropped, since the flags of the
----------------
egebeysel wrote:
> Integer overflow flags are dropped, since the flags of the subtraction do not carry over to the addition.
A very quick example would be nice here.
https://github.com/llvm/llvm-project/pull/214033
More information about the Mlir-commits
mailing list