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

Commit 14df3a2

Browse files
author
Sven Verdoolaege
committed
MappedScop::detectReductions: do not detect reduction if block is of size 1
Test TcCudaMapper2DReductionStressTest.ThreadIdy1 explicitly checks that no reduction is detected if the block is of size 1 in the x direction. This is only the case because of some artifact of the current reduction detection mechanism. In particular, after specialization, the schedule band members on a domain of length 0 are replaced by constants and therefore no longer contain reduction dimensions and are therefore not detected as reduction band members. The reduction detection based on the polyhedral representation of reductions does not suffer from such artifacts and will therefore, correctly, identify this case as a reduction. Since this is apparently undesirable, an explicit check needs to be introduced that disables reduction detection if the block is of size 1 in the x direction.
1 parent b81795e commit 14df3a2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tc/core/polyhedral/cuda/mapped_scop.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ bool separatedOut(
226226
} // namespace
227227

228228
bool MappedScop::detectReductions(detail::ScheduleTree* tree) {
229+
// Do not bother with reductions if block is of size 1 in the x direction.
230+
if (numThreads.view.size() == 0 || numThreads.view[0] == 1) {
231+
return false;
232+
}
233+
229234
bool found = false;
230235
for (auto c : tree->children()) {
231236
found |= detectReductions(c);

0 commit comments

Comments
 (0)