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
32970359
Commit
32970359
authored
Mar 05, 2019
by
Paul
Browse files
Reduce number of waits
parent
6c7065c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
src/schedule.cpp
src/schedule.cpp
+19
-1
No files found.
src/schedule.cpp
View file @
32970359
...
...
@@ -258,15 +258,33 @@ void schedule::apply(program& p) const
}
// Schedule instructions
std
::
set
<
std
::
size_t
>
waited_for
;
std
::
size_t
waited_on
=
model
.
concurrency
();
for
(
auto
ins
:
iterator_for
(
p
))
{
// Only schedule instructions that have a stream
if
(
not
si
.
has_stream
(
ins
))
continue
;
// Schedule instruction on the stream
auto
stream
=
si
.
get_stream
(
ins
);
assert
(
stream
<
model
.
concurrency
());
model
.
schedule_instruction
(
p
,
ins
,
stream
);
// Clear waits when switching streams
if
(
stream
!=
waited_on
)
waited_for
.
clear
();
// Schedule wait instruction
if
(
si
.
is_merge_point
(
ins
,
stream
))
model
.
wait
(
p
,
ins
,
stream
,
si
.
wait_for
(
ins
));
{
auto
wait_for
=
si
.
wait_for
(
ins
);
// Dont wait for streams that have already been waited for
wait_for
.
erase
(
std
::
remove_if
(
wait_for
.
begin
(),
wait_for
.
end
(),
[
&
](
auto
x
)
{
return
waited_for
.
count
(
x
)
>
0
;
}),
wait_for
.
end
());
if
(
not
wait_for
.
empty
())
model
.
wait
(
p
,
ins
,
stream
,
wait_for
);
waited_for
.
insert
(
wait_for
.
begin
(),
wait_for
.
end
());
waited_on
=
stream
;
}
}
// Add memory conflicts
...
...
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