Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Workaround to allow BEs to disable revalidation in pass manager (#3254)
Browse files Browse the repository at this point in the history
* Workaround to allow BEs to disable revalidation in pass manager

* No no no, your _other_ `false`.
  • Loading branch information
Adam Procter authored and diyessi committed Jul 17, 2019
1 parent b3602cf commit 4f26509
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions src/ngraph/pass/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void pass::Manager::initialize_default_passes()
{
}

void pass::Manager::run_passes(shared_ptr<Function> func, bool transitive)
void pass::Manager::run_passes(shared_ptr<Function> func, bool transitive, bool revalidate)
{
bool profile_enabled = getenv("NGRAPH_PROFILE_PASS_ENABLE") != nullptr;

Expand Down Expand Up @@ -139,10 +139,13 @@ void pass::Manager::run_passes(shared_ptr<Function> func, bool transitive)
}

// Better to do this in node replacement but this will do for now
for (auto f_pair : fs)
if (revalidate)
{
shared_ptr<Function> f = f_pair.first;
f->validate_nodes_and_infer_types();
for (auto f_pair : fs)
{
shared_ptr<Function> f = f_pair.first;
f->validate_nodes_and_infer_types();
}
}

if (m_visualize || m_serialize)
Expand Down
2 changes: 1 addition & 1 deletion src/ngraph/pass/manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ngraph::pass::Manager
}
}

void run_passes(std::shared_ptr<Function>, bool transitive = true);
void run_passes(std::shared_ptr<Function>, bool transitive = true, bool revalidate = true);

ManagerState& get_state();
PassConfig& get_pass_config() { return m_pass_config; }
Expand Down
4 changes: 2 additions & 2 deletions src/ngraph/runtime/plaidml/plaidml_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ std::shared_ptr<ngraph::runtime::plaidml::PlaidML_Executable>
// before we rewrite, we make our own copy of the function.
auto rewrite_func = clone_function(*func);

// Apply passes.
pass_manager.run_passes(rewrite_func);
// Apply passes, with revalidation disabled.
pass_manager.run_passes(rewrite_func, true, false);

// Compile the resulting function.
Build b;
Expand Down

0 comments on commit 4f26509

Please sign in to comment.