[Mlir-commits] [mlir] [mlir][Linalg] Preserve init in tiled in-place update patterns (PR #195912)
Jyotsna Verma
llvmlistbot at llvm.org
Wed May 6 10:46:02 PDT 2026
================
@@ -92,6 +92,22 @@ struct MoveInitOperandsToInput : public OpRewritePattern<GenericOp> {
for (OpOperand &op : outputOperands) {
if (genericOp.getMatchingBlockArgument(&op).use_empty())
continue;
+ // When DropUnitDims folds a unit reduction dim, the generic becomes
+ // all-parallel but the former accumulator remains in outs. Moving it
+ // to ins is correct in general, but NOT when the init participates in
+ // an extract_slice -> generic -> insert_slice chain which is the
+ // canonical in-place update pattern that one-shot bufferize relies on.
----------------
jverma-quic wrote:
Thanks for the suggestion, @matthias-springer! I chose to handle this specific case since I didn't have the right context why this change was made in the first place. I spent some time today looking at the test related to unit-dims pass, and I noticed other cases where tensor.empty is being introduced unnecessarily. I'll go ahead and remove the call to populateMoveInitOperandsToInputPattern and update the patch.
https://github.com/llvm/llvm-project/pull/195912
More information about the Mlir-commits
mailing list