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
8d7a8a6c
Commit
8d7a8a6c
authored
Dec 06, 2023
by
Artur Wojcik
Browse files
Merge branch 'develop' into uif2-initial
parents
25b33431
a09dc502
Changes
203
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
248 additions
and
75 deletions
+248
-75
test/verify/test_reduce_op_small.cpp
test/verify/test_reduce_op_small.cpp
+21
-0
test/verify/test_reverse.cpp
test/verify/test_reverse.cpp
+7
-2
test/verify/test_rnn_sql_1.cpp
test/verify/test_rnn_sql_1.cpp
+11
-6
test/verify/test_roialign.cpp
test/verify/test_roialign.cpp
+12
-7
test/verify/test_rsqrt.cpp
test/verify/test_rsqrt.cpp
+14
-6
test/verify/test_scatter0.cpp
test/verify/test_scatter0.cpp
+8
-3
test/verify/test_scatternd.cpp
test/verify/test_scatternd.cpp
+9
-4
test/verify/test_scatternd_max.cpp
test/verify/test_scatternd_max.cpp
+16
-8
test/verify/test_scatternd_max_duplicate_idx.cpp
test/verify/test_scatternd_max_duplicate_idx.cpp
+17
-13
test/verify/test_scatternd_min.cpp
test/verify/test_scatternd_min.cpp
+17
-7
test/verify/test_scatternd_min_duplicate_idx.cpp
test/verify/test_scatternd_min_duplicate_idx.cpp
+51
-0
test/verify/test_sin.cpp
test/verify/test_sin.cpp
+7
-2
test/verify/test_sinh.cpp
test/verify/test_sinh.cpp
+7
-2
test/verify/test_softmax.cpp
test/verify/test_softmax.cpp
+4
-0
test/verify/test_sqrt.cpp
test/verify/test_sqrt.cpp
+7
-2
test/verify/test_tan.cpp
test/verify/test_tan.cpp
+7
-2
test/verify/test_tanh.cpp
test/verify/test_tanh.cpp
+7
-2
test/verify/test_topk_0.cpp
test/verify/test_topk_0.cpp
+7
-2
test/verify/test_unbatched_gemm_1.cpp
test/verify/test_unbatched_gemm_1.cpp
+10
-4
test/verify/test_unbatched_gemm_2.cpp
test/verify/test_unbatched_gemm_2.cpp
+9
-3
No files found.
test/verify/test_reduce_op_small.cpp
View file @
8d7a8a6c
...
...
@@ -46,13 +46,34 @@ struct test_reduce_op_small : verify_program<test_reduce_op_small<Op, Axis, T>>
};
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_sum
,
1
,
migraphx
::
shape
::
float_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_sum
,
3
,
migraphx
::
shape
::
float_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_sum
,
2
,
migraphx
::
shape
::
int32_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_mean
,
2
,
migraphx
::
shape
::
int32_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_max
,
2
,
migraphx
::
shape
::
int32_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_min
,
2
,
migraphx
::
shape
::
int32_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_sum
,
3
,
migraphx
::
shape
::
half_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_sum
,
2
,
migraphx
::
shape
::
half_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_mean
,
2
,
migraphx
::
shape
::
half_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_max
,
2
,
migraphx
::
shape
::
half_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_min
,
2
,
migraphx
::
shape
::
half_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_prod
,
-
2
,
migraphx
::
shape
::
half_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_sum
,
2
,
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_sum
,
3
,
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_mean
,
2
,
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_max
,
2
,
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_min
,
2
,
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
template
struct
test_reduce_op_small
<
migraphx
::
op
::
reduce_prod
,
-
2
,
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_reverse.cpp
View file @
8d7a8a6c
...
...
@@ -26,16 +26,21 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_reverse
:
verify_program
<
test_reverse
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_reverse
:
verify_program
<
test_reverse
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_t
ype
,
{
4
,
16
}};
migraphx
::
shape
s
{
DT
ype
,
{
4
,
16
}};
auto
a0
=
mm
->
add_parameter
(
"data"
,
s
);
std
::
vector
<
int64_t
>
axis
=
{
0
};
mm
->
add_instruction
(
migraphx
::
make_op
(
"reverse"
,
{{
"axes"
,
axis
}}),
a0
);
return
p
;
}
};
template
struct
test_reverse
<
migraphx
::
shape
::
float_type
>;
template
struct
test_reverse
<
migraphx
::
shape
::
half_type
>;
template
struct
test_reverse
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_rnn_sql_1.cpp
View file @
8d7a8a6c
...
...
@@ -31,7 +31,8 @@
#include <migraphx/op/common.hpp>
struct
test_rnn_sql_1
:
verify_program
<
test_rnn_sql_1
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_rnn_sql_1
:
verify_program
<
test_rnn_sql_1
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
...
...
@@ -44,12 +45,12 @@ struct test_rnn_sql_1 : verify_program<test_rnn_sql_1>
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
in_shape
{
migraphx
::
shape
::
float_t
ype
,
{
seq_len
,
batch_size
,
input_size
}};
migraphx
::
shape
w_shape
{
migraphx
::
shape
::
float_t
ype
,
{
num_dirct
,
hidden_size
,
input_size
}};
migraphx
::
shape
r_shape
{
migraphx
::
shape
::
float_t
ype
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_t
ype
,
{
num_dirct
,
2
*
hidden_size
}};
migraphx
::
shape
in_shape
{
DT
ype
,
{
seq_len
,
batch_size
,
input_size
}};
migraphx
::
shape
w_shape
{
DT
ype
,
{
num_dirct
,
hidden_size
,
input_size
}};
migraphx
::
shape
r_shape
{
DT
ype
,
{
num_dirct
,
hidden_size
,
hidden_size
}};
migraphx
::
shape
b_shape
{
DT
ype
,
{
num_dirct
,
2
*
hidden_size
}};
migraphx
::
shape
s_shape
{
migraphx
::
shape
::
int32_type
,
{
batch_size
}};
migraphx
::
shape
ih_shape
{
migraphx
::
shape
::
float_t
ype
,
{
num_dirct
,
batch_size
,
hidden_size
}};
migraphx
::
shape
ih_shape
{
DT
ype
,
{
num_dirct
,
batch_size
,
hidden_size
}};
auto
seq
=
mm
->
add_parameter
(
"seq"
,
in_shape
);
auto
w
=
mm
->
add_parameter
(
"w"
,
w_shape
);
...
...
@@ -81,3 +82,7 @@ struct test_rnn_sql_1 : verify_program<test_rnn_sql_1>
}
std
::
string
section
()
const
{
return
"rnn"
;
}
};
template
struct
test_rnn_sql_1
<
migraphx
::
shape
::
float_type
>;
template
struct
test_rnn_sql_1
<
migraphx
::
shape
::
half_type
>;
template
struct
test_rnn_sql_1
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_roialign.cpp
View file @
8d7a8a6c
...
...
@@ -27,15 +27,16 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_roialign
:
verify_program
<
test_roialign
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_roialign
:
verify_program
<
test_roialign
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
x_s
{
migraphx
::
shape
::
float_t
ype
,
{
5
,
4
,
10
,
10
}};
migraphx
::
shape
x_s
{
DT
ype
,
{
5
,
4
,
10
,
10
}};
migraphx
::
shape
roi_s
{
migraphx
::
shape
::
float_t
ype
,
{
5
,
4
}};
migraphx
::
shape
roi_s
{
DT
ype
,
{
5
,
4
}};
migraphx
::
shape
ind_s
{
migraphx
::
shape
::
int64_type
,
{
5
}};
std
::
vector
<
int64_t
>
ind_vec
=
{
0
,
2
,
3
,
4
,
1
};
...
...
@@ -44,10 +45,10 @@ struct test_roialign : verify_program<test_roialign>
auto
roi
=
mm
->
add_parameter
(
"roi"
,
roi_s
);
auto
ind
=
mm
->
add_literal
(
migraphx
::
literal
(
ind_s
,
ind_vec
));
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"roialign"
,
{{
"spatial_scale"
,
1.0
},
{
"output_height"
,
5
},
{
"output_width"
,
5
},
{
"sampling_ratio"
,
2
}}),
{{
"spatial_scale"
,
1.0
},
{
"output_height"
,
5
},
{
"output_width"
,
5
},
{
"sampling_ratio"
,
2
}}),
x
,
roi
,
ind
);
...
...
@@ -56,3 +57,7 @@ struct test_roialign : verify_program<test_roialign>
return
p
;
}
};
template
struct
test_roialign
<
migraphx
::
shape
::
float_type
>;
template
struct
test_roialign
<
migraphx
::
shape
::
half_type
>;
template
struct
test_roialign
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_rsqrt.cpp
View file @
8d7a8a6c
...
...
@@ -23,22 +23,26 @@
*/
#include "verify_program.hpp"
#include <migraphx/float8.hpp>
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_rsqrt
:
verify_program
<
test_rsqrt
>
template
<
typename
CType
>
struct
test_rsqrt
:
verify_program
<
test_rsqrt
<
CType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
::
type_t
dtype
=
migraphx
::
shape
::
get_type
<
CType
>
();
std
::
vector
<
size_t
>
input_lens
{
1
,
3
,
16
,
16
};
migraphx
::
shape
s
{
migraphx
::
shape
::
float_
type
,
input_lens
};
migraphx
::
shape
s
{
d
type
,
input_lens
};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
min_val
=
mm
->
add_literal
(
1.0
f
);
auto
max_val
=
mm
->
add_literal
(
std
::
numeric_limits
<
float
>::
max
());
min_val
=
mm
->
add_instruction
(
auto
min_val
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
dtype
},
{
1.0
}});
auto
max_val
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
dtype
},
{
std
::
numeric_limits
<
CType
>::
max
()}});
min_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
input_lens
}}),
min_val
);
max_val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
input_lens
}}),
max_val
);
...
...
@@ -47,3 +51,7 @@ struct test_rsqrt : verify_program<test_rsqrt>
return
p
;
};
};
template
struct
test_rsqrt
<
float
>;
template
struct
test_rsqrt
<
migraphx
::
half
>;
template
struct
test_rsqrt
<
migraphx
::
fp8
::
fp8e4m3fnuz
>;
test/verify/test_scatter0.cpp
View file @
8d7a8a6c
...
...
@@ -27,16 +27,17 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_scatter0
:
verify_program
<
test_scatter0
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_scatter0
:
verify_program
<
test_scatter0
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
sd
{
migraphx
::
shape
::
float_t
ype
,
{
3
,
3
}};
migraphx
::
shape
sd
{
DT
ype
,
{
3
,
3
}};
migraphx
::
shape
si
{
migraphx
::
shape
::
int32_type
,
{
2
,
3
}};
std
::
vector
<
int
>
vi
=
{
1
,
0
,
2
,
0
,
2
,
1
};
migraphx
::
shape
su
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
3
}};
migraphx
::
shape
su
{
DT
ype
,
{
2
,
3
}};
auto
pd
=
mm
->
add_parameter
(
"data"
,
sd
);
auto
li
=
mm
->
add_literal
(
migraphx
::
literal
{
si
,
vi
});
...
...
@@ -47,3 +48,7 @@ struct test_scatter0 : verify_program<test_scatter0>
return
p
;
}
};
template
struct
test_scatter0
<
migraphx
::
shape
::
float_type
>;
template
struct
test_scatter0
<
migraphx
::
shape
::
half_type
>;
template
struct
test_scatter0
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_scatternd.cpp
View file @
8d7a8a6c
...
...
@@ -25,18 +25,19 @@
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/shape.hpp>
struct
test_scatternd
:
verify_program
<
test_scatternd
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_scatternd
:
verify_program
<
test_scatternd
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
dtype
=
migraphx
::
shape
::
float_type
;
auto
itype
=
migraphx
::
shape
::
int64_type
;
migraphx
::
shape
ds
{
dt
ype
,
{
1
}};
migraphx
::
shape
ds
{
DT
ype
,
{
1
}};
migraphx
::
shape
is
{
itype
,
{
4
,
1
}};
migraphx
::
shape
us
{
dt
ype
,
{
4
}};
migraphx
::
shape
us
{
DT
ype
,
{
4
}};
std
::
vector
<
int64_t
>
ind_vec
{
4
,
3
,
1
,
7
};
auto
ld
=
mm
->
add_literal
(
migraphx
::
literal
{
ds
,
{
1
}});
...
...
@@ -51,3 +52,7 @@ struct test_scatternd : verify_program<test_scatternd>
return
p
;
}
};
template
struct
test_scatternd
<
migraphx
::
shape
::
float_type
>;
template
struct
test_scatternd
<
migraphx
::
shape
::
half_type
>;
template
struct
test_scatternd
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_
nonzero_half
.cpp
→
test/verify/test_
scatternd_max
.cpp
View file @
8d7a8a6c
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-202
2
Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-202
3
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
...
...
@@ -21,22 +21,30 @@
* 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_
nonzero_half
:
verify_program
<
test_
nonzero_half
>
struct
test_
scatternd_max
:
verify_program
<
test_
scatternd_max
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
half_type
,
{
3
,
4
,
3
,
5
}};
auto
x
=
mm
->
add_parameter
(
"data"
,
s
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"nonzero"
),
x
);
mm
->
add_return
({
r
});
auto
*
mm
=
p
.
get_main_module
();
auto
dtype
=
migraphx
::
shape
::
float_type
;
auto
itype
=
migraphx
::
shape
::
int64_type
;
migraphx
::
shape
ds
{
dtype
,
{
8
}};
migraphx
::
shape
is
{
itype
,
{
4
,
1
}};
migraphx
::
shape
us
{
dtype
,
{
4
}};
std
::
vector
<
int64_t
>
ind_vec
{
4
,
3
,
1
,
7
};
auto
data
=
mm
->
add_parameter
(
"data"
,
ds
);
auto
indices
=
mm
->
add_literal
(
migraphx
::
literal
{
is
,
ind_vec
});
auto
updates
=
mm
->
add_parameter
(
"update"
,
us
);
auto
scatternd
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"scatternd_max"
),
data
,
indices
,
updates
);
mm
->
add_return
({
scatternd
});
return
p
;
}
...
...
test/verify/
gemm_add_half
.cpp
→
test/verify/
test_scatternd_max_duplicate_idx
.cpp
View file @
8d7a8a6c
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-202
2
Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-202
3
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
...
...
@@ -21,27 +21,31 @@
* 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
>
struct
test_scatternd_max_duplicate_idx
:
verify_program
<
test_scatternd_max_duplicate_idx
>
{
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
*
mm
=
p
.
get_main_module
();
auto
dtype
=
migraphx
::
shape
::
float_type
;
auto
itype
=
migraphx
::
shape
::
int64_type
;
migraphx
::
shape
ds
{
dtype
,
{
8
}};
migraphx
::
shape
is
{
itype
,
{
4
,
1
}};
migraphx
::
shape
us
{
dtype
,
{
4
}};
std
::
vector
<
int64_t
>
ind_vec
{
4
,
7
,
4
,
7
};
auto
data
=
mm
->
add_parameter
(
"data"
,
ds
);
auto
indices
=
mm
->
add_literal
(
migraphx
::
literal
{
is
,
ind_vec
});
auto
updates
=
mm
->
add_parameter
(
"update"
,
us
);
auto
scatternd
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"scatternd_max"
),
data
,
indices
,
updates
);
mm
->
add_return
({
scatternd
});
auto
dot
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
l1
,
l2
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
dot
,
l3
);
return
p
;
}
};
test/verify/test_
gemm_half
.cpp
→
test/verify/test_
scatternd_min
.cpp
View file @
8d7a8a6c
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-202
2
Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-202
3
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
...
...
@@ -21,21 +21,31 @@
* 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
>
struct
test_
scatternd_min
:
verify_program
<
test_
scatternd_min
>
{
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
);
auto
*
mm
=
p
.
get_main_module
();
auto
dtype
=
migraphx
::
shape
::
float_type
;
auto
itype
=
migraphx
::
shape
::
int64_type
;
migraphx
::
shape
ds
{
dtype
,
{
8
}};
migraphx
::
shape
is
{
itype
,
{
4
,
1
}};
migraphx
::
shape
us
{
dtype
,
{
4
}};
std
::
vector
<
int64_t
>
ind_vec
{
4
,
3
,
1
,
7
};
auto
data
=
mm
->
add_parameter
(
"data"
,
ds
);
auto
indices
=
mm
->
add_literal
(
migraphx
::
literal
{
is
,
ind_vec
});
auto
updates
=
mm
->
add_parameter
(
"update"
,
us
);
auto
scatternd
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"scatternd_min"
),
data
,
indices
,
updates
);
mm
->
add_return
({
scatternd
});
return
p
;
}
};
test/verify/test_scatternd_min_duplicate_idx.cpp
0 → 100644
View file @
8d7a8a6c
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_scatternd_min_duplicate_idx
:
verify_program
<
test_scatternd_min_duplicate_idx
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
dtype
=
migraphx
::
shape
::
float_type
;
auto
itype
=
migraphx
::
shape
::
int64_type
;
migraphx
::
shape
ds
{
dtype
,
{
8
}};
migraphx
::
shape
is
{
itype
,
{
4
,
1
}};
migraphx
::
shape
us
{
dtype
,
{
4
}};
std
::
vector
<
int64_t
>
ind_vec
{
4
,
7
,
4
,
7
};
auto
data
=
mm
->
add_parameter
(
"data"
,
ds
);
auto
indices
=
mm
->
add_literal
(
migraphx
::
literal
{
is
,
ind_vec
});
auto
updates
=
mm
->
add_parameter
(
"update"
,
us
);
auto
scatternd
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"scatternd_min"
),
data
,
indices
,
updates
);
mm
->
add_return
({
scatternd
});
return
p
;
}
};
test/verify/test_sin.cpp
View file @
8d7a8a6c
...
...
@@ -27,15 +27,20 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_sin
:
verify_program
<
test_sin
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_sin
:
verify_program
<
test_sin
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_t
ype
,
{
10
}};
migraphx
::
shape
s
{
DT
ype
,
{
10
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"sin"
),
x
);
return
p
;
}
};
template
struct
test_sin
<
migraphx
::
shape
::
float_type
>;
template
struct
test_sin
<
migraphx
::
shape
::
half_type
>;
template
struct
test_sin
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_sinh.cpp
View file @
8d7a8a6c
...
...
@@ -27,15 +27,20 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_sinh
:
verify_program
<
test_sinh
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_sinh
:
verify_program
<
test_sinh
<
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
(
"sinh"
),
x
);
return
p
;
}
};
template
struct
test_sinh
<
migraphx
::
shape
::
float_type
>;
template
struct
test_sinh
<
migraphx
::
shape
::
half_type
>;
template
struct
test_sinh
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_softmax.cpp
View file @
8d7a8a6c
...
...
@@ -48,3 +48,7 @@ template struct test_softmax<0, migraphx::shape::half_type>;
template
struct
test_softmax
<
1
,
migraphx
::
shape
::
half_type
>;
template
struct
test_softmax
<
2
,
migraphx
::
shape
::
half_type
>;
template
struct
test_softmax
<
3
,
migraphx
::
shape
::
half_type
>;
template
struct
test_softmax
<
0
,
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
template
struct
test_softmax
<
1
,
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
template
struct
test_softmax
<
2
,
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
template
struct
test_softmax
<
3
,
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_sqrt.cpp
View file @
8d7a8a6c
...
...
@@ -27,16 +27,21 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_sqrt
:
verify_program
<
test_sqrt
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_sqrt
:
verify_program
<
test_sqrt
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
3
,
4
,
6
}};
migraphx
::
shape
s
{
DT
ype
,
{
2
,
3
,
4
,
6
}};
auto
param
=
mm
->
add_parameter
(
"x"
,
s
);
auto
param_abs
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"abs"
),
param
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"sqrt"
),
param_abs
);
return
p
;
}
};
template
struct
test_sqrt
<
migraphx
::
shape
::
float_type
>;
template
struct
test_sqrt
<
migraphx
::
shape
::
half_type
>;
template
struct
test_sqrt
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_tan.cpp
View file @
8d7a8a6c
...
...
@@ -27,15 +27,20 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_tan
:
verify_program
<
test_tan
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_tan
:
verify_program
<
test_tan
<
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
(
"tan"
),
x
);
return
p
;
}
};
template
struct
test_tan
<
migraphx
::
shape
::
float_type
>;
template
struct
test_tan
<
migraphx
::
shape
::
half_type
>;
template
struct
test_tan
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_tanh.cpp
View file @
8d7a8a6c
...
...
@@ -27,14 +27,19 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_tanh
:
verify_program
<
test_tanh
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_tanh
:
verify_program
<
test_tanh
<
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
(
"tanh"
),
x
);
return
p
;
}
};
template
struct
test_tanh
<
migraphx
::
shape
::
float_type
>;
template
struct
test_tanh
<
migraphx
::
shape
::
half_type
>;
template
struct
test_tanh
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_topk_0.cpp
View file @
8d7a8a6c
...
...
@@ -27,13 +27,14 @@
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_topk_0
:
verify_program
<
test_topk_0
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_topk_0
:
verify_program
<
test_topk_0
<
DType
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_t
ype
,
{
3
,
5
}};
migraphx
::
shape
s
{
DT
ype
,
{
3
,
5
}};
auto
data
=
mm
->
add_parameter
(
"data"
,
s
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"topk"
,
{{
"axis"
,
1
},
{
"k"
,
4
},
{
"largest"
,
1
}}),
data
);
...
...
@@ -43,3 +44,7 @@ struct test_topk_0 : verify_program<test_topk_0>
return
p
;
}
};
template
struct
test_topk_0
<
migraphx
::
shape
::
float_type
>;
template
struct
test_topk_0
<
migraphx
::
shape
::
half_type
>;
template
struct
test_topk_0
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_unbatched_gemm_1.cpp
View file @
8d7a8a6c
...
...
@@ -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,7 @@ 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
::
half_type
>;
template
struct
test_unbatched_gemm_1
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_unbatched_gemm_2.cpp
View file @
8d7a8a6c
...
...
@@ -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,7 @@ 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
::
half_type
>;
template
struct
test_unbatched_gemm_2
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
Prev
1
…
6
7
8
9
10
11
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