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

Commit 6440b03

Browse files
author
Sven Verdoolaege
committed
accessSubscriptsAreUnrolledLoops: use templated isl types
1 parent 4b8db9f commit 6440b03

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

tc/core/polyhedral/cuda/memory_promotion_heuristic.cc

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,12 @@ isl::UnionSet<Statement> collectMappingsTo(const Scop& scop) {
296296
* different references may have different values, but all of them remain
297297
* independent of non-unrolled loop iterators.
298298
*/
299+
template <typename Outer>
299300
bool accessSubscriptsAreUnrolledLoops(
300301
const TensorReferenceGroup& group,
301302
const detail::ScheduleTree* root,
302303
const detail::ScheduleTree* scope,
303-
isl::multi_union_pw_aff outerSchedule) {
304+
isl::MultiUnionPwAff<Statement, Outer> outerSchedule) {
304305
using namespace detail;
305306

306307
auto nodes = ScheduleTree::collect(scope);
@@ -315,16 +316,16 @@ bool accessSubscriptsAreUnrolledLoops(
315316
for (auto leaf : leaves) {
316317
auto ancestors = leaf->ancestors(root);
317318
ancestors.push_back(leaf);
318-
isl::union_set subdomain = activeDomainPointsBelow(root, leaf);
319+
auto subdomain = activeDomainPointsBelow(root, leaf);
319320

320-
auto unrolledDims = isl::union_pw_aff_list(leaf->ctx_, 1);
321+
auto unrolledDims = isl::UnionPwAffListOn<Statement>(leaf->ctx_, 1);
321322
for (auto node : ancestors) {
322-
auto band = node->as<detail::ScheduleTreeBand>();
323+
auto band = node->template as<detail::ScheduleTreeBand>();
323324
if (!band) {
324325
continue;
325326
}
326327

327-
isl::multi_union_pw_aff schedule = band->mupa_;
328+
auto schedule = band->mupa_;
328329
schedule = schedule.intersect_domain(subdomain);
329330
for (size_t i = 0, e = band->nMember(); i < e; ++i) {
330331
if (!band->unroll_[i]) {
@@ -334,21 +335,23 @@ bool accessSubscriptsAreUnrolledLoops(
334335
}
335336
}
336337

337-
auto space =
338-
subdomain.get_space().add_unnamed_tuple_ui(unrolledDims.size());
339-
auto unrolledDimsMupa = isl::multi_union_pw_aff(space, unrolledDims);
338+
auto space = subdomain.get_space().template add_unnamed_tuple_ui<Unrolled>(
339+
unrolledDims.size());
340+
auto unrolledDimsMupa =
341+
isl::MultiUnionPwAff<Statement, Unrolled>(space, unrolledDims);
340342

341343
// It is possible that no loops are unrolled, in which case
342344
// unrolledDimsMupa is zero-dimensional and needs an explicit domain
343345
// to be convertible to a union_map.
344346
unrolledDimsMupa =
345347
unrolledDimsMupa.intersect_domain(group.originalAccesses().domain());
346348

347-
isl::union_map accesses = group.originalAccesses();
348-
auto schedule = outerSchedule.flat_range_product(unrolledDimsMupa);
349-
accesses = accesses.apply_domain(isl::union_map::from(schedule));
349+
auto accesses = group.originalAccesses();
350+
auto schedule = outerSchedule.range_product(unrolledDimsMupa);
351+
auto scheduleMap = schedule.toUnionMap();
352+
auto scheduledAccesses = accesses.apply_domain(scheduleMap);
350353

351-
if (!accesses.is_single_valued()) {
354+
if (!scheduledAccesses.is_single_valued()) {
352355
return false;
353356
}
354357
}

tc/core/polyhedral/domain_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ struct Statement;
1010
struct Tag;
1111
struct Tensor;
1212
struct Thread;
13+
struct Unrolled;
1314
struct Warp;
1415

1516
} // namespace polyhedral

0 commit comments

Comments
 (0)