diff options
| author | Andy Davis <andydavis@google.com> | 2019-11-11 10:32:52 -0800 |
|---|---|---|
| committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-11-11 10:33:27 -0800 |
| commit | 5cf6e0ce7f03f9841675b1a9d44232540f3df5cc (patch) | |
| tree | ff2fd4639568dc7bdc4fa91132397c154a5e7d8d /mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp | |
| parent | e04d4bf865b01ec35ecfb98b34372a1dacd70266 (diff) | |
| download | bcm5719-llvm-5cf6e0ce7f03f9841675b1a9d44232540f3df5cc.tar.gz bcm5719-llvm-5cf6e0ce7f03f9841675b1a9d44232540f3df5cc.zip | |
Adds std.subview operation which takes dynamic offsets, sizes and strides and returns a memref type which represents sub/reduced-size view of its memref argument.
This operation is a companion operation to the std.view operation added as proposed in "Updates to the MLIR MemRefType" RFC.
PiperOrigin-RevId: 279766410
Diffstat (limited to 'mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp')
| -rw-r--r-- | mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp index c1d9755f4df..b7a5740a387 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp @@ -65,7 +65,7 @@ static bool isZero(Value *v) { // avoiding affine map manipulations. // The returned ranges correspond to the loop ranges, in the proper order, that // are tiled and for which new loops will be created. -static SmallVector<SubViewOp::Range, 4> +static SmallVector<mlir::linalg::SubViewOp::Range, 4> makeTiledLoopRanges(OpBuilder &b, Location loc, AffineMap map, ArrayRef<Value *> allViewSizes, ArrayRef<Value *> allTileSizes, OperationFolder *folder) { @@ -83,10 +83,10 @@ makeTiledLoopRanges(OpBuilder &b, Location loc, AffineMap map, } // Create a new range with the applied tile sizes. - SmallVector<SubViewOp::Range, 4> res; + SmallVector<mlir::linalg::SubViewOp::Range, 4> res; for (unsigned idx = 0, e = tileSizes.size(); idx < e; ++idx) { - res.push_back(SubViewOp::Range{constant_index(folder, 0), viewSizes[idx], - tileSizes[idx]}); + res.push_back(mlir::linalg::SubViewOp::Range{ + constant_index(folder, 0), viewSizes[idx], tileSizes[idx]}); } return res; } @@ -182,13 +182,13 @@ makeTiledViews(OpBuilder &b, Location loc, LinalgOp linalgOp, } // Construct a new subview for the tile. - SmallVector<SubViewOp::Range, 4> subViewRangeOperands; + SmallVector<mlir::linalg::SubViewOp::Range, 4> subViewRangeOperands; subViewRangeOperands.reserve(rank * 3); for (unsigned r = 0; r < rank; ++r) { if (!isTiled(map.getSubMap({r}), tileSizes)) { - subViewRangeOperands.push_back( - SubViewOp::Range{constant_index(folder, 0), dim(view, r), - constant_index(folder, 1)}); + subViewRangeOperands.push_back(mlir::linalg::SubViewOp::Range{ + constant_index(folder, 0), dim(view, r), + constant_index(folder, 1)}); continue; } @@ -198,7 +198,7 @@ makeTiledViews(OpBuilder &b, Location loc, LinalgOp linalgOp, // Tiling creates a new slice at the proper index, the slice step is 1 // (i.e. the slice view does not subsample, stepping occurs in the loop). subViewRangeOperands.push_back( - SubViewOp::Range{min, max, constant_index(folder, 1)}); + mlir::linalg::SubViewOp::Range{min, max, constant_index(folder, 1)}); } SmallVector<Value *, 12> subViewOperands; subViewOperands.reserve(subViewRangeOperands.size() * 3); @@ -207,7 +207,8 @@ makeTiledViews(OpBuilder &b, Location loc, LinalgOp linalgOp, subViewOperands.push_back(r.max); subViewOperands.push_back(r.step); } - res.push_back(b.create<SubViewOp>(loc, view, subViewOperands)); + res.push_back( + b.create<mlir::linalg::SubViewOp>(loc, view, subViewOperands)); } // Traverse the mins/maxes and erase those that don't have uses left. |

