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
0b217041
Commit
0b217041
authored
Nov 27, 2018
by
Paul
Browse files
Rename more things to migraphx
parent
53fd3f74
Changes
155
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
109 additions
and
109 deletions
+109
-109
src/include/migraphx/shape.hpp
src/include/migraphx/shape.hpp
+15
-15
src/include/migraphx/shape_for_each.hpp
src/include/migraphx/shape_for_each.hpp
+4
-4
src/include/migraphx/simplify_algebra.hpp
src/include/migraphx/simplify_algebra.hpp
+4
-4
src/include/migraphx/simplify_reshapes.hpp
src/include/migraphx/simplify_reshapes.hpp
+4
-4
src/include/migraphx/streamutils.hpp
src/include/migraphx/streamutils.hpp
+4
-4
src/include/migraphx/stringutils.hpp
src/include/migraphx/stringutils.hpp
+4
-4
src/include/migraphx/target.hpp
src/include/migraphx/target.hpp
+4
-4
src/include/migraphx/tensor_view.hpp
src/include/migraphx/tensor_view.hpp
+8
-8
src/include/migraphx/time.hpp
src/include/migraphx/time.hpp
+4
-4
src/include/migraphx/tracer.hpp
src/include/migraphx/tracer.hpp
+4
-4
src/include/migraphx/type_name.hpp
src/include/migraphx/type_name.hpp
+4
-4
src/include/migraphx/type_traits.hpp
src/include/migraphx/type_traits.hpp
+8
-8
src/include/migraphx/verify.hpp
src/include/migraphx/verify.hpp
+4
-4
src/include/migraphx/verify_args.hpp
src/include/migraphx/verify_args.hpp
+4
-4
src/instruction.cpp
src/instruction.cpp
+2
-2
src/onnx/CMakeLists.txt
src/onnx/CMakeLists.txt
+1
-1
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+7
-7
src/opt/common_header.hpp
src/opt/common_header.hpp
+10
-10
src/opt/memory_coloring.cpp
src/opt/memory_coloring.cpp
+3
-3
src/opt/memory_coloring_impl.cpp
src/opt/memory_coloring_impl.cpp
+11
-11
No files found.
src/include/migraphx/shape.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_SHAPE_HPP
#ifndef MIGRAPH
X
_GUARD_MIGRAPHLIB_SHAPE_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_SHAPE_HPP
#define MIGRAPH
X
_GUARD_MIGRAPHLIB_SHAPE_HPP
#include <vector>
#include <vector>
#include <cassert>
#include <cassert>
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
struct
shape_impl
;
struct
shape_impl
;
...
@@ -21,7 +21,7 @@ struct shape
...
@@ -21,7 +21,7 @@ struct shape
// Add new types here
// Add new types here
// clang-format off
// clang-format off
#define MIGRAPH_SHAPE_VISIT_TYPES(m) \
#define MIGRAPH
X
_SHAPE_VISIT_TYPES(m) \
m(half_type, half) \
m(half_type, half) \
m(float_type, float) \
m(float_type, float) \
m(double_type, double) \
m(double_type, double) \
...
@@ -35,22 +35,22 @@ struct shape
...
@@ -35,22 +35,22 @@ struct shape
m(uint64_type, uint64_t)
m(uint64_type, uint64_t)
// clang-format on
// clang-format on
#define MIGRAPH_SHAPE_ENUM_TYPES(x, t) x,
#define MIGRAPH
X
_SHAPE_ENUM_TYPES(x, t) x,
enum
type_t
enum
type_t
{
{
MIGRAPH_SHAPE_VISIT_TYPES
(
MIGRAPH_SHAPE_ENUM_TYPES
)
MIGRAPH
X
_SHAPE_VISIT_TYPES
(
MIGRAPH
X
_SHAPE_ENUM_TYPES
)
};
};
#undef MIGRAPH_SHAPE_ENUM_TYPES
#undef MIGRAPH
X
_SHAPE_ENUM_TYPES
template
<
class
T
,
class
=
void
>
template
<
class
T
,
class
=
void
>
struct
get_type
;
struct
get_type
;
#define MIGRAPH_SHAPE_GET_TYPE(x, t) \
#define MIGRAPH
X
_SHAPE_GET_TYPE(x, t) \
template <class T> \
template <class T> \
struct get_type<t, T> : std::integral_constant<type_t, x> \
struct get_type<t, T> : std::integral_constant<type_t, x> \
{ \
{ \
};
};
MIGRAPH_SHAPE_VISIT_TYPES
(
MIGRAPH_SHAPE_GET_TYPE
)
MIGRAPH
X
_SHAPE_VISIT_TYPES
(
MIGRAPH
X
_SHAPE_GET_TYPE
)
#undef MIGRAPH_SHAPE_GET_TYPE
#undef MIGRAPH
X
_SHAPE_GET_TYPE
template
<
class
T
>
template
<
class
T
>
struct
get_type
<
const
T
>
:
get_type
<
T
>
struct
get_type
<
const
T
>
:
get_type
<
T
>
...
@@ -148,12 +148,12 @@ struct shape
...
@@ -148,12 +148,12 @@ struct shape
{
{
switch
(
this
->
type
())
switch
(
this
->
type
())
{
{
#define MIGRAPH_SHAPE_VISITOR_CASE(x, t) \
#define MIGRAPH
X
_SHAPE_VISITOR_CASE(x, t) \
case x: v(as<t>()); return;
case x: v(as<t>()); return;
MIGRAPH_SHAPE_VISIT_TYPES
(
MIGRAPH_SHAPE_VISITOR_CASE
)
MIGRAPH
X
_SHAPE_VISIT_TYPES
(
MIGRAPH
X
_SHAPE_VISITOR_CASE
)
#undef MIGRAPH_SHAPE_VISITOR_CASE
#undef MIGRAPH
X
_SHAPE_VISITOR_CASE
}
}
MIGRAPH_THROW
(
"Unknown type"
);
MIGRAPH
X
_THROW
(
"Unknown type"
);
}
}
private:
private:
...
@@ -163,7 +163,7 @@ struct shape
...
@@ -163,7 +163,7 @@ struct shape
std
::
string
type_string
()
const
;
std
::
string
type_string
()
const
;
};
};
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/include/migraphx/shape_for_each.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_SHAPE_FOR_EACH_HPP
#ifndef MIGRAPH
X
_GUARD_MIGRAPHLIB_SHAPE_FOR_EACH_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_SHAPE_FOR_EACH_HPP
#define MIGRAPH
X
_GUARD_MIGRAPHLIB_SHAPE_FOR_EACH_HPP
#include <migraphx/shape.hpp>
#include <migraphx/shape.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#include <algorithm>
#include <algorithm>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
template
<
class
F
>
template
<
class
F
>
void
shape_for_each
(
const
migraphx
::
shape
&
s
,
F
f
)
void
shape_for_each
(
const
migraphx
::
shape
&
s
,
F
f
)
...
@@ -28,7 +28,7 @@ void shape_for_each(const migraphx::shape& s, F f)
...
@@ -28,7 +28,7 @@ void shape_for_each(const migraphx::shape& s, F f)
}
}
}
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/include/migraphx/simplify_algebra.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_RTGLIB_SIMPLIFY_ALGEBRA_HPP
#ifndef MIGRAPH
X
_GUARD_RTGLIB_SIMPLIFY_ALGEBRA_HPP
#define MIGRAPH_GUARD_RTGLIB_SIMPLIFY_ALGEBRA_HPP
#define MIGRAPH
X
_GUARD_RTGLIB_SIMPLIFY_ALGEBRA_HPP
#include <string>
#include <string>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
struct
program
;
struct
program
;
...
@@ -18,7 +18,7 @@ struct simplify_algebra
...
@@ -18,7 +18,7 @@ struct simplify_algebra
void
apply
(
program
&
p
)
const
;
void
apply
(
program
&
p
)
const
;
};
};
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/include/migraphx/simplify_reshapes.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_RTGLIB_SIMPLIFY_RESHAPES_HPP
#ifndef MIGRAPH
X
_GUARD_RTGLIB_SIMPLIFY_RESHAPES_HPP
#define MIGRAPH_GUARD_RTGLIB_SIMPLIFY_RESHAPES_HPP
#define MIGRAPH
X
_GUARD_RTGLIB_SIMPLIFY_RESHAPES_HPP
#include <string>
#include <string>
#include <migraphx/instruction_ref.hpp>
#include <migraphx/instruction_ref.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
struct
program
;
struct
program
;
...
@@ -19,7 +19,7 @@ struct simplify_reshapes
...
@@ -19,7 +19,7 @@ struct simplify_reshapes
void
apply
(
program
&
p
)
const
;
void
apply
(
program
&
p
)
const
;
};
};
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/include/migraphx/streamutils.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_STREAMUTILS_HPP
#ifndef MIGRAPH
X
_GUARD_STREAMUTILS_HPP
#define MIGRAPH_GUARD_STREAMUTILS_HPP
#define MIGRAPH
X
_GUARD_STREAMUTILS_HPP
#include <ostream>
#include <ostream>
#include <algorithm>
#include <algorithm>
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
template
<
class
T
>
template
<
class
T
>
struct
stream_range_container
struct
stream_range_container
...
@@ -56,7 +56,7 @@ void stream_write_value(std::ostream& os, const T& x)
...
@@ -56,7 +56,7 @@ void stream_write_value(std::ostream& os, const T& x)
detail
::
stream_write_value_impl
(
rank
<
1
>
{},
os
,
x
);
detail
::
stream_write_value_impl
(
rank
<
1
>
{},
os
,
x
);
}
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/include/migraphx/stringutils.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_STRINGUTILS_HPP
#ifndef MIGRAPH
X
_GUARD_MIGRAPHLIB_STRINGUTILS_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_STRINGUTILS_HPP
#define MIGRAPH
X
_GUARD_MIGRAPHLIB_STRINGUTILS_HPP
#include <algorithm>
#include <algorithm>
#include <numeric>
#include <numeric>
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
inline
std
::
string
inline
std
::
string
replace_string
(
std
::
string
subject
,
const
std
::
string
&
search
,
const
std
::
string
&
replace
)
replace_string
(
std
::
string
subject
,
const
std
::
string
&
search
,
const
std
::
string
&
replace
)
...
@@ -87,7 +87,7 @@ inline std::string to_string(const T& x)
...
@@ -87,7 +87,7 @@ inline std::string to_string(const T& x)
return
ss
.
str
();
return
ss
.
str
();
}
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/include/migraphx/target.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_TARGET_HPP
#ifndef MIGRAPH
X
_GUARD_MIGRAPHLIB_TARGET_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_TARGET_HPP
#define MIGRAPH
X
_GUARD_MIGRAPHLIB_TARGET_HPP
#include <cassert>
#include <cassert>
#include <string>
#include <string>
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
#ifdef DOXYGEN
#ifdef DOXYGEN
...
@@ -244,7 +244,7 @@ inline const ValueType& any_cast(const target& x)
...
@@ -244,7 +244,7 @@ inline const ValueType& any_cast(const target& x)
#endif
#endif
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/include/migraphx/tensor_view.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_TENSOR_VIEW_HPP
#ifndef MIGRAPH
X
_GUARD_TENSOR_VIEW_HPP
#define MIGRAPH_GUARD_TENSOR_VIEW_HPP
#define MIGRAPH
X
_GUARD_TENSOR_VIEW_HPP
#include <migraphx/shape.hpp>
#include <migraphx/shape.hpp>
#include <migraphx/float_equal.hpp>
#include <migraphx/float_equal.hpp>
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#include <utility>
#include <utility>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
template
<
class
T
>
template
<
class
T
>
struct
tensor_view
struct
tensor_view
...
@@ -29,7 +29,7 @@ struct tensor_view
...
@@ -29,7 +29,7 @@ struct tensor_view
const
T
*
data
()
const
{
return
this
->
m_data
;
}
const
T
*
data
()
const
{
return
this
->
m_data
;
}
template
<
class
...
Ts
,
MIGRAPH_REQUIRES
(
std
::
is_integral
<
Ts
>{}...)
>
template
<
class
...
Ts
,
MIGRAPH
X
_REQUIRES
(
std
::
is_integral
<
Ts
>{}...)
>
const
T
&
operator
()(
Ts
...
xs
)
const
const
T
&
operator
()(
Ts
...
xs
)
const
{
{
assert
(
std
::
vector
<
std
::
size_t
>
{
static_cast
<
std
::
size_t
>
(
xs
)...}
<
m_shape
.
lens
());
assert
(
std
::
vector
<
std
::
size_t
>
{
static_cast
<
std
::
size_t
>
(
xs
)...}
<
m_shape
.
lens
());
...
@@ -37,7 +37,7 @@ struct tensor_view
...
@@ -37,7 +37,7 @@ struct tensor_view
return
m_data
[
m_shape
.
index
({
static_cast
<
std
::
size_t
>
(
xs
)...})];
return
m_data
[
m_shape
.
index
({
static_cast
<
std
::
size_t
>
(
xs
)...})];
}
}
template
<
class
...
Ts
,
MIGRAPH_REQUIRES
(
std
::
is_integral
<
Ts
>{}...)
>
template
<
class
...
Ts
,
MIGRAPH
X
_REQUIRES
(
std
::
is_integral
<
Ts
>{}...)
>
T
&
operator
()(
Ts
...
xs
)
T
&
operator
()(
Ts
...
xs
)
{
{
assert
(
std
::
vector
<
std
::
size_t
>
{
static_cast
<
std
::
size_t
>
(
xs
)...}
<
m_shape
.
lens
());
assert
(
std
::
vector
<
std
::
size_t
>
{
static_cast
<
std
::
size_t
>
(
xs
)...}
<
m_shape
.
lens
());
...
@@ -45,13 +45,13 @@ struct tensor_view
...
@@ -45,13 +45,13 @@ struct tensor_view
return
m_data
[
m_shape
.
index
({
static_cast
<
std
::
size_t
>
(
xs
)...})];
return
m_data
[
m_shape
.
index
({
static_cast
<
std
::
size_t
>
(
xs
)...})];
}
}
template
<
class
Iterator
,
MIGRAPH_REQUIRES
(
not
std
::
is_integral
<
Iterator
>{})
>
template
<
class
Iterator
,
MIGRAPH
X
_REQUIRES
(
not
std
::
is_integral
<
Iterator
>{})
>
const
T
&
operator
()(
Iterator
start
,
Iterator
last
)
const
const
T
&
operator
()(
Iterator
start
,
Iterator
last
)
const
{
{
return
m_data
[
m_shape
.
index
(
start
,
last
)];
return
m_data
[
m_shape
.
index
(
start
,
last
)];
}
}
template
<
class
Iterator
,
MIGRAPH_REQUIRES
(
not
std
::
is_integral
<
Iterator
>{})
>
template
<
class
Iterator
,
MIGRAPH
X
_REQUIRES
(
not
std
::
is_integral
<
Iterator
>{})
>
T
&
operator
()(
Iterator
start
,
Iterator
last
)
T
&
operator
()(
Iterator
start
,
Iterator
last
)
{
{
return
m_data
[
m_shape
.
index
(
start
,
last
)];
return
m_data
[
m_shape
.
index
(
start
,
last
)];
...
@@ -169,7 +169,7 @@ tensor_view<T> make_view(shape s, T* data)
...
@@ -169,7 +169,7 @@ tensor_view<T> make_view(shape s, T* data)
return
{
s
,
data
};
return
{
s
,
data
};
}
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/include/migraphx/time.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_RTGLIB_TIME_HPP
#ifndef MIGRAPH
X
_GUARD_RTGLIB_TIME_HPP
#define MIGRAPH_GUARD_RTGLIB_TIME_HPP
#define MIGRAPH
X
_GUARD_RTGLIB_TIME_HPP
#include <chrono>
#include <chrono>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
template
<
class
Duration
,
class
F
>
template
<
class
Duration
,
class
F
>
auto
time
(
F
f
)
auto
time
(
F
f
)
...
@@ -16,7 +16,7 @@ auto time(F f)
...
@@ -16,7 +16,7 @@ auto time(F f)
return
std
::
chrono
::
duration_cast
<
Duration
>
(
finish
-
start
).
count
();
return
std
::
chrono
::
duration_cast
<
Duration
>
(
finish
-
start
).
count
();
}
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/include/migraphx/tracer.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_RTGLIB_TRACER_HPP
#ifndef MIGRAPH
X
_GUARD_RTGLIB_TRACER_HPP
#define MIGRAPH_GUARD_RTGLIB_TRACER_HPP
#define MIGRAPH
X
_GUARD_RTGLIB_TRACER_HPP
#include <ostream>
#include <ostream>
#include <migraphx/functional.hpp>
#include <migraphx/functional.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
struct
tracer
struct
tracer
{
{
...
@@ -30,7 +30,7 @@ struct tracer
...
@@ -30,7 +30,7 @@ struct tracer
std
::
ostream
*
os
=
nullptr
;
std
::
ostream
*
os
=
nullptr
;
};
};
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/include/migraphx/type_name.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_RTGLIB_TYPE_NAME_HPP
#ifndef MIGRAPH
X
_GUARD_RTGLIB_TYPE_NAME_HPP
#define MIGRAPH_GUARD_RTGLIB_TYPE_NAME_HPP
#define MIGRAPH
X
_GUARD_RTGLIB_TYPE_NAME_HPP
#include <string>
#include <string>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
template
<
class
PrivateMigraphTypeNameProbe
>
template
<
class
PrivateMigraphTypeNameProbe
>
const
std
::
string
&
get_type_name
()
const
std
::
string
&
get_type_name
()
...
@@ -41,7 +41,7 @@ const std::string& get_type_name(const T&)
...
@@ -41,7 +41,7 @@ const std::string& get_type_name(const T&)
return
migraphx
::
get_type_name
<
T
>
();
return
migraphx
::
get_type_name
<
T
>
();
}
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/include/migraphx/type_traits.hpp
View file @
0b217041
...
@@ -5,17 +5,17 @@
...
@@ -5,17 +5,17 @@
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
==============================================================================*/
#ifndef MIGRAPH_GUARD_RTGLIB_TYPE_TRAITS_HPP
#ifndef MIGRAPH
X
_GUARD_RTGLIB_TYPE_TRAITS_HPP
#define MIGRAPH_GUARD_RTGLIB_TYPE_TRAITS_HPP
#define MIGRAPH
X
_GUARD_RTGLIB_TYPE_TRAITS_HPP
#include <type_traits>
#include <type_traits>
#include <migraphx/half.hpp>
#include <migraphx/half.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
#define MIGRAPH_DETAIL_EXTEND_TRAIT_FOR(trait, T) \
#define MIGRAPH
X
_DETAIL_EXTEND_TRAIT_FOR(trait, T) \
template <class X> \
template <class X> \
struct trait : std::trait<X> \
struct trait : std::trait<X> \
{ \
{ \
...
@@ -26,11 +26,11 @@ inline namespace MIGRAPH_INLINE_NS {
...
@@ -26,11 +26,11 @@ inline namespace MIGRAPH_INLINE_NS {
{ \
{ \
};
};
MIGRAPH_DETAIL_EXTEND_TRAIT_FOR
(
is_floating_point
,
half
)
MIGRAPH
X
_DETAIL_EXTEND_TRAIT_FOR
(
is_floating_point
,
half
)
MIGRAPH_DETAIL_EXTEND_TRAIT_FOR
(
is_signed
,
half
)
MIGRAPH
X
_DETAIL_EXTEND_TRAIT_FOR
(
is_signed
,
half
)
MIGRAPH_DETAIL_EXTEND_TRAIT_FOR
(
is_arithmetic
,
half
)
MIGRAPH
X
_DETAIL_EXTEND_TRAIT_FOR
(
is_arithmetic
,
half
)
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/include/migraphx/verify.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_VERIFY_HPP
#ifndef MIGRAPH
X
_GUARD_VERIFY_HPP
#define MIGRAPH_GUARD_VERIFY_HPP
#define MIGRAPH
X
_GUARD_VERIFY_HPP
#include <algorithm>
#include <algorithm>
#include <cmath>
#include <cmath>
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
// Compute the value of a range
// Compute the value of a range
template
<
class
R
>
template
<
class
R
>
...
@@ -173,6 +173,6 @@ bool verify_range(R1&& r1, R2&& r2, double tolerance = 80, double* out_error = n
...
@@ -173,6 +173,6 @@ bool verify_range(R1&& r1, R2&& r2, double tolerance = 80, double* out_error = n
return
error
<=
threshold
;
return
error
<=
threshold
;
}
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/include/migraphx/verify_args.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_RTGLIB_VERIFY_ARGS_HPP
#ifndef MIGRAPH
X
_GUARD_RTGLIB_VERIFY_ARGS_HPP
#define MIGRAPH_GUARD_RTGLIB_VERIFY_ARGS_HPP
#define MIGRAPH
X
_GUARD_RTGLIB_VERIFY_ARGS_HPP
#include <migraphx/verify.hpp>
#include <migraphx/verify.hpp>
#include <migraphx/argument.hpp>
#include <migraphx/argument.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
inline
bool
verify_args
(
const
std
::
string
&
name
,
inline
bool
verify_args
(
const
std
::
string
&
name
,
const
argument
&
cpu_arg
,
const
argument
&
cpu_arg
,
...
@@ -84,7 +84,7 @@ inline bool verify_args(const std::string& name,
...
@@ -84,7 +84,7 @@ inline bool verify_args(const std::string& name,
return
passed
;
return
passed
;
}
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/instruction.cpp
View file @
0b217041
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#include <migraphx/erase.hpp>
#include <migraphx/erase.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
instruction
::
instruction
(
operation
o
,
shape
r
,
std
::
vector
<
instruction_ref
>
args
)
instruction
::
instruction
(
operation
o
,
shape
r
,
std
::
vector
<
instruction_ref
>
args
)
:
op
(
std
::
move
(
o
)),
result
(
std
::
move
(
r
)),
arguments
(
std
::
move
(
args
))
:
op
(
std
::
move
(
o
)),
result
(
std
::
move
(
r
)),
arguments
(
std
::
move
(
args
))
...
@@ -183,5 +183,5 @@ shape compute_shape(const operation& op, const std::vector<instruction_ref>& arg
...
@@ -183,5 +183,5 @@ shape compute_shape(const operation& op, const std::vector<instruction_ref>& arg
return
op
.
compute_shape
(
compute_shapes
(
args
));
return
op
.
compute_shape
(
compute_shapes
(
args
));
}
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
src/onnx/CMakeLists.txt
View file @
0b217041
...
@@ -22,7 +22,7 @@ rocm_clang_tidy_check(read_onnx)
...
@@ -22,7 +22,7 @@ rocm_clang_tidy_check(read_onnx)
target_link_libraries
(
read_onnx migraphx_onnx
)
target_link_libraries
(
read_onnx migraphx_onnx
)
if
(
MIGRAPH_ENABLE_GPU
)
if
(
MIGRAPH
X
_ENABLE_GPU
)
add_executable
(
mnist mnist.cpp
)
add_executable
(
mnist mnist.cpp
)
rocm_clang_tidy_check
(
mnist
)
rocm_clang_tidy_check
(
mnist
)
target_link_libraries
(
mnist migraphx_cpu migraphx_gpu migraphx_onnx
)
target_link_libraries
(
mnist migraphx_cpu migraphx_gpu migraphx_onnx
)
...
...
src/onnx/onnx.cpp
View file @
0b217041
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
struct
unknown
struct
unknown
{
{
std
::
string
op
;
std
::
string
op
;
...
@@ -99,7 +99,7 @@ struct onnx_parser
...
@@ -99,7 +99,7 @@ struct onnx_parser
{
{
ops
.
emplace
(
name
,
[
this
,
x
](
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
{
ops
.
emplace
(
name
,
[
this
,
x
](
attribute_map
attributes
,
std
::
vector
<
instruction_ref
>
args
)
{
if
(
args
.
size
()
!=
2
)
if
(
args
.
size
()
!=
2
)
MIGRAPH_THROW
(
"binary operators should have 2 operands"
);
MIGRAPH
X
_THROW
(
"binary operators should have 2 operands"
);
if
(
contains
(
attributes
,
"broadcast"
))
if
(
contains
(
attributes
,
"broadcast"
))
{
{
uint64_t
broadcasted
=
parse_value
(
attributes
.
at
(
"broadcast"
)).
at
<
uint64_t
>
();
uint64_t
broadcasted
=
parse_value
(
attributes
.
at
(
"broadcast"
)).
at
<
uint64_t
>
();
...
@@ -476,7 +476,7 @@ struct onnx_parser
...
@@ -476,7 +476,7 @@ struct onnx_parser
void
parse_node
(
const
std
::
string
&
name
)
void
parse_node
(
const
std
::
string
&
name
)
{
{
if
(
name
.
empty
())
if
(
name
.
empty
())
MIGRAPH_THROW
(
"Onnx node must have a name"
);
MIGRAPH
X
_THROW
(
"Onnx node must have a name"
);
if
(
instructions
.
count
(
name
)
==
0
)
if
(
instructions
.
count
(
name
)
==
0
)
{
{
auto
&&
node
=
nodes
.
at
(
name
);
auto
&&
node
=
nodes
.
at
(
name
);
...
@@ -566,7 +566,7 @@ struct onnx_parser
...
@@ -566,7 +566,7 @@ struct onnx_parser
case
onnx
::
AttributeProto
::
TENSORS
:
return
{};
case
onnx
::
AttributeProto
::
TENSORS
:
return
{};
case
onnx
::
AttributeProto
::
GRAPHS
:
return
{};
case
onnx
::
AttributeProto
::
GRAPHS
:
return
{};
}
}
MIGRAPH_THROW
(
"Invalid attribute type"
);
MIGRAPH
X
_THROW
(
"Invalid attribute type"
);
}
}
static
literal
parse_tensor
(
const
onnx
::
TensorProto
&
t
)
static
literal
parse_tensor
(
const
onnx
::
TensorProto
&
t
)
...
@@ -594,7 +594,7 @@ struct onnx_parser
...
@@ -594,7 +594,7 @@ struct onnx_parser
case
onnx
::
TensorProto
::
COMPLEX64
:
throw
std
::
runtime_error
(
""
);
case
onnx
::
TensorProto
::
COMPLEX64
:
throw
std
::
runtime_error
(
""
);
case
onnx
::
TensorProto
::
COMPLEX128
:
throw
std
::
runtime_error
(
""
);
case
onnx
::
TensorProto
::
COMPLEX128
:
throw
std
::
runtime_error
(
""
);
}
}
MIGRAPH_THROW
(
"Invalid tensor type"
);
MIGRAPH
X
_THROW
(
"Invalid tensor type"
);
}
}
switch
(
t
.
data_type
())
switch
(
t
.
data_type
())
{
{
...
@@ -625,7 +625,7 @@ struct onnx_parser
...
@@ -625,7 +625,7 @@ struct onnx_parser
case
onnx
::
TensorProto
::
COMPLEX64
:
throw
std
::
runtime_error
(
""
);
case
onnx
::
TensorProto
::
COMPLEX64
:
throw
std
::
runtime_error
(
""
);
case
onnx
::
TensorProto
::
COMPLEX128
:
throw
std
::
runtime_error
(
""
);
case
onnx
::
TensorProto
::
COMPLEX128
:
throw
std
::
runtime_error
(
""
);
}
}
MIGRAPH_THROW
(
"Invalid tensor type"
);
MIGRAPH
X
_THROW
(
"Invalid tensor type"
);
}
}
static
shape
parse_type
(
const
onnx
::
TypeProto
&
t
)
static
shape
parse_type
(
const
onnx
::
TypeProto
&
t
)
...
@@ -694,5 +694,5 @@ program parse_onnx(const std::string& name)
...
@@ -694,5 +694,5 @@ program parse_onnx(const std::string& name)
return
std
::
move
(
parser
.
prog
);
return
std
::
move
(
parser
.
prog
);
}
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
src/opt/common_header.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_RTGLIB_COMMON_HEADER_HPP
#ifndef MIGRAPH
X
_GUARD_RTGLIB_COMMON_HEADER_HPP
#define MIGRAPH_GUARD_RTGLIB_COMMON_HEADER_HPP
#define MIGRAPH
X
_GUARD_RTGLIB_COMMON_HEADER_HPP
#include <migraphx/program.hpp>
#include <migraphx/program.hpp>
#include <migraphx/stringutils.hpp>
#include <migraphx/stringutils.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/instruction.hpp>
...
@@ -14,17 +14,17 @@
...
@@ -14,17 +14,17 @@
#include <queue>
#include <queue>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
//#define MIGRAPH_DEBUG_OPT
//#define MIGRAPH
X
_DEBUG_OPT
#ifdef MIGRAPH_DEBUG_OPT
#ifdef MIGRAPH
X
_DEBUG_OPT
#define MIGRAPH_DEBUG(s) s
#define MIGRAPH
X
_DEBUG(s) s
#else
#else
#define MIGRAPH_DEBUG(s)
#define MIGRAPH
X
_DEBUG(s)
#endif // MIGRAPH_DEBUG_OPT
#endif // MIGRAPH
X
_DEBUG_OPT
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif // MIGRAPH_GUARD_RTGLIB_COMMON_HEADER_HPP
#endif // MIGRAPH
X
_GUARD_RTGLIB_COMMON_HEADER_HPP
src/opt/memory_coloring.cpp
View file @
0b217041
...
@@ -2,16 +2,16 @@
...
@@ -2,16 +2,16 @@
#include "memory_coloring_impl.hpp"
#include "memory_coloring_impl.hpp"
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
void
memory_coloring
::
apply
(
program
&
p
)
const
void
memory_coloring
::
apply
(
program
&
p
)
const
{
{
if
(
!
enabled
(
MIGRAPH_DISABLE_MEMORY_COLORING
{}))
if
(
!
enabled
(
MIGRAPH
X
_DISABLE_MEMORY_COLORING
{}))
{
{
memory_coloring_impl
opt
(
&
p
,
allocation_op
,
verify
);
memory_coloring_impl
opt
(
&
p
,
allocation_op
,
verify
);
opt
.
run
();
opt
.
run
();
}
}
}
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
src/opt/memory_coloring_impl.cpp
View file @
0b217041
#include "memory_coloring_impl.hpp"
#include "memory_coloring_impl.hpp"
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
void
memory_coloring_impl
::
run
()
void
memory_coloring_impl
::
run
()
{
{
MIGRAPH_DEBUG
(
dump
(
"---Before memory coloring---"
));
MIGRAPH
X
_DEBUG
(
dump
(
"---Before memory coloring---"
));
MIGRAPH_DEBUG
(
dump_program
());
MIGRAPH
X
_DEBUG
(
dump_program
());
build
();
build
();
if
(
num_of_lives
!=
0
)
if
(
num_of_lives
!=
0
)
{
{
MIGRAPH_DEBUG
(
dump_intervals
());
MIGRAPH
X
_DEBUG
(
dump_intervals
());
// Coloring
// Coloring
while
(
!
alloc_queue
.
empty
())
while
(
!
alloc_queue
.
empty
())
{
{
...
@@ -85,7 +85,7 @@ bool memory_coloring_impl::allocate(interval_ptr interval)
...
@@ -85,7 +85,7 @@ bool memory_coloring_impl::allocate(interval_ptr interval)
conflict_queue
.
pop
();
conflict_queue
.
pop
();
}
}
segment
.
offset
=
offset
;
segment
.
offset
=
offset
;
MIGRAPH_DEBUG
(
segment
.
dump
());
MIGRAPH
X
_DEBUG
(
segment
.
dump
());
required_bytes
=
std
::
max
(
required_bytes
,
offset
+
segment
.
size
);
required_bytes
=
std
::
max
(
required_bytes
,
offset
+
segment
.
size
);
return
true
;
return
true
;
}
}
...
@@ -218,8 +218,8 @@ void memory_coloring_impl::rewrite()
...
@@ -218,8 +218,8 @@ void memory_coloring_impl::rewrite()
}
}
}
}
}
}
MIGRAPH_DEBUG
(
dump
(
"---After rewrite---"
));
MIGRAPH
X
_DEBUG
(
dump
(
"---After rewrite---"
));
MIGRAPH_DEBUG
(
dump_program
());
MIGRAPH
X
_DEBUG
(
dump_program
());
}
}
void
memory_coloring_impl
::
verify
()
void
memory_coloring_impl
::
verify
()
...
@@ -235,7 +235,7 @@ void memory_coloring_impl::verify()
...
@@ -235,7 +235,7 @@ void memory_coloring_impl::verify()
{
{
// TODO: This check breaks on the tests
// TODO: This check breaks on the tests
// if(!interval.is_live_on_entry)
// if(!interval.is_live_on_entry)
// MIGRAPH_THROW("interval is not live on entry");
// MIGRAPH
X
_THROW("interval is not live on entry");
continue
;
continue
;
}
}
...
@@ -253,14 +253,14 @@ void memory_coloring_impl::verify()
...
@@ -253,14 +253,14 @@ void memory_coloring_impl::verify()
if
(
range
->
offset
==
invalid_offset
)
if
(
range
->
offset
==
invalid_offset
)
continue
;
continue
;
if
(
!
is_disjoin
(
*
range
,
segment
))
if
(
!
is_disjoin
(
*
range
,
segment
))
MIGRAPH_THROW
(
"range and segment is not disjoined"
);
MIGRAPH
X
_THROW
(
"range and segment is not disjoined"
);
}
}
}
}
}
}
}
}
}
}
#ifdef MIGRAPH_DEBUG_OPT
#ifdef MIGRAPH
X
_DEBUG_OPT
void
memory_coloring_impl
::
dump
(
const
std
::
string
&
str
)
{
std
::
cout
<<
str
<<
std
::
endl
;
}
void
memory_coloring_impl
::
dump
(
const
std
::
string
&
str
)
{
std
::
cout
<<
str
<<
std
::
endl
;
}
...
@@ -334,5 +334,5 @@ void live_interval::dump()
...
@@ -334,5 +334,5 @@ void live_interval::dump()
#endif
#endif
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
Prev
1
2
3
4
5
6
7
8
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