Commit 1cde662e authored by Jaikrishnan Menon's avatar Jaikrishnan Menon

CPU: Rework

parent 2a438ff2
......@@ -226,7 +226,7 @@ void runtime::cpu::CPU_ExternalFunction::compile()
string function_name = m_function->get_name();
mkldnn_emitter.reset(new MKLDNNEmitter(shared_from_this()));
m_mkldnn_emitter.reset(new MKLDNNEmitter(shared_from_this()));
pass::Manager pass_manager;
// For now, just make everyone row-major.
......
......@@ -24,8 +24,6 @@
#include <unordered_map>
#include <vector>
#include <mkldnn.hpp>
#include "ngraph/codegen/code_writer.hpp"
#include "ngraph/codegen/compiler.hpp"
#include "ngraph/codegen/execution_engine.hpp"
......@@ -44,7 +42,6 @@ namespace ngraph
class CPU_ExternalFunction;
class CPU_Emitter;
class CPU_CallFrame;
class MKLDNNEmitter;
using OpFunction = std::function<void(codegen::CodeWriter&,
const ngraph::Node*,
......@@ -79,9 +76,9 @@ namespace ngraph
std::shared_ptr<ngraph::runtime::CallFrame> make_call_frame();
const std::vector<OpAttributes>& get_op_attrs() const { return m_op_attrs; }
const std::vector<mkldnn::primitive>& get_mkldnn_primitives() const
const std::unique_ptr<MKLDNNEmitter>& get_mkldnn_emitter() const
{
return m_mkldnn_primitives;
return m_mkldnn_emitter;
}
protected:
......@@ -117,8 +114,7 @@ namespace ngraph
std::unordered_map<std::string, std::string> m_variable_name_map;
std::vector<OpAttributes> m_op_attrs;
std::vector<mkldnn::primitive> m_mkldnn_primitives;
std::unique_ptr<MKLDNNEmitter> mkldnn_emitter;
std::unique_ptr<MKLDNNEmitter> m_mkldnn_emitter;
};
}
}
......
......@@ -15,9 +15,9 @@
#pragma once
#include <memory>
#include <vector>
#include "ngraph/codegen/code_writer.hpp"
#include "ngraph/shape.hpp"
#include <mkldnn.hpp>
namespace ngraph
{
......@@ -39,6 +39,7 @@ namespace ngraph
private:
std::shared_ptr<CPU_ExternalFunction> external_function;
std::vector<mkldnn::primitive> mkldnn_primitives;
};
}
}
......
......@@ -12,7 +12,12 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include <mkldnn.hpp>
#include "mkldnn_invoke.hpp"
#include "ngraph/runtime/cpu/mkldnn_utils.hpp"
mkldnn::engine ngraph::runtime::cpu::mkldnn_utils::global_cpu_engine(mkldnn::engine::cpu, 0);
extern "C" void
ngraph::runtime::cpu::mkldnn_utils::mkldnn_invoke_primitive(CPURuntimeContext* ctx,
......
// ----------------------------------------------------------------------------
// Copyright 2018 Nervana Systems Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#pragma once
#include <mkldnn.hpp>
namespace ngraph
{
namespace runtime
{
namespace cpu
{
namespace mkldnn_utils
{
extern mkldnn::engine global_cpu_engine;
}
}
}
}
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