[Mlir-commits] [mlir] 3c982a6 - [mlir] Add helpers to set lbs, ubs, steps for linalg.tiled_loop.
Alexander Belyaev
llvmlistbot at llvm.org
Thu Apr 15 11:45:01 PDT 2021
Author: Alexander Belyaev
Date: 2021-04-15T20:44:38+02:00
New Revision: 3c982a6e54cf5d473af87ee22a4b5f576240366d
URL: https://github.com/llvm/llvm-project/commit/3c982a6e54cf5d473af87ee22a4b5f576240366d
DIFF: https://github.com/llvm/llvm-project/commit/3c982a6e54cf5d473af87ee22a4b5f576240366d.diff
LOG: [mlir] Add helpers to set lbs, ubs, steps for linalg.tiled_loop.
Differential Revision: https://reviews.llvm.org/D100579
Added:
Modified:
mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
index 931eada61ac4..ca4488d2f20a 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
@@ -591,6 +591,31 @@ def Linalg_TiledLoopOp : Linalg_Op<"tiled_loop", [
return getBody()->getArguments();
}
+
+ void setLowerBounds(ValueRange lowerBounds) {
+ unsigned numLoops = getNumLoops();
+ assert(lowerBounds.size() == numLoops &&
+ "expected lower bounds for every loop dimension");
+ for (unsigned i = 0; i < numLoops; ++i)
+ setOperand(i, lowerBounds[i]);
+ }
+
+ void setUpperBounds(ValueRange upperBounds) {
+ unsigned numLoops = getNumLoops();
+ assert(upperBounds.size() == numLoops &&
+ "expected upper bounds for every loop dimension");
+ for (unsigned i = 0, pos = numLoops; i < numLoops; ++i, ++pos)
+ setOperand(pos, upperBounds[i]);
+ }
+
+ void setSteps(ValueRange steps) {
+ unsigned numLoops = getNumLoops();
+ assert(steps.size() == numLoops &&
+ "expected upper bounds for every loop dimension");
+ for (unsigned i = 0, pos = 2 * numLoops; i < numLoops; ++i, ++pos)
+ setOperand(pos, steps[i]);
+ }
+
/// Result that corresponds to the `outputs` argument of tensor type.
OpResult getTiedOpResult(OpOperand& opOperand) {
// No result can correspond to a memref argument.
More information about the Mlir-commits
mailing list