Lines Matching defs:packOp
220 tensor::PackOp packOp,
224 cast<RankedTensorType>(packOp->getResultTypes().front());
225 if (llvm::any_of(packOp.getStaticInnerTiles(),
228 packOp,
232 Location loc = packOp->getLoc();
234 rewriter.setInsertionPoint(packOp);
239 packedTensorType.getRank(), packOp.getInnerDimsPos());
241 tensor::getPackInverseDestPerm(packOp);
248 // 4. Pad the source of packOp to a shape we can expand into stripMinedShape.
249 SmallVector<OpFoldResult> lows(packOp.getSourceRank(),
251 SmallVector<OpFoldResult> highs(packOp.getSourceRank(),
254 llvm::zip_equal(packOp.getInnerDimsPos(), packOp.getMixedTiles())) {
258 tensor::getMixedSize(rewriter, loc, packOp.getSource(), pos);
260 tensor::getMixedSize(rewriter, loc, packOp.getDest(), outerPos);
271 Value paddingValue = packOp.getPaddingValue();
277 rewriter.create<tensor::PadOp>(loc, collapsed, packOp.getSource(), lows,
299 if (lowerPadLikeWithInsertSlice && packOp.isLikePad()) {
310 SmallVector<OpFoldResult> zeros(packOp.getDestRank(),
313 SmallVector<OpFoldResult> ones(packOp.getDestRank(),
316 tensor::getMixedSizes(rewriter, loc, packOp.getDest());
319 loc, /*source=*/padOp, /*dest=*/packOp.getDest(),
324 rewriter.replaceOp(packOp, insertSliceOp->getResults());
342 loc, reshapeOp.getResult(), packOp.getDest(), transpPerm);
349 // 7. Replace packOp by transposeOp.
350 rewriter.replaceOp(packOp, transposeOp->getResults());
677 linalg::packTranspose(RewriterBase &rewriter, tensor::PackOp packOp,
683 // Step 1. Transpose packOp.
684 rewriter.setInsertionPoint(packOp);
686 packOp.createTransposedClone(rewriter, loc, innerPerm, outerPerm);
688 if (!packOp.getResult().hasOneUse())
691 OpOperand &packUse = *packOp->getUses().begin();
706 int64_t numLeadingDims = packOp.getSourceRank();
707 int64_t numTrailingDims = packOp.getInnerDimsPos().size();
748 // Step 4. Finally, replace packOp now that we don't need it anymore.
749 rewriter.replaceOp(packOp, transposedPackOp->getResults());
1022 /// with the output shape matching the output of `packOp`. Otherwise, returns
1027 tensor::PackOp packOp) {
1028 Value input = packOp.getSource();
1029 if (!packOp.getPaddingValue()) {
1033 assert(llvm::all_of(packOp.getAllOuterDims(),
1037 Location loc = packOp.getLoc();
1038 ShapedType inputType = packOp.getSourceType();
1042 packOp.getDimAndTileMapping();
1080 return tensor::createPadHighOp(resultType, input, packOp.getPaddingValue(),
1144 tensor::PackOp packOp, PatternRewriter &rewriter) const {
1147 if (llvm::any_of(packOp.getAllOuterDims(),
1150 packOp, "not all outer dimensions of the result are 1s");
1155 Location loc = packOp.getLoc();
1157 Value input = getPackOpSourceOrPaddedSource(rewriter, packOp);
1159 packOp.getDimAndTileMapping();
1160 int64_t srcRank = packOp.getSourceRank();
1161 int64_t destRank = packOp.getDestRank();
1164 if (!llvm::all_of(packOp.getInnerDimsPos(),
1169 packOp, "Attempting to tile non-trailing source dims!");
1194 getPackUnpackNormalizedPerm(srcRank, packOp.getInnerDimsPos());
1199 srcPermForTranspose.append(SmallVector<int64_t>(packOp.getInnerDimsPos()));
1201 LLVM_DEBUG(DBGS() << "Pack permutation: " << packOp << "\n";
1213 loc, transShapeForEmptyOp, packOp.getSourceType().getElementType());
1228 for (auto tileSize : packOp.getMixedTiles()) {
1235 // 4. Replace tensor.packOp with tensor.insert_slice created above
1237 loc, transposedOp.getResult()[0], packOp.getDest(), writeOffsets,
1239 rewriter.replaceOp(packOp, insert.getResult());