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
7d645dd0
"git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "39b097c7585e373ae3f4a17d73a3d61f8b61fc5d"
Commit
7d645dd0
authored
Jun 01, 2022
by
charlie
Browse files
Pass module, skip order check if other module
parent
bd24f471
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
18 deletions
+7
-18
src/include/migraphx/instruction.hpp
src/include/migraphx/instruction.hpp
+1
-1
src/instruction.cpp
src/instruction.cpp
+5
-16
src/module.cpp
src/module.cpp
+1
-1
No files found.
src/include/migraphx/instruction.hpp
View file @
7d645dd0
...
@@ -42,7 +42,7 @@ struct instruction
...
@@ -42,7 +42,7 @@ struct instruction
friend
bool
operator
==
(
const
instruction
&
i
,
instruction_ref
ref
);
friend
bool
operator
==
(
const
instruction
&
i
,
instruction_ref
ref
);
bool
valid
(
i
nst
ruction_ref
start
,
bool
check_order
=
false
)
const
;
bool
valid
(
co
nst
module
&
m
,
bool
check_order
=
false
)
const
;
bool
valid
()
const
;
bool
valid
()
const
;
...
...
src/instruction.cpp
View file @
7d645dd0
...
@@ -76,27 +76,16 @@ bool operator==(const instruction& i, instruction_ref ref)
...
@@ -76,27 +76,16 @@ bool operator==(const instruction& i, instruction_ref ref)
static
void
debug_name
(
std
::
ostream
&
os
,
const
instruction
&
ins
);
static
void
debug_name
(
std
::
ostream
&
os
,
const
instruction
&
ins
);
bool
instruction
::
valid
(
i
nst
ruction_ref
start
,
bool
check_order
)
const
bool
instruction
::
valid
(
co
nst
module
&
m
,
bool
check_order
)
const
{
{
// Need this lambda because std::distance has undefined behavior when comparing iterators of
// from different ranges
auto
ins_dist
=
[](
instruction_ref
s
,
instruction_ref
e
)
{
int
dist
=
0
;
while
((
*
s
)
!=
(
*
e
))
{
++
s
;
++
dist
;
}
return
dist
;
};
return
valid
()
&&
std
::
all_of
(
arguments
.
begin
(),
arguments
.
end
(),
[
&
](
instruction_ref
i
)
{
return
valid
()
&&
std
::
all_of
(
arguments
.
begin
(),
arguments
.
end
(),
[
&
](
instruction_ref
i
)
{
auto
self
=
std
::
find
(
i
->
outputs
().
begin
(),
i
->
outputs
().
end
(),
*
this
);
auto
self
=
std
::
find
(
i
->
outputs
().
begin
(),
i
->
outputs
().
end
(),
*
this
);
bool
ret
=
self
!=
i
->
outputs
().
end
();
bool
ret
=
self
!=
i
->
outputs
().
end
();
if
(
check_order
)
// assume argument is in previous module if m.has_instruction(i) is false
if
(
check_order
and
m
.
has_instruction
(
i
))
{
{
// arguments for this instruction before this instruction
//
check
arguments for this instruction before this instruction
ret
=
ret
and
(
ins_dist
(
start
,
i
)
<
ins_dist
(
start
,
*
self
));
ret
=
ret
and
(
std
::
distance
(
m
.
begin
(),
i
)
<
std
::
distance
(
m
.
begin
()
,
*
self
));
}
}
return
ret
;
return
ret
;
});
});
...
...
src/module.cpp
View file @
7d645dd0
...
@@ -511,7 +511,7 @@ instruction_ref module::validate() const
...
@@ -511,7 +511,7 @@ instruction_ref module::validate() const
bool
check_order
=
std
::
all_of
(
inputs
.
begin
(),
inputs
.
end
(),
[
&
](
auto
in
)
{
bool
check_order
=
std
::
all_of
(
inputs
.
begin
(),
inputs
.
end
(),
[
&
](
auto
in
)
{
return
contains
(
impl
->
instructions
,
*
in
);
return
contains
(
impl
->
instructions
,
*
in
);
});
});
return
!
i
.
valid
(
impl
->
instructions
.
begin
()
,
check_order
);
return
!
i
.
valid
(
*
this
,
check_order
);
});
});
}
}
...
...
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