Tensor Comprehensions
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
schedule_tree-inl.h
Go to the documentation of this file.
1 
16 #pragma once
17 
18 namespace tc {
19 namespace polyhedral {
20 namespace detail {
21 template <typename MappingIdType>
22 inline ScheduleTreeUPtr ScheduleTree::makeMappingFilter(
23  isl::union_set filter,
24  const std::unordered_set<MappingIdType, typename MappingIdType::Hash>&
25  mappingIds,
26  std::vector<ScheduleTreeUPtr>&& children) {
27  // slicing may happen below if not careful
28  std::unordered_set<mapping::MappingId, typename mapping::MappingId::Hash> ids;
29  for (auto id : mappingIds) {
30  CHECK_EQ(1, mappingIds.count(id)) << "id: " << id << " mapped != 1 times";
31  ids.insert(id);
32  }
33  isl::ctx ctx(filter.get_ctx());
34  ScheduleTreeUPtr res(new ScheduleTree(ctx));
35  res->elem_ = std::unique_ptr<ScheduleTreeElemMappingFilter>(
36  new ScheduleTreeElemMappingFilter(filter, ids));
37  res->type_ = ScheduleTreeType::MappingFilter;
38  res->appendChildren(std::move(children));
39  return res;
40 }
41 } // namespace detail
42 } // namespace polyhedral
43 } // namespace tc