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
"vscode:/vscode.git/clone" did not exist on "6c521eb17aef7fea6773919067584266068abaf4"
Commit
0b217041
authored
Nov 27, 2018
by
Paul
Browse files
Rename more things to migraphx
parent
53fd3f74
Changes
155
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
120 additions
and
120 deletions
+120
-120
src/include/migraphx/half.hpp
src/include/migraphx/half.hpp
+4
-4
src/include/migraphx/instruction.hpp
src/include/migraphx/instruction.hpp
+4
-4
src/include/migraphx/instruction_ref.hpp
src/include/migraphx/instruction_ref.hpp
+4
-4
src/include/migraphx/iterator_for.hpp
src/include/migraphx/iterator_for.hpp
+4
-4
src/include/migraphx/literal.hpp
src/include/migraphx/literal.hpp
+4
-4
src/include/migraphx/make_shared_array.hpp
src/include/migraphx/make_shared_array.hpp
+4
-4
src/include/migraphx/manage_ptr.hpp
src/include/migraphx/manage_ptr.hpp
+5
-5
src/include/migraphx/matcher.hpp
src/include/migraphx/matcher.hpp
+12
-12
src/include/migraphx/memory_coloring.hpp
src/include/migraphx/memory_coloring.hpp
+4
-4
src/include/migraphx/onnx.hpp
src/include/migraphx/onnx.hpp
+4
-4
src/include/migraphx/operation.hpp
src/include/migraphx/operation.hpp
+5
-5
src/include/migraphx/operators.hpp
src/include/migraphx/operators.hpp
+21
-21
src/include/migraphx/pass.hpp
src/include/migraphx/pass.hpp
+4
-4
src/include/migraphx/pass_config.hpp
src/include/migraphx/pass_config.hpp
+6
-6
src/include/migraphx/program.hpp
src/include/migraphx/program.hpp
+4
-4
src/include/migraphx/ranges.hpp
src/include/migraphx/ranges.hpp
+4
-4
src/include/migraphx/rank.hpp
src/include/migraphx/rank.hpp
+4
-4
src/include/migraphx/raw_data.hpp
src/include/migraphx/raw_data.hpp
+8
-8
src/include/migraphx/reflect.hpp
src/include/migraphx/reflect.hpp
+4
-4
src/include/migraphx/requires.hpp
src/include/migraphx/requires.hpp
+11
-11
No files found.
src/include/migraphx/half.hpp
View file @
0b217041
...
...
@@ -5,14 +5,14 @@
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#ifndef MIGRAPH_GUARD_RTGLIB_HALF_HPP
#define MIGRAPH_GUARD_RTGLIB_HALF_HPP
#ifndef MIGRAPH
X
_GUARD_RTGLIB_HALF_HPP
#define MIGRAPH
X
_GUARD_RTGLIB_HALF_HPP
#include <half.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
using
half
=
half_float
::
half
;
...
...
@@ -33,7 +33,7 @@ struct deduce<half_float::detail::expr>
template
<
class
T
>
using
deduce
=
typename
detail
::
deduce
<
T
>::
type
;
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/instruction.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_INSTRUCTION_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_INSTRUCTION_HPP
#ifndef MIGRAPH
X
_GUARD_MIGRAPHLIB_INSTRUCTION_HPP
#define MIGRAPH
X
_GUARD_MIGRAPHLIB_INSTRUCTION_HPP
#include <migraphx/literal.hpp>
#include <migraphx/shape.hpp>
...
...
@@ -11,7 +11,7 @@
#include <utility>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
shape
compute_shape
(
const
operation
&
op
,
const
std
::
vector
<
instruction_ref
>&
args
);
...
...
@@ -90,7 +90,7 @@ struct instruction
std
::
vector
<
instruction_ref
>
arguments
;
literal
lit
;
};
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
namespace
std
{
...
...
src/include/migraphx/instruction_ref.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_INSTRUCTION_REF_HPP
#define MIGRAPH_GUARD_INSTRUCTION_REF_HPP
#ifndef MIGRAPH
X
_GUARD_INSTRUCTION_REF_HPP
#define MIGRAPH
X
_GUARD_INSTRUCTION_REF_HPP
#include <list>
#include <functional>
#include <migraphx/config.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
struct
instruction
;
using
instruction_ref
=
std
::
list
<
instruction
>::
iterator
;
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/iterator_for.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_RTGLIB_ITERATOR_FOR_HPP
#define MIGRAPH_GUARD_RTGLIB_ITERATOR_FOR_HPP
#ifndef MIGRAPH
X
_GUARD_RTGLIB_ITERATOR_FOR_HPP
#define MIGRAPH
X
_GUARD_RTGLIB_ITERATOR_FOR_HPP
#include <cassert>
#include <type_traits>
#include <migraphx/config.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
template
<
class
T
>
struct
iterator_for_range
...
...
@@ -39,7 +39,7 @@ iterator_for_range<T> iterator_for(T& x)
return
{
&
x
};
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/literal.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_LITERAL_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_LITERAL_HPP
#ifndef MIGRAPH
X
_GUARD_MIGRAPHLIB_LITERAL_HPP
#define MIGRAPH
X
_GUARD_MIGRAPHLIB_LITERAL_HPP
#include <migraphx/shape.hpp>
#include <migraphx/shape_for_each.hpp>
...
...
@@ -12,7 +12,7 @@
#include <memory>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
/**
* @brief Represents a raw literal
...
...
@@ -124,7 +124,7 @@ literal transform(literal l1, literal l2, F f)
return
result
;
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/make_shared_array.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_MAKE_SHARED_ARRAY_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_MAKE_SHARED_ARRAY_HPP
#ifndef MIGRAPH
X
_GUARD_MIGRAPHLIB_MAKE_SHARED_ARRAY_HPP
#define MIGRAPH
X
_GUARD_MIGRAPHLIB_MAKE_SHARED_ARRAY_HPP
#include <memory>
#include <migraphx/config.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
template
<
typename
T
>
std
::
shared_ptr
<
T
>
make_shared_array
(
size_t
size
)
...
...
@@ -13,7 +13,7 @@ std::shared_ptr<T> make_shared_array(size_t size)
return
std
::
shared_ptr
<
T
>
(
new
T
[
size
],
std
::
default_delete
<
T
[]
>
());
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/manage_ptr.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_MIGRAPH_MANAGE_PTR_HPP
#define MIGRAPH_GUARD_MIGRAPH_MANAGE_PTR_HPP
#ifndef MIGRAPH
X
_GUARD_MIGRAPH
X
_MANAGE_PTR_HPP
#define MIGRAPH
X
_GUARD_MIGRAPH
X
_MANAGE_PTR_HPP
#include <memory>
#include <type_traits>
#include <migraphx/config.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
template
<
class
F
,
F
f
>
// NOLINT
struct
manage_deleter
...
...
@@ -51,10 +51,10 @@ shared<T> share(T p)
return
shared
<
T
>
{
std
::
move
(
p
)};
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#define MIGRAPH_MANAGE_PTR(T, F) \
#define MIGRAPH
X
_MANAGE_PTR(T, F) \
migraphx::manage_ptr<std::remove_pointer_t<T>, decltype(&F), &F> // NOLINT
#endif
src/include/migraphx/matcher.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_RTGLIB_MATCHER_HPP
#define MIGRAPH_GUARD_RTGLIB_MATCHER_HPP
#ifndef MIGRAPH
X
_GUARD_RTGLIB_MATCHER_HPP
#define MIGRAPH
X
_GUARD_RTGLIB_MATCHER_HPP
#include <migraphx/functional.hpp>
#include <migraphx/ranges.hpp>
...
...
@@ -10,7 +10,7 @@
#include <unordered_map>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
match
{
...
...
@@ -169,7 +169,7 @@ basic_matcher<predicate_matcher<P>> make_basic_pred_matcher(P p)
}
/// This macro takes care of the boilerplate for defining a matcher
#define MIGRAPH_BASIC_MATCHER(name, ...) \
#define MIGRAPH
X
_BASIC_MATCHER(name, ...) \
struct name##_m \
{ \
instruction_ref match(__VA_ARGS__) const; \
...
...
@@ -178,7 +178,7 @@ basic_matcher<predicate_matcher<P>> make_basic_pred_matcher(P p)
inline instruction_ref name##_m::match(__VA_ARGS__) const
/// This macro takes care of the boilerplate for defining a predicate matcher
#define MIGRAPH_PRED_MATCHER(name, ...) \
#define MIGRAPH
X
_PRED_MATCHER(name, ...) \
struct name##_m \
{ \
bool operator()(__VA_ARGS__) const; \
...
...
@@ -266,22 +266,22 @@ auto any_of(Ts... ms)
});
}
MIGRAPH_PRED_MATCHER
(
any
,
instruction_ref
)
{
return
true
;
}
MIGRAPH_PRED_MATCHER
(
none
,
instruction_ref
)
{
return
false
;
}
MIGRAPH_PRED_MATCHER
(
standard_shape
,
instruction_ref
ins
)
{
return
ins
->
get_shape
().
standard
();
}
MIGRAPH_PRED_MATCHER
(
broadcast_shape
,
instruction_ref
ins
)
MIGRAPH
X
_PRED_MATCHER
(
any
,
instruction_ref
)
{
return
true
;
}
MIGRAPH
X
_PRED_MATCHER
(
none
,
instruction_ref
)
{
return
false
;
}
MIGRAPH
X
_PRED_MATCHER
(
standard_shape
,
instruction_ref
ins
)
{
return
ins
->
get_shape
().
standard
();
}
MIGRAPH
X
_PRED_MATCHER
(
broadcast_shape
,
instruction_ref
ins
)
{
return
ins
->
get_shape
().
broadcasted
();
}
MIGRAPH_BASIC_MATCHER
(
output
,
matcher_context
&
ctx
,
instruction_ref
ins
)
MIGRAPH
X
_BASIC_MATCHER
(
output
,
matcher_context
&
ctx
,
instruction_ref
ins
)
{
if
(
ins
->
outputs
().
size
()
==
1
)
return
ins
->
outputs
().
front
();
return
ctx
.
not_found
();
}
MIGRAPH_BASIC_MATCHER
(
used_once
,
matcher_context
&
ctx
,
instruction_ref
ins
)
MIGRAPH
X
_BASIC_MATCHER
(
used_once
,
matcher_context
&
ctx
,
instruction_ref
ins
)
{
if
(
ins
->
outputs
().
size
()
==
1
)
return
ins
;
...
...
@@ -340,7 +340,7 @@ inline auto either_arg(std::size_t i, std::size_t j)
}
}
// namespace match
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/memory_coloring.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_RTGLIB_MEMORY_COLORING_HPP
#define MIGRAPH_GUARD_RTGLIB_MEMORY_COLORING_HPP
#ifndef MIGRAPH
X
_GUARD_RTGLIB_MEMORY_COLORING_HPP
#define MIGRAPH
X
_GUARD_RTGLIB_MEMORY_COLORING_HPP
#include <string>
#include <migraphx/instruction_ref.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
struct
program
;
/**
...
...
@@ -20,7 +20,7 @@ struct memory_coloring
void
apply
(
program
&
p
)
const
;
};
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/onnx.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_ONNX_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_ONNX_HPP
#ifndef MIGRAPH
X
_GUARD_MIGRAPHLIB_ONNX_HPP
#define MIGRAPH
X
_GUARD_MIGRAPHLIB_ONNX_HPP
#include <migraphx/program.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
/// Create a program from an onnx file
program
parse_onnx
(
const
std
::
string
&
name
);
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/operation.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_OPERAND_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_OPERAND_HPP
#ifndef MIGRAPH
X
_GUARD_MIGRAPHLIB_OPERAND_HPP
#define MIGRAPH
X
_GUARD_MIGRAPHLIB_OPERAND_HPP
#include <cassert>
#include <string>
...
...
@@ -16,7 +16,7 @@
#include <migraphx/config.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
#ifdef DOXYGEN
...
...
@@ -103,7 +103,7 @@ template <class T>
argument
compute_op
(
rank
<
0
>
,
const
T
&
x
,
context
&
,
const
shape
&
,
const
std
::
vector
<
argument
>&
)
{
std
::
string
name
=
x
.
name
();
MIGRAPH_THROW
(
"Not computable: "
+
name
);
MIGRAPH
X
_THROW
(
"Not computable: "
+
name
);
}
template
<
class
T
>
...
...
@@ -387,7 +387,7 @@ inline bool operator!=(const operation& x, const operation& y) { return !(x == y
#endif
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/operators.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_OPERATORS_HPP
#define MIGRAPH_GUARD_OPERATORS_HPP
#ifndef MIGRAPH
X
_GUARD_OPERATORS_HPP
#define MIGRAPH
X
_GUARD_OPERATORS_HPP
#include <array>
#include <migraphx/operation.hpp>
...
...
@@ -11,14 +11,14 @@
#include <utility>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
op
{
struct
not_computable
{
argument
compute
(
context
&
,
const
shape
&
,
const
std
::
vector
<
argument
>&
)
const
{
MIGRAPH_THROW
(
"not computable"
);
MIGRAPH
X
_THROW
(
"not computable"
);
}
};
...
...
@@ -124,7 +124,7 @@ struct convolution
}
else
{
MIGRAPH_THROW
(
"Invalid padding mode"
);
MIGRAPH
X
_THROW
(
"Invalid padding mode"
);
}
}
};
...
...
@@ -163,7 +163,7 @@ struct im2col
auto
kernel_width
=
weights
.
lens
()[
3
];
check_shapes
{
inputs
,
*
this
}.
has
(
2
);
if
(
batch_size
!=
1
)
MIGRAPH_THROW
(
"im2col only support batch_size 1"
);
MIGRAPH
X
_THROW
(
"im2col only support batch_size 1"
);
auto
output_height
=
std
::
size_t
(
std
::
max
<
std
::
ptrdiff_t
>
(
1
,
(
input
.
lens
()[
2
]
-
(
1
+
dilation
[
0
]
*
(
kernel_height
-
1
))
+
2
*
padding
[
0
])
/
...
...
@@ -261,13 +261,13 @@ struct transpose
auto
t
=
input
.
type
();
if
(
dims
.
size
()
!=
input_lens
.
size
())
{
MIGRAPH_THROW
(
"Permutation has wrong number of axes"
);
MIGRAPH
X
_THROW
(
"Permutation has wrong number of axes"
);
}
std
::
vector
<
int64_t
>
axes
(
dims
.
size
());
std
::
iota
(
axes
.
begin
(),
axes
.
end
(),
0
);
if
(
!
std
::
is_permutation
(
axes
.
begin
(),
axes
.
end
(),
dims
.
begin
()))
{
MIGRAPH_THROW
(
"Invalid permutation"
);
MIGRAPH
X
_THROW
(
"Invalid permutation"
);
}
std
::
vector
<
size_t
>
output_lens
(
input_lens
.
size
());
std
::
vector
<
size_t
>
output_strides
(
input_lens
.
size
());
...
...
@@ -318,7 +318,7 @@ struct concat
{
if
(
inputs
.
empty
())
{
MIGRAPH_THROW
(
"Number of input tensors should exceed 0"
);
MIGRAPH
X
_THROW
(
"Number of input tensors should exceed 0"
);
}
const
auto
&
first_shape_lens
=
inputs
.
front
().
lens
();
...
...
@@ -331,7 +331,7 @@ struct concat
return
s
.
lens
()[
l
]
==
first_shape_lens
[
l
];
}))
{
MIGRAPH_THROW
(
"Non-axis dimensions should match"
);
MIGRAPH
X
_THROW
(
"Non-axis dimensions should match"
);
}
}
}
...
...
@@ -411,7 +411,7 @@ struct slice
// }
if
(
starts
.
size
()
!=
axes
.
size
()
||
axes
.
size
()
!=
ends
.
size
())
{
MIGRAPH_THROW
(
"inconsistent sizes"
);
MIGRAPH
X
_THROW
(
"inconsistent sizes"
);
}
std
::
vector
<
std
::
size_t
>
new_lens
=
old_lens
;
for
(
std
::
size_t
i
=
0
;
i
<
axes
.
size
();
i
++
)
...
...
@@ -450,7 +450,7 @@ struct squeeze
if
(
std
::
any_of
(
axes
.
begin
(),
axes
.
end
(),
[
&
](
auto
axis
)
{
return
input_shape
.
lens
()[
axis
]
!=
1
;
}))
{
MIGRAPH_THROW
(
"squeeze axis dimension should be equal to 1"
);
MIGRAPH
X
_THROW
(
"squeeze axis dimension should be equal to 1"
);
}
std
::
vector
<
std
::
size_t
>
new_lens
;
if
(
axes
.
empty
())
...
...
@@ -536,7 +536,7 @@ struct reshape
std
::
vector
<
std
::
size_t
>
rdims
(
dims
.
begin
(),
dims
.
end
());
auto
n_neg_dims
=
std
::
count
(
dims
.
begin
(),
dims
.
end
(),
-
1
);
if
(
n_neg_dims
>
1
)
MIGRAPH_THROW
(
"Dimensions for reshape can only have one -1 dim"
);
MIGRAPH
X
_THROW
(
"Dimensions for reshape can only have one -1 dim"
);
for
(
std
::
size_t
i
=
0
;
i
<
dims
.
size
();
i
++
)
{
if
(
dims
[
i
]
==
0
)
...
...
@@ -560,7 +560,7 @@ struct reshape
}
shape
s
{
inputs
.
front
().
type
(),
rdims
};
if
(
s
.
elements
()
!=
inputs
.
front
().
elements
())
MIGRAPH_THROW
(
"Wrong number of elements for reshape"
);
MIGRAPH
X
_THROW
(
"Wrong number of elements for reshape"
);
return
s
;
}
argument
compute
(
context
&
,
shape
output_shape
,
std
::
vector
<
argument
>
args
)
const
...
...
@@ -590,7 +590,7 @@ struct dot
auto
t
=
a
.
type
();
if
(
a
.
lens
()[
1
]
!=
b
.
lens
()[
0
])
MIGRAPH_THROW
(
"Inner dimensions do not match: {"
+
to_string_range
(
a
.
lens
())
+
"} x {"
+
MIGRAPH
X
_THROW
(
"Inner dimensions do not match: {"
+
to_string_range
(
a
.
lens
())
+
"} x {"
+
to_string_range
(
b
.
lens
())
+
"}"
);
return
{
t
,
{
a
.
lens
()[
0
],
b
.
lens
()[
1
]}};
}
...
...
@@ -704,7 +704,7 @@ struct flatten
if
(
axis
>
lens
.
size
())
{
MIGRAPH_THROW
(
"axis for flatten must be less than tensor rank"
);
MIGRAPH
X
_THROW
(
"axis for flatten must be less than tensor rank"
);
}
auto
x
=
std
::
accumulate
(
lens
.
begin
(),
lens
.
begin
()
+
axis
,
std
::
size_t
{
1
},
std
::
multiplies
<>
{});
...
...
@@ -742,7 +742,7 @@ struct broadcast
}))
{
if
(
axis
!=
0
)
MIGRAPH_THROW
(
"when broadcasting tensor of size 1, axis should be 0"
);
MIGRAPH
X
_THROW
(
"when broadcasting tensor of size 1, axis should be 0"
);
return
{
t
,
broadcast_shape
.
lens
(),
std
::
move
(
bcast_strides
)};
}
else
...
...
@@ -750,7 +750,7 @@ struct broadcast
assert
(
broadcast_shape
.
lens
().
size
()
-
axis
>=
input
.
lens
().
size
());
if
(
!
std
::
equal
(
input
.
lens
().
begin
(),
input
.
lens
().
end
(),
broadcast_shape
.
lens
().
begin
()
+
axis
))
MIGRAPH_THROW
(
"when broadcasting success sizes must match"
);
MIGRAPH
X
_THROW
(
"when broadcasting success sizes must match"
);
std
::
copy
(
input
.
strides
().
begin
(),
input
.
strides
().
end
(),
bcast_strides
.
begin
()
+
axis
);
return
{
t
,
broadcast_shape
.
lens
(),
std
::
move
(
bcast_strides
)};
}
...
...
@@ -781,10 +781,10 @@ struct multibroadcast
auto
input
=
inputs
.
at
(
0
);
if
(
input
.
lens
().
empty
())
MIGRAPH_THROW
(
"inputs dimensions should be > 0"
);
MIGRAPH
X
_THROW
(
"inputs dimensions should be > 0"
);
if
(
input
.
lens
().
size
()
>
output_lens
.
size
())
MIGRAPH_THROW
(
"inputs dimensions should <= output size"
);
MIGRAPH
X
_THROW
(
"inputs dimensions should <= output size"
);
std
::
vector
<
size_t
>
bcast_strides
(
output_lens
.
size
(),
0
);
auto
offset
=
output_lens
.
size
()
-
input
.
lens
().
size
();
...
...
@@ -904,7 +904,7 @@ struct outline
};
}
// namespace op
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/pass.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_PASS_HPP
#define MIGRAPH_GUARD_PASS_HPP
#ifndef MIGRAPH
X
_GUARD_PASS_HPP
#define MIGRAPH
X
_GUARD_PASS_HPP
#include <cassert>
#include <string>
...
...
@@ -10,7 +10,7 @@
#include <migraphx/config.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
struct
program
;
...
...
@@ -218,7 +218,7 @@ inline const ValueType& any_cast(const pass& x)
#endif
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/pass_config.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_PASS_CONFIG_HPP
#define MIGRAPH_GUARD_PASS_CONFIG_HPP
#ifndef MIGRAPH
X
_GUARD_PASS_CONFIG_HPP
#define MIGRAPH
X
_GUARD_PASS_CONFIG_HPP
#include <migraphx/env.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
MIGRAPH_DECLARE_ENV_VAR
(
MIGRAPH_DISABLE_MEMORY_COLORING
)
MIGRAPH
X
_DECLARE_ENV_VAR
(
MIGRAPH
X
_DISABLE_MEMORY_COLORING
)
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif // MIGRAPH_GUARD_PASS_CONFIG_HPP
#endif // MIGRAPH
X
_GUARD_PASS_CONFIG_HPP
src/include/migraphx/program.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_PROGRAM_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_PROGRAM_HPP
#ifndef MIGRAPH
X
_GUARD_MIGRAPHLIB_PROGRAM_HPP
#define MIGRAPH
X
_GUARD_MIGRAPHLIB_PROGRAM_HPP
#include <list>
#include <unordered_map>
...
...
@@ -14,7 +14,7 @@
#include <iostream>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
struct
program_impl
;
...
...
@@ -109,7 +109,7 @@ struct program
std
::
unique_ptr
<
program_impl
>
impl
;
};
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/ranges.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_RANGES_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_RANGES_HPP
#ifndef MIGRAPH
X
_GUARD_MIGRAPHLIB_RANGES_HPP
#define MIGRAPH
X
_GUARD_MIGRAPHLIB_RANGES_HPP
#include <algorithm>
#include <initializer_list>
...
...
@@ -7,7 +7,7 @@
#include <migraphx/config.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
detail
{
...
...
@@ -106,7 +106,7 @@ iterator_range<Iterator> range(std::pair<Iterator, Iterator> p)
return
{
p
.
first
,
p
.
second
};
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/rank.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_RTGLIB_RANK_HPP
#define MIGRAPH_GUARD_RTGLIB_RANK_HPP
#ifndef MIGRAPH
X
_GUARD_RTGLIB_RANK_HPP
#define MIGRAPH
X
_GUARD_RTGLIB_RANK_HPP
#include <migraphx/config.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
template
<
int
N
>
struct
rank
:
rank
<
N
-
1
>
...
...
@@ -16,7 +16,7 @@ struct rank<0>
{
};
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/raw_data.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_RAW_DATA_HPP
#define MIGRAPH_GUARD_RAW_DATA_HPP
#ifndef MIGRAPH
X
_GUARD_RAW_DATA_HPP
#define MIGRAPH
X
_GUARD_RAW_DATA_HPP
#include <migraphx/tensor_view.hpp>
#include <migraphx/requires.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
struct
raw_data_base
{
...
...
@@ -126,7 +126,7 @@ struct raw_data : raw_data_base
auto
&&
s
=
static_cast
<
const
Derived
&>
(
*
this
).
get_shape
();
auto
&&
buffer
=
static_cast
<
const
Derived
&>
(
*
this
).
data
();
if
(
s
.
type
()
!=
migraphx
::
shape
::
get_type
<
T
>
{})
MIGRAPH_THROW
(
"Incorrect data type for raw data"
);
MIGRAPH
X
_THROW
(
"Incorrect data type for raw data"
);
return
make_view
(
s
,
reinterpret_cast
<
T
*>
(
buffer
));
}
...
...
@@ -143,7 +143,7 @@ struct raw_data : raw_data_base
template
<
class
T
,
class
U
,
MIGRAPH_REQUIRES
(
std
::
is_base_of
<
raw_data_base
,
T
>{}
&&
MIGRAPH
X
_REQUIRES
(
std
::
is_base_of
<
raw_data_base
,
T
>{}
&&
std
::
is_base_of
<
raw_data_base
,
U
>
{})
>
bool
operator
==
(
const
T
&
x
,
const
U
&
y
)
{
...
...
@@ -166,7 +166,7 @@ bool operator==(const T& x, const U& y)
template
<
class
T
,
class
U
,
MIGRAPH_REQUIRES
(
std
::
is_base_of
<
raw_data_base
,
T
>{}
&&
MIGRAPH
X
_REQUIRES
(
std
::
is_base_of
<
raw_data_base
,
T
>{}
&&
std
::
is_base_of
<
raw_data_base
,
U
>
{})
>
bool
operator
!=
(
const
T
&
x
,
const
U
&
y
)
{
...
...
@@ -198,14 +198,14 @@ auto visit_all(T&& x, Ts&&... xs)
auto
&&
s
=
x
.
get_shape
();
std
::
initializer_list
<
shape
::
type_t
>
types
=
{
xs
.
get_shape
().
type
()...};
if
(
!
std
::
all_of
(
types
.
begin
(),
types
.
end
(),
[
&
](
shape
::
type_t
t
)
{
return
t
==
s
.
type
();
}))
MIGRAPH_THROW
(
"Types must be the same"
);
MIGRAPH
X
_THROW
(
"Types must be the same"
);
return
[
&
](
auto
v
)
{
// Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70100
detail
::
visit_all_impl
(
s
,
v
,
x
,
xs
...);
};
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/reflect.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_RTGLIB_REFLECT_HPP
#define MIGRAPH_GUARD_RTGLIB_REFLECT_HPP
#ifndef MIGRAPH
X
_GUARD_RTGLIB_REFLECT_HPP
#define MIGRAPH
X
_GUARD_RTGLIB_REFLECT_HPP
#include <migraphx/functional.hpp>
#include <migraphx/rank.hpp>
...
...
@@ -7,7 +7,7 @@
#include <functional>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
detail
{
...
...
@@ -47,7 +47,7 @@ void reflect_each(T& x, F f)
});
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
src/include/migraphx/requires.hpp
View file @
0b217041
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_REQUIRES_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_REQUIRES_HPP
#ifndef MIGRAPH
X
_GUARD_MIGRAPHLIB_REQUIRES_HPP
#define MIGRAPH
X
_GUARD_MIGRAPHLIB_REQUIRES_HPP
#include <type_traits>
#include <migraphx/config.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
template
<
bool
...
Bs
>
struct
and_
:
std
::
is_same
<
and_
<
Bs
...
>
,
and_
<
(
Bs
||
true
)...
>>
// NOLINT
...
...
@@ -24,29 +24,29 @@ struct requires_enum
};
};
#define MIGRAPH_REQUIRES_CAT(x, y) x##y
#define MIGRAPH
X
_REQUIRES_CAT(x, y) x##y
#ifdef CPPCHECK
#define MIGRAPH_REQUIRES(...) class = void
#define MIGRAPH
X
_REQUIRES(...) class = void
#else
#if 0
// TODO: This currently crashed on clang
#define MIGRAPH_REQUIRES(...) \
typename migraphx::requires_enum<__LINE__>::e MIGRAPH_REQUIRES_CAT( \
#define MIGRAPH
X
_REQUIRES(...) \
typename migraphx::requires_enum<__LINE__>::e MIGRAPH
X
_REQUIRES_CAT( \
PrivateRequires, \
__LINE__) = migraphx::requires_enum<__LINE__>::a, \
class = typename std::enable_if<and_<__VA_ARGS__, \
MIGRAPH_REQUIRES_CAT(PrivateRequires, __LINE__) == \
MIGRAPH
X
_REQUIRES_CAT(PrivateRequires, __LINE__) == \
migraphx::requires_enum<__LINE__>::a>{}>::type
#else
#define MIGRAPH_REQUIRES(...) \
typename migraphx::requires_enum<__LINE__>::e MIGRAPH_REQUIRES_CAT( \
#define MIGRAPH
X
_REQUIRES(...) \
typename migraphx::requires_enum<__LINE__>::e MIGRAPH
X
_REQUIRES_CAT( \
PrivateRequires, __LINE__) = migraphx::requires_enum<__LINE__>::a, \
class = typename std::enable_if<and_<__VA_ARGS__>{}>::type
#endif
#endif
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
#endif
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