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
4a535604
Commit
4a535604
authored
Mar 09, 2019
by
Paul
Browse files
Formatting
parent
f1f9770b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
8 deletions
+14
-8
src/dead_code_elimination.cpp
src/dead_code_elimination.cpp
+2
-1
src/schedule.cpp
src/schedule.cpp
+10
-5
test/schedule_test.cpp
test/schedule_test.cpp
+2
-2
No files found.
src/dead_code_elimination.cpp
View file @
4a535604
...
...
@@ -42,7 +42,8 @@ void dead_code_elimination::apply(program& p) const
if
(
i
==
last
)
break
;
// Skip instruction with empty shape as output unless its a builtin or undefined or identity
if
(
i
->
get_shape
().
elements
()
==
0
and
i
->
name
().
front
()
!=
'@'
and
i
->
name
()
!=
"undefined"
and
i
->
name
()
!=
"identity"
)
if
(
i
->
get_shape
().
elements
()
==
0
and
i
->
name
().
front
()
!=
'@'
and
i
->
name
()
!=
"undefined"
and
i
->
name
()
!=
"identity"
)
continue
;
assert
(
bidistance
(
p
,
i
,
last
)
>
0
);
fix
([
&
](
auto
self
,
auto
leaf
)
{
...
...
src/schedule.cpp
View file @
4a535604
...
...
@@ -276,11 +276,16 @@ struct stream_info
result
[
merge
].
resize
(
stream
+
1
);
auto
&&
r
=
result
[
merge
][
stream
];
r
.
push_back
(
ins
);
// Copy inputs if they dont have a stream(and are not a builtin and context free)
// Inputs without a stream can have a implicit dependency
std
::
copy_if
(
ins
->
inputs
().
begin
(),
ins
->
inputs
().
end
(),
std
::
back_inserter
(
r
),
[
&
](
auto
x
)
{
return
not
this
->
has_stream
(
x
)
and
not
is_context_free
(
x
->
get_operator
())
and
x
->
name
().
front
()
!=
'@'
;
});
// Copy inputs if they dont have a stream(and are not a builtin and context
// free) Inputs without a stream can have a implicit dependency
std
::
copy_if
(
ins
->
inputs
().
begin
(),
ins
->
inputs
().
end
(),
std
::
back_inserter
(
r
),
[
&
](
auto
x
)
{
return
not
this
->
has_stream
(
x
)
and
not
is_context_free
(
x
->
get_operator
())
and
x
->
name
().
front
()
!=
'@'
;
});
}
}
}
...
...
test/schedule_test.cpp
View file @
4a535604
...
...
@@ -240,8 +240,8 @@ TEST_CASE(zero_record)
auto
one
=
p
.
add_literal
(
1
);
auto
onep1
=
p
.
add_instruction
(
unary_op
{},
one
);
auto
onep2
=
p
.
add_instruction
(
unary_op
{},
one
);
auto
onei1
=
p
.
add_instruction
(
migraphx
::
op
::
identity
{},
onep1
);
auto
onei2
=
p
.
add_instruction
(
migraphx
::
op
::
identity
{},
onep2
);
auto
onei1
=
p
.
add_instruction
(
migraphx
::
op
::
identity
{},
onep1
);
auto
onei2
=
p
.
add_instruction
(
migraphx
::
op
::
identity
{},
onep2
);
auto
binary
=
p
.
add_instruction
(
nary_op
{},
onei1
,
onei2
);
p
.
compile
(
t
);
EXPECT
(
not
t
.
has_stream
(
one
));
...
...
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