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
b19ec2b2
Commit
b19ec2b2
authored
Nov 03, 2018
by
Paul
Browse files
Add three more tests
parent
4a880d96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
test/memory_coloring_test.cpp
test/memory_coloring_test.cpp
+45
-0
No files found.
test/memory_coloring_test.cpp
View file @
b19ec2b2
...
...
@@ -309,6 +309,48 @@ void test20()
EXPECT
(
no_allocate
(
p
));
}
void
test21
()
{
migraph
::
program
p
;
auto
a1
=
add_alloc
(
p
,
{
migraph
::
shape
::
float_type
,
{
32
}});
auto
a2
=
add_alloc
(
p
,
{
migraph
::
shape
::
float_type
,
{
8
}});
auto
a3
=
add_alloc
(
p
,
{
migraph
::
shape
::
float_type
,
{
32
}});
auto
p1
=
p
.
add_instruction
(
pass_op
{},
a1
,
a2
,
a3
);
auto
a4
=
add_alloc
(
p
,
{
migraph
::
shape
::
float_type
,
{
8
}});
p
.
add_instruction
(
pass_op
{},
a4
,
p1
);
p
.
compile
(
memory_coloring_target
{});
EXPECT
(
p
.
get_parameter_shape
(
"scratch"
).
bytes
()
==
288
);
EXPECT
(
no_allocate
(
p
));
}
void
test22
()
{
migraph
::
program
p
;
auto
a1
=
add_alloc
(
p
,
{
migraph
::
shape
::
float_type
,
{
32
}});
auto
a2
=
add_alloc
(
p
,
{
migraph
::
shape
::
float_type
,
{
32
}});
auto
a3
=
add_alloc
(
p
,
{
migraph
::
shape
::
float_type
,
{
8
}});
auto
p1
=
p
.
add_instruction
(
pass_op
{},
a1
,
a2
,
a3
);
auto
a4
=
add_alloc
(
p
,
{
migraph
::
shape
::
float_type
,
{
8
}});
p
.
add_instruction
(
pass_op
{},
a4
,
p1
);
p
.
compile
(
memory_coloring_target
{});
EXPECT
(
p
.
get_parameter_shape
(
"scratch"
).
bytes
()
==
288
);
EXPECT
(
no_allocate
(
p
));
}
void
test23
()
{
migraph
::
program
p
;
auto
a1
=
add_alloc
(
p
,
{
migraph
::
shape
::
float_type
,
{
32
}});
auto
a2
=
add_alloc
(
p
,
{
migraph
::
shape
::
float_type
,
{
32
}});
auto
a3
=
add_alloc
(
p
,
{
migraph
::
shape
::
float_type
,
{
32
}});
auto
p1
=
p
.
add_instruction
(
pass_op
{},
a1
,
a2
,
a3
);
auto
a4
=
add_alloc
(
p
,
{
migraph
::
shape
::
float_type
,
{
8
}});
p
.
add_instruction
(
pass_op
{},
a4
,
p1
);
p
.
compile
(
memory_coloring_target
{});
EXPECT
(
p
.
get_parameter_shape
(
"scratch"
).
bytes
()
==
384
);
EXPECT
(
no_allocate
(
p
));
}
void
literal_test
()
{
migraph
::
program
p
;
...
...
@@ -341,6 +383,9 @@ int main()
test18
();
test19
();
test20
();
test21
();
test22
();
test23
();
literal_test
();
}
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