@@ -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
0 commit comments