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
4604f2e1
Commit
4604f2e1
authored
Nov 26, 2023
by
Umang Yadav
Browse files
add tests
parent
d473b802
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
24 deletions
+48
-24
test/verify/test_gemm_transposeb.cpp
test/verify/test_gemm_transposeb.cpp
+7
-3
test/verify/test_gemm_transposeb_ex.cpp
test/verify/test_gemm_transposeb_ex.cpp
+7
-4
test/verify/test_mul_dot_a.cpp
test/verify/test_mul_dot_a.cpp
+8
-5
test/verify/test_mul_dot_b.cpp
test/verify/test_mul_dot_b.cpp
+9
-5
test/verify/test_unbatched_gemm_1.cpp
test/verify/test_unbatched_gemm_1.cpp
+9
-4
test/verify/test_unbatched_gemm_2.cpp
test/verify/test_unbatched_gemm_2.cpp
+8
-3
No files found.
test/verify/test_gemm_transposeb.cpp
View file @
4604f2e1
...
...
@@ -27,16 +27,20 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_gemm_transposeb
:
verify_program
<
test_gemm_transposeb
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_gemm_transposeb
:
verify_program
<
test_gemm_transposeb
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
a
=
mm
->
add_parameter
(
"a"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_t
ype
,
{
4
,
5
}});
auto
b
=
mm
->
add_parameter
(
"b"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_t
ype
,
{
3
,
5
}});
auto
a
=
mm
->
add_parameter
(
"a"
,
migraphx
::
shape
{
DT
ype
,
{
4
,
5
}});
auto
b
=
mm
->
add_parameter
(
"b"
,
migraphx
::
shape
{
DT
ype
,
{
3
,
5
}});
auto
bt
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
b
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
a
,
bt
);
return
p
;
}
};
template
struct
test_gemm_transposeb
<
migraphx
::
shape
::
float_type
>;
template
struct
test_gemm_transposeb
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_gemm_transposeb_ex.cpp
View file @
4604f2e1
...
...
@@ -26,18 +26,21 @@
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_gemm_transposeb_ex
:
verify_program
<
test_gemm_transposeb_ex
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_gemm_transposeb_ex
:
verify_program
<
test_gemm_transposeb_ex
<
DType
>
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
a
=
mm
->
add_parameter
(
"a"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
4
,
5
}});
auto
b
=
mm
->
add_parameter
(
"b"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
3
,
5
}});
auto
a
=
mm
->
add_parameter
(
"a"
,
migraphx
::
shape
{
DT
ype
,
{
1
,
4
,
5
}});
auto
b
=
mm
->
add_parameter
(
"b"
,
migraphx
::
shape
{
DT
ype
,
{
1
,
3
,
5
}});
auto
bt
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
0
,
2
,
1
}}}),
b
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
a
,
bt
);
return
p
;
}
};
template
struct
test_gemm_transposeb_ex
<
migraphx
::
shape
::
float_type
>;
template
struct
test_gemm_transposeb_ex
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_mul_dot_a.cpp
View file @
4604f2e1
...
...
@@ -27,17 +27,17 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_mul_dot_a
:
verify_program
<
test_mul_dot_a
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_mul_dot_a
:
verify_program
<
test_mul_dot_a
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
as
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
256
,
32
}};
migraphx
::
shape
bs
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
32
,
128
}};
migraphx
::
shape
as
{
DT
ype
,
{
2
,
256
,
32
}};
migraphx
::
shape
bs
{
DT
ype
,
{
2
,
32
,
128
}};
auto
a
=
mm
->
add_parameter
(
"input"
,
as
);
auto
lit
=
mm
->
add_literal
(
migraphx
::
generate_literal
({
migraphx
::
shape
::
float_type
,
{
1
,
1
,
32
}}));
auto
lit
=
mm
->
add_literal
(
migraphx
::
generate_literal
({
DType
,
{
1
,
1
,
32
}}));
auto
litb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
as
.
lens
()}}),
lit
);
auto
mul
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
a
,
litb
);
...
...
@@ -47,3 +47,6 @@ struct test_mul_dot_a : verify_program<test_mul_dot_a>
return
p
;
}
};
template
struct
test_mul_dot_a
<
migraphx
::
shape
::
float_type
>;
template
struct
test_mul_dot_a
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_mul_dot_b.cpp
View file @
4604f2e1
...
...
@@ -27,17 +27,18 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_mul_dot_b
:
verify_program
<
test_mul_dot_b
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_mul_dot_b
:
verify_program
<
test_mul_dot_b
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
as
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
256
,
32
}};
migraphx
::
shape
bs
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
32
,
128
}};
migraphx
::
shape
as
{
DT
ype
,
{
2
,
256
,
32
}};
migraphx
::
shape
bs
{
DT
ype
,
{
2
,
32
,
128
}};
auto
b
=
mm
->
add_parameter
(
"input"
,
bs
);
auto
lit
=
mm
->
add_literal
(
migraphx
::
generate_literal
({
migraphx
::
shape
::
float_type
,
{
1
,
32
,
1
}}));
auto
lit
=
mm
->
add_literal
(
migraphx
::
generate_literal
({
DType
,
{
1
,
32
,
1
}}));
auto
litb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
bs
.
lens
()}}),
lit
);
auto
mul
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
b
,
litb
);
...
...
@@ -47,3 +48,6 @@ struct test_mul_dot_b : verify_program<test_mul_dot_b>
return
p
;
}
};
template
struct
test_mul_dot_b
<
migraphx
::
shape
::
float_type
>;
template
struct
test_mul_dot_b
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_unbatched_gemm_1.cpp
View file @
4604f2e1
...
...
@@ -27,15 +27,17 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.hpp>
struct
test_unbatched_gemm_1
:
verify_program
<
test_unbatched_gemm_1
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_unbatched_gemm_1
:
verify_program
<
test_unbatched_gemm_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
,
32
,
64
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
64
,
64
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
32
,
192
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
32
,
64
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
64
,
64
}};
migraphx
::
shape
m3_shape
{
DT
ype
,
{
2
,
32
,
192
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_literal
(
migraphx
::
generate_literal
(
m2_shape
));
l2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
2
,
64
,
64
}}}),
...
...
@@ -56,3 +58,6 @@ struct test_unbatched_gemm_1 : verify_program<test_unbatched_gemm_1>
return
p
;
}
};
template
struct
test_unbatched_gemm_1
<
migraphx
::
shape
::
float_type
>;
template
struct
test_unbatched_gemm_1
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_unbatched_gemm_2.cpp
View file @
4604f2e1
...
...
@@ -27,14 +27,16 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.hpp>
struct
test_unbatched_gemm_2
:
verify_program
<
test_unbatched_gemm_2
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_unbatched_gemm_2
:
verify_program
<
test_unbatched_gemm_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
,
{
4
,
32
,
64
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
64
,
64
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
4
,
32
,
64
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
64
,
64
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_literal
(
migraphx
::
generate_literal
(
m2_shape
));
l2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
4
,
64
,
64
}}}),
...
...
@@ -44,3 +46,6 @@ struct test_unbatched_gemm_2 : verify_program<test_unbatched_gemm_2>
return
p
;
}
};
template
struct
test_unbatched_gemm_2
<
migraphx
::
shape
::
float_type
>;
template
struct
test_unbatched_gemm_2
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
Prev
1
2
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