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
d0f8dff2
Unverified
Commit
d0f8dff2
authored
Feb 22, 2018
by
Robert Kimball
Committed by
GitHub
Feb 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add comments for every emitted function in CPU backend. (#509)
parent
8ad86ab9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
19 deletions
+16
-19
code_writer.cpp
src/ngraph/codegen/code_writer.cpp
+1
-1
cpu_external_function.cpp
src/ngraph/runtime/cpu/cpu_external_function.cpp
+12
-12
cpu_kernel_emitters.cpp
src/ngraph/runtime/cpu/cpu_kernel_emitters.cpp
+1
-4
cpu_kernel_utils.cpp
src/ngraph/runtime/cpu/cpu_kernel_utils.cpp
+2
-2
No files found.
src/ngraph/codegen/code_writer.cpp
View file @
d0f8dff2
...
...
@@ -40,7 +40,7 @@ std::string codegen::CodeWriter::generate_temporary_name(std::string prefix)
{
std
::
stringstream
ss
;
ss
<<
prefix
<<
"__"
<<
m_temporary_name_count
;
ss
<<
prefix
<<
m_temporary_name_count
;
m_temporary_name_count
++
;
return
ss
.
str
();
...
...
src/ngraph/runtime/cpu/cpu_external_function.cpp
View file @
d0f8dff2
...
...
@@ -284,13 +284,8 @@ void runtime::cpu::CPU_ExternalFunction::compile()
}
writer
+=
R"(// Generated by the
N
Graph CPU backend
R"(// Generated by the
n
Graph CPU backend
#include <cmath>
)"
;
writer
+=
R"(#include <Eigen/Dense>
#include "ngraph/except.hpp"
#include "ngraph/runtime/aligned_buffer.hpp"
#include "ngraph/runtime/cpu/cpu_eigen_utils.hpp"
...
...
@@ -669,7 +664,8 @@ using namespace ngraph::runtime;
throw
ngraph_error
(
"Unhandled op during code generation : "
+
node
->
description
());
}
vector
<
TensorViewWrapper
>
in
;
vector
<
string
>
node_input_names
,
node_output_names
;
vector
<
string
>
node_input_names
;
vector
<
string
>
node_output_names
;
for
(
const
descriptor
::
Input
&
input
:
node
->
get_inputs
())
{
const
descriptor
::
Output
&
output
=
input
.
get_output
();
...
...
@@ -714,19 +710,23 @@ using namespace ngraph::runtime;
}
}
writer
<<
"
\n
// "
<<
node
->
get_name
()
<<
"("
;
vector
<
string
>
parameter_nodes
=
node_input_names
;
parameter_nodes
.
insert
(
parameter_nodes
.
end
(),
node_output_names
.
begin
(),
node_output_names
.
end
());
writer
<<
join
(
parameter_nodes
);
writer
<<
")
\n
"
;
// Emit operation body
string
func_name
;
auto
it
=
match_functions
.
find
(
node
.
get
());
if
(
it
!=
match_functions
.
end
())
{
func_name
=
it
->
second
;
}
if
(
func_name
.
empty
())
if
(
it
==
match_functions
.
end
())
{
handler
->
second
(
this
,
writer
,
node
.
get
(),
in
,
out
);
}
else
{
func_name
=
it
->
second
;
vector
<
string
>
names
;
for
(
const
TensorViewWrapper
&
tv
:
in
)
{
...
...
src/ngraph/runtime/cpu/cpu_kernel_emitters.cpp
View file @
d0f8dff2
...
...
@@ -30,9 +30,6 @@ string emit_bracketed_string(vector<T> data)
{
stringstream
ss
;
if
(
data
.
size
()
==
0
)
return
""
;
for
(
auto
s
:
data
)
{
ss
<<
"["
<<
s
<<
"]"
;
...
...
@@ -75,7 +72,7 @@ vector<string>
vector
<
string
>
index_vars
;
for
(
size_t
i
=
0
;
i
<
top
.
size
();
i
++
)
{
string
index_var
=
writer
.
generate_temporary_name
(
"i"
);
string
index_var
=
writer
.
generate_temporary_name
(
"
_
i"
);
writer
<<
runtime
::
cpu
::
kernel
::
start_index_loop
(
index_var
,
new_bottom
[
i
],
top
[
i
],
i
==
0
);
writer
.
indent
++
;
...
...
src/ngraph/runtime/cpu/cpu_kernel_utils.cpp
View file @
d0f8dff2
...
...
@@ -149,7 +149,7 @@ string ngraph::runtime::cpu::kernel::end_index_loop(const string& index_var)
{
stringstream
ss
;
ss
<<
"}
// end for("
<<
index_var
<<
")
\n
"
;
ss
<<
"}
\n
"
;
return
ss
.
str
();
}
...
...
@@ -209,7 +209,7 @@ void ngraph::runtime::cpu::kernel::emit_pointwise_copy(codegen::CodeWriter& writ
for
(
size_t
i
=
0
;
i
<
n_axes
;
i
++
)
{
string
index_var
=
writer
.
generate_temporary_name
(
"
i
"
);
string
index_var
=
writer
.
generate_temporary_name
(
"
_j
"
);
writer
<<
start_index_loop
(
index_var
,
source_start_corner
[
i
],
source_end_corner
[
i
],
i
==
0
);
writer
.
indent
++
;
...
...
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