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

Commit 0893236

Browse files
committed
introduce insertTopLevelEmptyBand
This function inserts an empty band below the root of the tree or below the top-level context if it is present. It will be used in the following commit.
1 parent 147597a commit 0893236

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

tc/core/polyhedral/schedule_transforms.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,15 @@ ScheduleTree* bandScale(ScheduleTree* tree, const vector<size_t>& scales) {
275275
return tree;
276276
}
277277

278+
ScheduleTree* insertTopLevelEmptyBand(ScheduleTree* root) {
279+
auto node = root;
280+
if (node->numChildren() > 0 &&
281+
node->child({0})->elemAs<detail::ScheduleTreeElemContext>()) {
282+
node = node->child({0});
283+
}
284+
return insertNodeBelow(node, ScheduleTree::makeEmptyBand(root));
285+
}
286+
278287
void updateTopLevelContext(detail::ScheduleTree* root, isl::set context) {
279288
if (!matchOne(tc::polyhedral::domain(tc::polyhedral::context(any())), root)) {
280289
root->appendChild(ScheduleTree::makeContext(

tc/core/polyhedral/schedule_transforms.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ detail::ScheduleTree* bandScale(
102102
detail::ScheduleTree* tree,
103103
const std::vector<size_t>& scales);
104104

105+
// Insert an empty band node below "root" or below the only child of "root" if
106+
// the child is a context node.
107+
detail::ScheduleTree* insertTopLevelEmptyBand(detail::ScheduleTree* root);
108+
105109
// Update the top-level context node by intersecting it with "context". The
106110
// top-level context node must be located directly under the root of the tree.
107111
// If there is no such node, insert one with universe context first.

0 commit comments

Comments
 (0)