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
af7c81a3
Commit
af7c81a3
authored
Jun 17, 2019
by
Scott Cyphers
Committed by
Robert Kimball
Jun 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove internal functions (#3079)
parent
52c0827d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
31 additions
and
125 deletions
+31
-125
CMakeLists.txt
src/ngraph/CMakeLists.txt
+0
-1
graph_util.cpp
src/ngraph/graph_util.cpp
+0
-27
graph_util.hpp
src/ngraph/graph_util.hpp
+6
-2
node.cpp
src/ngraph/node.cpp
+0
-5
node.hpp
src/ngraph/node.hpp
+0
-2
manager.cpp
src/ngraph/pass/manager.cpp
+3
-21
manager_state.cpp
src/ngraph/pass/manager_state.cpp
+0
-31
manager_state.hpp
src/ngraph/pass/manager_state.hpp
+9
-10
cpu_external_function.cpp
src/ngraph/runtime/cpu/cpu_external_function.cpp
+0
-0
gpu_compiled_function.cpp
src/ngraph/runtime/gpu/gpu_compiled_function.cpp
+1
-5
serializer.cpp
src/ngraph/serializer.cpp
+12
-21
No files found.
src/ngraph/CMakeLists.txt
View file @
af7c81a3
...
...
@@ -385,7 +385,6 @@ set (SRC
pass/liveness.hpp
pass/manager.cpp
pass/manager.hpp
pass/manager_state.cpp
pass/manager_state.hpp
pass/memory_layout.cpp
pass/memory_layout.hpp
...
...
src/ngraph/graph_util.cpp
View file @
af7c81a3
...
...
@@ -108,33 +108,6 @@ void ngraph::traverse_nodes(const NodeVector& subgraph_results,
}
}
void
ngraph
::
traverse_functions
(
std
::
shared_ptr
<
ngraph
::
Function
>
p
,
std
::
function
<
void
(
shared_ptr
<
Function
>
)
>
f
)
{
std
::
unordered_set
<
shared_ptr
<
Function
>>
instances_seen
;
deque
<
shared_ptr
<
Function
>>
stack
;
stack
.
push_front
(
p
);
while
(
stack
.
size
()
>
0
)
{
shared_ptr
<
Function
>
func
=
stack
.
front
();
if
(
instances_seen
.
find
(
func
)
==
instances_seen
.
end
())
{
instances_seen
.
insert
(
func
);
f
(
func
);
}
stack
.
pop_front
();
for
(
shared_ptr
<
Node
>
op
:
func
->
get_ops
())
{
for
(
shared_ptr
<
Function
>
fp
:
op
->
get_functions
())
{
stack
.
push_front
(
fp
);
}
}
}
}
NodeVector
ngraph
::
find_common_args
(
std
::
shared_ptr
<
Node
>
target
,
std
::
shared_ptr
<
Node
>
replacement
)
{
std
::
unordered_set
<
std
::
shared_ptr
<
Node
>>
target_args
;
...
...
src/ngraph/graph_util.hpp
View file @
af7c81a3
...
...
@@ -70,8 +70,12 @@ namespace ngraph
bool
include_control_deps
,
const
NodeVector
&
subgraph_params
=
{});
void
traverse_functions
(
std
::
shared_ptr
<
Function
>
p
,
std
::
function
<
void
(
std
::
shared_ptr
<
Function
>
)
>
f
);
inline
void
traverse_functions
(
std
::
shared_ptr
<
Function
>
p
,
std
::
function
<
void
(
std
::
shared_ptr
<
Function
>
)
>
f
)
NGRAPH_DEPRECATED
(
"Replace with f(p)"
)
{
f
(
p
);
};
void
replace_node
(
std
::
shared_ptr
<
Node
>
target
,
std
::
shared_ptr
<
Node
>
replacement
);
...
...
src/ngraph/node.cpp
View file @
af7c81a3
...
...
@@ -339,11 +339,6 @@ void Node::add_control_dependency(std::shared_ptr<Node> node)
m_control_dependencies
.
insert
(
node
);
}
std
::
vector
<
std
::
shared_ptr
<
Function
>>
Node
::
get_functions
()
const
{
return
std
::
vector
<
std
::
shared_ptr
<
Function
>>
{};
}
namespace
ngraph
{
ostream
&
operator
<<
(
ostream
&
out
,
const
Node
&
node
)
...
...
src/ngraph/node.hpp
View file @
af7c81a3
...
...
@@ -323,8 +323,6 @@ namespace ngraph
// Will be replaced with an OutputVector version
virtual
std
::
shared_ptr
<
Node
>
copy_with_new_args
(
const
NodeVector
&
new_args
)
const
=
0
;
virtual
std
::
vector
<
std
::
shared_ptr
<
Function
>>
get_functions
()
const
;
/// True if this and node have one output with same element type and shape
bool
has_same_type
(
std
::
shared_ptr
<
const
Node
>
node
)
const
;
...
...
src/ngraph/pass/manager.cpp
View file @
af7c81a3
...
...
@@ -61,27 +61,9 @@ void pass::Manager::run_passes(shared_ptr<Function> func, bool transitive)
{
bool
profile_enabled
=
getenv
(
"NGRAPH_PROFILE_PASS_ENABLE"
)
!=
nullptr
;
vector
<
std
::
pair
<
shared_ptr
<
Function
>
,
bool
>>
fs
;
if
(
transitive
)
{
// find all functions
traverse_functions
(
func
,
[
&
](
shared_ptr
<
Function
>
f
)
{
fs
.
push_back
(
std
::
make_pair
(
f
,
f
->
is_dynamic
()));
});
}
else
{
fs
=
{
std
::
make_pair
(
func
,
func
->
is_dynamic
())};
}
set
<
shared_ptr
<
Function
>>
tfs
;
std
::
vector
<
shared_ptr
<
Function
>>
f_array
;
for
(
auto
f_pair
:
fs
)
{
shared_ptr
<
Function
>
f
=
f_pair
.
first
;
tfs
.
insert
(
f
);
f_array
.
push_back
(
f
);
}
get_state
().
set_functions
(
tfs
);
get_state
().
set_function
(
func
);
vector
<
std
::
pair
<
shared_ptr
<
Function
>
,
bool
>>
fs
{
std
::
make_pair
(
func
,
func
->
is_dynamic
())};
vector
<
shared_ptr
<
Function
>>
f_array
{
func
};
size_t
index
=
0
;
stopwatch
pass_timer
;
...
...
src/ngraph/pass/manager_state.cpp
deleted
100644 → 0
View file @
52c0827d
//*****************************************************************************
// Copyright 2017-2019 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************
#include <iostream>
#include <memory>
#include "ngraph/function.hpp"
#include "ngraph/log.hpp"
#include "ngraph/node.hpp"
#include "ngraph/pass/manager_state.hpp"
using
namespace
std
;
using
namespace
ngraph
;
const
vector
<
shared_ptr
<
Function
>>&
pass
::
ManagerState
::
get_functions
()
{
return
m_function_list
;
}
src/ngraph/pass/manager_state.hpp
View file @
af7c81a3
...
...
@@ -41,15 +41,6 @@ namespace ngraph
class
ngraph
::
pass
::
ManagerState
{
public
:
const
std
::
vector
<
std
::
shared_ptr
<
Function
>>&
get_functions
();
template
<
typename
T
>
void
set_functions
(
const
T
&
collection
)
{
m_function_list
.
clear
();
m_function_list
.
insert
(
m_function_list
.
begin
(),
collection
.
begin
(),
collection
.
end
());
}
void
set_visualize_tree_ops_map
(
const
visualize_tree_ops_map_t
&
ops_map
)
{
m_visualize_tree_ops_map
=
ops_map
;
...
...
@@ -60,7 +51,15 @@ public:
return
m_visualize_tree_ops_map
;
}
void
set_function
(
const
std
::
shared_ptr
<
Function
>
function
)
{
m_function
=
function
;
}
std
::
shared_ptr
<
Function
>
get_function
()
const
{
return
m_function
;
}
std
::
vector
<
std
::
shared_ptr
<
Function
>>
get_functions
()
const
NGRAPH_DEPRECATED
(
"Use get_function()"
)
{
return
{
m_function
};
}
private
:
std
::
vector
<
std
::
shared_ptr
<
Function
>>
m_function_list
;
visualize_tree_ops_map_t
m_visualize_tree_ops_map
;
std
::
shared_ptr
<
Function
>
m_function
;
};
src/ngraph/runtime/cpu/cpu_external_function.cpp
View file @
af7c81a3
This diff is collapsed.
Click to expand it.
src/ngraph/runtime/gpu/gpu_compiled_function.cpp
View file @
af7c81a3
...
...
@@ -184,11 +184,7 @@ void runtime::gpu::GPUCompiledFunction::compile()
string
dump_filename
=
file_util
::
path_join
(
get_output_dir
(),
m_function_name
+
"_ops.txt"
);
pass_manager
.
register_pass
<
ngraph
::
pass
::
DumpSorted
>
(
dump_filename
);
pass_manager
.
run_passes
(
m_function
);
for
(
shared_ptr
<
Function
>
current_function
:
pass_manager
.
get_state
().
get_functions
())
{
m_function_ordered_ops
.
emplace
(
current_function
,
current_function
->
get_ordered_ops
());
}
m_function_ordered_ops
.
emplace
(
m_function
,
m_function
->
get_ordered_ops
());
add_passes
(
pass_manager
);
emit
();
...
...
src/ngraph/serializer.cpp
View file @
af7c81a3
...
...
@@ -340,33 +340,24 @@ static void serialize_to_cpio(ostream& out, shared_ptr<ngraph::Function> func, s
cpio
::
Writer
writer
(
out
);
writer
.
write
(
func
->
get_name
(),
j
.
c_str
(),
static_cast
<
uint32_t
>
(
j
.
size
()));
traverse_functions
(
func
,
[
&
](
shared_ptr
<
ngraph
::
Function
>
f
)
{
traverse_nodes
(
const_cast
<
Function
*>
(
f
.
get
()),
[
&
](
shared_ptr
<
Node
>
node
)
{
if
(
auto
c
=
dynamic_pointer_cast
<
op
::
Constant
>
(
node
))
{
uint32_t
size
=
static_cast
<
uint32_t
>
(
shape_size
(
c
->
get_output_shape
(
0
))
*
c
->
get_output_element_type
(
0
).
size
());
writer
.
write
(
c
->
get_name
(),
c
->
get_data_ptr
(),
size
);
}
},
true
);
});
traverse_nodes
(
const_cast
<
Function
*>
(
func
.
get
()),
[
&
](
shared_ptr
<
Node
>
node
)
{
if
(
auto
c
=
dynamic_pointer_cast
<
op
::
Constant
>
(
node
))
{
uint32_t
size
=
static_cast
<
uint32_t
>
(
shape_size
(
c
->
get_output_shape
(
0
))
*
c
->
get_output_element_type
(
0
).
size
());
writer
.
write
(
c
->
get_name
(),
c
->
get_data_ptr
(),
size
);
}
},
true
);
}
#endif
static
string
serialize
(
shared_ptr
<
ngraph
::
Function
>
func
,
size_t
indent
,
bool
binary_constant_data
)
{
json
j
;
vector
<
json
>
functions
;
traverse_functions
(
func
,
[
&
](
shared_ptr
<
ngraph
::
Function
>
f
)
{
functions
.
push_back
(
write
(
*
f
,
binary_constant_data
));
});
for
(
auto
it
=
functions
.
rbegin
();
it
!=
functions
.
rend
();
it
++
)
{
j
.
push_back
(
*
it
);
}
j
.
push_back
(
write
(
*
func
,
binary_constant_data
));
string
rc
;
if
(
indent
==
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