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

Commit f4f7c6c

Browse files
author
Sven Verdoolaege
committed
use templated isl types removeRangeStrides
1 parent abe1c98 commit f4f7c6c

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

tc/core/polyhedral/memory_promotion.cc

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,27 @@ namespace {
4444
// D -> O: o_i = f(D)
4545
//
4646
// by subtracting "offsets" and by dividing the result by "strides".
47-
isl::map removeRangeStrides(
48-
isl::map relation,
49-
isl::multi_val strides,
50-
isl::multi_aff offsets) {
47+
template <typename Domain, typename Range>
48+
isl::Map<Domain, Range> removeRangeStrides(
49+
isl::Map<Domain, Range> relation,
50+
isl::MultiVal<Range> strides,
51+
isl::MultiAff<Domain, Range> offsets) {
5152
TC_CHECK_EQ(strides.size(), offsets.size());
5253

5354
auto space = relation.get_space();
54-
auto stridesMA = isl::multi_aff::identity(space.range().map_from_set());
55+
auto stridesMA = isl::MultiAff<Range, Range>::identity(space.range().map_from_set());
5556
stridesMA = stridesMA / strides;
5657

57-
return relation.sum(isl::map(offsets.neg())).apply_range(isl::map(stridesMA));
58+
return relation.sum(offsets.neg().asMap()).apply_range(stridesMA.asMap());
5859
}
5960

6061
// Compute a box approximation of the range of the given relation,
6162
// including the lower bounds, the box sizes, and the strides.
6263
// If the range has strides, remove them first.
63-
ScopedFootprint outputRanges(isl::map access) {
64+
ScopedFootprint outputRanges(isl::Map<Scope, Tensor> access) {
6465
ScopedFootprint footprint;
65-
footprint.strideValues = isl::multi_val::zero(access.get_space().range());
66-
footprint.strideOffsets = isl::multi_aff::zero(access.get_space());
66+
footprint.strideValues = isl::MultiVal<Tensor>::zero(access.get_space().range());
67+
footprint.strideOffsets = isl::MultiAff<Scope, Tensor>::zero(access.get_space());
6768

6869
int nSubscripts = footprint.strideValues.size();
6970
for (int i = 0; i < nSubscripts; ++i) {
@@ -370,17 +371,17 @@ TensorGroups TensorReferenceGroup::accessedWithin(
370371
// outer schedule dimensions.
371372
isl::multi_aff TensorReferenceGroup::promotion() const {
372373
// access space is S -> O
373-
isl::map map = scopedAccesses();
374+
auto map = scopedAccesses();
374375
auto accessSpace = map.get_space();
375376

376377
// Construct a projection multi-aff in [S -> O] -> S
377378
// for further precomposition.
378-
auto originalSpaceInserter = isl::multi_aff::domain_map(accessSpace);
379+
auto originalSpaceInserter = isl::MultiAff<isl::Pair<Scope, Tensor>, Scope>::domain_map(accessSpace);
379380

380381
// Lower bounds and offsets space is S -> O; transform into [S -> O] -> O.
381-
auto lowerBounds =
382+
isl::multi_aff lowerBounds =
382383
approximation.lowerBounds().pullback(originalSpaceInserter);
383-
auto offsets = approximation.strideOffsets.pullback(originalSpaceInserter);
384+
isl::multi_aff offsets = approximation.strideOffsets.pullback(originalSpaceInserter);
384385

385386
// Create promotion starting by identity in [S -> O] -> O.
386387
auto original = isl::multi_aff::range_map(accessSpace);

tc/core/polyhedral/memory_promotion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ struct ScopedFootprint {
5959
}
6060

6161
isl::fixed_box box;
62-
isl::multi_val strideValues;
63-
isl::multi_aff strideOffsets;
62+
isl::MultiVal<Tensor> strideValues;
63+
isl::MultiAff<Scope, Tensor> strideOffsets;
6464

6565
isl::multi_aff lowerBounds() const;
6666
};

0 commit comments

Comments
 (0)