Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
30aad12f
Commit
30aad12f
authored
Sep 15, 2018
by
Paul
Browse files
Move private functions down
parent
d2231938
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
23 deletions
+42
-23
src/include/migraph/instruction.hpp
src/include/migraph/instruction.hpp
+42
-23
No files found.
src/include/migraph/instruction.hpp
View file @
30aad12f
...
...
@@ -25,14 +25,6 @@ struct instruction
instruction
(
literal
l
)
:
op
(
builtin
::
literal
{}),
result
(
l
.
get_shape
()),
lit
(
std
::
move
(
l
))
{}
// internal
void
replace
(
operation
o
,
const
shape
&
r
,
std
::
vector
<
instruction_ref
>
args
)
{
op
=
std
::
move
(
o
);
replace
(
r
);
replace
(
std
::
move
(
args
));
}
void
replace
(
const
shape
&
r
)
{
if
(
r
!=
result
)
...
...
@@ -48,20 +40,6 @@ struct instruction
void
recompute_shape
()
{
replace
(
compute_shape
(
op
,
arguments
));
}
// internal
void
replace
(
std
::
vector
<
instruction_ref
>
args
)
{
clear_arguments
();
arguments
=
std
::
move
(
args
);
}
// internal
void
replace_argument
(
instruction_ref
old
,
instruction_ref
new_ins
)
{
std
::
replace
(
arguments
.
begin
(),
arguments
.
end
(),
old
,
new_ins
);
old
->
remove_output
(
*
this
);
}
void
clear_arguments
()
{
for
(
auto
&&
arg
:
arguments
)
...
...
@@ -121,6 +99,26 @@ struct instruction
return
lit
;
}
const
operation
&
get_operator
()
const
{
return
op
;
}
std
::
string
name
()
const
{
return
op
.
name
();
}
const
std
::
vector
<
instruction_ref
>&
inputs
()
const
{
return
arguments
;
}
const
std
::
vector
<
instruction_ref
>&
outputs
()
const
{
return
output
;
}
friend
bool
operator
==
(
instruction_ref
ref
,
const
instruction
&
i
)
{
return
i
==
ref
;
}
friend
bool
operator
!=
(
const
instruction
&
i
,
instruction_ref
ref
)
{
return
!
(
i
==
ref
);
}
...
...
@@ -139,6 +137,28 @@ struct instruction
migraph
::
erase
(
output
,
ins
);
}
// internal
void
replace
(
std
::
vector
<
instruction_ref
>
args
)
{
clear_arguments
();
arguments
=
std
::
move
(
args
);
}
// internal
void
replace_argument
(
instruction_ref
old
,
instruction_ref
new_ins
)
{
std
::
replace
(
arguments
.
begin
(),
arguments
.
end
(),
old
,
new_ins
);
old
->
remove_output
(
*
this
);
}
// internal
void
replace
(
operation
o
,
const
shape
&
r
,
std
::
vector
<
instruction_ref
>
args
)
{
op
=
std
::
move
(
o
);
replace
(
r
);
replace
(
std
::
move
(
args
));
}
operation
op
;
shape
result
;
std
::
vector
<
instruction_ref
>
output
;
...
...
@@ -160,7 +180,6 @@ inline void replace_argument(instruction_ref ins, instruction_ref old, instructi
}
// TODO: Move to a cpp file
// TODO: Use const ref for vector
inline
shape
compute_shape
(
const
operation
&
op
,
const
std
::
vector
<
instruction_ref
>&
args
)
{
std
::
vector
<
shape
>
shapes
(
args
.
size
());
...
...
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