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
5f8d7005
Commit
5f8d7005
authored
Nov 22, 2019
by
Ashok Emani
Committed by
Scott Cyphers
Nov 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add env pass filtering to core (#3905)
parent
90c70dde
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
10 deletions
+25
-10
manager.hpp
src/ngraph/pass/manager.hpp
+19
-10
pass_config.cpp
src/ngraph/pass/pass_config.cpp
+5
-0
pass_config.hpp
src/ngraph/pass/pass_config.hpp
+1
-0
No files found.
src/ngraph/pass/manager.hpp
View file @
5f8d7005
...
...
@@ -44,6 +44,11 @@ public:
template
<
typename
T
,
class
...
Args
>
void
register_pass
(
Args
&&
...
args
)
{
auto
pass
=
get_pass_name
(
typeid
(
T
).
name
());
if
(
m_pass_config
.
is_pass_configured
(
pass
)
&&
!
m_pass_config
.
get_pass_enable
(
pass
))
{
return
;
}
push_pass
<
T
>
(
std
::
forward
<
Args
>
(
args
)...);
if
(
m_per_pass_validation
)
{
...
...
@@ -60,6 +65,19 @@ public:
void
set_pass_serialization
(
bool
new_state
)
{
m_serialize
=
new_state
;
}
void
set_per_pass_validation
(
bool
new_state
)
{
m_per_pass_validation
=
new_state
;
}
private
:
std
::
string
get_pass_name
(
const
std
::
string
&
name
)
{
#ifdef _WIN32
// MSVC produce a human-readable type name like class ngraph::pass::LikeReplacement
// by typeid(T).name(). Later ofstream doesn't accept it as a valid file name.
//
auto
pos
=
name
.
find_last_of
(
":"
);
return
name
.
substr
(
pos
+
1
);
#elif defined(__linux) || defined(__APPLE__)
return
name
;
#endif
}
template
<
typename
T
,
class
...
Args
>
void
push_pass
(
Args
&&
...
args
)
{
...
...
@@ -69,16 +87,7 @@ private:
m_pass_list
.
push_back
(
pass_base
);
if
(
m_visualize
||
m_serialize
)
{
#ifdef _WIN32
// MSVC produce a human-readable type name like class ngraph::pass::LikeReplacement
// by typeid(T).name(). Later ofstream doesn't accept it as a valid file name.
//
std
::
string
str
=
typeid
(
T
).
name
();
auto
pos
=
str
.
find_last_of
(
":"
);
m_pass_names
.
push_back
(
str
.
substr
(
pos
+
1
));
#elif defined(__linux) || defined(__APPLE__)
m_pass_names
.
push_back
(
typeid
(
T
).
name
());
#endif
m_pass_names
.
push_back
(
get_pass_name
(
typeid
(
T
).
name
()));
}
}
...
...
src/ngraph/pass/pass_config.cpp
View file @
5f8d7005
...
...
@@ -80,6 +80,11 @@ pass::PassConfig::PassConfig()
}
}
bool
pass
::
PassConfig
::
is_pass_configured
(
const
string
&
name
)
const
{
return
(
m_pass_enables
.
find
(
name
)
!=
m_pass_enables
.
end
());
}
void
pass
::
PassConfig
::
set_pass_enable
(
const
string
&
name
,
bool
enable
)
{
m_pass_enables
[
name
]
=
enable
;
...
...
src/ngraph/pass/pass_config.hpp
View file @
5f8d7005
...
...
@@ -32,6 +32,7 @@ class ngraph::pass::PassConfig
public
:
PassConfig
();
const
std
::
map
<
std
::
string
,
bool
>&
get_enables
()
const
{
return
m_pass_enables
;
}
bool
is_pass_configured
(
const
std
::
string
&
name
)
const
;
void
set_pass_enable
(
const
std
::
string
&
name
,
bool
enable
);
bool
get_pass_enable
(
const
std
::
string
&
name
)
const
;
const
std
::
map
<
std
::
string
,
bool
>&
get_pass_attributes
()
const
{
return
m_pass_attributes
;
}
...
...
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