INFO(l) << "PhaseRunner<Saturate> - done";
}
+void PhaseRunner<PhaseStrategy::Restart>::run(const Phase &phase) const
+{
+ LOGGER(l);
+
+ INFO(l) << "==============================================================";
+ INFO(l) << "PhaseRunner<Restart>";
+
+ INFO(l) << "Initial graph";
+ INFO(l) << fmt(_graph);
+
+ for (bool changed = true; changed;)
+ {
+ changed = false;
+
+ for (auto &tr : phase)
+ {
+ INFO(l) << "--------------------------------------------------------------";
+ INFO(l) << "Before " << transform_name(tr.get());
+
+ if (tr->run(_graph))
+ {
+ changed = true;
+ }
+
+ INFO(l) << "After " << transform_name(tr.get()) << " (changed: " << to_char(changed) << ")";
+ INFO(l) << fmt(_graph);
+
+ if (changed)
+ {
+ break;
+ }
+ }
+ }
+
+ INFO(l) << "PhaseRunner<Restart> - done";
+}
+
} // namespace tf
} // namespace moco
{
// Run all the transforms until there is no transform that makes a change
Saturate,
+ // Same as Saturate but will restart from the first when there is a change
+ Restart,
};
template <PhaseStrategy S> class PhaseRunner;
loco::Graph *_graph;
};
+template <> class PhaseRunner<PhaseStrategy::Restart>
+{
+public:
+ PhaseRunner(loco::Graph *graph) : _graph{graph}
+ {
+ // DO NOTHING
+ }
+
+public:
+ void run(const Phase &) const;
+
+private:
+ loco::Graph *_graph;
+};
+
} // namespace tf
} // namespace moco