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
c7cc170c
Commit
c7cc170c
authored
Sep 19, 2017
by
Bob Kimball
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new directory layout
parent
1c78e9f3
Hide whitespace changes
Inline
Side-by-side
Showing
113 changed files
with
1027 additions
and
1027 deletions
+1027
-1027
CMakeLists.txt
src/CMakeLists.txt
+23
-23
common.hpp
src/common.hpp
+0
-0
buffer.hpp
src/descriptor/buffer.hpp
+0
-0
call_frame.hpp
src/descriptor/call_frame.hpp
+2
-2
input.cpp
src/descriptor/input.cpp
+1
-1
input.hpp
src/descriptor/input.hpp
+1
-1
output.cpp
src/descriptor/output.cpp
+1
-1
output.hpp
src/descriptor/output.hpp
+1
-1
tensor.cpp
src/descriptor/tensor.cpp
+2
-2
tensor.hpp
src/descriptor/tensor.hpp
+0
-0
tensor_view.cpp
src/descriptor/tensor_view.cpp
+1
-1
tensor_view.hpp
src/descriptor/tensor_view.hpp
+3
-3
tensor_view_layout.hpp
src/descriptor/tensor_view_layout.hpp
+0
-0
except.hpp
src/except.hpp
+0
-0
function.cpp
src/function.cpp
+1
-1
function.hpp
src/function.hpp
+6
-6
ngraph.hpp
src/ngraph.hpp
+68
-0
ngraph.hpp
src/ngraph/ngraph.hpp
+0
-68
node.cpp
src/node.cpp
+0
-0
node.hpp
src/node.hpp
+2
-2
abs.hpp
src/ops/abs.hpp
+0
-0
add.hpp
src/ops/add.hpp
+0
-0
binary_elementwise_arithmetic.cpp
src/ops/binary_elementwise_arithmetic.cpp
+1
-1
binary_elementwise_builtin.cpp
src/ops/binary_elementwise_builtin.cpp
+1
-1
binary_elementwise_comparison.cpp
src/ops/binary_elementwise_comparison.cpp
+1
-1
broadcast.cpp
src/ops/broadcast.cpp
+1
-1
broadcast.hpp
src/ops/broadcast.hpp
+0
-0
ceiling.hpp
src/ops/ceiling.hpp
+0
-0
concatenate.cpp
src/ops/concatenate.cpp
+1
-1
concatenate.hpp
src/ops/concatenate.hpp
+0
-0
constant.cpp
src/ops/constant.cpp
+1
-1
constant.hpp
src/ops/constant.hpp
+2
-2
convert.cpp
src/ops/convert.cpp
+1
-1
convert.hpp
src/ops/convert.hpp
+0
-0
divide.hpp
src/ops/divide.hpp
+0
-0
dot.cpp
src/ops/dot.cpp
+1
-1
dot.hpp
src/ops/dot.hpp
+0
-0
equal.hpp
src/ops/equal.hpp
+0
-0
exp.hpp
src/ops/exp.hpp
+0
-0
floor.hpp
src/ops/floor.hpp
+0
-0
greater.hpp
src/ops/greater.hpp
+0
-0
less.hpp
src/ops/less.hpp
+0
-0
log.hpp
src/ops/log.hpp
+0
-0
maximum.hpp
src/ops/maximum.hpp
+0
-0
minimum.hpp
src/ops/minimum.hpp
+0
-0
multiply.hpp
src/ops/multiply.hpp
+0
-0
negative.hpp
src/ops/negative.hpp
+0
-0
op.cpp
src/ops/op.cpp
+1
-1
op.hpp
src/ops/op.hpp
+3
-3
parameter.cpp
src/ops/parameter.cpp
+1
-1
parameter.hpp
src/ops/parameter.hpp
+2
-2
power.hpp
src/ops/power.hpp
+0
-0
remainder.hpp
src/ops/remainder.hpp
+0
-0
subtract.hpp
src/ops/subtract.hpp
+0
-0
tuple.cpp
src/ops/tuple.cpp
+1
-1
tuple.hpp
src/ops/tuple.hpp
+0
-0
unary_elementwise_arithmetic.cpp
src/ops/unary_elementwise_arithmetic.cpp
+1
-1
unary_elementwise_builtin.cpp
src/ops/unary_elementwise_builtin.cpp
+1
-1
assign_tensors.cpp
src/pass/assign_tensors.cpp
+1
-1
assign_tensors.hpp
src/pass/assign_tensors.hpp
+0
-0
call_pass.cpp
src/pass/call_pass.cpp
+15
-15
call_pass.hpp
src/pass/call_pass.hpp
+42
-42
dump_sorted.cpp
src/pass/dump_sorted.cpp
+1
-1
dump_sorted.hpp
src/pass/dump_sorted.hpp
+0
-0
liveness.cpp
src/pass/liveness.cpp
+172
-172
liveness.hpp
src/pass/liveness.hpp
+39
-39
manager.cpp
src/pass/manager.cpp
+76
-76
manager.hpp
src/pass/manager.hpp
+51
-51
memory_layout.cpp
src/pass/memory_layout.cpp
+227
-227
memory_layout.hpp
src/pass/memory_layout.hpp
+97
-97
pass.cpp
src/pass/pass.cpp
+15
-15
pass.hpp
src/pass/pass.hpp
+29
-29
propagate_types.cpp
src/pass/propagate_types.cpp
+1
-1
propagate_types.hpp
src/pass/propagate_types.hpp
+0
-0
topological_sort.cpp
src/pass/topological_sort.cpp
+2
-2
topological_sort.hpp
src/pass/topological_sort.hpp
+1
-1
tree_pass.cpp
src/pass/tree_pass.cpp
+15
-15
tree_pass.hpp
src/pass/tree_pass.hpp
+46
-46
visualize_tree.cpp
src/pass/visualize_tree.cpp
+1
-1
visualize_tree.hpp
src/pass/visualize_tree.hpp
+1
-1
call_frame.cpp
src/runtime/call_frame.cpp
+1
-1
call_frame.hpp
src/runtime/call_frame.hpp
+3
-3
add.hpp
src/runtime/eigen/add.hpp
+3
-3
external_function.cpp
src/runtime/eigen/external_function.cpp
+11
-11
external_function.hpp
src/runtime/eigen/external_function.hpp
+1
-1
multiply.hpp
src/runtime/eigen/multiply.hpp
+2
-2
return.hpp
src/runtime/eigen/return.hpp
+2
-2
tensor_view.cpp
src/runtime/eigen/tensor_view.cpp
+0
-0
tensor_view.hpp
src/runtime/eigen/tensor_view.hpp
+3
-3
instruction.hpp
src/runtime/instruction.hpp
+0
-0
tensor_view.hpp
src/runtime/tensor_view.hpp
+0
-0
shape.cpp
src/shape.cpp
+1
-1
shape.hpp
src/shape.hpp
+0
-0
element_type.cpp
src/types/element_type.cpp
+1
-1
element_type.hpp
src/types/element_type.hpp
+1
-1
type.cpp
src/types/type.cpp
+1
-1
type.hpp
src/types/type.hpp
+2
-2
util.cpp
src/util.cpp
+1
-1
visualize.cpp
src/visualize.cpp
+2
-2
visualize.hpp
src/visualize.hpp
+0
-0
build_graph.cpp
test/build_graph.cpp
+1
-1
element_type.cpp
test/element_type.cpp
+1
-1
execute.cpp
test/execute.cpp
+1
-1
input_output_assign.cpp
test/input_output_assign.cpp
+1
-1
op.cpp
test/op.cpp
+1
-1
pass_liveness.cpp
test/pass_liveness.cpp
+9
-9
pass_manager.cpp
test/pass_manager.cpp
+5
-5
pass_memory_layout.cpp
test/pass_memory_layout.cpp
+2
-2
runtime.cpp
test/runtime.cpp
+1
-1
shape.cpp
test/shape.cpp
+1
-1
test_tools.cpp
test/test_tools.cpp
+1
-1
topological_sort.cpp
test/topological_sort.cpp
+3
-3
type_prop.cpp
test/type_prop.cpp
+1
-1
No files found.
src/CMakeLists.txt
View file @
c7cc170c
...
...
@@ -15,29 +15,29 @@ include_directories(SYSTEM ${EIGEN_INCLUDE_DIR})
set
(
SRC
log.cpp
ngraph/
descriptor/input.cpp
ngraph/
descriptor/output.cpp
ngraph/
descriptor/tensor_view.cpp
ngraph/
descriptor/tensor.cpp
ngraph/
function.cpp
n
graph/n
ode.cpp
ngraph/
shape.cpp
ngraph/
pass/assign_tensors.cpp
ngraph/
pass/call_pass.cpp
ngraph/
pass/dump_sorted.cpp
ngraph/
pass/liveness.cpp
ngraph/
pass/manager.cpp
ngraph/
pass/memory_layout.cpp
ngraph/
pass/pass.cpp
ngraph/
pass/propagate_types.cpp
ngraph/
pass/topological_sort.cpp
ngraph/
pass/tree_pass.cpp
ngraph/
pass/visualize_tree.cpp
ngraph/
runtime/call_frame.cpp
ngraph/
runtime/eigen/external_function.cpp
ngraph/
runtime/eigen/tensor_view.cpp
ngraph/
shape.cpp
ngraph/
visualize.cpp
descriptor/input.cpp
descriptor/output.cpp
descriptor/tensor_view.cpp
descriptor/tensor.cpp
function.cpp
node.cpp
shape.cpp
pass/assign_tensors.cpp
pass/call_pass.cpp
pass/dump_sorted.cpp
pass/liveness.cpp
pass/manager.cpp
pass/memory_layout.cpp
pass/pass.cpp
pass/propagate_types.cpp
pass/topological_sort.cpp
pass/tree_pass.cpp
pass/visualize_tree.cpp
runtime/call_frame.cpp
runtime/eigen/external_function.cpp
runtime/eigen/tensor_view.cpp
shape.cpp
visualize.cpp
ops/binary_elementwise_arithmetic.cpp
ops/binary_elementwise_builtin.cpp
ops/binary_elementwise_comparison.cpp
...
...
src/
ngraph/
common.hpp
→
src/common.hpp
View file @
c7cc170c
File moved
src/
ngraph/
descriptor/buffer.hpp
→
src/descriptor/buffer.hpp
View file @
c7cc170c
File moved
src/
ngraph/
descriptor/call_frame.hpp
→
src/descriptor/call_frame.hpp
View file @
c7cc170c
...
...
@@ -17,8 +17,8 @@
#include <memory>
#include <vector>
#include "
ngraph/
descriptor/tensor_view.hpp"
#include "
ngraph/
function.hpp"
#include "descriptor/tensor_view.hpp"
#include "function.hpp"
namespace
ngraph
{
...
...
src/
ngraph/
descriptor/input.cpp
→
src/descriptor/input.cpp
View file @
c7cc170c
...
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
src/
ngraph/
descriptor/input.hpp
→
src/descriptor/input.hpp
View file @
c7cc170c
...
...
@@ -16,7 +16,7 @@
#include <memory>
#include "
ngraph/
descriptor/tensor.hpp"
#include "descriptor/tensor.hpp"
namespace
ngraph
{
...
...
src/
ngraph/
descriptor/output.cpp
→
src/descriptor/output.cpp
View file @
c7cc170c
...
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
src/
ngraph/
descriptor/output.hpp
→
src/descriptor/output.hpp
View file @
c7cc170c
...
...
@@ -17,7 +17,7 @@
#include <memory>
#include <set>
#include "
ngraph/
descriptor/tensor_view.hpp"
#include "descriptor/tensor_view.hpp"
namespace
ngraph
{
...
...
src/
ngraph/
descriptor/tensor.cpp
→
src/descriptor/tensor.cpp
View file @
c7cc170c
...
...
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include "
ngraph/
descriptor/tensor.hpp"
#include "n
graph/n
ode.hpp"
#include "descriptor/tensor.hpp"
#include "node.hpp"
using
namespace
ngraph
;
using
namespace
descriptor
;
...
...
src/
ngraph/
descriptor/tensor.hpp
→
src/descriptor/tensor.hpp
View file @
c7cc170c
File moved
src/
ngraph/
descriptor/tensor_view.cpp
→
src/descriptor/tensor_view.cpp
View file @
c7cc170c
...
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include "
ngraph/
descriptor/tensor_view.hpp"
#include "descriptor/tensor_view.hpp"
using
namespace
ngraph
;
using
namespace
descriptor
;
...
...
src/
ngraph/
descriptor/tensor_view.hpp
→
src/descriptor/tensor_view.hpp
View file @
c7cc170c
...
...
@@ -14,9 +14,9 @@
#pragma once
#include "
ngraph/
descriptor/tensor.hpp"
#include "
ngraph/
shape.hpp"
#include "
ngraph
/type.hpp"
#include "descriptor/tensor.hpp"
#include "shape.hpp"
#include "
types
/type.hpp"
#include "log.hpp"
namespace
ngraph
...
...
src/
ngraph/
descriptor/tensor_view_layout.hpp
→
src/descriptor/tensor_view_layout.hpp
View file @
c7cc170c
File moved
src/
ngraph/
except.hpp
→
src/except.hpp
View file @
c7cc170c
File moved
src/
ngraph/
function.cpp
→
src/function.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include <memory>
#include "
ngraph/
function.hpp"
#include "function.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
src/
ngraph/
function.hpp
→
src/function.hpp
View file @
c7cc170c
...
...
@@ -14,12 +14,12 @@
#pragma once
#include "
ngraph/
descriptor/tensor_view.hpp"
#include "n
graph/n
ode.hpp"
#include "
ngraph
/op.hpp"
#include "
ngraph/
ops/parameter.hpp"
#include "
ngraph/
runtime/instruction.hpp"
#include "
ngraph
/type.hpp"
#include "descriptor/tensor_view.hpp"
#include "node.hpp"
#include "
ops
/op.hpp"
#include "ops/parameter.hpp"
#include "runtime/instruction.hpp"
#include "
types
/type.hpp"
namespace
ngraph
{
...
...
src/ngraph.hpp
0 → 100644
View file @
c7cc170c
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
//
// The public API for ngraph++
//
#pragma once
#include "common.hpp"
#include "descriptor/buffer.hpp"
#include "descriptor/call_frame.hpp"
#include "descriptor/input.hpp"
#include "descriptor/output.hpp"
#include "descriptor/tensor.hpp"
#include "descriptor/tensor_view.hpp"
#include "descriptor/tensor_view_layout.hpp"
#include "types/element_type.hpp"
#include "except.hpp"
#include "function.hpp"
#include "node.hpp"
#include "ops/abs.hpp"
#include "ops/add.hpp"
#include "ops/broadcast.hpp"
#include "ops/ceiling.hpp"
#include "ops/concatenate.hpp"
#include "ops/constant.hpp"
#include "ops/convert.hpp"
#include "ops/divide.hpp"
#include "ops/dot.hpp"
#include "ops/equal.hpp"
#include "ops/exp.hpp"
#include "ops/floor.hpp"
#include "ops/greater.hpp"
#include "ops/less.hpp"
#include "ops/log.hpp"
#include "ops/maximum.hpp"
#include "ops/minimum.hpp"
#include "ops/multiply.hpp"
#include "ops/negative.hpp"
#include "ops/op.hpp"
#include "ops/parameter.hpp"
#include "ops/power.hpp"
#include "ops/remainder.hpp"
#include "ops/subtract.hpp"
#include "ops/tuple.hpp"
#include "runtime/eigen/add.hpp"
#include "runtime/eigen/external_function.hpp"
#include "runtime/eigen/multiply.hpp"
#include "runtime/eigen/return.hpp"
#include "runtime/eigen/tensor_view.hpp"
#include "runtime/call_frame.hpp"
#include "function.hpp"
#include "runtime/instruction.hpp"
#include "runtime/tensor_view.hpp"
#include "shape.hpp"
#include "types/type.hpp"
src/ngraph/ngraph.hpp
deleted
100644 → 0
View file @
1c78e9f3
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
//
// The public API for ngraph++
//
#pragma once
#include "ngraph/common.hpp"
#include "ngraph/descriptor/buffer.hpp"
#include "ngraph/descriptor/call_frame.hpp"
#include "ngraph/descriptor/input.hpp"
#include "ngraph/descriptor/output.hpp"
#include "ngraph/descriptor/tensor.hpp"
#include "ngraph/descriptor/tensor_view.hpp"
#include "ngraph/descriptor/tensor_view_layout.hpp"
#include "ngraph/element_type.hpp"
#include "ngraph/except.hpp"
#include "ngraph/function.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op.hpp"
#include "ngraph/ops/abs.hpp"
#include "ngraph/ops/add.hpp"
#include "ngraph/ops/broadcast.hpp"
#include "ngraph/ops/ceiling.hpp"
#include "ngraph/ops/concatenate.hpp"
#include "ngraph/ops/constant.hpp"
#include "ngraph/ops/convert.hpp"
#include "ngraph/ops/divide.hpp"
#include "ngraph/ops/dot.hpp"
#include "ngraph/ops/equal.hpp"
#include "ngraph/ops/exp.hpp"
#include "ngraph/ops/floor.hpp"
#include "ngraph/ops/greater.hpp"
#include "ngraph/ops/less.hpp"
#include "ngraph/ops/log.hpp"
#include "ngraph/ops/maximum.hpp"
#include "ngraph/ops/minimum.hpp"
#include "ngraph/ops/multiply.hpp"
#include "ngraph/ops/negative.hpp"
#include "ngraph/ops/parameter.hpp"
#include "ngraph/ops/power.hpp"
#include "ngraph/ops/remainder.hpp"
#include "ngraph/ops/subtract.hpp"
#include "ngraph/ops/tuple.hpp"
#include "ngraph/runtime/eigen/add.hpp"
#include "ngraph/runtime/eigen/external_function.hpp"
#include "ngraph/runtime/eigen/multiply.hpp"
#include "ngraph/runtime/eigen/return.hpp"
#include "ngraph/runtime/eigen/tensor_view.hpp"
#include "ngraph/runtime/call_frame.hpp"
#include "ngraph/function.hpp"
#include "ngraph/runtime/instruction.hpp"
#include "ngraph/runtime/tensor_view.hpp"
#include "ngraph/shape.hpp"
#include "ngraph/type.hpp"
src/n
graph/n
ode.cpp
→
src/node.cpp
View file @
c7cc170c
File moved
src/n
graph/n
ode.hpp
→
src/node.hpp
View file @
c7cc170c
...
...
@@ -21,8 +21,8 @@
#include <iostream>
#include "
ngraph/
common.hpp"
#include "
ngraph
/type.hpp"
#include "common.hpp"
#include "
types
/type.hpp"
namespace
ngraph
{
...
...
src/
ngraph/
ops/abs.hpp
→
src/ops/abs.hpp
View file @
c7cc170c
File moved
src/
ngraph/
ops/add.hpp
→
src/ops/add.hpp
View file @
c7cc170c
File moved
src/ops/binary_elementwise_arithmetic.cpp
View file @
c7cc170c
...
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
src/ops/binary_elementwise_builtin.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include <memory>
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
#include "log.hpp"
using
namespace
std
;
...
...
src/ops/binary_elementwise_comparison.cpp
View file @
c7cc170c
...
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
src/ops/broadcast.cpp
View file @
c7cc170c
...
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
::
op
;
...
...
src/
ngraph/
ops/broadcast.hpp
→
src/ops/broadcast.hpp
View file @
c7cc170c
File moved
src/
ngraph/
ops/ceiling.hpp
→
src/ops/ceiling.hpp
View file @
c7cc170c
File moved
src/ops/concatenate.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include <memory>
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
::
op
;
...
...
src/
ngraph/
ops/concatenate.hpp
→
src/ops/concatenate.hpp
View file @
c7cc170c
File moved
src/ops/constant.cpp
View file @
c7cc170c
...
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
ngraph
::
op
;
...
...
src/
ngraph/
ops/constant.hpp
→
src/ops/constant.hpp
View file @
c7cc170c
...
...
@@ -16,8 +16,8 @@
#include <sstream>
#include "
ngraph
/element_type.hpp"
#include "
ngraph/
runtime/eigen/tensor_view.hpp"
#include "
types
/element_type.hpp"
#include "runtime/eigen/tensor_view.hpp"
namespace
ngraph
{
...
...
src/ops/convert.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include <memory>
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
::
op
;
...
...
src/
ngraph/
ops/convert.hpp
→
src/ops/convert.hpp
View file @
c7cc170c
File moved
src/
ngraph/
ops/divide.hpp
→
src/ops/divide.hpp
View file @
c7cc170c
File moved
src/ops/dot.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include <memory>
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
::
op
;
...
...
src/
ngraph/
ops/dot.hpp
→
src/ops/dot.hpp
View file @
c7cc170c
File moved
src/
ngraph/
ops/equal.hpp
→
src/ops/equal.hpp
View file @
c7cc170c
File moved
src/
ngraph/
ops/exp.hpp
→
src/ops/exp.hpp
View file @
c7cc170c
File moved
src/
ngraph/
ops/floor.hpp
→
src/ops/floor.hpp
View file @
c7cc170c
File moved
src/
ngraph/
ops/greater.hpp
→
src/ops/greater.hpp
View file @
c7cc170c
File moved
src/
ngraph/
ops/less.hpp
→
src/ops/less.hpp
View file @
c7cc170c
File moved
src/
ngraph/
ops/log.hpp
→
src/ops/log.hpp
View file @
c7cc170c
File moved
src/
ngraph/
ops/maximum.hpp
→
src/ops/maximum.hpp
View file @
c7cc170c
File moved
src/
ngraph/
ops/minimum.hpp
→
src/ops/minimum.hpp
View file @
c7cc170c
File moved
src/
ngraph/
ops/multiply.hpp
→
src/ops/multiply.hpp
View file @
c7cc170c
File moved
src/
ngraph/
ops/negative.hpp
→
src/ops/negative.hpp
View file @
c7cc170c
File moved
src/ops/op.cpp
View file @
c7cc170c
...
...
@@ -15,7 +15,7 @@
#include <algorithm>
#include <sstream>
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
ngraph
;
using
namespace
std
;
src/
ngraph
/op.hpp
→
src/
ops
/op.hpp
View file @
c7cc170c
...
...
@@ -16,9 +16,9 @@
#include <memory>
#include "n
graph/n
ode.hpp"
#include "
ngraph/
ops/parameter.hpp"
#include "
ngraph
/type.hpp"
#include "node.hpp"
#include "ops/parameter.hpp"
#include "
types
/type.hpp"
namespace
ngraph
{
...
...
src/ops/parameter.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include <sstream>
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
::
op
;
...
...
src/
ngraph/
ops/parameter.hpp
→
src/ops/parameter.hpp
View file @
c7cc170c
...
...
@@ -14,8 +14,8 @@
#pragma once
#include "n
graph/n
ode.hpp"
#include "
ngraph
/type.hpp"
#include "node.hpp"
#include "
types
/type.hpp"
namespace
ngraph
{
...
...
src/
ngraph/
ops/power.hpp
→
src/ops/power.hpp
View file @
c7cc170c
File moved
src/
ngraph/
ops/remainder.hpp
→
src/ops/remainder.hpp
View file @
c7cc170c
File moved
src/
ngraph/
ops/subtract.hpp
→
src/ops/subtract.hpp
View file @
c7cc170c
File moved
src/ops/tuple.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include <memory>
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
::
op
;
...
...
src/
ngraph/
ops/tuple.hpp
→
src/ops/tuple.hpp
View file @
c7cc170c
File moved
src/ops/unary_elementwise_arithmetic.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include <memory>
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
src/ops/unary_elementwise_builtin.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include <memory>
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
src/
ngraph/
pass/assign_tensors.cpp
→
src/pass/assign_tensors.cpp
View file @
c7cc170c
...
...
@@ -18,7 +18,7 @@
#include <sstream>
#include "log.hpp"
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
#include "propagate_types.hpp"
using
namespace
std
;
...
...
src/
ngraph/
pass/assign_tensors.hpp
→
src/pass/assign_tensors.hpp
View file @
c7cc170c
File moved
src/
ngraph/
pass/call_pass.cpp
→
src/pass/call_pass.cpp
View file @
c7cc170c
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#include "call_pass.hpp"
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#include "call_pass.hpp"
src/
ngraph/
pass/call_pass.hpp
→
src/pass/call_pass.hpp
View file @
c7cc170c
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#pragma once
#include <list>
#include <memory>
#include <vector>
#include "pass.hpp"
namespace
ngraph
{
namespace
pass
{
class
CallBase
;
}
class
Node
;
}
class
ngraph
::
pass
::
CallBase
:
public
Base
{
public
:
virtual
~
CallBase
()
{}
virtual
bool
run_on_call_list
(
std
::
list
<
Node
*>&
)
=
0
;
// derived class throws exception if its dependencies have not been met
virtual
void
check_dependencies
(
const
std
::
vector
<
std
::
shared_ptr
<
CallBase
>>&
)
const
{}
private
:
};
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#pragma once
#include <list>
#include <memory>
#include <vector>
#include "pass.hpp"
namespace
ngraph
{
namespace
pass
{
class
CallBase
;
}
class
Node
;
}
class
ngraph
::
pass
::
CallBase
:
public
Base
{
public
:
virtual
~
CallBase
()
{}
virtual
bool
run_on_call_list
(
std
::
list
<
Node
*>&
)
=
0
;
// derived class throws exception if its dependencies have not been met
virtual
void
check_dependencies
(
const
std
::
vector
<
std
::
shared_ptr
<
CallBase
>>&
)
const
{}
private
:
};
src/
ngraph/
pass/dump_sorted.cpp
→
src/pass/dump_sorted.cpp
View file @
c7cc170c
...
...
@@ -15,7 +15,7 @@
#include <fstream>
#include "dump_sorted.hpp"
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
#include "util.hpp"
using
namespace
ngraph
;
...
...
src/
ngraph/
pass/dump_sorted.hpp
→
src/pass/dump_sorted.hpp
View file @
c7cc170c
File moved
src/
ngraph/
pass/liveness.cpp
→
src/pass/liveness.cpp
View file @
c7cc170c
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#include <exception>
#include <sstream>
#include <unordered_set>
#include "log.hpp"
#include "ngraph
/ngraph.hpp"
#include "
ngraph/pass/assign_tensors.hpp"
#include "
ngraph/pass/liveness.hpp"
#include "util.hpp"
#include "log.hpp"
using
namespace
std
;
using
namespace
ngraph
;
bool
pass
::
Liveness
::
run_on_call_list
(
list
<
Node
*>&
ops
)
{
unordered_set
<
descriptor
::
Tensor
*>
currently_live
;
for
(
auto
it
=
ops
.
rbegin
();
it
!=
ops
.
rend
();
it
++
)
{
Node
&
exop
=
**
it
;
exop
.
liveness_live_list
.
clear
();
exop
.
liveness_new_list
.
clear
();
exop
.
liveness_free_list
.
clear
();
unordered_set
<
descriptor
::
Tensor
*>
input_tensor_decls
;
for
(
auto
input_decl
:
exop
.
get_inputs
())
{
descriptor
::
Tensor
&
tensor
=
input_decl
.
get_tensor
();
if
(
is_temporary
(
tensor
))
{
input_tensor_decls
.
insert
(
&
tensor
);
}
}
unordered_set
<
descriptor
::
Tensor
*>
output_tensor_decls
;
for
(
auto
output_decl
:
exop
.
get_outputs
())
{
descriptor
::
Tensor
&
tensor
=
output_decl
.
get_tensor
();
if
(
is_temporary
(
tensor
))
{
output_tensor_decls
.
insert
(
&
tensor
);
}
}
unordered_set
<
descriptor
::
Tensor
*>
free_tensor_decls
;
unordered_set
<
descriptor
::
Tensor
*>
new_tensor_decls
;
unordered_set
<
descriptor
::
Tensor
*>
all_tensor_decls
=
input_tensor_decls
;
for
(
auto
decls
:
{
input_tensor_decls
,
output_tensor_decls
})
{
for
(
descriptor
::
Tensor
*
tensor_decl
:
decls
)
{
if
(
!
contains
(
currently_live
,
tensor_decl
))
{
// this is the last node that value is seen in
// delete it at the end of the op
currently_live
.
insert
(
tensor_decl
);
free_tensor_decls
.
insert
(
tensor_decl
);
}
}
}
exop
.
liveness_live_list
=
currently_live
;
for
(
descriptor
::
Tensor
*
output_decl
:
output_tensor_decls
)
{
if
(
contains
(
currently_live
,
output_decl
))
{
new_tensor_decls
.
insert
(
output_decl
);
currently_live
.
erase
(
output_decl
);
}
}
exop
.
liveness_free_list
=
free_tensor_decls
;
exop
.
liveness_new_list
=
new_tensor_decls
;
}
// Anything marked as output must remain live for the remainder of the graph
// Add outputs to live_list and remove from free_list
unordered_set
<
descriptor
::
Tensor
*>
outputs
;
unordered_set
<
descriptor
::
Tensor
*>
seen
;
for
(
Node
*
exop
:
ops
)
{
for
(
descriptor
::
Tensor
*
tensor
:
exop
->
liveness_live_list
)
{
if
(
tensor
->
is_output
())
{
outputs
.
insert
(
tensor
);
}
}
for
(
descriptor
::
Tensor
*
tensor
:
outputs
)
{
exop
->
liveness_live_list
.
insert
(
tensor
);
exop
->
liveness_free_list
.
erase
(
tensor
);
if
(
contains
(
exop
->
liveness_new_list
,
tensor
))
{
if
(
contains
(
seen
,
tensor
))
{
exop
->
liveness_new_list
.
erase
(
tensor
);
}
else
{
seen
.
insert
(
tensor
);
}
}
}
}
validate_liveness
(
ops
);
return
false
;
}
void
pass
::
Liveness
::
check_dependencies
(
const
std
::
vector
<
std
::
shared_ptr
<
CallBase
>>&
registered_passes
)
const
{
bool
found_propagate_types
=
false
;
for
(
auto
pass
:
registered_passes
)
{
if
(
dynamic_pointer_cast
<
AssignTensors
>
(
pass
))
{
found_propagate_types
=
true
;
}
}
if
(
!
found_propagate_types
)
{
throw
runtime_error
(
"Dependency 'PropagateTypes' not found for pass 'AssignTensors'"
);
}
}
bool
pass
::
Liveness
::
is_temporary
(
const
descriptor
::
Tensor
&
tensor
)
{
return
tensor
.
is_persistent
()
==
false
&&
tensor
.
is_input
()
==
false
;
// && tensor.is_constant() == false
// && tensor.is_compile_only() == false;
}
void
pass
::
Liveness
::
validate_liveness
(
const
list
<
Node
*>&
ops
)
{
unordered_set
<
descriptor
::
Tensor
*>
dead_tensors
;
for
(
const
Node
*
exop
:
ops
)
{
auto
active
=
exop
->
liveness_live_list
;
active
.
insert
(
exop
->
liveness_new_list
.
begin
(),
exop
->
liveness_new_list
.
end
());
active
.
insert
(
exop
->
liveness_free_list
.
begin
(),
exop
->
liveness_free_list
.
end
());
for
(
const
descriptor
::
Tensor
*
tensor
:
active
)
{
if
(
contains
(
dead_tensors
,
tensor
))
{
throw
runtime_error
(
"Liveness: Dead tensors intersect active tensors"
);
}
}
dead_tensors
.
insert
(
exop
->
liveness_free_list
.
begin
(),
exop
->
liveness_free_list
.
end
());
}
}
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#include <exception>
#include <sstream>
#include <unordered_set>
#include "log.hpp"
#include "ngraph
.hpp"
#include "
pass/assign_tensors.hpp"
#include "
pass/liveness.hpp"
#include "util.hpp"
#include "log.hpp"
using
namespace
std
;
using
namespace
ngraph
;
bool
pass
::
Liveness
::
run_on_call_list
(
list
<
Node
*>&
ops
)
{
unordered_set
<
descriptor
::
Tensor
*>
currently_live
;
for
(
auto
it
=
ops
.
rbegin
();
it
!=
ops
.
rend
();
it
++
)
{
Node
&
exop
=
**
it
;
exop
.
liveness_live_list
.
clear
();
exop
.
liveness_new_list
.
clear
();
exop
.
liveness_free_list
.
clear
();
unordered_set
<
descriptor
::
Tensor
*>
input_tensor_decls
;
for
(
auto
input_decl
:
exop
.
get_inputs
())
{
descriptor
::
Tensor
&
tensor
=
input_decl
.
get_tensor
();
if
(
is_temporary
(
tensor
))
{
input_tensor_decls
.
insert
(
&
tensor
);
}
}
unordered_set
<
descriptor
::
Tensor
*>
output_tensor_decls
;
for
(
auto
output_decl
:
exop
.
get_outputs
())
{
descriptor
::
Tensor
&
tensor
=
output_decl
.
get_tensor
();
if
(
is_temporary
(
tensor
))
{
output_tensor_decls
.
insert
(
&
tensor
);
}
}
unordered_set
<
descriptor
::
Tensor
*>
free_tensor_decls
;
unordered_set
<
descriptor
::
Tensor
*>
new_tensor_decls
;
unordered_set
<
descriptor
::
Tensor
*>
all_tensor_decls
=
input_tensor_decls
;
for
(
auto
decls
:
{
input_tensor_decls
,
output_tensor_decls
})
{
for
(
descriptor
::
Tensor
*
tensor_decl
:
decls
)
{
if
(
!
contains
(
currently_live
,
tensor_decl
))
{
// this is the last node that value is seen in
// delete it at the end of the op
currently_live
.
insert
(
tensor_decl
);
free_tensor_decls
.
insert
(
tensor_decl
);
}
}
}
exop
.
liveness_live_list
=
currently_live
;
for
(
descriptor
::
Tensor
*
output_decl
:
output_tensor_decls
)
{
if
(
contains
(
currently_live
,
output_decl
))
{
new_tensor_decls
.
insert
(
output_decl
);
currently_live
.
erase
(
output_decl
);
}
}
exop
.
liveness_free_list
=
free_tensor_decls
;
exop
.
liveness_new_list
=
new_tensor_decls
;
}
// Anything marked as output must remain live for the remainder of the graph
// Add outputs to live_list and remove from free_list
unordered_set
<
descriptor
::
Tensor
*>
outputs
;
unordered_set
<
descriptor
::
Tensor
*>
seen
;
for
(
Node
*
exop
:
ops
)
{
for
(
descriptor
::
Tensor
*
tensor
:
exop
->
liveness_live_list
)
{
if
(
tensor
->
is_output
())
{
outputs
.
insert
(
tensor
);
}
}
for
(
descriptor
::
Tensor
*
tensor
:
outputs
)
{
exop
->
liveness_live_list
.
insert
(
tensor
);
exop
->
liveness_free_list
.
erase
(
tensor
);
if
(
contains
(
exop
->
liveness_new_list
,
tensor
))
{
if
(
contains
(
seen
,
tensor
))
{
exop
->
liveness_new_list
.
erase
(
tensor
);
}
else
{
seen
.
insert
(
tensor
);
}
}
}
}
validate_liveness
(
ops
);
return
false
;
}
void
pass
::
Liveness
::
check_dependencies
(
const
std
::
vector
<
std
::
shared_ptr
<
CallBase
>>&
registered_passes
)
const
{
bool
found_propagate_types
=
false
;
for
(
auto
pass
:
registered_passes
)
{
if
(
dynamic_pointer_cast
<
AssignTensors
>
(
pass
))
{
found_propagate_types
=
true
;
}
}
if
(
!
found_propagate_types
)
{
throw
runtime_error
(
"Dependency 'PropagateTypes' not found for pass 'AssignTensors'"
);
}
}
bool
pass
::
Liveness
::
is_temporary
(
const
descriptor
::
Tensor
&
tensor
)
{
return
tensor
.
is_persistent
()
==
false
&&
tensor
.
is_input
()
==
false
;
// && tensor.is_constant() == false
// && tensor.is_compile_only() == false;
}
void
pass
::
Liveness
::
validate_liveness
(
const
list
<
Node
*>&
ops
)
{
unordered_set
<
descriptor
::
Tensor
*>
dead_tensors
;
for
(
const
Node
*
exop
:
ops
)
{
auto
active
=
exop
->
liveness_live_list
;
active
.
insert
(
exop
->
liveness_new_list
.
begin
(),
exop
->
liveness_new_list
.
end
());
active
.
insert
(
exop
->
liveness_free_list
.
begin
(),
exop
->
liveness_free_list
.
end
());
for
(
const
descriptor
::
Tensor
*
tensor
:
active
)
{
if
(
contains
(
dead_tensors
,
tensor
))
{
throw
runtime_error
(
"Liveness: Dead tensors intersect active tensors"
);
}
}
dead_tensors
.
insert
(
exop
->
liveness_free_list
.
begin
(),
exop
->
liveness_free_list
.
end
());
}
}
src/
ngraph/
pass/liveness.hpp
→
src/pass/liveness.hpp
View file @
c7cc170c
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#pragma once
#include "call_pass.hpp"
#include "
ngraph/descriptor/tensor.hpp"
namespace
ngraph
{
namespace
pass
{
class
Liveness
;
}
class
Node
;
}
class
ngraph
::
pass
::
Liveness
:
public
CallBase
{
public
:
virtual
bool
run_on_call_list
(
std
::
list
<
Node
*>&
)
override
;
void
check_dependencies
(
const
std
::
vector
<
std
::
shared_ptr
<
CallBase
>>&
)
const
override
;
private
:
bool
is_temporary
(
const
descriptor
::
Tensor
&
);
void
validate_liveness
(
const
std
::
list
<
Node
*>&
ops
);
};
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#pragma once
#include "call_pass.hpp"
#include "
descriptor/tensor.hpp"
namespace
ngraph
{
namespace
pass
{
class
Liveness
;
}
class
Node
;
}
class
ngraph
::
pass
::
Liveness
:
public
CallBase
{
public
:
virtual
bool
run_on_call_list
(
std
::
list
<
Node
*>&
)
override
;
void
check_dependencies
(
const
std
::
vector
<
std
::
shared_ptr
<
CallBase
>>&
)
const
override
;
private
:
bool
is_temporary
(
const
descriptor
::
Tensor
&
);
void
validate_liveness
(
const
std
::
list
<
Node
*>&
ops
);
};
src/
ngraph/
pass/manager.cpp
→
src/pass/manager.cpp
View file @
c7cc170c
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#include <iostream>
#include <memory>
#include "log.hpp"
#include "manager.hpp"
#include "n
graph/node.hpp"
using
namespace
std
;
ngraph
::
pass
::
Manager
::
Manager
()
{
}
ngraph
::
pass
::
Manager
::~
Manager
()
{
}
void
ngraph
::
pass
::
Manager
::
initialize_default_passes
()
{
}
void
ngraph
::
pass
::
Manager
::
register_pass
(
std
::
shared_ptr
<
TreeBase
>
p
)
{
if
(
p
==
nullptr
)
{
throw
invalid_argument
(
"null pass registered"
);
}
p
->
check_dependencies
(
m_tree_passes
);
m_tree_passes
.
push_back
(
p
);
}
void
ngraph
::
pass
::
Manager
::
register_pass
(
std
::
shared_ptr
<
CallBase
>
p
)
{
if
(
p
==
nullptr
)
{
throw
invalid_argument
(
"null pass registered"
);
}
p
->
check_dependencies
(
m_call_passes
);
m_call_passes
.
push_back
(
p
);
}
void
ngraph
::
pass
::
Manager
::
run_passes
(
std
::
shared_ptr
<
Node
>
nodes
)
{
for
(
shared_ptr
<
TreeBase
>
p
:
m_tree_passes
)
{
p
->
run_on_tree
(
nodes
);
if
(
p
->
call_graph_produced
())
{
m_sorted_list
=
p
->
get_call_graph
();
}
}
for
(
shared_ptr
<
CallBase
>&
p
:
m_call_passes
)
{
p
->
run_on_call_list
(
m_sorted_list
);
}
}
const
std
::
list
<
ngraph
::
Node
*>&
ngraph
::
pass
::
Manager
::
get_sorted_list
()
const
{
return
m_sorted_list
;
}
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#include <iostream>
#include <memory>
#include "log.hpp"
#include "manager.hpp"
#include "n
ode.hpp"
using
namespace
std
;
ngraph
::
pass
::
Manager
::
Manager
()
{
}
ngraph
::
pass
::
Manager
::~
Manager
()
{
}
void
ngraph
::
pass
::
Manager
::
initialize_default_passes
()
{
}
void
ngraph
::
pass
::
Manager
::
register_pass
(
std
::
shared_ptr
<
TreeBase
>
p
)
{
if
(
p
==
nullptr
)
{
throw
invalid_argument
(
"null pass registered"
);
}
p
->
check_dependencies
(
m_tree_passes
);
m_tree_passes
.
push_back
(
p
);
}
void
ngraph
::
pass
::
Manager
::
register_pass
(
std
::
shared_ptr
<
CallBase
>
p
)
{
if
(
p
==
nullptr
)
{
throw
invalid_argument
(
"null pass registered"
);
}
p
->
check_dependencies
(
m_call_passes
);
m_call_passes
.
push_back
(
p
);
}
void
ngraph
::
pass
::
Manager
::
run_passes
(
std
::
shared_ptr
<
Node
>
nodes
)
{
for
(
shared_ptr
<
TreeBase
>
p
:
m_tree_passes
)
{
p
->
run_on_tree
(
nodes
);
if
(
p
->
call_graph_produced
())
{
m_sorted_list
=
p
->
get_call_graph
();
}
}
for
(
shared_ptr
<
CallBase
>&
p
:
m_call_passes
)
{
p
->
run_on_call_list
(
m_sorted_list
);
}
}
const
std
::
list
<
ngraph
::
Node
*>&
ngraph
::
pass
::
Manager
::
get_sorted_list
()
const
{
return
m_sorted_list
;
}
src/
ngraph/
pass/manager.hpp
→
src/pass/manager.hpp
View file @
c7cc170c
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#pragma once
#include <vector>
#include "call_pass.hpp"
#include "tree_pass.hpp"
namespace
ngraph
{
namespace
pass
{
class
Manager
;
}
class
Node
;
}
class
ngraph
::
pass
::
Manager
{
public
:
Manager
();
~
Manager
();
void
initialize_default_passes
();
void
register_pass
(
std
::
shared_ptr
<
TreeBase
>
);
void
register_pass
(
std
::
shared_ptr
<
CallBase
>
);
void
run_passes
(
std
::
shared_ptr
<
Node
>
nodes
);
const
std
::
list
<
Node
*>&
get_sorted_list
()
const
;
private
:
std
::
vector
<
std
::
shared_ptr
<
TreeBase
>>
m_tree_passes
;
std
::
vector
<
std
::
shared_ptr
<
CallBase
>>
m_call_passes
;
std
::
list
<
Node
*>
m_sorted_list
;
};
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#pragma once
#include <vector>
#include "call_pass.hpp"
#include "tree_pass.hpp"
namespace
ngraph
{
namespace
pass
{
class
Manager
;
}
class
Node
;
}
class
ngraph
::
pass
::
Manager
{
public
:
Manager
();
~
Manager
();
void
initialize_default_passes
();
void
register_pass
(
std
::
shared_ptr
<
TreeBase
>
);
void
register_pass
(
std
::
shared_ptr
<
CallBase
>
);
void
run_passes
(
std
::
shared_ptr
<
Node
>
nodes
);
const
std
::
list
<
Node
*>&
get_sorted_list
()
const
;
private
:
std
::
vector
<
std
::
shared_ptr
<
TreeBase
>>
m_tree_passes
;
std
::
vector
<
std
::
shared_ptr
<
CallBase
>>
m_call_passes
;
std
::
list
<
Node
*>
m_sorted_list
;
};
src/
ngraph/
pass/memory_layout.cpp
→
src/pass/memory_layout.cpp
View file @
c7cc170c
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#include <exception>
#include <sstream>
#include "log.hpp"
#include "ngraph
/ngraph.hpp"
#include "
ngraph/pass/liveness.hpp"
#include "
ngraph/pass/memory_layout.hpp"
#include "log.hpp"
using
namespace
std
;
using
namespace
ngraph
;
bool
pass
::
MemoryLayout
::
run_on_call_list
(
std
::
list
<
Node
*>&
node_list
)
{
for
(
Node
*
node
:
node_list
)
{
}
return
false
;
}
void
pass
::
MemoryLayout
::
check_dependencies
(
const
std
::
vector
<
std
::
shared_ptr
<
CallBase
>>&
registered_passes
)
const
{
bool
found_propagate_types
=
false
;
for
(
auto
pass
:
registered_passes
)
{
if
(
dynamic_pointer_cast
<
Liveness
>
(
pass
))
{
found_propagate_types
=
true
;
}
}
if
(
!
found_propagate_types
)
{
throw
runtime_error
(
"Dependency 'PropagateTypes' not found for pass 'AssignTensors'"
);
}
}
pass
::
MemoryManager
::
node
::
node
(
size_t
size
,
block_state
state
)
:
m_size
{
size
}
,
m_state
{
state
}
{
}
pass
::
MemoryManager
::
MemoryManager
(
size_t
alignment
)
:
m_alignment
{
alignment
}
,
m_scheme
{
allocation_scheme
::
BEST_FIT
}
,
m_max_allocated
{
0
}
{
// assert(m_base_offset % m_alignment == 0);
m_node_list
.
emplace_back
(
numeric_limits
<
size_t
>::
max
(),
block_state
::
FREE
);
}
size_t
pass
::
MemoryManager
::
allocate
(
size_t
size
)
{
size_t
rc
;
switch
(
m_scheme
)
{
case
allocation_scheme
:
:
FIRST_FIT
:
rc
=
first_fit
(
size
);
break
;
case
allocation_scheme
:
:
BEST_FIT
:
rc
=
best_fit
(
size
);
break
;
}
return
rc
;
}
size_t
pass
::
MemoryManager
::
best_fit
(
size_t
size
)
{
size
=
align
(
size
,
m_alignment
);
size_t
offset
=
0
;
size_t
min_delta
=
numeric_limits
<
size_t
>::
max
();
auto
best_fit
=
m_node_list
.
end
();
size_t
best_offset
=
offset
;
for
(
auto
it
=
m_node_list
.
begin
();
it
!=
m_node_list
.
end
();
++
it
)
{
if
(
it
->
m_state
==
block_state
::
FREE
&&
it
->
m_size
>=
size
)
{
size_t
delta
=
it
->
m_size
-
size
;
if
(
delta
<
min_delta
)
{
min_delta
=
delta
;
best_fit
=
it
;
best_offset
=
offset
;
}
}
offset
+=
it
->
m_size
;
}
if
(
best_fit
==
m_node_list
.
end
())
{
throw
bad_alloc
();
}
if
(
min_delta
==
0
)
{
// exact fit
best_fit
->
m_state
=
block_state
::
ALLOCATED
;
}
else
{
m_node_list
.
insert
(
best_fit
,
node
{
size
,
block_state
::
ALLOCATED
});
best_fit
->
m_size
-=
size
;
}
m_max_allocated
=
std
::
max
(
m_max_allocated
,
best_offset
+
size
);
return
best_offset
;
}
size_t
pass
::
MemoryManager
::
first_fit
(
size_t
size
)
{
size
=
align
(
size
,
m_alignment
);
size_t
offset
=
0
;
bool
found
=
false
;
for
(
auto
it
=
m_node_list
.
begin
();
it
!=
m_node_list
.
end
();
++
it
)
{
if
(
it
->
m_state
==
block_state
::
FREE
&&
it
->
m_size
>=
size
)
{
if
(
it
->
m_size
>
size
)
{
m_node_list
.
insert
(
it
,
node
{
size
,
block_state
::
ALLOCATED
});
it
->
m_size
-=
size
;
}
else
{
// exact fit
it
->
m_state
=
block_state
::
ALLOCATED
;
}
found
=
true
;
break
;
}
offset
+=
it
->
m_size
;
}
if
(
!
found
)
{
throw
bad_alloc
();
}
m_max_allocated
=
std
::
max
(
m_max_allocated
,
offset
+
size
);
return
offset
;
}
void
pass
::
MemoryManager
::
free
(
size_t
offset
)
{
size_t
search_offset
=
0
;
bool
found
=
false
;
for
(
auto
it
=
m_node_list
.
begin
();
it
!=
m_node_list
.
end
();
++
it
)
{
if
(
offset
==
search_offset
)
{
list
<
node
>::
iterator
it_next
=
std
::
next
(
it
);
if
(
it
==
m_node_list
.
begin
())
{
// free the first node in the list
it
->
m_state
=
block_state
::
FREE
;
}
else
{
// node has predecessor
list
<
node
>::
iterator
it_prev
=
std
::
prev
(
it
);
if
(
it_prev
->
m_state
==
block_state
::
FREE
)
{
it
->
m_size
+=
it_prev
->
m_size
;
m_node_list
.
erase
(
it_prev
);
}
}
if
(
it_next
!=
m_node_list
.
end
()
&&
it_next
->
m_state
==
block_state
::
FREE
)
{
// join this node with next
it
->
m_size
+=
it_next
->
m_size
;
m_node_list
.
erase
(
it_next
);
}
it
->
m_state
=
block_state
::
FREE
;
found
=
true
;
break
;
}
search_offset
+=
it
->
m_size
;
}
if
(
!
found
)
{
throw
runtime_error
(
"bad free"
);
}
}
void
pass
::
MemoryManager
::
dump
(
std
::
ostream
&
out
)
{
for
(
const
node
&
n
:
m_node_list
)
{
out
<<
"size="
<<
n
.
m_size
<<
", "
;
out
<<
(
n
.
m_state
==
block_state
::
FREE
?
"FREE"
:
"ALLOCATED"
);
out
<<
"
\n
"
;
}
}
size_t
pass
::
MemoryManager
::
align
(
size_t
size
,
size_t
alignment
)
{
if
(
size
==
0
)
{
size
=
alignment
;
}
else
{
auto
remainder
=
size
%
alignment
;
if
(
remainder
>
0
)
{
size
+=
(
alignment
-
remainder
);
}
}
return
size
;
}
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#include <exception>
#include <sstream>
#include "log.hpp"
#include "ngraph
.hpp"
#include "
pass/liveness.hpp"
#include "
pass/memory_layout.hpp"
#include "log.hpp"
using
namespace
std
;
using
namespace
ngraph
;
bool
pass
::
MemoryLayout
::
run_on_call_list
(
std
::
list
<
Node
*>&
node_list
)
{
for
(
Node
*
node
:
node_list
)
{
}
return
false
;
}
void
pass
::
MemoryLayout
::
check_dependencies
(
const
std
::
vector
<
std
::
shared_ptr
<
CallBase
>>&
registered_passes
)
const
{
bool
found_propagate_types
=
false
;
for
(
auto
pass
:
registered_passes
)
{
if
(
dynamic_pointer_cast
<
Liveness
>
(
pass
))
{
found_propagate_types
=
true
;
}
}
if
(
!
found_propagate_types
)
{
throw
runtime_error
(
"Dependency 'PropagateTypes' not found for pass 'AssignTensors'"
);
}
}
pass
::
MemoryManager
::
node
::
node
(
size_t
size
,
block_state
state
)
:
m_size
{
size
}
,
m_state
{
state
}
{
}
pass
::
MemoryManager
::
MemoryManager
(
size_t
alignment
)
:
m_alignment
{
alignment
}
,
m_scheme
{
allocation_scheme
::
BEST_FIT
}
,
m_max_allocated
{
0
}
{
// assert(m_base_offset % m_alignment == 0);
m_node_list
.
emplace_back
(
numeric_limits
<
size_t
>::
max
(),
block_state
::
FREE
);
}
size_t
pass
::
MemoryManager
::
allocate
(
size_t
size
)
{
size_t
rc
;
switch
(
m_scheme
)
{
case
allocation_scheme
:
:
FIRST_FIT
:
rc
=
first_fit
(
size
);
break
;
case
allocation_scheme
:
:
BEST_FIT
:
rc
=
best_fit
(
size
);
break
;
}
return
rc
;
}
size_t
pass
::
MemoryManager
::
best_fit
(
size_t
size
)
{
size
=
align
(
size
,
m_alignment
);
size_t
offset
=
0
;
size_t
min_delta
=
numeric_limits
<
size_t
>::
max
();
auto
best_fit
=
m_node_list
.
end
();
size_t
best_offset
=
offset
;
for
(
auto
it
=
m_node_list
.
begin
();
it
!=
m_node_list
.
end
();
++
it
)
{
if
(
it
->
m_state
==
block_state
::
FREE
&&
it
->
m_size
>=
size
)
{
size_t
delta
=
it
->
m_size
-
size
;
if
(
delta
<
min_delta
)
{
min_delta
=
delta
;
best_fit
=
it
;
best_offset
=
offset
;
}
}
offset
+=
it
->
m_size
;
}
if
(
best_fit
==
m_node_list
.
end
())
{
throw
bad_alloc
();
}
if
(
min_delta
==
0
)
{
// exact fit
best_fit
->
m_state
=
block_state
::
ALLOCATED
;
}
else
{
m_node_list
.
insert
(
best_fit
,
node
{
size
,
block_state
::
ALLOCATED
});
best_fit
->
m_size
-=
size
;
}
m_max_allocated
=
std
::
max
(
m_max_allocated
,
best_offset
+
size
);
return
best_offset
;
}
size_t
pass
::
MemoryManager
::
first_fit
(
size_t
size
)
{
size
=
align
(
size
,
m_alignment
);
size_t
offset
=
0
;
bool
found
=
false
;
for
(
auto
it
=
m_node_list
.
begin
();
it
!=
m_node_list
.
end
();
++
it
)
{
if
(
it
->
m_state
==
block_state
::
FREE
&&
it
->
m_size
>=
size
)
{
if
(
it
->
m_size
>
size
)
{
m_node_list
.
insert
(
it
,
node
{
size
,
block_state
::
ALLOCATED
});
it
->
m_size
-=
size
;
}
else
{
// exact fit
it
->
m_state
=
block_state
::
ALLOCATED
;
}
found
=
true
;
break
;
}
offset
+=
it
->
m_size
;
}
if
(
!
found
)
{
throw
bad_alloc
();
}
m_max_allocated
=
std
::
max
(
m_max_allocated
,
offset
+
size
);
return
offset
;
}
void
pass
::
MemoryManager
::
free
(
size_t
offset
)
{
size_t
search_offset
=
0
;
bool
found
=
false
;
for
(
auto
it
=
m_node_list
.
begin
();
it
!=
m_node_list
.
end
();
++
it
)
{
if
(
offset
==
search_offset
)
{
list
<
node
>::
iterator
it_next
=
std
::
next
(
it
);
if
(
it
==
m_node_list
.
begin
())
{
// free the first node in the list
it
->
m_state
=
block_state
::
FREE
;
}
else
{
// node has predecessor
list
<
node
>::
iterator
it_prev
=
std
::
prev
(
it
);
if
(
it_prev
->
m_state
==
block_state
::
FREE
)
{
it
->
m_size
+=
it_prev
->
m_size
;
m_node_list
.
erase
(
it_prev
);
}
}
if
(
it_next
!=
m_node_list
.
end
()
&&
it_next
->
m_state
==
block_state
::
FREE
)
{
// join this node with next
it
->
m_size
+=
it_next
->
m_size
;
m_node_list
.
erase
(
it_next
);
}
it
->
m_state
=
block_state
::
FREE
;
found
=
true
;
break
;
}
search_offset
+=
it
->
m_size
;
}
if
(
!
found
)
{
throw
runtime_error
(
"bad free"
);
}
}
void
pass
::
MemoryManager
::
dump
(
std
::
ostream
&
out
)
{
for
(
const
node
&
n
:
m_node_list
)
{
out
<<
"size="
<<
n
.
m_size
<<
", "
;
out
<<
(
n
.
m_state
==
block_state
::
FREE
?
"FREE"
:
"ALLOCATED"
);
out
<<
"
\n
"
;
}
}
size_t
pass
::
MemoryManager
::
align
(
size_t
size
,
size_t
alignment
)
{
if
(
size
==
0
)
{
size
=
alignment
;
}
else
{
auto
remainder
=
size
%
alignment
;
if
(
remainder
>
0
)
{
size
+=
(
alignment
-
remainder
);
}
}
return
size
;
}
src/
ngraph/
pass/memory_layout.hpp
→
src/pass/memory_layout.hpp
View file @
c7cc170c
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#pragma once
#include <limits>
#include <list>
#include <sstream>
#include "call_pass.hpp"
namespace
ngraph
{
namespace
pass
{
class
MemoryLayout
;
class
MemoryNode
;
class
MemoryManager
;
}
class
Node
;
}
class
ngraph
::
pass
::
MemoryLayout
:
public
CallBase
{
public
:
virtual
bool
run_on_call_list
(
std
::
list
<
Node
*>&
)
override
;
void
check_dependencies
(
const
std
::
vector
<
std
::
shared_ptr
<
CallBase
>>&
)
const
override
;
private
:
};
class
ngraph
::
pass
::
MemoryManager
{
public
:
enum
class
block_state
{
FREE
,
ALLOCATED
};
enum
class
allocation_scheme
{
FIRST_FIT
,
BEST_FIT
};
class
node
{
public
:
node
(
size_t
size
,
block_state
state
);
bool
is_free
()
const
{
return
m_state
==
block_state
::
FREE
;
}
size_t
m_size
;
block_state
m_state
;
};
MemoryManager
(
size_t
alignment
=
1
);
// memory_manager& alignment(size_t a);
size_t
allocate
(
size_t
size
);
void
free
(
size_t
offset
);
void
dump
(
std
::
ostream
&
);
static
size_t
align
(
size_t
x
,
size_t
alignment
);
std
::
list
<
node
>::
iterator
begin
()
{
return
m_node_list
.
begin
();
}
std
::
list
<
node
>::
iterator
end
()
{
return
m_node_list
.
end
();
}
std
::
list
<
node
>::
const_iterator
begin
()
const
{
return
m_node_list
.
cbegin
();
}
std
::
list
<
node
>::
const_iterator
end
()
const
{
return
m_node_list
.
cend
();
}
const
std
::
list
<
node
>&
get_node_list
()
const
{
return
m_node_list
;
}
size_t
max_allocated
()
const
{
return
m_max_allocated
;
}
private
:
size_t
first_fit
(
size_t
size
);
size_t
best_fit
(
size_t
size
);
std
::
list
<
node
>
m_node_list
;
size_t
m_alignment
;
allocation_scheme
m_scheme
;
size_t
m_max_allocated
;
};
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#pragma once
#include <limits>
#include <list>
#include <sstream>
#include "call_pass.hpp"
namespace
ngraph
{
namespace
pass
{
class
MemoryLayout
;
class
MemoryNode
;
class
MemoryManager
;
}
class
Node
;
}
class
ngraph
::
pass
::
MemoryLayout
:
public
CallBase
{
public
:
virtual
bool
run_on_call_list
(
std
::
list
<
Node
*>&
)
override
;
void
check_dependencies
(
const
std
::
vector
<
std
::
shared_ptr
<
CallBase
>>&
)
const
override
;
private
:
};
class
ngraph
::
pass
::
MemoryManager
{
public
:
enum
class
block_state
{
FREE
,
ALLOCATED
};
enum
class
allocation_scheme
{
FIRST_FIT
,
BEST_FIT
};
class
node
{
public
:
node
(
size_t
size
,
block_state
state
);
bool
is_free
()
const
{
return
m_state
==
block_state
::
FREE
;
}
size_t
m_size
;
block_state
m_state
;
};
MemoryManager
(
size_t
alignment
=
1
);
// memory_manager& alignment(size_t a);
size_t
allocate
(
size_t
size
);
void
free
(
size_t
offset
);
void
dump
(
std
::
ostream
&
);
static
size_t
align
(
size_t
x
,
size_t
alignment
);
std
::
list
<
node
>::
iterator
begin
()
{
return
m_node_list
.
begin
();
}
std
::
list
<
node
>::
iterator
end
()
{
return
m_node_list
.
end
();
}
std
::
list
<
node
>::
const_iterator
begin
()
const
{
return
m_node_list
.
cbegin
();
}
std
::
list
<
node
>::
const_iterator
end
()
const
{
return
m_node_list
.
cend
();
}
const
std
::
list
<
node
>&
get_node_list
()
const
{
return
m_node_list
;
}
size_t
max_allocated
()
const
{
return
m_max_allocated
;
}
private
:
size_t
first_fit
(
size_t
size
);
size_t
best_fit
(
size_t
size
);
std
::
list
<
node
>
m_node_list
;
size_t
m_alignment
;
allocation_scheme
m_scheme
;
size_t
m_max_allocated
;
};
src/
ngraph/
pass/pass.cpp
→
src/pass/pass.cpp
View file @
c7cc170c
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#include "pass.hpp"
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#include "pass.hpp"
src/
ngraph/
pass/pass.hpp
→
src/pass/pass.hpp
View file @
c7cc170c
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#pragma once
namespace
ngraph
{
namespace
pass
{
class
Base
;
}
}
class
ngraph
::
pass
::
Base
{
public
:
private
:
};
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#pragma once
namespace
ngraph
{
namespace
pass
{
class
Base
;
}
}
class
ngraph
::
pass
::
Base
{
public
:
private
:
};
src/
ngraph/
pass/propagate_types.cpp
→
src/pass/propagate_types.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include <sstream>
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
#include "propagate_types.hpp"
using
namespace
std
;
...
...
src/
ngraph/
pass/propagate_types.hpp
→
src/pass/propagate_types.hpp
View file @
c7cc170c
File moved
src/
ngraph/
pass/topological_sort.cpp
→
src/pass/topological_sort.cpp
View file @
c7cc170c
...
...
@@ -16,8 +16,8 @@
#include <unordered_map>
#include "log.hpp"
#include "n
graph/n
ode.hpp"
#include "
ngraph/
pass/topological_sort.hpp"
#include "node.hpp"
#include "pass/topological_sort.hpp"
#include "util.hpp"
using
namespace
ngraph
;
...
...
src/
ngraph/
pass/topological_sort.hpp
→
src/pass/topological_sort.hpp
View file @
c7cc170c
...
...
@@ -17,7 +17,7 @@
#include <list>
#include <memory>
#include "
ngraph/
pass/tree_pass.hpp"
#include "pass/tree_pass.hpp"
namespace
ngraph
{
...
...
src/
ngraph/
pass/tree_pass.cpp
→
src/pass/tree_pass.cpp
View file @
c7cc170c
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#include "tree_pass.hpp"
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#include "tree_pass.hpp"
src/
ngraph/
pass/tree_pass.hpp
→
src/pass/tree_pass.hpp
View file @
c7cc170c
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#pragma once
#include <list>
#include <memory>
#include <vector>
#include "pass.hpp"
namespace
ngraph
{
namespace
pass
{
class
TreeBase
;
}
class
Node
;
}
class
ngraph
::
pass
::
TreeBase
:
public
Base
{
public
:
virtual
~
TreeBase
()
{}
// return true if changes were made to the tree
virtual
bool
run_on_tree
(
std
::
shared_ptr
<
Node
>
)
=
0
;
virtual
bool
call_graph_produced
()
const
{
return
false
;
}
virtual
std
::
list
<
Node
*>
get_call_graph
()
const
{
return
std
::
list
<
Node
*>
();
}
// derived class throws exception if its dependencies have not been met
virtual
void
check_dependencies
(
const
std
::
vector
<
std
::
shared_ptr
<
TreeBase
>>&
)
const
{}
private
:
std
::
list
<
Node
*>
m_sorted_list
;
};
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// 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
// ----------------------------------------------------------------------------
#pragma once
#include <list>
#include <memory>
#include <vector>
#include "pass.hpp"
namespace
ngraph
{
namespace
pass
{
class
TreeBase
;
}
class
Node
;
}
class
ngraph
::
pass
::
TreeBase
:
public
Base
{
public
:
virtual
~
TreeBase
()
{}
// return true if changes were made to the tree
virtual
bool
run_on_tree
(
std
::
shared_ptr
<
Node
>
)
=
0
;
virtual
bool
call_graph_produced
()
const
{
return
false
;
}
virtual
std
::
list
<
Node
*>
get_call_graph
()
const
{
return
std
::
list
<
Node
*>
();
}
// derived class throws exception if its dependencies have not been met
virtual
void
check_dependencies
(
const
std
::
vector
<
std
::
shared_ptr
<
TreeBase
>>&
)
const
{}
private
:
std
::
list
<
Node
*>
m_sorted_list
;
};
src/
ngraph/
pass/visualize_tree.cpp
→
src/pass/visualize_tree.cpp
View file @
c7cc170c
...
...
@@ -15,7 +15,7 @@
#include <fstream>
#include "visualize_tree.hpp"
#include "n
graph/n
ode.hpp"
#include "node.hpp"
#include "util.hpp"
using
namespace
ngraph
;
...
...
src/
ngraph/
pass/visualize_tree.hpp
→
src/pass/visualize_tree.hpp
View file @
c7cc170c
...
...
@@ -18,7 +18,7 @@
#include <string>
#include <set>
#include "
ngraph/
pass/tree_pass.hpp"
#include "pass/tree_pass.hpp"
namespace
ngraph
{
...
...
src/
ngraph/
runtime/call_frame.cpp
→
src/runtime/call_frame.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include <algorithm>
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
src/
ngraph/
runtime/call_frame.hpp
→
src/runtime/call_frame.hpp
View file @
c7cc170c
...
...
@@ -17,9 +17,9 @@
#include <memory>
#include <vector>
#include "
ngraph/
runtime/tensor_view.hpp"
#include "
ngraph/
function.hpp"
#include "
ngraph/
runtime/instruction.hpp"
#include "runtime/tensor_view.hpp"
#include "function.hpp"
#include "runtime/instruction.hpp"
namespace
ngraph
{
...
...
src/
ngraph/
runtime/eigen/add.hpp
→
src/runtime/eigen/add.hpp
View file @
c7cc170c
...
...
@@ -14,9 +14,9 @@
#pragma once
#include "
ngraph/
runtime/call_frame.hpp"
#include "
ngraph/
runtime/eigen/tensor_view.hpp"
#include "
ngraph/
runtime/instruction.hpp"
#include "runtime/call_frame.hpp"
#include "runtime/eigen/tensor_view.hpp"
#include "runtime/instruction.hpp"
namespace
ngraph
{
...
...
src/
ngraph/
runtime/eigen/external_function.cpp
→
src/runtime/eigen/external_function.cpp
View file @
c7cc170c
...
...
@@ -18,17 +18,17 @@
#include <typeinfo>
#include <unordered_map>
#include "
ngraph/
descriptor/input.hpp"
#include "
ngraph/
descriptor/output.hpp"
#include "
ngraph/
function.hpp"
#include "n
graph/n
ode.hpp"
#include "
ngraph/
ops/add.hpp"
#include "
ngraph/
ops/multiply.hpp"
#include "
ngraph/
pass/topological_sort.hpp"
#include "
ngraph/
runtime/eigen/add.hpp"
#include "
ngraph/
runtime/eigen/external_function.hpp"
#include "
ngraph/
runtime/eigen/multiply.hpp"
#include "
ngraph/
runtime/eigen/return.hpp"
#include "descriptor/input.hpp"
#include "descriptor/output.hpp"
#include "function.hpp"
#include "node.hpp"
#include "ops/add.hpp"
#include "ops/multiply.hpp"
#include "pass/topological_sort.hpp"
#include "runtime/eigen/add.hpp"
#include "runtime/eigen/external_function.hpp"
#include "runtime/eigen/multiply.hpp"
#include "runtime/eigen/return.hpp"
using
namespace
std
;
using
namespace
ngraph
::
runtime
::
eigen
;
...
...
src/
ngraph/
runtime/eigen/external_function.hpp
→
src/runtime/eigen/external_function.hpp
View file @
c7cc170c
...
...
@@ -19,7 +19,7 @@
#include <typeinfo>
#include <unordered_map>
#include "
ngraph/
function.hpp"
#include "function.hpp"
namespace
ngraph
{
...
...
src/
ngraph/
runtime/eigen/multiply.hpp
→
src/runtime/eigen/multiply.hpp
View file @
c7cc170c
...
...
@@ -14,8 +14,8 @@
#pragma once
#include "
ngraph/
runtime/call_frame.hpp"
#include "
ngraph/
runtime/instruction.hpp"
#include "runtime/call_frame.hpp"
#include "runtime/instruction.hpp"
namespace
ngraph
{
...
...
src/
ngraph/
runtime/eigen/return.hpp
→
src/runtime/eigen/return.hpp
View file @
c7cc170c
...
...
@@ -14,8 +14,8 @@
#pragma once
#include "
ngraph/
runtime/call_frame.hpp"
#include "
ngraph/
runtime/instruction.hpp"
#include "runtime/call_frame.hpp"
#include "runtime/instruction.hpp"
namespace
ngraph
{
...
...
src/
ngraph/
runtime/eigen/tensor_view.cpp
→
src/runtime/eigen/tensor_view.cpp
View file @
c7cc170c
File moved
src/
ngraph/
runtime/eigen/tensor_view.hpp
→
src/runtime/eigen/tensor_view.hpp
View file @
c7cc170c
...
...
@@ -17,9 +17,9 @@
#include <Eigen/Dense>
#include <vector>
#include "
ngraph/
shape.hpp"
#include "
ngraph/
runtime/tensor_view.hpp"
#include "
ngraph/
descriptor/tensor_view.hpp"
#include "shape.hpp"
#include "runtime/tensor_view.hpp"
#include "descriptor/tensor_view.hpp"
namespace
ngraph
{
...
...
src/
ngraph/
runtime/instruction.hpp
→
src/runtime/instruction.hpp
View file @
c7cc170c
File moved
src/
ngraph/
runtime/tensor_view.hpp
→
src/runtime/tensor_view.hpp
View file @
c7cc170c
File moved
src/
ngraph/
shape.cpp
→
src/shape.cpp
View file @
c7cc170c
...
...
@@ -15,7 +15,7 @@
#include <algorithm>
#include <vector>
#include "
ngraph/
shape.hpp"
#include "shape.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
src/
ngraph/
shape.hpp
→
src/shape.hpp
View file @
c7cc170c
File moved
src/types/element_type.cpp
View file @
c7cc170c
...
...
@@ -16,7 +16,7 @@
#include <cmath>
#include <iostream>
#include "
ngraph/
element_type.hpp"
#include "element_type.hpp"
#include "log.hpp"
using
namespace
ngraph
;
...
...
src/
ngraph
/element_type.hpp
→
src/
types
/element_type.hpp
View file @
c7cc170c
...
...
@@ -22,7 +22,7 @@
#include <string>
#include <type_traits>
#include "
ngraph/
except.hpp"
#include "except.hpp"
namespace
ngraph
{
...
...
src/types/type.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include <memory>
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
#include "log.hpp"
#include "util.hpp"
...
...
src/
ngraph
/type.hpp
→
src/
types
/type.hpp
View file @
c7cc170c
...
...
@@ -17,8 +17,8 @@
#include <memory>
#include <vector>
#include "
ngraph
/element_type.hpp"
#include "
ngraph/
shape.hpp"
#include "
types
/element_type.hpp"
#include "shape.hpp"
namespace
ngraph
{
...
...
src/util.cpp
View file @
c7cc170c
...
...
@@ -19,7 +19,7 @@
#include <unordered_set>
#include "util.hpp"
#include "n
graph/n
ode.hpp"
#include "node.hpp"
#include "log.hpp"
using
namespace
std
;
...
...
src/
ngraph/
visualize.cpp
→
src/visualize.cpp
View file @
c7cc170c
...
...
@@ -16,8 +16,8 @@
#include <fstream>
#include <list>
#include "n
graph/n
ode.hpp"
#include "
ngraph/
visualize.hpp"
#include "node.hpp"
#include "visualize.hpp"
#include "util.hpp"
using
namespace
ngraph
;
...
...
src/
ngraph/
visualize.hpp
→
src/visualize.hpp
View file @
c7cc170c
File moved
test/build_graph.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include "gtest/gtest.h"
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
#include <memory>
using
namespace
std
;
...
...
test/element_type.cpp
View file @
c7cc170c
...
...
@@ -18,6 +18,6 @@
#include "gtest/gtest.h"
#include "
ngraph
/element_type.hpp"
#include "
types
/element_type.hpp"
using
namespace
ngraph
;
test/execute.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include "gtest/gtest.h"
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
test/input_output_assign.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include "gtest/gtest.h"
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
#include <memory>
using
namespace
std
;
...
...
test/op.cpp
View file @
c7cc170c
...
...
@@ -16,7 +16,7 @@
#include "gtest/gtest.h"
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
test/pass_liveness.cpp
View file @
c7cc170c
...
...
@@ -19,15 +19,15 @@
#include "gtest/gtest.h"
#include "
ngraph/
pass/liveness.hpp"
#include "
ngraph/
pass/assign_tensors.hpp"
#include "
ngraph/
pass/manager.hpp"
#include "
ngraph/
pass/propagate_types.hpp"
#include "
ngraph/
pass/topological_sort.hpp"
#include "
ngraph/
pass/liveness.hpp"
#include "
ngraph/
pass/visualize_tree.hpp"
#include "
ngraph/
pass/dump_sorted.hpp"
#include "ngraph
/ngraph
.hpp"
#include "pass/liveness.hpp"
#include "pass/assign_tensors.hpp"
#include "pass/manager.hpp"
#include "pass/propagate_types.hpp"
#include "pass/topological_sort.hpp"
#include "pass/liveness.hpp"
#include "pass/visualize_tree.hpp"
#include "pass/dump_sorted.hpp"
#include "ngraph.hpp"
#include "test_tools.hpp"
#include "log.hpp"
...
...
test/pass_manager.cpp
View file @
c7cc170c
...
...
@@ -19,11 +19,11 @@
#include "gtest/gtest.h"
#include "ngraph
/ngraph
.hpp"
#include "
ngraph/
pass/assign_tensors.hpp"
#include "
ngraph/
pass/manager.hpp"
#include "
ngraph/
pass/propagate_types.hpp"
#include "
ngraph/
pass/topological_sort.hpp"
#include "ngraph.hpp"
#include "pass/assign_tensors.hpp"
#include "pass/manager.hpp"
#include "pass/propagate_types.hpp"
#include "pass/topological_sort.hpp"
#include "test_tools.hpp"
using
namespace
ngraph
;
...
...
test/pass_memory_layout.cpp
View file @
c7cc170c
...
...
@@ -19,8 +19,8 @@
#include "gtest/gtest.h"
#include "ngraph
/ngraph
.hpp"
#include "
ngraph/
pass/memory_layout.hpp"
#include "ngraph.hpp"
#include "pass/memory_layout.hpp"
#include "test_tools.hpp"
using
namespace
ngraph
;
...
...
test/runtime.cpp
View file @
c7cc170c
...
...
@@ -17,7 +17,7 @@
#include "gtest/gtest.h"
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
test/shape.cpp
View file @
c7cc170c
...
...
@@ -16,7 +16,7 @@
#include "gtest/gtest.h"
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
test/test_tools.cpp
View file @
c7cc170c
...
...
@@ -15,7 +15,7 @@
#include <algorithm>
#include "test_tools.hpp"
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
#include "util.hpp"
using
namespace
std
;
...
...
test/topological_sort.cpp
View file @
c7cc170c
...
...
@@ -19,9 +19,9 @@
#include "gtest/gtest.h"
#include "ngraph
/ngraph
.hpp"
#include "
ngraph/
pass/topological_sort.hpp"
#include "
ngraph/
visualize.hpp"
#include "ngraph.hpp"
#include "pass/topological_sort.hpp"
#include "visualize.hpp"
#include "util.hpp"
#include "log.hpp"
#include "test_tools.hpp"
...
...
test/type_prop.cpp
View file @
c7cc170c
...
...
@@ -14,7 +14,7 @@
#include "gtest/gtest.h"
#include "ngraph
/ngraph
.hpp"
#include "ngraph.hpp"
#include <memory>
using
namespace
std
;
...
...
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