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
0721ddc1
"library/vscode:/vscode.git/clone" did not exist on "bb4b82a95a27248c713ed93cd4b47384663eefca"
Commit
0721ddc1
authored
Mar 01, 2019
by
Paul
Browse files
Formatting
parent
d9fe1c6c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
20 deletions
+24
-20
src/schedule.cpp
src/schedule.cpp
+8
-7
src/targets/gpu/include/migraphx/gpu/schedule_model.hpp
src/targets/gpu/include/migraphx/gpu/schedule_model.hpp
+4
-1
src/targets/gpu/schedule_model.cpp
src/targets/gpu/schedule_model.cpp
+7
-10
tools/include/schedule_model.hpp
tools/include/schedule_model.hpp
+5
-2
No files found.
src/schedule.cpp
View file @
0721ddc1
...
...
@@ -15,24 +15,25 @@ void schedule::apply(program& p) const
std
::
unordered_map
<
instruction_ref
,
std
::
size_t
>
weights
;
auto
last
=
std
::
prev
(
p
.
end
());
fix
<
std
::
size_t
>
([
&
](
auto
self
,
auto
ins
)
->
std
::
size_t
{
if
(
weights
.
count
(
ins
)
==
0
)
if
(
weights
.
count
(
ins
)
==
0
)
{
weights
[
ins
]
=
std
::
accumulate
(
ins
->
inputs
().
begin
(),
ins
->
inputs
().
end
(),
model
.
weight
(
ins
->
get_operator
()),
[
&
](
std
::
size_t
w
,
instruction_ref
i
)
{
return
w
+
self
(
i
);
});
weights
[
ins
]
=
std
::
accumulate
(
ins
->
inputs
().
begin
(),
ins
->
inputs
().
end
(),
model
.
weight
(
ins
->
get_operator
()),
[
&
](
std
::
size_t
w
,
instruction_ref
i
)
{
return
w
+
self
(
i
);
});
}
return
weights
[
ins
];
})(
last
);
// Topo sort
fix
([
&
](
auto
self
,
auto
ins
)
{
for
(
auto
i
:
ins
->
inputs
())
for
(
auto
i
:
ins
->
inputs
())
p
.
move_instruction
(
i
,
p
.
begin
());
for
(
auto
i
:
ins
->
inputs
())
for
(
auto
i
:
ins
->
inputs
())
self
(
i
);
})(
last
);
}
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
src/targets/gpu/include/migraphx/gpu/schedule_model.hpp
View file @
0721ddc1
...
...
@@ -18,7 +18,10 @@ struct schedule_model
std
::
size_t
n
=
4
;
std
::
size_t
concurrency
()
const
;
void
schedule_instruction
(
program
&
p
,
instruction_ref
ins
,
std
::
size_t
n
)
const
;
void
wait
(
program
&
p
,
instruction_ref
ins
,
std
::
size_t
wait_on
,
const
std
::
vector
<
std
::
size_t
>&
wait_for
)
const
;
void
wait
(
program
&
p
,
instruction_ref
ins
,
std
::
size_t
wait_on
,
const
std
::
vector
<
std
::
size_t
>&
wait_for
)
const
;
std
::
size_t
weight
(
const
operation
&
op
)
const
;
};
...
...
src/targets/gpu/schedule_model.cpp
View file @
0721ddc1
...
...
@@ -6,18 +6,15 @@ namespace migraphx {
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
std
::
size_t
schedule_model
::
concurrency
()
const
std
::
size_t
schedule_model
::
concurrency
()
const
{
return
n
;
}
void
schedule_model
::
schedule_instruction
(
program
&
p
,
instruction_ref
ins
,
std
::
size_t
n
)
const
{}
void
schedule_model
::
wait
(
program
&
p
,
instruction_ref
ins
,
std
::
size_t
wait_on
,
const
std
::
vector
<
std
::
size_t
>&
wait_for
)
const
{
return
n
;
}
void
schedule_model
::
schedule_instruction
(
program
&
p
,
instruction_ref
ins
,
std
::
size_t
n
)
const
{}
void
schedule_model
::
wait
(
program
&
p
,
instruction_ref
ins
,
std
::
size_t
wait_on
,
const
std
::
vector
<
std
::
size_t
>&
wait_for
)
const
{}
std
::
size_t
schedule_model
::
weight
(
const
operation
&
op
)
const
{
return
1
;
}
std
::
size_t
schedule_model
::
weight
(
const
operation
&
op
)
const
{
return
1
;
}
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
...
...
tools/include/schedule_model.hpp
View file @
0721ddc1
...
...
@@ -27,8 +27,11 @@ struct schedule_model
std
::
size_t
concurrency
()
const
;
/// Schedule a concurrent instruction
void
schedule_instruction
(
program
&
p
,
instruction_ref
ins
,
std
::
size_t
n
)
const
;
// Insert necessary waits before an instruction
void
wait
(
program
&
p
,
instruction_ref
ins
,
std
::
size_t
wait_on
,
const
std
::
vector
<
std
::
size_t
>&
wait_for
)
const
;
// Insert necessary waits before an instruction
void
wait
(
program
&
p
,
instruction_ref
ins
,
std
::
size_t
wait_on
,
const
std
::
vector
<
std
::
size_t
>&
wait_for
)
const
;
/// Compute weights for an operation
std
::
size_t
weight
(
const
operation
&
op
)
const
;
};
...
...
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