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
0d94f068
Commit
0d94f068
authored
Jan 31, 2023
by
Paul
Browse files
Format
parent
bb7f65d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
src/include/migraphx/matcher.hpp
src/include/migraphx/matcher.hpp
+1
-1
src/targets/gpu/prefuse_ops.cpp
src/targets/gpu/prefuse_ops.cpp
+5
-4
No files found.
src/include/migraphx/matcher.hpp
View file @
0d94f068
...
...
@@ -615,7 +615,7 @@ inline auto var(std::string s)
[
=
,
s
=
std
::
move
(
s
)](
const
matcher_context
&
ctx
,
instruction_ref
)
->
optional
<
instruction_ref
>
{
auto
it
=
ctx
.
instructions
.
find
(
s
);
if
(
it
==
ctx
.
instructions
.
end
())
if
(
it
==
ctx
.
instructions
.
end
())
return
nullopt
;
return
it
->
second
;
});
...
...
src/targets/gpu/prefuse_ops.cpp
View file @
0d94f068
...
...
@@ -92,9 +92,9 @@ struct find_layernorm
{
auto
ins
=
r
.
result
;
auto
x_ins
=
r
.
instructions
[
"x"
];
float
eps
=
0
;
float
eps
=
0
;
if
(
contains
(
r
.
instructions
,
"eps"
))
eps
=
r
.
instructions
[
"eps"
]
->
eval
().
at
<
float
>
();
eps
=
r
.
instructions
[
"eps"
]
->
eval
().
at
<
float
>
();
m
.
replace_instruction
(
ins
,
layernorm
{
eps
},
x_ins
);
}
...
...
@@ -104,14 +104,15 @@ struct find_add_layernorm
{
auto
matcher
()
const
{
return
match
::
name
(
"gpu::prelayernorm"
)(
match
::
args
(
match
::
name
(
"add"
)(
match
::
used_once
()).
bind
(
"add"
)));
return
match
::
name
(
"gpu::prelayernorm"
)(
match
::
args
(
match
::
name
(
"add"
)(
match
::
used_once
()).
bind
(
"add"
)));
}
void
apply
(
module
&
m
,
const
match
::
matcher_result
&
r
)
const
{
auto
ins
=
r
.
result
;
auto
add_ins
=
r
.
instructions
[
"add"
];
auto
op
=
any_cast
<
layernorm
>
(
ins
->
get_operator
());
auto
op
=
any_cast
<
layernorm
>
(
ins
->
get_operator
());
m
.
replace_instruction
(
ins
,
add_layernorm
{
op
.
epsilon
},
add_ins
->
inputs
());
}
...
...
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