[Mlir-commits] [mlir] [mlir][tensor] Extend the logic to generalise tensor.pack (PR #109815)
Han-Chung Wang
llvmlistbot at llvm.org
Mon Sep 30 14:57:00 PDT 2024
================
@@ -1178,10 +1212,20 @@ LogicalResult GeneralizeOuterUnitDimsPackOpPattern::matchAndRewrite(
LLVM_DEBUG(DBGS() << "Pack permutation: " << packOp << "\n";
llvm::interleaveComma(perm, DBGS() << "perm: "); DBGSNL(););
- SmallVector<int64_t> transpShape = readShape;
- applyPermutationToVector<int64_t>(transpShape, perm);
+ applyPermutationToVector<OpFoldResult>(transShapeForEmpty, perm);
- Value empty = rewriter.create<tensor::EmptyOp>(loc, transpShape, elemType);
+ // If there's a tile with a dynamic size, retrieve its size. ATM only 1
+ // dynamic tile is allowed.
+ Value dynDimSize;
+ for (auto tile : packOp.getMixedTiles()) {
+ if (tile.is<Value>()) {
+ assert(!dynDimSize && "Only one scalable size is supported ATM.");
+ dynDimSize = cast<Value>(tile);
+ }
+ }
----------------
hanhanW wrote:
Nit: remove the dead code. We don't need this, right? There are no uses, and the function that should account this is `getPackOpSourceOrPaddedSource`.
https://github.com/llvm/llvm-project/pull/109815
More information about the Mlir-commits
mailing list