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

Commit 2a3e7ac

Browse files
author
Sven Verdoolaege
committed
add prefixMappingFilter
This will be used in the next commit.
1 parent 934a4ba commit 2a3e7ac

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

tc/core/polyhedral/schedule_transforms.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@ isl::union_set applyAnyFilter(isl::union_set domain, const ScheduleTree* node) {
112112
return domain;
113113
}
114114

115+
/*
116+
* If "node" is a mapping filter, then intersect "domain" with that filter.
117+
*/
118+
isl::union_set applyMapping(isl::union_set domain, const ScheduleTree* node) {
119+
if (auto filterElem = node->elemAs<ScheduleTreeElemMappingFilter>()) {
120+
return domain.intersect(filterElem->filter_);
121+
}
122+
return domain;
123+
}
124+
115125
// Get the set of domain elements that are active below
116126
// the given branch of nodes, filtered using "filter".
117127
//
@@ -150,6 +160,12 @@ isl::union_set activeDomainPointsHelper(
150160

151161
} // namespace
152162

163+
isl::union_set prefixMappingFilter(
164+
const ScheduleTree* root,
165+
const ScheduleTree* node) {
166+
return collectDomain(root, node->ancestors(root), &applyMapping);
167+
}
168+
153169
isl::union_set activeDomainPoints(
154170
const ScheduleTree* root,
155171
const ScheduleTree* node) {

tc/core/polyhedral/schedule_transforms.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,12 @@ isl::union_set activeDomainPointsNoMappingNoExtension(
335335
const detail::ScheduleTree* root,
336336
const detail::ScheduleTree* tree);
337337

338+
// Collect the outer block/thread identifier mappings
339+
// into a filter on the active domain elements.
340+
isl::union_set prefixMappingFilter(
341+
const detail::ScheduleTree* root,
342+
const detail::ScheduleTree* node);
343+
338344
// Extract a mapping from the domain elements active at "tree" (in a tree
339345
// rooted at "root") to identifiers "ids", where all branches in "tree" are
340346
// assumed to have been mapped to these identifiers. The result lives in a

0 commit comments

Comments
 (0)