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
f9f431c4
"ts/webui/src/static/const.ts" did not exist on "7e35d32e2987493838779826155f7434bc30b81c"
Commit
f9f431c4
authored
May 22, 2019
by
Paul
Browse files
Add more test cases for simplify algebra
parent
33e15c8b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
test/simplify_algebra_test.cpp
test/simplify_algebra_test.cpp
+61
-0
No files found.
test/simplify_algebra_test.cpp
View file @
f9f431c4
...
...
@@ -99,7 +99,68 @@ TEST_CASE(simplify_add3)
EXPECT
(
p1
==
p2
);
}
TEST_CASE
(
simplify_add_broadcast1
)
{
migraphx
::
shape
inner
{
migraphx
::
shape
::
int32_type
,
{
2
}};
migraphx
::
shape
outer
{
migraphx
::
shape
::
int32_type
,
{
1
,
2
,
3
,
3
}};
migraphx
::
op
::
broadcast
b
{
1
,
{
1
,
2
,
3
,
3
}};
migraphx
::
program
p1
;
{
auto
x
=
p1
.
add_parameter
(
"x"
,
outer
);
auto
y
=
p1
.
add_parameter
(
"y"
,
outer
);
auto
one
=
p1
.
add_literal
({
inner
,
{
1
,
1
}});
auto
oneb
=
p1
.
add_instruction
(
b
,
one
);
auto
two
=
p1
.
add_literal
({
inner
,
{
2
,
2
}});
auto
twob
=
p1
.
add_instruction
(
b
,
two
);
auto
sum1
=
p1
.
add_instruction
(
migraphx
::
op
::
add
{},
x
,
oneb
);
auto
sum2
=
p1
.
add_instruction
(
migraphx
::
op
::
add
{},
y
,
twob
);
auto
sum3
=
p1
.
add_instruction
(
migraphx
::
op
::
add
{},
sum1
,
sum2
);
p1
.
add_instruction
(
pass_op
{},
sum3
);
}
p1
.
compile
(
simplify_algebra_target
{});
migraphx
::
program
p2
;
{
auto
x
=
p2
.
add_parameter
(
"x"
,
outer
);
auto
y
=
p2
.
add_parameter
(
"y"
,
outer
);
auto
one
=
p2
.
add_literal
({
inner
,
{
1
,
1
}});
auto
two
=
p2
.
add_literal
({
inner
,
{
2
,
2
}});
auto
sum1
=
p2
.
add_instruction
(
migraphx
::
op
::
add
{},
one
,
two
);
auto
sum1b
=
p2
.
add_instruction
(
b
,
sum1
);
auto
sum2
=
p2
.
add_instruction
(
migraphx
::
op
::
add
{},
x
,
y
);
auto
sum3
=
p2
.
add_instruction
(
migraphx
::
op
::
add
{},
sum2
,
sum1b
);
p2
.
add_instruction
(
pass_op
{},
sum3
);
}
EXPECT
(
p1
==
p2
);
}
TEST_CASE
(
simplify_add_broadcast2
)
{
migraphx
::
shape
inner
{
migraphx
::
shape
::
int32_type
,
{
2
}};
migraphx
::
shape
outer
{
migraphx
::
shape
::
int32_type
,
{
1
,
2
,
3
,
3
}};
migraphx
::
op
::
broadcast
b
{
1
,
{
1
,
2
,
3
,
3
}};
auto
create_program
=
[
&
]
{
migraphx
::
program
p
;
auto
x
=
p
.
add_parameter
(
"x"
,
outer
);
auto
y
=
p
.
add_parameter
(
"y"
,
outer
);
auto
one
=
p
.
add_literal
({
inner
,
{
1
,
1
}});
auto
oneb
=
p
.
add_instruction
(
b
,
one
);
auto
two
=
p
.
add_literal
({
outer
,
{
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
}});
auto
sum1
=
p
.
add_instruction
(
migraphx
::
op
::
add
{},
x
,
oneb
);
auto
sum2
=
p
.
add_instruction
(
migraphx
::
op
::
add
{},
y
,
two
);
auto
sum3
=
p
.
add_instruction
(
migraphx
::
op
::
add
{},
sum1
,
sum2
);
p
.
add_instruction
(
pass_op
{},
sum3
);
return
p
;
};
migraphx
::
program
p1
=
create_program
();
p1
.
compile
(
simplify_algebra_target
{});
migraphx
::
program
p2
=
create_program
();
EXPECT
(
p1
==
p2
);
}
// TODO: Add test case
// TEST_CASE(simplify_add4)
void
simplify_add4
()
{
migraphx
::
program
p1
;
...
...
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