Unverified Commit c04fbc92 authored by Artur Wojcik's avatar Artur Wojcik Committed by GitHub
Browse files

export API symbols from dynamic libraries (#1892)

Export API symbols for migraphx, migraphx_ref, migraphx_cpu, migrphx_gpu, migraphx_device, migraphx_tf, and migraphx_onnx. There is a separate PR for migrahx_c.

API symbol exporting affects only Windows. It is transparent on Linux.
parent c88d4a54
......@@ -25,7 +25,7 @@
#define MIGRAPHX_GUARD_MIGRAPHLIB_KERNELS_HPP
#include <migraphx/argument.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/device/config.hpp>
#include <hip/hip_runtime_api.h>
namespace migraphx {
......@@ -33,7 +33,9 @@ inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {
void contiguous(hipStream_t stream, const argument& result, const argument& arg);
void MIGRAPHX_DEVICE_EXPORT contiguous(hipStream_t stream,
const argument& result,
const argument& arg);
} // namespace device
} // namespace gpu
......
......@@ -25,7 +25,7 @@
#define MIGRAPHX_GUARD_RTGLIB_DEVICE_FILL_HPP
#include <migraphx/argument.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/device/config.hpp>
#include <hip/hip_runtime_api.h>
namespace migraphx {
......@@ -33,7 +33,7 @@ inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {
void fill(hipStream_t stream, const argument& result, unsigned long val);
void MIGRAPHX_DEVICE_EXPORT fill(hipStream_t stream, const argument& result, unsigned long val);
} // namespace device
} // namespace gpu
......
......@@ -25,7 +25,7 @@
#define MIGRAPHX_GUARD_RTGLIB_DEVICE_GATHER_HPP
#include <migraphx/argument.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/device/config.hpp>
#include <hip/hip_runtime_api.h>
namespace migraphx {
......@@ -33,7 +33,8 @@ inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {
argument gather(hipStream_t stream, argument result, argument arg1, argument arg2, int64_t axis);
argument MIGRAPHX_DEVICE_EXPORT
gather(hipStream_t stream, argument result, argument arg1, argument arg2, int64_t axis);
} // namespace device
} // namespace gpu
......
......@@ -25,7 +25,7 @@
#define MIGRAPHX_GUARD_RTGLIB_DEVICE_INT8_GEMM_PACK_HPP
#include <migraphx/argument.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/device/config.hpp>
#include <hip/hip_runtime_api.h>
namespace migraphx {
......@@ -33,9 +33,13 @@ inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {
void int8_gemm_pack_a(hipStream_t stream, const argument& result, const argument& arg);
void MIGRAPHX_DEVICE_EXPORT int8_gemm_pack_a(hipStream_t stream,
const argument& result,
const argument& arg);
void int8_gemm_pack_b(hipStream_t stream, const argument& result, const argument& arg);
void MIGRAPHX_DEVICE_EXPORT int8_gemm_pack_b(hipStream_t stream,
const argument& result,
const argument& arg);
} // namespace device
} // namespace gpu
......
......@@ -25,7 +25,7 @@
#define MIGRAPHX_GUARD_RTGLIB_DEVICE_LOGSOFTMAX_HPP
#include <migraphx/argument.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/device/config.hpp>
#include <hip/hip_runtime_api.h>
namespace migraphx {
......@@ -33,7 +33,10 @@ inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {
void logsoftmax(hipStream_t stream, const argument& result, const argument& arg, int64_t axis);
void MIGRAPHX_DEVICE_EXPORT logsoftmax(hipStream_t stream,
const argument& result,
const argument& arg,
int64_t axis);
} // namespace device
} // namespace gpu
......
......@@ -25,7 +25,7 @@
#define MIGRAPHX_GUARD_RTGLIB_DEVICE_MULTINOMIAL_HPP
#include <migraphx/argument.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/device/config.hpp>
#include <hip/hip_runtime_api.h>
namespace migraphx {
......@@ -33,10 +33,10 @@ inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {
void multinomial(hipStream_t stream,
const argument& result,
const argument& arg0,
const argument& arg1);
void MIGRAPHX_DEVICE_EXPORT multinomial(hipStream_t stream,
const argument& result,
const argument& arg0,
const argument& arg1);
} // namespace device
} // namespace gpu
......
......@@ -25,7 +25,7 @@
#define MIGRAPHX_GUARD_RTGLIB_DEVICE_NONZERO_HPP
#include <migraphx/argument.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/device/config.hpp>
#include <hip/hip_runtime_api.h>
namespace migraphx {
......@@ -33,7 +33,9 @@ inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {
argument nonzero(hipStream_t stream, const argument& result, const argument& arg_data);
argument MIGRAPHX_DEVICE_EXPORT nonzero(hipStream_t stream,
const argument& result,
const argument& arg_data);
} // namespace device
} // namespace gpu
......
......@@ -26,7 +26,7 @@
#define MIGRAPHX_GUARD_RTGLIB_DEVICE_PAD_HPP
#include <migraphx/argument.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/device/config.hpp>
#include <hip/hip_runtime_api.h>
namespace migraphx {
......@@ -34,11 +34,11 @@ inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {
argument pad(hipStream_t stream,
argument result,
argument arg1,
float value,
std::vector<std::int64_t> pads);
argument MIGRAPHX_DEVICE_EXPORT pad(hipStream_t stream,
argument result,
argument arg1,
float value,
std::vector<std::int64_t> pads);
} // namespace device
} // namespace gpu
......
......@@ -25,7 +25,7 @@
#define MIGRAPHX_GUARD_DEVICE_PREFIX_SCAN_SUM_HPP
#include <migraphx/argument.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/device/config.hpp>
#include <hip/hip_runtime_api.h>
namespace migraphx {
......@@ -33,12 +33,12 @@ inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {
void prefix_scan_sum(hipStream_t stream,
const argument& result,
const argument& arg,
int32_t axis,
bool exclusive,
bool reverse);
void MIGRAPHX_DEVICE_EXPORT prefix_scan_sum(hipStream_t stream,
const argument& result,
const argument& arg,
int32_t axis,
bool exclusive,
bool reverse);
} // namespace device
} // namespace gpu
......
......@@ -25,7 +25,7 @@
#define MIGRAPHX_GUARD_RTGLIB_DEVICE_REVERSE_HPP
#include <migraphx/argument.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/device/config.hpp>
#include <hip/hip_runtime_api.h>
namespace migraphx {
......@@ -33,8 +33,10 @@ inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {
argument
reverse(hipStream_t stream, argument result, argument arg1, const std::vector<int64_t>& axes);
argument MIGRAPHX_DEVICE_EXPORT reverse(hipStream_t stream,
argument result,
argument arg1,
const std::vector<int64_t>& axes);
} // namespace device
} // namespace gpu
......
......@@ -25,7 +25,7 @@
#define MIGRAPHX_GUARD_RTGLIB_DEVICE_RNN_VARIABLE_SEQ_LENS_HPP
#include <migraphx/argument.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/device/config.hpp>
#include <hip/hip_runtime_api.h>
namespace migraphx {
......@@ -33,22 +33,22 @@ inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {
void rnn_var_sl_shift_sequence(hipStream_t stream,
const argument& result,
const argument& arg_hs,
const argument& arg_sl);
void MIGRAPHX_DEVICE_EXPORT rnn_var_sl_shift_sequence(hipStream_t stream,
const argument& result,
const argument& arg_hs,
const argument& arg_sl);
void rnn_var_sl_shift_output(hipStream_t stream,
const argument& result,
const argument& arg_hs,
const argument& arg_sl,
bool is_reverse);
void MIGRAPHX_DEVICE_EXPORT rnn_var_sl_shift_output(hipStream_t stream,
const argument& result,
const argument& arg_hs,
const argument& arg_sl,
bool is_reverse);
void rnn_var_sl_last_output(hipStream_t stream,
const argument& result,
const argument& arg_hs,
const argument& arg_sl,
bool is_reverse);
void MIGRAPHX_DEVICE_EXPORT rnn_var_sl_last_output(hipStream_t stream,
const argument& result,
const argument& arg_hs,
const argument& arg_sl,
bool is_reverse);
} // namespace device
} // namespace gpu
......
......@@ -25,7 +25,7 @@
#define MIGRAPHX_GUARD_RTGLIB_DEVICE_SCATTER_HPP
#include <migraphx/argument.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/device/config.hpp>
#include <hip/hip_runtime_api.h>
namespace migraphx {
......@@ -33,7 +33,7 @@ inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {
argument scatter(
argument MIGRAPHX_DEVICE_EXPORT scatter(
hipStream_t stream, argument result, argument arg0, argument arg1, argument arg2, int64_t axis);
} // namespace device
......
......@@ -25,7 +25,7 @@
#define MIGRAPHX_GUARD_RTGLIB_DEVICE_TOPK_HPP
#include <migraphx/argument.hpp>
#include <migraphx/config.hpp>
#include <migraphx/gpu/device/config.hpp>
#include <hip/hip_runtime_api.h>
namespace migraphx {
......@@ -33,19 +33,19 @@ inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {
argument topk_smallest(hipStream_t stream,
const argument& val_res,
const argument& ind_res,
const argument& arg,
int64_t k,
int64_t axis);
argument MIGRAPHX_DEVICE_EXPORT topk_smallest(hipStream_t stream,
const argument& val_res,
const argument& ind_res,
const argument& arg,
int64_t k,
int64_t axis);
argument topk_largest(hipStream_t stream,
const argument& val_res,
const argument& ind_res,
const argument& arg,
int64_t k,
int64_t axis);
argument MIGRAPHX_DEVICE_EXPORT topk_largest(hipStream_t stream,
const argument& val_res,
const argument& ind_res,
const argument& arg,
int64_t k,
int64_t axis);
} // namespace device
} // namespace gpu
......
......@@ -24,7 +24,7 @@
#ifndef MIGRAPHX_GUARD_GPU_DEVICE_NAME_HPP
#define MIGRAPHX_GUARD_GPU_DEVICE_NAME_HPP
#include <migraphx/config.hpp>
#include <migraphx/gpu/config.hpp>
#include <string>
struct hipDeviceProp_t;
......@@ -33,11 +33,11 @@ namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
std::string get_arch_name(const hipDeviceProp_t& props);
MIGRAPHX_GPU_EXPORT std::string get_arch_name(const hipDeviceProp_t& props);
std::string get_device_name();
MIGRAPHX_GPU_EXPORT std::string get_device_name();
int get_device_id();
MIGRAPHX_GPU_EXPORT int get_device_id();
} // namespace gpu
} // namespace MIGRAPHX_INLINE_NS
......
......@@ -24,7 +24,6 @@
#ifndef MIGRAPHX_GUARD_GPU_FUSE_MLIR_HPP
#define MIGRAPHX_GUARD_GPU_FUSE_MLIR_HPP
#include <migraphx/config.hpp>
#include <migraphx/gpu/context.hpp>
namespace migraphx {
......@@ -34,9 +33,9 @@ struct module_pass_manager;
namespace gpu {
bool mlir_enabled();
MIGRAPHX_GPU_EXPORT bool mlir_enabled();
struct fuse_mlir
struct MIGRAPHX_GPU_EXPORT fuse_mlir
{
context* ctx = nullptr;
std::string name() const { return "gpu::fuse_mlir"; }
......
......@@ -24,7 +24,7 @@
#ifndef MIGRAPHX_GUARD_MIGRAPHLIB_HIP_HPP
#define MIGRAPHX_GUARD_MIGRAPHLIB_HIP_HPP
#include <migraphx/config.hpp>
#include <migraphx/gpu/config.hpp>
#include <migraphx/argument.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/check_shapes.hpp>
......@@ -38,26 +38,26 @@ namespace gpu {
struct context;
std::string hip_error(int error);
MIGRAPHX_GPU_EXPORT std::string hip_error(int error);
argument allocate_gpu(const shape& s, bool host = false);
MIGRAPHX_GPU_EXPORT argument allocate_gpu(const shape& s, bool host = false);
argument register_on_gpu(const argument& arg);
MIGRAPHX_GPU_EXPORT argument register_on_gpu(const argument& arg);
argument to_gpu(const argument& arg, bool host = false);
MIGRAPHX_GPU_EXPORT argument to_gpu(const argument& arg, bool host = false);
argument from_gpu(const argument& arg);
MIGRAPHX_GPU_EXPORT argument from_gpu(const argument& arg);
void set_device(std::size_t id);
MIGRAPHX_GPU_EXPORT void set_device(std::size_t id);
void gpu_sync();
void gpu_sync(const context& ctx);
MIGRAPHX_GPU_EXPORT void gpu_sync();
MIGRAPHX_GPU_EXPORT void gpu_sync(const context& ctx);
void gpu_copy(context& ctx, const argument& src, const argument& dst);
void copy_to_gpu(context& ctx, const argument& src, const argument& dst);
void copy_from_gpu(context& ctx, const argument& src, const argument& dst);
MIGRAPHX_GPU_EXPORT void gpu_copy(context& ctx, const argument& src, const argument& dst);
MIGRAPHX_GPU_EXPORT void copy_to_gpu(context& ctx, const argument& src, const argument& dst);
MIGRAPHX_GPU_EXPORT void copy_from_gpu(context& ctx, const argument& src, const argument& dst);
argument get_preallocation(context& ctx, const std::string& id);
MIGRAPHX_GPU_EXPORT argument get_preallocation(context& ctx, const std::string& id);
struct hip_allocate
{
......@@ -187,7 +187,8 @@ struct hip_copy
std::ptrdiff_t output_alias(const std::vector<shape>&) const { return 1; }
};
void store_preallocated_param(context& ctx, const std::string& id, const argument& a);
MIGRAPHX_GPU_EXPORT void
store_preallocated_param(context& ctx, const std::string& id, const argument& a);
struct hip_allocate_memory
{
......
......@@ -24,7 +24,7 @@
#ifndef MIGRAPHX_GUARD_RTGLIB_KERNEL_HPP
#define MIGRAPHX_GUARD_RTGLIB_KERNEL_HPP
#include <migraphx/config.hpp>
#include <migraphx/gpu/config.hpp>
#include <migraphx/gpu/pack_args.hpp>
#include <hip/hip_runtime_api.h>
#include <memory>
......@@ -37,7 +37,7 @@ namespace gpu {
struct kernel_impl;
struct kernel
struct MIGRAPHX_GPU_EXPORT kernel
{
kernel() = default;
kernel(const char* image, const std::string& name);
......
......@@ -24,7 +24,6 @@
#ifndef MIGRAPHX_GUARD_RTGLIB_MIOPEN_LOWERING_HPP
#define MIGRAPHX_GUARD_RTGLIB_MIOPEN_LOWERING_HPP
#include <migraphx/config.hpp>
#include <migraphx/gpu/context.hpp>
namespace migraphx {
......@@ -40,7 +39,7 @@ namespace gpu {
* * Maps instructions to their GPU-specific counterparts.
* * Inserts `allocate` instructions before GPU operators.
*/
struct lowering
struct MIGRAPHX_GPU_EXPORT lowering
{
context* ctx;
bool offload_copy;
......
......@@ -26,7 +26,7 @@
#include <string>
#include <vector>
#include <migraphx/config.hpp>
#include <migraphx/gpu/config.hpp>
#include <migraphx/gpu/code_object_op.hpp>
#include <migraphx/instruction_ref.hpp>
......@@ -35,14 +35,16 @@ inline namespace MIGRAPHX_INLINE_NS {
struct module;
namespace gpu {
std::string dump_mlir(const module& m);
code_object_op
compile_mlir(const context& ctx, module m, const std::vector<instruction_ref>& inputs);
MIGRAPHX_GPU_EXPORT std::string dump_mlir(const module& m);
instruction_ref insert_mlir(module& m,
instruction_ref ins,
code_object_op co,
const std::vector<instruction_ref>& inputs);
MIGRAPHX_GPU_EXPORT code_object_op compile_mlir(const context& ctx,
module m,
const std::vector<instruction_ref>& inputs);
MIGRAPHX_GPU_EXPORT instruction_ref insert_mlir(module& m,
instruction_ref ins,
code_object_op co,
const std::vector<instruction_ref>& inputs);
} // namespace gpu
} // namespace MIGRAPHX_INLINE_NS
......
......@@ -24,7 +24,7 @@
#ifndef MIGRAPHX_GUARD_RTGLIB_PACK_ARGS_HPP
#define MIGRAPHX_GUARD_RTGLIB_PACK_ARGS_HPP
#include <migraphx/config.hpp>
#include <migraphx/gpu/config.hpp>
#include <migraphx/requires.hpp>
#include <utility>
#include <vector>
......@@ -46,7 +46,7 @@ struct kernel_argument
void* data;
};
std::vector<char> pack_args(const std::vector<kernel_argument>& args);
MIGRAPHX_GPU_EXPORT std::vector<char> pack_args(const std::vector<kernel_argument>& args);
} // namespace gpu
} // namespace MIGRAPHX_INLINE_NS
......
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