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

Commit 80fe1d7

Browse files
author
Sven Verdoolaege
committed
[RFC] use templated isl types memberRange
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 b0db598 commit 80fe1d7

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

tc/core/polyhedral/cuda/mapped_scop.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ bool MappedScop::detectReductions(ScheduleTree* tree) {
296296
});
297297
// The outer (coincident) members, together with the prefix schedule,
298298
// need to determine a single reduction.
299-
auto prefix = prefixScheduleMupa(schedule(), tree);
300-
prefix = prefix.range_product(band->memberRange(0, nCoincident));
299+
auto prefix = prefixScheduleMupa<Prefix>(schedule(), tree)
300+
.range_product(band->memberRange<Band>(0, nCoincident));
301301
if (!isSingleReductionWithin(updates, prefix, scop())) {
302302
return false;
303303
}
@@ -331,7 +331,7 @@ isl::multi_union_pw_aff MappedScop::reductionMapSchedule(
331331
TC_CHECK_GE(nMember, reductionDim + 1);
332332

333333
auto first = reductionDim + 1 - nMappedThreads;
334-
return reductionBand->memberRange(first, nMappedThreads);
334+
return reductionBand->memberRange<ReductionSchedule>(first, nMappedThreads);
335335
}
336336

337337
ScheduleTree* MappedScop::separateReduction(ScheduleTree* st) {

tc/core/polyhedral/domain_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace tc {
22
namespace polyhedral {
33

4+
struct Band;
45
struct Prefix;
56
struct Reduction;
67
struct ReductionSchedule;

tc/core/polyhedral/schedule_tree_elem.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "tc/external/isl.h"
2424

2525
#include "tc/core/check.h"
26+
#include "tc/core/polyhedral/domain_types.h"
2627
#include "tc/core/polyhedral/mapping_types.h"
2728
#include "tc/core/polyhedral/schedule_tree.h"
2829

@@ -331,14 +332,15 @@ struct ScheduleTreeBand : public ScheduleTree {
331332

332333
// Extract the range of "n" members starting at "first"
333334
// (in an anonymous space).
334-
isl::multi_union_pw_aff memberRange(size_t first, size_t n) const {
335+
template <typename Range>
336+
isl::MultiUnionPwAff<Statement, Range> memberRange(size_t first, size_t n) const {
335337
auto list = mupa_.get_union_pw_aff_list();
336338
auto space = mupa_.get_space().params().add_unnamed_tuple_ui(n);
337339
auto end = first + n;
338340
TC_CHECK_LE(end, nMember());
339341
list = list.drop(end, nMember() - end);
340342
list = list.drop(0, first);
341-
return isl::multi_union_pw_aff(space, list);
343+
return isl::MultiUnionPwAff<Statement, Range>(isl::multi_union_pw_aff(space, list));
342344
}
343345

344346
public:

0 commit comments

Comments
 (0)