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

Commit e70ee93

Browse files
author
Sven Verdoolaege
committed
finish handling of single node schedule trees
Prior to 653ecbb (halide2isl::makeScheduleTree: use isl::schedule for constructing tree, Thu Mar 22 11:32:03 2018 +0100), makeScheduleTree refused to construct a schedule tree that consists of a single (domain) node. Since then, inputs that result in such a tree are handled by makeScheduleTree, but makeScheduleConstraints still assumed that a tree contains at least two nodes. Remove that assumption, allowing TestCornerCases.E4 to be enabled.
1 parent 42d69ca commit e70ee93

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

tc/core/polyhedral/scop.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,18 +332,19 @@ isl::schedule_constraints makeScheduleConstraints(
332332
const Scop& scop,
333333
const SchedulerOptionsView& schedulerOptions,
334334
isl::union_set restrictDomain = isl::union_set()) {
335-
auto firstChildNode = scop.scheduleRoot()->child({0});
336-
337335
auto constraints = isl::schedule_constraints::on_domain(scop.domain())
338336
.set_validity(scop.dependences)
339337
.set_proximity(scop.dependences)
340338
.set_coincidence(scop.dependences);
341339
if (restrictDomain) {
342340
constraints = constraints.intersect_domain(restrictDomain);
343341
}
344-
if (auto contextNode =
345-
firstChildNode->elemAs<detail::ScheduleTreeElemContext>()) {
346-
constraints = constraints.set_context(contextNode->context_);
342+
auto root = scop.scheduleRoot();
343+
if (root->numChildren() > 0) {
344+
if (auto contextNode =
345+
root->child({0})->elemAs<detail::ScheduleTreeElemContext>()) {
346+
constraints = constraints.set_context(contextNode->context_);
347+
}
347348
}
348349

349350
// Set up "add_schedule_constraints" and "merge_callback"

test/cuda/test_corner_cases.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ TEST(TestCornerCases, E2) {
8585
Succeed("def f(float(1) a) -> (b) { b(i) = a(i) }", {F(1)}, {F(1)});
8686
}
8787

88-
// free(): invalid next size (fast): 0x000000003b2d6230 ***
89-
TEST(TestCornerCases, DISABLED_E4) {
88+
// Schedule tree that only consists of domain node
89+
TEST(TestCornerCases, E4) {
9090
Succeed("def f(float a) -> (b) { b = a }", {F()}, {F()});
9191
}
9292

0 commit comments

Comments
 (0)