[Mlir-commits] [mlir] 247a1a5 - [mlir][linalg] Use getAsOpFoldResult in padding (NFC).

Tobias Gysi llvmlistbot at llvm.org
Mon Nov 22 05:26:39 PST 2021


Author: Tobias Gysi
Date: 2021-11-22T13:15:19Z
New Revision: 247a1a55eb6a58199006565d594c6f6c6b58b736

URL: https://github.com/llvm/llvm-project/commit/247a1a55eb6a58199006565d594c6f6c6b58b736
DIFF: https://github.com/llvm/llvm-project/commit/247a1a55eb6a58199006565d594c6f6c6b58b736.diff

LOG: [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

Added: 
    

Modified: 
    mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp b/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
index 20073359a68a..05bf250571b8 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<OpFoldResult> offsets(rank, b.getIndexAttr(0));
     SmallVector<OpFoldResult> sizes;
     for (Value v : reifiedResultShapes[resultNumber])
-      sizes.push_back(v);
+      sizes.push_back(getAsOpFoldResult(v));
     SmallVector<OpFoldResult> strides(rank, b.getIndexAttr(1));
     paddedSubviewResults.push_back(b.create<tensor::ExtractSliceOp>(
         loc, paddedResult, offsets, sizes, strides));


        


More information about the Mlir-commits mailing list