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
dd033c75
Commit
dd033c75
authored
Oct 18, 2021
by
Paul
Browse files
Merge branch 'develop' into mlir-c
parents
50f87a87
8829d6ab
Changes
109
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
117 additions
and
8 deletions
+117
-8
test/verify/quant_dot_3args_3.cpp
test/verify/quant_dot_3args_3.cpp
+2
-2
test/verify/quant_dot_3args_4.cpp
test/verify/quant_dot_3args_4.cpp
+2
-2
test/verify/quant_dot_3args_5.cpp
test/verify/quant_dot_3args_5.cpp
+2
-1
test/verify/test_gemm_copy.cpp
test/verify/test_gemm_copy.cpp
+4
-3
test/verify/test_layernorm.cpp
test/verify/test_layernorm.cpp
+17
-0
test/verify/test_multinomial.cpp
test/verify/test_multinomial.cpp
+37
-0
test/verify/test_nonzero.cpp
test/verify/test_nonzero.cpp
+20
-0
test/verify/test_nonzero_half.cpp
test/verify/test_nonzero_half.cpp
+20
-0
test/verify/test_reduce_op_large.cpp
test/verify/test_reduce_op_large.cpp
+13
-0
No files found.
test/verify/quant_dot_3args_3.cpp
View file @
dd033c75
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/apply_alpha_beta.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
...
...
@@ -19,8 +20,7 @@ struct quant_dot_3args_3 : verify_program<quant_dot_3args_3>
auto
tl2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
l2
);
auto
l3
=
mm
->
add_parameter
(
"c"
,
m3_shape
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"quant_dot"
,
{{
"alpha"
,
2
},
{
"beta"
,
3
}}),
l1
,
tl2
,
l3
);
migraphx
::
add_apply_alpha_beta
(
*
mm
,
{
l1
,
tl2
,
l3
},
migraphx
::
make_op
(
"quant_dot"
),
2
,
3
);
return
p
;
}
};
test/verify/quant_dot_3args_4.cpp
View file @
dd033c75
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/apply_alpha_beta.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
...
...
@@ -21,8 +22,7 @@ struct quant_dot_3args_4 : verify_program<quant_dot_3args_4>
auto
tl2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
l2
);
auto
l3
=
mm
->
add_parameter
(
"c"
,
m3_shape
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"quant_dot"
,
{{
"alpha"
,
3
},
{
"beta"
,
2
}}),
tl1
,
tl2
,
l3
);
migraphx
::
add_apply_alpha_beta
(
*
mm
,
{
tl1
,
tl2
,
l3
},
migraphx
::
make_op
(
"quant_dot"
),
3
,
2
);
return
p
;
}
};
test/verify/quant_dot_3args_5.cpp
View file @
dd033c75
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/apply_alpha_beta.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
...
...
@@ -19,7 +20,7 @@ struct quant_dot_3args_5 : verify_program<quant_dot_3args_5>
auto
l2
=
mm
->
add_parameter
(
"b"
,
m2_shape
);
auto
tl2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
1
,
0
}}}),
l2
);
m
m
->
add_instruction
(
migraphx
::
make_op
(
"quant_dot"
,
{{
"alpha"
,
3
},
{
"beta"
,
2
}}),
tl1
,
tl2
);
m
igraphx
::
add_apply_alpha_beta
(
*
mm
,
{
tl1
,
tl2
},
migraphx
::
make_op
(
"quant_dot"
),
3
);
return
p
;
}
};
test/verify/test_gemm_copy.cpp
View file @
dd033c75
#include <migraphx/apply_alpha_beta.hpp>
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
...
...
@@ -12,13 +13,13 @@ struct test_gemm_copy : verify_program<test_gemm_copy>
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
sa
{
migraphx
::
shape
::
float_type
,
{
2
,
16
}};
migraphx
::
shape
sb
{
migraphx
::
shape
::
float_type
,
{
16
,
8
}};
migraphx
::
shape
sc
{
migraphx
::
shape
::
float_type
,
{
2
,
8
}};
migraphx
::
shape
sc
{
migraphx
::
shape
::
float_type
,
{
1
,
8
}};
auto
pa
=
mm
->
add_parameter
(
"a"
,
sa
);
auto
pb
=
mm
->
add_parameter
(
"b"
,
sb
);
auto
pc
=
mm
->
add_parameter
(
"c"
,
sc
);
auto
dr
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dot"
),
pa
,
pb
,
pc
);
auto
dr
=
migraphx
::
add_apply_alpha_beta
(
*
mm
,
{
pa
,
pb
,
pc
},
migraphx
::
make_op
(
"dot"
),
1.0
f
,
1.0
f
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
dr
,
dr
);
return
p
;
}
};
test/verify/test_layernorm.cpp
View file @
dd033c75
...
...
@@ -81,3 +81,20 @@ struct test_layernorm_triadd : verify_program<test_layernorm_triadd>
return
p
;
}
};
struct
test_layernorm_triadd_large
:
verify_program
<
test_layernorm_triadd_large
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
std
::
vector
<
size_t
>
dims
=
{
1
,
384
,
1024
};
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
dims
});
auto
y
=
mm
->
add_parameter
(
"y"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
dims
});
auto
z
=
mm
->
add_parameter
(
"z"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
dims
});
auto
add1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
x
,
y
);
auto
add2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
add1
,
z
);
add_layernorm
(
*
mm
,
add2
,
dims
);
return
p
;
}
};
test/verify/test_multinomial.cpp
0 → 100644
View file @
dd033c75
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_multinomial
:
verify_program
<
test_multinomial
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
size_t
sample_size
=
10
;
size_t
batch_size
=
2
;
float
seed
=
0.0
f
;
std
::
mt19937
gen
(
seed
);
std
::
uniform_real_distribution
<>
dis
(
0.0
,
1.0
);
std
::
vector
<
float
>
rand_samples
(
batch_size
*
sample_size
);
std
::
generate
(
rand_samples
.
begin
(),
rand_samples
.
end
(),
[
&
]()
{
return
dis
(
gen
);
});
migraphx
::
shape
rs
{
migraphx
::
shape
::
float_type
,
{
batch_size
,
sample_size
}};
auto
rs_lit
=
mm
->
add_literal
(
migraphx
::
literal
{
rs
,
rand_samples
});
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
batch_size
,
5
}};
auto
input
=
mm
->
add_parameter
(
"input"
,
s
);
auto
maxes
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reduce_max"
,
{{
"axes"
,
{
1
}}}),
input
);
auto
mb_maxes
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
batch_size
,
5
}}}),
maxes
);
auto
cdf
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"sub"
),
input
,
mb_maxes
);
cdf
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"exp"
),
cdf
);
cdf
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"prefix_scan_sum"
,
{{
"axis"
,
1
},
{
"exclusive"
,
false
}}),
cdf
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"multinomial"
),
cdf
,
rs_lit
);
return
p
;
}
};
test/verify/test_nonzero.cpp
0 → 100644
View file @
dd033c75
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_nonzero
:
verify_program
<
test_nonzero
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
,
5
}};
auto
x
=
mm
->
add_parameter
(
"data"
,
s
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"nonzero"
),
x
);
mm
->
add_return
({
r
});
return
p
;
}
};
test/verify/test_nonzero_half.cpp
0 → 100644
View file @
dd033c75
#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
>
{
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
});
return
p
;
}
};
test/verify/test_reduce_op_large.cpp
View file @
dd033c75
...
...
@@ -27,3 +27,16 @@ template struct test_reduce_op_large<migraphx::op::reduce_mean, 1, migraphx::sha
template
struct
test_reduce_op_large
<
migraphx
::
op
::
reduce_min
,
1
,
migraphx
::
shape
::
float_type
>;
template
struct
test_reduce_op_large
<
migraphx
::
op
::
reduce_prod
,
2
,
migraphx
::
shape
::
float_type
>;
template
struct
test_reduce_op_large
<
migraphx
::
op
::
reduce_sum
,
1
,
migraphx
::
shape
::
float_type
>;
struct
test_reduce_mean
:
verify_program
<
test_reduce_mean
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
1
,
384
,
1024
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
mm
->
add_instruction
(
migraphx
::
op
::
reduce_mean
{{
1
}},
x
);
return
p
;
};
};
Prev
1
2
3
4
5
6
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