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

Commit 37f1c75

Browse files
author
Sven Verdoolaege
committed
ScheduleTreeElemMappingFilter: only check identifiers once
The original code would loop over all sets in a filter and then over all possible mapping identifiers, performing some check on the identifiers that only need to be performed once. Perform loop interchange to avoid the confusing duplicate checks.
1 parent f9eb39e commit 37f1c75

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

tc/core/polyhedral/schedule_tree_elem.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -152,24 +152,24 @@ struct ScheduleTreeElemMappingFilter : public ScheduleTreeElemFilter {
152152
typename mapping::MappingId::Hash>& ids)
153153
: ScheduleTreeElemFilter(us), mappingIds(ids) {
154154
USING_MAPPING_SHORT_NAMES(BX, BY, BZ, TX, TY, TZ);
155-
for (auto s : us.get_set_list()) {
156-
for (auto id : std::vector<mapping::MappingId>{BX, BY, BZ, TX, TY, TZ}) {
157-
if (mappingIds.count(id) > 0) {
158-
CHECK_EQ(1u, ids.count(id)) << "id: " << id << " mapped >1 times";
155+
for (auto id : std::vector<mapping::MappingId>{BX, BY, BZ, TX, TY, TZ}) {
156+
if (mappingIds.count(id) > 0) {
157+
CHECK_EQ(1u, ids.count(id)) << "id: " << id << " mapped >1 times";
158+
for (auto s : us.get_set_list()) {
159159
CHECK(s.involves_param(id))
160160
<< "unexpected missing id: " << id << " in filter: " << s;
161-
} else {
162-
if (s.involves_param(id)) {
163-
std::stringstream ss;
164-
for (auto id : ids) {
165-
ss << id.to_str() << " ";
166-
}
167-
// TODO: will need to relax this if we map the same loop
168-
// iteratively without stripmining it beforehand
169-
CHECK(false) << "unexpected involved id: " << id
170-
<< " in filter: " << s
171-
<< " but not present in filter id list: " << ss.str();
161+
}
162+
} else {
163+
if (us.involves_param(id)) {
164+
std::stringstream ss;
165+
for (auto id : ids) {
166+
ss << id.to_str() << " ";
172167
}
168+
// TODO: will need to relax this if we map the same loop
169+
// iteratively without stripmining it beforehand
170+
CHECK(false) << "unexpected involved id: " << id
171+
<< " in filter: " << us
172+
<< " but not present in filter id list: " << ss.str();
173173
}
174174
}
175175
}

0 commit comments

Comments
 (0)