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
96358e41
Commit
96358e41
authored
Nov 14, 2018
by
Paul
Browse files
Rename to migraphx
parent
80203608
Changes
190
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
265 additions
and
228 deletions
+265
-228
src/targets/gpu/include/migraphx/gpu/miopen.hpp
src/targets/gpu/include/migraphx/gpu/miopen.hpp
+8
-8
src/targets/gpu/include/migraphx/gpu/mul.hpp
src/targets/gpu/include/migraphx/gpu/mul.hpp
+37
-0
src/targets/gpu/include/migraphx/gpu/pooling.hpp
src/targets/gpu/include/migraphx/gpu/pooling.hpp
+17
-17
src/targets/gpu/include/migraphx/gpu/relu.hpp
src/targets/gpu/include/migraphx/gpu/relu.hpp
+17
-17
src/targets/gpu/include/migraphx/gpu/rocblas.hpp
src/targets/gpu/include/migraphx/gpu/rocblas.hpp
+5
-5
src/targets/gpu/include/migraphx/gpu/softmax.hpp
src/targets/gpu/include/migraphx/gpu/softmax.hpp
+17
-17
src/targets/gpu/include/migraphx/gpu/target.hpp
src/targets/gpu/include/migraphx/gpu/target.hpp
+6
-6
src/targets/gpu/include/migraphx/gpu/write_literals.hpp
src/targets/gpu/include/migraphx/gpu/write_literals.hpp
+4
-4
src/targets/gpu/leaky_relu.cpp
src/targets/gpu/leaky_relu.cpp
+6
-6
src/targets/gpu/lowering.cpp
src/targets/gpu/lowering.cpp
+27
-27
src/targets/gpu/mul.cpp
src/targets/gpu/mul.cpp
+6
-6
src/targets/gpu/pooling.cpp
src/targets/gpu/pooling.cpp
+6
-6
src/targets/gpu/relu.cpp
src/targets/gpu/relu.cpp
+6
-6
src/targets/gpu/rocblas.cpp
src/targets/gpu/rocblas.cpp
+3
-3
src/targets/gpu/softmax.cpp
src/targets/gpu/softmax.cpp
+6
-6
src/targets/gpu/target.cpp
src/targets/gpu/target.cpp
+23
-23
src/targets/gpu/write_literals.cpp
src/targets/gpu/write_literals.cpp
+7
-7
test/CMakeLists.txt
test/CMakeLists.txt
+7
-7
test/auto_contiguous_test.cpp
test/auto_contiguous_test.cpp
+19
-19
test/common_subexpression_elimination_test.cpp
test/common_subexpression_elimination_test.cpp
+38
-38
No files found.
src/targets/gpu/include/migraph/gpu/miopen.hpp
→
src/targets/gpu/include/migraph
x
/gpu/miopen.hpp
View file @
96358e41
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_HPP
#include <migraph/manage_ptr.hpp>
#include <migraph/operators.hpp>
#include <migraph
x
/manage_ptr.hpp>
#include <migraph
x
/operators.hpp>
#include <miopen/miopen.h>
#include <migraph/config.hpp>
#include <migraph
x
/config.hpp>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
...
...
@@ -34,7 +34,7 @@ Result make_obj(F f, Ts... xs)
return
r
;
}
inline
tensor_descriptor
make_tensor
(
const
migraph
::
shape
&
s
)
inline
tensor_descriptor
make_tensor
(
const
migraph
x
::
shape
&
s
)
{
auto
t
=
make_obj
<
tensor_descriptor
>
(
&
miopenCreateTensorDescriptor
);
// Convert to ints
...
...
@@ -51,7 +51,7 @@ inline tensor_descriptor make_tensor(const migraph::shape& s)
return
t
;
}
inline
convolution_descriptor
make_conv
(
const
migraph
::
op
::
convolution
&
op
)
inline
convolution_descriptor
make_conv
(
const
migraph
x
::
op
::
convolution
&
op
)
{
auto
c
=
make_obj
<
convolution_descriptor
>
(
&
miopenCreateConvolutionDescriptor
);
miopenInitConvolutionDescriptor
(
c
.
get
(),
...
...
@@ -65,7 +65,7 @@ inline convolution_descriptor make_conv(const migraph::op::convolution& op)
return
c
;
}
inline
pooling_descriptor
make_pooling
(
const
migraph
::
op
::
pooling
&
op
)
inline
pooling_descriptor
make_pooling
(
const
migraph
x
::
op
::
pooling
&
op
)
{
miopenPoolingMode_t
mode
;
if
(
op
.
mode
==
"max"
)
...
...
@@ -118,6 +118,6 @@ inline fused_operator_args make_fused_args()
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
#endif
src/targets/gpu/include/migraph/gpu/mul.hpp
→
src/targets/gpu/include/migraph
x
/gpu/mul.hpp
View file @
96358e41
#ifndef MIGRAPH_GUARD_RTGLIB_MUL_HPP
#define MIGRAPH_GUARD_RTGLIB_MUL_HPP
#include <migraph/gpu/lowering.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/instruction.hpp>
#include <migraph/operators.hpp>
#include <migraph/generate.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/dfor.hpp>
#include <migraph/gpu/device/contiguous.hpp>
#include <migraph/gpu/device/mul.hpp>
#include <migraph/iterator_for.hpp>
#include <migraph/gpu/rocblas.hpp>
#include <migraph/gpu/context.hpp>
#include <migraph
x
/gpu/lowering.hpp>
#include <migraph
x
/manage_ptr.hpp>
#include <migraph
x
/instruction.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/generate.hpp>
#include <migraph
x
/shape_for_each.hpp>
#include <migraph
x
/config.hpp>
#include <migraph
x
/gpu/miopen.hpp>
#include <migraph
x
/gpu/hip.hpp>
#include <migraph
x
/dfor.hpp>
#include <migraph
x
/gpu/device/contiguous.hpp>
#include <migraph
x
/gpu/device/mul.hpp>
#include <migraph
x
/iterator_for.hpp>
#include <migraph
x
/gpu/rocblas.hpp>
#include <migraph
x
/gpu/context.hpp>
#include <utility>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
...
...
@@ -32,6 +32,6 @@ struct hip_mul
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
#endif
src/targets/gpu/include/migraph/gpu/pooling.hpp
→
src/targets/gpu/include/migraph
x
/gpu/pooling.hpp
View file @
96358e41
#ifndef MIGRAPH_GUARD_RTGLIB_POOLING_HPP
#define MIGRAPH_GUARD_RTGLIB_POOLING_HPP
#include <migraph/gpu/lowering.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/instruction.hpp>
#include <migraph/operators.hpp>
#include <migraph/generate.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/dfor.hpp>
#include <migraph/gpu/device/contiguous.hpp>
#include <migraph/gpu/device/add.hpp>
#include <migraph/iterator_for.hpp>
#include <migraph/gpu/rocblas.hpp>
#include <migraph/gpu/context.hpp>
#include <migraph
x
/gpu/lowering.hpp>
#include <migraph
x
/manage_ptr.hpp>
#include <migraph
x
/instruction.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/generate.hpp>
#include <migraph
x
/shape_for_each.hpp>
#include <migraph
x
/config.hpp>
#include <migraph
x
/gpu/miopen.hpp>
#include <migraph
x
/gpu/hip.hpp>
#include <migraph
x
/dfor.hpp>
#include <migraph
x
/gpu/device/contiguous.hpp>
#include <migraph
x
/gpu/device/add.hpp>
#include <migraph
x
/iterator_for.hpp>
#include <migraph
x
/gpu/rocblas.hpp>
#include <migraph
x
/gpu/context.hpp>
#include <utility>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
...
...
@@ -36,6 +36,6 @@ struct miopen_pooling
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
#endif
src/targets/gpu/include/migraph/gpu/relu.hpp
→
src/targets/gpu/include/migraph
x
/gpu/relu.hpp
View file @
96358e41
#ifndef MIGRAPH_GUARD_RTGLIB_RELU_HPP
#define MIGRAPH_GUARD_RTGLIB_RELU_HPP
#include <migraph/gpu/lowering.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/instruction.hpp>
#include <migraph/operators.hpp>
#include <migraph/generate.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/dfor.hpp>
#include <migraph/gpu/device/contiguous.hpp>
#include <migraph/gpu/device/add.hpp>
#include <migraph/iterator_for.hpp>
#include <migraph/gpu/rocblas.hpp>
#include <migraph/gpu/context.hpp>
#include <migraph
x
/gpu/lowering.hpp>
#include <migraph
x
/manage_ptr.hpp>
#include <migraph
x
/instruction.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/generate.hpp>
#include <migraph
x
/shape_for_each.hpp>
#include <migraph
x
/config.hpp>
#include <migraph
x
/gpu/miopen.hpp>
#include <migraph
x
/gpu/hip.hpp>
#include <migraph
x
/dfor.hpp>
#include <migraph
x
/gpu/device/contiguous.hpp>
#include <migraph
x
/gpu/device/add.hpp>
#include <migraph
x
/iterator_for.hpp>
#include <migraph
x
/gpu/rocblas.hpp>
#include <migraph
x
/gpu/context.hpp>
#include <utility>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
...
...
@@ -34,6 +34,6 @@ struct miopen_relu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
#endif
src/targets/gpu/include/migraph/gpu/rocblas.hpp
→
src/targets/gpu/include/migraph
x
/gpu/rocblas.hpp
View file @
96358e41
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_ROCBLAS_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_ROCBLAS_HPP
#include <migraph/manage_ptr.hpp>
#include <migraph/operators.hpp>
#include <migraph/config.hpp>
#include <migraph
x
/manage_ptr.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/config.hpp>
#include <rocblas.h>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
...
...
@@ -17,6 +17,6 @@ rocblas_handle_ptr create_rocblas_handle_ptr(hipStream_t s);
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
#endif
src/targets/gpu/include/migraph/gpu/softmax.hpp
→
src/targets/gpu/include/migraph
x
/gpu/softmax.hpp
View file @
96358e41
#ifndef MIGRAPH_GUARD_RTGLIB_SOFTMAX_HPP
#define MIGRAPH_GUARD_RTGLIB_SOFTMAX_HPP
#include <migraph/gpu/lowering.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/instruction.hpp>
#include <migraph/operators.hpp>
#include <migraph/generate.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/dfor.hpp>
#include <migraph/gpu/device/contiguous.hpp>
#include <migraph/gpu/device/add.hpp>
#include <migraph/iterator_for.hpp>
#include <migraph/gpu/rocblas.hpp>
#include <migraph/gpu/context.hpp>
#include <migraph
x
/gpu/lowering.hpp>
#include <migraph
x
/manage_ptr.hpp>
#include <migraph
x
/instruction.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/generate.hpp>
#include <migraph
x
/shape_for_each.hpp>
#include <migraph
x
/config.hpp>
#include <migraph
x
/gpu/miopen.hpp>
#include <migraph
x
/gpu/hip.hpp>
#include <migraph
x
/dfor.hpp>
#include <migraph
x
/gpu/device/contiguous.hpp>
#include <migraph
x
/gpu/device/add.hpp>
#include <migraph
x
/iterator_for.hpp>
#include <migraph
x
/gpu/rocblas.hpp>
#include <migraph
x
/gpu/context.hpp>
#include <utility>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
...
...
@@ -34,6 +34,6 @@ struct miopen_softmax
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
#endif
src/targets/gpu/include/migraph/gpu/target.hpp
→
src/targets/gpu/include/migraph
x
/gpu/target.hpp
View file @
96358e41
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_TARGET_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_TARGET_HPP
#include <migraph/program.hpp>
#include <migraph/config.hpp>
#include <migraph
x
/program.hpp>
#include <migraph
x
/config.hpp>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
struct
target
{
std
::
string
name
()
const
;
std
::
vector
<
pass
>
get_passes
(
migraph
::
context
&
gctx
)
const
;
migraph
::
context
get_context
()
const
;
std
::
vector
<
pass
>
get_passes
(
migraph
x
::
context
&
gctx
)
const
;
migraph
x
::
context
get_context
()
const
;
};
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
#endif
src/targets/gpu/include/migraph/gpu/write_literals.hpp
→
src/targets/gpu/include/migraph
x
/gpu/write_literals.hpp
View file @
96358e41
#ifndef MIGRAPH_GUARD_RTGLIB_MIOPEN_WRITE_LITERALS_HPP
#define MIGRAPH_GUARD_RTGLIB_MIOPEN_WRITE_LITERALS_HPP
#include <migraph/program.hpp>
#include <migraph/gpu/context.hpp>
#include <migraph
x
/program.hpp>
#include <migraph
x
/gpu/context.hpp>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
...
...
@@ -19,6 +19,6 @@ struct write_literals
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
#endif
src/targets/gpu/leaky_relu.cpp
View file @
96358e41
#include <migraph/gpu/leaky_relu.hpp>
#include <migraph/operators.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph
x
/gpu/leaky_relu.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/manage_ptr.hpp>
#include <migraph
x
/gpu/miopen.hpp>
#include <utility>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
...
...
@@ -35,4 +35,4 @@ argument miopen_leaky_relu::compute(context& ctx,
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/targets/gpu/lowering.cpp
View file @
96358e41
#include <rocblas.h>
#include <migraph/gpu/lowering.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/instruction.hpp>
#include <migraph/operators.hpp>
#include <migraph/generate.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/dfor.hpp>
#include <migraph/gpu/device/contiguous.hpp>
#include <migraph/gpu/device/add.hpp>
#include <migraph/iterator_for.hpp>
#include <migraph/gpu/rocblas.hpp>
#include <migraph/gpu/context.hpp>
#include <migraph/gpu/convolution.hpp>
#include <migraph/gpu/contiguous.hpp>
#include <migraph/gpu/relu.hpp>
#include <migraph/gpu/leaky_relu.hpp>
#include <migraph/gpu/softmax.hpp>
#include <migraph/gpu/add.hpp>
#include <migraph/gpu/mul.hpp>
#include <migraph/gpu/batchnorm.hpp>
#include <migraph/gpu/pooling.hpp>
#include <migraph/gpu/gemm.hpp>
#include <migraph/gpu/concat.hpp>
#include <migraph
x
/gpu/lowering.hpp>
#include <migraph
x
/manage_ptr.hpp>
#include <migraph
x
/instruction.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/generate.hpp>
#include <migraph
x
/shape_for_each.hpp>
#include <migraph
x
/gpu/miopen.hpp>
#include <migraph
x
/gpu/hip.hpp>
#include <migraph
x
/dfor.hpp>
#include <migraph
x
/gpu/device/contiguous.hpp>
#include <migraph
x
/gpu/device/add.hpp>
#include <migraph
x
/iterator_for.hpp>
#include <migraph
x
/gpu/rocblas.hpp>
#include <migraph
x
/gpu/context.hpp>
#include <migraph
x
/gpu/convolution.hpp>
#include <migraph
x
/gpu/contiguous.hpp>
#include <migraph
x
/gpu/relu.hpp>
#include <migraph
x
/gpu/leaky_relu.hpp>
#include <migraph
x
/gpu/softmax.hpp>
#include <migraph
x
/gpu/add.hpp>
#include <migraph
x
/gpu/mul.hpp>
#include <migraph
x
/gpu/batchnorm.hpp>
#include <migraph
x
/gpu/pooling.hpp>
#include <migraph
x
/gpu/gemm.hpp>
#include <migraph
x
/gpu/concat.hpp>
#include <utility>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
...
...
@@ -222,4 +222,4 @@ struct miopen_apply
void
lowering
::
apply
(
program
&
p
)
const
{
miopen_apply
{
&
p
,
ctx
}.
apply
();
}
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/targets/gpu/mul.cpp
View file @
96358e41
#include <migraph/gpu/mul.hpp>
#include <migraph/operators.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph
x
/gpu/mul.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/manage_ptr.hpp>
#include <migraph
x
/gpu/miopen.hpp>
#include <utility>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
...
...
@@ -23,4 +23,4 @@ argument hip_mul::compute(context& ctx, const shape&, const std::vector<argument
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/targets/gpu/pooling.cpp
View file @
96358e41
#include <migraph/gpu/pooling.hpp>
#include <migraph/operators.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph
x
/gpu/pooling.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/manage_ptr.hpp>
#include <migraph
x
/gpu/miopen.hpp>
#include <utility>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
...
...
@@ -39,4 +39,4 @@ argument miopen_pooling::compute(context& ctx,
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/targets/gpu/relu.cpp
View file @
96358e41
#include <migraph/gpu/relu.hpp>
#include <migraph/operators.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph
x
/gpu/relu.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/manage_ptr.hpp>
#include <migraph
x
/gpu/miopen.hpp>
#include <utility>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
...
...
@@ -35,4 +35,4 @@ argument miopen_relu::compute(context& ctx,
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/targets/gpu/rocblas.cpp
View file @
96358e41
#include <migraph/gpu/rocblas.hpp>
#include <migraph
x
/gpu/rocblas.hpp>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
...
...
@@ -20,4 +20,4 @@ rocblas_handle_ptr create_rocblas_handle_ptr(hipStream_t s)
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/targets/gpu/softmax.cpp
View file @
96358e41
#include <migraph/gpu/softmax.hpp>
#include <migraph/operators.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph
x
/gpu/softmax.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/manage_ptr.hpp>
#include <migraph
x
/gpu/miopen.hpp>
#include <utility>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
...
...
@@ -34,4 +34,4 @@ argument miopen_softmax::compute(context& ctx,
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/targets/gpu/target.cpp
View file @
96358e41
#include <migraph/gpu/target.hpp>
#include <migraph/gpu/lowering.hpp>
#include <migraph/memory_coloring.hpp>
#include <migraph/gpu/write_literals.hpp>
#include <migraph/gpu/context.hpp>
#include <migraph/gpu/eliminate_workspace.hpp>
#include <migraph/eliminate_allocation.hpp>
#include <migraph/gpu/fuse_ops.hpp>
#include <migraph/check_context.hpp>
#include <migraph/auto_contiguous.hpp>
#include <migraph/dead_code_elimination.hpp>
#include <migraph/simplify_reshapes.hpp>
#include <migraph/simplify_algebra.hpp>
#include <migraph/constant_propagate.hpp>
#include <migraph/eliminate_contiguous.hpp>
#include <migraph/common_subexpression_elimination.hpp>
#include <migraph/fwd_conv_batchnorm_rewrite.hpp>
#include <migraph/eliminate_concat.hpp>
#include <migraph/gpu/concat_gpu_opt.hpp>
#include <migraph
x
/gpu/target.hpp>
#include <migraph
x
/gpu/lowering.hpp>
#include <migraph
x
/memory_coloring.hpp>
#include <migraph
x
/gpu/write_literals.hpp>
#include <migraph
x
/gpu/context.hpp>
#include <migraph
x
/gpu/eliminate_workspace.hpp>
#include <migraph
x
/eliminate_allocation.hpp>
#include <migraph
x
/gpu/fuse_ops.hpp>
#include <migraph
x
/check_context.hpp>
#include <migraph
x
/auto_contiguous.hpp>
#include <migraph
x
/dead_code_elimination.hpp>
#include <migraph
x
/simplify_reshapes.hpp>
#include <migraph
x
/simplify_algebra.hpp>
#include <migraph
x
/constant_propagate.hpp>
#include <migraph
x
/eliminate_contiguous.hpp>
#include <migraph
x
/common_subexpression_elimination.hpp>
#include <migraph
x
/fwd_conv_batchnorm_rewrite.hpp>
#include <migraph
x
/eliminate_concat.hpp>
#include <migraph
x
/gpu/concat_gpu_opt.hpp>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
std
::
vector
<
pass
>
target
::
get_passes
(
migraph
::
context
&
gctx
)
const
std
::
vector
<
pass
>
target
::
get_passes
(
migraph
x
::
context
&
gctx
)
const
{
auto
&
ctx
=
any_cast
<
context
>
(
gctx
);
// clang-format off
...
...
@@ -59,7 +59,7 @@ std::vector<pass> target::get_passes(migraph::context& gctx) const
std
::
string
target
::
name
()
const
{
return
"miopen"
;
}
migraph
::
context
target
::
get_context
()
const
{
return
context
{};
}
migraph
x
::
context
target
::
get_context
()
const
{
return
context
{};
}
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/targets/gpu/write_literals.cpp
View file @
96358e41
#include <migraph/gpu/write_literals.hpp>
#include <migraph/iterator_for.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/instruction.hpp>
#include <migraph/env.hpp>
#include <migraph
x
/gpu/write_literals.hpp>
#include <migraph
x
/iterator_for.hpp>
#include <migraph
x
/gpu/hip.hpp>
#include <migraph
x
/instruction.hpp>
#include <migraph
x
/env.hpp>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
...
...
@@ -54,4 +54,4 @@ void write_literals::apply(program& p) const
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
test/CMakeLists.txt
View file @
96358e41
...
...
@@ -83,7 +83,7 @@ function(add_test_executable TEST_NAME)
add_dependencies
(
tests
${
TEST_NAME
}
)
add_dependencies
(
check
${
TEST_NAME
}
)
set_tests_properties
(
${
TEST_NAME
}
PROPERTIES FAIL_REGULAR_EXPRESSION
"FAILED"
)
target_link_libraries
(
${
TEST_NAME
}
migraph migraph_cpu migraph_onnx
)
target_link_libraries
(
${
TEST_NAME
}
migraph
x
migraph
x
_cpu migraph
x
_onnx
)
target_include_directories
(
${
TEST_NAME
}
PUBLIC include
)
endfunction
(
add_test_executable
)
...
...
@@ -107,14 +107,14 @@ if(MIGRAPH_ENABLE_GPU)
COST 10
RESOURCE_LOCK gpu
)
target_link_libraries
(
test_gpu_
${
BASE_NAME
}
migraph_gpu
)
target_link_libraries
(
test_gpu_
${
BASE_NAME
}
migraph
x
_gpu
)
endforeach
()
endif
()
# Onnx test
add_executable
(
test_onnx onnx/onnx_test.cpp
)
rocm_clang_tidy_check
(
test_onnx
)
target_link_libraries
(
test_onnx migraph_onnx
)
target_link_libraries
(
test_onnx migraph
x
_onnx
)
target_include_directories
(
test_onnx PUBLIC include
)
add_test
(
NAME test_onnx COMMAND $<TARGET_FILE:test_onnx> WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
/onnx
)
add_dependencies
(
tests test_onnx
)
...
...
@@ -143,13 +143,13 @@ function(test_headers PREFIX)
get_filename_component
(
BASE_NAME
${
HEADER
}
NAME_WE
)
test_header
(
header_
${
TEST_NAME
}
${
PREFIX
}
/
${
BASE_NAME
}
.hpp
)
if
(
MIGRAPH_ENABLE_GPU
)
target_link_libraries
(
header_
${
TEST_NAME
}
migraph_gpu
)
target_link_libraries
(
header_
${
TEST_NAME
}
migraph
x
_gpu
)
endif
()
endforeach
()
endfunction
()
test_headers
(
migraph
${
CMAKE_SOURCE_DIR
}
/src/include/migraph/*.hpp
)
test_headers
(
migraph/cpu
${
CMAKE_SOURCE_DIR
}
/src/targets/cpu/include/migraph/cpu/*.hpp
)
test_headers
(
migraph
x
${
CMAKE_SOURCE_DIR
}
/src/include/migraph
x
/*.hpp
)
test_headers
(
migraph
x
/cpu
${
CMAKE_SOURCE_DIR
}
/src/targets/cpu/include/migraph
x
/cpu/*.hpp
)
if
(
MIGRAPH_ENABLE_GPU
)
test_headers
(
migraph/gpu
${
CMAKE_SOURCE_DIR
}
/src/targets/gpu/include/migraph/gpu/*.hpp
)
test_headers
(
migraph
x
/gpu
${
CMAKE_SOURCE_DIR
}
/src/targets/gpu/include/migraph
x
/gpu/*.hpp
)
endif
()
test/auto_contiguous_test.cpp
View file @
96358e41
#include <migraph/auto_contiguous.hpp>
#include <migraph/operators.hpp>
#include <migraph/instruction.hpp>
#include <migraph
x
/auto_contiguous.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/instruction.hpp>
#include <basic_ops.hpp>
#include <test.hpp>
struct
contiguous_target
{
std
::
string
name
()
const
{
return
"contiguous"
;
}
std
::
vector
<
migraph
::
pass
>
get_passes
(
migraph
::
context
&
)
const
std
::
vector
<
migraph
x
::
pass
>
get_passes
(
migraph
x
::
context
&
)
const
{
return
{
migraph
::
auto_contiguous
{}};
return
{
migraph
x
::
auto_contiguous
{}};
}
migraph
::
context
get_context
()
const
{
return
{};
}
migraph
x
::
context
get_context
()
const
{
return
{};
}
};
// TODO: Add this test case
void
literal_broadcast
()
{
migraph
::
program
p
;
migraph
x
::
program
p
;
p
.
add_literal
(
get_2_broadcasted
());
EXPECT
(
not
p
.
get_shape
().
standard
());
EXPECT
(
p
.
get_shape
().
broadcasted
());
...
...
@@ -28,7 +28,7 @@ void literal_broadcast()
TEST_CASE
(
literal_transpose
)
{
migraph
::
program
p
;
migraph
x
::
program
p
;
p
.
add_literal
(
get_2x2_transposed
());
EXPECT
(
not
p
.
get_shape
().
standard
());
EXPECT
(
p
.
get_shape
().
transposed
());
...
...
@@ -39,11 +39,11 @@ TEST_CASE(literal_transpose)
TEST_CASE
(
after_literal_transpose
)
{
migraph
::
program
p
;
migraph
x
::
program
p
;
auto
l
=
p
.
add_literal
(
get_2x2
());
EXPECT
(
p
.
get_shape
().
standard
());
EXPECT
(
not
p
.
get_shape
().
transposed
());
auto
t
=
p
.
add_instruction
(
migraph
::
op
::
transpose
{{
1
,
0
}},
l
);
auto
t
=
p
.
add_instruction
(
migraph
x
::
op
::
transpose
{{
1
,
0
}},
l
);
p
.
add_instruction
(
pass_op
{},
t
);
EXPECT
(
not
p
.
get_shape
().
standard
());
EXPECT
(
p
.
get_shape
().
transposed
());
...
...
@@ -54,12 +54,12 @@ TEST_CASE(after_literal_transpose)
TEST_CASE
(
after_literal_broadcast
)
{
migraph
::
program
p
;
migraph
x
::
program
p
;
auto
l1
=
p
.
add_literal
(
get_2x2
());
auto
l2
=
p
.
add_literal
(
get_2
());
EXPECT
(
p
.
get_shape
().
standard
());
EXPECT
(
not
p
.
get_shape
().
broadcasted
());
auto
b
=
p
.
add_instruction
(
migraph
::
op
::
broadcast
{
0
,
l1
->
get_shape
()},
l2
);
auto
b
=
p
.
add_instruction
(
migraph
x
::
op
::
broadcast
{
0
,
l1
->
get_shape
()},
l2
);
p
.
add_instruction
(
pass_op
{},
b
);
EXPECT
(
not
p
.
get_shape
().
standard
());
EXPECT
(
p
.
get_shape
().
broadcasted
());
...
...
@@ -70,11 +70,11 @@ TEST_CASE(after_literal_broadcast)
TEST_CASE
(
after_param_transpose
)
{
migraph
::
program
p
;
auto
l
=
p
.
add_parameter
(
"2x2"
,
{
migraph
::
shape
::
float_type
,
{
2
,
2
}});
migraph
x
::
program
p
;
auto
l
=
p
.
add_parameter
(
"2x2"
,
{
migraph
x
::
shape
::
float_type
,
{
2
,
2
}});
EXPECT
(
p
.
get_shape
().
standard
());
EXPECT
(
not
p
.
get_shape
().
transposed
());
auto
t
=
p
.
add_instruction
(
migraph
::
op
::
transpose
{{
1
,
0
}},
l
);
auto
t
=
p
.
add_instruction
(
migraph
x
::
op
::
transpose
{{
1
,
0
}},
l
);
p
.
add_instruction
(
pass_op
{},
t
);
EXPECT
(
not
p
.
get_shape
().
standard
());
EXPECT
(
p
.
get_shape
().
transposed
());
...
...
@@ -85,12 +85,12 @@ TEST_CASE(after_param_transpose)
TEST_CASE
(
after_param_broadcast
)
{
migraph
::
program
p
;
auto
l1
=
p
.
add_parameter
(
"2x2"
,
{
migraph
::
shape
::
float_type
,
{
2
,
2
}});
auto
l2
=
p
.
add_parameter
(
"2"
,
{
migraph
::
shape
::
float_type
,
{
2
}});
migraph
x
::
program
p
;
auto
l1
=
p
.
add_parameter
(
"2x2"
,
{
migraph
x
::
shape
::
float_type
,
{
2
,
2
}});
auto
l2
=
p
.
add_parameter
(
"2"
,
{
migraph
x
::
shape
::
float_type
,
{
2
}});
EXPECT
(
p
.
get_shape
().
standard
());
EXPECT
(
not
p
.
get_shape
().
broadcasted
());
auto
b
=
p
.
add_instruction
(
migraph
::
op
::
broadcast
{
0
,
l1
->
get_shape
()},
l2
);
auto
b
=
p
.
add_instruction
(
migraph
x
::
op
::
broadcast
{
0
,
l1
->
get_shape
()},
l2
);
p
.
add_instruction
(
pass_op
{},
b
);
EXPECT
(
not
p
.
get_shape
().
standard
());
EXPECT
(
p
.
get_shape
().
broadcasted
());
...
...
test/common_subexpression_elimination_test.cpp
View file @
96358e41
#include <migraph/common_subexpression_elimination.hpp>
#include <migraph/dead_code_elimination.hpp>
#include <migraph/operators.hpp>
#include <migraph
x
/common_subexpression_elimination.hpp>
#include <migraph
x
/dead_code_elimination.hpp>
#include <migraph
x
/operators.hpp>
#include <basic_ops.hpp>
#include <test.hpp>
struct
cse_target
{
std
::
string
name
()
const
{
return
"dce"
;
}
std
::
vector
<
migraph
::
pass
>
get_passes
(
migraph
::
context
&
)
const
std
::
vector
<
migraph
x
::
pass
>
get_passes
(
migraph
x
::
context
&
)
const
{
return
{
migraph
::
common_subexpression_elimination
{},
migraph
::
dead_code_elimination
{}};
return
{
migraph
x
::
common_subexpression_elimination
{},
migraph
x
::
dead_code_elimination
{}};
}
migraph
::
context
get_context
()
const
{
return
{};
}
migraph
x
::
context
get_context
()
const
{
return
{};
}
};
TEST_CASE
(
cse_test1
)
{
migraph
::
program
p1
;
migraph
x
::
program
p1
;
{
auto
one
=
p1
.
add_literal
(
1
);
auto
two
=
p1
.
add_literal
(
2
);
auto
sum1
=
p1
.
add_instruction
(
migraph
::
op
::
add
{},
one
,
two
);
auto
sum2
=
p1
.
add_instruction
(
migraph
::
op
::
add
{},
one
,
two
);
auto
sum3
=
p1
.
add_instruction
(
migraph
::
op
::
add
{},
sum1
,
sum2
);
auto
sum1
=
p1
.
add_instruction
(
migraph
x
::
op
::
add
{},
one
,
two
);
auto
sum2
=
p1
.
add_instruction
(
migraph
x
::
op
::
add
{},
one
,
two
);
auto
sum3
=
p1
.
add_instruction
(
migraph
x
::
op
::
add
{},
sum1
,
sum2
);
p1
.
add_instruction
(
pass_op
{},
sum3
);
}
p1
.
compile
(
cse_target
{});
migraph
::
program
p2
;
migraph
x
::
program
p2
;
{
auto
one
=
p2
.
add_literal
(
1
);
auto
two
=
p2
.
add_literal
(
2
);
auto
sum1
=
p2
.
add_instruction
(
migraph
::
op
::
add
{},
one
,
two
);
auto
sum3
=
p2
.
add_instruction
(
migraph
::
op
::
add
{},
sum1
,
sum1
);
auto
sum1
=
p2
.
add_instruction
(
migraph
x
::
op
::
add
{},
one
,
two
);
auto
sum3
=
p2
.
add_instruction
(
migraph
x
::
op
::
add
{},
sum1
,
sum1
);
p2
.
add_instruction
(
pass_op
{},
sum3
);
}
EXPECT
(
p1
==
p2
);
...
...
@@ -40,24 +40,24 @@ TEST_CASE(cse_test1)
TEST_CASE
(
cse_test2
)
{
migraph
::
program
p1
;
migraph
x
::
program
p1
;
{
auto
one
=
p1
.
add_literal
(
1
);
auto
two
=
p1
.
add_literal
(
2
);
auto
sum1
=
p1
.
add_instruction
(
migraph
::
op
::
add
{},
one
,
two
);
auto
sum2
=
p1
.
add_instruction
(
migraph
::
op
::
add
{},
two
,
one
);
auto
sum3
=
p1
.
add_instruction
(
migraph
::
op
::
add
{},
sum1
,
sum2
);
auto
sum1
=
p1
.
add_instruction
(
migraph
x
::
op
::
add
{},
one
,
two
);
auto
sum2
=
p1
.
add_instruction
(
migraph
x
::
op
::
add
{},
two
,
one
);
auto
sum3
=
p1
.
add_instruction
(
migraph
x
::
op
::
add
{},
sum1
,
sum2
);
p1
.
add_instruction
(
pass_op
{},
sum3
);
}
p1
.
compile
(
cse_target
{});
migraph
::
program
p2
;
migraph
x
::
program
p2
;
{
auto
one
=
p2
.
add_literal
(
1
);
auto
two
=
p2
.
add_literal
(
2
);
auto
sum1
=
p2
.
add_instruction
(
migraph
::
op
::
add
{},
one
,
two
);
auto
sum2
=
p2
.
add_instruction
(
migraph
::
op
::
add
{},
two
,
one
);
auto
sum3
=
p2
.
add_instruction
(
migraph
::
op
::
add
{},
sum1
,
sum2
);
auto
sum1
=
p2
.
add_instruction
(
migraph
x
::
op
::
add
{},
one
,
two
);
auto
sum2
=
p2
.
add_instruction
(
migraph
x
::
op
::
add
{},
two
,
one
);
auto
sum3
=
p2
.
add_instruction
(
migraph
x
::
op
::
add
{},
sum1
,
sum2
);
p2
.
add_instruction
(
pass_op
{},
sum3
);
}
EXPECT
(
p1
==
p2
);
...
...
@@ -65,22 +65,22 @@ TEST_CASE(cse_test2)
TEST_CASE
(
cse_test3
)
{
migraph
::
program
p1
;
migraph
x
::
program
p1
;
{
auto
one
=
p1
.
add_literal
(
1
);
auto
two
=
p1
.
add_literal
(
1
);
auto
sum1
=
p1
.
add_instruction
(
migraph
::
op
::
add
{},
one
,
two
);
auto
sum2
=
p1
.
add_instruction
(
migraph
::
op
::
add
{},
two
,
one
);
auto
sum3
=
p1
.
add_instruction
(
migraph
::
op
::
add
{},
sum1
,
sum2
);
auto
sum1
=
p1
.
add_instruction
(
migraph
x
::
op
::
add
{},
one
,
two
);
auto
sum2
=
p1
.
add_instruction
(
migraph
x
::
op
::
add
{},
two
,
one
);
auto
sum3
=
p1
.
add_instruction
(
migraph
x
::
op
::
add
{},
sum1
,
sum2
);
p1
.
add_instruction
(
pass_op
{},
sum3
);
}
p1
.
compile
(
cse_target
{});
migraph
::
program
p2
;
migraph
x
::
program
p2
;
{
auto
one
=
p2
.
add_literal
(
1
);
auto
sum1
=
p2
.
add_instruction
(
migraph
::
op
::
add
{},
one
,
one
);
auto
sum3
=
p2
.
add_instruction
(
migraph
::
op
::
add
{},
sum1
,
sum1
);
auto
sum1
=
p2
.
add_instruction
(
migraph
x
::
op
::
add
{},
one
,
one
);
auto
sum3
=
p2
.
add_instruction
(
migraph
x
::
op
::
add
{},
sum1
,
sum1
);
p2
.
add_instruction
(
pass_op
{},
sum3
);
}
EXPECT
(
p1
==
p2
);
...
...
@@ -88,25 +88,25 @@ TEST_CASE(cse_test3)
TEST_CASE
(
cse_test4
)
{
migraph
::
program
p1
;
migraph
x
::
program
p1
;
{
auto
one
=
p1
.
add_literal
(
1
);
auto
two
=
p1
.
add_literal
(
1
);
auto
sum1
=
p1
.
add_instruction
(
migraph
::
op
::
add
{},
one
,
two
);
auto
sum2
=
p1
.
add_instruction
(
migraph
::
op
::
add
{},
two
,
one
);
auto
sum3
=
p1
.
add_instruction
(
migraph
::
op
::
add
{},
sum1
,
one
);
auto
sum4
=
p1
.
add_instruction
(
migraph
::
op
::
add
{},
sum2
,
two
);
auto
sum5
=
p1
.
add_instruction
(
migraph
::
op
::
add
{},
sum4
,
sum3
);
auto
sum1
=
p1
.
add_instruction
(
migraph
x
::
op
::
add
{},
one
,
two
);
auto
sum2
=
p1
.
add_instruction
(
migraph
x
::
op
::
add
{},
two
,
one
);
auto
sum3
=
p1
.
add_instruction
(
migraph
x
::
op
::
add
{},
sum1
,
one
);
auto
sum4
=
p1
.
add_instruction
(
migraph
x
::
op
::
add
{},
sum2
,
two
);
auto
sum5
=
p1
.
add_instruction
(
migraph
x
::
op
::
add
{},
sum4
,
sum3
);
p1
.
add_instruction
(
pass_op
{},
sum5
);
}
p1
.
compile
(
cse_target
{});
migraph
::
program
p2
;
migraph
x
::
program
p2
;
{
auto
one
=
p2
.
add_literal
(
1
);
auto
sum1
=
p2
.
add_instruction
(
migraph
::
op
::
add
{},
one
,
one
);
auto
sum3
=
p2
.
add_instruction
(
migraph
::
op
::
add
{},
sum1
,
one
);
auto
sum5
=
p2
.
add_instruction
(
migraph
::
op
::
add
{},
sum3
,
sum3
);
auto
sum1
=
p2
.
add_instruction
(
migraph
x
::
op
::
add
{},
one
,
one
);
auto
sum3
=
p2
.
add_instruction
(
migraph
x
::
op
::
add
{},
sum1
,
one
);
auto
sum5
=
p2
.
add_instruction
(
migraph
x
::
op
::
add
{},
sum3
,
sum3
);
p2
.
add_instruction
(
pass_op
{},
sum5
);
}
EXPECT
(
p1
==
p2
);
...
...
Prev
1
…
4
5
6
7
8
9
10
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