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
96604f12
Unverified
Commit
96604f12
authored
Apr 10, 2018
by
Robert Kimball
Committed by
GitHub
Apr 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
back out api change (#842)
* back out api change
parent
db788de8
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
38 additions
and
38 deletions
+38
-38
backend.cpp
src/ngraph/runtime/backend.cpp
+1
-1
backend.hpp
src/ngraph/runtime/backend.hpp
+3
-3
cpu_backend.cpp
src/ngraph/runtime/cpu/cpu_backend.cpp
+9
-9
cpu_backend.hpp
src/ngraph/runtime/cpu/cpu_backend.hpp
+4
-4
gpu_backend.cpp
src/ngraph/runtime/gpu/gpu_backend.cpp
+7
-7
gpu_backend.hpp
src/ngraph/runtime/gpu/gpu_backend.hpp
+3
-3
int_backend.cpp
src/ngraph/runtime/interpreter/int_backend.cpp
+8
-8
int_backend.hpp
src/ngraph/runtime/interpreter/int_backend.hpp
+3
-3
backend_test.in.cpp
test/backend_test.in.cpp
+0
-0
No files found.
src/ngraph/runtime/backend.cpp
View file @
96604f12
...
...
@@ -43,6 +43,6 @@ vector<size_t> runtime::Backend::get_subdevices(const string& type)
return
manager
->
get_subdevices
();
}
void
runtime
::
Backend
::
remove_compiled_function
(
const
Function
&
func
)
void
runtime
::
Backend
::
remove_compiled_function
(
std
::
shared_ptr
<
Function
>
func
)
{
}
src/ngraph/runtime/backend.hpp
View file @
96604f12
...
...
@@ -93,13 +93,13 @@ namespace ngraph
return
create_tensor
(
element
::
from
<
T
>
(),
shape
);
}
virtual
bool
compile
(
const
ngraph
::
Function
&
func
)
=
0
;
virtual
bool
compile
(
std
::
shared_ptr
<
Function
>
func
)
=
0
;
virtual
bool
call
(
const
ngraph
::
Function
&
func
,
virtual
bool
call
(
std
::
shared_ptr
<
Function
>
func
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
outputs
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
inputs
)
=
0
;
virtual
void
remove_compiled_function
(
const
ngraph
::
Function
&
func
);
virtual
void
remove_compiled_function
(
std
::
shared_ptr
<
Function
>
func
);
};
}
}
src/ngraph/runtime/cpu/cpu_backend.cpp
View file @
96604f12
...
...
@@ -46,30 +46,30 @@ std::shared_ptr<ngraph::runtime::TensorView>
return
make_shared
<
runtime
::
cpu
::
CPUTensorView
>
(
element_type
,
shape
);
}
bool
runtime
::
cpu
::
CPU_Backend
::
compile
(
const
ngraph
::
Function
&
func
)
bool
runtime
::
cpu
::
CPU_Backend
::
compile
(
std
::
shared_ptr
<
Function
>
func
)
{
if
(
!
contains_key
(
m_function_map
,
&
func
))
if
(
!
contains_key
(
m_function_map
,
func
))
{
FunctionInstance
instance
;
instance
.
m_function
=
clone_function
(
func
)
;
instance
.
m_function
=
func
;
instance
.
m_external_function
=
make_shared
<
CPU_ExternalFunction
>
(
instance
.
m_function
);
auto
cf
=
instance
.
m_external_function
->
make_call_frame
();
instance
.
m_call_frame
=
dynamic_pointer_cast
<
CPU_CallFrame
>
(
cf
);
m_function_map
.
insert
({
&
func
,
instance
});
m_function_map
.
insert
({
func
,
instance
});
}
return
true
;
}
bool
runtime
::
cpu
::
CPU_Backend
::
call
(
const
Function
&
func
,
bool
runtime
::
cpu
::
CPU_Backend
::
call
(
std
::
shared_ptr
<
Function
>
func
,
const
vector
<
shared_ptr
<
runtime
::
TensorView
>>&
outputs
,
const
vector
<
shared_ptr
<
runtime
::
TensorView
>>&
inputs
)
{
bool
rc
=
true
;
auto
it
=
m_function_map
.
find
(
&
func
);
auto
it
=
m_function_map
.
find
(
func
);
if
(
it
==
m_function_map
.
end
())
{
compile
(
func
);
it
=
m_function_map
.
find
(
&
func
);
it
=
m_function_map
.
find
(
func
);
}
if
(
it
==
m_function_map
.
end
())
...
...
@@ -96,9 +96,9 @@ bool runtime::cpu::CPU_Backend::call(
return
true
;
}
void
runtime
::
cpu
::
CPU_Backend
::
remove_compiled_function
(
const
Function
&
func
)
void
runtime
::
cpu
::
CPU_Backend
::
remove_compiled_function
(
std
::
shared_ptr
<
Function
>
func
)
{
m_function_map
.
erase
(
&
func
);
m_function_map
.
erase
(
func
);
}
std
::
shared_ptr
<
ngraph
::
runtime
::
TensorView
>
runtime
::
cpu
::
CPU_Backend
::
make_primary_tensor_view
(
...
...
src/ngraph/runtime/cpu/cpu_backend.hpp
View file @
96604f12
...
...
@@ -51,16 +51,16 @@ namespace ngraph
create_tensor
(
const
ngraph
::
element
::
Type
&
element_type
,
const
Shape
&
shape
)
override
;
bool
compile
(
const
ngraph
::
Function
&
fun
)
override
;
bool
compile
(
std
::
shared_ptr
<
Function
>
func
)
override
;
bool
call
(
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
outputs
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
inputs
)
override
;
bool
call
(
const
ngraph
::
Function
&
fun
,
bool
call
(
std
::
shared_ptr
<
Function
>
func
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
outputs
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
inputs
)
override
;
void
remove_compiled_function
(
const
Function
&
func
)
override
;
void
remove_compiled_function
(
std
::
shared_ptr
<
Function
>
func
)
override
;
private
:
class
FunctionInstance
...
...
@@ -71,7 +71,7 @@ namespace ngraph
std
::
shared_ptr
<
Function
>
m_function
;
};
std
::
map
<
const
Function
*
,
FunctionInstance
>
m_function_map
;
std
::
map
<
std
::
shared_ptr
<
Function
>
,
FunctionInstance
>
m_function_map
;
};
}
}
...
...
src/ngraph/runtime/gpu/gpu_backend.cpp
View file @
96604f12
...
...
@@ -46,31 +46,31 @@ std::shared_ptr<ngraph::runtime::TensorView>
return
dynamic_pointer_cast
<
runtime
::
TensorView
>
(
rc
);
}
bool
runtime
::
gpu
::
GPU_Backend
::
compile
(
const
ngraph
::
Function
&
func
)
bool
runtime
::
gpu
::
GPU_Backend
::
compile
(
std
::
shared_ptr
<
Function
>
func
)
{
if
(
!
contains_key
(
m_function_map
,
&
func
))
if
(
!
contains_key
(
m_function_map
,
func
))
{
FunctionInstance
instance
;
instance
.
m_function
=
clone_function
(
func
)
;
instance
.
m_function
=
func
;
instance
.
m_external_function
=
make_shared
<
GPU_ExternalFunction
>
(
instance
.
m_function
);
auto
cf
=
instance
.
m_external_function
->
make_call_frame
();
instance
.
m_call_frame
=
dynamic_pointer_cast
<
GPU_CallFrame
>
(
cf
);
m_function_map
.
insert
({
&
func
,
instance
});
m_function_map
.
insert
({
func
,
instance
});
}
return
true
;
}
bool
runtime
::
gpu
::
GPU_Backend
::
call
(
const
ngraph
::
Function
&
func
,
std
::
shared_ptr
<
Function
>
func
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
outputs
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
inputs
)
{
bool
rc
=
true
;
auto
it
=
m_function_map
.
find
(
&
func
);
auto
it
=
m_function_map
.
find
(
func
);
if
(
it
==
m_function_map
.
end
())
{
compile
(
func
);
it
=
m_function_map
.
find
(
&
func
);
it
=
m_function_map
.
find
(
func
);
}
if
(
it
==
m_function_map
.
end
())
...
...
src/ngraph/runtime/gpu/gpu_backend.hpp
View file @
96604f12
...
...
@@ -52,12 +52,12 @@ namespace ngraph
create_tensor
(
const
ngraph
::
element
::
Type
&
element_type
,
const
Shape
&
shape
)
override
;
bool
compile
(
const
ngraph
::
Function
&
fun
)
override
;
bool
compile
(
std
::
shared_ptr
<
Function
>
func
)
override
;
bool
call
(
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
outputs
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
inputs
)
override
;
bool
call
(
const
ngraph
::
Function
&
fun
,
bool
call
(
std
::
shared_ptr
<
Function
>
func
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
outputs
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
inputs
)
override
;
...
...
@@ -70,7 +70,7 @@ namespace ngraph
std
::
shared_ptr
<
Function
>
m_function
;
};
std
::
map
<
const
Function
*
,
FunctionInstance
>
m_function_map
;
std
::
map
<
std
::
shared_ptr
<
Function
>
,
FunctionInstance
>
m_function_map
;
};
}
}
...
...
src/ngraph/runtime/interpreter/int_backend.cpp
View file @
96604f12
...
...
@@ -53,31 +53,31 @@ shared_ptr<ngraph::runtime::TensorView>
return
static_pointer_cast
<
runtime
::
TensorView
>
(
rc
);
}
bool
runtime
::
interpreter
::
INT_Backend
::
compile
(
const
ngraph
::
Function
&
func
)
bool
runtime
::
interpreter
::
INT_Backend
::
compile
(
std
::
shared_ptr
<
Function
>
func
)
{
if
(
!
contains_key
(
m_function_map
,
&
func
))
if
(
!
contains_key
(
m_function_map
,
func
))
{
FunctionInstance
instance
;
instance
.
m_function
=
clone_function
(
func
)
;
instance
.
m_function
=
func
;
instance
.
m_external_function
=
make_shared
<
interpreter
::
ExternalFunction
>
(
instance
.
m_function
);
auto
cf
=
instance
.
m_external_function
->
make_call_frame
();
instance
.
m_call_frame
=
dynamic_pointer_cast
<
interpreter
::
INT_CallFrame
>
(
cf
);
m_function_map
.
insert
({
&
func
,
instance
});
m_function_map
.
insert
({
func
,
instance
});
}
return
true
;
}
bool
runtime
::
interpreter
::
INT_Backend
::
call
(
const
Function
&
fun
,
bool
runtime
::
interpreter
::
INT_Backend
::
call
(
std
::
shared_ptr
<
Function
>
func
,
const
vector
<
shared_ptr
<
runtime
::
TensorView
>>&
outputs
,
const
vector
<
shared_ptr
<
runtime
::
TensorView
>>&
inputs
)
{
bool
rc
=
true
;
auto
it
=
m_function_map
.
find
(
&
fun
);
auto
it
=
m_function_map
.
find
(
func
);
if
(
it
==
m_function_map
.
end
())
{
compile
(
fun
);
it
=
m_function_map
.
find
(
&
fun
);
compile
(
fun
c
);
it
=
m_function_map
.
find
(
func
);
}
if
(
it
==
m_function_map
.
end
())
...
...
src/ngraph/runtime/interpreter/int_backend.hpp
View file @
96604f12
...
...
@@ -52,12 +52,12 @@ namespace ngraph
create_tensor
(
const
ngraph
::
element
::
Type
&
element_type
,
const
Shape
&
shape
)
override
;
bool
compile
(
const
ngraph
::
Function
&
fun
)
override
;
bool
compile
(
std
::
shared_ptr
<
Function
>
func
)
override
;
bool
call
(
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
outputs
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
inputs
)
override
;
bool
call
(
const
ngraph
::
Function
&
fun
,
bool
call
(
std
::
shared_ptr
<
Function
>
func
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
outputs
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
TensorView
>>&
inputs
)
override
;
...
...
@@ -70,7 +70,7 @@ namespace ngraph
std
::
shared_ptr
<
Function
>
m_function
;
};
std
::
map
<
const
Function
*
,
FunctionInstance
>
m_function_map
;
std
::
map
<
std
::
shared_ptr
<
Function
>
,
FunctionInstance
>
m_function_map
;
};
}
}
...
...
test/backend_test.in.cpp
View file @
96604f12
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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