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
1681e49a
Commit
1681e49a
authored
Mar 01, 2019
by
Shucai Xiao
Browse files
clang format
parent
5b4bb22c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
26 deletions
+27
-26
src/include/migraphx/operators.hpp
src/include/migraphx/operators.hpp
+10
-8
src/targets/cpu/gemm.cpp
src/targets/cpu/gemm.cpp
+2
-2
src/targets/cpu/lowering.cpp
src/targets/cpu/lowering.cpp
+5
-8
src/targets/gpu/gemm.cpp
src/targets/gpu/gemm.cpp
+5
-2
test/cpu_ops_test.cpp
test/cpu_ops_test.cpp
+5
-6
No files found.
src/include/migraphx/operators.hpp
View file @
1681e49a
...
@@ -834,7 +834,7 @@ struct dot
...
@@ -834,7 +834,7 @@ struct dot
MIGRAPHX_THROW
(
"DOT: number of matrices in stack are different in A and B"
);
MIGRAPHX_THROW
(
"DOT: number of matrices in stack are different in A and B"
);
}
}
if
(
inputs
.
size
()
==
3
)
if
(
inputs
.
size
()
==
3
)
{
{
check_shapes
{{
inputs
[
0
],
inputs
[
2
]},
*
this
}.
has
(
2
).
same_type
();
check_shapes
{{
inputs
[
0
],
inputs
[
2
]},
*
this
}.
has
(
2
).
same_type
();
const
shape
&
c
=
inputs
.
at
(
2
);
const
shape
&
c
=
inputs
.
at
(
2
);
...
@@ -849,19 +849,21 @@ struct dot
...
@@ -849,19 +849,21 @@ struct dot
if
(
a
.
lens
()[
dim_1
]
!=
b
.
lens
()[
dim_0
])
if
(
a
.
lens
()[
dim_1
]
!=
b
.
lens
()[
dim_0
])
MIGRAPHX_THROW
(
"DOT : inner dimensions do not match: {"
+
to_string_range
(
a
.
lens
())
+
MIGRAPHX_THROW
(
"DOT : inner dimensions do not match: {"
+
to_string_range
(
a
.
lens
())
+
"} x {"
+
to_string_range
(
b
.
lens
())
+
"}"
);
"} x {"
+
to_string_range
(
b
.
lens
())
+
"}"
);
if
(
inputs
.
size
()
==
3
)
if
(
inputs
.
size
()
==
3
)
{
{
const
shape
&
c
=
inputs
.
at
(
2
);
const
shape
&
c
=
inputs
.
at
(
2
);
if
(
a
.
lens
()[
dim_0
]
!=
c
.
lens
()[
dim_0
])
if
(
a
.
lens
()[
dim_0
]
!=
c
.
lens
()[
dim_0
])
{
{
MIGRAPHX_THROW
(
"DOT : matrix size does not match: A: {"
+
to_string_range
(
a
.
lens
())
+
MIGRAPHX_THROW
(
"DOT : matrix size does not match: A: {"
+
"}, C: {"
+
to_string_range
(
c
.
lens
())
+
"}"
);
to_string_range
(
a
.
lens
())
+
"}, C: {"
+
to_string_range
(
c
.
lens
())
+
"}"
);
}
}
if
(
b
.
lens
()[
dim_1
]
!=
c
.
lens
()[
dim_1
])
if
(
b
.
lens
()[
dim_1
]
!=
c
.
lens
()[
dim_1
])
{
{
MIGRAPHX_THROW
(
"DOT : matrix size does not match: B: {"
+
to_string_range
(
b
.
lens
())
+
MIGRAPHX_THROW
(
"DOT : matrix size does not match: B: {"
+
"}, C: {"
+
to_string_range
(
c
.
lens
())
+
"}"
);
to_string_range
(
b
.
lens
())
+
"}, C: {"
+
to_string_range
(
c
.
lens
())
+
"}"
);
}
}
}
}
...
...
src/targets/cpu/gemm.cpp
View file @
1681e49a
...
@@ -55,12 +55,12 @@ void migemm_impl(tensor_view<T> cmat,
...
@@ -55,12 +55,12 @@ 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
);
if
(
beta
!=
0.0
)
if
(
beta
!=
0.0
)
{
{
c
=
beta
*
c
;
c
=
beta
*
c
;
}
}
if
(
alpha
!=
0.0
)
if
(
alpha
!=
0.0
)
{
{
c
=
c
+
alpha
*
a
*
b
;
c
=
c
+
alpha
*
a
*
b
;
}
}
...
...
src/targets/cpu/lowering.cpp
View file @
1681e49a
...
@@ -375,19 +375,16 @@ struct cpu_gemm
...
@@ -375,19 +375,16 @@ struct cpu_gemm
{
{
argument
result
{
output_shape
};
argument
result
{
output_shape
};
// if there is a C input
// if there is a C input
if
(
args
.
size
()
==
3
)
if
(
args
.
size
()
==
3
)
{
{
result
.
visit
([
&
](
auto
output
)
{
result
.
visit
([
&
](
auto
output
)
{
args
[
2
].
visit
([
&
](
auto
input
)
{
args
[
2
].
visit
(
std
::
copy
(
input
.
begin
(),
input
.
end
(),
output
.
begin
());
[
&
](
auto
input
)
{
std
::
copy
(
input
.
begin
(),
input
.
end
(),
output
.
begin
());
});
});
});
});
}
}
else
else
{
{
result
.
visit
([
&
](
auto
output
)
{
result
.
visit
([
&
](
auto
output
)
{
std
::
fill
(
output
.
begin
(),
output
.
end
(),
0
);
});
std
::
fill
(
output
.
begin
(),
output
.
end
(),
0
);
});
}
}
migemm
(
result
,
args
[
0
],
args
[
1
],
op
.
alpha
,
op
.
beta
);
migemm
(
result
,
args
[
0
],
args
[
1
],
op
.
alpha
,
op
.
beta
);
...
...
src/targets/gpu/gemm.cpp
View file @
1681e49a
...
@@ -114,8 +114,11 @@ argument miopen_gemm::compute(context& ctx,
...
@@ -114,8 +114,11 @@ argument miopen_gemm::compute(context& ctx,
bool
is_3inputs
=
(
args
.
size
()
==
4
);
bool
is_3inputs
=
(
args
.
size
()
==
4
);
output_shape
.
visit_type
([
&
](
auto
as
)
{
output_shape
.
visit_type
([
&
](
auto
as
)
{
auto
to_pointer
=
[
&
](
auto
&&
arg
)
{
return
to_rocblas_type
(
as
.
from
(
arg
.
data
()));
};
auto
to_pointer
=
[
&
](
auto
&&
arg
)
{
return
to_rocblas_type
(
as
.
from
(
arg
.
data
()));
};
if
(
is_3inputs
)
if
(
is_3inputs
)
hipMemcpy
(
to_pointer
(
args
[
3
]),
to_pointer
(
args
[
2
]),
output_shape
.
bytes
(),
hipMemcpyDeviceToDevice
);
hipMemcpy
(
to_pointer
(
args
[
3
]),
to_pointer
(
args
[
2
]),
output_shape
.
bytes
(),
hipMemcpyDeviceToDevice
);
else
else
hipMemset
(
to_pointer
(
args
[
2
]),
0
,
output_shape
.
bytes
());
hipMemset
(
to_pointer
(
args
[
2
]),
0
,
output_shape
.
bytes
());
});
});
...
...
test/cpu_ops_test.cpp
View file @
1681e49a
...
@@ -1158,7 +1158,6 @@ TEST_CASE(gemm_mutli_3args)
...
@@ -1158,7 +1158,6 @@ TEST_CASE(gemm_mutli_3args)
EXPECT
(
migraphx
::
verify_range
(
m
,
m_res
));
EXPECT
(
migraphx
::
verify_range
(
m
,
m_res
));
}
}
TEST_CASE
(
maxpool_test
)
TEST_CASE
(
maxpool_test
)
{
{
migraphx
::
program
p
;
migraphx
::
program
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