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
f95d7167
Commit
f95d7167
authored
Jul 17, 2019
by
pruthvi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- add methods to create and register backend statically
- Option in parent CMakeLists to build cpu as static backend
parent
05763edb
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
2 deletions
+50
-2
CMakeLists.txt
CMakeLists.txt
+1
-0
cpu_backend.cpp
src/ngraph/runtime/cpu/cpu_backend.cpp
+19
-1
cpu_backend.hpp
src/ngraph/runtime/cpu/cpu_backend.hpp
+2
-1
static_initialize.hpp
src/ngraph/runtime/cpu/static_initialize.hpp
+28
-0
No files found.
CMakeLists.txt
View file @
f95d7167
...
@@ -183,6 +183,7 @@ option(NGRAPH_FAST_MATH_ENABLE "Enable fast math" ON)
...
@@ -183,6 +183,7 @@ option(NGRAPH_FAST_MATH_ENABLE "Enable fast math" ON)
option
(
NGRAPH_JSON_ENABLE
"Enable JSON based serialization and tracing features"
TRUE
)
option
(
NGRAPH_JSON_ENABLE
"Enable JSON based serialization and tracing features"
TRUE
)
option
(
NGRAPH_STATIC_LIB_ENABLE
"Enable build nGraph static library"
FALSE
)
option
(
NGRAPH_STATIC_LIB_ENABLE
"Enable build nGraph static library"
FALSE
)
option
(
NGRAPH_INTERPRETER_STATIC_LIB_ENABLE
"Enable build INTERPRETER backend static library"
FALSE
)
option
(
NGRAPH_INTERPRETER_STATIC_LIB_ENABLE
"Enable build INTERPRETER backend static library"
FALSE
)
option
(
NGRAPH_CPU_STATIC_LIB_ENABLE
"Enable build CPU backend static library"
FALSE
)
if
(
NGRAPH_CPU_ENABLE
if
(
NGRAPH_CPU_ENABLE
AND
AND
...
...
src/ngraph/runtime/cpu/cpu_backend.cpp
View file @
f95d7167
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include "ngraph/runtime/cpu/cpu_call_frame.hpp"
#include "ngraph/runtime/cpu/cpu_call_frame.hpp"
#include "ngraph/runtime/cpu/cpu_external_function.hpp"
#include "ngraph/runtime/cpu/cpu_external_function.hpp"
#include "ngraph/runtime/cpu/cpu_tensor_view.hpp"
#include "ngraph/runtime/cpu/cpu_tensor_view.hpp"
#include "ngraph/runtime/cpu/static_initialize.hpp"
#include "ngraph/util.hpp"
#include "ngraph/util.hpp"
#ifdef NGRAPH_MLIR_ENABLE
#ifdef NGRAPH_MLIR_ENABLE
...
@@ -32,7 +33,7 @@
...
@@ -32,7 +33,7 @@
using
namespace
ngraph
;
using
namespace
ngraph
;
using
namespace
std
;
using
namespace
std
;
extern
"C"
runtime
::
BackendConstructor
*
get_backend_constructor_pointer
()
runtime
::
BackendConstructor
*
runtime
::
cpu
::
get_backend_constructor_pointer
()
{
{
class
CPU_BackendConstructor
:
public
runtime
::
BackendConstructor
class
CPU_BackendConstructor
:
public
runtime
::
BackendConstructor
{
{
...
@@ -50,6 +51,23 @@ extern "C" runtime::BackendConstructor* get_backend_constructor_pointer()
...
@@ -50,6 +51,23 @@ extern "C" runtime::BackendConstructor* get_backend_constructor_pointer()
return
s_backend_constructor
.
get
();
return
s_backend_constructor
.
get
();
}
}
#ifndef CPU_BACKEND_STATIC
extern
"C"
runtime
::
BackendConstructor
*
get_backend_constructor_pointer
()
{
return
runtime
::
cpu
::
get_backend_constructor_pointer
();
}
#endif
void
runtime
::
cpu
::
static_initialize
()
{
static
bool
s_is_initialized
=
false
;
if
(
!
s_is_initialized
)
{
s_is_initialized
=
true
;
BackendManager
::
register_backend
(
"CPU"
,
runtime
::
cpu
::
get_backend_constructor_pointer
());
}
}
namespace
namespace
{
{
static
class
CPUStaticInit
static
class
CPUStaticInit
...
...
src/ngraph/runtime/cpu/cpu_backend.hpp
View file @
f95d7167
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "ngraph/pass/pass_config.hpp"
#include "ngraph/pass/pass_config.hpp"
#include "ngraph/runtime/allocator.hpp"
#include "ngraph/runtime/allocator.hpp"
#include "ngraph/runtime/backend.hpp"
#include "ngraph/runtime/backend.hpp"
#include "ngraph/runtime/backend_manager.hpp"
namespace
ngraph
namespace
ngraph
{
{
...
@@ -33,7 +34,7 @@ namespace ngraph
...
@@ -33,7 +34,7 @@ namespace ngraph
{
{
class
CPU_ExternalFunction
;
class
CPU_ExternalFunction
;
class
CPU_CallFrame
;
class
CPU_CallFrame
;
ngraph
::
runtime
::
BackendConstructor
*
get_backend_constructor_pointer
();
class
CPU_BACKEND_API
CPU_Backend
:
public
runtime
::
Backend
class
CPU_BACKEND_API
CPU_Backend
:
public
runtime
::
Backend
{
{
public
:
public
:
...
...
src/ngraph/runtime/cpu/static_initialize.hpp
0 → 100644
View file @
f95d7167
//*****************************************************************************
// 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
();
}
}
}
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