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

Commit 0b3446d

Browse files
author
Sven Verdoolaege
committed
TensorReferenceGroup::approximateScopedAccesses: use templated isl types
1 parent 285985f commit 0b3446d

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

tc/core/polyhedral/memory_promotion.cc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,15 @@ std::unique_ptr<TensorReferenceGroup> TensorReferenceGroup::makeSingleton(
114114
return group;
115115
}
116116

117-
isl::map TensorReferenceGroup::approximateScopedAccesses() const {
117+
isl::Map<Scope, Tensor> TensorReferenceGroup::approximateScopedAccesses()
118+
const {
118119
auto scopedDomain = scopedAccesses().domain();
119120
auto space = approximation.box.get_space();
120-
auto accessed = isl::map::universe(space).intersect_domain(scopedDomain);
121+
auto accessed =
122+
isl::Map<Scope, Tensor>::universe(space).intersect_domain(scopedDomain);
121123

122-
auto identity = isl::multi_aff::identity(space.range().map_from_set());
124+
auto identity =
125+
isl::MultiAff<Tensor, Tensor>::identity(space.range().map_from_set());
123126
for (size_t i = 0; i < approximation.dim(); ++i) {
124127
auto offset = approximation.lowerBound(i);
125128
auto stride = approximation.stride(i);
@@ -128,8 +131,8 @@ isl::map TensorReferenceGroup::approximateScopedAccesses() const {
128131
auto rhs = identity.get_aff(i);
129132
auto lowerBound = offset * stride + strideOffset;
130133
auto upperBound = (offset + size) * stride + strideOffset;
131-
auto partial =
132-
(isl::aff_map(lowerBound) <= rhs) & (isl::aff_map(upperBound) > rhs);
134+
auto partial = lowerBound.asPwAff().lt_map((rhs + 1).asPwAff()) &
135+
upperBound.asPwAff().gt_map(rhs.asPwAff());
133136

134137
accessed = accessed & partial;
135138
}
@@ -525,9 +528,9 @@ ScheduleTree* insertCopiesUnder(
525528
auto arrayId = promotionSpace.domain().unwrap().get_map_range_tuple_id();
526529
auto approximatedRead =
527530
group.approximateScopedAccesses().intersect_range(tensorElements).wrap();
528-
approximatedRead = approximatedRead.product(promotedFootprint);
531+
auto product = approximatedRead.product(promotedFootprint);
529532
auto readExtension =
530-
extension.intersect_range(approximatedRead).set_range_tuple_id(readId);
533+
extension.intersect_range(product).set_range_tuple_id(readId);
531534
auto writtenElements = group.scopedWrites()
532535
.intersect_range(tensorElements)
533536
.wrap()

tc/core/polyhedral/memory_promotion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class TensorReferenceGroup {
143143

144144
// Rectangular overapproximation of the set of tensor elements accessed below
145145
// and relative to the scoping point.
146-
isl::map approximateScopedAccesses() const;
146+
isl::Map<Scope, Tensor> approximateScopedAccesses() const;
147147

148148
isl::MultiAff<isl::Pair<Scope, Tensor>, Tensor> promotion() const;
149149
isl::Set<Tensor> promotedFootprint() const;

0 commit comments

Comments
 (0)