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
dd9ff577
Commit
dd9ff577
authored
Oct 23, 2018
by
Paul
Browse files
Formatting
parent
299b33d1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
9 deletions
+6
-9
src/common_subexpression_elimination.cpp
src/common_subexpression_elimination.cpp
+3
-6
src/include/migraph/instruction.hpp
src/include/migraph/instruction.hpp
+1
-1
src/instruction.cpp
src/instruction.cpp
+2
-2
No files found.
src/common_subexpression_elimination.cpp
View file @
dd9ff577
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
namespace
migraph
{
namespace
migraph
{
template
<
class
Range
>
template
<
class
Range
>
void
cse_range
(
program
&
p
,
Range
&&
r
)
void
cse_range
(
program
&
p
,
Range
&&
r
)
{
{
std
::
unordered_multimap
<
std
::
string
,
instruction_ref
>
instructions
;
std
::
unordered_multimap
<
std
::
string
,
instruction_ref
>
instructions
;
...
@@ -18,7 +18,7 @@ void cse_range(program& p, Range&& r)
...
@@ -18,7 +18,7 @@ void cse_range(program& p, Range&& r)
continue
;
continue
;
// Find instruction with the same name
// Find instruction with the same name
auto
found_instructions
=
range
(
instructions
.
equal_range
(
ins
->
name
()));
auto
found_instructions
=
range
(
instructions
.
equal_range
(
ins
->
name
()));
for
(
auto
pp
:
found_instructions
)
for
(
auto
pp
:
found_instructions
)
{
{
auto
eq
=
pp
.
second
;
auto
eq
=
pp
.
second
;
if
(
*
eq
!=
*
ins
)
if
(
*
eq
!=
*
ins
)
...
@@ -30,9 +30,6 @@ void cse_range(program& p, Range&& r)
...
@@ -30,9 +30,6 @@ void cse_range(program& p, Range&& r)
}
}
}
}
void
common_subexpression_elimination
::
apply
(
program
&
p
)
const
void
common_subexpression_elimination
::
apply
(
program
&
p
)
const
{
cse_range
(
p
,
iterator_for
(
p
));
}
{
cse_range
(
p
,
iterator_for
(
p
));
}
}
// namespace migraph
}
// namespace migraph
src/include/migraph/instruction.hpp
View file @
dd9ff577
src/instruction.cpp
View file @
dd9ff577
...
@@ -96,7 +96,7 @@ const std::vector<instruction_ref>& instruction::outputs() const { return output
...
@@ -96,7 +96,7 @@ const std::vector<instruction_ref>& instruction::outputs() const { return output
bool
operator
==
(
const
instruction
&
x
,
const
instruction
&
y
)
bool
operator
==
(
const
instruction
&
x
,
const
instruction
&
y
)
{
{
if
(
not
(
x
.
result
==
y
.
result
and
x
.
op
==
y
.
op
and
x
.
arguments
==
y
.
arguments
))
if
(
not
(
x
.
result
==
y
.
result
and
x
.
op
==
y
.
op
and
x
.
arguments
==
y
.
arguments
))
return
false
;
return
false
;
if
(
x
.
name
()
==
"@literal"
)
if
(
x
.
name
()
==
"@literal"
)
return
x
.
lit
==
y
.
lit
;
return
x
.
lit
==
y
.
lit
;
...
...
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