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

Commit c93acf8

Browse files
authored
Merge pull request #452 from facebookresearch/pr/reduction
MappedScop::detectReductions: check that member exists before accessing it
2 parents 34542a5 + b0f4404 commit c93acf8

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)