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
b1126322
Commit
b1126322
authored
Aug 11, 2022
by
turneram
Browse files
Initial implementation works; should be refactored
parent
5bf4dee6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
1 deletion
+32
-1
src/simplify_algebra.cpp
src/simplify_algebra.cpp
+32
-1
No files found.
src/simplify_algebra.cpp
View file @
b1126322
...
@@ -804,11 +804,42 @@ struct find_conv_dot_horiz_fusion
...
@@ -804,11 +804,42 @@ struct find_conv_dot_horiz_fusion
if
(
name
==
"dot"
)
if
(
name
==
"dot"
)
{
{
axis
=
int
(
args
.
front
()
->
get_shape
().
lens
().
size
()
-
1
);
axis
=
int
(
args
.
front
()
->
get_shape
().
lens
().
size
()
-
1
);
concat_axis
=
axis
;
concat_axis
=
axis
-
1
;
for
(
auto
&
arg
:
args
)
{
arg
=
arg
->
inputs
().
front
();
m
.
move_instructions
(
arg
,
input
);
}
// TODO: Check if axises match
auto
concat
=
m
.
insert_instruction
(
input
,
make_op
(
"concat"
,
{{
"axis"
,
concat_axis
}}),
args
);
auto
batch_size
=
input
->
get_shape
().
lens
().
front
();
auto
sequence_length
=
input
->
get_shape
().
lens
().
at
(
1
);
auto
hidden_size
=
input
->
get_shape
().
lens
().
at
(
2
);
auto
reshape
=
m
.
insert_instruction
(
std
::
next
(
input
),
make_op
(
"reshape"
,
{{
"dims"
,
{
batch_size
*
sequence_length
,
hidden_size
}}}),
input
);
auto
fused
=
m
.
insert_instruction
(
std
::
next
(
reshape
),
op
,
reshape
,
concat
);
int64_t
offset
=
0
;
for
(
auto
arg
:
range
(
start
,
last
))
{
fused
=
m
.
insert_instruction
(
std
::
next
(
fused
),
make_op
(
"reshape"
,
{{
"dims"
,
{
batch_size
,
sequence_length
,
hidden_size
*
3
}}}),
fused
);
int64_t
len
=
arg
->
get_shape
().
lens
()[
axis
];
m
.
replace_instruction
(
arg
,
make_op
(
"slice"
,
{{
"axes"
,
{
axis
}},
{
"starts"
,
{
offset
}},
{
"ends"
,
{
offset
+
len
}}}),
fused
);
offset
+=
len
;
}
return
;
}
}
for
(
auto
arg
:
args
)
for
(
auto
arg
:
args
)
m
.
move_instructions
(
arg
,
input
);
m
.
move_instructions
(
arg
,
input
);
// TODO: Check if axises match
// TODO: Check if axises match
auto
concat
=
auto
concat
=
m
.
insert_instruction
(
input
,
make_op
(
"concat"
,
{{
"axis"
,
concat_axis
}}),
args
);
m
.
insert_instruction
(
input
,
make_op
(
"concat"
,
{{
"axis"
,
concat_axis
}}),
args
);
...
...
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