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

Commit 8a1476f

Browse files
author
Sven Verdoolaege
committed
drop halide2isl::findReductions
Now that all users of reductions have switched to the polyhedral representation, the original representation can be removed.
1 parent 0c4c750 commit 8a1476f

File tree

4 files changed

+0
-69
lines changed

4 files changed

+0
-69
lines changed

tc/core/halide2isl.cc

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -572,60 +572,5 @@ ScheduleTreeAndAccesses makeScheduleTree(isl::space paramSpace, const Stmt& s) {
572572
return result;
573573
}
574574

575-
std::vector<Reduction> findReductions(const Stmt& s) {
576-
class FindReductions : public IRVisitor {
577-
using IRVisitor::visit;
578-
579-
// Keep track of any reduction variable name for use in visit(Provide*)
580-
void visit(const Variable* op) {
581-
if (op->reduction_domain.defined()) {
582-
reductionVars.insert(op->name);
583-
}
584-
}
585-
586-
// Keep track of the names of the outer For nodes.
587-
void visit(const For* op) {
588-
vars.push_back(op->name);
589-
IRVisitor::visit(op);
590-
vars.pop_back();
591-
}
592-
593-
// Check if the node is an update node with at least one reduction
594-
// dimension, keeping track of the information about the reduction.
595-
// In particular, collect the positions of the reduction
596-
// dimensions in the update statement domain.
597-
// Visit the children first to ensure that all relevant
598-
// reduction variables have been found first.
599-
void visit(const Provide* op) {
600-
IRVisitor::visit(op);
601-
if (isReductionUpdate(op)) {
602-
std::vector<size_t> dims;
603-
auto n = vars.size();
604-
for (size_t i = 0; i < n; ++i) {
605-
if (reductionVars.count(vars[i]) != 0) {
606-
dims.emplace_back(i);
607-
}
608-
}
609-
if (dims.size() > 0) {
610-
Reduction p;
611-
p.update = op;
612-
p.dims = dims;
613-
reductions.emplace_back(p);
614-
}
615-
}
616-
}
617-
618-
public:
619-
// The variables that are known to be reduction variables.
620-
std::unordered_set<std::string> reductionVars;
621-
// The names of the outer For nodes, outermost to innermost.
622-
std::vector<std::string> vars;
623-
std::vector<Reduction> reductions;
624-
} finder;
625-
s.accept(&finder);
626-
627-
return finder.reductions;
628-
}
629-
630575
} // namespace halide2isl
631576
} // namespace tc

tc/core/halide2isl.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,5 @@ ScheduleTreeAndAccesses makeScheduleTree(
105105
isl::space paramSpace,
106106
const Halide::Internal::Stmt& s);
107107

108-
/// Enumerate all reductions in a statement, by looking for the
109-
/// ReductionUpdate markers inserted during lowering
110-
/// (see tc2halide.h).
111-
/// Each reduction object stores a reference to
112-
/// the update statement, and a list of reduction dimensions
113-
/// in the domain of the update statement.
114-
struct Reduction {
115-
Halide::Internal::Stmt update;
116-
std::vector<size_t> dims;
117-
};
118-
std::vector<Reduction> findReductions(const Halide::Internal::Stmt& s);
119-
120108
} // namespace halide2isl
121109
} // namespace tc

tc/core/polyhedral/scop.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ ScopUPtr Scop::makeScop(
6464
scop->body = tree.body;
6565
scop->halide.statements = std::move(tree.statements);
6666
scop->halide.accesses = std::move(tree.accesses);
67-
scop->halide.reductions = halide2isl::findReductions(components.stmt);
6867
scop->halide.domains = std::move(tree.domains);
6968

7069
return scop;

tc/core/polyhedral/scop.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ struct Scop {
485485
std::vector<std::string> idx, reductionIdx;
486486
std::vector<Halide::ImageParam> inputs;
487487
std::vector<Halide::OutputImageParam> outputs;
488-
std::vector<halide2isl::Reduction> reductions;
489488
std::unordered_map<isl::id, Halide::Internal::Stmt, isl::IslIdIslHash>
490489
statements;
491490
std::unordered_map<const Halide::Internal::IRNode*, isl::id> accesses;

0 commit comments

Comments
 (0)