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
62970436
Commit
62970436
authored
Sep 15, 2018
by
Paul
Browse files
Rename output field
parent
7cafc6cd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
11 deletions
+11
-11
src/dead_code_elimination.cpp
src/dead_code_elimination.cpp
+1
-1
src/include/migraph/instruction.hpp
src/include/migraph/instruction.hpp
+2
-2
src/program.cpp
src/program.cpp
+5
-5
src/simplify_reshapes.cpp
src/simplify_reshapes.cpp
+2
-2
src/targets/gpu/eliminate_workspace.cpp
src/targets/gpu/eliminate_workspace.cpp
+1
-1
No files found.
src/dead_code_elimination.cpp
View file @
62970436
...
@@ -24,7 +24,7 @@ void dead_code_elimination::apply(program& p) const
...
@@ -24,7 +24,7 @@ void dead_code_elimination::apply(program& p) const
break
;
break
;
fix
([
&
](
auto
self
,
auto
leaf
)
{
fix
([
&
](
auto
self
,
auto
leaf
)
{
assert
(
p
.
has_instruction
(
leaf
));
assert
(
p
.
has_instruction
(
leaf
));
if
(
leaf
->
output
.
empty
())
if
(
leaf
->
output
s
()
.
empty
())
{
{
auto
args
=
leaf
->
inputs
();
auto
args
=
leaf
->
inputs
();
leaf
->
clear_arguments
();
leaf
->
clear_arguments
();
...
...
src/include/migraph/instruction.hpp
View file @
62970436
...
@@ -57,8 +57,8 @@ struct instruction
...
@@ -57,8 +57,8 @@ struct instruction
bool
valid
(
instruction_ref
start
)
const
bool
valid
(
instruction_ref
start
)
const
{
{
return
valid
()
&&
std
::
all_of
(
arguments
.
begin
(),
arguments
.
end
(),
[
&
](
instruction_ref
i
)
{
return
valid
()
&&
std
::
all_of
(
arguments
.
begin
(),
arguments
.
end
(),
[
&
](
instruction_ref
i
)
{
auto
self
=
std
::
find
(
i
->
output
.
begin
(),
i
->
output
.
end
(),
*
this
);
auto
self
=
std
::
find
(
i
->
output
s
()
.
begin
(),
i
->
output
s
()
.
end
(),
*
this
);
return
self
!=
i
->
output
.
end
()
&&
return
self
!=
i
->
output
s
()
.
end
()
&&
std
::
distance
(
start
,
i
)
<
std
::
distance
(
start
,
*
self
);
std
::
distance
(
start
,
i
)
<
std
::
distance
(
start
,
*
self
);
});
});
}
}
...
...
src/program.cpp
View file @
62970436
...
@@ -120,11 +120,11 @@ instruction_ref program::replace_instruction(instruction_ref ins, instruction_re
...
@@ -120,11 +120,11 @@ instruction_ref program::replace_instruction(instruction_ref ins, instruction_re
assert
(
has_instruction
(
rep
));
assert
(
has_instruction
(
rep
));
assert
(
ins
!=
rep
);
assert
(
ins
!=
rep
);
// TODO: Should it be an error if the output is empty?
// TODO: Should it be an error if the output is empty?
if
(
ins
->
output
.
empty
())
if
(
ins
->
output
s
()
.
empty
())
{
{
return
rep
;
return
rep
;
}
}
for
(
auto
&&
out
:
ins
->
output
)
for
(
auto
&&
out
:
ins
->
output
s
()
)
{
{
// TODO: Check for possible cycles
// TODO: Check for possible cycles
if
(
out
!=
rep
)
if
(
out
!=
rep
)
...
@@ -134,7 +134,7 @@ instruction_ref program::replace_instruction(instruction_ref ins, instruction_re
...
@@ -134,7 +134,7 @@ instruction_ref program::replace_instruction(instruction_ref ins, instruction_re
assert
(
out
->
valid
(
begin
()));
assert
(
out
->
valid
(
begin
()));
}
}
// Replacement should not be dead code unless its the last instruction
// Replacement should not be dead code unless its the last instruction
assert
(
!
rep
->
output
.
empty
()
or
rep
==
std
::
prev
(
end
()));
assert
(
!
rep
->
output
s
()
.
empty
()
or
rep
==
std
::
prev
(
end
()));
assert
(
ins
->
valid
(
begin
()));
assert
(
ins
->
valid
(
begin
()));
assert
(
rep
->
valid
(
begin
()));
assert
(
rep
->
valid
(
begin
()));
return
rep
;
return
rep
;
...
@@ -143,7 +143,7 @@ instruction_ref program::replace_instruction(instruction_ref ins, instruction_re
...
@@ -143,7 +143,7 @@ instruction_ref program::replace_instruction(instruction_ref ins, instruction_re
instruction_ref
program
::
remove_instruction
(
instruction_ref
ins
)
instruction_ref
program
::
remove_instruction
(
instruction_ref
ins
)
{
{
assert
(
has_instruction
(
ins
));
assert
(
has_instruction
(
ins
));
assert
(
ins
->
output
.
empty
());
assert
(
ins
->
output
s
()
.
empty
());
ins
->
clear_arguments
();
ins
->
clear_arguments
();
return
impl
->
instructions
.
erase
(
ins
);
return
impl
->
instructions
.
erase
(
ins
);
}
}
...
@@ -155,7 +155,7 @@ instruction_ref program::remove_instructions(instruction_ref first, instruction_
...
@@ -155,7 +155,7 @@ instruction_ref program::remove_instructions(instruction_ref first, instruction_
// TODO: Check every element
// TODO: Check every element
assert
(
has_instruction
(
first
));
assert
(
has_instruction
(
first
));
std
::
for_each
(
first
,
last
,
[
&
](
instruction
&
ins
)
{
ins
.
clear_arguments
();
});
std
::
for_each
(
first
,
last
,
[
&
](
instruction
&
ins
)
{
ins
.
clear_arguments
();
});
assert
(
std
::
all_of
(
first
,
last
,
[
&
](
instruction
&
ins
)
{
return
ins
.
output
.
empty
();
}));
assert
(
std
::
all_of
(
first
,
last
,
[
&
](
instruction
&
ins
)
{
return
ins
.
output
s
()
.
empty
();
}));
return
impl
->
instructions
.
erase
(
first
,
last
);
return
impl
->
instructions
.
erase
(
first
,
last
);
}
}
...
...
src/simplify_reshapes.cpp
View file @
62970436
...
@@ -27,9 +27,9 @@ void simplify_reshapes::apply(program& p) const
...
@@ -27,9 +27,9 @@ void simplify_reshapes::apply(program& p) const
{
{
if
(
not
is_reshaper
(
ins
->
name
()))
if
(
not
is_reshaper
(
ins
->
name
()))
continue
;
continue
;
if
(
ins
->
output
.
size
()
!=
1
)
if
(
ins
->
output
s
()
.
size
()
!=
1
)
continue
;
continue
;
if
(
is_reshaper
(
ins
->
output
.
front
()
->
name
()))
if
(
is_reshaper
(
ins
->
output
s
()
.
front
()
->
name
()))
continue
;
continue
;
// Gather reshapes
// Gather reshapes
std
::
vector
<
instruction_ref
>
reshapes
{
ins
};
std
::
vector
<
instruction_ref
>
reshapes
{
ins
};
...
...
src/targets/gpu/eliminate_workspace.cpp
View file @
62970436
...
@@ -16,7 +16,7 @@ void eliminate_workspace::apply(program& p) const
...
@@ -16,7 +16,7 @@ void eliminate_workspace::apply(program& p) const
std
::
vector
<
instruction_ref
>
allocs
;
std
::
vector
<
instruction_ref
>
allocs
;
for
(
auto
ins
:
iterator_for
(
p
))
for
(
auto
ins
:
iterator_for
(
p
))
{
{
if
(
ins
->
output
.
size
()
!=
1
)
if
(
ins
->
output
s
()
.
size
()
!=
1
)
continue
;
continue
;
if
(
ins
->
name
()
!=
"hip::allocate"
)
if
(
ins
->
name
()
!=
"hip::allocate"
)
continue
;
continue
;
...
...
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