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
a22ae993
Commit
a22ae993
authored
Feb 17, 2022
by
Shucai Xiao
Browse files
refine the changes
parent
c201c46b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
9 deletions
+11
-9
src/auto_contiguous.cpp
src/auto_contiguous.cpp
+1
-1
src/include/migraphx/shape.hpp
src/include/migraphx/shape.hpp
+1
-1
src/simplify_reshapes.cpp
src/simplify_reshapes.cpp
+3
-1
test/print_graph_test.cpp
test/print_graph_test.cpp
+6
-6
No files found.
src/auto_contiguous.cpp
View file @
a22ae993
...
...
@@ -58,7 +58,7 @@ void auto_contiguous::apply(module& p) const
continue
;
auto
ins_alias
=
ins
->
get_operator
().
output_alias
({});
if
(
ins_alias
==
0
)
if
(
ins_alias
==
0
and
ins
->
get_shape
().
element_space
()
!=
ins
->
inputs
().
front
()
->
get_shape
().
element_space
()
)
{
auto
cont_ins
=
p
.
insert_instruction
(
last
,
make_op
(
"contiguous"
),
ins
);
p
.
replace_instruction
(
ins
,
cont_ins
);
...
...
src/include/migraphx/shape.hpp
View file @
a22ae993
...
...
@@ -223,11 +223,11 @@ struct shape
static
type_t
parse_type
(
const
std
::
string
&
s
);
const
std
::
vector
<
shape
>&
sub_shapes
()
const
;
std
::
size_t
element_space
()
const
;
private:
std
::
shared_ptr
<
const
shape_impl
>
impl
;
std
::
size_t
element_space
()
const
;
};
void
migraphx_to_value
(
value
&
v
,
const
shape
&
s
);
...
...
src/simplify_reshapes.cpp
View file @
a22ae993
...
...
@@ -120,7 +120,9 @@ struct find_nop_reshapes
void
apply
(
module
&
p
,
const
match
::
matcher_result
&
mr
)
const
{
auto
ins
=
mr
.
result
;
if
(
ins
->
name
()
==
"contiguous"
)
// output of reshape and contiguous is standard, so no need to add another contiguous
// if the output is used an a ret value
if
(
ins
->
name
()
==
"contiguous"
and
ins
->
name
()
!=
"contiguous"
and
ins
->
name
()
!=
"reshape"
)
{
auto
&
outputs
=
ins
->
outputs
();
if
(
std
::
any_of
(
...
...
test/print_graph_test.cpp
View file @
a22ae993
...
...
@@ -34,12 +34,12 @@ TEST_CASE(basic_graph_test)
EXPECT
(
migraphx
::
contains
(
test
,
"
\"
main:@0
\"
[label=
\"
@literal
\"
]"
));
EXPECT
(
migraphx
::
contains
(
test
,
"
\"
y
\"
[label=
\"
@param:y
\"
]"
));
EXPECT
(
migraphx
::
contains
(
test
,
"
\"
x
\"
[label=
\"
@param:x
\"
]"
));
EXPECT
(
migraphx
::
contains
(
test
,
"
\"
main:@
1
\"
[label=
\"
sum
\"
]"
));
EXPECT
(
migraphx
::
contains
(
test
,
"
\"
main:@
2
\"
[label=
\"
sum
\"
]"
));
EXPECT
(
migraphx
::
contains
(
test
,
"
\"
x
\"
->
\"
main:@
1
\"
"
));
EXPECT
(
migraphx
::
contains
(
test
,
"
\"
y
\"
->
\"
main:@
1
\"
"
));
EXPECT
(
migraphx
::
contains
(
test
,
"
\"
main:@
1
\"
->
\"
main:@
2
\"
"
));
EXPECT
(
migraphx
::
contains
(
test
,
"
\"
main:@0
\"
->
\"
main:@
2
\"
"
));
EXPECT
(
migraphx
::
contains
(
test
,
"
\"
main:@
3
\"
[label=
\"
sum
\"
]"
));
EXPECT
(
migraphx
::
contains
(
test
,
"
\"
main:@
4
\"
[label=
\"
sum
\"
]"
));
EXPECT
(
migraphx
::
contains
(
test
,
"
\"
x
\"
->
\"
main:@
3
\"
"
));
EXPECT
(
migraphx
::
contains
(
test
,
"
\"
y
\"
->
\"
main:@
3
\"
"
));
EXPECT
(
migraphx
::
contains
(
test
,
"
\"
main:@
3
\"
->
\"
main:@
4
\"
"
));
EXPECT
(
migraphx
::
contains
(
test
,
"
\"
main:@0
\"
->
\"
main:@
4
\"
"
));
EXPECT
(
migraphx
::
contains
(
test
,
"[label=
\"
int64_type, {1}, {0}
\"
]"
));
}
...
...
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