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

Commit 8bc7735

Browse files
committed
fixThreadsBelowFilter: fix domain used for threadIdxxScheduleDepth
threadIdxxScheduleDepthState is the mapping from active domain points to the schedule depth of the band member mapped to thread x. Since the mapping happens below the given node in fixThreadsBelowFilter, we need to use domain points active in a child of the given node rather than in the given node itself (especially the given node being a filter). Note that the same domain points are active in all children of a node as only ancestor filters are taken into account. Take active domain points of the first child of the given node instead of the node itself. Without this change, threadIdxxScheduleDepthState could have multiple entries for partially overlapping domains, potentially with different values of depth. However, memory promotion code assumes the depth must be the same. Furthermore, having different depths considered as mapped to thread x for the same statement instance is incorrect with respect to the parallel execution model.
1 parent cd6f059 commit 8bc7735

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/core/polyhedral/mapped_scop.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,11 @@ void fixThreadsBelowFilter(
176176

177177
for (size_t i = begin; i < end; ++i) {
178178
if (mapping::ThreadId::makeId(i) == mapping::ThreadId::x()) {
179+
// Mapping happend below filterTree, so we need points active for its
180+
// children. After insertion, filterTree is guaranteed to have at least
181+
// one child.
179182
mscop.threadIdxxScheduleDepthState.emplace_back(std::make_pair(
180-
activeDomainPoints(mscop.schedule(), filterTree),
183+
activeDomainPoints(mscop.schedule(), filterTree->child({0})),
181184
filterTree->scheduleDepth(mscop.schedule())));
182185
}
183186
}

0 commit comments

Comments
 (0)