Commit 24a7db84 authored by Robert Kimball's avatar Robert Kimball

only emit memory handler if there are temporaries

parent efc53f25
...@@ -214,8 +214,19 @@ using namespace ngraph::runtime::cpu::eigen; ...@@ -214,8 +214,19 @@ using namespace ngraph::runtime::cpu::eigen;
TU << " const std::vector<void*>& inputs,\n"; TU << " const std::vector<void*>& inputs,\n";
TU << " const std::vector<void*>& outputs)\n"; TU << " const std::vector<void*>& outputs)\n";
TU << "{\n"; TU << "{\n";
TU.indent++; TU.indent++;
bool temporaries_used = false;
for (shared_ptr<Node> node : current_function->get_ordered_ops())
{
if (node->liveness_new_list.size() > 0)
{
temporaries_used = true;
break;
}
}
if (temporaries_used)
{
size_t temp_pool_size = pass_manager.get_state().get_temporary_pool_size(); size_t temp_pool_size = pass_manager.get_state().get_temporary_pool_size();
TU << "// Allocate the memory pool\n"; TU << "// Allocate the memory pool\n";
TU << "ngraph::runtime::cpu::MemoryHandler memory_handler(" << temp_pool_size << ", " TU << "ngraph::runtime::cpu::MemoryHandler memory_handler(" << temp_pool_size << ", "
...@@ -233,6 +244,7 @@ using namespace ngraph::runtime::cpu::eigen; ...@@ -233,6 +244,7 @@ using namespace ngraph::runtime::cpu::eigen;
} }
} }
TU << "\n"; TU << "\n";
}
TU << "// Define inputs\n"; TU << "// Define inputs\n";
size_t arg_index = 0; size_t arg_index = 0;
...@@ -263,9 +275,6 @@ using namespace ngraph::runtime::cpu::eigen; ...@@ -263,9 +275,6 @@ using namespace ngraph::runtime::cpu::eigen;
} }
TU << "\n"; TU << "\n";
TU << "// Define tensor views\n";
TU << "\n";
for (shared_ptr<Node> node : current_function->get_ordered_ops()) for (shared_ptr<Node> node : current_function->get_ordered_ops())
{ {
auto& n = *node; // Work around a compiler warning (*node inside typeid may have effects auto& n = *node; // Work around a compiler warning (*node inside typeid may have effects
......
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