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

Commit 049185a

Browse files
Sven VerdoolaegeTheodoros Theodoridis
authored andcommitted
MappedScop::detectReductions: check that member exists before accessing it
If all members in the band are coincident, then the member that gets checked for being a reduction lies beyond the band. It is not clear if this can happen in practice in the current code base because the band has already been checked for not containing anything beyond a single update statement and optionally the corresponding init statement. However, these restrictions may get relaxed at some point and there is no point in continuing if all member are coincident.
1 parent 658e058 commit 049185a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tc/core/polyhedral/cuda/mapped_scop.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,11 @@ bool MappedScop::detectReductions(detail::ScheduleTree* tree) {
203203
}
204204

205205
// For now, only support reductions with a sufficient number
206-
// of coincident outer band members for the remaining thread identifiers.
206+
// of coincident outer band members for the remaining thread identifiers and
207+
// at least one non-coincident member.
207208
auto nCoincident = band->nOuterCoincident();
208-
if (nCoincident < numThreads.view.size() - 1) {
209+
auto nMember = band->nMember();
210+
if (nCoincident < numThreads.view.size() - 1 || nCoincident >= nMember) {
209211
return found;
210212
}
211213

0 commit comments

Comments
 (0)