From 247a1a55eb6a58199006565d594c6f6c6b58b736 Mon Sep 17 00:00:00 2001 From: Tobias Gysi Date: Mon, 22 Nov 2021 13:15:06 +0000 Subject: [PATCH] [mlir][linalg] Use getAsOpFoldResult in padding (NFC). After padding, we introduce a ExtractSliceOp to get the final unpadded result. This revision uses getAsOpFoldResult to compute the size of the unpadded result, which guarantees the result type has a partially static shape if some of the sizes of the unpadded result are statically known. At the moment, we rely on canonicalization to cleanup the types after padding. Depends On D114085 Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D114153 --- mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp b/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp index 2007335..05bf250 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp @@ -254,7 +254,7 @@ linalg::rewriteAsPaddedOp(OpBuilder &b, LinalgOp opToPad, SmallVector offsets(rank, b.getIndexAttr(0)); SmallVector sizes; for (Value v : reifiedResultShapes[resultNumber]) - sizes.push_back(v); + sizes.push_back(getAsOpFoldResult(v)); SmallVector strides(rank, b.getIndexAttr(1)); paddedSubviewResults.push_back(b.create( loc, paddedResult, offsets, sizes, strides)); -- 2.7.4