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
b73427c9
Unverified
Commit
b73427c9
authored
Dec 07, 2023
by
Chris Austen
Committed by
GitHub
Dec 07, 2023
Browse files
Merge branch 'develop' into fix_for_multiconfig_generators
parents
55e635e5
4c059fa3
Changes
240
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
164 additions
and
76 deletions
+164
-76
test/verify/gemm_multi_3args_alpha0.cpp
test/verify/gemm_multi_3args_alpha0.cpp
+10
-4
test/verify/gemm_multi_3args_beta0.cpp
test/verify/gemm_multi_3args_beta0.cpp
+9
-4
test/verify/gemm_multi_3args_c25.cpp
test/verify/gemm_multi_3args_c25.cpp
+9
-4
test/verify/gemm_multi_dim_2.cpp
test/verify/gemm_multi_dim_2.cpp
+8
-3
test/verify/gemm_multi_dim_2_3.cpp
test/verify/gemm_multi_dim_2_3.cpp
+8
-3
test/verify/gemm_multi_transpose.cpp
test/verify/gemm_multi_transpose.cpp
+8
-3
test/verify/gemm_softmax_gemm_relu.cpp
test/verify/gemm_softmax_gemm_relu.cpp
+19
-12
test/verify/main.cpp
test/verify/main.cpp
+0
-1
test/verify/quant_conv.cpp
test/verify/quant_conv.cpp
+7
-3
test/verify/quant_conv_1.cpp
test/verify/quant_conv_1.cpp
+7
-3
test/verify/quant_conv_1d.cpp
test/verify/quant_conv_1d.cpp
+8
-3
test/verify/quant_conv_2.cpp
test/verify/quant_conv_2.cpp
+7
-3
test/verify/quant_conv_padding.cpp
test/verify/quant_conv_padding.cpp
+7
-3
test/verify/quant_conv_padding_stride.cpp
test/verify/quant_conv_padding_stride.cpp
+6
-3
test/verify/run_verify.cpp
test/verify/run_verify.cpp
+13
-10
test/verify/run_verify.hpp
test/verify/run_verify.hpp
+5
-3
test/verify/test_abs.cpp
test/verify/test_abs.cpp
+7
-2
test/verify/test_acos.cpp
test/verify/test_acos.cpp
+7
-2
test/verify/test_acosh.cpp
test/verify/test_acosh.cpp
+12
-5
test/verify/test_add.cpp
test/verify/test_add.cpp
+7
-2
No files found.
test/verify/gemm_multi_3args_alpha0.cpp
View file @
b73427c9
...
...
@@ -27,15 +27,17 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.hpp>
struct
gemm_multi_3args_alpha0
:
verify_program
<
gemm_multi_3args_alpha0
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_multi_3args_alpha0
:
verify_program
<
gemm_multi_3args_alpha0
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
3
,
4
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
2
,
4
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
1
,
3
,
4
}};
migraphx
::
shape
m3_shape
{
DT
ype
,
{
1
,
2
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l3
=
mm
->
add_parameter
(
"3"
,
m3_shape
);
...
...
@@ -46,3 +48,7 @@ struct gemm_multi_3args_alpha0 : verify_program<gemm_multi_3args_alpha0>
return
p
;
}
};
template
struct
gemm_multi_3args_alpha0
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_multi_3args_alpha0
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_multi_3args_alpha0
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_multi_3args_beta0.cpp
View file @
b73427c9
...
...
@@ -28,15 +28,16 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_multi_3args_beta0
:
verify_program
<
gemm_multi_3args_beta0
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_multi_3args_beta0
:
verify_program
<
gemm_multi_3args_beta0
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
3
,
4
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
2
,
4
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
1
,
3
,
4
}};
migraphx
::
shape
m3_shape
{
DT
ype
,
{
1
,
2
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l3
=
mm
->
add_parameter
(
"3"
,
m3_shape
);
...
...
@@ -47,3 +48,7 @@ struct gemm_multi_3args_beta0 : verify_program<gemm_multi_3args_beta0>
return
p
;
}
};
template
struct
gemm_multi_3args_beta0
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_multi_3args_beta0
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_multi_3args_beta0
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_multi_3args_c25.cpp
View file @
b73427c9
...
...
@@ -28,15 +28,16 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_multi_3args_c25
:
verify_program
<
gemm_multi_3args_c25
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_multi_3args_c25
:
verify_program
<
gemm_multi_3args_c25
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
3
,
5
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
5
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
3
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
3
,
5
}};
migraphx
::
shape
m3_shape
{
DT
ype
,
{
2
,
5
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
...
...
@@ -47,3 +48,7 @@ struct gemm_multi_3args_c25 : verify_program<gemm_multi_3args_c25>
return
p
;
}
};
template
struct
gemm_multi_3args_c25
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_multi_3args_c25
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_multi_3args_c25
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_multi_dim_2.cpp
View file @
b73427c9
...
...
@@ -27,14 +27,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_multi_dim_2
:
verify_program
<
gemm_multi_dim_2
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_multi_dim_2
:
verify_program
<
gemm_multi_dim_2
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
3
,
4
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
2
,
3
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
...
...
@@ -43,3 +44,7 @@ struct gemm_multi_dim_2 : verify_program<gemm_multi_dim_2>
return
p
;
}
};
template
struct
gemm_multi_dim_2
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_multi_dim_2
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_multi_dim_2
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_multi_dim_2_3.cpp
View file @
b73427c9
...
...
@@ -27,14 +27,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_multi_dim_2_3
:
verify_program
<
gemm_multi_dim_2_3
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_multi_dim_2_3
:
verify_program
<
gemm_multi_dim_2_3
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
3
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
3
,
3
,
2
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
3
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
2
,
3
,
3
,
2
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
...
...
@@ -43,3 +44,7 @@ struct gemm_multi_dim_2_3 : verify_program<gemm_multi_dim_2_3>
return
p
;
}
};
template
struct
gemm_multi_dim_2_3
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_multi_dim_2_3
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_multi_dim_2_3
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_multi_transpose.cpp
View file @
b73427c9
...
...
@@ -28,14 +28,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_multi_transpose
:
verify_program
<
gemm_multi_transpose
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_multi_transpose
:
verify_program
<
gemm_multi_transpose
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
3
,
2
,
4
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
3
,
2
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
tl2
=
...
...
@@ -47,3 +48,7 @@ struct gemm_multi_transpose : verify_program<gemm_multi_transpose>
return
p
;
}
};
template
struct
gemm_multi_transpose
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_multi_transpose
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_multi_transpose
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_
add_broadcast_half
.cpp
→
test/verify/gemm_
softmax_gemm_relu
.cpp
View file @
b73427c9
...
...
@@ -26,24 +26,31 @@
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.hpp>
struct
gemm_
add_broadcast_half
:
verify_program
<
gemm_
add_broadcast_half
>
struct
gemm_
softmax_gemm_relu
:
verify_program
<
gemm_
softmax_gemm_relu
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
half_type
,
{
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
half_type
,
{
1
,
3
,
4
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
half_type
,
{
1
,
1
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l3
=
mm
->
add_parameter
(
"3"
,
m3_shape
);
auto
l3_b
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
1
,
2
,
4
}}}),
l3
);
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
half_type
,
{
1
,
12
,
256
,
256
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
half_type
,
{
1
,
12
,
256
,
256
}};
auto
m2_elements
=
m2_shape
.
elements
();
auto
a
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
b
=
mm
->
add_parameter
(
"2"
,
m1_shape
);
auto
b1
=
mm
->
add_parameter
(
"3"
,
m1_shape
);
std
::
vector
<
float
>
eights
(
m2_elements
,
0.125
);
auto
eight
=
mm
->
add_literal
(
migraphx
::
literal
{
m2_shape
,
eights
});
std
::
vector
<
float
>
zeros
(
m2_elements
,
0
);
auto
zero
=
mm
->
add_literal
(
migraphx
::
literal
{
m2_shape
,
zeros
});
auto
dot
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
l1
,
l2
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
dot
,
l3_b
);
b
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
0
,
1
,
3
,
2
}}}),
b
);
auto
gemm1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
a
,
b
);
auto
scale
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
gemm1
,
eight
);
auto
bias
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
scale
,
zero
);
auto
softmax
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"softmax"
,
{{
"axis"
,
3
}}),
bias
);
auto
gemm2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
softmax
,
b1
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"relu"
),
gemm2
);
return
p
;
}
};
test/verify/main.cpp
View file @
b73427c9
...
...
@@ -77,6 +77,5 @@ int main(int argc, const char* argv[])
"test_split_single_dyn_dim"
,
"test_instancenorm_large_3d<migraphx::shape::float_type>"
,
"test_instancenorm_large_3d<migraphx::shape::half_type>"
});
rv
.
disable_test_for
(
"gpu"
,
{
"test_conv_bn_add"
});
rv
.
run
(
argc
,
argv
);
}
test/verify/quant_conv.cpp
View file @
b73427c9
...
...
@@ -27,17 +27,21 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
quant_conv
:
verify_program
<
quant_conv
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
quant_conv
:
verify_program
<
quant_conv
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
int8_t
ype
,
{
2
,
3
,
4
,
4
}};
migraphx
::
shape
a_shape
{
DT
ype
,
{
2
,
3
,
4
,
4
}};
auto
pa
=
mm
->
add_parameter
(
"a"
,
a_shape
);
migraphx
::
shape
c_shape
{
migraphx
::
shape
::
int8_t
ype
,
{
2
,
3
,
3
,
3
}};
migraphx
::
shape
c_shape
{
DT
ype
,
{
2
,
3
,
3
,
3
}};
auto
pc
=
mm
->
add_parameter
(
"c"
,
c_shape
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"quant_convolution"
),
pa
,
pc
);
return
p
;
}
};
template
struct
quant_conv
<
migraphx
::
shape
::
int8_type
>;
template
struct
quant_conv
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/quant_conv_1.cpp
View file @
b73427c9
...
...
@@ -27,17 +27,21 @@
#include <migraphx/generate.hpp>
#include <migraphx/op/quant_convolution.hpp>
struct
quant_conv_1
:
verify_program
<
quant_conv_1
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
quant_conv_1
:
verify_program
<
quant_conv_1
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
int8_t
ype
,
{
2
,
3
,
4
,
4
}};
migraphx
::
shape
a_shape
{
DT
ype
,
{
2
,
3
,
4
,
4
}};
auto
pa
=
mm
->
add_parameter
(
"a"
,
a_shape
);
migraphx
::
shape
c_shape
{
migraphx
::
shape
::
int8_t
ype
,
{
2
,
3
,
3
,
3
}};
migraphx
::
shape
c_shape
{
DT
ype
,
{
2
,
3
,
3
,
3
}};
auto
pc
=
mm
->
add_parameter
(
"c"
,
c_shape
);
mm
->
add_instruction
(
migraphx
::
op
::
quant_convolution
{{{
0
,
0
}},
{{
1
,
1
}},
{{
1
,
1
}}},
pa
,
pc
);
return
p
;
}
};
template
struct
quant_conv_1
<
migraphx
::
shape
::
int8_type
>;
template
struct
quant_conv_1
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/quant_conv_1d.cpp
View file @
b73427c9
...
...
@@ -27,15 +27,16 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
quant_conv_1d
:
verify_program
<
quant_conv_1d
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
quant_conv_1d
:
verify_program
<
quant_conv_1d
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
int8_t
ype
,
{
2
,
3
,
4
}};
migraphx
::
shape
a_shape
{
DT
ype
,
{
2
,
3
,
4
}};
auto
pa
=
mm
->
add_parameter
(
"a"
,
a_shape
);
migraphx
::
shape
c_shape
{
migraphx
::
shape
::
int8_t
ype
,
{
2
,
3
,
3
}};
migraphx
::
shape
c_shape
{
DT
ype
,
{
2
,
3
,
3
}};
auto
pc
=
mm
->
add_parameter
(
"c"
,
c_shape
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"quant_convolution"
,
...
...
@@ -45,3 +46,7 @@ struct quant_conv_1d : verify_program<quant_conv_1d>
return
p
;
}
};
template
struct
quant_conv_1d
<
migraphx
::
shape
::
int8_type
>;
// MLIR 1D convolution is not supported in MIGraphX yet. Enable this through MIOpen route later.
// template struct quant_conv_1d<migraphx::shape::fp8e4m3fnuz_type>;
test/verify/quant_conv_2.cpp
View file @
b73427c9
...
...
@@ -27,17 +27,21 @@
#include <migraphx/generate.hpp>
#include <migraphx/op/quant_convolution.hpp>
struct
quant_conv_2
:
verify_program
<
quant_conv_2
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
quant_conv_2
:
verify_program
<
quant_conv_2
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
int8_t
ype
,
{
16
,
16
,
4
,
4
}};
migraphx
::
shape
a_shape
{
DT
ype
,
{
16
,
16
,
4
,
4
}};
auto
pa
=
mm
->
add_parameter
(
"a"
,
a_shape
);
migraphx
::
shape
c_shape
{
migraphx
::
shape
::
int8_t
ype
,
{
16
,
16
,
3
,
3
}};
migraphx
::
shape
c_shape
{
DT
ype
,
{
16
,
16
,
3
,
3
}};
auto
pc
=
mm
->
add_parameter
(
"c"
,
c_shape
);
mm
->
add_instruction
(
migraphx
::
op
::
quant_convolution
{{{
0
,
0
}},
{{
1
,
1
}},
{{
1
,
1
}}},
pa
,
pc
);
return
p
;
}
};
template
struct
quant_conv_2
<
migraphx
::
shape
::
int8_type
>;
template
struct
quant_conv_2
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/quant_conv_padding.cpp
View file @
b73427c9
...
...
@@ -27,15 +27,16 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
quant_conv_padding
:
verify_program
<
quant_conv_padding
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
quant_conv_padding
:
verify_program
<
quant_conv_padding
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
int8_t
ype
,
{
2
,
3
,
4
,
4
}};
migraphx
::
shape
a_shape
{
DT
ype
,
{
2
,
3
,
4
,
4
}};
auto
pa
=
mm
->
add_parameter
(
"a"
,
a_shape
);
migraphx
::
shape
c_shape
{
migraphx
::
shape
::
int8_t
ype
,
{
2
,
3
,
3
,
3
}};
migraphx
::
shape
c_shape
{
DT
ype
,
{
2
,
3
,
3
,
3
}};
auto
pc
=
mm
->
add_parameter
(
"c"
,
c_shape
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"quant_convolution"
,
{{
"padding"
,
{
1
,
1
}},
{
"stride"
,
{
1
,
1
}}}),
...
...
@@ -44,3 +45,6 @@ struct quant_conv_padding : verify_program<quant_conv_padding>
return
p
;
}
};
template
struct
quant_conv_padding
<
migraphx
::
shape
::
int8_type
>;
template
struct
quant_conv_padding
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/quant_conv_padding_stride.cpp
View file @
b73427c9
...
...
@@ -27,15 +27,16 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
quant_conv_padding_stride
:
verify_program
<
quant_conv_padding_stride
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
quant_conv_padding_stride
:
verify_program
<
quant_conv_padding_stride
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
int8_t
ype
,
{
2
,
3
,
4
,
4
}};
migraphx
::
shape
a_shape
{
DT
ype
,
{
2
,
3
,
4
,
4
}};
auto
pa
=
mm
->
add_parameter
(
"a"
,
a_shape
);
migraphx
::
shape
c_shape
{
migraphx
::
shape
::
int8_t
ype
,
{
2
,
3
,
3
,
3
}};
migraphx
::
shape
c_shape
{
DT
ype
,
{
2
,
3
,
3
,
3
}};
auto
pc
=
mm
->
add_parameter
(
"c"
,
c_shape
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"quant_convolution"
,
{{
"padding"
,
{
1
,
1
}},
{
"stride"
,
{
2
,
2
}}}),
...
...
@@ -45,3 +46,5 @@ struct quant_conv_padding_stride : verify_program<quant_conv_padding_stride>
return
p
;
}
};
template
struct
quant_conv_padding_stride
<
migraphx
::
shape
::
int8_type
>;
template
struct
quant_conv_padding_stride
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/run_verify.cpp
View file @
b73427c9
...
...
@@ -136,15 +136,18 @@ void run_verify::validate(const migraphx::target& t,
ti
.
validate
(
p
,
m
);
}
std
::
vector
<
migraphx
::
argument
>
run_verify
::
run_ref
(
migraphx
::
program
p
,
migraphx
::
parameter_map
inputs
,
const
migraphx
::
compile_options
&
c_opts
)
const
std
::
pair
<
migraphx
::
program
,
std
::
vector
<
migraphx
::
argument
>>
run_verify
::
run_ref
(
migraphx
::
program
p
,
migraphx
::
parameter_map
inputs
,
const
migraphx
::
compile_options
&
c_opts
)
const
{
migraphx
::
target
t
=
migraphx
::
make_target
(
"ref"
);
auto_print
pp
{
p
,
t
.
name
()};
compile_check
(
p
,
t
,
c_opts
);
return
p
.
eval
(
std
::
move
(
inputs
));
auto
trace_target
=
migraphx
::
string_value_of
(
MIGRAPHX_TRACE_TEST_COMPILE
{});
compile_check
(
p
,
t
,
c_opts
,
(
trace_target
==
"ref"
));
return
std
::
make_pair
(
std
::
move
(
p
),
p
.
eval
(
std
::
move
(
inputs
)));
}
std
::
pair
<
migraphx
::
program
,
std
::
vector
<
migraphx
::
argument
>>
run_verify
::
run_target
(
const
migraphx
::
target
&
t
,
migraphx
::
program
p
,
...
...
@@ -225,7 +228,7 @@ void run_verify::verify(const std::string& name,
}
}
auto
gold
_f
=
detach_async
([
=
]
{
return
run_ref
(
p
,
m
,
c_opts
);
});
auto
ref
_f
=
detach_async
([
=
]
{
return
run_ref
(
p
,
m
,
c_opts
);
});
for
(
const
auto
&
tname
:
target_names
)
{
target_info
ti
=
get_target_info
(
tname
);
...
...
@@ -234,8 +237,8 @@ void run_verify::verify(const std::string& name,
tname
,
detach_async
([
=
]
{
return
run_target
(
t
,
p
,
m
,
c_opts
);
},
ti
.
parallel
));
}
assert
(
gold
_f
.
valid
());
auto
gold
=
gold
_f
.
get
();
assert
(
ref
_f
.
valid
());
auto
ref_results
=
ref
_f
.
get
();
for
(
auto
&&
pp
:
results
)
{
...
...
@@ -244,7 +247,7 @@ void run_verify::verify(const std::string& name,
auto
x
=
pp
.
second
.
get
();
auto
cp
=
x
.
first
;
auto
result
=
x
.
second
;
auto
gold
=
ref_results
.
second
;
bool
passed
=
true
;
passed
&=
(
gold
.
size
()
==
result
.
size
());
std
::
size_t
num
=
gold
.
size
();
...
...
@@ -257,7 +260,7 @@ void run_verify::verify(const std::string& name,
if
(
not
passed
or
migraphx
::
enabled
(
MIGRAPHX_TRACE_TEST
{}))
{
std
::
cout
<<
p
<<
std
::
endl
;
std
::
cout
<<
"ref:
\n
"
<<
p
<<
std
::
endl
;
std
::
cout
<<
"ref:
\n
"
<<
ref_results
.
first
<<
std
::
endl
;
std
::
cout
<<
tname
<<
":
\n
"
<<
cp
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
}
...
...
test/verify/run_verify.hpp
View file @
b73427c9
...
...
@@ -39,9 +39,11 @@ struct target_info
struct
run_verify
{
std
::
vector
<
migraphx
::
argument
>
run_ref
(
migraphx
::
program
p
,
migraphx
::
parameter_map
inputs
,
const
migraphx
::
compile_options
&
c_opts
)
const
;
std
::
pair
<
migraphx
::
program
,
std
::
vector
<
migraphx
::
argument
>>
run_ref
(
migraphx
::
program
p
,
migraphx
::
parameter_map
inputs
,
const
migraphx
::
compile_options
&
c_opts
)
const
;
std
::
pair
<
migraphx
::
program
,
std
::
vector
<
migraphx
::
argument
>>
run_target
(
const
migraphx
::
target
&
t
,
migraphx
::
program
p
,
...
...
test/verify/test_abs.cpp
View file @
b73427c9
...
...
@@ -27,14 +27,19 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_abs
:
verify_program
<
test_abs
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_abs
:
verify_program
<
test_abs
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_t
ype
,
{
4
,
3
,
3
,
3
}});
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
DT
ype
,
{
4
,
3
,
3
,
3
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"abs"
),
x
);
return
p
;
}
};
template
struct
test_abs
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
template
struct
test_abs
<
migraphx
::
shape
::
half_type
>;
template
struct
test_abs
<
migraphx
::
shape
::
float_type
>;
test/verify/test_acos.cpp
View file @
b73427c9
...
...
@@ -27,15 +27,20 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_acos
:
verify_program
<
test_acos
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_acos
:
verify_program
<
test_acos
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_t
ype
,
{
16
}};
migraphx
::
shape
s
{
DT
ype
,
{
16
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"acos"
),
x
);
return
p
;
}
};
template
struct
test_acos
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
template
struct
test_acos
<
migraphx
::
shape
::
half_type
>;
template
struct
test_acos
<
migraphx
::
shape
::
float_type
>;
test/verify/test_acosh.cpp
View file @
b73427c9
...
...
@@ -23,20 +23,23 @@
*/
#include "verify_program.hpp"
#include <migraphx/literal.hpp>
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_acosh
:
verify_program
<
test_acosh
>
template
<
typename
CType
>
struct
test_acosh
:
verify_program
<
test_acosh
<
CType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
16
}};
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
::
type_t
dtype
=
migraphx
::
shape
::
get_type
<
CType
>
();
migraphx
::
shape
s
{
dtype
,
{
16
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
min_val
=
mm
->
add_literal
(
1.1
f
);
auto
max_val
=
mm
->
add_literal
(
100.0
f
);
auto
min_val
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
dtype
},
{
1.1
f
}}
);
auto
max_val
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
dtype
},
{
100.0
f
}}
);
min_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
16
}}}),
min_val
);
max_val
=
...
...
@@ -46,3 +49,7 @@ struct test_acosh : verify_program<test_acosh>
return
p
;
}
};
template
struct
test_acosh
<
float
>;
template
struct
test_acosh
<
migraphx
::
half
>;
template
struct
test_acosh
<
migraphx
::
fp8
::
fp8e4m3fnuz
>;
test/verify/test_add.cpp
View file @
b73427c9
...
...
@@ -27,16 +27,21 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_add
:
verify_program
<
test_add
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_add
:
verify_program
<
test_add
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_t
ype
,
{
3
}};
migraphx
::
shape
s
{
DT
ype
,
{
8
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
y
=
mm
->
add_parameter
(
"y"
,
s
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
x
,
y
);
return
p
;
}
};
template
struct
test_add
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
template
struct
test_add
<
migraphx
::
shape
::
half_type
>;
template
struct
test_add
<
migraphx
::
shape
::
float_type
>;
Prev
1
…
4
5
6
7
8
9
10
11
12
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