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
cf5e3623
Commit
cf5e3623
authored
May 24, 2019
by
Adam Procter
Committed by
Robert Kimball
May 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport fix from #2973 (#2976)
parent
7ad4c0ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
graph_rewrite.cpp
src/ngraph/pass/graph_rewrite.cpp
+13
-4
No files found.
src/ngraph/pass/graph_rewrite.cpp
View file @
cf5e3623
...
...
@@ -64,7 +64,11 @@ bool pass::GraphRewrite::run_on_function(shared_ptr<Function> f)
const
size_t
NUM_TRIES
=
10
;
size_t
tries
=
NUM_TRIES
;
vector
<
MatchClosure
>
original_matchers
{
m_matchers
};
bool
is_dyn_func
=
f
->
is_dynamic
();
// This check is very expensive and is only needed for experimental features, so we will hide
// it behind an environment variable for now. TODO: Find a less expensive way to handle this.
static
bool
s_rerun_dynamic_check
=
(
std
::
getenv
(
"NGRAPH_GRAPH_REWRITE_RERUN_DYNAMIC_CHECK"
)
!=
nullptr
);
bool
is_dyn_func
=
s_rerun_dynamic_check
&&
f
->
is_dynamic
();
do
{
rewritten
=
false
;
...
...
@@ -98,7 +102,7 @@ bool pass::GraphRewrite::run_on_function(shared_ptr<Function> f)
// update the cached value.
if
(
closure
.
property
.
is_set
(
PassProperty
::
CHANGE_DYNAMIC_STATE
))
{
is_dyn_func
=
f
->
is_dynamic
();
is_dyn_func
=
s_rerun_dynamic_check
&&
f
->
is_dynamic
();
}
break
;
}
...
...
@@ -198,8 +202,13 @@ bool pass::RecurrentGraphRewrite::run_on_function(shared_ptr<Function> f)
bool
changed
=
false
;
size_t
i
=
0
;
// This check is very expensive and is only needed for experimental features, so we will hide
// it behind an environment variable for now. TODO: Find a less expensive way to handle this.
static
bool
s_rerun_dynamic_check
=
(
std
::
getenv
(
"NGRAPH_GRAPH_REWRITE_RERUN_DYNAMIC_CHECK"
)
!=
nullptr
);
auto
run_matchers
=
[
&
]()
->
bool
{
bool
is_dyn_func
=
f
->
is_dynamic
();
bool
is_dyn_func
=
s_rerun_dynamic_check
&&
f
->
is_dynamic
();
for
(
auto
node
:
f
->
get_ops
())
{
for
(
auto
&
closure
:
m_matchers
)
...
...
@@ -223,7 +232,7 @@ bool pass::RecurrentGraphRewrite::run_on_function(shared_ptr<Function> f)
// update the cached value.
if
(
closure
.
property
.
is_set
(
PassProperty
::
CHANGE_DYNAMIC_STATE
))
{
is_dyn_func
=
f
->
is_dynamic
();
is_dyn_func
=
s_rerun_dynamic_check
&&
f
->
is_dynamic
();
}
return
true
;
}
...
...
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