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
8a081fcf
Commit
8a081fcf
authored
Mar 09, 2019
by
Paul
Browse files
Use contains function
parent
9b8739f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
src/schedule.cpp
src/schedule.cpp
+5
-5
No files found.
src/schedule.cpp
View file @
8a081fcf
...
@@ -33,7 +33,7 @@ struct stream_info
...
@@ -33,7 +33,7 @@ struct stream_info
void
accumulate_weights
(
instruction_ref
last
,
const
schedule_model
&
model
)
void
accumulate_weights
(
instruction_ref
last
,
const
schedule_model
&
model
)
{
{
fix
<
std
::
size_t
>
([
&
](
auto
self
,
auto
ins
)
->
std
::
size_t
{
fix
<
std
::
size_t
>
([
&
](
auto
self
,
auto
ins
)
->
std
::
size_t
{
if
(
weights
.
count
(
ins
)
==
0
)
if
(
not
contains
(
weights
,
ins
)
)
{
{
std
::
size_t
weight
=
0
;
std
::
size_t
weight
=
0
;
auto
&&
op
=
ins
->
get_operator
();
auto
&&
op
=
ins
->
get_operator
();
...
@@ -125,7 +125,7 @@ struct stream_info
...
@@ -125,7 +125,7 @@ struct stream_info
std
::
size_t
get_stream
(
instruction_ref
ins
)
const
{
return
ins2stream
.
at
(
ins
);
}
std
::
size_t
get_stream
(
instruction_ref
ins
)
const
{
return
ins2stream
.
at
(
ins
);
}
bool
has_stream
(
instruction_ref
ins
)
const
{
return
ins2stream
.
count
(
ins
)
>
0
;
}
bool
has_stream
(
instruction_ref
ins
)
const
{
return
contains
(
ins2stream
,
ins
)
;
}
bool
different
(
const
std
::
vector
<
std
::
size_t
>&
v
)
const
bool
different
(
const
std
::
vector
<
std
::
size_t
>&
v
)
const
{
{
...
@@ -221,7 +221,7 @@ struct stream_info
...
@@ -221,7 +221,7 @@ struct stream_info
continue
;
continue
;
}
}
auto
stream
=
get_stream
(
i
);
auto
stream
=
get_stream
(
i
);
if
(
m
.
co
u
nt
(
stream
)
==
0
)
if
(
not
cont
ains
(
m
,
stream
))
m
[
stream
]
=
i
;
m
[
stream
]
=
i
;
else
else
m
[
stream
]
=
std
::
min
(
m
[
stream
],
i
,
by
(
std
::
less
<>
{},
[
&
](
auto
x
)
{
m
[
stream
]
=
std
::
min
(
m
[
stream
],
i
,
by
(
std
::
less
<>
{},
[
&
](
auto
x
)
{
...
@@ -345,7 +345,7 @@ void schedule::apply(program& p) const
...
@@ -345,7 +345,7 @@ void schedule::apply(program& p) const
if
(
stream
==
istream
)
if
(
stream
==
istream
)
continue
;
continue
;
// Create a new event if it hasn't been recorded
// Create a new event if it hasn't been recorded
if
(
ins2wait
.
count
(
i
)
==
0
)
if
(
not
contains
(
ins2wait
,
i
)
)
{
{
ins2wait
[
i
]
=
wait_id
;
ins2wait
[
i
]
=
wait_id
;
model
.
record
(
p
,
i
,
wait_id
);
model
.
record
(
p
,
i
,
wait_id
);
...
@@ -354,7 +354,7 @@ void schedule::apply(program& p) const
...
@@ -354,7 +354,7 @@ void schedule::apply(program& p) const
auto
w
=
ins2wait
.
at
(
i
);
auto
w
=
ins2wait
.
at
(
i
);
// If we already waited for the event on this stream then dont
// If we already waited for the event on this stream then dont
// insert another wait event
// insert another wait event
if
(
waited_for
[
stream
]
.
count
(
w
)
==
0
)
if
(
not
contains
(
waited_for
[
stream
]
,
w
)
)
model
.
wait
(
p
,
ins
,
w
);
model
.
wait
(
p
,
ins
,
w
);
// Store the event as waited
// Store the event as waited
waited_for
[
stream
].
insert
(
w
);
waited_for
[
stream
].
insert
(
w
);
...
...
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