[PATCH] D75589: [MLIR][Affine][NFC] Expose expandAffineMap
Frank Laub via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 17:52:13 PST 2020
flaub created this revision.
flaub added reviewers: rriddle, ftynse.
Herald added subscribers: llvm-commits, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar, mehdi_amini.
Herald added a project: LLVM.
Expose expandAffineMap so that it can be used by lowerings defined outside of
MLIR core.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75589
Files:
mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
Index: mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
===================================================================
--- mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
+++ mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
@@ -42,7 +42,8 @@
: builder(builder), dimValues(dimValues), symbolValues(symbolValues),
loc(loc) {}
- template <typename OpTy> Value buildBinaryExpr(AffineBinaryOpExpr expr) {
+ template <typename OpTy>
+ Value buildBinaryExpr(AffineBinaryOpExpr expr) {
auto lhs = visit(expr.getLHS());
auto rhs = visit(expr.getRHS());
if (!lhs || !rhs)
@@ -216,10 +217,10 @@
/// Create a sequence of operations that implement the `affineMap` applied to
/// the given `operands` (as it it were an AffineApplyOp).
-Optional<SmallVector<Value, 8>> static expandAffineMap(OpBuilder &builder,
- Location loc,
- AffineMap affineMap,
- ValueRange operands) {
+Optional<SmallVector<Value, 8>> mlir::expandAffineMap(OpBuilder &builder,
+ Location loc,
+ AffineMap affineMap,
+ ValueRange operands) {
auto numDims = affineMap.getNumDims();
auto expanded = functional::map(
[numDims, &builder, loc, operands](AffineExpr expr) {
Index: mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
===================================================================
--- mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
+++ mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
@@ -14,6 +14,7 @@
namespace mlir {
class AffineExpr;
class AffineForOp;
+class AffineMap;
class Location;
struct LogicalResult;
class MLIRContext;
@@ -30,6 +31,13 @@
Value expandAffineExpr(OpBuilder &builder, Location loc, AffineExpr expr,
ValueRange dimValues, ValueRange symbolValues);
+/// Create a sequence of operations that implement the `affineMap` applied to
+/// the given `operands` (as it it were an AffineApplyOp).
+Optional<SmallVector<Value, 8>> expandAffineMap(OpBuilder &builder,
+ Location loc,
+ AffineMap affineMap,
+ ValueRange operands);
+
/// Collect a set of patterns to convert from the Affine dialect to the Standard
/// dialect, in particular convert structured affine control flow into CFG
/// branch-based control flow.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75589.248078.patch
Type: text/x-patch
Size: 2736 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200304/2274db22/attachment.bin>
More information about the llvm-commits
mailing list