Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
a4a654c9
Commit
a4a654c9
authored
Oct 06, 2018
by
Paul
Browse files
Add either_arg matcher
parent
7c416eb9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
src/include/migraph/matcher.hpp
src/include/migraph/matcher.hpp
+10
-0
src/targets/gpu/fuse_ops.cpp
src/targets/gpu/fuse_ops.cpp
+4
-5
No files found.
src/include/migraph/matcher.hpp
View file @
a4a654c9
...
@@ -310,6 +310,16 @@ auto args(Ms... ms)
...
@@ -310,6 +310,16 @@ auto args(Ms... ms)
});
});
}
}
auto
either_arg
(
std
::
size_t
i
,
std
::
size_t
j
)
{
return
[
=
](
auto
m1
,
auto
m2
)
{
return
match
::
any_of
(
match
::
all_of
(
arg
(
i
)(
m1
),
arg
(
j
)(
m2
)),
match
::
all_of
(
arg
(
j
)(
m1
),
arg
(
i
)(
m2
))
);
};
}
}
// namespace match
}
// namespace match
}
// namespace migraph
}
// namespace migraph
...
...
src/targets/gpu/fuse_ops.cpp
View file @
a4a654c9
...
@@ -167,11 +167,10 @@ struct match_conv_bias
...
@@ -167,11 +167,10 @@ struct match_conv_bias
context
*
ctx
=
nullptr
;
context
*
ctx
=
nullptr
;
auto
matcher
()
const
auto
matcher
()
const
{
{
return
match
::
name
(
"gpu::add"
)(
match
::
any_of
(
return
match
::
name
(
"gpu::add"
)(
match
::
either_arg
(
0
,
1
)(
match
::
all_of
(
match
::
arg
(
0
)(
match
::
broadcast_shape
().
bind
(
"bias"
)),
match
::
broadcast_shape
().
bind
(
"bias"
),
match
::
arg
(
1
)(
match
::
name
(
"gpu::convolution"
).
bind
(
"conv"
))),
match
::
name
(
"gpu::convolution"
).
bind
(
"conv"
)
match
::
all_of
(
match
::
arg
(
1
)(
match
::
broadcast_shape
().
bind
(
"bias"
)),
));
match
::
arg
(
0
)(
match
::
name
(
"gpu::convolution"
).
bind
(
"conv"
)))));
}
}
void
apply
(
program
&
p
,
match
::
matcher_result
r
)
const
void
apply
(
program
&
p
,
match
::
matcher_result
r
)
const
...
...
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