Commit 4d62a0f3 authored by Robert Kimball's avatar Robert Kimball

interpreter working

parent 2204a054
......@@ -25,7 +25,6 @@
#include "ngraph/file_util.hpp"
#include "ngraph/runtime/backend.hpp"
#include "ngraph/runtime/backend_manager.hpp"
#include "ngraph/runtime/cpu/static_initialize.hpp"
#include "ngraph/runtime/interpreter/static_initialize.hpp"
#include "ngraph/util.hpp"
......@@ -50,27 +49,6 @@ unordered_map<string, runtime::BackendConstructor*>& runtime::BackendManager::ge
#ifdef INTERPRETER_BACKEND_STATIC
runtime::interpreter::static_initialize();
#endif
// #ifdef CPU_BACKEND_STATIC
// runtime::cpu::static_initialize();
// #endif
// #ifdef INTELGPU_BACKEND_STATIC
// runtime::intelgpu::static_initialize();
// #endif
// #ifdef GPU_BACKEND_STATIC
// runtime::gpu::static_initialize();
// #endif
// #ifdef NOP_BACKEND_STATIC
// runtime::nop::static_initialize();
// #endif
// #ifdef GPUH_BACKEND_STATIC
// runtime::gpuh::static_initialize();
// #endif
// #ifdef GENERIC_CPU_BACKEND_STATIC
// runtime::cpu::static_initialize();
// #endif
// #ifdef PLAIDML_BACKEND_STATIC
// runtime::plaidml::static_initialize();
// #endif
}
return s_registered_backend;
}
......
......@@ -150,11 +150,7 @@ endif()
if (NGRAPH_CPU_ENABLE)
set(NGRAPH_CPU_DEBUGINFO_ENABLE 0 CACHE STRING "Enable debuginfo in the CPU backend")
# if (NGRAPH_STATIC_LIB_ENABLE)
# add_library(cpu_backend STATIC ${SRC})
# else()
add_library(cpu_backend SHARED ${SRC})
# endif()
add_library(cpu_backend SHARED ${SRC})
if(NGRAPH_LIB_VERSIONING_ENABLE)
set_target_properties(cpu_backend PROPERTIES
VERSION ${NGRAPH_VERSION}
......
......@@ -23,13 +23,12 @@
#include "ngraph/runtime/cpu/cpu_call_frame.hpp"
#include "ngraph/runtime/cpu/cpu_external_function.hpp"
#include "ngraph/runtime/cpu/cpu_tensor_view.hpp"
#include "ngraph/runtime/cpu/static_initialize.hpp"
#include "ngraph/util.hpp"
using namespace ngraph;
using namespace std;
static runtime::BackendConstructor* cpu_get_backend_constructor_pointer()
extern "C" runtime::BackendConstructor* get_backend_constructor_pointer()
{
class CPU_BackendConstructor : public runtime::BackendConstructor
{
......@@ -37,7 +36,6 @@ static runtime::BackendConstructor* cpu_get_backend_constructor_pointer()
std::shared_ptr<runtime::Backend> create(const std::string& config) override
{
// Force TBB to link to the backend
NGRAPH_INFO;
tbb::TBB_runtime_interface_version();
return make_shared<runtime::cpu::CPU_Backend>();
}
......@@ -48,22 +46,17 @@ static runtime::BackendConstructor* cpu_get_backend_constructor_pointer()
return s_backend_constructor.get();
}
#ifndef CPU_BACKEND_STATIC
extern "C" runtime::BackendConstructor* get_backend_constructor_pointer()
{
return cpu_get_backend_constructor_pointer();
}
#endif
void runtime::cpu::static_initialize()
namespace
{
NGRAPH_INFO;
static bool s_is_initialized = false;
if (!s_is_initialized)
static class CPUStaticInit
{
s_is_initialized = true;
runtime::BackendManager::register_backend("CPU", cpu_get_backend_constructor_pointer());
}
public:
CPUStaticInit()
{
runtime::BackendManager::register_backend("CPU", get_backend_constructor_pointer());
}
~CPUStaticInit() {}
} s_cpu_static_init;
}
shared_ptr<runtime::cpu::CPU_CallFrame> runtime::cpu::CPU_Backend::make_call_frame(
......
//*****************************************************************************
// Copyright 2017-2019 Intel Corporation
//
// 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
// limitations under the License.
//*****************************************************************************
#pragma once
namespace ngraph
{
namespace runtime
{
namespace cpu
{
void static_initialize();
}
}
}
......@@ -27,8 +27,7 @@
using namespace std;
using namespace ngraph;
static runtime::BackendConstructor*
interpreter_get_backend_constructor_pointer()
static runtime::BackendConstructor* interpreter_get_backend_constructor_pointer()
{
class INTBackendConstructor : public runtime::BackendConstructor
{
......@@ -45,11 +44,10 @@ static runtime::BackendConstructor*
}
#ifdef INTERPRETER_BACKEND_STATIC
extern "C" runtime::BackendConstructor*
get_backend_constructor_pointer()
{
return interpreter_get_backend_constructor_pointer();
}
extern "C" runtime::BackendConstructor* get_backend_constructor_pointer()
{
return interpreter_get_backend_constructor_pointer();
}
#endif
void runtime::interpreter::static_initialize()
......@@ -58,7 +56,8 @@ void runtime::interpreter::static_initialize()
if (!s_is_initialized)
{
s_is_initialized = true;
BackendManager::register_backend("INTERPRETER", get_backend_constructor_pointer());
BackendManager::register_backend("INTERPRETER",
interpreter_get_backend_constructor_pointer());
}
}
......
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