[Mlir-commits] [mlir] [mlir][tensor] Generalize/restrict `GeneralizeOuterUnitDimsPackOpPattern` (PR #114315)
Quinn Dawkins
llvmlistbot at llvm.org
Tue Nov 5 11:34:04 PST 2024
================
@@ -1148,69 +1172,104 @@ LogicalResult GeneralizeOuterUnitDimsPackOpPattern::matchAndRewrite(
packOp, "require the tiled outer dimensions of the result are all 1s");
}
- // 1. Use rank-reduced tensor.extract_slice op to extract the tile and untiled
- // outer dims.
+ Attribute zeroIdxAttr = rewriter.getIndexAttr(0);
+ Attribute oneIdxAttr = rewriter.getIndexAttr(1);
Location loc = packOp.getLoc();
+
Value input = getPackOpSourceOrPaddedSource(rewriter, packOp);
auto inputShape = packOp.getSourceType().getShape();
DenseMap<int64_t, OpFoldResult> dimAndTileMapping =
packOp.getDimAndTileMapping();
- Attribute zeroIdxAttr = rewriter.getIndexAttr(0);
- Attribute oneIdxAttr = rewriter.getIndexAttr(1);
int64_t srcRank = packOp.getSourceRank();
+
+ int64_t destRank = packOp.getDestRank();
+ size_t numTiles = destRank - srcRank;
+
+ // 1. Use rank-reduced tensor.extract_slice op to extract the tile:
----------------
qedawkins wrote:
Ah really, that makes sense then. If it's preserving existing behavior leaving it is fine, but should look into removing it at some point.
https://github.com/llvm/llvm-project/pull/114315
More information about the Mlir-commits
mailing list