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

Commit 00e96d3

Browse files
author
Sven Verdoolaege
committed
add activeDomainPointsBelow
Since the TC schedule tree representation does not allow pointing to a position below a leaf node, a separate function is needed to obtain the active domain points underneath a given node. This function will be used in the next commit.
1 parent 73d51b0 commit 00e96d3

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

tc/core/polyhedral/schedule_transforms.cc

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,22 @@ isl::union_map partialSchedule(
9999
return partialScheduleImpl(root, node, true);
100100
}
101101

102-
// Get a set of domain elements that are active at the given node.
102+
namespace {
103+
// Get a set of domain elements that are active below
104+
// the given branch of nodes.
103105
//
104106
// Domain elements are introduced by the root domain node. Filter nodes
105107
// disable the points that do not intersect with the filter. Extension nodes
106108
// are considered to introduce additional domain points.
107-
isl::union_set activeDomainPoints(
109+
isl::union_set activeDomainPointsHelper(
108110
const ScheduleTree* root,
109-
const ScheduleTree* node) {
111+
const vector<const ScheduleTree*>& nodes) {
110112
auto domainElem = root->elemAs<ScheduleTreeElemDomain>();
111113
CHECK(domainElem) << "root must be a Domain node" << *root;
112114

113115
auto domain = domainElem->domain_;
114116

115-
for (auto anc : node->ancestors(root)) {
117+
for (auto anc : nodes) {
116118
if (auto filterElem = anc->elemAsBase<ScheduleTreeElemFilter>()) {
117119
domain = domain.intersect(filterElem->filter_);
118120
} else if (auto extensionElem = anc->elemAs<ScheduleTreeElemExtension>()) {
@@ -131,6 +133,21 @@ isl::union_set activeDomainPoints(
131133
}
132134
return domain;
133135
}
136+
} // namespace
137+
138+
isl::union_set activeDomainPoints(
139+
const ScheduleTree* root,
140+
const ScheduleTree* node) {
141+
return activeDomainPointsHelper(root, node->ancestors(root));
142+
}
143+
144+
isl::union_set activeDomainPointsBelow(
145+
const ScheduleTree* root,
146+
const ScheduleTree* node) {
147+
auto ancestors = node->ancestors(root);
148+
ancestors.emplace_back(node);
149+
return activeDomainPointsHelper(root, ancestors);
150+
}
134151

135152
vector<ScheduleTree*> collectScheduleTreesPath(
136153
std::function<ScheduleTree*(ScheduleTree*)> next,

tc/core/polyhedral/schedule_transforms.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,14 @@ isl::union_set activeDomainPoints(
292292
const detail::ScheduleTree* root,
293293
const detail::ScheduleTree* node);
294294

295+
// Get the set of domain points active below the given node. A domain
296+
// point is active if it was not filtered away on the path from the
297+
// root to the node. The root must be a domain element, otherwise no
298+
// elements would be considered active.
299+
isl::union_set activeDomainPointsBelow(
300+
const detail::ScheduleTree* root,
301+
const detail::ScheduleTree* node);
302+
295303
////////////////////////////////////////////////////////////////////////////////
296304
// Experimental
297305
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)