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
a5b75e36
Commit
a5b75e36
authored
Feb 06, 2018
by
Jayaram Bobba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conditionally emit mkldnn headers
parent
924ec039
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
5 deletions
+26
-5
cpu_emitter.cpp
src/ngraph/runtime/cpu/cpu_emitter.cpp
+2
-0
cpu_external_function.cpp
src/ngraph/runtime/cpu/cpu_external_function.cpp
+24
-5
No files found.
src/ngraph/runtime/cpu/cpu_emitter.cpp
View file @
a5b75e36
...
...
@@ -90,6 +90,8 @@ static const string& get_mkldnn_data_type(const string& type)
void
runtime
::
cpu
::
CPU_Emitter
::
EmitMKLDNNPreamble
(
codegen
::
CodeWriter
&
writer
)
{
writer
<<
"// MKLDNN Preamble
\n
"
;
writer
<<
"#include <mkldnn.hpp>;
\n
"
;
writer
<<
"using namespace mkldnn;
\n\n
"
;
}
...
...
src/ngraph/runtime/cpu/cpu_external_function.cpp
100755 → 100644
View file @
a5b75e36
...
...
@@ -230,15 +230,25 @@ void runtime::cpu::CPU_ExternalFunction::compile()
codegen
::
CodeWriter
writer
;
bool
include_mkldnn_headers
=
false
;
for
(
shared_ptr
<
Function
>
current_function
:
pass_manager
.
get_state
().
get_functions
())
{
for
(
shared_ptr
<
Node
>
node
:
current_function
->
get_ordered_ops
())
{
if
(
dynamic_cast
<
op
::
Convolution
*>
(
node
.
get
())
||
dynamic_cast
<
op
::
AvgPool
*>
(
node
.
get
())
||
dynamic_cast
<
op
::
MaxPool
*>
(
node
.
get
()))
{
include_mkldnn_headers
=
true
;
}
}
}
writer
+=
R"(// Generated by the NGraph CPU backend
#include <cmath>
#include <tbb/flow_graph.h>
#include <Eigen/Dense>
#include <mkldnn.hpp>
#include "ngraph/runtime/aligned_buffer.hpp"
#include "ngraph/runtime/cpu/cpu_eigen_utils.hpp"
#include "ngraph/runtime/cpu/cpu_kernels.hpp"
...
...
@@ -264,6 +274,17 @@ using namespace ngraph::runtime::cpu::eigen;
using namespace ngraph::runtime;
)"
;
if
(
m_use_tbb
)
{
writer
<<
"#include <tbb/flow_graph.h>
\n
"
;
}
if
(
include_mkldnn_headers
)
{
runtime
::
cpu
::
CPU_Emitter
::
EmitMKLDNNPreamble
(
writer
);
}
string
pch_header_source
=
writer
.
get_code
();
// The "dso_handle" symbol is required by __cxa_atexit()
...
...
@@ -364,8 +385,6 @@ using namespace ngraph::runtime;
}
}
runtime
::
cpu
::
CPU_Emitter
::
EmitMKLDNNPreamble
(
writer
);
writer
<<
"// Declare all functions
\n
"
;
for
(
shared_ptr
<
Function
>
f
:
pass_manager
.
get_state
().
get_functions
())
{
...
...
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