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

Commit f716c7e

Browse files
committed
bandsContainingScheduleDepth: support depth 0
Technically, the first band in each subtree contains depth 0. However, the check currently implemented in bandsContainingScheduleDepth expects the depth before the given band to be strictly less than the given depth. Furthermore, the subsequent uses of this function will attempt to split the resulting bands so that the required depth corresponds to the last member of the band. It is impossible to split off all band members. The result the callers of bandsContainingScheduleDepth followed by splitting expect is a band with zero members to be used as a promotion scope. Add a special case to bandsContainingScheduleDepth that introduces such zero-dimensional band below the domain node (or the context node immediately following the domain) and returns it. Subsequent band splitting will detect that zero-depth is reached at the end of the newly introduced band and will stop there.
1 parent 0893236 commit f716c7e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tc/core/polyhedral/cuda/memory_promotion_heuristic.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,14 +437,20 @@ bool isPromotableToRegistersBelow(
437437
}
438438

439439
/*
440-
* Starting from the root, find bands where depth is reached. Using
440+
* Starting from the root, find bands where depth is reached. If zero depth is
441+
* requested, insert a zero-dimensional band node below the root (or the
442+
* context node if present) and return it. Otherwise, use
441443
* DFSPreorder to make sure order is specified and consistent for tests.
442444
*/
443445
std::vector<detail::ScheduleTree*> bandsContainingScheduleDepth(
444446
detail::ScheduleTree* root,
445447
size_t depth) {
446448
using namespace tc::polyhedral::detail;
447449

450+
if (depth == 0) {
451+
return {insertTopLevelEmptyBand(root)};
452+
}
453+
448454
auto bands =
449455
ScheduleTree::collectDFSPreorder(root, detail::ScheduleTreeType::Band);
450456
std::function<bool(ScheduleTree * st)> containsDepth = [&](ScheduleTree* st) {

0 commit comments

Comments
 (0)