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
a91071cf
Commit
a91071cf
authored
Oct 01, 2022
by
Paul
Browse files
Format
parent
baee674c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
src/include/migraphx/instruction_ref.hpp
src/include/migraphx/instruction_ref.hpp
+1
-2
src/simplify_algebra.cpp
src/simplify_algebra.cpp
+9
-9
No files found.
src/include/migraphx/instruction_ref.hpp
View file @
a91071cf
...
@@ -38,8 +38,7 @@ migraphx::instruction* as_address(const instruction_ref& ins) noexcept;
...
@@ -38,8 +38,7 @@ migraphx::instruction* as_address(const instruction_ref& ins) noexcept;
struct
compare_instruction_ref
struct
compare_instruction_ref
{
{
bool
operator
()(
const
instruction_ref
&
x
,
bool
operator
()(
const
instruction_ref
&
x
,
const
instruction_ref
&
y
)
const
noexcept
const
instruction_ref
&
y
)
const
noexcept
{
{
return
as_address
(
x
)
<
as_address
(
y
);
return
as_address
(
x
)
<
as_address
(
y
);
}
}
...
...
src/simplify_algebra.cpp
View file @
a91071cf
...
@@ -559,7 +559,8 @@ struct find_splits
...
@@ -559,7 +559,8 @@ struct find_splits
return
true
;
return
true
;
}
}
static
std
::
vector
<
instruction_ref
>
split_nary
(
const
std
::
vector
<
instruction_ref
>&
group
,
bool
commutative
)
static
std
::
vector
<
instruction_ref
>
split_nary
(
const
std
::
vector
<
instruction_ref
>&
group
,
bool
commutative
)
{
{
// All inputs have the same slices
// All inputs have the same slices
if
(
not
std
::
all_of
(
group
.
begin
(),
group
.
end
(),
[](
auto
ins
)
{
if
(
not
std
::
all_of
(
group
.
begin
(),
group
.
end
(),
[](
auto
ins
)
{
...
@@ -583,14 +584,13 @@ struct find_splits
...
@@ -583,14 +584,13 @@ struct find_splits
return
result
;
return
result
;
};
};
auto
inputs
=
get_inputs
(
start
);
auto
inputs
=
get_inputs
(
start
);
if
(
commutative
and
inputs
.
size
()
>
1
)
if
(
commutative
and
inputs
.
size
()
>
1
)
{
{
std
::
sort
(
inputs
.
begin
(),
inputs
.
end
(),
compare_instruction_ref
{});
std
::
sort
(
inputs
.
begin
(),
inputs
.
end
(),
compare_instruction_ref
{});
if
(
not
std
::
all_of
(
group
.
begin
(),
group
.
end
(),
[
&
](
auto
ins
)
{
if
(
not
std
::
all_of
(
group
.
begin
(),
group
.
end
(),
[
&
](
auto
ins
)
{
auto
inputs2
=
get_inputs
(
ins
);
auto
inputs2
=
get_inputs
(
ins
);
std
::
sort
(
inputs2
.
begin
(),
inputs2
.
end
(),
compare_instruction_ref
{});
std
::
sort
(
inputs2
.
begin
(),
inputs2
.
end
(),
compare_instruction_ref
{});
return
inputs
==
inputs2
;
return
inputs
==
inputs2
;
}))
}))
return
{};
return
{};
}
}
...
...
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