[Mlir-commits] [mlir] [mlir][linalg] Extend `FuseElementwiseOps` pattern to work with named ops (PR #144922)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Nov 18 06:56:22 PST 2025


================
@@ -554,23 +554,42 @@ FailureOr<DropUnitDimsResult> dropUnitDims(RewriterBase &rewriter,
                                            GenericOp genericOp,
                                            const ControlDropUnitDims &options);
 
-/// Fuse two `linalg.generic` operations that have a producer-consumer
+/// Base implementation for fusion of two linalg operations.
+/// Fuse two linalg operations that have a producer-consumer
 /// relationship captured through `fusedOperand`. The method expects
 /// that `areElementwiseOpsFusable` returns true for the given `fusedOperand`.
+/// The resulting fused operation is always a `linalg.generic`.
+/// TODO: Support fusing to named ops when possible.  For many cases,
+/// `linalg.generic` is the only op that is capable of representing the fused
+/// operation. An example exception is fusing two `linalg.map` ops.  The fused
+/// result can also be represented by `linalg.map`.
 struct ElementwiseOpFusionResult {
   Operation *fusedOp;
   llvm::DenseMap<Value, Value> replacements;
 };
+template <typename LinagOpTy>
 FailureOr<ElementwiseOpFusionResult>
-fuseElementwiseOps(RewriterBase &rewriter, OpOperand *fusedOperand);
+fuseElementwiseLinalgOpsImpl(RewriterBase &rewriter, OpOperand *fusedOperand);
+
+/// Specialization of `fuseElementwiseLinalgOpsImpl` for a producer-consumer of
+/// `fusedOperand` that are any `LinalgOp`.
+FailureOr<ElementwiseOpFusionResult>
+fuseElementwiseLinalgOps(RewriterBase &rewriter, OpOperand *fusedOperand);
+
+/// Specialization `fuseElementwiseLinalgOpsImpl` restricted to
----------------
srcarroll wrote:

you call it being disrespectful. i call it being blunt.  

i could argue you have been violating https://llvm.org/docs/CodeOfConduct.html#when-we-disagree-try-to-understand-why for the entire second half of this PRs lifetime.  You have ignored every single one of my rebuttals to your false claims.  Claims that were just asserted without supporting facts.  Instead of addressing my arguments, you just re-assert the same false claims.

I've lost interest in continuing with this PR. I'll just keep the changes for myself. You're putting too much burden on me to make a change that, I've argued, is entirely unnecessary while you have provided no legitimate reasons for it.  I don't want to negotiate with someone who doesn't show the courtesy of addressing my concerns.  If no other reviewer wants to chime in on this argument, then that tells me they don't care enough about the changes.  Which is fine.  I don't take it personally.  As I've said before, I don't need to upstream this and at this point it isn't worth it. I'll revisit if there are enough people that care about it.

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


More information about the Mlir-commits mailing list