diff options
| author | Alex Zinenko <zinenko@google.com> | 2019-02-20 06:54:36 -0800 |
|---|---|---|
| committer | jpienaar <jpienaar@google.com> | 2019-03-29 16:33:56 -0700 |
| commit | d055a4e100dfd8019bd232f6fc79b4d8b97b4ce3 (patch) | |
| tree | 5b035aabc0e5ce9d58e67e7f4cc8b086fb4ca11c /mlir/include/mlir-c | |
| parent | a2a433652de4c07a9474274c345dbc5f28c83f96 (diff) | |
| download | bcm5719-llvm-d055a4e100dfd8019bd232f6fc79b4d8b97b4ce3.tar.gz bcm5719-llvm-d055a4e100dfd8019bd232f6fc79b4d8b97b4ce3.zip | |
EDSC: support multi-expression loop bounds
MLIR supports 'for' loops with lower(upper) bound defined by taking a
maximum(minimum) of a list of expressions, but does not have first-class affine
constructs for the maximum(minimum). All these expressions must have affine
provenance, similarly to a single-expression bound. Add support for
constructing such loops using EDSC. The expression factory function is called
`edsc::MaxMinFor` to (1) highlight that the maximum(minimum) operation is
applied to the lower(upper) bound expressions and (2) differentiate it from a
`edsc::For` that creates multiple perfectly nested loops (and should arguably
be called `edsc::ForNest`).
PiperOrigin-RevId: 234785996
Diffstat (limited to 'mlir/include/mlir-c')
| -rw-r--r-- | mlir/include/mlir-c/Core.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/mlir/include/mlir-c/Core.h b/mlir/include/mlir-c/Core.h index c8967860f47..8505cdc0ae6 100644 --- a/mlir/include/mlir-c/Core.h +++ b/mlir/include/mlir-c/Core.h @@ -227,17 +227,24 @@ edsc_stmt_t Return(edsc_expr_list_t values); /// given list of statements. Block arguments are not currently supported. edsc_block_t Block(edsc_stmt_list_t enclosedStmts); -/// Returns an opaque statement for an mlir::ForInst with `enclosedStmts` nested -/// below it. +/// Returns an opaque statement for an mlir::AffineForOp with `enclosedStmts` +/// nested below it. edsc_stmt_t For(edsc_expr_t iv, edsc_expr_t lb, edsc_expr_t ub, edsc_expr_t step, edsc_stmt_list_t enclosedStmts); -/// Returns an opaque statement for a perfectly nested set of mlir::ForInst with -/// `enclosedStmts` nested below it. +/// Returns an opaque statement for a perfectly nested set of mlir::AffineForOp +/// with `enclosedStmts` nested below it. edsc_stmt_t ForNest(edsc_expr_list_t iv, edsc_expr_list_t lb, edsc_expr_list_t ub, edsc_expr_list_t step, edsc_stmt_list_t enclosedStmts); +/// Returns an opaque statement for an mlir::AffineForOp with the lower bound +/// `max(lbs)` and the upper bound `min(ubs)`, and with `enclosedStmts` nested +/// below it. +edsc_stmt_t MaxMinFor(edsc_expr_t iv, edsc_expr_list_t lbs, + edsc_expr_list_t ubs, edsc_expr_t step, + edsc_stmt_list_t enclosedStmts); + /// Returns an opaque expression for the corresponding Binary operation. edsc_expr_t Add(edsc_expr_t e1, edsc_expr_t e2); edsc_expr_t Sub(edsc_expr_t e1, edsc_expr_t e2); |

