[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:47:14 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,
----------------
pstarkcdpr wrote:

Refactored to use a struct. It's much better this way since the identity element and merge function are forced to match. Commit 4e221308f922b304fb4d8345005674e72cd82131

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


More information about the Mlir-commits mailing list