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
87197ec3
Commit
87197ec3
authored
Oct 24, 2018
by
amy.zhuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No in place concat if input format differs from output format.
parent
8f102516
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
cpu_emitter.cpp
src/ngraph/runtime/cpu/cpu_emitter.cpp
+3
-3
cpu_memory_optimization.cpp
src/ngraph/runtime/cpu/pass/cpu_memory_optimization.cpp
+19
-0
No files found.
src/ngraph/runtime/cpu/cpu_emitter.cpp
View file @
87197ec3
...
...
@@ -1006,19 +1006,19 @@ namespace ngraph
{
writer
<<
"if ("
<<
args
[
i
].
get_name
()
<<
" < "
<<
out
[
0
].
get_name
()
<<
" || "
<<
args
[
i
].
get_name
()
<<
" >= "
<<
out
[
0
].
get_name
()
<<
" + "
<<
out
[
0
].
get_size
()
<<
")
\n
"
;
<<
" + "
<<
out
[
0
].
get_size
()
*
out
[
0
].
get_element_type
().
size
()
<<
")
\n
"
;
writer
.
block_begin
();
writer
<<
"memcpy("
<<
out
[
0
].
get_name
()
<<
" + "
<<
offset
<<
", "
<<
args
[
i
].
get_name
()
<<
", "
<<
args
[
i
].
get_size
()
*
out
[
0
].
get_element_type
().
size
()
<<
");
\n
"
;
writer
.
block_end
();
offset
+=
args
[
i
].
get_size
();
offset
+=
args
[
i
].
get_size
()
*
out
[
0
].
get_element_type
().
size
()
;
}
return
;
}
}
auto
result_shape
=
out
[
0
].
get_shape
();
#if USE_EIGEN_CORE_INLINE == 1
...
...
src/ngraph/runtime/cpu/pass/cpu_memory_optimization.cpp
View file @
87197ec3
...
...
@@ -78,6 +78,25 @@ bool runtime::cpu::pass::CPUMemoryOptimization::run_on_function(std::shared_ptr<
}
bool
in_place_concat
=
true
;
auto
output_md
=
mkldnn_utils
::
get_output_mkldnn_md
(
n
.
get
(),
0
);
auto
output_format
=
static_cast
<
mkldnn
::
memory
::
format
>
(
output_md
.
data
.
format
);
for
(
size_t
i
=
0
;
i
<
n
->
get_input_size
();
i
++
)
{
auto
input_md
=
mkldnn_utils
::
get_input_mkldnn_md
(
n
.
get
(),
i
);
auto
input_format
=
static_cast
<
mkldnn
::
memory
::
format
>
(
input_md
.
data
.
format
);
if
(
output_format
!=
input_format
)
{
NGRAPH_DEBUG
<<
"cpu_memory_optimization: input format is different from "
"output format, no in place concat"
;
in_place_concat
=
false
;
break
;
}
}
if
(
!
in_place_concat
)
{
continue
;
}
AxisVector
axis_list
=
ngraph
::
get_default_order
(
shape
);
auto
index
=
0
;
...
...
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