Commit dd1c264a authored by Jaikrishnan Menon's avatar Jaikrishnan Menon

CPU: Always create an MKLDNN CPU engine

parent fc6cd9ac
...@@ -19,7 +19,6 @@ using namespace ngraph; ...@@ -19,7 +19,6 @@ using namespace ngraph;
codegen::CodeWriter::CodeWriter() codegen::CodeWriter::CodeWriter()
: indent(0) : indent(0)
, emitted_mkldnn_preamble(false)
, m_pending_indent(true) , m_pending_indent(true)
, m_temporary_name_count(0) , m_temporary_name_count(0)
{ {
......
...@@ -36,7 +36,6 @@ public: ...@@ -36,7 +36,6 @@ public:
void operator+=(const std::string&); void operator+=(const std::string&);
size_t indent; size_t indent;
bool emitted_mkldnn_preamble;
template <typename T> template <typename T>
friend CodeWriter& operator<<(CodeWriter& out, const T& obj) friend CodeWriter& operator<<(CodeWriter& out, const T& obj)
......
...@@ -91,7 +91,6 @@ void runtime::cpu::CPU_Emitter::EmitMKLDNNPreamble(codegen::CodeWriter& writer) ...@@ -91,7 +91,6 @@ void runtime::cpu::CPU_Emitter::EmitMKLDNNPreamble(codegen::CodeWriter& writer)
{ {
writer << "using namespace mkldnn;\n"; writer << "using namespace mkldnn;\n";
writer << "auto cpu_engine = engine(engine::cpu, 0);\n"; writer << "auto cpu_engine = engine(engine::cpu, 0);\n";
writer.emitted_mkldnn_preamble = true;
} }
void runtime::cpu::CPU_Emitter::EmitNop(codegen::CodeWriter& writer, void runtime::cpu::CPU_Emitter::EmitNop(codegen::CodeWriter& writer,
...@@ -1854,11 +1853,6 @@ void runtime::cpu::CPU_Emitter::EmitConvolution(codegen::CodeWriter& writer, ...@@ -1854,11 +1853,6 @@ void runtime::cpu::CPU_Emitter::EmitConvolution(codegen::CodeWriter& writer,
images_dilated = images_dilated || (s != 1); images_dilated = images_dilated || (s != 1);
} }
if (!writer.emitted_mkldnn_preamble)
{
EmitMKLDNNPreamble(writer);
}
// TODO: MKLDNN streams should be static so we need to either implement // TODO: MKLDNN streams should be static so we need to either implement
// codegen for statics or move primitive and stream construction out // codegen for statics or move primitive and stream construction out
// of the generated function and only generate code to run/rerun the stream // of the generated function and only generate code to run/rerun the stream
...@@ -1983,11 +1977,6 @@ void runtime::cpu::CPU_Emitter::EmitMaxPool(codegen::CodeWriter& writer, ...@@ -1983,11 +1977,6 @@ void runtime::cpu::CPU_Emitter::EmitMaxPool(codegen::CodeWriter& writer,
// TODO: Optimize for 1D // TODO: Optimize for 1D
if (!writer.emitted_mkldnn_preamble)
{
EmitMKLDNNPreamble(writer);
}
// TODO: Remove element type restriction // TODO: Remove element type restriction
if (arg_rank == 4 && max_pool->get_window_shape().size() == 2 && if (arg_rank == 4 && max_pool->get_window_shape().size() == 2 &&
args[0].get_element_type() == element::f32) args[0].get_element_type() == element::f32)
......
...@@ -481,6 +481,8 @@ using namespace ngraph::runtime; ...@@ -481,6 +481,8 @@ using namespace ngraph::runtime;
writer << "tbb::flow::graph G;\n\n"; writer << "tbb::flow::graph G;\n\n";
} }
runtime::cpu::CPU_Emitter::EmitMKLDNNPreamble(writer);
bool temporaries_used = false; bool temporaries_used = false;
size_t worst_case_tmp_size = 0; size_t worst_case_tmp_size = 0;
for (shared_ptr<Node> node : current_function->get_ordered_ops()) for (shared_ptr<Node> node : current_function->get_ordered_ops())
......
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