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
1cc36521
Commit
1cc36521
authored
Nov 04, 2019
by
Robert Kimball
Committed by
Scott Cyphers
Nov 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass Manager returns shared_ptr to each pass created. (#3843)
* Return pass created with register_pass call * Add test
parent
476dfe14
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
manager.hpp
src/ngraph/pass/manager.hpp
+5
-3
pass_manager.cpp
test/pass_manager.cpp
+1
-1
No files found.
src/ngraph/pass/manager.hpp
View file @
1cc36521
...
...
@@ -42,13 +42,14 @@ public:
~
Manager
();
template
<
typename
T
,
class
...
Args
>
void
register_pass
(
Args
&&
...
args
)
std
::
shared_ptr
<
T
>
register_pass
(
Args
&&
...
args
)
{
push_pass
<
T
>
(
std
::
forward
<
Args
>
(
args
)...);
auto
rc
=
push_pass
<
T
>
(
std
::
forward
<
Args
>
(
args
)...);
if
(
m_per_pass_validation
)
{
push_pass
<
Validate
>
();
}
return
rc
;
}
void
run_passes
(
std
::
shared_ptr
<
Function
>
,
bool
transitive
=
true
);
...
...
@@ -61,7 +62,7 @@ public:
void
set_per_pass_validation
(
bool
new_state
)
{
m_per_pass_validation
=
new_state
;
}
private
:
template
<
typename
T
,
class
...
Args
>
void
push_pass
(
Args
&&
...
args
)
std
::
shared_ptr
<
T
>
push_pass
(
Args
&&
...
args
)
{
static_assert
(
std
::
is_base_of
<
pass
::
PassBase
,
T
>::
value
,
"pass not derived from pass base"
);
auto
pass
=
std
::
make_shared
<
T
>
(
std
::
forward
<
Args
>
(
args
)...);
...
...
@@ -80,6 +81,7 @@ private:
m_pass_names
.
push_back
(
typeid
(
T
).
name
());
#endif
}
return
pass
;
}
std
::
vector
<
std
::
string
>
m_pass_names
;
...
...
test/pass_manager.cpp
View file @
1cc36521
...
...
@@ -62,7 +62,7 @@ TEST(pass_manager, serialize_with_revalidate_does_not_crash)
pass
::
Manager
pass_manager
;
pass_manager
.
set_per_pass_validation
(
true
);
pass_manager
.
set_pass_serialization
(
true
);
pass_manager
.
register_pass
<
DummyPass
>
();
shared_ptr
<
DummyPass
>
dummy
=
pass_manager
.
register_pass
<
DummyPass
>
();
auto
graph
=
make_test_graph
();
pass_manager
.
run_passes
(
graph
);
...
...
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