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
bd12f16b
Commit
bd12f16b
authored
Oct 13, 2023
by
Umang Yadav
Browse files
Fixes for merge and fork node
parent
34b9258a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
src/generate_root_modules.cpp
src/generate_root_modules.cpp
+9
-11
test/multi_target/multitarget_test.cpp
test/multi_target/multitarget_test.cpp
+3
-1
No files found.
src/generate_root_modules.cpp
View file @
bd12f16b
...
...
@@ -154,7 +154,8 @@ struct auto_gen_root_modules
{
const
auto
inputs
=
ins
->
inputs
();
if
(
std
::
any_of
(
inputs
.
begin
(),
inputs
.
end
(),
[
&
](
auto
input_ins
)
{
if
(
is_different_subgraph
(
input_ins
,
tid
))
if
(
tass
.
find
(
input_ins
)
!=
tass
.
end
()
and
tass
.
at
(
ins
)
!=
tid
.
value_or
(
std
::
numeric_limits
<
std
::
size_t
>::
max
()))
{
return
true
;
}
...
...
@@ -168,7 +169,9 @@ struct auto_gen_root_modules
{
const
auto
outputs
=
ins
->
outputs
();
if
(
std
::
any_of
(
outputs
.
begin
(),
outputs
.
end
(),
[
&
](
auto
output_ins
)
{
if
(
is_different_subgraph
(
output_ins
,
tid
)
and
output_ins
->
name
()
!=
"@return"
)
if
(
tass
.
find
(
output_ins
)
!=
tass
.
end
()
and
tass
.
at
(
output_ins
)
!=
tid
.
value_or
(
std
::
numeric_limits
<
std
::
size_t
>::
max
())
and
output_ins
->
name
()
!=
"@return"
)
{
return
true
;
}
...
...
@@ -206,11 +209,7 @@ struct auto_gen_root_modules
}
if
(
not
current_tid
.
has_value
())
{
if
(
tass
.
find
(
ins
)
==
tass
.
end
())
{
continue
;
}
else
if
(
tass
.
find
(
ins
)
!=
tass
.
end
())
{
current_tid
=
std
::
make_optional
<
std
::
size_t
>
(
tass
.
at
(
ins
));
update_tid_counter
(
current_tid
.
value
());
...
...
@@ -244,11 +243,11 @@ struct auto_gen_root_modules
}
else
{
MIGRAPHX_THROW
(
"
Partition
: this case shouldn't occur"
);
MIGRAPHX_THROW
(
"
GenerateRootModules
: this case shouldn't occur"
);
}
}
if
(
skip_ins
.
find
(
ins
)
==
skip_ins
.
end
()
and
not
ins
->
module_inputs
().
empty
())
if
(
not
ins
->
module_inputs
().
empty
())
{
std
::
vector
<
instruction_ref
>
same_tid_ins_vec_copy
=
{};
std
::
unordered_set
<
instruction_ref
>
same_tid_ins_set_copy
=
{};
...
...
@@ -308,12 +307,11 @@ struct auto_gen_root_modules
{
(
*
tmp
)
->
debug_print
();
}
std
::
cout
<<
"
\n
return ins:
\n
"
;
std
::
cout
<<
"return ins:
\n
"
;
for
(
auto
tmp
:
iterator_for
(
return_ins
))
{
(
*
tmp
)
->
debug_print
();
}
std
::
cout
<<
"
\n
"
;
}
auto
*
tmod
=
p
.
create_module
(
"target_mod_"
+
std
::
to_string
(
current_tid
)
+
"_"
+
...
...
test/multi_target/multitarget_test.cpp
View file @
bd12f16b
...
...
@@ -134,6 +134,7 @@ bool check_compiled_program(const migraphx::program& p,
const
std
::
vector
<
migraphx
::
target
>&
targets
)
{
auto
mods
=
p
.
get_modules
();
bool
rot_ins
=
false
;
bool
check_compiled
=
true
;
for
(
const
auto
*
mod
:
mods
)
{
...
...
@@ -141,6 +142,7 @@ bool check_compiled_program(const migraphx::program& p,
{
if
(
ins
.
name
()
==
"run_on_target"
)
{
rot_ins
|=
true
;
auto
*
mod_input
=
ins
.
module_inputs
().
front
();
std
::
size_t
target_id
=
ins
.
get_operator
().
to_value
()[
"target_id"
].
to
<
std
::
size_t
>
();
...
...
@@ -156,7 +158,7 @@ bool check_compiled_program(const migraphx::program& p,
}
}
}
return
check_compiled
;
return
check_compiled
and
rot_ins
;
}
TEST_CASE
(
multitarget_compile_cpu_gpu
)
...
...
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