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

Commit 8d5fe7e

Browse files
author
Sven Verdoolaege
committed
[RFC] use templated isl types reductionMapSchedule
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 cd0b955 commit 8d5fe7e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tc/core/polyhedral/cuda/mapped_scop.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ bool MappedScop::needReductionSeparation(const ScheduleTree* st) {
319319
return !reductionBandUpdates_.at(st).separated;
320320
}
321321

322-
isl::multi_union_pw_aff MappedScop::reductionMapSchedule(
323-
const ScheduleTree* st) {
322+
isl::MultiUnionPwAff<Statement, ReductionSchedule>
323+
MappedScop::reductionMapSchedule(const ScheduleTree* st) {
324324
TC_CHECK(reductionBandUpdates_.count(st) == 1);
325325
auto reductionBand = st->as<ScheduleTreeBand>();
326326
TC_CHECK(reductionBand);
@@ -342,10 +342,10 @@ ScheduleTree* MappedScop::separateReduction(ScheduleTree* st) {
342342

343343
auto root = scop_->scheduleRoot();
344344
auto domain = activeDomainPoints(root, st);
345-
auto prefixSchedule = prefixScheduleMupa(root, st);
345+
auto prefixSchedule = prefixScheduleMupa<Prefix>(root, st);
346346
auto reductionSchedule = reductionMapSchedule(st);
347347
auto space = reductionSchedule.get_space();
348-
auto size = isl::multi_val::zero(space);
348+
auto size = isl::MultiVal<ReductionSchedule>::zero(space);
349349
for (size_t i = 0; i < numThreads.view.size(); ++i) {
350350
auto pos = numThreads.view.size() - 1 - i;
351351
size = size.set_val(pos, isl::val(st->ctx_, numThreads.view[i]));

tc/core/polyhedral/cuda/mapped_scop.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "tc/core/cuda/cuda_mapping_options.h"
2525
#include "tc/core/polyhedral/cuda/mapping_types.h"
2626
#include "tc/core/polyhedral/cuda/memory_promotion_heuristic.h"
27+
#include "tc/core/polyhedral/domain_types.h"
2728
#include "tc/core/polyhedral/scop.h"
2829
#include "tc/core/tensor.h"
2930
#include "tc/external/isl.h"
@@ -171,7 +172,8 @@ class MappedScop {
171172
// Return the schedule that will be used by mapInnermostBandsToThreads
172173
// for mapping to thread identifiers, with the last function
173174
// corresponding to thread identifier x.
174-
isl::multi_union_pw_aff reductionMapSchedule(const detail::ScheduleTree* st);
175+
isl::MultiUnionPwAff<Statement, ReductionSchedule> reductionMapSchedule(
176+
const detail::ScheduleTree* st);
175177
// Separate out reductions that can be mapped to an entire block.
176178
// The remaining parts, if any, are no longer considered for replacement
177179
// by a library call.

0 commit comments

Comments
 (0)