[Mlir-commits] [mlir] [mlir][linalg] Support subtracting accumulation in partial reduction … (PR #214033)
Federico Bruzzone
llvmlistbot at llvm.org
Fri Aug 7 03:23:37 PDT 2026
================
@@ -562,7 +584,12 @@ struct LinalgOpPartialReductionInterface
return op->emitOpError("Failed to anaysis the reduction operation.");
Operation *reductionOp = combinerOps[0];
- std::optional<TypedAttr> identity = arith::getNeutralElement(reductionOp);
+ std::optional<TypedAttr> identity;
+ if (isSubtractingAccumulation(reductionOp,
+ linalgOp.getRegionOutputArgs()[initIdx]))
+ identity = b.getZeroAttr(reductionOp->getResult(0).getType());
+ else
+ identity = arith::getNeutralElement(reductionOp);
if (!identity.has_value())
return op->emitOpError(
"Failed to get an identity value for the reduction operation.");
----------------
FedericoBruzzone wrote:
Perhaps we can update this error message. It refers to the position of the operand, right?
https://github.com/llvm/llvm-project/pull/214033
More information about the Mlir-commits
mailing list