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
301b84e3
Commit
301b84e3
authored
May 05, 2018
by
Paul
Browse files
Formatting
parent
4ba12b4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
include/rtg/program.hpp
include/rtg/program.hpp
+3
-2
src/program.cpp
src/program.cpp
+3
-2
No files found.
include/rtg/program.hpp
View file @
301b84e3
...
...
@@ -26,13 +26,14 @@ struct program
return
add_instruction
(
op
,
{
args
...});
}
instruction_ref
add_instruction
(
operation
op
,
std
::
vector
<
instruction_ref
>
args
);
template
<
class
...
Ts
>
instruction_ref
insert_instruction
(
instruction_ref
ins
,
operation
op
,
Ts
...
args
)
{
return
insert_instruction
(
ins
,
op
,
{
args
...});
}
instruction_ref
insert_instruction
(
instruction_ref
ins
,
operation
op
,
std
::
vector
<
instruction_ref
>
args
);
instruction_ref
insert_instruction
(
instruction_ref
ins
,
operation
op
,
std
::
vector
<
instruction_ref
>
args
);
template
<
class
...
Ts
>
instruction_ref
add_literal
(
Ts
&&
...
xs
)
...
...
src/program.cpp
View file @
301b84e3
...
...
@@ -22,7 +22,8 @@ instruction_ref program::add_instruction(operation op, std::vector<instruction_r
{
return
insert_instruction
(
impl
->
instructions
.
end
(),
std
::
move
(
op
),
std
::
move
(
args
));
}
instruction_ref
program
::
insert_instruction
(
instruction_ref
ins
,
operation
op
,
std
::
vector
<
instruction_ref
>
args
)
instruction_ref
program
::
insert_instruction
(
instruction_ref
ins
,
operation
op
,
std
::
vector
<
instruction_ref
>
args
)
{
assert
(
std
::
all_of
(
args
.
begin
(),
args
.
end
(),
[
&
](
instruction_ref
x
)
{
return
has_instruction
(
x
);
})
&&
...
...
@@ -30,7 +31,7 @@ instruction_ref program::insert_instruction(instruction_ref ins, operation op, s
std
::
vector
<
shape
>
shapes
(
args
.
size
());
std
::
transform
(
args
.
begin
(),
args
.
end
(),
shapes
.
begin
(),
[](
instruction_ref
i
)
{
return
i
->
result
;
});
shape
r
=
op
.
compute_shape
(
shapes
);
shape
r
=
op
.
compute_shape
(
shapes
);
auto
result
=
impl
->
instructions
.
insert
(
ins
,
{
op
,
r
,
args
});
assert
(
result
->
arguments
==
args
);
for
(
auto
&&
arg
:
args
)
...
...
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