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

Commit 9c29c10

Browse files
author
Sven Verdoolaege
committed
splitOutReductionAndInsertSyncs: drop redundant argument
The reduction handling always maps all members of a band to threads and it is always the last member that needs to be split off.
1 parent c8310f1 commit 9c29c10

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

tc/core/polyhedral/cuda/mapped_scop.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ size_t MappedScop::mapToThreads(detail::ScheduleTree* band) {
390390
mapThreadsBackward(band);
391391

392392
if (isReduction) {
393-
splitOutReductionAndInsertSyncs(band, nMappedThreads - 1);
393+
splitOutReductionAndInsertSyncs(band);
394394
}
395395

396396
return numThreads.view.size();
@@ -946,14 +946,14 @@ std::tuple<std::string, tc::Grid, tc::Block> MappedScop::codegen(
946946
mappedScopForCodegen->numThreads);
947947
}
948948

949-
// Split out reduction member at position "dim" in "band" and
949+
// Split out reduction member in "band" and
950950
// insert reduction synchronizations outside this split off band.
951951
void MappedScop::splitOutReductionAndInsertSyncs(
952-
detail::ScheduleTree* band,
953-
int dim) {
952+
detail::ScheduleTree* band) {
954953
using namespace polyhedral::detail;
954+
size_t n = numThreads.view.size();
955955

956-
auto tree = bandSplitOut(scop_->scheduleRoot(), band, dim);
956+
auto tree = bandSplitOut(scop_->scheduleRoot(), band, n - 1);
957957
for (auto updateId : reductionBandUpdates_.at(band).ids) {
958958
scop_->insertReductionSync1D(tree, updateId);
959959
}

tc/core/polyhedral/cuda/mapped_scop.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ class MappedScop {
182182
private:
183183
// Insert the optimal combination of synchronizations in the sequence
184184
void insertBestSyncInSeq(detail::ScheduleTree* seq);
185-
// Split out reduction member at position "dim" in "band" and
185+
// Split out reduction member in "band" and
186186
// insert reduction synchronizations.
187-
void splitOutReductionAndInsertSyncs(detail::ScheduleTree* band, int dim);
187+
void splitOutReductionAndInsertSyncs(detail::ScheduleTree* band);
188188
// Map "band" to thread identifiers using as many blockSizes values as outer
189189
// coincident dimensions (plus reduction dimension, if any),
190190
// insert synchronization in case of a reduction, and

0 commit comments

Comments
 (0)