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

Commit 3508ad5

Browse files
author
Sven Verdoolaege
committed
MappedScop::mapToThreads: use single loop iterator
Using two loop iterators for the same loop is confusing as it looks like two conditions are being check, while one is a logical consequence of the other. Using a single loop iterator makes it more clear that exactly the number of required thread identifiers get mapped.
1 parent 3e0bd6a commit 3508ad5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tc/core/polyhedral/cuda/mapped_scop.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,9 @@ size_t MappedScop::mapToThreads(detail::ScheduleTree* band, size_t nInner) {
381381

382382
// Map the coincident dimensions to threads starting from the innermost and
383383
// from thread x.
384-
for (int i = 0, dim = nOuterCoincident - 1; i < nMappedThreads && dim >= 0;
385-
++i, --dim) {
384+
for (int i = 0; i < nMappedThreads; ++i) {
386385
auto id = mapping::ThreadId::makeId(nInner + i);
386+
auto dim = nOuterCoincident - 1 - i;
387387
if (id == mapping::ThreadId::x()) {
388388
threadIdxXScheduleDepthState.emplace_back(std::make_pair(
389389
activeDomainPoints(schedule(), band),

0 commit comments

Comments
 (0)