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
245 additions
and
59 deletions
+245
-59
test/simplify_algebra_test.cpp
test/simplify_algebra_test.cpp
+34
-0
test/simplify_qdq_test.cpp
test/simplify_qdq_test.cpp
+56
-1
test/verify/gemm_2args_bmv.cpp
test/verify/gemm_2args_bmv.cpp
+8
-3
test/verify/gemm_2args_mm_1.cpp
test/verify/gemm_2args_mm_1.cpp
+8
-3
test/verify/gemm_2args_mm_2.cpp
test/verify/gemm_2args_mm_2.cpp
+9
-3
test/verify/gemm_2args_mm_3.cpp
test/verify/gemm_2args_mm_3.cpp
+9
-3
test/verify/gemm_2args_mm_4.cpp
test/verify/gemm_2args_mm_4.cpp
+9
-3
test/verify/gemm_2args_mm_5.cpp
test/verify/gemm_2args_mm_5.cpp
+8
-3
test/verify/gemm_2args_mm_6.cpp
test/verify/gemm_2args_mm_6.cpp
+9
-3
test/verify/gemm_2args_mm_7.cpp
test/verify/gemm_2args_mm_7.cpp
+8
-3
test/verify/gemm_2args_mm_8.cpp
test/verify/gemm_2args_mm_8.cpp
+8
-3
test/verify/gemm_2args_mv.cpp
test/verify/gemm_2args_mv.cpp
+8
-3
test/verify/gemm_2args_vbm.cpp
test/verify/gemm_2args_vbm.cpp
+8
-3
test/verify/gemm_2args_vm.cpp
test/verify/gemm_2args_vm.cpp
+8
-3
test/verify/gemm_2args_vv.cpp
test/verify/gemm_2args_vv.cpp
+8
-3
test/verify/gemm_add.cpp
test/verify/gemm_add.cpp
+10
-4
test/verify/gemm_add_broadcast1.cpp
test/verify/gemm_add_broadcast1.cpp
+10
-4
test/verify/gemm_add_broadcast2.cpp
test/verify/gemm_add_broadcast2.cpp
+10
-4
test/verify/gemm_literal.cpp
test/verify/gemm_literal.cpp
+8
-3
test/verify/gemm_multi_3args.cpp
test/verify/gemm_multi_3args.cpp
+9
-4
No files found.
test/simplify_algebra_test.cpp
View file @
b73427c9
...
...
@@ -1017,6 +1017,40 @@ TEST_CASE(simplify_concat_add_relu_broadcast_same_axis)
EXPECT
(
m1
==
m2
);
}
TEST_CASE
(
concat_convert_fusion
)
{
auto
s
=
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
64
}};
migraphx
::
module
m1
;
{
auto
x
=
m1
.
add_parameter
(
"x"
,
s
);
auto
y
=
m1
.
add_parameter
(
"y"
,
s
);
auto
xh
=
m1
.
add_instruction
(
migraphx
::
make_op
(
"convert"
,
{{
"target_type"
,
migraphx
::
to_value
(
migraphx
::
shape
::
half_type
)}}),
x
);
auto
yh
=
m1
.
add_instruction
(
migraphx
::
make_op
(
"convert"
,
{{
"target_type"
,
migraphx
::
to_value
(
migraphx
::
shape
::
half_type
)}}),
y
);
auto
concat
=
m1
.
add_instruction
(
migraphx
::
make_op
(
"concat"
,
{{
"axis"
,
0
}}),
xh
,
yh
);
m1
.
add_instruction
(
pass_op
{},
concat
);
}
run_pass
(
m1
);
migraphx
::
module
m2
;
{
auto
x
=
m2
.
add_parameter
(
"x"
,
s
);
auto
y
=
m2
.
add_parameter
(
"y"
,
s
);
auto
concat
=
m2
.
add_instruction
(
migraphx
::
make_op
(
"concat"
,
{{
"axis"
,
0
}}),
x
,
y
);
auto
concath
=
m2
.
add_instruction
(
migraphx
::
make_op
(
"convert"
,
{{
"target_type"
,
migraphx
::
to_value
(
migraphx
::
shape
::
half_type
)}}),
concat
);
m2
.
add_instruction
(
pass_op
{},
concath
);
}
EXPECT
(
m1
==
m2
);
}
TEST_CASE
(
simplify_div_const
)
{
migraphx
::
module
m1
;
...
...
test/simplify_qdq_test.cpp
View file @
b73427c9
...
...
@@ -527,6 +527,62 @@ TEST_CASE(dot_add)
EXPECT
(
m1
==
m2
);
}
TEST_CASE
(
dot_add_multiple_dq_use
)
{
migraphx
::
shape
sh1
{
migraphx
::
shape
::
float_type
,
{
32
,
1
}};
migraphx
::
shape
sh2
{
migraphx
::
shape
::
float_type
,
{
32
,
32
}};
migraphx
::
module
m1
;
{
auto
t1
=
m1
.
add_parameter
(
"t1"
,
sh1
);
auto
t2
=
m1
.
add_parameter
(
"t2"
,
sh2
);
auto
scale
=
m1
.
add_literal
(
0.5
f
);
auto
zero
=
m1
.
add_literal
(
std
::
int8_t
{
0
});
auto
q1
=
add_quantize_op
(
m1
,
"quantizelinear"
,
t1
,
scale
,
zero
);
auto
d1
=
add_quantize_op
(
m1
,
"dequantizelinear"
,
q1
,
scale
,
zero
);
auto
d1_t
=
m1
.
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
d1
);
auto
d1_tmb
=
m1
.
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
32
,
32
}}}),
d1_t
);
auto
d1_tmbc
=
m1
.
add_instruction
(
migraphx
::
make_op
(
"contiguous"
),
d1_tmb
);
auto
q2
=
add_quantize_op
(
m1
,
"quantizelinear"
,
t2
,
scale
,
zero
);
auto
d2
=
add_quantize_op
(
m1
,
"dequantizelinear"
,
q2
,
scale
,
zero
);
auto
dot_1
=
m1
.
add_instruction
(
migraphx
::
make_op
(
"dot"
),
d1_tmbc
,
d2
);
auto
q3
=
add_quantize_op
(
m1
,
"quantizelinear"
,
dot_1
,
scale
,
zero
);
auto
d3
=
add_quantize_op
(
m1
,
"dequantizelinear"
,
q3
,
scale
,
zero
);
auto
dot_2
=
m1
.
add_instruction
(
migraphx
::
make_op
(
"dot"
),
d3
,
d1
);
auto
add
=
m1
.
add_instruction
(
migraphx
::
make_op
(
"add"
),
{
dot_2
,
d1
});
m1
.
add_return
({
add
});
}
migraphx
::
module
m2
;
{
auto
t1
=
m2
.
add_parameter
(
"t1"
,
sh1
);
auto
t2
=
m2
.
add_parameter
(
"t2"
,
sh2
);
auto
scale
=
m2
.
add_literal
(
0.5
f
);
auto
zero
=
m2
.
add_literal
(
std
::
int8_t
{
0
});
auto
q1
=
add_quantize_op
(
m2
,
"quantizelinear"
,
t1
,
scale
,
zero
);
auto
q1_t
=
m2
.
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
q1
);
auto
q1_tmb
=
m2
.
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
32
,
32
}}}),
q1_t
);
auto
q1_tmbc
=
m2
.
add_instruction
(
migraphx
::
make_op
(
"contiguous"
),
q1_tmb
);
auto
q2
=
add_quantize_op
(
m2
,
"quantizelinear"
,
t2
,
scale
,
zero
);
auto
dot_1
=
m2
.
add_instruction
(
migraphx
::
make_op
(
"quant_dot"
),
q1_tmbc
,
q2
);
auto
out_scale
=
add_scale_mul
(
m2
,
scale
,
scale
,
1
,
1
,
dot_1
->
get_shape
().
lens
());
auto
d3
=
add_quantize_op
(
m2
,
"dequantizelinear"
,
dot_1
,
out_scale
);
auto
d3_q
=
add_quantize_op
(
m2
,
"quantizelinear"
,
d3
,
scale
,
zero
);
auto
dot_2
=
m2
.
add_instruction
(
migraphx
::
make_op
(
"quant_dot"
),
d3_q
,
q1
);
auto
out_scale_2
=
add_scale_mul
(
m2
,
scale
,
scale
,
1
,
1
,
dot_2
->
get_shape
().
lens
());
auto
d4
=
add_quantize_op
(
m2
,
"dequantizelinear"
,
dot_2
,
out_scale_2
);
auto
add
=
m2
.
add_instruction
(
migraphx
::
make_op
(
"add"
),
d4
,
t1
);
m2
.
add_return
({
add
});
}
run_pass
(
m1
);
EXPECT
(
m1
==
m2
);
}
TEST_CASE
(
conv
)
{
migraphx
::
shape
s4
{
migraphx
::
shape
::
int8_type
,
{
1280
,
320
,
1
,
1
}};
...
...
@@ -919,7 +975,6 @@ TEST_CASE(mobilenet_snippet)
auto
mod1
=
create_module
();
auto
mod2
=
create_module
();
run_pass
(
mod2
);
auto
match_qdq
=
migraphx
::
match
::
name
(
"dequantizelinear"
)(
...
...
test/verify/gemm_2args_bmv.cpp
View file @
b73427c9
...
...
@@ -27,14 +27,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_2args_bmv
:
verify_program
<
gemm_2args_bmv
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_2args_bmv
:
verify_program
<
gemm_2args_bmv
<
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
,
3
,
5
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
5
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
3
,
3
,
5
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
5
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
ul2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"unsqueeze"
,
{{
"axes"
,
{
1
}}}),
l2
);
...
...
@@ -46,3 +47,7 @@ struct gemm_2args_bmv : verify_program<gemm_2args_bmv>
return
p
;
}
};
template
struct
gemm_2args_bmv
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_2args_bmv
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_2args_bmv
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_2args_mm_1.cpp
View file @
b73427c9
...
...
@@ -27,14 +27,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_2args_mm_1
:
verify_program
<
gemm_2args_mm_1
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_2args_mm_1
:
verify_program
<
gemm_2args_mm_1
<
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
,
{
1
,
3
,
4
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
1
,
3
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
bl2
=
...
...
@@ -45,3 +46,7 @@ struct gemm_2args_mm_1 : verify_program<gemm_2args_mm_1>
return
p
;
}
};
template
struct
gemm_2args_mm_1
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_2args_mm_1
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_2args_mm_1
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_2args_mm_2.cpp
View file @
b73427c9
...
...
@@ -24,17 +24,19 @@
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/shape.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_2args_mm_2
:
verify_program
<
gemm_2args_mm_2
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_2args_mm_2
:
verify_program
<
gemm_2args_mm_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
,
{
3
,
4
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
3
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
bl2
=
...
...
@@ -45,3 +47,7 @@ struct gemm_2args_mm_2 : verify_program<gemm_2args_mm_2>
return
p
;
}
};
template
struct
gemm_2args_mm_2
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_2args_mm_2
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_2args_mm_2
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_2args_mm_3.cpp
View file @
b73427c9
...
...
@@ -24,17 +24,19 @@
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/shape.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_2args_mm_3
:
verify_program
<
gemm_2args_mm_3
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_2args_mm_3
:
verify_program
<
gemm_2args_mm_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
,
{
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
3
,
3
,
4
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
3
,
3
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
bl1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
3
,
2
,
3
}}}),
l1
);
...
...
@@ -45,3 +47,7 @@ struct gemm_2args_mm_3 : verify_program<gemm_2args_mm_3>
return
p
;
}
};
template
struct
gemm_2args_mm_3
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_2args_mm_3
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_2args_mm_3
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_2args_mm_4.cpp
View file @
b73427c9
...
...
@@ -23,18 +23,20 @@
*/
#include "verify_program.hpp"
#include <migraphx/shape.hpp>
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_2args_mm_4
:
verify_program
<
gemm_2args_mm_4
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_2args_mm_4
:
verify_program
<
gemm_2args_mm_4
<
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
,
3
,
4
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
3
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
3
,
3
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
bl1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
3
,
2
,
3
}}}),
l1
);
...
...
@@ -45,3 +47,7 @@ struct gemm_2args_mm_4 : verify_program<gemm_2args_mm_4>
return
p
;
}
};
template
struct
gemm_2args_mm_4
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_2args_mm_4
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_2args_mm_4
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_2args_mm_5.cpp
View file @
b73427c9
...
...
@@ -27,14 +27,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_2args_mm_5
:
verify_program
<
gemm_2args_mm_5
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_2args_mm_5
:
verify_program
<
gemm_2args_mm_5
<
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
,
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
3
,
3
,
4
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
2
,
3
,
3
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
bl1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
2
,
3
,
2
,
3
}}}),
l1
);
...
...
@@ -45,3 +46,7 @@ struct gemm_2args_mm_5 : verify_program<gemm_2args_mm_5>
return
p
;
}
};
template
struct
gemm_2args_mm_5
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_2args_mm_5
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_2args_mm_5
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_2args_mm_6.cpp
View file @
b73427c9
...
...
@@ -27,14 +27,16 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_2args_mm_6
:
verify_program
<
gemm_2args_mm_6
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_2args_mm_6
:
verify_program
<
gemm_2args_mm_6
<
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
,
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
3
,
3
,
4
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
1
,
3
,
3
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
bl1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
2
,
3
,
2
,
3
}}}),
l1
);
...
...
@@ -47,3 +49,7 @@ struct gemm_2args_mm_6 : verify_program<gemm_2args_mm_6>
return
p
;
}
};
template
struct
gemm_2args_mm_6
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_2args_mm_6
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_2args_mm_6
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_2args_mm_7.cpp
View file @
b73427c9
...
...
@@ -27,14 +27,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_2args_mm_7
:
verify_program
<
gemm_2args_mm_7
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_2args_mm_7
:
verify_program
<
gemm_2args_mm_7
<
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
,
{
2
,
3
,
3
,
4
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
3
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
2
,
3
,
3
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
bl1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
2
,
3
,
2
,
3
}}}),
l1
);
...
...
@@ -45,3 +46,7 @@ struct gemm_2args_mm_7 : verify_program<gemm_2args_mm_7>
return
p
;
}
};
template
struct
gemm_2args_mm_7
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_2args_mm_7
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_2args_mm_7
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_2args_mm_8.cpp
View file @
b73427c9
...
...
@@ -27,14 +27,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_2args_mm_8
:
verify_program
<
gemm_2args_mm_8
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_2args_mm_8
:
verify_program
<
gemm_2args_mm_8
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
128
,
32
},
{
4096
,
1
,
128
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_t
ype
,
{
32
,
32
}};
migraphx
::
shape
a_shape
{
DT
ype
,
{
2
,
128
,
32
},
{
4096
,
1
,
128
}};
migraphx
::
shape
b_shape
{
DT
ype
,
{
32
,
32
}};
auto
a
=
mm
->
add_parameter
(
"a"
,
a_shape
);
auto
b
=
mm
->
add_parameter
(
"b"
,
b_shape
);
auto
bb
=
mm
->
add_instruction
(
...
...
@@ -45,3 +46,7 @@ struct gemm_2args_mm_8 : verify_program<gemm_2args_mm_8>
return
p
;
}
};
template
struct
gemm_2args_mm_8
<
migraphx
::
shape
::
float_type
>;
// template struct gemm_2args_mm_8<migraphx::shape::half_type>; // fails with CK, issue#2514
template
struct
gemm_2args_mm_8
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_2args_mv.cpp
View file @
b73427c9
...
...
@@ -27,14 +27,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_2args_mv
:
verify_program
<
gemm_2args_mv
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_2args_mv
:
verify_program
<
gemm_2args_mv
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
3
,
5
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
5
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
3
,
5
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
5
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
ul2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"unsqueeze"
,
{{
"axes"
,
{
1
}}}),
l2
);
...
...
@@ -44,3 +45,7 @@ struct gemm_2args_mv : verify_program<gemm_2args_mv>
return
p
;
}
};
template
struct
gemm_2args_mv
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_2args_mv
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_2args_mv
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_2args_vbm.cpp
View file @
b73427c9
...
...
@@ -27,14 +27,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_2args_vbm
:
verify_program
<
gemm_2args_vbm
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_2args_vbm
:
verify_program
<
gemm_2args_vbm
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
5
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
2
,
5
,
4
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
5
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
2
,
2
,
5
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
ul1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"unsqueeze"
,
{{
"axes"
,
{
0
}}}),
l1
);
auto
bul1
=
mm
->
add_instruction
(
...
...
@@ -48,3 +49,7 @@ struct gemm_2args_vbm : verify_program<gemm_2args_vbm>
return
p
;
}
};
template
struct
gemm_2args_vbm
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_2args_vbm
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_2args_vbm
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_2args_vm.cpp
View file @
b73427c9
...
...
@@ -27,14 +27,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_2args_vm
:
verify_program
<
gemm_2args_vm
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_2args_vm
:
verify_program
<
gemm_2args_vm
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
5
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
5
,
4
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
5
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
5
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
ul1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"unsqueeze"
,
{{
"axes"
,
{
0
}}}),
l1
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
...
...
@@ -45,3 +46,7 @@ struct gemm_2args_vm : verify_program<gemm_2args_vm>
return
p
;
}
};
template
struct
gemm_2args_vm
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_2args_vm
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_2args_vm
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_2args_vv.cpp
View file @
b73427c9
...
...
@@ -28,14 +28,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_2args_vv
:
verify_program
<
gemm_2args_vv
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_2args_vv
:
verify_program
<
gemm_2args_vv
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
8
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
8
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
8
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
8
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
ul1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"unsqueeze"
,
{{
"axes"
,
{
0
}}}),
l1
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
...
...
@@ -48,3 +49,7 @@ struct gemm_2args_vv : verify_program<gemm_2args_vv>
return
p
;
}
};
template
struct
gemm_2args_vv
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_2args_vv
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_2args_vv
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_add.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_add
:
verify_program
<
gemm_add
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_add
:
verify_program
<
gemm_add
<
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
);
...
...
@@ -45,3 +47,7 @@ struct gemm_add : verify_program<gemm_add>
return
p
;
}
};
template
struct
gemm_add
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_add
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_add
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_add_broadcast1.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_add_broadcast1
:
verify_program
<
gemm_add_broadcast1
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_add_broadcast1
:
verify_program
<
gemm_add_broadcast1
<
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
,
1
,
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
,
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
);
...
...
@@ -47,3 +49,7 @@ struct gemm_add_broadcast1 : verify_program<gemm_add_broadcast1>
return
p
;
}
};
template
struct
gemm_add_broadcast1
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_add_broadcast1
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_add_broadcast1
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_add_broadcast2.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_add_broadcast2
:
verify_program
<
gemm_add_broadcast2
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_add_broadcast2
:
verify_program
<
gemm_add_broadcast2
<
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
,
1
}};
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
,
1
}};
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 +49,7 @@ struct gemm_add_broadcast2 : verify_program<gemm_add_broadcast2>
return
p
;
}
};
template
struct
gemm_add_broadcast2
<
migraphx
::
shape
::
float_type
>;
// template struct gemm_add_broadcast2<migraphx::shape::half_type>; // fails with CK, issue#2514
template
struct
gemm_add_broadcast2
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_literal.cpp
View file @
b73427c9
...
...
@@ -27,14 +27,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_literal
:
verify_program
<
gemm_literal
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_literal
:
verify_program
<
gemm_literal
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
4
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_t
ype
,
{
4
,
4
}};
migraphx
::
shape
a_shape
{
DT
ype
,
{
2
,
4
}};
migraphx
::
shape
b_shape
{
DT
ype
,
{
4
,
4
}};
auto
a
=
mm
->
add_literal
(
migraphx
::
generate_literal
(
a_shape
));
auto
b
=
mm
->
add_parameter
(
"b"
,
b_shape
);
...
...
@@ -43,3 +44,7 @@ struct gemm_literal : verify_program<gemm_literal>
return
p
;
}
};
template
struct
gemm_literal
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_literal
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_literal
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_multi_3args.cpp
View file @
b73427c9
...
...
@@ -28,15 +28,16 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
gemm_multi_3args
:
verify_program
<
gemm_multi_3args
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
gemm_multi_3args
:
verify_program
<
gemm_multi_3args
<
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
m3_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
3
,
2
,
2
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
3
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
2
,
3
,
3
,
2
}};
migraphx
::
shape
m3_shape
{
DT
ype
,
{
2
,
3
,
2
,
2
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
...
...
@@ -47,3 +48,7 @@ struct gemm_multi_3args : verify_program<gemm_multi_3args>
return
p
;
}
};
template
struct
gemm_multi_3args
<
migraphx
::
shape
::
float_type
>;
template
struct
gemm_multi_3args
<
migraphx
::
shape
::
half_type
>;
template
struct
gemm_multi_3args
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
Prev
1
…
3
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