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
a1dcece1
Commit
a1dcece1
authored
Mar 02, 2019
by
Paul
Browse files
Formatting
parent
e1f448cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
14 deletions
+9
-14
src/schedule.cpp
src/schedule.cpp
+9
-14
No files found.
src/schedule.cpp
View file @
a1dcece1
...
@@ -94,7 +94,7 @@ struct stream_info
...
@@ -94,7 +94,7 @@ struct stream_info
return
not
std
::
all_of
(
v
.
begin
(),
v
.
end
(),
[
&
](
std
::
size_t
x
)
{
return
x
==
v
.
front
();
});
return
not
std
::
all_of
(
v
.
begin
(),
v
.
end
(),
[
&
](
std
::
size_t
x
)
{
return
x
==
v
.
front
();
});
}
}
template
<
class
Selector
>
template
<
class
Selector
>
std
::
vector
<
std
::
size_t
>
get_streams
(
instruction_ref
ins
,
Selector
select
)
const
std
::
vector
<
std
::
size_t
>
get_streams
(
instruction_ref
ins
,
Selector
select
)
const
{
{
std
::
vector
<
std
::
size_t
>
result
;
std
::
vector
<
std
::
size_t
>
result
;
...
@@ -115,20 +115,16 @@ struct stream_info
...
@@ -115,20 +115,16 @@ struct stream_info
std
::
vector
<
std
::
size_t
>
get_input_streams
(
instruction_ref
ins
)
const
std
::
vector
<
std
::
size_t
>
get_input_streams
(
instruction_ref
ins
)
const
{
{
return
get_streams
(
ins
,
[](
auto
i
)
{
return
get_streams
(
ins
,
[](
auto
i
)
{
return
i
->
inputs
();
});
return
i
->
inputs
();
});
}
}
std
::
vector
<
std
::
size_t
>
get_output_streams
(
instruction_ref
ins
)
const
std
::
vector
<
std
::
size_t
>
get_output_streams
(
instruction_ref
ins
)
const
{
{
return
get_streams
(
ins
,
[](
auto
i
)
{
return
get_streams
(
ins
,
[](
auto
i
)
{
return
i
->
outputs
();
});
return
i
->
outputs
();
});
}
}
bool
is_merge_point
(
instruction_ref
ins
)
const
{
return
different
(
get_input_streams
(
ins
));
}
bool
is_merge_point
(
instruction_ref
ins
)
const
{
return
different
(
get_input_streams
(
ins
));
}
bool
is_split_point
(
instruction_ref
ins
)
const
{
return
different
(
get_output_streams
(
ins
));
}
bool
is_split_point
(
instruction_ref
ins
)
const
{
return
different
(
get_output_streams
(
ins
));
}
std
::
vector
<
std
::
size_t
>
wait_for
(
instruction_ref
ins
)
const
std
::
vector
<
std
::
size_t
>
wait_for
(
instruction_ref
ins
)
const
...
@@ -139,17 +135,17 @@ struct stream_info
...
@@ -139,17 +135,17 @@ struct stream_info
return
result
;
return
result
;
}
}
template
<
class
F
>
template
<
class
F
>
void
find_concurrent_instructions
(
program
&
p
,
F
f
)
void
find_concurrent_instructions
(
program
&
p
,
F
f
)
{
{
std
::
unordered_map
<
instruction_ref
,
std
::
unordered_set
<
instruction_ref
>>
split_from
;
std
::
unordered_map
<
instruction_ref
,
std
::
unordered_set
<
instruction_ref
>>
split_from
;
for
(
auto
ins
:
iterator_for
(
p
))
for
(
auto
ins
:
iterator_for
(
p
))
{
{
if
(
weights
[
ins
]
==
0
)
if
(
weights
[
ins
]
==
0
)
continue
;
continue
;
for
(
auto
&&
arg
:
ins
->
inputs
())
for
(
auto
&&
arg
:
ins
->
inputs
())
{
{
if
(
is_split_point
(
arg
))
if
(
is_split_point
(
arg
))
split_from
[
ins
].
insert
(
arg
);
split_from
[
ins
].
insert
(
arg
);
split_from
[
ins
].
insert
(
split_from
[
arg
].
begin
(),
split_from
[
arg
].
end
());
split_from
[
ins
].
insert
(
split_from
[
arg
].
begin
(),
split_from
[
arg
].
end
());
}
}
...
@@ -190,9 +186,8 @@ void schedule::apply(program& p) const
...
@@ -190,9 +186,8 @@ void schedule::apply(program& p) const
model
.
schedule_instruction
(
p
,
ins
,
si
.
get_stream
(
ins
));
model
.
schedule_instruction
(
p
,
ins
,
si
.
get_stream
(
ins
));
}
}
si
.
find_concurrent_instructions
(
p
,
[
&
](
auto
x
,
auto
y
)
{
si
.
find_concurrent_instructions
(
p
.
insert_instruction
(
std
::
next
(
x
),
op
::
identity
{},
x
,
y
);
p
,
[
&
](
auto
x
,
auto
y
)
{
p
.
insert_instruction
(
std
::
next
(
x
),
op
::
identity
{},
x
,
y
);
});
});
}
}
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
...
...
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