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
189c3793
Commit
189c3793
authored
Mar 11, 2019
by
Paul
Browse files
Formatting
parent
fbaec470
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
src/schedule.cpp
src/schedule.cpp
+7
-7
test/schedule_test.cpp
test/schedule_test.cpp
+3
-4
No files found.
src/schedule.cpp
View file @
189c3793
...
...
@@ -390,11 +390,11 @@ void schedule::apply(program& p) const
auto
p1
=
std
::
distance
(
ins1
,
merge
.
first
);
for
(
auto
ins2
:
merge
.
second
[
j
])
{
if
(
ins1
==
ins2
)
if
(
ins1
==
ins2
)
continue
;
auto
p2
=
std
::
distance
(
ins2
,
merge
.
first
);
// The smaller distance means the instruction occurs later
if
(
p1
>
p2
)
if
(
p1
>
p2
)
conflict_table
[
ins2
].
insert
(
ins1
);
else
conflict_table
[
ins1
].
insert
(
ins2
);
...
...
@@ -403,16 +403,16 @@ void schedule::apply(program& p) const
});
}
// Remove duplicates
for
(
auto
&&
ip
:
conflict_table
)
for
(
auto
&&
ip
:
conflict_table
)
{
auto
ins1
=
ip
.
first
;
for
(
auto
ins2
:
ip
.
second
)
if
(
contains
(
conflict_table
[
ins2
],
ins1
))
for
(
auto
ins2
:
ip
.
second
)
if
(
contains
(
conflict_table
[
ins2
],
ins1
))
conflict_table
[
ins2
].
erase
(
ins1
);
}
for
(
auto
&&
ip
:
conflict_table
)
for
(
auto
&&
ip
:
conflict_table
)
{
if
(
ip
.
second
.
empty
())
if
(
ip
.
second
.
empty
())
continue
;
std
::
vector
<
instruction_ref
>
args
;
args
.
push_back
(
ip
.
first
);
...
...
test/schedule_test.cpp
View file @
189c3793
...
...
@@ -177,7 +177,7 @@ struct schedule_target
}
bool
has_stream
(
migraphx
::
instruction_ref
ins
)
{
return
model
.
ins2stream
->
count
(
ins
)
>
0
;
}
void
check_conflicts
(
migraphx
::
program
&
p
,
std
::
vector
<
std
::
vector
<
migraphx
::
instruction_ref
>>
conflicts
,
bool
result
=
true
)
...
...
@@ -190,7 +190,8 @@ struct schedule_target
for
(
auto
ins2
:
conflicts
[
j
])
{
// If both instructions are on the same stream then dont check for a conflict
if
(
has_stream
(
ins1
)
and
has_stream
(
ins2
)
and
get_stream
(
ins1
)
==
get_stream
(
ins2
))
if
(
has_stream
(
ins1
)
and
has_stream
(
ins2
)
and
get_stream
(
ins1
)
==
get_stream
(
ins2
))
continue
;
CHECK
(
::
check_conflicts
(
p
,
ins1
,
ins2
)
==
result
);
}
...
...
@@ -199,8 +200,6 @@ struct schedule_target
}
};
template
<
class
T
>
std
::
vector
<
T
>
sorted
(
std
::
vector
<
T
>
x
)
{
...
...
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