Unverified Commit ee80cee9 authored by Paul Fultz II's avatar Paul Fultz II Committed by GitHub
Browse files

Merge branch 'master' into gpu_slice_test

parents 6d06226d f958d56f
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,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 {
...@@ -13,4 +14,5 @@ void contiguous(hipStream_t stream, argument result, argument arg) ...@@ -13,4 +14,5 @@ void contiguous(hipStream_t stream, argument result, argument arg)
} // namespace device } // namespace device
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
#define MIGRAPH_GUARD_RTGLIB_DEVICE_LAUNCH_HPP #define MIGRAPH_GUARD_RTGLIB_DEVICE_LAUNCH_HPP
#include <hip/hip_runtime.h> #include <hip/hip_runtime.h>
#include <migraph/config.hpp>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
namespace device { namespace device {
...@@ -58,6 +60,7 @@ inline auto gs_launch(hipStream_t stream, std::size_t n, std::size_t local = 102 ...@@ -58,6 +60,7 @@ inline auto gs_launch(hipStream_t stream, std::size_t n, std::size_t local = 102
} // namespace device } // namespace device
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -6,8 +6,10 @@ ...@@ -6,8 +6,10 @@
#include <migraph/gpu/device/types.hpp> #include <migraph/gpu/device/types.hpp>
#include <migraph/functional.hpp> #include <migraph/functional.hpp>
#include <migraph/ranges.hpp> #include <migraph/ranges.hpp>
#include <migraph/config.hpp>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
namespace device { namespace device {
...@@ -394,6 +396,7 @@ inline auto nary(hipStream_t stream, ...@@ -394,6 +396,7 @@ inline auto nary(hipStream_t stream,
} // namespace device } // namespace device
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -3,8 +3,10 @@ ...@@ -3,8 +3,10 @@
#include <hip/hip_runtime.h> #include <hip/hip_runtime.h>
#include <migraph/functional.hpp> #include <migraph/functional.hpp>
#include <migraph/config.hpp>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
namespace device { namespace device {
...@@ -85,6 +87,7 @@ struct hip_tensor_descriptor ...@@ -85,6 +87,7 @@ struct hip_tensor_descriptor
} // namespace device } // namespace device
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -9,8 +9,10 @@ ...@@ -9,8 +9,10 @@
#define MIGRAPH_GUARD_RTGLIB_GPU_DEVICE_TYPES_HPP #define MIGRAPH_GUARD_RTGLIB_GPU_DEVICE_TYPES_HPP
#include <migraph/half.hpp> #include <migraph/half.hpp>
#include <migraph/config.hpp>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
namespace device { namespace device {
...@@ -75,6 +77,7 @@ device_type<T>* device_cast(T* x) ...@@ -75,6 +77,7 @@ device_type<T>* device_cast(T* x)
} // namespace device } // namespace device
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -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 mul(hipStream_t stream, ...@@ -21,4 +22,5 @@ void mul(hipStream_t stream,
} // namespace device } // namespace device
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <migraph/pass_config.hpp> #include <migraph/pass_config.hpp>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
void eliminate_workspace::apply(program& p) const void eliminate_workspace::apply(program& p) const
...@@ -38,5 +39,7 @@ void eliminate_workspace::apply(program& p) const ...@@ -38,5 +39,7 @@ void eliminate_workspace::apply(program& p) const
p.remove_instruction(a); p.remove_instruction(a);
} }
} }
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <migraph/instruction.hpp> #include <migraph/instruction.hpp>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
struct fusion struct fusion
...@@ -382,5 +382,5 @@ void fuse_ops::apply(program& p) const ...@@ -382,5 +382,5 @@ void fuse_ops::apply(program& p) const
} }
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
...@@ -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_gemm::compute_shape(const std::vector<shape>& inputs) const shape miopen_gemm::compute_shape(const std::vector<shape>& inputs) const
...@@ -44,5 +45,5 @@ argument miopen_gemm::compute(context& ctx, ...@@ -44,5 +45,5 @@ argument miopen_gemm::compute(context& ctx,
} }
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <vector> #include <vector>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
using hip_ptr = MIGRAPH_MANAGE_PTR(void, hipFree); using hip_ptr = MIGRAPH_MANAGE_PTR(void, hipFree);
...@@ -107,5 +108,7 @@ void copy_to_gpu(argument src, argument dst) ...@@ -107,5 +108,7 @@ void copy_to_gpu(argument src, argument dst)
if(status != hipSuccess) if(status != hipSuccess)
MIGRAPH_THROW("Copy to gpu failed: " + hip_error(status)); MIGRAPH_THROW("Copy to gpu failed: " + hip_error(status));
} }
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
...@@ -15,9 +15,11 @@ ...@@ -15,9 +15,11 @@
#include <migraph/iterator_for.hpp> #include <migraph/iterator_for.hpp>
#include <migraph/gpu/rocblas.hpp> #include <migraph/gpu/rocblas.hpp>
#include <migraph/gpu/context.hpp> #include <migraph/gpu/context.hpp>
#include <migraph/config.hpp>
#include <utility> #include <utility>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
struct hip_add struct hip_add
...@@ -25,6 +27,7 @@ struct hip_add ...@@ -25,6 +27,7 @@ struct hip_add
std::string name() const { return "gpu::add"; } std::string name() const { return "gpu::add"; }
shape compute_shape(const std::vector<shape>& inputs) const; shape compute_shape(const std::vector<shape>& inputs) const;
argument compute(context&, const shape&, const std::vector<argument>& args) const; argument compute(context&, const shape&, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
struct miopen_add struct miopen_add
...@@ -33,10 +36,11 @@ struct miopen_add ...@@ -33,10 +36,11 @@ struct miopen_add
shape compute_shape(const std::vector<shape>& inputs) const; shape compute_shape(const std::vector<shape>& inputs) const;
argument argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const; compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -15,9 +15,11 @@ ...@@ -15,9 +15,11 @@
#include <migraph/iterator_for.hpp> #include <migraph/iterator_for.hpp>
#include <migraph/gpu/rocblas.hpp> #include <migraph/gpu/rocblas.hpp>
#include <migraph/gpu/context.hpp> #include <migraph/gpu/context.hpp>
#include <migraph/config.hpp>
#include <utility> #include <utility>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
struct miopen_batch_norm_inference struct miopen_batch_norm_inference
...@@ -27,10 +29,11 @@ struct miopen_batch_norm_inference ...@@ -27,10 +29,11 @@ struct miopen_batch_norm_inference
shape compute_shape(const std::vector<shape>& inputs) const; shape compute_shape(const std::vector<shape>& inputs) const;
argument argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const; compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <migraph/operators.hpp> #include <migraph/operators.hpp>
#include <migraph/generate.hpp> #include <migraph/generate.hpp>
#include <migraph/shape_for_each.hpp> #include <migraph/shape_for_each.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/miopen.hpp> #include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp> #include <migraph/gpu/hip.hpp>
#include <migraph/dfor.hpp> #include <migraph/dfor.hpp>
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
#include <utility> #include <utility>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
struct hip_concat struct hip_concat
...@@ -28,10 +30,11 @@ struct hip_concat ...@@ -28,10 +30,11 @@ struct hip_concat
shape compute_shape(std::vector<shape> inputs) const; shape compute_shape(std::vector<shape> inputs) const;
argument argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const; compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
#endif #endif
#ifndef MIGRAPH_GUARD_RTGLIB_CONCAT_GPU_OPT_HPP
#define MIGRAPH_GUARD_RTGLIB_CONCAT_GPU_OPT_HPP
#include <migraph/gpu/concat.hpp>
namespace migraph {
namespace gpu {
struct concat_gpu_optimization
{
std::string name() const { return "gpu::concat"; }
std::string allocate() const { return "hip::allocate"; }
migraph::op::concat get_concat(const migraph::operation& op) const
{
return migraph::any_cast<migraph::gpu::hip_concat>(op).op;
}
};
} // namespace gpu
} // namespace migraph
#endif
...@@ -5,8 +5,10 @@ ...@@ -5,8 +5,10 @@
#include <migraph/gpu/rocblas.hpp> #include <migraph/gpu/rocblas.hpp>
#include <migraph/gpu/hip.hpp> #include <migraph/gpu/hip.hpp>
#include <migraph/env.hpp> #include <migraph/env.hpp>
#include <migraph/config.hpp>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
MIGRAPH_DECLARE_ENV_VAR(MIGRAPH_DISABLE_NULL_STREAM) MIGRAPH_DECLARE_ENV_VAR(MIGRAPH_DISABLE_NULL_STREAM)
...@@ -114,6 +116,7 @@ struct context ...@@ -114,6 +116,7 @@ struct context
std::shared_ptr<hip_device> current_device; std::shared_ptr<hip_device> current_device;
}; };
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <migraph/operators.hpp> #include <migraph/operators.hpp>
#include <migraph/generate.hpp> #include <migraph/generate.hpp>
#include <migraph/shape_for_each.hpp> #include <migraph/shape_for_each.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/miopen.hpp> #include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp> #include <migraph/gpu/hip.hpp>
#include <migraph/dfor.hpp> #include <migraph/dfor.hpp>
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
#include <utility> #include <utility>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
struct miopen_contiguous struct miopen_contiguous
...@@ -26,10 +28,11 @@ struct miopen_contiguous ...@@ -26,10 +28,11 @@ struct miopen_contiguous
std::string name() const { return "gpu::contiguous"; } std::string name() const { return "gpu::contiguous"; }
shape compute_shape(const std::vector<shape>& inputs) const; shape compute_shape(const std::vector<shape>& inputs) const;
argument compute(context&, shape output_shape, const std::vector<argument>& args) const; argument compute(context&, shape output_shape, const std::vector<argument>& args) const;
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <migraph/operators.hpp> #include <migraph/operators.hpp>
#include <migraph/generate.hpp> #include <migraph/generate.hpp>
#include <migraph/shape_for_each.hpp> #include <migraph/shape_for_each.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/miopen.hpp> #include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp> #include <migraph/gpu/hip.hpp>
#include <migraph/dfor.hpp> #include <migraph/dfor.hpp>
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
#include <utility> #include <utility>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
struct miopen_convolution struct miopen_convolution
...@@ -38,10 +40,11 @@ struct miopen_convolution ...@@ -38,10 +40,11 @@ struct miopen_convolution
argument argument
compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const; compute(context& ctx, const shape& output_shape, const std::vector<argument>& args) const;
shape compile(context& ctx, const shape& output_shape, std::vector<instruction_ref> inputs); shape compile(context& ctx, const shape& output_shape, std::vector<instruction_ref> inputs);
int output_alias(const std::vector<shape>& shapes) const { return shapes.size() - 1; }
}; };
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
#define MIGRAPH_GUARD_RTGLIB_DEVICE_ADD_HPP #define MIGRAPH_GUARD_RTGLIB_DEVICE_ADD_HPP
#include <migraph/argument.hpp> #include <migraph/argument.hpp>
#include <migraph/config.hpp>
#include <hip/hip_runtime_api.h> #include <hip/hip_runtime_api.h>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
namespace device { namespace device {
...@@ -19,6 +21,7 @@ void add(hipStream_t stream, ...@@ -19,6 +21,7 @@ void add(hipStream_t stream,
} // namespace device } // namespace device
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
#define MIGRAPH_GUARD_RTGLIB_DEVICE_ADD_RELU_HPP #define MIGRAPH_GUARD_RTGLIB_DEVICE_ADD_RELU_HPP
#include <migraph/argument.hpp> #include <migraph/argument.hpp>
#include <migraph/config.hpp>
#include <hip/hip_runtime_api.h> #include <hip/hip_runtime_api.h>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
namespace device { namespace device {
...@@ -22,6 +24,7 @@ void add_relu(hipStream_t stream, ...@@ -22,6 +24,7 @@ void add_relu(hipStream_t stream,
} // namespace device } // namespace device
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
#define MIGRAPH_GUARD_RTGLIB_DEVICE_CONCAT_HPP #define MIGRAPH_GUARD_RTGLIB_DEVICE_CONCAT_HPP
#include <migraph/argument.hpp> #include <migraph/argument.hpp>
#include <migraph/config.hpp>
#include <hip/hip_runtime_api.h> #include <hip/hip_runtime_api.h>
namespace migraph { namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace gpu { namespace gpu {
namespace device { namespace device {
...@@ -15,6 +17,7 @@ argument concat(hipStream_t stream, ...@@ -15,6 +17,7 @@ argument concat(hipStream_t stream,
} // namespace device } // namespace device
} // namespace gpu } // namespace gpu
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph } // namespace migraph
#endif #endif
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