@@ -52,7 +52,8 @@ isl::Map<Domain, Range> removeRangeStrides(
52
52
TC_CHECK_EQ (strides.size (), offsets.size ());
53
53
54
54
auto space = relation.get_space ();
55
- auto stridesMA = isl::MultiAff<Range, Range>::identity (space.range ().map_from_set ());
55
+ auto stridesMA =
56
+ isl::MultiAff<Range, Range>::identity (space.range ().map_from_set ());
56
57
stridesMA = stridesMA / strides;
57
58
58
59
return relation.sum (offsets.neg ().asMap ()).apply_range (stridesMA.asMap ());
@@ -63,8 +64,10 @@ isl::Map<Domain, Range> removeRangeStrides(
63
64
// If the range has strides, remove them first.
64
65
ScopedFootprint outputRanges (isl::Map<Scope, Tensor> access) {
65
66
ScopedFootprint footprint;
66
- footprint.strideValues = isl::MultiVal<Tensor>::zero (access.get_space ().range ());
67
- footprint.strideOffsets = isl::MultiAff<Scope, Tensor>::zero (access.get_space ());
67
+ footprint.strideValues =
68
+ isl::MultiVal<Tensor>::zero (access.get_space ().range ());
69
+ footprint.strideOffsets =
70
+ isl::MultiAff<Scope, Tensor>::zero (access.get_space ());
68
71
69
72
int nSubscripts = footprint.strideValues .size ();
70
73
for (int i = 0 ; i < nSubscripts; ++i) {
@@ -159,8 +162,8 @@ isl::Set<Tensor> TensorReferenceGroup::promotedFootprint() const {
159
162
for (size_t i = 0 , e = sizes.size (); i < e; ++i) {
160
163
auto aff = identity.get_aff (i);
161
164
auto size = sizes.get_val (i);
162
- footprint =
163
- footprint & aff. asPwAff (). nonneg_set () & (size - aff).asPwAff ().pos_set ();
165
+ footprint = footprint & aff. asPwAff (). nonneg_set () &
166
+ (size - aff).asPwAff ().pos_set ();
164
167
}
165
168
return footprint;
166
169
}
@@ -181,8 +184,8 @@ isl::Map<Scope, Tensor> referenceScopedAccessesImpl(
181
184
if (group.references .size () == 0 ) {
182
185
throw promotion::GroupingError (" no references in the group" );
183
186
}
184
- auto accesses =
185
- isl::Map<Scope, Tensor>:: empty ( group.references .front ()->scopedAccess .get_space ());
187
+ auto accesses = isl::Map<Scope, Tensor>:: empty (
188
+ group.references .front ()->scopedAccess .get_space ());
186
189
187
190
for (const auto & ref : group.references ) {
188
191
if (ref->type != type) {
@@ -369,22 +372,25 @@ TensorGroups TensorReferenceGroup::accessedWithin(
369
372
// elements of the promoted array get assigned different values of the original
370
373
// array in different outer loop iterations; it's impossible to project out the
371
374
// outer schedule dimensions.
372
- isl::multi_aff TensorReferenceGroup::promotion () const {
375
+ isl::MultiAff<isl::Pair<Scope, Tensor>, Tensor>
376
+ TensorReferenceGroup::promotion () const {
373
377
// access space is S -> O
374
378
auto map = scopedAccesses ();
375
379
auto accessSpace = map.get_space ();
376
380
377
381
// Construct a projection multi-aff in [S -> O] -> S
378
382
// for further precomposition.
379
- auto originalSpaceInserter = isl::MultiAff<isl::Pair<Scope, Tensor>, Scope>::domain_map (accessSpace);
383
+ auto originalSpaceInserter =
384
+ isl::MultiAff<isl::Pair<Scope, Tensor>, Scope>::domain_map (accessSpace);
380
385
381
386
// Lower bounds and offsets space is S -> O; transform into [S -> O] -> O.
382
- isl::multi_aff lowerBounds =
387
+ auto lowerBounds =
383
388
approximation.lowerBounds ().pullback (originalSpaceInserter);
384
- isl::multi_aff offsets = approximation.strideOffsets .pullback (originalSpaceInserter);
389
+ auto offsets = approximation.strideOffsets .pullback (originalSpaceInserter);
385
390
386
391
// Create promotion starting by identity in [S -> O] -> O.
387
- auto original = isl::multi_aff::range_map (accessSpace);
392
+ auto original =
393
+ isl::MultiAff<isl::Pair<Scope, Tensor>, Tensor>::range_map (accessSpace);
388
394
auto promotion =
389
395
(original - offsets) / approximation.strideValues - lowerBounds;
390
396
@@ -416,7 +422,8 @@ isl::Set<Tensor> tensorElementsSet(const Scop& scop, isl::id tensorId) {
416
422
auto tensorSpace = tensorTuple.get_space ();
417
423
418
424
auto tensorElements = isl::Set<Tensor>::universe (tensorSpace);
419
- auto identity = isl::MultiAff<Tensor,Tensor>::identity (tensorSpace.map_from_set ());
425
+ auto identity =
426
+ isl::MultiAff<Tensor, Tensor>::identity (tensorSpace.map_from_set ());
420
427
for (int i = 0 ; i < nDim; ++i) {
421
428
auto minAff = halide2isl::makeIslAffFromExpr (
422
429
space, halideParameter.min_constraint (i));
@@ -508,7 +515,8 @@ ScheduleTree* insertCopiesUnder(
508
515
// control flow, but we should only write back elements that are actually
509
516
// written to. In any case, intersect the footprint with the set of existing
510
517
// tensor elements.
511
- auto promotedFootprint = group.promotedFootprint ().set_tuple_id <Promoted>(groupId);
518
+ auto promotedFootprint =
519
+ group.promotedFootprint ().set_tuple_id <Promoted>(groupId);
512
520
auto scheduleUniverse =
513
521
isl::set::universe (promotionSpace.domain ().unwrap ().domain ());
514
522
auto arrayId = promotionSpace.domain ().unwrap ().get_map_range_tuple_id ();
@@ -517,9 +525,10 @@ ScheduleTree* insertCopiesUnder(
517
525
approximatedRead = approximatedRead.product (promotedFootprint);
518
526
auto readExtension =
519
527
extension.intersect_range (approximatedRead).set_range_tuple_id (readId);
520
- auto writtenElements =
521
- group.scopedWrites ().intersect_range (tensorElements).wrap ()
522
- .product (promotedFootprint);
528
+ auto writtenElements = group.scopedWrites ()
529
+ .intersect_range (tensorElements)
530
+ .wrap ()
531
+ .product (promotedFootprint);
523
532
auto writeExtension =
524
533
extension.intersect_range (writtenElements).set_range_tuple_id (writeId);
525
534
0 commit comments