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
bbd4e0c3
Commit
bbd4e0c3
authored
Mar 06, 2019
by
Shucai Xiao
Browse files
clang format
parent
837304f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
44 deletions
+50
-44
src/targets/cpu/gemm.cpp
src/targets/cpu/gemm.cpp
+1
-1
test/cpu_ops_test.cpp
test/cpu_ops_test.cpp
+45
-39
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+4
-4
No files found.
src/targets/cpu/gemm.cpp
View file @
bbd4e0c3
...
@@ -55,7 +55,7 @@ void migemm_impl(tensor_view<T> cmat,
...
@@ -55,7 +55,7 @@ void migemm_impl(tensor_view<T> cmat,
visit_mat
(
amat
,
[
&
](
const
auto
&
a
)
{
visit_mat
(
amat
,
[
&
](
const
auto
&
a
)
{
visit_mat
(
bmat
,
[
&
](
const
auto
&
b
)
{
visit_mat
(
bmat
,
[
&
](
const
auto
&
b
)
{
auto
c
=
make_mat
(
cmat
);
auto
c
=
make_mat
(
cmat
);
c
=
beta
*
c
;
c
=
beta
*
c
;
if
(
alpha
!=
0.0
)
if
(
alpha
!=
0.0
)
{
{
...
...
test/cpu_ops_test.cpp
View file @
bbd4e0c3
...
@@ -1047,27 +1047,28 @@ TEST_CASE(gemm_mutli_dim_2_beta0)
...
@@ -1047,27 +1047,28 @@ TEST_CASE(gemm_mutli_dim_2_beta0)
-
0.69359678
,
-
0.26334436
,
1.56292796
,
-
0.33629175
,
-
1.72693469
,
-
0.69359678
,
-
0.26334436
,
1.56292796
,
-
0.33629175
,
-
1.72693469
,
0.41435494
,
1.52136843
,
-
0.40699791
,
-
1.59839430
};
0.41435494
,
1.52136843
,
-
0.40699791
,
-
1.59839430
};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
}};
std
::
vector
<
float
>
m3
=
{
0.18208394
,
-
0.49276402
,
std
::
vector
<
float
>
m3
=
{
0.18208394
,
0.87189133
,
-
0.49276402
,
0.75150114
,
0.87189133
,
-
0.55909610
,
0.75150114
,
1.00521735
,
-
0.55909610
,
-
0.95536130
,
1.00521735
,
2.27996211
,
-
0.95536130
,
0.06239879
,
2.27996211
,
0.74700068
,
0.06239879
,
-
0.01570983
,
0.74700068
,
-
0.85920856
,
-
0.01570983
,
-
0.59070835
,
-
0.85920856
,
-
1.70729902
,
-
0.59070835
,
0.40245487
,
-
1.70729902
,
1.80182751
};
0.40245487
,
1.80182751
};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
float_type
,
{
2
,
2
,
4
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
float_type
,
{
2
,
2
,
4
}};
auto
l1
=
p
.
add_literal
(
migraphx
::
literal
{
m1_shape
,
m1
});
auto
l1
=
p
.
add_literal
(
migraphx
::
literal
{
m1_shape
,
m1
});
auto
l2
=
p
.
add_literal
(
migraphx
::
literal
{
m2_shape
,
m2
});
auto
l2
=
p
.
add_literal
(
migraphx
::
literal
{
m2_shape
,
m2
});
auto
l3
=
p
.
add_literal
(
migraphx
::
literal
{
m3_shape
,
m3
});
auto
l3
=
p
.
add_literal
(
migraphx
::
literal
{
m3_shape
,
m3
});
float
alpha
=
1.0
f
;
float
alpha
=
1.0
f
;
float
beta
=
0.0
f
;
float
beta
=
0.0
f
;
p
.
add_instruction
(
migraphx
::
op
::
dot
{
alpha
,
beta
},
l1
,
l2
,
l3
);
p
.
add_instruction
(
migraphx
::
op
::
dot
{
alpha
,
beta
},
l1
,
l2
,
l3
);
p
.
compile
(
migraphx
::
cpu
::
target
{});
p
.
compile
(
migraphx
::
cpu
::
target
{});
auto
result
=
p
.
eval
({});
auto
result
=
p
.
eval
({});
...
@@ -1097,33 +1098,38 @@ TEST_CASE(gemm_mutli_dim_2_beta0)
...
@@ -1097,33 +1098,38 @@ TEST_CASE(gemm_mutli_dim_2_beta0)
TEST_CASE
(
gemm_beta_0
)
TEST_CASE
(
gemm_beta_0
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
std
::
vector
<
float
>
m1
=
{
-
0.76234141
,
std
::
vector
<
float
>
m1
=
{
0.01368910
,
-
0.76234141
,
0.01368910
,
-
0.86343423
,
-
0.99465282
,
0.76133268
,
0.96507140
};
-
0.86343423
,
-
0.99465282
,
0.76133268
,
0.96507140
};
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
3
}};
migraphx
::
shape
m1_shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
3
}};
std
::
vector
<
float
>
m2
=
{
-
0.15933632
,
-
0.69594712
,
-
0.06198966
,
-
1.23905184
,
-
0.83672704
,
std
::
vector
<
float
>
m2
=
{
-
0.15933632
,
-
1.06971832
,
-
0.12272917
,
1.07094116
,
-
0.08346820
,
1.16820693
,
-
0.69594712
,
-
0.95700874
,
0.24059691
};
-
0.06198966
,
-
1.23905184
,
-
0.83672704
,
-
1.06971832
,
-
0.12272917
,
1.07094116
,
-
0.08346820
,
1.16820693
,
-
0.95700874
,
0.24059691
};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
4
}};
migraphx
::
shape
m2_shape
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
4
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
4
}};
migraphx
::
shape
m3_shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
4
}};
std
::
vector
<
float
>
m3
=
{
0.18208394
,
std
::
vector
<
float
>
m3
=
{
0.18208394
,
-
0.49276402
,
-
0.49276402
,
0.87189133
,
0.87189133
,
0.75150114
,
0.75150114
,
-
0.55909610
,
-
0.55909610
,
1.00521735
,
1.00521735
,
-
0.95536130
,
-
0.95536130
,
2.27996211
};
2.27996211
};
auto
l1
=
p
.
add_literal
(
migraphx
::
literal
{
m1_shape
,
m1
});
auto
l1
=
p
.
add_literal
(
migraphx
::
literal
{
m1_shape
,
m1
});
auto
l2
=
p
.
add_literal
(
migraphx
::
literal
{
m2_shape
,
m2
});
auto
l2
=
p
.
add_literal
(
migraphx
::
literal
{
m2_shape
,
m2
});
auto
l3
=
p
.
add_literal
(
migraphx
::
literal
{
m3_shape
,
m3
});
auto
l3
=
p
.
add_literal
(
migraphx
::
literal
{
m3_shape
,
m3
});
float
alpha
=
1.0
f
;
float
alpha
=
1.0
f
;
float
beta
=
0.0
f
;
float
beta
=
0.0
f
;
p
.
add_instruction
(
migraphx
::
op
::
dot
{
alpha
,
beta
},
l1
,
l2
,
l3
);
p
.
add_instruction
(
migraphx
::
op
::
dot
{
alpha
,
beta
},
l1
,
l2
,
l3
);
p
.
compile
(
migraphx
::
cpu
::
target
{});
p
.
compile
(
migraphx
::
cpu
::
target
{});
auto
result
=
p
.
eval
({});
auto
result
=
p
.
eval
({});
...
...
test/gpu/miopen.cpp
View file @
bbd4e0c3
...
@@ -913,9 +913,9 @@ struct gemm_mutli_3args_beta0
...
@@ -913,9 +913,9 @@ struct gemm_mutli_3args_beta0
auto
l1
=
p
.
add_parameter
(
"1"
,
m1_shape
);
auto
l1
=
p
.
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
p
.
add_parameter
(
"2"
,
m2_shape
);
auto
l2
=
p
.
add_parameter
(
"2"
,
m2_shape
);
auto
l3
=
p
.
add_parameter
(
"3"
,
m3_shape
);
auto
l3
=
p
.
add_parameter
(
"3"
,
m3_shape
);
float
alpha
=
1.0
f
;
float
alpha
=
1.0
f
;
float
beta
=
0.0
f
;
float
beta
=
0.0
f
;
p
.
add_instruction
(
migraphx
::
op
::
dot
{
alpha
,
beta
},
l1
,
l2
,
l3
);
p
.
add_instruction
(
migraphx
::
op
::
dot
{
alpha
,
beta
},
l1
,
l2
,
l3
);
return
p
;
return
p
;
...
@@ -933,9 +933,9 @@ struct gemm_mutli_3args_alpha0
...
@@ -933,9 +933,9 @@ struct gemm_mutli_3args_alpha0
auto
l1
=
p
.
add_parameter
(
"1"
,
m1_shape
);
auto
l1
=
p
.
add_parameter
(
"1"
,
m1_shape
);
auto
l2
=
p
.
add_parameter
(
"2"
,
m2_shape
);
auto
l2
=
p
.
add_parameter
(
"2"
,
m2_shape
);
auto
l3
=
p
.
add_parameter
(
"3"
,
m3_shape
);
auto
l3
=
p
.
add_parameter
(
"3"
,
m3_shape
);
float
alpha
=
0.0
f
;
float
alpha
=
0.0
f
;
float
beta
=
1.0
f
;
float
beta
=
1.0
f
;
p
.
add_instruction
(
migraphx
::
op
::
dot
{
alpha
,
beta
},
l1
,
l2
,
l3
);
p
.
add_instruction
(
migraphx
::
op
::
dot
{
alpha
,
beta
},
l1
,
l2
,
l3
);
return
p
;
return
p
;
...
...
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