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

Mehdi Amini llvmlistbot at llvm.org
Mon Nov 11 14:42:44 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());
----------------
joker-eph wrote:

The reason these are called "discardable" is because we are expected to discard them when we don't understand them / can't update them in transformations!

So the principled approach would be to be conservative: either don't perform the transformation if you don't understand the attributes, or drop them.

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


More information about the Mlir-commits mailing list