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
a87ee09e
Commit
a87ee09e
authored
Oct 15, 2018
by
amy.zhuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No in place concat immediately after non-concat in place ops.
parent
6ca1a511
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
memory_layout.cpp
src/ngraph/pass/memory_layout.cpp
+4
-1
cpu_memory_optimization.cpp
src/ngraph/runtime/cpu/pass/cpu_memory_optimization.cpp
+24
-0
No files found.
src/ngraph/pass/memory_layout.cpp
View file @
a87ee09e
...
...
@@ -74,6 +74,8 @@ bool pass::MemoryLayout::run_on_function(shared_ptr<ngraph::Function> function)
?
in_place_outputs
.
at
(
tensor
)
->
get_pool_offset
()
:
mm
.
allocate
(
tensor
->
size
());
tensor
->
set_pool_offset
(
offset
);
}
// check if the op is concat
if
(
auto
concat
=
std
::
dynamic_pointer_cast
<
op
::
Concat
>
(
node
))
{
...
...
@@ -82,6 +84,8 @@ bool pass::MemoryLayout::run_on_function(shared_ptr<ngraph::Function> function)
auto
in_place_oi_pairs
=
op_annotations
->
get_in_place_oi_pairs
();
if
(
in_place_oi_pairs
.
size
()
>
0
)
{
auto
output_tensor
=
&
concat
->
get_output_tensor
();
auto
offset
=
output_tensor
->
get_pool_offset
();
for
(
auto
arg
:
concat
->
get_arguments
())
{
auto
input_node
=
std
::
dynamic_pointer_cast
<
op
::
Op
>
(
arg
);
...
...
@@ -95,7 +99,6 @@ bool pass::MemoryLayout::run_on_function(shared_ptr<ngraph::Function> function)
}
}
}
}
if
(
!
m_disable_memory_sharing
)
{
...
...
src/ngraph/runtime/cpu/pass/cpu_memory_optimization.cpp
View file @
a87ee09e
...
...
@@ -66,6 +66,30 @@ bool runtime::cpu::pass::CPUMemoryOptimization::run_on_function(std::shared_ptr<
break
;
}
if
(
arg
->
get_output_size
()
!=
1
)
{
NGRAPH_DEBUG
<<
"cpu_post_layout_assignment: "
<<
arg
->
get_name
()
<<
": multiple outputs, no in place concat"
;
in_place_concat
=
false
;
break
;
}
if
(
!
std
::
dynamic_pointer_cast
<
op
::
Concat
>
(
arg
))
{
if
(
auto
op
=
std
::
dynamic_pointer_cast
<
op
::
Op
>
(
arg
))
{
auto
annotation
=
op
->
get_op_annotations
();
if
(
annotation
&&
annotation
->
get_in_place_oi_pairs
().
size
()
>
0
)
{
NGRAPH_DEBUG
<<
"cpu_post_layout_assignment: "
<<
arg
->
get_name
()
<<
": in place non concat op, no in place concat"
;
in_place_concat
=
false
;
break
;
}
}
}
if
(
output
.
get_inputs
().
size
()
!=
1
)
{
// check if we can do in place concat
...
...
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