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
733591e1
"src/targets/gpu/device/relu.cpp" did not exist on "7f9d85cc0323bff32b92ea5b3751ac8c2e6fb2f3"
Commit
733591e1
authored
Sep 10, 2018
by
Paul
Browse files
Formatting
parent
117ae108
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
src/eliminate_allocation.cpp
src/eliminate_allocation.cpp
+1
-1
test/eliminate_allocation_test.cpp
test/eliminate_allocation_test.cpp
+7
-5
No files found.
src/eliminate_allocation.cpp
View file @
733591e1
...
...
@@ -17,7 +17,7 @@ void eliminate_allocation::apply(program& p) const
if
(
ins
->
op
.
name
()
!=
allocation_op
)
continue
;
allocs
.
emplace_back
(
ins
,
n
);
std
::
size_t
size
=
ins
->
get_shape
().
bytes
();
std
::
size_t
size
=
ins
->
get_shape
().
bytes
();
std
::
size_t
padding
=
(
alignment
-
(
size
%
alignment
))
%
alignment
;
n
+=
size
+
padding
;
}
...
...
test/eliminate_allocation_test.cpp
View file @
733591e1
...
...
@@ -24,7 +24,9 @@ struct allocate
migraph
::
check_shapes
{
inputs
}.
has
(
0
);
return
s
;
}
migraph
::
argument
compute
(
migraph
::
context
&
,
const
migraph
::
shape
&
output_shape
,
const
std
::
vector
<
migraph
::
argument
>&
)
const
migraph
::
argument
compute
(
migraph
::
context
&
,
const
migraph
::
shape
&
output_shape
,
const
std
::
vector
<
migraph
::
argument
>&
)
const
{
return
{
output_shape
};
}
...
...
@@ -44,7 +46,7 @@ void basic()
p
.
compile
(
eliminate_allocation_target
{});
EXPECT
(
p
.
get_shape
()
==
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
200
}});
EXPECT
(
p
.
get_parameter_shape
(
"memory"
).
bytes
()
==
(
8
*
4
+
40
*
4
+
200
*
4
));
EXPECT
(
p
.
get_parameter_shape
(
"memory"
).
bytes
()
==
(
8
*
4
+
40
*
4
+
200
*
4
));
}
void
aligned
()
...
...
@@ -61,7 +63,7 @@ void aligned()
p
.
compile
(
eliminate_allocation_target
{});
EXPECT
(
p
.
get_shape
()
==
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
200
}});
EXPECT
(
p
.
get_parameter_shape
(
"memory"
).
bytes
()
==
(
32
+
32
+
200
*
4
));
EXPECT
(
p
.
get_parameter_shape
(
"memory"
).
bytes
()
==
(
32
+
32
+
200
*
4
));
}
void
unaligned
()
...
...
@@ -78,7 +80,7 @@ void unaligned()
p
.
compile
(
eliminate_allocation_target
{
1
});
EXPECT
(
p
.
get_shape
()
==
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
200
}});
EXPECT
(
p
.
get_parameter_shape
(
"memory"
).
bytes
()
==
(
1
*
4
+
2
*
4
+
200
*
4
));
EXPECT
(
p
.
get_parameter_shape
(
"memory"
).
bytes
()
==
(
1
*
4
+
2
*
4
+
200
*
4
));
}
void
float_aligned
()
...
...
@@ -95,7 +97,7 @@ void float_aligned()
p
.
compile
(
eliminate_allocation_target
{
4
});
EXPECT
(
p
.
get_shape
()
==
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
200
}});
EXPECT
(
p
.
get_parameter_shape
(
"memory"
).
bytes
()
==
(
1
*
4
+
2
*
4
+
200
*
4
));
EXPECT
(
p
.
get_parameter_shape
(
"memory"
).
bytes
()
==
(
1
*
4
+
2
*
4
+
200
*
4
));
}
int
main
()
...
...
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