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

Commit f82779e

Browse files
author
Sven Verdoolaege
committed
inline mapRemaining
By inlining mapRemaining, the filter for the unmapped identifiers can be included in the single mapping filter node, completing the process of creating a single block mapping filter and a single thread mapping filter per branch.
1 parent bff75f5 commit f82779e

File tree

2 files changed

+8
-25
lines changed

2 files changed

+8
-25
lines changed

tc/core/polyhedral/cuda/mapped_scop.cc

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,6 @@ const CudaDim& mappingSize<mapping::ThreadId>(const MappedScop* mscop) {
108108
}
109109
} // namespace
110110

111-
template <typename MappingTypeId>
112-
void MappedScop::mapRemaining(detail::ScheduleTree* tree, size_t nMapped) {
113-
size_t nToMap = mappingSize<MappingTypeId>(this).view.size();
114-
if (nMapped >= nToMap) {
115-
return;
116-
}
117-
118-
std::unordered_set<MappingTypeId, typename MappingTypeId::Hash> ids;
119-
for (size_t i = nMapped; i < nToMap; ++i) {
120-
ids.insert(MappingTypeId::makeId(i));
121-
}
122-
auto root = scop_->scheduleRoot();
123-
auto domain = activeDomainPoints(root, tree);
124-
auto filter = makeFixRemainingZeroFilter(domain, ids);
125-
auto mapping = detail::ScheduleTree::makeMappingFilter(filter, ids);
126-
insertNodeAbove(root, tree, std::move(mapping));
127-
}
128-
129111
// Map the elements in "list" to successive blocks or thread identifiers,
130112
// with the first element mapped to identifier X. The extents are obtained
131113
// from the initial elements of numBlocks or numThreads. The identifiers
@@ -166,10 +148,17 @@ detail::ScheduleTree* MappedScop::map(
166148
idSet.emplace(id);
167149
}
168150

151+
std::unordered_set<MappingTypeId, typename MappingTypeId::Hash> unmapped;
152+
for (size_t i = nToMap; i < extent.size(); ++i) {
153+
auto id = MappingTypeId::makeId(i);
154+
unmapped.emplace(id);
155+
idSet.emplace(id);
156+
}
157+
filter = filter.intersect(makeFixRemainingZeroFilter(domain, unmapped));
158+
169159
auto mapping = detail::ScheduleTree::makeMappingFilter(filter, idSet);
170160
tree = insertNodeAbove(root, tree, std::move(mapping))->child({0});
171161

172-
mapRemaining<MappingTypeId>(tree, nToMap);
173162
return tree;
174163
}
175164

tc/core/polyhedral/cuda/mapped_scop.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ class MappedScop {
9999
// This function can only be called once in any branch of the tree.
100100
detail::ScheduleTree* mapThreadsBackward(detail::ScheduleTree* band);
101101

102-
// Given that "nMapped" identifiers of type "MappingTypeId" have already
103-
// been mapped, map the remaining ones to zero
104-
// for all statement instances.
105-
template <typename MappingTypeId>
106-
void mapRemaining(detail::ScheduleTree* tree, size_t nMapped);
107-
108102
// Fix the values of the specified parameters in the context
109103
// to the corresponding specified values.
110104
template <typename T>

0 commit comments

Comments
 (0)