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
2eb12723
Commit
2eb12723
authored
Mar 29, 2023
by
Khalique Ahmed
Browse files
formatting
parent
c80393b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
src/eliminate_layout.cpp
src/eliminate_layout.cpp
+9
-7
No files found.
src/eliminate_layout.cpp
View file @
2eb12723
...
...
@@ -61,9 +61,11 @@ std::unordered_set<instruction_ref> preserve_output_layout(module& m)
{
auto
permutation
=
find_permutation
(
output
->
get_shape
());
auto
layout_ins
=
m
.
insert_instruction
(
std
::
next
(
output
),
make_op
(
"layout"
,
{{
"permutation"
,
permutation
}}),
output
);
auto
layout_ins
=
m
.
insert_instruction
(
std
::
next
(
output
),
make_op
(
"layout"
,
{{
"permutation"
,
permutation
}}),
output
);
auto
output1
=
m
.
insert_instruction
(
layout_ins
,
make_op
(
"allocate"
,
{{
"shape"
,
to_value
(
layout_ins
->
get_shape
())}}));
auto
output1
=
m
.
insert_instruction
(
layout_ins
,
make_op
(
"allocate"
,
{{
"shape"
,
to_value
(
layout_ins
->
get_shape
())}}));
std
::
vector
<
instruction_ref
>
refs
=
layout_ins
->
inputs
();
refs
.
push_back
(
output1
);
...
...
@@ -74,15 +76,15 @@ std::unordered_set<instruction_ref> preserve_output_layout(module& m)
layout_ins
->
module_inputs
());
// auto layout = m.insert_instruction(
// std::next(output),
// make_op("gpu::precompile_op", {{"op", to_value(layout_ins->get_operator())}}), output);
// std::next(output),
// make_op("gpu::precompile_op", {{"op", to_value(layout_ins->get_operator())}}),
// output);
// m.debug_print();
result
.
insert
(
layout
);
}
return
result
;
}
void
remove_layout
(
module
&
m
,
const
std
::
unordered_set
<
instruction_ref
>&
output_layouts
)
{
for
(
auto
ins
:
iterator_for
(
m
))
...
...
@@ -91,8 +93,8 @@ void remove_layout(module& m, const std::unordered_set<instruction_ref>& output_
continue
;
auto
precompile_op
=
ins
->
get_operator
();
auto
val
=
precompile_op
.
to_value
();
auto
val
=
precompile_op
.
to_value
();
if
(
val
[
"op"
].
at
(
"name"
)
!=
"layout"
)
continue
;
if
(
ins
->
get_shape
()
!=
ins
->
inputs
().
front
()
->
get_shape
())
...
...
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