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
5b3cded5
Commit
5b3cded5
authored
Mar 02, 2019
by
Paul
Browse files
Formatting
parent
7c26b6ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
src/schedule.cpp
src/schedule.cpp
+9
-13
No files found.
src/schedule.cpp
View file @
5b3cded5
...
@@ -42,7 +42,7 @@ struct stream_info
...
@@ -42,7 +42,7 @@ struct stream_info
{
{
fix
([
&
](
auto
self
,
auto
ins
)
{
fix
([
&
](
auto
self
,
auto
ins
)
{
// If weight is zero then stop
// If weight is zero then stop
if
(
weights
[
ins
]
==
0
)
if
(
weights
[
ins
]
==
0
)
return
;
return
;
// Only assign streams if not already assigned
// Only assign streams if not already assigned
if
(
not
has_stream
(
ins
))
if
(
not
has_stream
(
ins
))
...
@@ -73,7 +73,7 @@ struct stream_info
...
@@ -73,7 +73,7 @@ struct stream_info
{
{
if
(
has_stream
(
ins
))
if
(
has_stream
(
ins
))
continue
;
continue
;
if
(
weights
[
ins
]
==
0
)
if
(
weights
[
ins
]
==
0
)
continue
;
continue
;
set_stream
(
ins
,
streams
-
1
);
set_stream
(
ins
,
streams
-
1
);
}
}
...
@@ -89,16 +89,15 @@ struct stream_info
...
@@ -89,16 +89,15 @@ struct stream_info
{
{
if
(
v
.
size
()
<
2
)
if
(
v
.
size
()
<
2
)
return
false
;
return
false
;
return
not
std
::
all_of
(
return
not
std
::
all_of
(
v
.
begin
(),
v
.
end
(),
[
&
](
std
::
size_t
x
)
{
return
x
==
v
.
front
();
});
v
.
begin
(),
v
.
end
(),
[
&
](
std
::
size_t
x
)
{
return
x
==
v
.
front
();
});
}
}
std
::
vector
<
std
::
size_t
>
get_input_streams
(
instruction_ref
ins
)
const
std
::
vector
<
std
::
size_t
>
get_input_streams
(
instruction_ref
ins
)
const
{
{
std
::
vector
<
std
::
size_t
>
result
;
std
::
vector
<
std
::
size_t
>
result
;
for
(
auto
i
:
ins
->
inputs
())
for
(
auto
i
:
ins
->
inputs
())
{
{
if
(
weights
.
at
(
i
)
==
0
)
if
(
weights
.
at
(
i
)
==
0
)
{
{
auto
vv
=
get_input_streams
(
i
);
auto
vv
=
get_input_streams
(
i
);
result
.
insert
(
result
.
end
(),
vv
.
begin
(),
vv
.
end
());
result
.
insert
(
result
.
end
(),
vv
.
begin
(),
vv
.
end
());
...
@@ -111,16 +110,13 @@ struct stream_info
...
@@ -111,16 +110,13 @@ struct stream_info
return
result
;
return
result
;
}
}
bool
is_merge_point
(
instruction_ref
ins
)
const
bool
is_merge_point
(
instruction_ref
ins
)
const
{
return
different
(
get_input_streams
(
ins
));
}
{
return
different
(
get_input_streams
(
ins
));
}
std
::
vector
<
std
::
size_t
>
wait_for
(
instruction_ref
ins
)
const
std
::
vector
<
std
::
size_t
>
wait_for
(
instruction_ref
ins
)
const
{
{
std
::
vector
<
std
::
size_t
>
result
=
get_input_streams
(
ins
);
std
::
vector
<
std
::
size_t
>
result
=
get_input_streams
(
ins
);
std
::
sort
(
result
.
begin
(),
result
.
end
()
);
std
::
sort
(
result
.
begin
(),
result
.
end
());
result
.
erase
(
std
::
unique
(
result
.
begin
(),
result
.
end
()
),
result
.
end
()
);
result
.
erase
(
std
::
unique
(
result
.
begin
(),
result
.
end
()),
result
.
end
());
return
result
;
return
result
;
}
}
};
};
...
@@ -145,7 +141,7 @@ void schedule::apply(program& p) const
...
@@ -145,7 +141,7 @@ void schedule::apply(program& p) const
for
(
auto
ins
:
iterator_for
(
p
))
for
(
auto
ins
:
iterator_for
(
p
))
{
{
// Only schedule instructions that have a stream
// Only schedule instructions that have a stream
if
(
not
si
.
has_stream
(
ins
))
if
(
not
si
.
has_stream
(
ins
))
continue
;
continue
;
if
(
si
.
is_merge_point
(
ins
))
if
(
si
.
is_merge_point
(
ins
))
model
.
wait
(
p
,
ins
,
si
.
get_stream
(
ins
),
si
.
wait_for
(
ins
));
model
.
wait
(
p
,
ins
,
si
.
get_stream
(
ins
),
si
.
wait_for
(
ins
));
...
...
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