[Mlir-commits] [mlir] [mlir][Tensor] Retain discardable attrs in pack(cast) folder (PR #115772)

Stella Laurenzo llvmlistbot at llvm.org
Tue Nov 12 21:13:18 PST 2024


================
@@ -4798,6 +4798,7 @@ struct FoldTensorCastPackOp : public OpRewritePattern<PackOp> {
     PackOp newOp = rewriter.create<PackOp>(
         op.getLoc(), newOperands[0], newOperands[1], op.getInnerDimsPos(),
         newMixedTileSizes, op.getPaddingValue(), op.getOuterDimsPerm());
+    newOp->setDiscardableAttrs(op->getDiscardableAttrDictionary());
----------------
stellaraccident wrote:

The rationale stated claimed in the comments was that in the prior state, the folders were operating in place, which implicitly preserves these attributes. Regardless of whether this is the best kind of assumption to have, it is an inconsistent and unintended state to have this be different just because this pattern does not do an in place modification. 

Agreed, that should have made it to the commit message.

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


More information about the Mlir-commits mailing list