Commit e8fa980a authored by Jaikrishnan Menon's avatar Jaikrishnan Menon Committed by Scott Cyphers

Fix run_passes semantics, but default to old transitive behavior (#1242)

parent ad12723b
...@@ -56,14 +56,20 @@ void ngraph::pass::Manager::initialize_default_passes() ...@@ -56,14 +56,20 @@ void ngraph::pass::Manager::initialize_default_passes()
{ {
} }
void ngraph::pass::Manager::run_passes(shared_ptr<Function> func) void ngraph::pass::Manager::run_passes(shared_ptr<Function> func, bool transitive)
{ {
bool profile_enabled = getenv("NGRAPH_PROFILE_PASS_ENABLE") != nullptr; bool profile_enabled = getenv("NGRAPH_PROFILE_PASS_ENABLE") != nullptr;
// find all functions
vector<shared_ptr<Function>> fs; vector<shared_ptr<Function>> fs;
traverse_functions(func, [&](shared_ptr<Function> f) { fs.push_back(f); }); if (transitive)
{
// find all functions
traverse_functions(func, [&](shared_ptr<Function> f) { fs.push_back(f); });
}
else
{
fs = {func};
}
set<shared_ptr<Function>> tfs(begin(fs), end(fs)); set<shared_ptr<Function>> tfs(begin(fs), end(fs));
get_state().set_functions(tfs); get_state().set_functions(tfs);
......
...@@ -54,7 +54,7 @@ public: ...@@ -54,7 +54,7 @@ public:
} }
} }
void run_passes(std::shared_ptr<Function>); void run_passes(std::shared_ptr<Function>, bool transitive = true);
ManagerState& get_state(); ManagerState& get_state();
void set_pass_visualization(bool new_state) { m_visualize = new_state; } void set_pass_visualization(bool new_state) { m_visualize = new_state; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment