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
63bcf1a2
Commit
63bcf1a2
authored
Mar 07, 2018
by
Louis Feng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into louisfeng/NGMX-296-conv_bias
parents
d37b30ad
eb35534e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
109 additions
and
4 deletions
+109
-4
installation.rst
doc/sphinx/source/installation.rst
+5
-4
CMakeLists.txt
src/ngraph/CMakeLists.txt
+1
-0
cpu_external_function.cpp
src/ngraph/runtime/cpu/cpu_external_function.cpp
+2
-0
cpu_nop_elimination.cpp
src/ngraph/runtime/cpu/pass/cpu_nop_elimination.cpp
+64
-0
cpu_nop_elimination.hpp
src/ngraph/runtime/cpu/pass/cpu_nop_elimination.hpp
+37
-0
No files found.
doc/sphinx/source/installation.rst
View file @
63bcf1a2
...
...
@@ -79,10 +79,11 @@ information about how to change or customize this location.
$ cd build && cmake ../ [-DNGRAPH_USE_PREBUILT_LLVM=TRUE]
#. (Optional) Run ``$ make [-jN]`` where ``-jN`` specifies the number of
cores. The example here uses a configuration of ``j8``, which is
good for a system install using an Intel® Xeon® (CPU processor). This step
is **not recommended** with Docker / VM installs.
#. (Optional) Run ``$ make [-jN]`` where ``-jN`` specifies the number of physical
cores to use to build. The example here uses a configuration of ``j8``,
which is good for a system install using an 8-core Intel® Xeon® CPU processor.
This step is **not recommended** for machines with too little RAM available,
such as those whose RAM is superceded by Docker or VM tasks.
.. code-block:: console
...
...
src/ngraph/CMakeLists.txt
View file @
63bcf1a2
...
...
@@ -191,6 +191,7 @@ if (NGRAPH_CPU_ENABLE AND LLVM_INCLUDE_DIR AND
runtime/cpu/pass/cpu_assignment.cpp
runtime/cpu/pass/cpu_fusion.cpp
runtime/cpu/pass/cpu_layout.cpp
runtime/cpu/pass/cpu_nop_elimination.cpp
)
# LLVM binary builds are typically built without RTTI
# The built-in headers are in a version-specific directory
...
...
src/ngraph/runtime/cpu/cpu_external_function.cpp
View file @
63bcf1a2
...
...
@@ -114,6 +114,7 @@
#include "ngraph/runtime/cpu/pass/cpu_assignment.hpp"
#include "ngraph/runtime/cpu/pass/cpu_fusion.hpp"
#include "ngraph/runtime/cpu/pass/cpu_layout.hpp"
#include "ngraph/runtime/cpu/pass/cpu_nop_elimination.hpp"
#ifdef NGRAPH_DISTRIBUTED
#include "ngraph/ops/allreduce.hpp"
...
...
@@ -275,6 +276,7 @@ void runtime::cpu::CPU_ExternalFunction::compile()
ngraph
::
pass
::
Manager
pass_manager
;
pass_manager
.
register_pass
<
runtime
::
cpu
::
pass
::
CPUNopElimination
>
();
pass_manager
.
register_pass
<
ngraph
::
pass
::
CoreFusion
>
();
pass_manager
.
register_pass
<
runtime
::
cpu
::
pass
::
CPUFusion
>
();
pass_manager
.
register_pass
<
runtime
::
cpu
::
pass
::
CPUAssignment
>
(
this
);
...
...
src/ngraph/runtime/cpu/pass/cpu_nop_elimination.cpp
0 → 100644
View file @
63bcf1a2
/*******************************************************************************
* Copyright 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 <memory>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include "cpu_nop_elimination.hpp"
#include "ngraph/ops/pad.hpp"
#define TI(x) std::type_index(typeid(x))
#define HANDLER_DECL(x) \
static bool x(const std::shared_ptr<ngraph::Function>& function, \
const std::shared_ptr<ngraph::Node>& node)
HANDLER_DECL
(
eliminate_pad
)
{
auto
pad
=
std
::
dynamic_pointer_cast
<
ngraph
::
op
::
Pad
>
(
node
);
if
(
pad
->
get_input_shape
(
0
)
==
pad
->
get_output_shape
(
0
))
{
function
->
replace_node
(
node
,
node
->
get_input_op
(
0
));
return
true
;
}
return
false
;
}
static
const
std
::
unordered_map
<
std
::
type_index
,
std
::
function
<
bool
(
const
std
::
shared_ptr
<
ngraph
::
Function
>&
,
const
std
::
shared_ptr
<
ngraph
::
Node
>&
)
>>
dispatcher
{{
TI
(
ngraph
::
op
::
Pad
),
&
eliminate_pad
}};
bool
ngraph
::
runtime
::
cpu
::
pass
::
CPUNopElimination
::
run_on_function
(
std
::
shared_ptr
<
ngraph
::
Function
>
function
)
{
bool
clobbered
=
false
;
for
(
const
auto
&
n
:
function
->
get_ops
())
{
// Work around a warning [-Wpotentially-evaluated-expression]
const
Node
&
node
=
*
n
;
auto
handler
=
dispatcher
.
find
(
TI
(
node
));
if
(
handler
!=
dispatcher
.
end
())
{
clobbered
=
handler
->
second
(
function
,
n
)
||
clobbered
;
}
}
return
clobbered
;
}
src/ngraph/runtime/cpu/pass/cpu_nop_elimination.hpp
0 → 100644
View file @
63bcf1a2
/*******************************************************************************
* Copyright 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
#include "ngraph/pass/pass.hpp"
namespace
ngraph
{
namespace
runtime
{
namespace
cpu
{
namespace
pass
{
class
CPUNopElimination
:
public
ngraph
::
pass
::
FunctionPass
{
public
:
bool
run_on_function
(
std
::
shared_ptr
<
ngraph
::
Function
>
function
)
override
;
};
}
}
}
}
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