Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
4f33026c
Commit
4f33026c
authored
Aug 19, 2019
by
Paul
Browse files
Fix tests
parent
b324b9ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
3 deletions
+40
-3
test/eliminate_contiguous_test.cpp
test/eliminate_contiguous_test.cpp
+40
-3
No files found.
test/eliminate_contiguous_test.cpp
View file @
4f33026c
...
@@ -22,7 +22,7 @@ struct eliminate_contiguous_target
...
@@ -22,7 +22,7 @@ struct eliminate_contiguous_target
TEST_CASE
(
standard_op
)
TEST_CASE
(
standard_op
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
l
=
p
.
add_
literal
(
get_2x2
()
);
auto
l
=
p
.
add_
parameter
(
"x"
,
{
migraphx
::
shape
::
float_type
,
{
2
,
2
}}
);
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
);
p
.
add_instruction
(
pass_standard_op
{},
c
);
p
.
add_instruction
(
pass_standard_op
{},
c
);
...
@@ -31,18 +31,42 @@ TEST_CASE(standard_op)
...
@@ -31,18 +31,42 @@ TEST_CASE(standard_op)
EXPECT
(
std
::
distance
(
p
.
begin
(),
p
.
end
())
==
count
);
EXPECT
(
std
::
distance
(
p
.
begin
(),
p
.
end
())
==
count
);
}
}
TEST_CASE
(
non_
standard_op
)
TEST_CASE
(
standard_op
_const
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
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
);
p
.
add_instruction
(
pass_standard_op
{},
c
);
auto
count
=
std
::
distance
(
p
.
begin
(),
p
.
end
());
p
.
compile
(
eliminate_contiguous_target
{});
EXPECT
(
std
::
distance
(
p
.
begin
(),
p
.
end
())
==
2
);
}
TEST_CASE
(
non_standard_op
)
{
migraphx
::
program
p
;
auto
l
=
p
.
add_parameter
(
"x"
,
{
migraphx
::
shape
::
float_type
,
{
2
,
2
}});
auto
t
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
1
,
0
}},
l
);
auto
c
=
p
.
add_instruction
(
migraphx
::
op
::
contiguous
{},
t
);
p
.
add_instruction
(
pass_op
{},
c
);
p
.
add_instruction
(
pass_op
{},
c
);
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
(
non_standard_op_const
)
{
migraphx
::
program
p
;
auto
l
=
p
.
add_literal
(
get_2x2
());
auto
t
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
1
,
0
}},
l
);
auto
c
=
p
.
add_instruction
(
migraphx
::
op
::
contiguous
{},
t
);
p
.
add_instruction
(
pass_op
{},
c
);
auto
count
=
std
::
distance
(
p
.
begin
(),
p
.
end
());
p
.
compile
(
eliminate_contiguous_target
{});
EXPECT
(
std
::
distance
(
p
.
begin
(),
p
.
end
())
==
2
);
}
TEST_CASE
(
transpose_gemm
)
TEST_CASE
(
transpose_gemm
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
...
@@ -59,7 +83,7 @@ TEST_CASE(transpose_gemm)
...
@@ -59,7 +83,7 @@ TEST_CASE(transpose_gemm)
TEST_CASE
(
transpose_standard_op
)
TEST_CASE
(
transpose_standard_op
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
l
=
p
.
add_
literal
(
get_2x2
()
);
auto
l
=
p
.
add_
parameter
(
"x"
,
{
migraphx
::
shape
::
float_type
,
{
2
,
2
}}
);
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
sn
=
p
.
add_instruction
(
migraphx
::
op
::
sin
{},
c
);
auto
sn
=
p
.
add_instruction
(
migraphx
::
op
::
sin
{},
c
);
...
@@ -69,6 +93,19 @@ TEST_CASE(transpose_standard_op)
...
@@ -69,6 +93,19 @@ TEST_CASE(transpose_standard_op)
EXPECT
(
std
::
distance
(
p
.
begin
(),
p
.
end
())
==
count
);
EXPECT
(
std
::
distance
(
p
.
begin
(),
p
.
end
())
==
count
);
}
}
TEST_CASE
(
transpose_standard_op_const
)
{
migraphx
::
program
p
;
auto
l
=
p
.
add_literal
(
get_2x2
());
auto
t
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
1
,
0
}},
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
())
==
3
);
}
TEST_CASE
(
no_packed_unary_op
)
TEST_CASE
(
no_packed_unary_op
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
...
...
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