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
b888b61d
Commit
b888b61d
authored
Sep 08, 2023
by
umang yadav
Browse files
Fix tidy
parent
f079b678
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
src/generate_root_modules.cpp
src/generate_root_modules.cpp
+5
-5
src/program.cpp
src/program.cpp
+9
-9
No files found.
src/generate_root_modules.cpp
View file @
b888b61d
...
...
@@ -49,7 +49,7 @@ static literal get_scalar(instruction_ref ins)
if
(
ins
->
name
()
==
"contiguous"
)
return
get_scalar
(
ins
->
inputs
().
front
());
const
auto
&
s
=
ins
->
get_shape
();
if
(
s
.
elements
()
!=
1
&&
not
(
s
.
scalar
()))
if
(
s
.
elements
()
!=
1
and
not
(
s
.
scalar
()))
return
{};
if
(
not
ins
->
can_eval
())
return
{};
...
...
@@ -97,10 +97,10 @@ Step 3:
Create modules using information collected in step 2 and insert run_on_target instructions.
*/
struct
A
uto
GenR
oot
M
odules
struct
a
uto
_gen_r
oot
_m
odules
{
A
uto
GenR
oot
M
odules
(
migraphx
::
program
&
p
,
const
target_assignments
&
target_assignments
)
a
uto
_gen_r
oot
_m
odules
(
migraphx
::
program
&
p
,
const
target_assignments
&
target_assignments
)
:
tass
(
target_assignments
)
{
auto
*
mm
=
p
.
get_main_module
();
...
...
@@ -182,7 +182,7 @@ struct AutoGenRootModules
std
::
unordered_set
<
instruction_ref
>
same_tid_ins_set_copy
=
{};
std
::
swap
(
same_tid_ins_set_copy
,
same_tid_ins_set
);
std
::
swap
(
same_tid_ins_vec_copy
,
same_tid_ins_vec
);
for
(
auto
sub_mod
:
ins
->
module_inputs
())
for
(
auto
*
sub_mod
:
ins
->
module_inputs
())
{
find_subgraphs
(
sub_mod
,
p
);
}
...
...
@@ -344,7 +344,7 @@ struct AutoGenRootModules
void
generate_root_modules
(
migraphx
::
program
&
p
,
const
target_assignments
&
tass
)
{
A
uto
GenR
oot
M
odules
(
p
,
tass
);
a
uto
_gen_r
oot
_m
odules
(
p
,
tass
);
}
}
// namespace MIGRAPHX_INLINE_NS
...
...
src/program.cpp
View file @
b888b61d
...
...
@@ -43,7 +43,6 @@
#include <iostream>
#include <queue>
#include <queue>
#include <sstream>
#include <algorithm>
#include <set>
...
...
@@ -180,23 +179,24 @@ It does it by first finding subgraphs supported on a given target based on assig
It is possible that instructions have multiple target assignments and part of multiple subgraphs.
Current logic is simple and assigns entire subgraph containing supported instruction to a particular
target on first seen basis and doesn't find the "best" target assignment.
Assumes that all instructions will have target_assignment after this.
Assumes that all relevant (compute and reshaper) instructions will have target_assignment after
this.
*/
target_assignments
program
::
get_target_assignments
(
const
std
::
vector
<
target
>&
targets
,
assignment_options
options
)
{
const
auto
m
=
options
.
metric
;
const
auto
m
etric
=
options
.
metric
;
target_assignments
p
;
const
auto
*
m
od
=
get_main_module
();
const
auto
*
m
m
=
get_main_module
();
std
::
vector
<
std
::
pair
<
std
::
size_t
,
supported_segments
>>
target_subgraphs
;
target_subgraphs
.
reserve
(
targets
.
size
());
for
(
auto
t
id
:
range
(
targets
.
size
())
)
{
target_subgraphs
.
push_back
(
std
::
make_pair
(
tid
,
targets
[
tid
].
find_supported
(
m
od
,
m
)
));
}
for
(
const
auto
ins
:
iterator_for
(
*
m
od
))
auto
t
r
=
range
(
targets
.
size
())
;
std
::
transform
(
tr
.
begin
(),
tr
.
end
(),
std
::
back_inserter
(
target_subgraphs
),
[
&
](
auto
tid
)
{
return
std
::
make_pair
(
tid
,
targets
[
tid
].
find_supported
(
m
m
,
m
etric
));
}
);
for
(
const
auto
ins
:
iterator_for
(
*
m
m
))
{
if
(
contains
(
p
,
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