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
ee80cee9
Unverified
Commit
ee80cee9
authored
Nov 07, 2018
by
Paul Fultz II
Committed by
GitHub
Nov 07, 2018
Browse files
Merge branch 'master' into gpu_slice_test
parents
6d06226d
f958d56f
Changes
159
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
67 additions
and
46 deletions
+67
-46
src/shape.cpp
src/shape.cpp
+2
-0
src/simplify_algebra.cpp
src/simplify_algebra.cpp
+2
-0
src/simplify_reshapes.cpp
src/simplify_reshapes.cpp
+2
-0
src/targets/cpu/CMakeLists.txt
src/targets/cpu/CMakeLists.txt
+2
-2
src/targets/cpu/cpu_target.cpp
src/targets/cpu/cpu_target.cpp
+0
-18
src/targets/cpu/gemm.cpp
src/targets/cpu/gemm.cpp
+2
-1
src/targets/cpu/include/migraph/cpu/context.hpp
src/targets/cpu/include/migraph/cpu/context.hpp
+4
-0
src/targets/cpu/include/migraph/cpu/gemm.hpp
src/targets/cpu/include/migraph/cpu/gemm.hpp
+3
-1
src/targets/cpu/include/migraph/cpu/lowering.hpp
src/targets/cpu/include/migraph/cpu/lowering.hpp
+4
-2
src/targets/cpu/include/migraph/cpu/target.hpp
src/targets/cpu/include/migraph/cpu/target.hpp
+4
-2
src/targets/cpu/lowering.cpp
src/targets/cpu/lowering.cpp
+6
-15
src/targets/cpu/target.cpp
src/targets/cpu/target.cpp
+19
-0
src/targets/gpu/add.cpp
src/targets/gpu/add.cpp
+3
-1
src/targets/gpu/batchnorm.cpp
src/targets/gpu/batchnorm.cpp
+2
-1
src/targets/gpu/concat.cpp
src/targets/gpu/concat.cpp
+2
-1
src/targets/gpu/contiguous.cpp
src/targets/gpu/contiguous.cpp
+2
-1
src/targets/gpu/convolution.cpp
src/targets/gpu/convolution.cpp
+2
-1
src/targets/gpu/device/add.cpp
src/targets/gpu/device/add.cpp
+2
-0
src/targets/gpu/device/add_relu.cpp
src/targets/gpu/device/add_relu.cpp
+2
-0
src/targets/gpu/device/concat.cpp
src/targets/gpu/device/concat.cpp
+2
-0
No files found.
src/shape.cpp
View file @
ee80cee9
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include <iostream>
#include <iostream>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
struct
shape_impl
struct
shape_impl
{
{
...
@@ -190,4 +191,5 @@ std::ostream& operator<<(std::ostream& os, const shape& x)
...
@@ -190,4 +191,5 @@ std::ostream& operator<<(std::ostream& os, const shape& x)
return
os
;
return
os
;
}
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
src/simplify_algebra.cpp
View file @
ee80cee9
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include <migraph/literal.hpp>
#include <migraph/literal.hpp>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
struct
find_add_lit_broadcast
struct
find_add_lit_broadcast
{
{
...
@@ -60,4 +61,5 @@ struct find_add_lit_broadcast
...
@@ -60,4 +61,5 @@ struct find_add_lit_broadcast
void
simplify_algebra
::
apply
(
program
&
p
)
const
{
match
::
find_matches
(
p
,
find_add_lit_broadcast
{});
}
void
simplify_algebra
::
apply
(
program
&
p
)
const
{
match
::
find_matches
(
p
,
find_add_lit_broadcast
{});
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
src/simplify_reshapes.cpp
View file @
ee80cee9
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include <unordered_set>
#include <unordered_set>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
bool
is_reshaper
(
const
std
::
string
&
name
)
bool
is_reshaper
(
const
std
::
string
&
name
)
{
{
...
@@ -59,4 +60,5 @@ void simplify_reshapes::apply(program& p) const
...
@@ -59,4 +60,5 @@ void simplify_reshapes::apply(program& p) const
}
}
}
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
src/targets/cpu/CMakeLists.txt
View file @
ee80cee9
add_library
(
migraph_cpu
add_library
(
migraph_cpu
cpu_
target.cpp
target.cpp
cpu_
lowering.cpp
lowering.cpp
gemm.cpp
gemm.cpp
)
)
...
...
src/targets/cpu/cpu_target.cpp
deleted
100644 → 0
View file @
6d06226d
#include <migraph/cpu/cpu_target.hpp>
#include <migraph/cpu/cpu_lowering.hpp>
#include <migraph/auto_contiguous.hpp>
namespace
migraph
{
namespace
cpu
{
std
::
string
cpu_target
::
name
()
const
{
return
"cpu"
;
}
std
::
vector
<
pass
>
cpu_target
::
get_passes
(
migraph
::
context
&
)
const
{
return
{
auto_contiguous
{},
cpu_lowering
{}};
}
}
// namespace cpu
}
// namespace migraph
src/targets/cpu/gemm.cpp
View file @
ee80cee9
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#include <blaze/math/CustomMatrix.h>
#include <blaze/math/CustomMatrix.h>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
cpu
{
namespace
cpu
{
template
<
class
T
>
template
<
class
T
>
...
@@ -93,5 +94,5 @@ void migemm(
...
@@ -93,5 +94,5 @@ void migemm(
}
}
}
// namespace cpu
}
// namespace cpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
src/targets/cpu/include/migraph/cpu/context.hpp
View file @
ee80cee9
#ifndef MIGRAPH_GUARD_RTGLIB_CONTEXT_HPP
#ifndef MIGRAPH_GUARD_RTGLIB_CONTEXT_HPP
#define MIGRAPH_GUARD_RTGLIB_CONTEXT_HPP
#define MIGRAPH_GUARD_RTGLIB_CONTEXT_HPP
#include <migraph/config.hpp>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
cpu
{
namespace
cpu
{
struct
context
struct
context
...
@@ -10,6 +13,7 @@ struct context
...
@@ -10,6 +13,7 @@ struct context
};
};
}
// namespace cpu
}
// namespace cpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/cpu/include/migraph/cpu/gemm.hpp
View file @
ee80cee9
...
@@ -2,15 +2,17 @@
...
@@ -2,15 +2,17 @@
#define MIGRAPH_GUARD_RTGLIB_CPU_GEMM_HPP
#define MIGRAPH_GUARD_RTGLIB_CPU_GEMM_HPP
#include <migraph/argument.hpp>
#include <migraph/argument.hpp>
#include <migraph/config.hpp>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
cpu
{
namespace
cpu
{
void
migemm
(
void
migemm
(
const
argument
&
c_arg
,
const
argument
&
a_arg
,
const
argument
&
b_arg
,
float
alpha
,
float
beta
);
const
argument
&
c_arg
,
const
argument
&
a_arg
,
const
argument
&
b_arg
,
float
alpha
,
float
beta
);
}
// namespace cpu
}
// namespace cpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/cpu/include/migraph/cpu/
cpu_
lowering.hpp
→
src/targets/cpu/include/migraph/cpu/lowering.hpp
View file @
ee80cee9
...
@@ -2,18 +2,20 @@
...
@@ -2,18 +2,20 @@
#define MIGRAPH_GUARD_RTGLIB_CPU_LOWERING_HPP
#define MIGRAPH_GUARD_RTGLIB_CPU_LOWERING_HPP
#include <migraph/program.hpp>
#include <migraph/program.hpp>
#include <migraph/config.hpp>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
cpu
{
namespace
cpu
{
struct
cpu_
lowering
struct
lowering
{
{
std
::
string
name
()
const
{
return
"cpu::lowering"
;
}
std
::
string
name
()
const
{
return
"cpu::lowering"
;
}
void
apply
(
program
&
p
)
const
;
void
apply
(
program
&
p
)
const
;
};
};
}
// namespace cpu
}
// namespace cpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/cpu/include/migraph/cpu/
cpu_
target.hpp
→
src/targets/cpu/include/migraph/cpu/target.hpp
View file @
ee80cee9
...
@@ -3,11 +3,13 @@
...
@@ -3,11 +3,13 @@
#include <migraph/program.hpp>
#include <migraph/program.hpp>
#include <migraph/cpu/context.hpp>
#include <migraph/cpu/context.hpp>
#include <migraph/config.hpp>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
cpu
{
namespace
cpu
{
struct
cpu_
target
struct
target
{
{
std
::
string
name
()
const
;
std
::
string
name
()
const
;
std
::
vector
<
pass
>
get_passes
(
migraph
::
context
&
ctx
)
const
;
std
::
vector
<
pass
>
get_passes
(
migraph
::
context
&
ctx
)
const
;
...
@@ -15,7 +17,7 @@ struct cpu_target
...
@@ -15,7 +17,7 @@ struct cpu_target
};
};
}
// namespace cpu
}
// namespace cpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/cpu/
cpu_
lowering.cpp
→
src/targets/cpu/lowering.cpp
View file @
ee80cee9
#include <migraph/cpu/
cpu_
lowering.hpp>
#include <migraph/cpu/lowering.hpp>
#include <migraph/instruction.hpp>
#include <migraph/instruction.hpp>
#include <migraph/dfor.hpp>
#include <migraph/dfor.hpp>
#include <migraph/operators.hpp>
#include <migraph/operators.hpp>
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
cpu
{
namespace
cpu
{
template
<
typename
T
>
template
<
typename
T
>
...
@@ -606,6 +607,7 @@ struct cpu_apply
...
@@ -606,6 +607,7 @@ struct cpu_apply
apply_map
[
"sin"
]
=
simple_op
<
cpu_unary
<
sin_op
>>
();
apply_map
[
"sin"
]
=
simple_op
<
cpu_unary
<
sin_op
>>
();
apply_map
[
"cos"
]
=
simple_op
<
cpu_unary
<
cos_op
>>
();
apply_map
[
"cos"
]
=
simple_op
<
cpu_unary
<
cos_op
>>
();
apply_map
[
"tan"
]
=
simple_op
<
cpu_unary
<
tan_op
>>
();
apply_map
[
"tan"
]
=
simple_op
<
cpu_unary
<
tan_op
>>
();
apply_map
[
"relu"
]
=
simple_op
<
cpu_unary
<
relu_op
>>
();
apply_map
[
"add"
]
=
simple_op
<
cpu_binary
<
add_op
>>
();
apply_map
[
"add"
]
=
simple_op
<
cpu_binary
<
add_op
>>
();
apply_map
[
"sub"
]
=
simple_op
<
cpu_binary
<
sub_op
>>
();
apply_map
[
"sub"
]
=
simple_op
<
cpu_binary
<
sub_op
>>
();
apply_map
[
"mul"
]
=
simple_op
<
cpu_binary
<
mul_op
>>
();
apply_map
[
"mul"
]
=
simple_op
<
cpu_binary
<
mul_op
>>
();
...
@@ -619,11 +621,7 @@ struct cpu_apply
...
@@ -619,11 +621,7 @@ struct cpu_apply
init
();
init
();
for
(
auto
it
:
iterator_for
(
*
prog
))
for
(
auto
it
:
iterator_for
(
*
prog
))
{
{
if
(
it
->
name
()
==
"activation"
)
if
(
it
->
name
()
==
"pooling"
)
{
apply_activation
(
it
);
}
else
if
(
it
->
name
()
==
"pooling"
)
{
{
apply_pooling
(
it
);
apply_pooling
(
it
);
}
}
...
@@ -647,13 +645,6 @@ struct cpu_apply
...
@@ -647,13 +645,6 @@ struct cpu_apply
prog
->
replace_instruction
(
ins
,
T
{
op
},
ins
->
inputs
());
prog
->
replace_instruction
(
ins
,
T
{
op
},
ins
->
inputs
());
}
}
void
apply_activation
(
instruction_ref
ins
)
{
auto
&&
op
=
any_cast
<
op
::
activation
>
(
ins
->
get_operator
());
if
(
op
.
mode
==
"relu"
)
prog
->
replace_instruction
(
ins
,
cpu_unary
<
relu_op
>
{},
ins
->
inputs
());
}
void
apply_pooling
(
instruction_ref
ins
)
void
apply_pooling
(
instruction_ref
ins
)
{
{
auto
&&
op
=
any_cast
<
op
::
pooling
>
(
ins
->
get_operator
());
auto
&&
op
=
any_cast
<
op
::
pooling
>
(
ins
->
get_operator
());
...
@@ -664,8 +655,8 @@ struct cpu_apply
...
@@ -664,8 +655,8 @@ struct cpu_apply
}
}
};
};
void
cpu_
lowering
::
apply
(
program
&
p
)
const
{
cpu_apply
{
&
p
}.
apply
();
}
void
lowering
::
apply
(
program
&
p
)
const
{
cpu_apply
{
&
p
}.
apply
();
}
}
// namespace cpu
}
// namespace cpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
src/targets/cpu/target.cpp
0 → 100644
View file @
ee80cee9
#include <migraph/cpu/target.hpp>
#include <migraph/cpu/lowering.hpp>
#include <migraph/auto_contiguous.hpp>
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
cpu
{
std
::
string
target
::
name
()
const
{
return
"cpu"
;
}
std
::
vector
<
pass
>
target
::
get_passes
(
migraph
::
context
&
)
const
{
return
{
auto_contiguous
{},
lowering
{}};
}
}
// namespace cpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
src/targets/gpu/add.cpp
View file @
ee80cee9
#include <migraph/gpu/add.hpp>
#include <migraph/gpu/add.hpp>
#include <migraph/operators.hpp>
#include <migraph/operators.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/miopen.hpp>
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
shape
hip_add
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
shape
hip_add
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
...
@@ -49,5 +51,5 @@ argument miopen_add::compute(context& ctx,
...
@@ -49,5 +51,5 @@ argument miopen_add::compute(context& ctx,
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
src/targets/gpu/batchnorm.cpp
View file @
ee80cee9
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
shape
miopen_batch_norm_inference
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
shape
miopen_batch_norm_inference
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
...
@@ -42,5 +43,5 @@ argument miopen_batch_norm_inference::compute(context& ctx,
...
@@ -42,5 +43,5 @@ argument miopen_batch_norm_inference::compute(context& ctx,
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
src/targets/gpu/concat.cpp
View file @
ee80cee9
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
shape
hip_concat
::
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
shape
hip_concat
::
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
...
@@ -23,5 +24,5 @@ argument hip_concat::compute(context& ctx,
...
@@ -23,5 +24,5 @@ argument hip_concat::compute(context& ctx,
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
src/targets/gpu/contiguous.cpp
View file @
ee80cee9
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
shape
miopen_contiguous
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
shape
miopen_contiguous
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
...
@@ -24,5 +25,5 @@ argument miopen_contiguous::compute(context& ctx,
...
@@ -24,5 +25,5 @@ argument miopen_contiguous::compute(context& ctx,
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
src/targets/gpu/convolution.cpp
View file @
ee80cee9
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
shape
miopen_convolution
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
shape
miopen_convolution
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
...
@@ -81,5 +82,5 @@ shape miopen_convolution::compile(context& ctx,
...
@@ -81,5 +82,5 @@ shape miopen_convolution::compile(context& ctx,
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
src/targets/gpu/device/add.cpp
View file @
ee80cee9
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#include <migraph/gpu/device/nary.hpp>
#include <migraph/gpu/device/nary.hpp>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
namespace
device
{
namespace
device
{
...
@@ -21,4 +22,5 @@ void add(hipStream_t stream,
...
@@ -21,4 +22,5 @@ void add(hipStream_t stream,
}
// namespace device
}
// namespace device
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
src/targets/gpu/device/add_relu.cpp
View file @
ee80cee9
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#include <migraph/gpu/device/nary.hpp>
#include <migraph/gpu/device/nary.hpp>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
namespace
device
{
namespace
device
{
...
@@ -26,4 +27,5 @@ void add_relu(hipStream_t stream,
...
@@ -26,4 +27,5 @@ void add_relu(hipStream_t stream,
}
// namespace device
}
// namespace device
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
src/targets/gpu/device/concat.cpp
View file @
ee80cee9
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include <migraph/gpu/device/launch.hpp>
#include <migraph/gpu/device/launch.hpp>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
namespace
device
{
namespace
device
{
...
@@ -33,4 +34,5 @@ argument concat(hipStream_t stream,
...
@@ -33,4 +34,5 @@ argument concat(hipStream_t stream,
}
// namespace device
}
// namespace device
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
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