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;
codegen::CodeWriter::CodeWriter()
: indent(0)
, emitted_mkldnn_preamble(false)
, m_pending_indent(true)
, m_temporary_name_count(0)
{
......
......@@ -36,7 +36,6 @@ public:
void operator+=(const std::string&);
size_t indent;
bool emitted_mkldnn_preamble;
template <typename T>
friend CodeWriter& operator<<(CodeWriter& out, const T& obj)
......
......@@ -91,7 +91,6 @@ void runtime::cpu::CPU_Emitter::EmitMKLDNNPreamble(codegen::CodeWriter& writer)
{
writer << "using namespace mkldnn;\n";
writer << "auto cpu_engine = engine(engine::cpu, 0);\n";
writer.emitted_mkldnn_preamble = true;
}
void runtime::cpu::CPU_Emitter::EmitNop(codegen::CodeWriter& writer,
......@@ -1854,11 +1853,6 @@ void runtime::cpu::CPU_Emitter::EmitConvolution(codegen::CodeWriter& writer,
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
// codegen for statics or move primitive and stream construction out
// 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,
// TODO: Optimize for 1D
if (!writer.emitted_mkldnn_preamble)
{
EmitMKLDNNPreamble(writer);
}
// TODO: Remove element type restriction
if (arg_rank == 4 && max_pool->get_window_shape().size() == 2 &&
args[0].get_element_type() == element::f32)
......
......@@ -481,6 +481,8 @@ using namespace ngraph::runtime;
writer << "tbb::flow::graph G;\n\n";
}
runtime::cpu::CPU_Emitter::EmitMKLDNNPreamble(writer);
bool temporaries_used = false;
size_t worst_case_tmp_size = 0;
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