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
3c733048
Commit
3c733048
authored
Feb 08, 2022
by
Shucai Xiao
Browse files
refine implementation
parent
255d6868
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
src/auto_contiguous.cpp
src/auto_contiguous.cpp
+5
-0
No files found.
src/auto_contiguous.cpp
View file @
3c733048
...
@@ -19,6 +19,10 @@ void auto_contiguous::apply(module& p) const
...
@@ -19,6 +19,10 @@ void auto_contiguous::apply(module& p) const
auto
args
=
ins
->
inputs
();
auto
args
=
ins
->
inputs
();
auto
new_args
=
args
;
auto
new_args
=
args
;
std
::
transform
(
args
.
begin
(),
args
.
end
(),
new_args
.
begin
(),
[
&
](
auto
in
)
{
std
::
transform
(
args
.
begin
(),
args
.
end
(),
new_args
.
begin
(),
[
&
](
auto
in
)
{
if
(
in
->
name
()
==
"contiguous"
)
{
return
in
;
}
return
p
.
insert_instruction
(
ins
,
make_op
(
"contiguous"
),
in
);
return
p
.
insert_instruction
(
ins
,
make_op
(
"contiguous"
),
in
);
});
});
...
@@ -32,6 +36,7 @@ void auto_contiguous::apply(module& p) const
...
@@ -32,6 +36,7 @@ void auto_contiguous::apply(module& p) const
auto
last
=
std
::
prev
(
p
.
end
());
auto
last
=
std
::
prev
(
p
.
end
());
for
(
auto
ins
:
iterator_for
(
p
))
for
(
auto
ins
:
iterator_for
(
p
))
{
{
// for last instruction that is NOT a return
if
(
ins
->
outputs
().
empty
()
and
ins
!=
last
)
if
(
ins
->
outputs
().
empty
()
and
ins
!=
last
)
continue
;
continue
;
shape
s
=
ins
->
get_shape
();
shape
s
=
ins
->
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