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
fc60486e
Unverified
Commit
fc60486e
authored
Sep 26, 2023
by
Chris Austen
Committed by
GitHub
Sep 26, 2023
Browse files
Merge branch 'develop' into enable_navi_32_ci
parents
6041f74c
434a06cf
Changes
174
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
250 additions
and
29 deletions
+250
-29
test/ref/pow.cpp
test/ref/pow.cpp
+1
-1
test/ref/prefix_scan_sum.cpp
test/ref/prefix_scan_sum.cpp
+1
-1
test/ref/prelu.cpp
test/ref/prelu.cpp
+1
-1
test/ref/quant_convolution.cpp
test/ref/quant_convolution.cpp
+1
-1
test/ref/quantizelinear.cpp
test/ref/quantizelinear.cpp
+1
-1
test/ref/random_seed.cpp
test/ref/random_seed.cpp
+52
-0
test/ref/random_uniform.cpp
test/ref/random_uniform.cpp
+174
-0
test/ref/recip.cpp
test/ref/recip.cpp
+1
-1
test/ref/reduce_max.cpp
test/ref/reduce_max.cpp
+1
-1
test/ref/reduce_mean.cpp
test/ref/reduce_mean.cpp
+1
-1
test/ref/reduce_min.cpp
test/ref/reduce_min.cpp
+1
-1
test/ref/reduce_prod.cpp
test/ref/reduce_prod.cpp
+1
-1
test/ref/reduce_sum.cpp
test/ref/reduce_sum.cpp
+1
-1
test/ref/relu.cpp
test/ref/relu.cpp
+1
-1
test/ref/reshape.cpp
test/ref/reshape.cpp
+1
-1
test/ref/reverse.cpp
test/ref/reverse.cpp
+1
-1
test/ref/rnn_ops.cpp
test/ref/rnn_ops.cpp
+3
-8
test/ref/roialign.cpp
test/ref/roialign.cpp
+5
-5
test/ref/round.cpp
test/ref/round.cpp
+1
-1
test/ref/rsqrt.cpp
test/ref/rsqrt.cpp
+1
-1
No files found.
test/ref/pow.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
test/ref/prefix_scan_sum.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
test/ref/prelu.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
test/ref/quant_convolution.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
test/ref/quantizelinear.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
test/ref/random_seed.cpp
0 → 100644
View file @
fc60486e
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <migraphx/instruction.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/program.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
#include <random>
#include <test.hpp>
/**
* Reference test for the random_seed operation
*/
TEST_CASE
(
random_seed_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
mm
->
add_instruction
(
migraphx
::
make_op
(
"random_seed"
));
p
.
compile
(
migraphx
::
make_target
(
"ref"
));
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
uint64_t
>
result_vec1
(
1
);
result
.
visit
([
&
](
auto
output
)
{
result_vec1
.
assign
(
output
.
begin
(),
output
.
end
());
});
std
::
vector
<
uint64_t
>
result_vec2
(
1
);
// Identical calls should give different seeds every time with 1/(2^64) chance of a repeat.
// We don't analyze for true randomness.
result
=
p
.
eval
({}).
back
();
result
.
visit
([
&
](
auto
output
)
{
result_vec2
.
assign
(
output
.
begin
(),
output
.
end
());
});
EXPECT
(
result_vec1
[
0
]
!=
result_vec2
[
0
]);
}
test/ref/random_uniform.cpp
0 → 100644
View file @
fc60486e
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/onnx.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
#include <random>
#include <test.hpp>
/**
* Reference test for the random_uniform operation. Also invokes the random_seed operation.
*/
TEST_CASE
(
random_uniform_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
uint64_t
seed
(
0
);
size_t
sample_size
(
200
);
// Shape of the random data
migraphx
::
shape
rs
{
migraphx
::
shape
::
float_type
,
{
1
,
sample_size
}};
// data tensor must be allocated at this point but does not need to be initialized.
std
::
vector
<
float
>
data
(
sample_size
);
auto
input
=
mm
->
add_literal
(
migraphx
::
literal
(
rs
,
data
));
// Runtime randomization seed
migraphx
::
shape
seed_shape
{
migraphx
::
shape
::
uint64_type
,
{
1
}};
std
::
vector
<
uint64_t
>
seed_data
{
seed
};
auto
seed_input
=
mm
->
add_literal
(
migraphx
::
literal
(
seed_shape
,
seed_data
));
mm
->
add_instruction
(
migraphx
::
make_op
(
"random_uniform"
),
seed_input
,
input
);
p
.
compile
(
migraphx
::
make_target
(
"ref"
));
// no params_map needed
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
result_vec
(
sample_size
);
result
.
visit
([
&
](
auto
output
)
{
result_vec
.
assign
(
output
.
begin
(),
output
.
end
());
});
// Compare result with the STL's mt19937 generator
std
::
mt19937
gen
(
seed
);
std
::
uniform_real_distribution
<>
dis
(
0.0
,
1.0
);
std
::
vector
<
float
>
rand_samples
(
sample_size
);
std
::
generate
(
rand_samples
.
begin
(),
rand_samples
.
end
(),
[
&
]()
{
return
dis
(
gen
);
});
EXPECT
(
migraphx
::
verify
::
verify_range
(
result_vec
,
rand_samples
,
100
));
}
TEST_CASE
(
random_uniform_int_test
)
{
// random uniform distribution with an integer type input shape
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
float
seed
(
0.1
);
size_t
sample_size
(
200
);
// Shape of the random data
migraphx
::
shape
rs
{
migraphx
::
shape
::
uint16_type
,
{
1
,
sample_size
}};
// data tensor must be allocated at this point but does not need to be initialized.
std
::
vector
<
uint16_t
>
data
(
sample_size
);
auto
input
=
mm
->
add_literal
(
migraphx
::
literal
(
rs
,
data
));
// Runtime randomization seed
migraphx
::
shape
seed_shape
{
migraphx
::
shape
::
float_type
,
{
1
}};
std
::
vector
<
float
>
seed_data
{
seed
};
auto
seed_input
=
mm
->
add_literal
(
migraphx
::
literal
(
seed_shape
,
seed_data
));
mm
->
add_instruction
(
migraphx
::
make_op
(
"random_uniform"
),
seed_input
,
input
);
p
.
compile
(
migraphx
::
make_target
(
"ref"
));
migraphx
::
parameter_map
params0
;
auto
result
=
p
.
eval
(
params0
).
back
();
std
::
vector
<
uint16_t
>
result_vec
(
sample_size
);
result
.
visit
([
&
](
auto
output
)
{
result_vec
.
assign
(
output
.
begin
(),
output
.
end
());
});
// Compare result with the STL's mt19937 generator
std
::
mt19937
gen
(
seed
);
std
::
uniform_int_distribution
<
uint16_t
>
dis
;
std
::
vector
<
uint16_t
>
rand_samples
(
sample_size
);
std
::
generate
(
rand_samples
.
begin
(),
rand_samples
.
end
(),
[
&
]()
{
return
dis
(
gen
);
});
EXPECT
(
migraphx
::
verify
::
verify_range
(
result_vec
,
rand_samples
));
}
TEST_CASE
(
random_uniform_dyn_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
uint64_t
seed
(
17
);
size_t
sample_size
(
200
);
// Shape of the random data
migraphx
::
shape
rs
{
migraphx
::
shape
::
float_type
,
{{
1
,
2
},
{
2
,
sample_size
+
1
}}};
auto
input
=
mm
->
add_parameter
(
"Input_1"
,
rs
);
// Runtime randomization seed
migraphx
::
shape
seed_shape
{
migraphx
::
shape
::
uint64_type
,
{
1
}};
auto
seed_input
=
mm
->
add_parameter
(
"Seed"
,
seed_shape
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"random_uniform"
,
{}),
seed_input
,
input
);
p
.
compile
(
migraphx
::
make_target
(
"ref"
));
// Create a dummy input to hold the random data
migraphx
::
shape
input_fixed_shape1
{
migraphx
::
shape
::
float_type
,
{
sample_size
}};
migraphx
::
parameter_map
params0
;
params0
[
"Input_1"
]
=
migraphx
::
argument
(
input_fixed_shape1
);
std
::
vector
<
uint64_t
>
seed_data
=
{
seed
};
params0
[
"Seed"
]
=
migraphx
::
argument
(
seed_shape
,
seed_data
.
data
());
auto
result
=
p
.
eval
(
params0
).
back
();
std
::
vector
<
float
>
result_vec
(
sample_size
);
result
.
visit
([
&
](
auto
output
)
{
result_vec
.
assign
(
output
.
begin
(),
output
.
end
());
});
// Compare result with the STL's mt19937 generator
std
::
mt19937
gen
(
seed
);
std
::
uniform_real_distribution
<>
dis
(
0.0
,
1.0
);
std
::
vector
<
float
>
rand_samples
(
sample_size
);
std
::
generate
(
rand_samples
.
begin
(),
rand_samples
.
end
(),
[
&
]()
{
return
dis
(
gen
);
});
EXPECT
(
migraphx
::
verify
::
verify_range
(
result_vec
,
rand_samples
));
}
TEST_CASE
(
random_uniform_and_seed_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
size_t
sample_size
(
20000
);
// Shape of the random data
migraphx
::
shape
rs
{
migraphx
::
shape
::
float_type
,
{{
1
,
2
},
{
2
,
sample_size
+
1
}}};
auto
input
=
mm
->
add_parameter
(
"Input_1"
,
rs
);
// Runtime randomization seed
auto
seed_input
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"random_seed"
));
mm
->
add_instruction
(
migraphx
::
make_op
(
"random_uniform"
),
seed_input
,
input
);
p
.
compile
(
migraphx
::
make_target
(
"ref"
));
// Create a dummy input to hold the random data
migraphx
::
shape
input_fixed_shape1
{
migraphx
::
shape
::
float_type
,
{
sample_size
}};
migraphx
::
parameter_map
params0
;
params0
[
"Input_1"
]
=
migraphx
::
argument
(
input_fixed_shape1
);
auto
result
=
p
.
eval
(
params0
).
back
();
result
.
visit
([
&
](
auto
output
)
{
EXPECT
(
output
.
size
()
==
sample_size
);
});
// Do not check the content of the data since it's not repeatable
}
test/ref/recip.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
test/ref/reduce_max.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
test/ref/reduce_mean.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
test/ref/reduce_min.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
test/ref/reduce_prod.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
test/ref/reduce_sum.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
test/ref/relu.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
test/ref/reshape.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
test/ref/reverse.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
test/ref/rnn_ops.cpp
View file @
fc60486e
...
...
@@ -21,18 +21,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <iostream>
#include <vector>
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/op/common.hpp>
#include <migraphx/
instruction
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
#include <migraphx/onnx.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/quantization.hpp>
#include <migraphx/serialize.hpp>
#include "test.hpp"
...
...
test/ref/roialign.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/op/pooling.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
@@ -73,7 +73,7 @@ TEST_CASE(roialign_out_of_bound_test)
};
{
auto
p
=
create_program
(
"
output_
half_pixel"
);
auto
p
=
create_program
(
"half_pixel"
);
p
.
compile
(
migraphx
::
make_target
(
"ref"
));
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
results_vector
;
...
...
@@ -130,7 +130,7 @@ TEST_CASE(roialign_test)
};
{
auto
p
=
create_program
();
auto
p
=
create_program
(
"output_half_pixel"
);
p
.
compile
(
migraphx
::
make_target
(
"ref"
));
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
results_vector
;
...
...
@@ -154,7 +154,7 @@ TEST_CASE(roialign_test)
}
{
auto
p
=
create_program
(
"
output_
half_pixel"
);
auto
p
=
create_program
(
"half_pixel"
);
p
.
compile
(
migraphx
::
make_target
(
"ref"
));
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
results_vector
;
...
...
@@ -175,7 +175,7 @@ TEST_CASE(roialign_test)
}
{
auto
p
=
create_program
(
"
output_
half_pixel"
,
migraphx
::
op
::
pooling_mode
::
max
,
0
);
auto
p
=
create_program
(
"half_pixel"
,
migraphx
::
op
::
pooling_mode
::
max
,
0
);
p
.
compile
(
migraphx
::
make_target
(
"ref"
));
auto
result
=
p
.
eval
({}).
back
();
std
::
vector
<
float
>
results_vector
;
...
...
test/ref/round.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
test/ref/rsqrt.cpp
View file @
fc60486e
...
...
@@ -24,7 +24,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/
onnx
.hpp>
#include <migraphx/
program
.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/verify.hpp>
...
...
Prev
1
…
3
4
5
6
7
8
9
Next
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