[Mlir-commits] [clang-tools-extra] [clang] [mlir] [llvm] [MLIR][Linalg] Support dynamic sizes in `lower_unpack` (PR #75494)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Dec 18 08:23:00 PST 2023


================
@@ -434,8 +429,21 @@ FailureOr<LowerUnPackOpResult> linalg::lowerUnPack(RewriterBase &rewriter,
       RankedTensorType::Builder(packedTensorType).setShape(stripMinedShape);
   RankedTensorType collapsedType = tensor::CollapseShapeOp::inferCollapsedType(
       stripMinedTensorType, packingMetadata.reassociations);
+
+  // Get dynamic dims from input tensor in order of stripMinedTensor
+  // `tensor.empty` op
+  SmallVector<OpFoldResult, 4> dims =
+      tensor::getMixedSizes(rewriter, loc, unPackOp.getSource());
+  applyPermutationToVector(dims, lastDimsToInsertPositionsPerm);
+  SmallVector<Value, 4> dynDims;
----------------
srcarroll wrote:

oh nice. i wasn't aware of this builder. very convenient.

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


More information about the Mlir-commits mailing list