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
5720e319
Commit
5720e319
authored
Nov 08, 2018
by
Rob Earhart
Committed by
Scott Cyphers
Nov 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Isolate mutable pass managers (#2015)
parent
e5d9b540
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
12 deletions
+21
-12
plaidml_compiler.cpp
src/ngraph/runtime/plaidml/plaidml_compiler.cpp
+21
-10
plaidml_compiler.hpp
src/ngraph/runtime/plaidml/plaidml_compiler.hpp
+0
-2
No files found.
src/ngraph/runtime/plaidml/plaidml_compiler.cpp
View file @
5720e319
...
...
@@ -22,6 +22,7 @@
#include "ngraph/pass/get_output_element_elimination.hpp"
#include "ngraph/pass/like_replacement.hpp"
#include "ngraph/pass/liveness.hpp"
#include "ngraph/pass/manager.hpp"
#include "ngraph/pass/nop_elimination.hpp"
#include "ngraph/runtime/plaidml/plaidml_impl.hpp"
#include "ngraph/runtime/plaidml/plaidml_logger.hpp"
...
...
@@ -58,21 +59,31 @@ namespace
ngraph
::
runtime
::
plaidml
::
Compiler
::
Compiler
(
Config
*
config
)
:
m_config
{
config
}
{
// We apply the same general-purposes passes as the CPU backend.
m_pass_manager
.
register_pass
<
ngraph
::
pass
::
LikeReplacement
>
();
m_pass_manager
.
register_pass
<
ngraph
::
pass
::
NopElimination
>
();
m_pass_manager
.
register_pass
<
ngraph
::
pass
::
AlgebraicSimplification
>
();
m_pass_manager
.
register_pass
<
ngraph
::
pass
::
CommonSubexpressionElimination
>
();
m_pass_manager
.
register_pass
<
ngraph
::
pass
::
CoreFusion
>
();
// N.B. We'd like to register ngraph::pass::GetOutputElementElimination, but it breaks BatchNorm
// backprop
m_pass_manager
.
register_pass
<
ngraph
::
pass
::
Liveness
>
();
}
std
::
shared_ptr
<
ngraph
::
runtime
::
plaidml
::
CompiledFunction
>
ngraph
::
runtime
::
plaidml
::
Compiler
::
compile
(
std
::
shared_ptr
<
Function
>
func
)
{
m_pass_manager
.
run_passes
(
func
);
// N.B. ngraph::pass::Manager::run_passes() is *not* a const
// method; it mutates the manager, possibly causing corruption if
// multiple threads are simultaneously running passes. So we
// build a new manager for each compilation, instead of building
// one when we build the Compiler and reusing it for each
// compilation.
ngraph
::
pass
::
Manager
pass_manager
;
// We apply the same general-purposes passes as the CPU backend.
pass_manager
.
register_pass
<
ngraph
::
pass
::
LikeReplacement
>
();
pass_manager
.
register_pass
<
ngraph
::
pass
::
NopElimination
>
();
pass_manager
.
register_pass
<
ngraph
::
pass
::
AlgebraicSimplification
>
();
pass_manager
.
register_pass
<
ngraph
::
pass
::
CommonSubexpressionElimination
>
();
pass_manager
.
register_pass
<
ngraph
::
pass
::
CoreFusion
>
();
// N.B. We'd like to register ngraph::pass::GetOutputElementElimination, but it breaks BatchNorm
// backprop
pass_manager
.
register_pass
<
ngraph
::
pass
::
Liveness
>
();
pass_manager
.
run_passes
(
func
);
Build
b
;
build
(
std
::
move
(
func
),
&
b
);
...
...
src/ngraph/runtime/plaidml/plaidml_compiler.hpp
View file @
5720e319
...
...
@@ -21,7 +21,6 @@
#include <plaidml/plaidml++.h>
#include "ngraph/function.hpp"
#include "ngraph/pass/manager.hpp"
#include "ngraph/runtime/plaidml/plaidml_compiled_function.hpp"
#include "ngraph/runtime/plaidml/plaidml_config.hpp"
...
...
@@ -49,5 +48,4 @@ public:
private
:
Config
*
m_config
;
ngraph
::
pass
::
Manager
m_pass_manager
;
};
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