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
98445357
Commit
98445357
authored
Feb 13, 2018
by
Jayaram Bobba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed license headers. Style fixes
parent
dd8017f9
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
227 additions
and
180 deletions
+227
-180
cpu_call_frame.cpp
src/ngraph/runtime/cpu/cpu_call_frame.cpp
+5
-1
cpu_external_function.cpp
src/ngraph/runtime/cpu/cpu_external_function.cpp
+18
-12
cpu_layout_descriptor.cpp
src/ngraph/runtime/cpu/cpu_layout_descriptor.cpp
+23
-13
cpu_layout_descriptor.hpp
src/ngraph/runtime/cpu/cpu_layout_descriptor.hpp
+15
-13
cpu_tensor_view.cpp
src/ngraph/runtime/cpu/cpu_tensor_view.cpp
+15
-13
cpu_tensor_view.hpp
src/ngraph/runtime/cpu/cpu_tensor_view.hpp
+15
-13
cpu_tracing.cpp
src/ngraph/runtime/cpu/cpu_tracing.cpp
+15
-13
cpu_tracing.hpp
src/ngraph/runtime/cpu/cpu_tracing.hpp
+15
-13
mkldnn_utils.cpp
src/ngraph/runtime/cpu/mkldnn_utils.cpp
+24
-18
mkldnn_utils.hpp
src/ngraph/runtime/cpu/mkldnn_utils.hpp
+16
-14
convert_layout.cpp
src/ngraph/runtime/cpu/ops/convert_layout.cpp
+16
-14
convert_layout.hpp
src/ngraph/runtime/cpu/ops/convert_layout.hpp
+15
-13
cpu_layout.cpp
src/ngraph/runtime/cpu/pass/cpu_layout.cpp
+20
-17
cpu_layout.hpp
src/ngraph/runtime/cpu/pass/cpu_layout.hpp
+15
-13
No files found.
src/ngraph/runtime/cpu/cpu_call_frame.cpp
View file @
98445357
...
...
@@ -100,7 +100,11 @@ void runtime::cpu::CPU_CallFrame::propagate_layouts(
}
for
(
size_t
i
=
0
;
i
<
tvs
.
size
();
i
++
)
{
assert
(
layouts
[
i
]);
if
(
layouts
[
i
]
==
nullptr
)
{
throw
ngraph_error
(
"Error propagating layouts - layout information missing from tensor view"
);
}
tvs
[
i
]
->
get_descriptor
()
->
set_tensor_view_layout
(
layouts
[
i
]);
}
}
...
...
src/ngraph/runtime/cpu/cpu_external_function.cpp
View file @
98445357
...
...
@@ -14,7 +14,6 @@
* limitations under the License.
*******************************************************************************/
#include <cassert>
#include <cstdlib>
#include <fstream>
#include <memory>
...
...
@@ -95,6 +94,7 @@
#include "ngraph/runtime/cpu/cpu_external_function.hpp"
#include "ngraph/runtime/cpu/cpu_tensor_view.hpp"
#include "ngraph/runtime/cpu/cpu_tracing.hpp"
#include "ngraph/runtime/cpu/mkldnn_utils.hpp"
#include "ngraph/runtime/cpu/ops/matmul_bias.hpp"
#include "ngraph/runtime/cpu/pass/cpu_fusion.hpp"
#include "ngraph/runtime/cpu/pass/cpu_layout.hpp"
...
...
@@ -105,7 +105,7 @@ using namespace ngraph;
static
const
string
s_output_dir
=
"cpu_codegen"
;
// Temporary Memory Pool alignment
static
const
size_t
MemoryPoolAlignment
=
64
;
static
const
size_t
s_memory_pool_alignment
=
4096
;
class
StaticInitializers
{
...
...
@@ -234,7 +234,7 @@ void runtime::cpu::CPU_ExternalFunction::compile()
pass_manager
.
register_pass
<
runtime
::
cpu
::
pass
::
CPUFusion
>
();
pass_manager
.
register_pass
<
runtime
::
cpu
::
pass
::
CPULayout
>
();
pass_manager
.
register_pass
<
ngraph
::
pass
::
Liveness
>
();
pass_manager
.
register_pass
<
ngraph
::
pass
::
MemoryLayout
>
(
MemoryPoolA
lignment
);
pass_manager
.
register_pass
<
ngraph
::
pass
::
MemoryLayout
>
(
s_memory_pool_a
lignment
);
pass_manager
.
run_passes
(
m_function
);
...
...
@@ -245,11 +245,7 @@ void runtime::cpu::CPU_ExternalFunction::compile()
{
for
(
shared_ptr
<
Node
>
node
:
current_function
->
get_ordered_ops
())
{
if
(
dynamic_cast
<
op
::
Convolution
*>
(
node
.
get
())
||
dynamic_cast
<
op
::
ConvolutionBackpropData
*>
(
node
.
get
())
||
dynamic_cast
<
op
::
ConvolutionBackpropFilters
*>
(
node
.
get
())
||
dynamic_cast
<
op
::
AvgPool
*>
(
node
.
get
())
||
dynamic_cast
<
op
::
MaxPool
*>
(
node
.
get
())
||
dynamic_cast
<
op
::
AvgPoolBackprop
*>
(
node
.
get
()))
if
(
ngraph
::
runtime
::
cpu
::
mkldnn_utils
::
IsMKLDNNOp
(
*
node
))
{
include_mkldnn_headers
=
true
;
}
...
...
@@ -524,7 +520,7 @@ using namespace ngraph::runtime;
writer
<<
"// Memory pool size is "
<<
temp_pool_size
<<
" bytes
\n
"
;
writer
<<
"// Worst case size is "
<<
worst_case_tmp_size
<<
" bytes
\n
"
;
writer
<<
"ngraph::runtime::AlignedBuffer memory_handler("
<<
temp_pool_size
<<
", "
<<
MemoryPoolA
lignment
<<
");
\n
"
;
<<
s_memory_pool_a
lignment
<<
");
\n
"
;
writer
<<
"size_t pool_base_ptr = (size_t)memory_handler.get_ptr();
\n
"
;
writer
<<
"
\n
"
;
...
...
@@ -772,20 +768,30 @@ using namespace ngraph::runtime;
for
(
size_t
i
=
0
;
i
<
parameter
->
get_output_size
();
++
i
)
{
auto
tv
=
parameter
->
get_output_tensor_view
(
i
);
assert
(
tv
->
get_tensor_view_layout
());
if
(
tv
->
get_tensor_view_layout
()
==
nullptr
)
{
throw
ngraph_error
(
"layout missing on function parameter's tensor view: "
+
tv
->
get_name
());
}
parameter_layout_descriptors
.
emplace_back
(
static_pointer_cast
<
runtime
::
cpu
::
LayoutDescriptor
>
(
tv
->
get_tensor_view_layout
()));
}
}
// Store layouts assigned for results
assert
(
result_layout_descriptors
.
empty
());
if
(
!
result_layout_descriptors
.
empty
())
{
throw
ngraph_error
(
"Function output layouts should not be pre-assigned"
);
}
for
(
size_t
i
=
0
;
i
<
m_function
->
get_output_size
();
++
i
)
{
const
auto
&
output
=
m_function
->
get_output_op
(
i
);
for
(
size_t
j
=
0
;
j
<
output
->
get_output_size
();
++
j
)
{
auto
tv
=
output
->
get_output_tensor_view
(
j
);
assert
(
tv
->
get_tensor_view_layout
());
if
(
tv
->
get_tensor_view_layout
()
==
nullptr
)
{
throw
ngraph_error
(
"layout missing on function output tensor: "
+
tv
->
get_name
());
}
result_layout_descriptors
.
emplace_back
(
static_pointer_cast
<
runtime
::
cpu
::
LayoutDescriptor
>
(
tv
->
get_tensor_view_layout
()));
}
...
...
src/ngraph/runtime/cpu/cpu_layout_descriptor.cpp
View file @
98445357
// ----------------------------------------------------------------------------
// 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
// ----------------------------------------------------------------------------
/*******************************************************************************
* Copyright 2017-2018 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 <algorithm>
...
...
@@ -81,16 +83,24 @@ namespace ngraph
{
const
LayoutDescriptor
*
p_other
=
dynamic_cast
<
const
LayoutDescriptor
*>
(
&
other
);
if
(
!
p_other
)
{
return
false
;
}
if
(
get_element_type
()
!=
p_other
->
get_element_type
())
{
return
false
;
}
if
(
strides
!=
p_other
->
strides
)
{
return
false
;
}
if
(
offset
!=
p_other
->
offset
)
{
return
false
;
}
return
true
;
}
...
...
src/ngraph/runtime/cpu/cpu_layout_descriptor.hpp
View file @
98445357
// ----------------------------------------------------------------------------
// 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
// ----------------------------------------------------------------------------
/*******************************************************************************
* Copyright 2017-2018 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.
*******************************************************************************/
#pragma once
...
...
src/ngraph/runtime/cpu/cpu_tensor_view.cpp
View file @
98445357
// ----------------------------------------------------------------------------
// 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
// ----------------------------------------------------------------------------
/*******************************************************************************
* Copyright 2017-2018 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 <cstring>
#include <memory>
...
...
src/ngraph/runtime/cpu/cpu_tensor_view.hpp
View file @
98445357
// ----------------------------------------------------------------------------
// 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
// ----------------------------------------------------------------------------
/*******************************************************************************
* Copyright 2017-2018 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.
*******************************************************************************/
#pragma once
...
...
src/ngraph/runtime/cpu/cpu_tracing.cpp
View file @
98445357
// ----------------------------------------------------------------------------
// Copyright 2018 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
// ----------------------------------------------------------------------------
/*******************************************************************************
* Copyright 2017-2018 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 <fstream>
#include <map>
...
...
src/ngraph/runtime/cpu/cpu_tracing.hpp
View file @
98445357
// ----------------------------------------------------------------------------
// Copyright 2018 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
// ----------------------------------------------------------------------------
/*******************************************************************************
* Copyright 2017-2018 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.
*******************************************************************************/
#pragma once
...
...
src/ngraph/runtime/cpu/mkldnn_utils.cpp
View file @
98445357
// ----------------------------------------------------------------------------
// 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
// ----------------------------------------------------------------------------
/*******************************************************************************
* Copyright 2017-2018 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 <typeindex>
#include <typeinfo>
...
...
@@ -29,17 +31,21 @@ namespace ngraph
{
namespace
cpu
{
namespace
MKLDNN
namespace
mkldnn_utils
{
#define TI(x) std::type_index(typeid(x))
const
std
::
unordered_set
<
std
::
type_index
>
OpRegistry
{
TI
(
ngraph
::
op
::
Convolution
),
TI
(
ngraph
::
op
::
AvgPool
),
TI
(
ngraph
::
op
::
MaxPool
),
};
const
std
::
unordered_set
<
std
::
type_index
>
s_op_registry
{
TI
(
ngraph
::
op
::
AvgPool
),
TI
(
ngraph
::
op
::
AvgPoolBackprop
),
TI
(
ngraph
::
op
::
Convolution
),
TI
(
ngraph
::
op
::
ConvolutionBackpropData
),
TI
(
ngraph
::
op
::
ConvolutionBackpropFilters
),
TI
(
ngraph
::
op
::
MaxPool
)};
bool
IsMKLDNNOp
(
ngraph
::
Node
&
op
)
{
return
(
OpRegistry
.
find
(
TI
(
op
))
!=
OpR
egistry
.
end
());
return
(
s_op_registry
.
find
(
TI
(
op
))
!=
s_op_r
egistry
.
end
());
}
mkldnn
::
memory
::
format
...
...
src/ngraph/runtime/cpu/mkldnn_utils.hpp
View file @
98445357
// ----------------------------------------------------------------------------
// 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
// ----------------------------------------------------------------------------
/*******************************************************************************
* Copyright 2017-2018 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.
*******************************************************************************/
#pragma once
...
...
@@ -29,7 +31,7 @@ namespace ngraph
{
namespace
cpu
{
namespace
MKLDNN
namespace
mkldnn_utils
{
bool
IsMKLDNNOp
(
ngraph
::
Node
&
op
);
mkldnn
::
memory
::
format
...
...
src/ngraph/runtime/cpu/ops/convert_layout.cpp
View file @
98445357
// ----------------------------------------------------------------------------
// Copyright 2018 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
// ----------------------------------------------------------------------------
/*******************************************************************************
* Copyright 2017-2018 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 "convert_layout.hpp"
#include "
ngraph/runtime/cpu/ops/
convert_layout.hpp"
#include "ngraph/runtime/cpu/cpu_layout_descriptor.hpp"
using
namespace
std
;
...
...
src/ngraph/runtime/cpu/ops/convert_layout.hpp
View file @
98445357
// ----------------------------------------------------------------------------
// Copyright 2018 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
// ----------------------------------------------------------------------------
/*******************************************************************************
* Copyright 2017-2018 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.
*******************************************************************************/
#pragma once
...
...
src/ngraph/runtime/cpu/pass/cpu_layout.cpp
View file @
98445357
// ----------------------------------------------------------------------------
// 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
// ----------------------------------------------------------------------------
/*******************************************************************************
* Copyright 2017-2018 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 <algorithm>
#include <memory>
...
...
@@ -22,9 +24,10 @@
#include "ngraph/runtime/cpu/cpu_layout_descriptor.hpp"
#include "ngraph/runtime/cpu/mkldnn_utils.hpp"
using
namespace
ngraph
::
runtime
::
cpu
::
pass
;
//using namespace ngraph::runtime::cpu::pass;
using
namespace
ngraph
;
bool
CPULayout
::
run_on_call_graph
(
const
std
::
list
<
std
::
shared_ptr
<
Node
>>&
nodes
)
bool
runtime
::
cpu
::
pass
::
CPULayout
::
run_on_call_graph
(
const
std
::
list
<
std
::
shared_ptr
<
Node
>>&
nodes
)
{
for
(
const
auto
&
node
:
nodes
)
{
...
...
@@ -49,11 +52,11 @@ bool CPULayout::run_on_call_graph(const std::list<std::shared_ptr<Node>>& nodes)
if
(
tensor
.
is_output
()
||
tensor
.
is_input
()
||
tensor
.
is_constant
())
{
// Set the MKLDNN format to native row-major variants
layout
->
set_mkldnn_format
(
MKLDNN
::
CreateNativeDataFormat
(
*
layout
));
layout
->
set_mkldnn_format
(
mkldnn_utils
::
CreateNativeDataFormat
(
*
layout
));
}
else
{
if
(
ngraph
::
runtime
::
cpu
::
MKLDNN
::
IsMKLDNNOp
(
*
node
))
if
(
ngraph
::
runtime
::
cpu
::
mkldnn_utils
::
IsMKLDNNOp
(
*
node
))
{
// TODO(jmenon): get_inputs is marked as to-be-deprecated
// but get_input_ops isn't a suitable API so this needs to be
...
...
src/ngraph/runtime/cpu/pass/cpu_layout.hpp
View file @
98445357
// ----------------------------------------------------------------------------
// 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
// ----------------------------------------------------------------------------
/*******************************************************************************
* Copyright 2017-2018 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.
*******************************************************************************/
#pragma once
...
...
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