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
647d7908
Commit
647d7908
authored
Aug 04, 2018
by
Paul
Browse files
Add missing header
parent
238bfadd
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
107 additions
and
38 deletions
+107
-38
src/include/migraph/type_name.hpp
src/include/migraph/type_name.hpp
+44
-0
src/targets/cpu/gemm.cpp
src/targets/cpu/gemm.cpp
+3
-7
test/cpu_ops_test.cpp
test/cpu_ops_test.cpp
+29
-29
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+3
-2
test/type_name.cpp
test/type_name.cpp
+28
-0
No files found.
src/include/migraph/type_name.hpp
0 → 100644
View file @
647d7908
#ifndef MIGRAPH_GUARD_RTGLIB_TYPE_NAME_HPP
#define MIGRAPH_GUARD_RTGLIB_TYPE_NAME_HPP
#include <string>
namespace
migraph
{
template
<
class
PrivateMigraphTypeNameProbe
>
const
std
::
string
&
get_type_name
()
{
static
std
::
string
name
;
if
(
name
.
empty
())
{
#ifdef _MSC_VER
name
=
typeid
(
PrivateMigraphTypeNameProbe
).
name
();
name
=
name
.
substr
(
7
);
#else
const
char
parameter_name
[]
=
"PrivateMigraphTypeNameProbe ="
;
name
=
__PRETTY_FUNCTION__
;
auto
begin
=
name
.
find
(
parameter_name
)
+
sizeof
(
parameter_name
);
#if(defined(__GNUC__) && !defined(__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7)
auto
length
=
name
.
find_last_of
(
","
)
-
begin
;
#else
auto
length
=
name
.
find_first_of
(
"];"
,
begin
)
-
begin
;
#endif
name
=
name
.
substr
(
begin
,
length
);
#endif
}
return
name
;
}
template
<
class
T
>
const
std
::
string
&
get_type_name
(
const
T
&
)
{
return
migraph
::
get_type_name
<
T
>
();
}
}
// namespace migraph
#endif
src/targets/cpu/gemm.cpp
View file @
647d7908
...
@@ -72,13 +72,9 @@ void migemm_impl(tensor_view<T> cmat,
...
@@ -72,13 +72,9 @@ void migemm_impl(tensor_view<T> cmat,
assert
(
m
==
amat
.
get_shape
().
lens
()[
0
]);
assert
(
m
==
amat
.
get_shape
().
lens
()[
0
]);
assert
(
n
==
bmat
.
get_shape
().
lens
()[
1
]);
assert
(
n
==
bmat
.
get_shape
().
lens
()[
1
]);
dfor
(
m
,
n
)([
&
](
auto
ii
,
auto
jj
)
dfor
(
m
,
n
)([
&
](
auto
ii
,
auto
jj
)
{
{
double
s
=
cmat
(
ii
,
jj
)
*
beta
;
double
s
=
cmat
(
ii
,
jj
)
*
beta
;
dfor
(
k
)([
&
](
auto
kk
)
dfor
(
k
)([
&
](
auto
kk
)
{
s
+=
amat
(
ii
,
kk
)
*
bmat
(
kk
,
jj
);
});
{
s
+=
amat
(
ii
,
kk
)
*
bmat
(
kk
,
jj
);
});
cmat
(
ii
,
jj
)
=
alpha
*
s
;
cmat
(
ii
,
jj
)
=
alpha
*
s
;
});
});
}
}
...
...
test/cpu_ops_test.cpp
View file @
647d7908
...
@@ -242,7 +242,7 @@ void reshape_test()
...
@@ -242,7 +242,7 @@ void reshape_test()
}
}
}
}
template
<
class
T
>
template
<
class
T
>
void
gemm_test
()
void
gemm_test
()
{
{
migraph
::
program
p
;
migraph
::
program
p
;
...
...
test/gpu/miopen.cpp
View file @
647d7908
...
@@ -50,7 +50,8 @@ void verify_program()
...
@@ -50,7 +50,8 @@ void verify_program()
auto
cpu_arg
=
run_cpu
<
V
>
();
auto
cpu_arg
=
run_cpu
<
V
>
();
auto
gpu_arg
=
run_gpu
<
V
>
();
auto
gpu_arg
=
run_gpu
<
V
>
();
visit_all
(
cpu_arg
,
gpu_arg
)([](
auto
cpu
,
auto
gpu
)
{
visit_all
(
cpu_arg
,
gpu_arg
)([](
auto
cpu
,
auto
gpu
)
{
if
(
not
test
::
verify_range
(
cpu
,
gpu
))
{
if
(
not
test
::
verify_range
(
cpu
,
gpu
))
{
std
::
cout
<<
"FAILED: "
<<
migraph
::
get_type_name
<
V
>
()
<<
std
::
endl
;
std
::
cout
<<
"FAILED: "
<<
migraph
::
get_type_name
<
V
>
()
<<
std
::
endl
;
}
}
});
});
...
...
test/type_name.cpp
0 → 100644
View file @
647d7908
#include <migraph/type_name.hpp>
#include "test.hpp"
struct
global_class
{
struct
inner_class
{
};
};
namespace
foo
{
struct
ns_class
{
struct
inner_class
{
};
};
}
// namespace foo
int
main
()
{
EXPECT
(
migraph
::
get_type_name
<
global_class
>
()
==
"global_class"
);
EXPECT
(
migraph
::
get_type_name
<
global_class
::
inner_class
>
()
==
"global_class::inner_class"
);
EXPECT
(
migraph
::
get_type_name
<
foo
::
ns_class
>
()
==
"foo::ns_class"
);
EXPECT
(
migraph
::
get_type_name
<
foo
::
ns_class
::
inner_class
>
()
==
"foo::ns_class::inner_class"
);
}
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