[Mlir-commits] [mlir] c141c03 - [mlir] Add materializeOpFoldResults to turn OpFoldResult array into values.
Alexander Belyaev
llvmlistbot at llvm.org
Tue Sep 6 04:38:21 PDT 2022
Author: Alexander Belyaev
Date: 2022-09-06T13:38:05+02:00
New Revision: c141c03fd8c5772a98f506191135526a8b0f0da9
URL: https://github.com/llvm/llvm-project/commit/c141c03fd8c5772a98f506191135526a8b0f0da9
DIFF: https://github.com/llvm/llvm-project/commit/c141c03fd8c5772a98f506191135526a8b0f0da9.diff
LOG: [mlir] Add materializeOpFoldResults to turn OpFoldResult array into values.
Differential Revision: https://reviews.llvm.org/D133346
Added:
Modified:
mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
mlir/lib/Dialect/Linalg/Utils/Utils.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h b/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
index 382e8ce23a201..510eab3553c84 100644
--- a/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
+++ b/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
@@ -193,6 +193,8 @@ Value materializeOpFoldResult(ImplicitLocOpBuilder &builder,
OpFoldResult opFoldResult);
Value materializeOpFoldResult(OpBuilder &b, Location loc,
OpFoldResult opFoldResult);
+Value materializeOpFoldResult(OpBuilder &b, Location loc,
+ ArrayRef<OpFoldResult> opFoldResults);
/// A struct containg offsets-sizes-strides arguments of the tiled shape.
struct SliceParameters {
diff --git a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp
index e8fc5ae2f9df2..19db66a74439b 100644
--- a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp
@@ -946,6 +946,16 @@ Value materializeOpFoldResult(OpBuilder &builder, Location loc,
return materializeOpFoldResult(b, opFoldResult);
}
+SmallVector<Value>
+materializeOpFoldResults(OpBuilder &builder, Location loc,
+ ArrayRef<OpFoldResult> opFoldResults) {
+ ImplicitLocOpBuilder b(loc, builder);
+ SmallVector<Value> values;
+ for (const auto &opFoldResult : opFoldResults)
+ values.push_back(materializeOpFoldResult(b, opFoldResult));
+ return values;
+}
+
SmallVector<Optional<SliceParameters>>
computeAllSliceParameters(OpBuilder &builder, Location loc, LinalgOp linalgOp,
ValueRange valuesToTile, ArrayRef<OpFoldResult> ivs,
More information about the Mlir-commits
mailing list