Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 806e3b0

Browse files
author
Sven Verdoolaege
committed
halide2isl::makeScheduleTree: drop explicit flattening of blocks
isl::schedule::sequence already takes care of the flattening of sequences.
1 parent 653ecbb commit 806e3b0

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

src/core/halide2isl.cc

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -403,32 +403,18 @@ isl::schedule makeScheduleTreeHelper(
403403

404404
schedule = body.insert_partial_schedule(mupa);
405405
} else if (auto op = s.as<Halide::Internal::Block>()) {
406-
// Flatten a nested block. Halide Block statements always nest
407-
// rightwards. Flattening it is not strictly necessary, but it
408-
// keeps things uniform with the PET lowering path.
409406
std::vector<Stmt> stmts;
410407
stmts.push_back(op->first);
411408
stmts.push_back(op->rest);
412-
while (const Halide::Internal::Block* b =
413-
stmts.back().as<Halide::Internal::Block>()) {
414-
Stmt f = b->first;
415-
Stmt r = b->rest;
416-
stmts.pop_back();
417-
stmts.push_back(f);
418-
stmts.push_back(r);
419-
}
420409

421-
// Build a schedule tree for each member of the block and
422-
// collect them in a sequence.
410+
// Build a schedule tree for both members of the block and
411+
// combine them in a sequence.
412+
std::vector<isl::schedule> schedules;
423413
for (Stmt s : stmts) {
424-
auto mem = makeScheduleTreeHelper(
425-
s, set, outer, reads, writes, accesses, statements, iterators);
426-
if (schedule) {
427-
schedule = schedule.sequence(mem);
428-
} else {
429-
schedule = mem;
430-
}
414+
schedules.push_back(makeScheduleTreeHelper(
415+
s, set, outer, reads, writes, accesses, statements, iterators));
431416
}
417+
schedule = schedules[0].sequence(schedules[1]);
432418

433419
} else if (auto op = s.as<Provide>()) {
434420
// Make an ID for this leaf statement. This *is* semantically

0 commit comments

Comments
 (0)