[PATCH] D79688: [mlir] loop::ForOp: provide builders with callbacks for loop body
Uday Bondhugula via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 10 17:33:38 PDT 2020
bondhugula requested changes to this revision.
bondhugula added inline comments.
This revision now requires changes to proceed.
================
Comment at: mlir/include/mlir/Dialect/LoopOps/LoopOps.h:72
+
+/// A convenience version for building loop nests without reductions. Does not
+/// take the initial value of reductions or expect the body building functions
----------------
Did you mean "without iteration arguments (like for reductions)" instead of "without reductions"?
================
Comment at: mlir/lib/Conversion/VectorToLoops/ConvertVectorToLoops.cpp:496
Value vec = vector_type_cast(tmp);
- SmallVector<Value, 8> ivs(lbs.size());
- LoopNestBuilder(ivs, lbs, ubs, steps)([&] {
+ loopNestBuilder(lbs, ubs, steps, [&](ValueRange loopIvs) {
+ auto ivs = llvm::to_vector<8>(loopIvs);
----------------
/*bodyBuilder=*/
================
Comment at: mlir/lib/Conversion/VectorToLoops/ConvertVectorToLoops.cpp:570
std_store(vectorValue, vec);
- SmallVector<Value, 8> ivs(lbs.size());
- LoopNestBuilder(ivs, lbs, ubs, steps)([&] {
+ loopNestBuilder(lbs, ubs, steps, [&](ValueRange loopIvs) {
+ auto ivs = llvm::to_vector<8>(loopIvs);
----------------
/*bodyBuilder=*/
================
Comment at: mlir/lib/Dialect/GPU/Transforms/MemoryPromotion.cpp:82
SmallVector<Value, 8> ivs(lbs.size());
- LoopNestBuilder(ivs, lbs, ubs, steps)([&]() {
+ loopNestBuilder(lbs, ubs, steps, [&](ValueRange loopIvs) {
+ ivs.assign(loopIvs.begin(), loopIvs.end());
----------------
Likewise.
================
Comment at: mlir/lib/Dialect/LoopOps/EDSC/Builders.cpp:152
+ step, iterArgInitValues,
+ [&](OpBuilder &builder, Location loc, ValueRange ivs, ValueRange args) {
+ assert(ivs.size() == 1 && "expected one induction variable");
----------------
Likewise.
================
Comment at: mlir/test/EDSC/builder-api-test.cpp:145
using namespace edsc::op;
- LoopNestBuilder(&i, a - b, c + d, a)();
+ loopNestBuilder(a - b, c + d, a);
----------------
/*lbs=*/..., /*ubs=*/..., /*step=*/...)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79688/new/
https://reviews.llvm.org/D79688
More information about the llvm-commits
mailing list