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
7668f6c0
Commit
7668f6c0
authored
Apr 30, 2019
by
Shucai Xiao
Browse files
add more tests for better code coverage
parent
3c89b942
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
test/eliminate_contiguous_test.cpp
test/eliminate_contiguous_test.cpp
+16
-2
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+13
-0
No files found.
test/eliminate_contiguous_test.cpp
View file @
7668f6c0
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include <migraphx/op/identity.hpp>
#include <migraphx/op/identity.hpp>
#include <migraphx/op/dot.hpp>
#include <migraphx/op/dot.hpp>
#include <migraphx/op/sin.hpp>
#include <migraphx/op/sin.hpp>
#include <migraphx/op/slice.hpp>
#include <migraphx/op/transpose.hpp>
#include <migraphx/op/transpose.hpp>
#include <migraphx/op/contiguous.hpp>
#include <migraphx/op/contiguous.hpp>
#include <basic_ops.hpp>
#include <basic_ops.hpp>
...
@@ -61,11 +62,24 @@ TEST_CASE(transpose_standard_op)
...
@@ -61,11 +62,24 @@ TEST_CASE(transpose_standard_op)
auto
l
=
p
.
add_literal
(
get_2x2
());
auto
l
=
p
.
add_literal
(
get_2x2
());
auto
t
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
1
,
0
}},
l
);
auto
t
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
1
,
0
}},
l
);
auto
c
=
p
.
add_instruction
(
migraphx
::
op
::
contiguous
{},
t
);
auto
c
=
p
.
add_instruction
(
migraphx
::
op
::
contiguous
{},
t
);
auto
s
um
=
p
.
add_instruction
(
migraphx
::
op
::
sin
{},
c
);
auto
s
n
=
p
.
add_instruction
(
migraphx
::
op
::
sin
{},
c
);
p
.
add_instruction
(
pass_standard_op
{},
s
um
);
p
.
add_instruction
(
pass_standard_op
{},
s
n
);
auto
count
=
std
::
distance
(
p
.
begin
(),
p
.
end
());
auto
count
=
std
::
distance
(
p
.
begin
(),
p
.
end
());
p
.
compile
(
eliminate_contiguous_target
{});
p
.
compile
(
eliminate_contiguous_target
{});
EXPECT
(
std
::
distance
(
p
.
begin
(),
p
.
end
())
==
count
);
EXPECT
(
std
::
distance
(
p
.
begin
(),
p
.
end
())
==
count
);
}
}
TEST_CASE
(
no_packed_unary_op
)
{
migraphx
::
program
p
;
auto
l
=
p
.
add_literal
(
get_2x2
());
auto
t
=
p
.
add_instruction
(
migraphx
::
op
::
slice
{{
1
},
{
1
},
{
2
}},
l
);
auto
c
=
p
.
add_instruction
(
migraphx
::
op
::
contiguous
{},
t
);
auto
sn
=
p
.
add_instruction
(
migraphx
::
op
::
sin
{},
c
);
p
.
add_instruction
(
pass_standard_op
{},
sn
);
auto
count
=
std
::
distance
(
p
.
begin
(),
p
.
end
());
p
.
compile
(
eliminate_contiguous_target
{});
EXPECT
(
std
::
distance
(
p
.
begin
(),
p
.
end
())
==
count
-
1
);
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
test
::
run
(
argc
,
argv
);
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
test
::
run
(
argc
,
argv
);
}
test/gpu/miopen.cpp
View file @
7668f6c0
...
@@ -340,6 +340,19 @@ struct test_trans_tanh : verify_program<test_trans_tanh>
...
@@ -340,6 +340,19 @@ struct test_trans_tanh : verify_program<test_trans_tanh>
}
}
};
};
struct
test_slice_sin
:
verify_program
<
test_slice_sin
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
l
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
2
}});
auto
t
=
p
.
add_instruction
(
migraphx
::
op
::
slice
{{
1
},
{
1
},
{
2
}},
l
);
p
.
add_instruction
(
migraphx
::
op
::
sin
{},
t
);
return
p
;
}
};
struct
test_asin
:
verify_program
<
test_asin
>
struct
test_asin
:
verify_program
<
test_asin
>
{
{
migraphx
::
program
create_program
()
const
migraphx
::
program
create_program
()
const
...
...
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