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
de001f3e
Commit
de001f3e
authored
Mar 19, 2019
by
Khalique
Browse files
formatting
parent
fd150551
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
src/eliminate_identity.cpp
src/eliminate_identity.cpp
+2
-2
test/eliminate_identity_test.cpp
test/eliminate_identity_test.cpp
+14
-9
No files found.
src/eliminate_identity.cpp
View file @
de001f3e
test/eliminate_identity_test.cpp
View file @
de001f3e
...
@@ -25,7 +25,9 @@ TEST_CASE(simple_test)
...
@@ -25,7 +25,9 @@ TEST_CASE(simple_test)
auto
two_identity
=
p
.
add_instruction
(
migraphx
::
op
::
identity
{},
two
);
auto
two_identity
=
p
.
add_instruction
(
migraphx
::
op
::
identity
{},
two
);
p
.
add_instruction
(
sum_op
{},
one_identity
,
two_identity
);
p
.
add_instruction
(
sum_op
{},
one_identity
,
two_identity
);
p
.
compile
(
eliminate_identity_target
{});
p
.
compile
(
eliminate_identity_target
{});
EXPECT
(
std
::
none_of
(
p
.
begin
(),
p
.
end
(),
[](
const
migraphx
::
instruction
&
ins
){
return
ins
.
name
()
==
"identity"
;
}));
EXPECT
(
std
::
none_of
(
p
.
begin
(),
p
.
end
(),
[](
const
migraphx
::
instruction
&
ins
)
{
return
ins
.
name
()
==
"identity"
;
}));
auto
result
=
p
.
eval
({});
auto
result
=
p
.
eval
({});
EXPECT
(
result
==
migraphx
::
literal
{
3
});
EXPECT
(
result
==
migraphx
::
literal
{
3
});
}
}
...
@@ -39,7 +41,9 @@ TEST_CASE(simple_test_end)
...
@@ -39,7 +41,9 @@ TEST_CASE(simple_test_end)
auto
ans
=
p
.
add_instruction
(
sum_op
{},
one
,
two
);
auto
ans
=
p
.
add_instruction
(
sum_op
{},
one
,
two
);
p
.
add_instruction
(
migraphx
::
op
::
identity
{},
ans
);
p
.
add_instruction
(
migraphx
::
op
::
identity
{},
ans
);
p
.
compile
(
eliminate_identity_target
{});
p
.
compile
(
eliminate_identity_target
{});
EXPECT
(
std
::
none_of
(
p
.
begin
(),
p
.
end
(),
[](
const
migraphx
::
instruction
&
ins
){
return
ins
.
name
()
==
"identity"
;
}));
EXPECT
(
std
::
none_of
(
p
.
begin
(),
p
.
end
(),
[](
const
migraphx
::
instruction
&
ins
)
{
return
ins
.
name
()
==
"identity"
;
}));
auto
result
=
p
.
eval
({});
auto
result
=
p
.
eval
({});
EXPECT
(
result
==
migraphx
::
literal
{
3
});
EXPECT
(
result
==
migraphx
::
literal
{
3
});
}
}
...
@@ -55,10 +59,11 @@ TEST_CASE(simple_test_end_dependency)
...
@@ -55,10 +59,11 @@ TEST_CASE(simple_test_end_dependency)
p
.
add_instruction
(
sum_op
{},
ans
,
three
);
p
.
add_instruction
(
sum_op
{},
ans
,
three
);
p
.
add_instruction
(
migraphx
::
op
::
identity
{},
ans
);
p
.
add_instruction
(
migraphx
::
op
::
identity
{},
ans
);
p
.
compile
(
eliminate_identity_target
{});
p
.
compile
(
eliminate_identity_target
{});
EXPECT
(
!
std
::
none_of
(
p
.
begin
(),
p
.
end
(),
[](
const
migraphx
::
instruction
&
ins
){
return
ins
.
name
()
==
"identity"
;
}));
EXPECT
(
!
std
::
none_of
(
p
.
begin
(),
p
.
end
(),
[](
const
migraphx
::
instruction
&
ins
)
{
return
ins
.
name
()
==
"identity"
;
}));
auto
result
=
p
.
eval
({});
auto
result
=
p
.
eval
({});
EXPECT
(
result
==
migraphx
::
literal
{
3.0
});
EXPECT
(
result
==
migraphx
::
literal
{
3.0
});
}
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
test
::
run
(
argc
,
argv
);
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
test
::
run
(
argc
,
argv
);
}
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