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
23fd64f8
Commit
23fd64f8
authored
Mar 06, 2019
by
Paul
Browse files
Formatting
parent
0e5dabb4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
19 deletions
+20
-19
src/include/migraphx/functional.hpp
src/include/migraphx/functional.hpp
+4
-8
src/schedule.cpp
src/schedule.cpp
+16
-11
No files found.
src/include/migraphx/functional.hpp
View file @
23fd64f8
...
...
@@ -137,20 +137,16 @@ auto fold(F f)
return
[
=
](
auto
&&
...
xs
)
{
return
fold_impl
(
f
,
std
::
forward
<
decltype
(
xs
)
>
(
xs
)...);
};
}
template
<
class
F
,
class
Proj
>
template
<
class
F
,
class
Proj
>
auto
by
(
F
f
,
Proj
proj
)
{
return
[
=
](
auto
&&
...
xs
)
{
return
f
(
proj
(
std
::
forward
<
decltype
(
xs
)
>
(
xs
))...);
};
return
[
=
](
auto
&&
...
xs
)
{
return
f
(
proj
(
std
::
forward
<
decltype
(
xs
)
>
(
xs
))...);
};
}
template
<
class
T
>
template
<
class
T
>
auto
index_of
(
T
&
x
)
{
return
[
&
](
auto
&&
y
)
{
return
x
[
y
];
};
return
[
&
](
auto
&&
y
)
{
return
x
[
y
];
};
}
}
// namespace MIGRAPHX_INLINE_NS
...
...
src/schedule.cpp
View file @
23fd64f8
...
...
@@ -73,11 +73,13 @@ struct stream_info
return
;
part
.
add
(
ins
,
this
->
iweights
[
ins
]);
auto
max_it
=
std
::
max_element
(
ins
->
inputs
().
begin
(),
ins
->
inputs
().
end
(),
by
(
std
::
less
<>
{},
index_of
(
this
->
weights
)));
auto
max_it
=
std
::
max_element
(
ins
->
inputs
().
begin
(),
ins
->
inputs
().
end
(),
by
(
std
::
less
<>
{},
index_of
(
this
->
weights
)));
for
(
auto
i
:
ins
->
inputs
())
{
const
auto
weight
=
this
->
weights
[
i
];
if
(
i
==
*
max_it
or
weight
<=
min_partition_threshold
)
if
(
i
==
*
max_it
or
weight
<=
min_partition_threshold
)
{
self
(
i
,
part
);
}
...
...
@@ -91,15 +93,18 @@ struct stream_info
// Set the critical partition to stream 0
set_stream
(
critical
,
0
);
std
::
vector
<
std
::
size_t
>
streams
(
n
-
1
);
std
::
vector
<
std
::
size_t
>
streams
(
n
-
1
);
// Assign streams for the other partitions
for
(
auto
&&
ins_part
:
partitions
)
for
(
auto
&&
ins_part
:
partitions
)
{
std
::
sort
(
ins_part
.
second
.
begin
(),
ins_part
.
second
.
end
(),
by
(
std
::
greater
<>
{},
[](
auto
&&
x
)
{
return
std
::
make_tuple
(
x
.
weight
,
x
.
instructions
.
size
());
}));
for
(
auto
&&
part
:
ins_part
.
second
)
std
::
sort
(
ins_part
.
second
.
begin
(),
ins_part
.
second
.
end
(),
by
(
std
::
greater
<>
{},
[](
auto
&&
x
)
{
return
std
::
make_tuple
(
x
.
weight
,
x
.
instructions
.
size
());
}));
for
(
auto
&&
part
:
ins_part
.
second
)
{
auto
stream
=
std
::
min_element
(
streams
.
begin
(),
streams
.
end
())
-
streams
.
begin
();
set_stream
(
part
,
stream
+
1
);
set_stream
(
part
,
stream
+
1
);
streams
[
stream
]
+=
part
.
weight
;
}
}
...
...
@@ -107,8 +112,8 @@ struct stream_info
void
set_stream
(
const
partition
&
p
,
std
::
size_t
n
)
{
for
(
auto
ins
:
p
.
instructions
)
if
(
iweights
[
ins
]
>
0
)
for
(
auto
ins
:
p
.
instructions
)
if
(
iweights
[
ins
]
>
0
)
set_stream
(
ins
,
n
);
}
...
...
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