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
6d0b6bcf
Unverified
Commit
6d0b6bcf
authored
Dec 05, 2023
by
Umang Yadav
Committed by
GitHub
Dec 05, 2023
Browse files
Add FP8 rocblas gemm support (#2473)
parent
e3e00547
Changes
48
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
148 additions
and
203 deletions
+148
-203
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_add_broadcast_half.cpp
test/verify/gemm_add_broadcast_half.cpp
+0
-49
test/verify/gemm_add_half.cpp
test/verify/gemm_add_half.cpp
+0
-47
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
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/test_convert.cpp
test/verify/test_convert.cpp
+9
-9
test/verify/test_gemm.cpp
test/verify/test_gemm.cpp
+8
-4
test/verify/test_gemm_copy.cpp
test/verify/test_gemm_copy.cpp
+9
-4
test/verify/test_gemm_ex.cpp
test/verify/test_gemm_ex.cpp
+7
-3
test/verify/test_gemm_half.cpp
test/verify/test_gemm_half.cpp
+0
-41
test/verify/test_gemm_transposea.cpp
test/verify/test_gemm_transposea.cpp
+8
-3
No files found.
test/verify/gemm_2args_vv.cpp
View file @
6d0b6bcf
...
@@ -28,14 +28,15 @@
...
@@ -28,14 +28,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.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
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
8
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
8
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
8
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
8
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
ul1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"unsqueeze"
,
{{
"axes"
,
{
0
}}}),
l1
);
auto
ul1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"unsqueeze"
,
{{
"axes"
,
{
0
}}}),
l1
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
...
@@ -48,3 +49,7 @@ struct gemm_2args_vv : verify_program<gemm_2args_vv>
...
@@ -48,3 +49,7 @@ struct gemm_2args_vv : verify_program<gemm_2args_vv>
return
p
;
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 @
6d0b6bcf
...
@@ -27,15 +27,17 @@
...
@@ -27,15 +27,17 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.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
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
2
,
3
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
3
,
4
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
1
,
3
,
4
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
2
,
4
}};
migraphx
::
shape
m3_shape
{
DT
ype
,
{
1
,
2
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l3
=
mm
->
add_parameter
(
"3"
,
m3_shape
);
auto
l3
=
mm
->
add_parameter
(
"3"
,
m3_shape
);
...
@@ -45,3 +47,7 @@ struct gemm_add : verify_program<gemm_add>
...
@@ -45,3 +47,7 @@ struct gemm_add : verify_program<gemm_add>
return
p
;
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 @
6d0b6bcf
...
@@ -27,15 +27,17 @@
...
@@ -27,15 +27,17 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.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
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
2
,
3
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
3
,
4
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
1
,
3
,
4
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
1
,
4
}};
migraphx
::
shape
m3_shape
{
DT
ype
,
{
1
,
1
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l3
=
mm
->
add_parameter
(
"3"
,
m3_shape
);
auto
l3
=
mm
->
add_parameter
(
"3"
,
m3_shape
);
...
@@ -47,3 +49,7 @@ struct gemm_add_broadcast1 : verify_program<gemm_add_broadcast1>
...
@@ -47,3 +49,7 @@ struct gemm_add_broadcast1 : verify_program<gemm_add_broadcast1>
return
p
;
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 @
6d0b6bcf
...
@@ -27,15 +27,17 @@
...
@@ -27,15 +27,17 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.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
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
2
,
3
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
3
,
4
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
1
,
3
,
4
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
2
,
1
}};
migraphx
::
shape
m3_shape
{
DT
ype
,
{
1
,
2
,
1
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l3
=
mm
->
add_parameter
(
"3"
,
m3_shape
);
auto
l3
=
mm
->
add_parameter
(
"3"
,
m3_shape
);
...
@@ -47,3 +49,7 @@ struct gemm_add_broadcast2 : verify_program<gemm_add_broadcast2>
...
@@ -47,3 +49,7 @@ struct gemm_add_broadcast2 : verify_program<gemm_add_broadcast2>
return
p
;
return
p
;
}
}
};
};
template
struct
gemm_add_broadcast2
<
migraphx
::
shape
::
float_type
>;
// template struct gemm_add_broadcast2<migraphx::shape::half_type>;
template
struct
gemm_add_broadcast2
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/gemm_add_broadcast_half.cpp
deleted
100644 → 0
View file @
e3e00547
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 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 "verify_program.hpp"
#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
>
{
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
);
auto
dot
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
l1
,
l2
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
dot
,
l3_b
);
return
p
;
}
};
test/verify/gemm_add_half.cpp
deleted
100644 → 0
View file @
e3e00547
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 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 "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.hpp>
struct
gemm_add_half
:
verify_program
<
gemm_add_half
>
{
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
,
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
);
auto
dot
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
l1
,
l2
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
dot
,
l3
);
return
p
;
}
};
test/verify/gemm_literal.cpp
View file @
6d0b6bcf
...
@@ -27,14 +27,15 @@
...
@@ -27,14 +27,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.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
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
4
}};
migraphx
::
shape
a_shape
{
DT
ype
,
{
2
,
4
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_t
ype
,
{
4
,
4
}};
migraphx
::
shape
b_shape
{
DT
ype
,
{
4
,
4
}};
auto
a
=
mm
->
add_literal
(
migraphx
::
generate_literal
(
a_shape
));
auto
a
=
mm
->
add_literal
(
migraphx
::
generate_literal
(
a_shape
));
auto
b
=
mm
->
add_parameter
(
"b"
,
b_shape
);
auto
b
=
mm
->
add_parameter
(
"b"
,
b_shape
);
...
@@ -43,3 +44,7 @@ struct gemm_literal : verify_program<gemm_literal>
...
@@ -43,3 +44,7 @@ struct gemm_literal : verify_program<gemm_literal>
return
p
;
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 @
6d0b6bcf
...
@@ -28,15 +28,16 @@
...
@@ -28,15 +28,16 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.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
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
3
,
2
,
3
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
3
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
3
,
3
,
2
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
2
,
3
,
3
,
2
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
3
,
2
,
2
}};
migraphx
::
shape
m3_shape
{
DT
ype
,
{
2
,
3
,
2
,
2
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
...
@@ -47,3 +48,7 @@ struct gemm_multi_3args : verify_program<gemm_multi_3args>
...
@@ -47,3 +48,7 @@ struct gemm_multi_3args : verify_program<gemm_multi_3args>
return
p
;
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
>;
test/verify/gemm_multi_3args_alpha0.cpp
View file @
6d0b6bcf
...
@@ -27,15 +27,17 @@
...
@@ -27,15 +27,17 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.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
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
2
,
3
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
3
,
4
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
1
,
3
,
4
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
2
,
4
}};
migraphx
::
shape
m3_shape
{
DT
ype
,
{
1
,
2
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l3
=
mm
->
add_parameter
(
"3"
,
m3_shape
);
auto
l3
=
mm
->
add_parameter
(
"3"
,
m3_shape
);
...
@@ -46,3 +48,7 @@ struct gemm_multi_3args_alpha0 : verify_program<gemm_multi_3args_alpha0>
...
@@ -46,3 +48,7 @@ struct gemm_multi_3args_alpha0 : verify_program<gemm_multi_3args_alpha0>
return
p
;
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 @
6d0b6bcf
...
@@ -28,15 +28,16 @@
...
@@ -28,15 +28,16 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.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
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
2
,
3
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
1
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
3
,
4
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
1
,
3
,
4
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
2
,
4
}};
migraphx
::
shape
m3_shape
{
DT
ype
,
{
1
,
2
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l3
=
mm
->
add_parameter
(
"3"
,
m3_shape
);
auto
l3
=
mm
->
add_parameter
(
"3"
,
m3_shape
);
...
@@ -47,3 +48,7 @@ struct gemm_multi_3args_beta0 : verify_program<gemm_multi_3args_beta0>
...
@@ -47,3 +48,7 @@ struct gemm_multi_3args_beta0 : verify_program<gemm_multi_3args_beta0>
return
p
;
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 @
6d0b6bcf
...
@@ -28,15 +28,16 @@
...
@@ -28,15 +28,16 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.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
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
3
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
3
,
5
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
3
,
5
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
5
}};
migraphx
::
shape
m3_shape
{
DT
ype
,
{
2
,
5
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
...
@@ -47,3 +48,7 @@ struct gemm_multi_3args_c25 : verify_program<gemm_multi_3args_c25>
...
@@ -47,3 +48,7 @@ struct gemm_multi_3args_c25 : verify_program<gemm_multi_3args_c25>
return
p
;
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 @
6d0b6bcf
...
@@ -27,14 +27,15 @@
...
@@ -27,14 +27,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.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
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
2
,
3
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
3
,
4
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
2
,
3
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
...
@@ -43,3 +44,7 @@ struct gemm_multi_dim_2 : verify_program<gemm_multi_dim_2>
...
@@ -43,3 +44,7 @@ struct gemm_multi_dim_2 : verify_program<gemm_multi_dim_2>
return
p
;
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 @
6d0b6bcf
...
@@ -27,14 +27,15 @@
...
@@ -27,14 +27,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.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
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
3
,
2
,
3
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
3
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
3
,
3
,
2
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
2
,
3
,
3
,
2
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_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>
...
@@ -43,3 +44,7 @@ struct gemm_multi_dim_2_3 : verify_program<gemm_multi_dim_2_3>
return
p
;
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 @
6d0b6bcf
...
@@ -28,14 +28,15 @@
...
@@ -28,14 +28,15 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.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
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
2
,
3
}};
migraphx
::
shape
m1_shape
{
DT
ype
,
{
2
,
2
,
3
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_t
ype
,
{
3
,
2
,
4
}};
migraphx
::
shape
m2_shape
{
DT
ype
,
{
3
,
2
,
4
}};
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l1
=
mm
->
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
l2
=
mm
->
add_parameter
(
"2"
,
m2_shape
);
auto
tl2
=
auto
tl2
=
...
@@ -47,3 +48,7 @@ struct gemm_multi_transpose : verify_program<gemm_multi_transpose>
...
@@ -47,3 +48,7 @@ struct gemm_multi_transpose : verify_program<gemm_multi_transpose>
return
p
;
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/test_convert.cpp
View file @
6d0b6bcf
...
@@ -29,26 +29,26 @@
...
@@ -29,26 +29,26 @@
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
struct
test_convert
:
verify_program
<
test_convert
>
template
<
migraphx
::
shape
::
type_t
From
,
migraphx
::
shape
::
type_t
To
>
struct
test_convert
:
verify_program
<
test_convert
<
From
,
To
>>
{
{
migraphx
::
program
create_program
()
const
migraphx
::
program
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
sa
{
migraphx
::
shape
::
int8_type
,
{
8
,
24
}};
migraphx
::
shape
sa
{
From
,
{
8
,
24
}};
migraphx
::
shape
sb
{
migraphx
::
shape
::
int8_type
,
{
24
,
6
}};
migraphx
::
shape
sb
{
From
,
{
24
,
6
}};
auto
pa
=
mm
->
add_parameter
(
"a"
,
sa
);
auto
pa
=
mm
->
add_parameter
(
"a"
,
sa
);
auto
pb
=
mm
->
add_parameter
(
"b"
,
sb
);
auto
pb
=
mm
->
add_parameter
(
"b"
,
sb
);
auto
ia
=
mm
->
add_instruction
(
auto
ia
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"convert"
,
migraphx
::
make_op
(
"convert"
,
{{
"target_type"
,
migraphx
::
to_value
(
To
)}}),
pa
);
{{
"target_type"
,
migraphx
::
to_value
(
migraphx
::
shape
::
float_type
)}}),
pa
);
auto
ib
=
mm
->
add_instruction
(
auto
ib
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"convert"
,
migraphx
::
make_op
(
"convert"
,
{{
"target_type"
,
migraphx
::
to_value
(
To
)}}),
pb
);
{{
"target_type"
,
migraphx
::
to_value
(
migraphx
::
shape
::
float_type
)}}),
pb
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
ia
,
ib
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
ia
,
ib
);
return
p
;
return
p
;
};
};
};
};
template
struct
test_convert
<
migraphx
::
shape
::
int8_type
,
migraphx
::
shape
::
float_type
>;
template
struct
test_convert
<
migraphx
::
shape
::
fp8e4m3fnuz_type
,
migraphx
::
shape
::
float_type
>;
test/verify/test_gemm.cpp
View file @
6d0b6bcf
...
@@ -26,16 +26,20 @@
...
@@ -26,16 +26,20 @@
#include <migraphx/program.hpp>
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_gemm
:
verify_program
<
test_gemm
>
struct
test_gemm
:
verify_program
<
test_gemm
<
DType
>
>
{
{
migraphx
::
program
create_program
()
const
migraphx
::
program
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
auto
a
=
mm
->
add_parameter
(
"a"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_t
ype
,
{
4
,
5
}});
auto
a
=
mm
->
add_parameter
(
"a"
,
migraphx
::
shape
{
DT
ype
,
{
4
,
5
}});
auto
b
=
mm
->
add_parameter
(
"b"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_t
ype
,
{
5
,
3
}});
auto
b
=
mm
->
add_parameter
(
"b"
,
migraphx
::
shape
{
DT
ype
,
{
5
,
3
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
a
,
b
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
a
,
b
);
return
p
;
return
p
;
}
}
};
};
template
struct
test_gemm
<
migraphx
::
shape
::
float_type
>;
template
struct
test_gemm
<
migraphx
::
shape
::
half_type
>;
template
struct
test_gemm
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_gemm_copy.cpp
View file @
6d0b6bcf
...
@@ -28,15 +28,16 @@
...
@@ -28,15 +28,16 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
struct
test_gemm_copy
:
verify_program
<
test_gemm_copy
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_gemm_copy
:
verify_program
<
test_gemm_copy
<
DType
>>
{
{
migraphx
::
program
create_program
()
const
migraphx
::
program
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
sa
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
16
}};
migraphx
::
shape
sa
{
DT
ype
,
{
2
,
16
}};
migraphx
::
shape
sb
{
migraphx
::
shape
::
float_t
ype
,
{
16
,
8
}};
migraphx
::
shape
sb
{
DT
ype
,
{
16
,
8
}};
migraphx
::
shape
sc
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
8
}};
migraphx
::
shape
sc
{
DT
ype
,
{
1
,
8
}};
auto
pa
=
mm
->
add_parameter
(
"a"
,
sa
);
auto
pa
=
mm
->
add_parameter
(
"a"
,
sa
);
auto
pb
=
mm
->
add_parameter
(
"b"
,
sb
);
auto
pb
=
mm
->
add_parameter
(
"b"
,
sb
);
auto
pc
=
mm
->
add_parameter
(
"c"
,
sc
);
auto
pc
=
mm
->
add_parameter
(
"c"
,
sc
);
...
@@ -46,3 +47,7 @@ struct test_gemm_copy : verify_program<test_gemm_copy>
...
@@ -46,3 +47,7 @@ struct test_gemm_copy : verify_program<test_gemm_copy>
return
p
;
return
p
;
}
}
};
};
template
struct
test_gemm_copy
<
migraphx
::
shape
::
float_type
>;
template
struct
test_gemm_copy
<
migraphx
::
shape
::
half_type
>;
template
struct
test_gemm_copy
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_gemm_ex.cpp
View file @
6d0b6bcf
...
@@ -27,15 +27,19 @@
...
@@ -27,15 +27,19 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
struct
test_gemm_ex
:
verify_program
<
test_gemm_ex
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_gemm_ex
:
verify_program
<
test_gemm_ex
<
DType
>>
{
{
migraphx
::
program
create_program
()
const
migraphx
::
program
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
auto
a
=
mm
->
add_parameter
(
"a"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
1
,
4
,
5
}});
auto
a
=
mm
->
add_parameter
(
"a"
,
migraphx
::
shape
{
DT
ype
,
{
1
,
1
,
4
,
5
}});
auto
b
=
mm
->
add_parameter
(
"b"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_t
ype
,
{
1
,
1
,
5
,
3
}});
auto
b
=
mm
->
add_parameter
(
"b"
,
migraphx
::
shape
{
DT
ype
,
{
1
,
1
,
5
,
3
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
a
,
b
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
a
,
b
);
return
p
;
return
p
;
}
}
};
};
template
struct
test_gemm_ex
<
migraphx
::
shape
::
float_type
>;
template
struct
test_gemm_ex
<
migraphx
::
shape
::
half_type
>;
template
struct
test_gemm_ex
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_gemm_half.cpp
deleted
100644 → 0
View file @
e3e00547
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 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 "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_gemm_half
:
verify_program
<
test_gemm_half
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
a
=
mm
->
add_parameter
(
"a"
,
migraphx
::
shape
{
migraphx
::
shape
::
half_type
,
{
4
,
5
}});
auto
b
=
mm
->
add_parameter
(
"b"
,
migraphx
::
shape
{
migraphx
::
shape
::
half_type
,
{
5
,
3
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
a
,
b
);
return
p
;
}
};
test/verify/test_gemm_transposea.cpp
View file @
6d0b6bcf
...
@@ -27,16 +27,21 @@
...
@@ -27,16 +27,21 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
struct
test_gemm_transposea
:
verify_program
<
test_gemm_transposea
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_gemm_transposea
:
verify_program
<
test_gemm_transposea
<
DType
>>
{
{
migraphx
::
program
create_program
()
const
migraphx
::
program
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
auto
a
=
mm
->
add_parameter
(
"a"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_t
ype
,
{
5
,
4
}});
auto
a
=
mm
->
add_parameter
(
"a"
,
migraphx
::
shape
{
DT
ype
,
{
5
,
4
}});
auto
b
=
mm
->
add_parameter
(
"b"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_t
ype
,
{
5
,
3
}});
auto
b
=
mm
->
add_parameter
(
"b"
,
migraphx
::
shape
{
DT
ype
,
{
5
,
3
}});
auto
at
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
a
);
auto
at
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
a
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
at
,
b
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
at
,
b
);
return
p
;
return
p
;
}
}
};
};
template
struct
test_gemm_transposea
<
migraphx
::
shape
::
float_type
>;
template
struct
test_gemm_transposea
<
migraphx
::
shape
::
half_type
>;
template
struct
test_gemm_transposea
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
Prev
1
2
3
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