[Mlir-commits] [mlir] [MLIR] Don't drop attached discardable attributes (PR #111261)
Mehdi Amini
llvmlistbot at llvm.org
Tue Oct 8 14:42:00 PDT 2024
================
@@ -4337,11 +4337,16 @@ LogicalResult PackOp::canonicalize(PackOp packOp, PatternRewriter &rewriter) {
dest =
rewriter.create<tensor::CastOp>(loc, newDestType, packOp.getDest());
}
- Value newOp = rewriter.create<tensor::PackOp>(
- loc, source, dest, packOp.getInnerDimsPos(), packOp.getMixedTiles(),
- packOp.getPaddingValue(), packOp.getOuterDimsPerm());
+ auto clonedPackOp = cast<PackOp>(rewriter.clone(*packOp));
----------------
joker-eph wrote:
> There are two situations:
> - The dest tensor type is the same. In this case, we do not need a tensor.cast consumer.
> - The dest tensor type is changed. In this case, we need to create the tensor.cast op which makes the types consistent.
The current code already does not try differentiate between these I believe: it always creates the cast, which is folded later if the types were matching.
> I think it is not trivial to do in-place modification.
I don't understand what's not trivial here.
I sent a PR implementing it: https://github.com/llvm/llvm-project/pull/111593
https://github.com/llvm/llvm-project/pull/111261
More information about the Mlir-commits
mailing list