"composable_kernel/include/utility/config_nvidia.hpp.in" did not exist on "766b0a9eafe29a5d2a75c350345e54165ceaf405"
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
...@@ -39,7 +39,7 @@ struct module; ...@@ -39,7 +39,7 @@ struct module;
/** /**
* capture inputs of operators to be quantized to int8 * capture inputs of operators to be quantized to int8
*/ */
struct capture_arguments_pass struct MIGRAPHX_EXPORT capture_arguments_pass
{ {
std::vector<std::string> ins_names = {"dot", "convolution"}; std::vector<std::string> ins_names = {"dot", "convolution"};
std::function<void(std::size_t, std::vector<argument>)> f{}; std::function<void(std::size_t, std::vector<argument>)> f{};
...@@ -51,7 +51,7 @@ struct capture_arguments_pass ...@@ -51,7 +51,7 @@ struct capture_arguments_pass
/** /**
* quantize a program to int8 * quantize a program to int8
*/ */
struct quantize_int8_pass struct MIGRAPHX_EXPORT quantize_int8_pass
{ {
std::vector<std::string> ins_names = {"dot", "convolution"}; std::vector<std::string> ins_names = {"dot", "convolution"};
std::vector<std::pair<float, float>> quant_params; std::vector<std::pair<float, float>> quant_params;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
namespace migraphx { namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
std::vector<shape> reduce_dims(const std::vector<shape>& shapes); MIGRAPHX_EXPORT std::vector<shape> reduce_dims(const std::vector<shape>& shapes);
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx } // namespace migraphx
......
...@@ -34,7 +34,7 @@ namespace migraphx { ...@@ -34,7 +34,7 @@ namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
// unregister all ops for specified target, useful when unloading dynamically plugged-in target lib // unregister all ops for specified target, useful when unloading dynamically plugged-in target lib
void unregister_op(const std::string& op_name); MIGRAPHX_EXPORT void unregister_op(const std::string& op_name);
namespace detail { namespace detail {
struct op_handler struct op_handler
...@@ -47,15 +47,15 @@ struct op_handler ...@@ -47,15 +47,15 @@ struct op_handler
} // namespace detail } // namespace detail
void register_op_init(); MIGRAPHX_EXPORT void register_op_init();
void register_op(const operation& op); MIGRAPHX_EXPORT void register_op(const operation& op);
operation load_op(const std::string& name); MIGRAPHX_EXPORT operation load_op(const std::string& name);
bool has_op(const std::string& name); MIGRAPHX_EXPORT bool has_op(const std::string& name);
std::vector<std::string> get_operators(); MIGRAPHX_EXPORT std::vector<std::string> get_operators();
template <class T> template <class T>
void register_op() void register_op()
......
...@@ -33,11 +33,11 @@ ...@@ -33,11 +33,11 @@
namespace migraphx { namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
void register_target_init(); MIGRAPHX_EXPORT void register_target_init();
void register_target(const target& t); MIGRAPHX_EXPORT void register_target(const target& t);
void unregister_target(const std::string& name); MIGRAPHX_EXPORT void unregister_target(const std::string& name);
target make_target(const std::string& name); MIGRAPHX_EXPORT target make_target(const std::string& name);
std::vector<std::string> get_targets(); MIGRAPHX_EXPORT std::vector<std::string> get_targets();
namespace detail { namespace detail {
struct target_handler struct target_handler
......
...@@ -35,7 +35,7 @@ struct module_pass_manager; ...@@ -35,7 +35,7 @@ struct module_pass_manager;
/** /**
* Replace `allocate` instructions with target allocations or output parameters. * Replace `allocate` instructions with target allocations or output parameters.
*/ */
struct replace_allocate struct MIGRAPHX_EXPORT replace_allocate
{ {
allocation_model model; allocation_model model;
bool offload_copy = false; bool offload_copy = false;
......
...@@ -36,7 +36,7 @@ struct module; ...@@ -36,7 +36,7 @@ struct module;
/** /**
* Rewrite gelu standard formula as the sigmoid approximation formula * Rewrite gelu standard formula as the sigmoid approximation formula
*/ */
struct rewrite_gelu struct MIGRAPHX_EXPORT rewrite_gelu
{ {
std::string name() const { return "rewrite_gelu"; } std::string name() const { return "rewrite_gelu"; }
void apply(module& m) const; void apply(module& m) const;
......
...@@ -35,7 +35,7 @@ struct module; ...@@ -35,7 +35,7 @@ struct module;
/** /**
* Rewrite pooling to reduce_mean * Rewrite pooling to reduce_mean
*/ */
struct rewrite_pooling struct MIGRAPHX_EXPORT rewrite_pooling
{ {
std::string name() const { return "rewrite_pooling"; } std::string name() const { return "rewrite_pooling"; }
void apply(module& m) const; void apply(module& m) const;
......
...@@ -35,7 +35,7 @@ struct module; ...@@ -35,7 +35,7 @@ struct module;
/** /**
* Rewrite quantization ops to equivalent operators * Rewrite quantization ops to equivalent operators
*/ */
struct rewrite_quantization struct MIGRAPHX_EXPORT rewrite_quantization
{ {
std::string name() const { return "rewrite_quantization"; } std::string name() const { return "rewrite_quantization"; }
void apply(module& m) const; void apply(module& m) const;
......
...@@ -39,7 +39,7 @@ struct module; ...@@ -39,7 +39,7 @@ struct module;
/** /**
* Rewrite rnn to gemm and add. * Rewrite rnn to gemm and add.
*/ */
struct rewrite_rnn struct MIGRAPHX_EXPORT rewrite_rnn
{ {
std::string name() const { return "rewrite_rnn"; } std::string name() const { return "rewrite_rnn"; }
void apply(module& m) const; void apply(module& m) const;
......
...@@ -37,7 +37,7 @@ struct module; ...@@ -37,7 +37,7 @@ struct module;
/** /**
* Schedule instructions for concurrent execution * Schedule instructions for concurrent execution
*/ */
struct schedule struct MIGRAPHX_EXPORT schedule
{ {
schedule_model model{}; schedule_model model{};
bool enable = true; bool enable = true;
......
...@@ -63,7 +63,7 @@ struct schedule_model ...@@ -63,7 +63,7 @@ struct schedule_model
#ifdef TYPE_ERASED_DECLARATION #ifdef TYPE_ERASED_DECLARATION
// Type-erased interface for: // Type-erased interface for:
struct schedule_model struct MIGRAPHX_EXPORT schedule_model
{ {
// //
std::size_t concurrency() const; std::size_t concurrency() const;
......
...@@ -43,7 +43,7 @@ inline namespace MIGRAPHX_INLINE_NS { ...@@ -43,7 +43,7 @@ inline namespace MIGRAPHX_INLINE_NS {
struct value; struct value;
struct shape_impl; struct shape_impl;
struct shape struct MIGRAPHX_EXPORT shape
{ {
// Add new types here // Add new types here
...@@ -85,7 +85,7 @@ struct shape ...@@ -85,7 +85,7 @@ struct shape
{ {
}; };
struct dynamic_dimension struct MIGRAPHX_EXPORT dynamic_dimension
{ {
std::size_t min = 0; std::size_t min = 0;
std::size_t max = 0; std::size_t max = 0;
...@@ -100,22 +100,28 @@ struct shape ...@@ -100,22 +100,28 @@ struct shape
bool is_fixed() const; bool is_fixed() const;
bool has_optimal() const; bool has_optimal() const;
friend bool operator==(const dynamic_dimension& x, const dynamic_dimension& y); MIGRAPHX_EXPORT friend bool operator==(const dynamic_dimension& x,
friend bool operator!=(const dynamic_dimension& x, const dynamic_dimension& y); const dynamic_dimension& y);
friend std::ostream& operator<<(std::ostream& os, const dynamic_dimension& x); MIGRAPHX_EXPORT friend bool operator!=(const dynamic_dimension& x,
const dynamic_dimension& y);
MIGRAPHX_EXPORT friend std::ostream& operator<<(std::ostream& os,
const dynamic_dimension& x);
// compare to fixed std::size_t dimension // compare to fixed std::size_t dimension
friend bool operator==(const dynamic_dimension& x, const std::size_t& y); MIGRAPHX_EXPORT friend bool operator==(const dynamic_dimension& x, const std::size_t& y);
friend bool operator==(const std::size_t& x, const dynamic_dimension& y); MIGRAPHX_EXPORT friend bool operator==(const std::size_t& x, const dynamic_dimension& y);
friend bool operator!=(const dynamic_dimension& x, const std::size_t& y); MIGRAPHX_EXPORT friend bool operator!=(const dynamic_dimension& x, const std::size_t& y);
friend bool operator!=(const std::size_t& x, const dynamic_dimension& y); MIGRAPHX_EXPORT friend bool operator!=(const std::size_t& x, const dynamic_dimension& y);
// add and subtract fixed std::size_t dimension // add and subtract fixed std::size_t dimension
dynamic_dimension& operator+=(const std::size_t& x); dynamic_dimension& operator+=(const std::size_t& x);
dynamic_dimension& operator-=(const std::size_t& x); dynamic_dimension& operator-=(const std::size_t& x);
friend dynamic_dimension operator+(const dynamic_dimension& x, const std::size_t& y); MIGRAPHX_EXPORT friend dynamic_dimension operator+(const dynamic_dimension& x,
friend dynamic_dimension operator+(const std::size_t& x, const dynamic_dimension& y); const std::size_t& y);
friend dynamic_dimension operator-(const dynamic_dimension& x, const std::size_t& y); MIGRAPHX_EXPORT friend dynamic_dimension operator+(const std::size_t& x,
const dynamic_dimension& y);
MIGRAPHX_EXPORT friend dynamic_dimension operator-(const dynamic_dimension& x,
const std::size_t& y);
}; };
static const std::vector<type_t>& types(); static const std::vector<type_t>& types();
...@@ -286,9 +292,9 @@ struct shape ...@@ -286,9 +292,9 @@ struct shape
// convert the shape to a static one setting any non-fixed dynamic_dimensions to x // convert the shape to a static one setting any non-fixed dynamic_dimensions to x
shape to_static(std::size_t x) const; shape to_static(std::size_t x) const;
friend bool operator==(const shape& x, const shape& y); MIGRAPHX_EXPORT friend bool operator==(const shape& x, const shape& y);
friend bool operator!=(const shape& x, const shape& y); MIGRAPHX_EXPORT friend bool operator!=(const shape& x, const shape& y);
friend std::ostream& operator<<(std::ostream& os, const shape& x); MIGRAPHX_EXPORT friend std::ostream& operator<<(std::ostream& os, const shape& x);
template <class T> template <class T>
struct as struct as
...@@ -396,8 +402,8 @@ struct shape ...@@ -396,8 +402,8 @@ struct shape
std::shared_ptr<const shape_impl> impl; std::shared_ptr<const shape_impl> impl;
}; };
void migraphx_to_value(value& v, const shape& s); MIGRAPHX_EXPORT void migraphx_to_value(value& v, const shape& s);
void migraphx_from_value(const value& v, shape& s); MIGRAPHX_EXPORT void migraphx_from_value(const value& v, shape& s);
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx } // namespace migraphx
......
...@@ -35,7 +35,7 @@ struct module; ...@@ -35,7 +35,7 @@ struct module;
/** /**
* Simplify many algebraic instructions to more efficient versions. * Simplify many algebraic instructions to more efficient versions.
*/ */
struct simplify_algebra struct MIGRAPHX_EXPORT simplify_algebra
{ {
std::string name() const { return "simplify_algebra"; } std::string name() const { return "simplify_algebra"; }
void apply(module& m) const; void apply(module& m) const;
......
...@@ -36,7 +36,7 @@ struct module; ...@@ -36,7 +36,7 @@ struct module;
* Inserts quantized operators in place of dq->quantizable_op->q * Inserts quantized operators in place of dq->quantizable_op->q
* then removes remaining fake quantization (q->dq pairs) * then removes remaining fake quantization (q->dq pairs)
*/ */
struct simplify_qdq struct MIGRAPHX_EXPORT simplify_qdq
{ {
std::string name() const { return "simplify_qdq"; } std::string name() const { return "simplify_qdq"; }
void apply(module& m) const; void apply(module& m) const;
......
...@@ -36,7 +36,7 @@ struct module; ...@@ -36,7 +36,7 @@ struct module;
/** /**
* Eliminate redundant reshapes. * Eliminate redundant reshapes.
*/ */
struct simplify_reshapes struct MIGRAPHX_EXPORT simplify_reshapes
{ {
std::string name() const { return "simplify_reshapes"; } std::string name() const { return "simplify_reshapes"; }
void apply(module& m) const; void apply(module& m) const;
......
...@@ -36,7 +36,7 @@ inline namespace MIGRAPHX_INLINE_NS { ...@@ -36,7 +36,7 @@ inline namespace MIGRAPHX_INLINE_NS {
* Split dynamic dimension over submodules if exactly one dimension in the parameter list is * Split dynamic dimension over submodules if exactly one dimension in the parameter list is
* dynamic. * dynamic.
*/ */
struct split_single_dyn_dim struct MIGRAPHX_EXPORT split_single_dyn_dim
{ {
std::string name() const { return "split_single_dyn_dim"; } std::string name() const { return "split_single_dyn_dim"; }
void apply(module_pass_manager&) const; void apply(module_pass_manager&) const;
......
...@@ -35,7 +35,7 @@ inline namespace MIGRAPHX_INLINE_NS { ...@@ -35,7 +35,7 @@ inline namespace MIGRAPHX_INLINE_NS {
struct sqlite_impl; struct sqlite_impl;
struct sqlite struct MIGRAPHX_EXPORT sqlite
{ {
sqlite() = default; sqlite() = default;
static sqlite read(const fs::path& p); static sqlite read(const fs::path& p);
......
...@@ -62,7 +62,7 @@ struct stream_model ...@@ -62,7 +62,7 @@ struct stream_model
#ifdef TYPE_ERASED_DECLARATION #ifdef TYPE_ERASED_DECLARATION
// Type-erased interface for: // Type-erased interface for:
struct stream_model struct MIGRAPHX_EXPORT stream_model
{ {
// //
std::size_t get_nstream() const; std::size_t get_nstream() const;
......
...@@ -127,7 +127,7 @@ supported_segments target_find_supported(T&, const_module_ref, support_metric) ...@@ -127,7 +127,7 @@ supported_segments target_find_supported(T&, const_module_ref, support_metric)
#ifdef TYPE_ERASED_DECLARATION #ifdef TYPE_ERASED_DECLARATION
// Type-erased interface for: // Type-erased interface for:
struct target struct MIGRAPHX_EXPORT target
{ {
// //
std::string name() const; std::string name() const;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <migraphx/program.hpp> #include <migraphx/program.hpp>
#include <migraphx/config.hpp> #include <migraphx/config.hpp>
#include <migraphx/tf/export.h>
namespace migraphx { namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
...@@ -41,9 +42,10 @@ struct tf_options ...@@ -41,9 +42,10 @@ struct tf_options
}; };
/// Create a program from a tf pb file (default is nhwc format) /// Create a program from a tf pb file (default is nhwc format)
program parse_tf(const std::string& name, const tf_options& options = tf_options{}); MIGRAPHX_TF_EXPORT program parse_tf(const std::string& name,
const tf_options& options = tf_options{});
std::vector<std::string> get_tf_operators(); MIGRAPHX_TF_EXPORT std::vector<std::string> get_tf_operators();
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx } // namespace migraphx
......
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