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

Commit 12e5ae6

Browse files
Merge pull request #461 from facebookresearch/pr/reduction
halide2isl: findReductions: support multiple reductions on the same tensor
2 parents 9fb6a37 + e15aaef commit 12e5ae6

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

tc/core/halide2isl.cc

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -529,11 +529,10 @@ std::vector<Reduction> findReductions(const Stmt& s) {
529529
}
530530
}
531531
if (dims.size() > 0) {
532-
auto& p = reductions[op->name];
533-
CHECK(!p.update.defined())
534-
<< "Multiple reduction updates not yet implemented";
532+
Reduction p;
535533
p.update = op;
536534
p.dims = dims;
535+
reductions.emplace_back(p);
537536
}
538537
}
539538
}
@@ -543,15 +542,11 @@ std::vector<Reduction> findReductions(const Stmt& s) {
543542
std::unordered_set<std::string> reductionVars;
544543
// The names of the outer For nodes, outermost to innermost.
545544
std::vector<std::string> vars;
546-
std::map<std::string, Reduction> reductions;
545+
std::vector<Reduction> reductions;
547546
} finder;
548547
s.accept(&finder);
549548

550-
std::vector<Reduction> result;
551-
for (auto p : finder.reductions) {
552-
result.push_back(p.second);
553-
}
554-
return result;
549+
return finder.reductions;
555550
}
556551

557552
} // namespace halide2isl

0 commit comments

Comments
 (0)