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
702eeb45
Commit
702eeb45
authored
May 23, 2019
by
Shucai Xiao
Browse files
fix the bug of overflow in gpu test.
parent
833cc7a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
4 deletions
+2
-4
src/include/migraphx/generate.hpp
src/include/migraphx/generate.hpp
+2
-0
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+0
-4
No files found.
src/include/migraphx/generate.hpp
View file @
702eeb45
...
...
@@ -82,6 +82,8 @@ std::vector<T> generate_tensor_data(const migraphx::shape& s, unsigned long seed
{
std
::
vector
<
T
>
result
(
s
.
elements
());
std
::
generate
(
result
.
begin
(),
result
.
end
(),
xorshf96_generator
<
T
>
{
seed
});
// divide a value to avoid integer overflow
std
::
transform
(
result
.
begin
(),
result
.
end
(),
result
.
begin
(),
[](
auto
i
)
{
return
i
/
32
;
});
// std::generate(result.begin(), result.end(), [&]{ return seed % 7; });
// std::generate(result.begin(), result.end(), []{ return 1; });
return
result
;
...
...
test/gpu/miopen.cpp
View file @
702eeb45
...
...
@@ -82,10 +82,6 @@ auto get_hash(const T& x)
return
std
::
hash
<
T
>
{}(
x
);
}
// add an overload function for int type
// to avoid overflow in test examples
inline
auto
get_hash
(
const
int
&
x
)
{
return
std
::
hash
<
int
>
{}(
x
)
/
64
;
}
void
compile_check
(
migraphx
::
program
&
p
,
const
migraphx
::
target
&
t
)
{
auto
name
=
t
.
name
();
...
...
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