Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
2204a054
Commit
2204a054
authored
Jun 20, 2019
by
Robert Kimball
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
45b7eb4c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
18 deletions
+71
-18
CMakeLists.txt
src/ngraph/CMakeLists.txt
+8
-8
backend_manager.cpp
src/ngraph/runtime/backend_manager.cpp
+5
-0
CMakeLists.txt
src/ngraph/runtime/cpu/CMakeLists.txt
+4
-0
cpu_backend.cpp
src/ngraph/runtime/cpu/cpu_backend.cpp
+16
-9
static_initialize.hpp
src/ngraph/runtime/cpu/static_initialize.hpp
+28
-0
int_backend.cpp
src/ngraph/runtime/interpreter/int_backend.cpp
+10
-1
No files found.
src/ngraph/CMakeLists.txt
View file @
2204a054
...
...
@@ -486,33 +486,33 @@ configure_file(version.in.hpp version.hpp)
if
(
NGRAPH_STATIC_LIB_ENABLE
)
add_library
(
ngraph STATIC
${
SRC
}
)
target_compile_definitions
(
ngraph P
RIVATE
INTERPRETER_BACKEND_STATIC
)
target_compile_definitions
(
ngraph P
UBLIC
INTERPRETER_BACKEND_STATIC
)
if
(
NGRAPH_CPU_ENABLE
)
target_compile_definitions
(
ngraph P
RIVATE
CPU_BACKEND_STATIC
)
target_compile_definitions
(
ngraph P
UBLIC
CPU_BACKEND_STATIC
)
endif
()
if
(
NGRAPH_INTELGPU_ENABLE
)
target_compile_definitions
(
ngraph P
RIVATE
INTELGPU_BACKEND_STATIC
)
target_compile_definitions
(
ngraph P
UBLIC
INTELGPU_BACKEND_STATIC
)
endif
()
if
(
NGRAPH_GPU_ENABLE
)
target_compile_definitions
(
ngraph P
RIVATE
GPU_BACKEND_STATIC
)
target_compile_definitions
(
ngraph P
UBLIC
GPU_BACKEND_STATIC
)
endif
()
if
(
NGRAPH_NOP_ENABLE
)
target_compile_definitions
(
ngraph P
RIVATE
NOP_BACKEND_STATIC
)
target_compile_definitions
(
ngraph P
UBLIC
NOP_BACKEND_STATIC
)
endif
()
if
(
NGRAPH_GPUH_ENABLE
)
target_compile_definitions
(
ngraph P
RIVATE
GPUH_BACKEND_STATIC
)
target_compile_definitions
(
ngraph P
UBLIC
GPUH_BACKEND_STATIC
)
endif
()
if
(
NGRAPH_GENERIC_CPU_ENABLE
)
target_compile_definitions
(
ngraph P
RIVATE
GENERIC_CPU_BACKEND_STATIC
)
target_compile_definitions
(
ngraph P
UBLIC
GENERIC_CPU_BACKEND_STATIC
)
endif
()
if
(
NGRAPH_PLAIDML_ENABLE
)
target_compile_definitions
(
ngraph P
RIVATE
PLAIDML_BACKEND_STATIC
)
target_compile_definitions
(
ngraph P
UBLIC
PLAIDML_BACKEND_STATIC
)
endif
()
else
()
add_library
(
ngraph SHARED
${
SRC
}
)
...
...
src/ngraph/runtime/backend_manager.cpp
View file @
2204a054
...
...
@@ -25,6 +25,7 @@
#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"
...
...
@@ -110,6 +111,10 @@ shared_ptr<runtime::Backend> runtime::BackendManager::create_backend(const std::
auto
registry
=
get_registry
();
auto
it
=
registry
.
find
(
type
);
for
(
auto
x
:
registry
)
{
NGRAPH_INFO
<<
x
.
first
;
}
if
(
it
!=
registry
.
end
())
{
BackendConstructor
*
new_backend
=
it
->
second
;
...
...
src/ngraph/runtime/cpu/CMakeLists.txt
View file @
2204a054
...
...
@@ -150,7 +150,11 @@ 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()
if
(
NGRAPH_LIB_VERSIONING_ENABLE
)
set_target_properties
(
cpu_backend PROPERTIES
VERSION
${
NGRAPH_VERSION
}
...
...
src/ngraph/runtime/cpu/cpu_backend.cpp
View file @
2204a054
...
...
@@ -23,12 +23,13 @@
#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
;
extern
"C"
runtime
::
BackendConstructor
*
get_backend_constructor_pointer
()
static
runtime
::
BackendConstructor
*
cpu_
get_backend_constructor_pointer
()
{
class
CPU_BackendConstructor
:
public
runtime
::
BackendConstructor
{
...
...
@@ -36,6 +37,7 @@ extern "C" runtime::BackendConstructor* 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
>
();
}
...
...
@@ -46,17 +48,22 @@ extern "C" runtime::BackendConstructor* get_backend_constructor_pointer()
return
s_backend_constructor
.
get
();
}
namespace
#ifndef CPU_BACKEND_STATIC
extern
"C"
runtime
::
BackendConstructor
*
get_backend_constructor_pointer
()
{
static
class
CPUStaticInit
{
public
:
CPUStaticInit
()
return
cpu_get_backend_constructor_pointer
();
}
#endif
void
runtime
::
cpu
::
static_initialize
()
{
NGRAPH_INFO
;
static
bool
s_is_initialized
=
false
;
if
(
!
s_is_initialized
)
{
runtime
::
BackendManager
::
register_backend
(
"CPU"
,
get_backend_constructor_pointer
());
s_is_initialized
=
true
;
runtime
::
BackendManager
::
register_backend
(
"CPU"
,
cpu_get_backend_constructor_pointer
());
}
~
CPUStaticInit
()
{}
}
s_cpu_static_init
;
}
shared_ptr
<
runtime
::
cpu
::
CPU_CallFrame
>
runtime
::
cpu
::
CPU_Backend
::
make_call_frame
(
...
...
src/ngraph/runtime/cpu/static_initialize.hpp
0 → 100644
View file @
2204a054
//*****************************************************************************
// 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
();
}
}
}
src/ngraph/runtime/interpreter/int_backend.cpp
View file @
2204a054
...
...
@@ -27,7 +27,8 @@
using
namespace
std
;
using
namespace
ngraph
;
extern
"C"
runtime
::
BackendConstructor
*
get_backend_constructor_pointer
()
static
runtime
::
BackendConstructor
*
interpreter_get_backend_constructor_pointer
()
{
class
INTBackendConstructor
:
public
runtime
::
BackendConstructor
{
...
...
@@ -43,6 +44,14 @@ extern "C" runtime::BackendConstructor* get_backend_constructor_pointer()
return
s_backend_constructor
.
get
();
}
#ifdef INTERPRETER_BACKEND_STATIC
extern
"C"
runtime
::
BackendConstructor
*
get_backend_constructor_pointer
()
{
return
interpreter_get_backend_constructor_pointer
();
}
#endif
void
runtime
::
interpreter
::
static_initialize
()
{
static
bool
s_is_initialized
=
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment