[Mlir-commits] [mlir] [mlir][linalg] Support subtracting accumulation in partial reduction … (PR #214033)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Aug 7 13:50:09 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.");
----------------
pstarkcdpr wrote:
After the refactor in commit 4e221308f922b304fb4d8345005674e72cd82131, there's a factory that creates both the identity element and the merge function at the same time. So this failure now potentially encapsulates a bunch of possible errors, so was updated to `failed to determine how to split the reduction operation`
https://github.com/llvm/llvm-project/pull/214033
More information about the Mlir-commits
mailing list