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

Commit 12d2793

Browse files
author
Sven Verdoolaege
committed
MappedScop::Reduction: drop redundant reductionDim
The reduction band member is always the one immediately following the coincident band members, so there is no need to store its position separately.
1 parent 04ba6c4 commit 12d2793

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

tc/core/polyhedral/cuda/mapped_scop.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ bool MappedScop::detectReductions(detail::ScheduleTree* tree) {
239239
if (!inits.is_empty()) {
240240
orderBefore(scop_->scheduleRoot(), tree, inits);
241241
}
242-
reductionBandUpdates_.emplace(tree, Reduction(updateIds, reductionDim));
242+
reductionBandUpdates_.emplace(tree, Reduction(updateIds));
243243
return true;
244244
}
245245

@@ -261,11 +261,9 @@ isl::multi_union_pw_aff MappedScop::reductionMapSchedule(
261261
// mapped to threads.
262262
auto reductionSchedule = reductionBand->mupa_;
263263
auto nMember = reductionBand->nMember();
264-
auto reductionDim = reductionBandUpdates_.at(st).reductionDim;
265-
auto nMappedThreads =
266-
std::min(numThreads.view.size(), reductionBand->nOuterCoincident() + 1);
264+
auto reductionDim = reductionBand->nOuterCoincident();
265+
auto nMappedThreads = std::min(numThreads.view.size(), reductionDim + 1);
267266
CHECK_GE(nMember, reductionDim);
268-
CHECK_GE(reductionDim + 1, nMappedThreads);
269267
reductionSchedule = reductionSchedule.drop_dims(
270268
isl::dim_type::set, reductionDim + 1, nMember - (reductionDim + 1));
271269
reductionSchedule = reductionSchedule.drop_dims(

tc/core/polyhedral/cuda/mapped_scop.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,11 @@ class MappedScop {
187187
// Information about a detected reduction that can potentially
188188
// be mapped to a library call.
189189
struct Reduction {
190-
Reduction(std::vector<isl::id> ids, size_t index)
191-
: ids(ids), separated(false), reductionDim(index) {}
190+
Reduction(std::vector<isl::id> ids) : ids(ids), separated(false) {}
192191
// The statement identifiers of the reduction update statements.
193192
std::vector<isl::id> ids;
194193
// Has the reduction been separated out as a full block?
195194
bool separated;
196-
// Index of the band member in which the reduction was detected.
197-
size_t reductionDim;
198195
};
199196
// Map isolated innermost reduction band members to information
200197
// about the detected reduction.

0 commit comments

Comments
 (0)