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
cd74b8f0
Commit
cd74b8f0
authored
Feb 17, 2018
by
Jaikrishnan Menon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CPU: Propagate staged primitives to the runtime context
parent
c9c01be1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
6 deletions
+13
-6
cpu_call_frame.cpp
src/ngraph/runtime/cpu/cpu_call_frame.cpp
+2
-0
cpu_emitter.cpp
src/ngraph/runtime/cpu/cpu_emitter.cpp
+4
-4
cpu_external_function.cpp
src/ngraph/runtime/cpu/cpu_external_function.cpp
+1
-0
cpu_runtime_context.hpp
src/ngraph/runtime/cpu/cpu_runtime_context.hpp
+1
-1
mkldnn_emitter.cpp
src/ngraph/runtime/cpu/mkldnn_emitter.cpp
+5
-1
No files found.
src/ngraph/runtime/cpu/cpu_call_frame.cpp
View file @
cd74b8f0
...
...
@@ -142,6 +142,8 @@ void runtime::cpu::CPU_CallFrame::setup_runtime_context()
{
ctx
->
op_durations
=
new
int64_t
[
m_external_function
->
get_op_attrs
().
size
()];
}
const
auto
&
mkldnn_emitter
=
m_external_function
->
get_mkldnn_emitter
();
ctx
->
mkldnn_primitives
=
mkldnn_emitter
->
get_mkldnn_primitives
().
data
();
}
void
runtime
::
cpu
::
CPU_CallFrame
::
cleanup_runtime_context
()
...
...
src/ngraph/runtime/cpu/cpu_emitter.cpp
View file @
cd74b8f0
...
...
@@ -1826,11 +1826,11 @@ void runtime::cpu::CPU_Emitter::EMITTER_DECL(EmitConvolution)
convolution
->
get_padding_above
());
auto
&
deps
=
mkldnn_emitter
->
get_primitive_deps
(
conv_index
);
writer
<<
"mkldnn_utils::set_memory_ptr(ctx, "
<<
to_string
(
deps
[
0
])
<<
", "
<<
args
[
0
].
get_name
()
<<
");
\n
"
;
writer
<<
"mkldnn_utils::set_memory_ptr(ctx, "
<<
to_string
(
deps
[
1
])
<<
", "
<<
args
[
1
].
get_name
()
<<
");
\n
"
;
writer
<<
"mkldnn_utils::set_memory_ptr(ctx, "
<<
to_string
(
deps
[
2
])
<<
", "
<<
out
[
0
].
get_name
()
<<
");
\n
"
;
writer
<<
"
cpu::
mkldnn_utils::set_memory_ptr(ctx, "
<<
to_string
(
deps
[
0
])
<<
", "
<<
args
[
0
].
get_name
()
<<
");
\n
"
;
writer
<<
"
cpu::
mkldnn_utils::set_memory_ptr(ctx, "
<<
to_string
(
deps
[
1
])
<<
", "
<<
args
[
1
].
get_name
()
<<
");
\n
"
;
writer
<<
"
cpu::
mkldnn_utils::set_memory_ptr(ctx, "
<<
to_string
(
deps
[
2
])
<<
", "
<<
out
[
0
].
get_name
()
<<
");
\n
"
;
writer
<<
"
mkldnn_utils::mkldnn_invok
e(ctx, "
<<
to_string
(
conv_index
)
<<
");
\n
"
;
writer
<<
"
cpu::mkldnn_utils::mkldnn_invoke_primitiv
e(ctx, "
<<
to_string
(
conv_index
)
<<
");
\n
"
;
#endif
}
else
if
(
filter_dilated
&&
!
data_dilated
&&
arg0_rank
==
4
&&
arg1_rank
==
4
&&
...
...
src/ngraph/runtime/cpu/cpu_external_function.cpp
View file @
cd74b8f0
...
...
@@ -268,6 +268,7 @@ void runtime::cpu::CPU_ExternalFunction::compile()
#include "ngraph/runtime/cpu/cpu_eigen_utils.hpp"
#include "ngraph/runtime/cpu/cpu_kernels.hpp"
#include "ngraph/runtime/cpu/cpu_runtime_context.hpp"
#include "ngraph/runtime/cpu/mkldnn_invoke.hpp"
#include "ngraph/runtime/kernel/avg_pool.hpp"
#include "ngraph/runtime/kernel/broadcast.hpp"
#include "ngraph/runtime/kernel/concat.hpp"
...
...
src/ngraph/runtime/cpu/cpu_runtime_context.hpp
View file @
cd74b8f0
...
...
@@ -36,7 +36,7 @@ namespace ngraph
struct
CPURuntimeContext
{
int64_t
*
op_durations
;
mkldnn
::
primitive
**
mkldnn_primitives
;
mkldnn
::
primitive
*
const
*
mkldnn_primitives
;
};
}
}
...
...
src/ngraph/runtime/cpu/mkldnn_emitter.cpp
View file @
cd74b8f0
...
...
@@ -59,8 +59,12 @@ mkldnn::memory MKLDNNEmitter::build_memory_primitive(const TensorViewWrapper& tv
size_t
MKLDNNEmitter
::
build_memory_primitive
(
const
mkldnn
::
memory
::
desc
&
desc
)
{
// The MKL-DNN C++ API forces proper initialization of a memory primitive
// with a non-null pointer (unlike the C API)
// Primitives are initialized at runtime so we use a known-invalid address here
// to bypass this check
return
insert_primitive
(
new
mkldnn
::
memory
({
desc
,
mkldnn_utils
::
global_cpu_engine
},
nullptr
)
new
mkldnn
::
memory
({
desc
,
mkldnn_utils
::
global_cpu_engine
},
reinterpret_cast
<
void
*>
(
0x42
)
)
);
}
...
...
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