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

Commit 1d3d270

Browse files
author
Sven Verdoolaege
committed
[RFC] use templated isl types isSingleReductionWithin
Templated isl types require the user to specify the domain and range universes of isl objects, allowing the compiler to check whether it makes sense to combine pairs of objects. This RFC only converts isPromotableToRegistersBelow and some related functions to illustrate the effect. The isPromotableToRegistersBelow was already applying operations correctly, so the code itself did not require any changes. However, one variable was reused to store different types of intermediate result and this one had to be split up into several variables because they now have different types.
1 parent bd46983 commit 1d3d270

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

tc/core/polyhedral/cuda/mapped_scop.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ bool MappedScop::detectReductions(ScheduleTree* tree) {
285285
// a single reduction for now.
286286
// Support for multiple reductions would require a check
287287
// that these reductions do not interfere with each other.
288-
auto domain = band->mupa_.domain();
288+
auto domain = isl::UnionSet<Statement>(band->mupa_.domain());
289289
auto updates = reductionUpdates(domain, scop());
290290
if (updates.n_set() != 1) {
291291
return false;

tc/core/polyhedral/schedule_tree_matcher-inl.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,14 @@ inline std::vector<const detail::ScheduleTree*> match(
291291
return matchDFSPreorder(matcher, tree);
292292
}
293293

294+
template <typename Prefix>
294295
inline bool isSingleReductionWithin(
295-
isl::union_set domain,
296-
isl::multi_union_pw_aff prefix,
296+
isl::UnionSet<Statement> domain,
297+
isl::MultiUnionPwAff<Statement, Prefix> prefix,
297298
const Scop& scop) {
298299
auto reductions = scop.body.reductions;
299300
reductions = reductions.intersect_domain(domain);
300-
auto prefixMap = isl::union_map::from(prefix);
301+
auto prefixMap = prefix.toUnionMap();
301302
auto prefixToReduction = reductions.apply_domain(prefixMap);
302303
return prefixToReduction.is_single_valued();
303304
}

tc/core/polyhedral/schedule_tree_matcher.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ isl::UnionSet<Statement> reductionUpdates(isl::union_set domain, const Scop& sco
3434
// In particular, do the elements of "domain" access a single tensor
3535
// element within "prefix"?
3636
bool isSingleReductionWithin(
37-
isl::union_set domain,
38-
isl::multi_union_pw_aff prefix,
37+
isl::UnionSet<Statement> domain,
38+
isl::MultiUnionPwAff<Statement, Prefix> prefix,
3939
const Scop& scop);
4040

4141
} // namespace polyhedral

0 commit comments

Comments
 (0)