tc/core/polyhedral/cuda/memory_promotion_heuristic.cc
/*
 * Split bands so that the "depth"-th dimension is always the last in some
 * band.  Return such bands.
 */
Split bands so that the "depth"-th dimension is always the last in some
band.  Return such bands.
Split bands so that the " depth " - th dimension is always the last in some band . Return such bands .
std::vector<detail::ScheduleTree*> bandsSplitAfterDepth(
    const std::vector<detail::ScheduleTree*>& bands,
    detail::ScheduleTree* root,
    size_t depth) {
  using namespace tc::polyhedral::detail;
  std::function<ScheduleTree*(ScheduleTree*)> splitAtDepth =
      [&](ScheduleTree* st) {
        auto nMember = st->elemAs<ScheduleTreeElemBand>()->nMember();
        auto scheduleDepth = st->scheduleDepth(root);
        auto depthAfter = scheduleDepth + nMember;
        return depthAfter == depth ? st
                                   : bandSplit(root, st, depth - scheduleDepth);
      };
  return functional::Map(splitAtDepth, bands);
}
std :: vector < detail :: ScheduleTree * > bandsSplitAfterDepth ( const std :: vector < detail :: ScheduleTree * > & bands , detail :: ScheduleTree * root , size_t depth ) { using namespace tc :: polyhedral :: detail ; std :: function < ScheduleTree * ( ScheduleTree * ) > splitAtDepth = [ & ] ( ScheduleTree * st ) { auto nMember = st -> elemAs < ScheduleTreeElemBand > ( ) -> nMember ( ) ; auto scheduleDepth = st -> scheduleDepth ( root ) ; auto depthAfter = scheduleDepth + nMember ; return depthAfter == depth ? st : bandSplit ( root , st , depth - scheduleDepth ) ; } ; return functional :: Map ( splitAtDepth , bands ) ; }
Split bands so that the "depth"-th dimension is always the last in some
 band.
Split bands so that the " depth " - th dimension is always the last in some band .