Commit 96358e41 authored by Paul's avatar Paul
Browse files

Rename to migraphx

parent 80203608
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_HPP #ifndef MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_HPP #define MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_HPP
#include <migraph/manage_ptr.hpp> #include <migraphx/manage_ptr.hpp>
#include <migraph/operators.hpp> #include <migraphx/operators.hpp>
#include <miopen/miopen.h> #include <miopen/miopen.h>
#include <migraph/config.hpp> #include <migraphx/config.hpp>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -34,7 +34,7 @@ Result make_obj(F f, Ts... xs) ...@@ -34,7 +34,7 @@ Result make_obj(F f, Ts... xs)
return r; return r;
} }
inline tensor_descriptor make_tensor(const migraph::shape& s) inline tensor_descriptor make_tensor(const migraphx::shape& s)
{ {
auto t = make_obj<tensor_descriptor>(&miopenCreateTensorDescriptor); auto t = make_obj<tensor_descriptor>(&miopenCreateTensorDescriptor);
// Convert to ints // Convert to ints
...@@ -51,7 +51,7 @@ inline tensor_descriptor make_tensor(const migraph::shape& s) ...@@ -51,7 +51,7 @@ inline tensor_descriptor make_tensor(const migraph::shape& s)
return t; return t;
} }
inline convolution_descriptor make_conv(const migraph::op::convolution& op) inline convolution_descriptor make_conv(const migraphx::op::convolution& op)
{ {
auto c = make_obj<convolution_descriptor>(&miopenCreateConvolutionDescriptor); auto c = make_obj<convolution_descriptor>(&miopenCreateConvolutionDescriptor);
miopenInitConvolutionDescriptor(c.get(), miopenInitConvolutionDescriptor(c.get(),
...@@ -65,7 +65,7 @@ inline convolution_descriptor make_conv(const migraph::op::convolution& op) ...@@ -65,7 +65,7 @@ inline convolution_descriptor make_conv(const migraph::op::convolution& op)
return c; return c;
} }
inline pooling_descriptor make_pooling(const migraph::op::pooling& op) inline pooling_descriptor make_pooling(const migraphx::op::pooling& op)
{ {
miopenPoolingMode_t mode; miopenPoolingMode_t mode;
if(op.mode == "max") if(op.mode == "max")
...@@ -118,6 +118,6 @@ inline fused_operator_args make_fused_args() ...@@ -118,6 +118,6 @@ inline fused_operator_args make_fused_args()
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#endif #endif
#ifndef MIGRAPH_GUARD_RTGLIB_MUL_HPP #ifndef MIGRAPH_GUARD_RTGLIB_MUL_HPP
#define MIGRAPH_GUARD_RTGLIB_MUL_HPP #define MIGRAPH_GUARD_RTGLIB_MUL_HPP
#include <migraph/gpu/lowering.hpp> #include <migraphx/gpu/lowering.hpp>
#include <migraph/manage_ptr.hpp> #include <migraphx/manage_ptr.hpp>
#include <migraph/instruction.hpp> #include <migraphx/instruction.hpp>
#include <migraph/operators.hpp> #include <migraphx/operators.hpp>
#include <migraph/generate.hpp> #include <migraphx/generate.hpp>
#include <migraph/shape_for_each.hpp> #include <migraphx/shape_for_each.hpp>
#include <migraph/config.hpp> #include <migraphx/config.hpp>
#include <migraph/gpu/miopen.hpp> #include <migraphx/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp> #include <migraphx/gpu/hip.hpp>
#include <migraph/dfor.hpp> #include <migraphx/dfor.hpp>
#include <migraph/gpu/device/contiguous.hpp> #include <migraphx/gpu/device/contiguous.hpp>
#include <migraph/gpu/device/mul.hpp> #include <migraphx/gpu/device/mul.hpp>
#include <migraph/iterator_for.hpp> #include <migraphx/iterator_for.hpp>
#include <migraph/gpu/rocblas.hpp> #include <migraphx/gpu/rocblas.hpp>
#include <migraph/gpu/context.hpp> #include <migraphx/gpu/context.hpp>
#include <utility> #include <utility>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -32,6 +32,6 @@ struct hip_mul ...@@ -32,6 +32,6 @@ struct hip_mul
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#endif #endif
#ifndef MIGRAPH_GUARD_RTGLIB_POOLING_HPP #ifndef MIGRAPH_GUARD_RTGLIB_POOLING_HPP
#define MIGRAPH_GUARD_RTGLIB_POOLING_HPP #define MIGRAPH_GUARD_RTGLIB_POOLING_HPP
#include <migraph/gpu/lowering.hpp> #include <migraphx/gpu/lowering.hpp>
#include <migraph/manage_ptr.hpp> #include <migraphx/manage_ptr.hpp>
#include <migraph/instruction.hpp> #include <migraphx/instruction.hpp>
#include <migraph/operators.hpp> #include <migraphx/operators.hpp>
#include <migraph/generate.hpp> #include <migraphx/generate.hpp>
#include <migraph/shape_for_each.hpp> #include <migraphx/shape_for_each.hpp>
#include <migraph/config.hpp> #include <migraphx/config.hpp>
#include <migraph/gpu/miopen.hpp> #include <migraphx/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp> #include <migraphx/gpu/hip.hpp>
#include <migraph/dfor.hpp> #include <migraphx/dfor.hpp>
#include <migraph/gpu/device/contiguous.hpp> #include <migraphx/gpu/device/contiguous.hpp>
#include <migraph/gpu/device/add.hpp> #include <migraphx/gpu/device/add.hpp>
#include <migraph/iterator_for.hpp> #include <migraphx/iterator_for.hpp>
#include <migraph/gpu/rocblas.hpp> #include <migraphx/gpu/rocblas.hpp>
#include <migraph/gpu/context.hpp> #include <migraphx/gpu/context.hpp>
#include <utility> #include <utility>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -36,6 +36,6 @@ struct miopen_pooling ...@@ -36,6 +36,6 @@ struct miopen_pooling
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#endif #endif
#ifndef MIGRAPH_GUARD_RTGLIB_RELU_HPP #ifndef MIGRAPH_GUARD_RTGLIB_RELU_HPP
#define MIGRAPH_GUARD_RTGLIB_RELU_HPP #define MIGRAPH_GUARD_RTGLIB_RELU_HPP
#include <migraph/gpu/lowering.hpp> #include <migraphx/gpu/lowering.hpp>
#include <migraph/manage_ptr.hpp> #include <migraphx/manage_ptr.hpp>
#include <migraph/instruction.hpp> #include <migraphx/instruction.hpp>
#include <migraph/operators.hpp> #include <migraphx/operators.hpp>
#include <migraph/generate.hpp> #include <migraphx/generate.hpp>
#include <migraph/shape_for_each.hpp> #include <migraphx/shape_for_each.hpp>
#include <migraph/config.hpp> #include <migraphx/config.hpp>
#include <migraph/gpu/miopen.hpp> #include <migraphx/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp> #include <migraphx/gpu/hip.hpp>
#include <migraph/dfor.hpp> #include <migraphx/dfor.hpp>
#include <migraph/gpu/device/contiguous.hpp> #include <migraphx/gpu/device/contiguous.hpp>
#include <migraph/gpu/device/add.hpp> #include <migraphx/gpu/device/add.hpp>
#include <migraph/iterator_for.hpp> #include <migraphx/iterator_for.hpp>
#include <migraph/gpu/rocblas.hpp> #include <migraphx/gpu/rocblas.hpp>
#include <migraph/gpu/context.hpp> #include <migraphx/gpu/context.hpp>
#include <utility> #include <utility>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -34,6 +34,6 @@ struct miopen_relu ...@@ -34,6 +34,6 @@ struct miopen_relu
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#endif #endif
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_ROCBLAS_HPP #ifndef MIGRAPH_GUARD_MIGRAPHLIB_ROCBLAS_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_ROCBLAS_HPP #define MIGRAPH_GUARD_MIGRAPHLIB_ROCBLAS_HPP
#include <migraph/manage_ptr.hpp> #include <migraphx/manage_ptr.hpp>
#include <migraph/operators.hpp> #include <migraphx/operators.hpp>
#include <migraph/config.hpp> #include <migraphx/config.hpp>
#include <rocblas.h> #include <rocblas.h>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -17,6 +17,6 @@ rocblas_handle_ptr create_rocblas_handle_ptr(hipStream_t s); ...@@ -17,6 +17,6 @@ rocblas_handle_ptr create_rocblas_handle_ptr(hipStream_t s);
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#endif #endif
#ifndef MIGRAPH_GUARD_RTGLIB_SOFTMAX_HPP #ifndef MIGRAPH_GUARD_RTGLIB_SOFTMAX_HPP
#define MIGRAPH_GUARD_RTGLIB_SOFTMAX_HPP #define MIGRAPH_GUARD_RTGLIB_SOFTMAX_HPP
#include <migraph/gpu/lowering.hpp> #include <migraphx/gpu/lowering.hpp>
#include <migraph/manage_ptr.hpp> #include <migraphx/manage_ptr.hpp>
#include <migraph/instruction.hpp> #include <migraphx/instruction.hpp>
#include <migraph/operators.hpp> #include <migraphx/operators.hpp>
#include <migraph/generate.hpp> #include <migraphx/generate.hpp>
#include <migraph/shape_for_each.hpp> #include <migraphx/shape_for_each.hpp>
#include <migraph/config.hpp> #include <migraphx/config.hpp>
#include <migraph/gpu/miopen.hpp> #include <migraphx/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp> #include <migraphx/gpu/hip.hpp>
#include <migraph/dfor.hpp> #include <migraphx/dfor.hpp>
#include <migraph/gpu/device/contiguous.hpp> #include <migraphx/gpu/device/contiguous.hpp>
#include <migraph/gpu/device/add.hpp> #include <migraphx/gpu/device/add.hpp>
#include <migraph/iterator_for.hpp> #include <migraphx/iterator_for.hpp>
#include <migraph/gpu/rocblas.hpp> #include <migraphx/gpu/rocblas.hpp>
#include <migraph/gpu/context.hpp> #include <migraphx/gpu/context.hpp>
#include <utility> #include <utility>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -34,6 +34,6 @@ struct miopen_softmax ...@@ -34,6 +34,6 @@ struct miopen_softmax
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#endif #endif
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_TARGET_HPP #ifndef MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_TARGET_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_TARGET_HPP #define MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_TARGET_HPP
#include <migraph/program.hpp> #include <migraphx/program.hpp>
#include <migraph/config.hpp> #include <migraphx/config.hpp>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
struct target struct target
{ {
std::string name() const; std::string name() const;
std::vector<pass> get_passes(migraph::context& gctx) const; std::vector<pass> get_passes(migraphx::context& gctx) const;
migraph::context get_context() const; migraphx::context get_context() const;
}; };
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#endif #endif
#ifndef MIGRAPH_GUARD_RTGLIB_MIOPEN_WRITE_LITERALS_HPP #ifndef MIGRAPH_GUARD_RTGLIB_MIOPEN_WRITE_LITERALS_HPP
#define MIGRAPH_GUARD_RTGLIB_MIOPEN_WRITE_LITERALS_HPP #define MIGRAPH_GUARD_RTGLIB_MIOPEN_WRITE_LITERALS_HPP
#include <migraph/program.hpp> #include <migraphx/program.hpp>
#include <migraph/gpu/context.hpp> #include <migraphx/gpu/context.hpp>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -19,6 +19,6 @@ struct write_literals ...@@ -19,6 +19,6 @@ struct write_literals
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#endif #endif
#include <migraph/gpu/leaky_relu.hpp> #include <migraphx/gpu/leaky_relu.hpp>
#include <migraph/operators.hpp> #include <migraphx/operators.hpp>
#include <migraph/manage_ptr.hpp> #include <migraphx/manage_ptr.hpp>
#include <migraph/gpu/miopen.hpp> #include <migraphx/gpu/miopen.hpp>
#include <utility> #include <utility>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -35,4 +35,4 @@ argument miopen_leaky_relu::compute(context& ctx, ...@@ -35,4 +35,4 @@ argument miopen_leaky_relu::compute(context& ctx,
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#include <rocblas.h> #include <rocblas.h>
#include <migraph/gpu/lowering.hpp> #include <migraphx/gpu/lowering.hpp>
#include <migraph/manage_ptr.hpp> #include <migraphx/manage_ptr.hpp>
#include <migraph/instruction.hpp> #include <migraphx/instruction.hpp>
#include <migraph/operators.hpp> #include <migraphx/operators.hpp>
#include <migraph/generate.hpp> #include <migraphx/generate.hpp>
#include <migraph/shape_for_each.hpp> #include <migraphx/shape_for_each.hpp>
#include <migraph/gpu/miopen.hpp> #include <migraphx/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp> #include <migraphx/gpu/hip.hpp>
#include <migraph/dfor.hpp> #include <migraphx/dfor.hpp>
#include <migraph/gpu/device/contiguous.hpp> #include <migraphx/gpu/device/contiguous.hpp>
#include <migraph/gpu/device/add.hpp> #include <migraphx/gpu/device/add.hpp>
#include <migraph/iterator_for.hpp> #include <migraphx/iterator_for.hpp>
#include <migraph/gpu/rocblas.hpp> #include <migraphx/gpu/rocblas.hpp>
#include <migraph/gpu/context.hpp> #include <migraphx/gpu/context.hpp>
#include <migraph/gpu/convolution.hpp> #include <migraphx/gpu/convolution.hpp>
#include <migraph/gpu/contiguous.hpp> #include <migraphx/gpu/contiguous.hpp>
#include <migraph/gpu/relu.hpp> #include <migraphx/gpu/relu.hpp>
#include <migraph/gpu/leaky_relu.hpp> #include <migraphx/gpu/leaky_relu.hpp>
#include <migraph/gpu/softmax.hpp> #include <migraphx/gpu/softmax.hpp>
#include <migraph/gpu/add.hpp> #include <migraphx/gpu/add.hpp>
#include <migraph/gpu/mul.hpp> #include <migraphx/gpu/mul.hpp>
#include <migraph/gpu/batchnorm.hpp> #include <migraphx/gpu/batchnorm.hpp>
#include <migraph/gpu/pooling.hpp> #include <migraphx/gpu/pooling.hpp>
#include <migraph/gpu/gemm.hpp> #include <migraphx/gpu/gemm.hpp>
#include <migraph/gpu/concat.hpp> #include <migraphx/gpu/concat.hpp>
#include <utility> #include <utility>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -222,4 +222,4 @@ struct miopen_apply ...@@ -222,4 +222,4 @@ struct miopen_apply
void lowering::apply(program& p) const { miopen_apply{&p, ctx}.apply(); } void lowering::apply(program& p) const { miopen_apply{&p, ctx}.apply(); }
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#include <migraph/gpu/mul.hpp> #include <migraphx/gpu/mul.hpp>
#include <migraph/operators.hpp> #include <migraphx/operators.hpp>
#include <migraph/manage_ptr.hpp> #include <migraphx/manage_ptr.hpp>
#include <migraph/gpu/miopen.hpp> #include <migraphx/gpu/miopen.hpp>
#include <utility> #include <utility>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -23,4 +23,4 @@ argument hip_mul::compute(context& ctx, const shape&, const std::vector<argument ...@@ -23,4 +23,4 @@ argument hip_mul::compute(context& ctx, const shape&, const std::vector<argument
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#include <migraph/gpu/pooling.hpp> #include <migraphx/gpu/pooling.hpp>
#include <migraph/operators.hpp> #include <migraphx/operators.hpp>
#include <migraph/manage_ptr.hpp> #include <migraphx/manage_ptr.hpp>
#include <migraph/gpu/miopen.hpp> #include <migraphx/gpu/miopen.hpp>
#include <utility> #include <utility>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -39,4 +39,4 @@ argument miopen_pooling::compute(context& ctx, ...@@ -39,4 +39,4 @@ argument miopen_pooling::compute(context& ctx,
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#include <migraph/gpu/relu.hpp> #include <migraphx/gpu/relu.hpp>
#include <migraph/operators.hpp> #include <migraphx/operators.hpp>
#include <migraph/manage_ptr.hpp> #include <migraphx/manage_ptr.hpp>
#include <migraph/gpu/miopen.hpp> #include <migraphx/gpu/miopen.hpp>
#include <utility> #include <utility>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -35,4 +35,4 @@ argument miopen_relu::compute(context& ctx, ...@@ -35,4 +35,4 @@ argument miopen_relu::compute(context& ctx,
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#include <migraph/gpu/rocblas.hpp> #include <migraphx/gpu/rocblas.hpp>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -20,4 +20,4 @@ rocblas_handle_ptr create_rocblas_handle_ptr(hipStream_t s) ...@@ -20,4 +20,4 @@ rocblas_handle_ptr create_rocblas_handle_ptr(hipStream_t s)
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#include <migraph/gpu/softmax.hpp> #include <migraphx/gpu/softmax.hpp>
#include <migraph/operators.hpp> #include <migraphx/operators.hpp>
#include <migraph/manage_ptr.hpp> #include <migraphx/manage_ptr.hpp>
#include <migraph/gpu/miopen.hpp> #include <migraphx/gpu/miopen.hpp>
#include <utility> #include <utility>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -34,4 +34,4 @@ argument miopen_softmax::compute(context& ctx, ...@@ -34,4 +34,4 @@ argument miopen_softmax::compute(context& ctx,
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#include <migraph/gpu/target.hpp> #include <migraphx/gpu/target.hpp>
#include <migraph/gpu/lowering.hpp> #include <migraphx/gpu/lowering.hpp>
#include <migraph/memory_coloring.hpp> #include <migraphx/memory_coloring.hpp>
#include <migraph/gpu/write_literals.hpp> #include <migraphx/gpu/write_literals.hpp>
#include <migraph/gpu/context.hpp> #include <migraphx/gpu/context.hpp>
#include <migraph/gpu/eliminate_workspace.hpp> #include <migraphx/gpu/eliminate_workspace.hpp>
#include <migraph/eliminate_allocation.hpp> #include <migraphx/eliminate_allocation.hpp>
#include <migraph/gpu/fuse_ops.hpp> #include <migraphx/gpu/fuse_ops.hpp>
#include <migraph/check_context.hpp> #include <migraphx/check_context.hpp>
#include <migraph/auto_contiguous.hpp> #include <migraphx/auto_contiguous.hpp>
#include <migraph/dead_code_elimination.hpp> #include <migraphx/dead_code_elimination.hpp>
#include <migraph/simplify_reshapes.hpp> #include <migraphx/simplify_reshapes.hpp>
#include <migraph/simplify_algebra.hpp> #include <migraphx/simplify_algebra.hpp>
#include <migraph/constant_propagate.hpp> #include <migraphx/constant_propagate.hpp>
#include <migraph/eliminate_contiguous.hpp> #include <migraphx/eliminate_contiguous.hpp>
#include <migraph/common_subexpression_elimination.hpp> #include <migraphx/common_subexpression_elimination.hpp>
#include <migraph/fwd_conv_batchnorm_rewrite.hpp> #include <migraphx/fwd_conv_batchnorm_rewrite.hpp>
#include <migraph/eliminate_concat.hpp> #include <migraphx/eliminate_concat.hpp>
#include <migraph/gpu/concat_gpu_opt.hpp> #include <migraphx/gpu/concat_gpu_opt.hpp>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
std::vector<pass> target::get_passes(migraph::context& gctx) const std::vector<pass> target::get_passes(migraphx::context& gctx) const
{ {
auto& ctx = any_cast<context>(gctx); auto& ctx = any_cast<context>(gctx);
// clang-format off // clang-format off
...@@ -59,7 +59,7 @@ std::vector<pass> target::get_passes(migraph::context& gctx) const ...@@ -59,7 +59,7 @@ std::vector<pass> target::get_passes(migraph::context& gctx) const
std::string target::name() const { return "miopen"; } std::string target::name() const { return "miopen"; }
migraph::context target::get_context() const { return context{}; } migraphx::context target::get_context() const { return context{}; }
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
#include <migraph/gpu/write_literals.hpp> #include <migraphx/gpu/write_literals.hpp>
#include <migraph/iterator_for.hpp> #include <migraphx/iterator_for.hpp>
#include <migraph/gpu/hip.hpp> #include <migraphx/gpu/hip.hpp>
#include <migraph/instruction.hpp> #include <migraphx/instruction.hpp>
#include <migraph/env.hpp> #include <migraphx/env.hpp>
namespace migraph { namespace migraphx {
inline namespace MIGRAPH_INLINE_NS { inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -54,4 +54,4 @@ void write_literals::apply(program& p) const ...@@ -54,4 +54,4 @@ void write_literals::apply(program& p) const
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS } // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraphx
...@@ -83,7 +83,7 @@ function(add_test_executable TEST_NAME) ...@@ -83,7 +83,7 @@ function(add_test_executable TEST_NAME)
add_dependencies(tests ${TEST_NAME}) add_dependencies(tests ${TEST_NAME})
add_dependencies(check ${TEST_NAME}) add_dependencies(check ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED") 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} migraphx migraphx_cpu migraphx_onnx)
target_include_directories(${TEST_NAME} PUBLIC include) target_include_directories(${TEST_NAME} PUBLIC include)
endfunction(add_test_executable) endfunction(add_test_executable)
...@@ -107,14 +107,14 @@ if(MIGRAPH_ENABLE_GPU) ...@@ -107,14 +107,14 @@ if(MIGRAPH_ENABLE_GPU)
COST 10 COST 10
RESOURCE_LOCK gpu RESOURCE_LOCK gpu
) )
target_link_libraries(test_gpu_${BASE_NAME} migraph_gpu) target_link_libraries(test_gpu_${BASE_NAME} migraphx_gpu)
endforeach() endforeach()
endif() endif()
# Onnx test # Onnx test
add_executable(test_onnx onnx/onnx_test.cpp) add_executable(test_onnx onnx/onnx_test.cpp)
rocm_clang_tidy_check(test_onnx) rocm_clang_tidy_check(test_onnx)
target_link_libraries(test_onnx migraph_onnx) target_link_libraries(test_onnx migraphx_onnx)
target_include_directories(test_onnx PUBLIC include) 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_test(NAME test_onnx COMMAND $<TARGET_FILE:test_onnx> WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/onnx)
add_dependencies(tests test_onnx) add_dependencies(tests test_onnx)
...@@ -143,13 +143,13 @@ function(test_headers PREFIX) ...@@ -143,13 +143,13 @@ function(test_headers PREFIX)
get_filename_component(BASE_NAME ${HEADER} NAME_WE) get_filename_component(BASE_NAME ${HEADER} NAME_WE)
test_header(header_${TEST_NAME} ${PREFIX}/${BASE_NAME}.hpp) test_header(header_${TEST_NAME} ${PREFIX}/${BASE_NAME}.hpp)
if(MIGRAPH_ENABLE_GPU) if(MIGRAPH_ENABLE_GPU)
target_link_libraries(header_${TEST_NAME} migraph_gpu) target_link_libraries(header_${TEST_NAME} migraphx_gpu)
endif() endif()
endforeach() endforeach()
endfunction() endfunction()
test_headers(migraph ${CMAKE_SOURCE_DIR}/src/include/migraph/*.hpp) test_headers(migraphx ${CMAKE_SOURCE_DIR}/src/include/migraphx/*.hpp)
test_headers(migraph/cpu ${CMAKE_SOURCE_DIR}/src/targets/cpu/include/migraph/cpu/*.hpp) test_headers(migraphx/cpu ${CMAKE_SOURCE_DIR}/src/targets/cpu/include/migraphx/cpu/*.hpp)
if(MIGRAPH_ENABLE_GPU) if(MIGRAPH_ENABLE_GPU)
test_headers(migraph/gpu ${CMAKE_SOURCE_DIR}/src/targets/gpu/include/migraph/gpu/*.hpp) test_headers(migraphx/gpu ${CMAKE_SOURCE_DIR}/src/targets/gpu/include/migraphx/gpu/*.hpp)
endif() endif()
#include <migraph/auto_contiguous.hpp> #include <migraphx/auto_contiguous.hpp>
#include <migraph/operators.hpp> #include <migraphx/operators.hpp>
#include <migraph/instruction.hpp> #include <migraphx/instruction.hpp>
#include <basic_ops.hpp> #include <basic_ops.hpp>
#include <test.hpp> #include <test.hpp>
struct contiguous_target struct contiguous_target
{ {
std::string name() const { return "contiguous"; } std::string name() const { return "contiguous"; }
std::vector<migraph::pass> get_passes(migraph::context&) const std::vector<migraphx::pass> get_passes(migraphx::context&) const
{ {
return {migraph::auto_contiguous{}}; return {migraphx::auto_contiguous{}};
} }
migraph::context get_context() const { return {}; } migraphx::context get_context() const { return {}; }
}; };
// TODO: Add this test case // TODO: Add this test case
void literal_broadcast() void literal_broadcast()
{ {
migraph::program p; migraphx::program p;
p.add_literal(get_2_broadcasted()); p.add_literal(get_2_broadcasted());
EXPECT(not p.get_shape().standard()); EXPECT(not p.get_shape().standard());
EXPECT(p.get_shape().broadcasted()); EXPECT(p.get_shape().broadcasted());
...@@ -28,7 +28,7 @@ void literal_broadcast() ...@@ -28,7 +28,7 @@ void literal_broadcast()
TEST_CASE(literal_transpose) TEST_CASE(literal_transpose)
{ {
migraph::program p; migraphx::program p;
p.add_literal(get_2x2_transposed()); p.add_literal(get_2x2_transposed());
EXPECT(not p.get_shape().standard()); EXPECT(not p.get_shape().standard());
EXPECT(p.get_shape().transposed()); EXPECT(p.get_shape().transposed());
...@@ -39,11 +39,11 @@ TEST_CASE(literal_transpose) ...@@ -39,11 +39,11 @@ TEST_CASE(literal_transpose)
TEST_CASE(after_literal_transpose) TEST_CASE(after_literal_transpose)
{ {
migraph::program p; migraphx::program p;
auto l = p.add_literal(get_2x2()); auto l = p.add_literal(get_2x2());
EXPECT(p.get_shape().standard()); EXPECT(p.get_shape().standard());
EXPECT(not p.get_shape().transposed()); EXPECT(not p.get_shape().transposed());
auto t = p.add_instruction(migraph::op::transpose{{1, 0}}, l); auto t = p.add_instruction(migraphx::op::transpose{{1, 0}}, l);
p.add_instruction(pass_op{}, t); p.add_instruction(pass_op{}, t);
EXPECT(not p.get_shape().standard()); EXPECT(not p.get_shape().standard());
EXPECT(p.get_shape().transposed()); EXPECT(p.get_shape().transposed());
...@@ -54,12 +54,12 @@ TEST_CASE(after_literal_transpose) ...@@ -54,12 +54,12 @@ TEST_CASE(after_literal_transpose)
TEST_CASE(after_literal_broadcast) TEST_CASE(after_literal_broadcast)
{ {
migraph::program p; migraphx::program p;
auto l1 = p.add_literal(get_2x2()); auto l1 = p.add_literal(get_2x2());
auto l2 = p.add_literal(get_2()); auto l2 = p.add_literal(get_2());
EXPECT(p.get_shape().standard()); EXPECT(p.get_shape().standard());
EXPECT(not p.get_shape().broadcasted()); EXPECT(not p.get_shape().broadcasted());
auto b = p.add_instruction(migraph::op::broadcast{0, l1->get_shape()}, l2); auto b = p.add_instruction(migraphx::op::broadcast{0, l1->get_shape()}, l2);
p.add_instruction(pass_op{}, b); p.add_instruction(pass_op{}, b);
EXPECT(not p.get_shape().standard()); EXPECT(not p.get_shape().standard());
EXPECT(p.get_shape().broadcasted()); EXPECT(p.get_shape().broadcasted());
...@@ -70,11 +70,11 @@ TEST_CASE(after_literal_broadcast) ...@@ -70,11 +70,11 @@ TEST_CASE(after_literal_broadcast)
TEST_CASE(after_param_transpose) TEST_CASE(after_param_transpose)
{ {
migraph::program p; migraphx::program p;
auto l = p.add_parameter("2x2", {migraph::shape::float_type, {2, 2}}); auto l = p.add_parameter("2x2", {migraphx::shape::float_type, {2, 2}});
EXPECT(p.get_shape().standard()); EXPECT(p.get_shape().standard());
EXPECT(not p.get_shape().transposed()); EXPECT(not p.get_shape().transposed());
auto t = p.add_instruction(migraph::op::transpose{{1, 0}}, l); auto t = p.add_instruction(migraphx::op::transpose{{1, 0}}, l);
p.add_instruction(pass_op{}, t); p.add_instruction(pass_op{}, t);
EXPECT(not p.get_shape().standard()); EXPECT(not p.get_shape().standard());
EXPECT(p.get_shape().transposed()); EXPECT(p.get_shape().transposed());
...@@ -85,12 +85,12 @@ TEST_CASE(after_param_transpose) ...@@ -85,12 +85,12 @@ TEST_CASE(after_param_transpose)
TEST_CASE(after_param_broadcast) TEST_CASE(after_param_broadcast)
{ {
migraph::program p; migraphx::program p;
auto l1 = p.add_parameter("2x2", {migraph::shape::float_type, {2, 2}}); auto l1 = p.add_parameter("2x2", {migraphx::shape::float_type, {2, 2}});
auto l2 = p.add_parameter("2", {migraph::shape::float_type, {2}}); auto l2 = p.add_parameter("2", {migraphx::shape::float_type, {2}});
EXPECT(p.get_shape().standard()); EXPECT(p.get_shape().standard());
EXPECT(not p.get_shape().broadcasted()); EXPECT(not p.get_shape().broadcasted());
auto b = p.add_instruction(migraph::op::broadcast{0, l1->get_shape()}, l2); auto b = p.add_instruction(migraphx::op::broadcast{0, l1->get_shape()}, l2);
p.add_instruction(pass_op{}, b); p.add_instruction(pass_op{}, b);
EXPECT(not p.get_shape().standard()); EXPECT(not p.get_shape().standard());
EXPECT(p.get_shape().broadcasted()); EXPECT(p.get_shape().broadcasted());
......
#include <migraph/common_subexpression_elimination.hpp> #include <migraphx/common_subexpression_elimination.hpp>
#include <migraph/dead_code_elimination.hpp> #include <migraphx/dead_code_elimination.hpp>
#include <migraph/operators.hpp> #include <migraphx/operators.hpp>
#include <basic_ops.hpp> #include <basic_ops.hpp>
#include <test.hpp> #include <test.hpp>
struct cse_target struct cse_target
{ {
std::string name() const { return "dce"; } std::string name() const { return "dce"; }
std::vector<migraph::pass> get_passes(migraph::context&) const std::vector<migraphx::pass> get_passes(migraphx::context&) const
{ {
return {migraph::common_subexpression_elimination{}, migraph::dead_code_elimination{}}; return {migraphx::common_subexpression_elimination{}, migraphx::dead_code_elimination{}};
} }
migraph::context get_context() const { return {}; } migraphx::context get_context() const { return {}; }
}; };
TEST_CASE(cse_test1) TEST_CASE(cse_test1)
{ {
migraph::program p1; migraphx::program p1;
{ {
auto one = p1.add_literal(1); auto one = p1.add_literal(1);
auto two = p1.add_literal(2); auto two = p1.add_literal(2);
auto sum1 = p1.add_instruction(migraph::op::add{}, one, two); auto sum1 = p1.add_instruction(migraphx::op::add{}, one, two);
auto sum2 = p1.add_instruction(migraph::op::add{}, one, two); auto sum2 = p1.add_instruction(migraphx::op::add{}, one, two);
auto sum3 = p1.add_instruction(migraph::op::add{}, sum1, sum2); auto sum3 = p1.add_instruction(migraphx::op::add{}, sum1, sum2);
p1.add_instruction(pass_op{}, sum3); p1.add_instruction(pass_op{}, sum3);
} }
p1.compile(cse_target{}); p1.compile(cse_target{});
migraph::program p2; migraphx::program p2;
{ {
auto one = p2.add_literal(1); auto one = p2.add_literal(1);
auto two = p2.add_literal(2); auto two = p2.add_literal(2);
auto sum1 = p2.add_instruction(migraph::op::add{}, one, two); auto sum1 = p2.add_instruction(migraphx::op::add{}, one, two);
auto sum3 = p2.add_instruction(migraph::op::add{}, sum1, sum1); auto sum3 = p2.add_instruction(migraphx::op::add{}, sum1, sum1);
p2.add_instruction(pass_op{}, sum3); p2.add_instruction(pass_op{}, sum3);
} }
EXPECT(p1 == p2); EXPECT(p1 == p2);
...@@ -40,24 +40,24 @@ TEST_CASE(cse_test1) ...@@ -40,24 +40,24 @@ TEST_CASE(cse_test1)
TEST_CASE(cse_test2) TEST_CASE(cse_test2)
{ {
migraph::program p1; migraphx::program p1;
{ {
auto one = p1.add_literal(1); auto one = p1.add_literal(1);
auto two = p1.add_literal(2); auto two = p1.add_literal(2);
auto sum1 = p1.add_instruction(migraph::op::add{}, one, two); auto sum1 = p1.add_instruction(migraphx::op::add{}, one, two);
auto sum2 = p1.add_instruction(migraph::op::add{}, two, one); auto sum2 = p1.add_instruction(migraphx::op::add{}, two, one);
auto sum3 = p1.add_instruction(migraph::op::add{}, sum1, sum2); auto sum3 = p1.add_instruction(migraphx::op::add{}, sum1, sum2);
p1.add_instruction(pass_op{}, sum3); p1.add_instruction(pass_op{}, sum3);
} }
p1.compile(cse_target{}); p1.compile(cse_target{});
migraph::program p2; migraphx::program p2;
{ {
auto one = p2.add_literal(1); auto one = p2.add_literal(1);
auto two = p2.add_literal(2); auto two = p2.add_literal(2);
auto sum1 = p2.add_instruction(migraph::op::add{}, one, two); auto sum1 = p2.add_instruction(migraphx::op::add{}, one, two);
auto sum2 = p2.add_instruction(migraph::op::add{}, two, one); auto sum2 = p2.add_instruction(migraphx::op::add{}, two, one);
auto sum3 = p2.add_instruction(migraph::op::add{}, sum1, sum2); auto sum3 = p2.add_instruction(migraphx::op::add{}, sum1, sum2);
p2.add_instruction(pass_op{}, sum3); p2.add_instruction(pass_op{}, sum3);
} }
EXPECT(p1 == p2); EXPECT(p1 == p2);
...@@ -65,22 +65,22 @@ TEST_CASE(cse_test2) ...@@ -65,22 +65,22 @@ TEST_CASE(cse_test2)
TEST_CASE(cse_test3) TEST_CASE(cse_test3)
{ {
migraph::program p1; migraphx::program p1;
{ {
auto one = p1.add_literal(1); auto one = p1.add_literal(1);
auto two = p1.add_literal(1); auto two = p1.add_literal(1);
auto sum1 = p1.add_instruction(migraph::op::add{}, one, two); auto sum1 = p1.add_instruction(migraphx::op::add{}, one, two);
auto sum2 = p1.add_instruction(migraph::op::add{}, two, one); auto sum2 = p1.add_instruction(migraphx::op::add{}, two, one);
auto sum3 = p1.add_instruction(migraph::op::add{}, sum1, sum2); auto sum3 = p1.add_instruction(migraphx::op::add{}, sum1, sum2);
p1.add_instruction(pass_op{}, sum3); p1.add_instruction(pass_op{}, sum3);
} }
p1.compile(cse_target{}); p1.compile(cse_target{});
migraph::program p2; migraphx::program p2;
{ {
auto one = p2.add_literal(1); auto one = p2.add_literal(1);
auto sum1 = p2.add_instruction(migraph::op::add{}, one, one); auto sum1 = p2.add_instruction(migraphx::op::add{}, one, one);
auto sum3 = p2.add_instruction(migraph::op::add{}, sum1, sum1); auto sum3 = p2.add_instruction(migraphx::op::add{}, sum1, sum1);
p2.add_instruction(pass_op{}, sum3); p2.add_instruction(pass_op{}, sum3);
} }
EXPECT(p1 == p2); EXPECT(p1 == p2);
...@@ -88,25 +88,25 @@ TEST_CASE(cse_test3) ...@@ -88,25 +88,25 @@ TEST_CASE(cse_test3)
TEST_CASE(cse_test4) TEST_CASE(cse_test4)
{ {
migraph::program p1; migraphx::program p1;
{ {
auto one = p1.add_literal(1); auto one = p1.add_literal(1);
auto two = p1.add_literal(1); auto two = p1.add_literal(1);
auto sum1 = p1.add_instruction(migraph::op::add{}, one, two); auto sum1 = p1.add_instruction(migraphx::op::add{}, one, two);
auto sum2 = p1.add_instruction(migraph::op::add{}, two, one); auto sum2 = p1.add_instruction(migraphx::op::add{}, two, one);
auto sum3 = p1.add_instruction(migraph::op::add{}, sum1, one); auto sum3 = p1.add_instruction(migraphx::op::add{}, sum1, one);
auto sum4 = p1.add_instruction(migraph::op::add{}, sum2, two); auto sum4 = p1.add_instruction(migraphx::op::add{}, sum2, two);
auto sum5 = p1.add_instruction(migraph::op::add{}, sum4, sum3); auto sum5 = p1.add_instruction(migraphx::op::add{}, sum4, sum3);
p1.add_instruction(pass_op{}, sum5); p1.add_instruction(pass_op{}, sum5);
} }
p1.compile(cse_target{}); p1.compile(cse_target{});
migraph::program p2; migraphx::program p2;
{ {
auto one = p2.add_literal(1); auto one = p2.add_literal(1);
auto sum1 = p2.add_instruction(migraph::op::add{}, one, one); auto sum1 = p2.add_instruction(migraphx::op::add{}, one, one);
auto sum3 = p2.add_instruction(migraph::op::add{}, sum1, one); auto sum3 = p2.add_instruction(migraphx::op::add{}, sum1, one);
auto sum5 = p2.add_instruction(migraph::op::add{}, sum3, sum3); auto sum5 = p2.add_instruction(migraphx::op::add{}, sum3, sum3);
p2.add_instruction(pass_op{}, sum5); p2.add_instruction(pass_op{}, sum5);
} }
EXPECT(p1 == p2); EXPECT(p1 == p2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment