From 7acd47bf6c1b701b9b0fae8256ab0ece5f513f1a Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Tue, 28 Nov 2023 17:25:08 +0100 Subject: [PATCH 1/3] add missing symbol export --- src/activ_api.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/activ_api.cpp b/src/activ_api.cpp index 8fe0373d63..b842ec6d94 100644 --- a/src/activ_api.cpp +++ b/src/activ_api.cpp @@ -70,6 +70,7 @@ extern "C" miopenStatus_t miopenGetActivationDescriptor(miopenActivationDescript } namespace miopen::debug { +MIOPEN_EXPORT void LogCmdActivation(const miopen::TensorDescriptor& x_desc, const miopen::ActivationDescriptor& activ_desc, bool fwd) From 625f26ff34fb18a51ddd0ad756457ad38028a2c3 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Wed, 29 Nov 2023 23:01:39 +0100 Subject: [PATCH 2/3] more missing exports --- src/execution_context.cpp | 3 ++- src/find_controls.cpp | 3 ++- src/find_db.cpp | 3 ++- src/include/miopen/conv_algo_name.hpp | 2 ++ src/include/miopen/convolution.hpp | 2 +- src/include/miopen/execution_context.hpp | 3 ++- src/include/miopen/find_controls.hpp | 3 ++- src/include/miopen/find_db.hpp | 5 +++-- src/include/miopen/gemm_v2.hpp | 2 ++ src/include/miopen/handle.hpp | 2 +- src/include/miopen/logger.hpp | 11 +++++++---- src/include/miopen/pooling.hpp | 2 +- src/include/miopen/solver.hpp | 2 +- src/include/miopen/solver_id.hpp | 2 +- src/include/miopen/tensor.hpp | 2 +- src/logger.cpp | 3 ++- src/solver/conv_direct_naive_conv.cpp | 2 +- test/gpu_conv.hpp | 5 +++-- 18 files changed, 36 insertions(+), 21 deletions(-) diff --git a/src/execution_context.cpp b/src/execution_context.cpp index 9593aa9fa1..4f8e357810 100644 --- a/src/execution_context.cpp +++ b/src/execution_context.cpp @@ -46,7 +46,8 @@ MIOPEN_DECLARE_ENV_VAR(MIOPEN_DEBUG_AMD_ROCM_METADATA_PREFER_OLDER) namespace miopen { namespace debug { -bool IsWarmupOngoing = false; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) +MIOPEN_EXPORT bool IsWarmupOngoing = + false; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) } // namespace debug } // namespace miopen diff --git a/src/find_controls.cpp b/src/find_controls.cpp index 3790a354ee..7e7d291b02 100644 --- a/src/find_controls.cpp +++ b/src/find_controls.cpp @@ -48,7 +48,8 @@ namespace miopen { namespace debug { -bool FindEnforceDisable = false; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) +MIOPEN_EXPORT bool FindEnforceDisable = + false; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) } // namespace debug diff --git a/src/find_db.cpp b/src/find_db.cpp index f2845f546c..ec41e38d47 100644 --- a/src/find_db.cpp +++ b/src/find_db.cpp @@ -40,7 +40,8 @@ namespace miopen { namespace debug { -bool testing_find_db_enabled = true; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) +MIOPEN_EXPORT bool testing_find_db_enabled = + true; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) /// \todo Remove when #1723 is resolved. boost::optional& testing_find_db_path_override() diff --git a/src/include/miopen/conv_algo_name.hpp b/src/include/miopen/conv_algo_name.hpp index cfcd32a76e..d0d04ca10e 100644 --- a/src/include/miopen/conv_algo_name.hpp +++ b/src/include/miopen/conv_algo_name.hpp @@ -28,6 +28,7 @@ #include #include +#include namespace miopen { @@ -46,6 +47,7 @@ miopenConvFwdAlgorithm_t StringToConvolutionFwdAlgo(const std::string& s); miopenConvBwdDataAlgorithm_t StringToConvolutionBwdDataAlgo(const std::string& s); miopenConvBwdWeightsAlgorithm_t StringToConvolutionBwdWeightsAlgo(const std::string& s); +MIOPEN_EXPORT std::string ConvolutionAlgoToString(miopenConvAlgorithm_t algo); std::string ConvolutionAlgoToDirectionalString(miopenConvAlgorithm_t algo, conv::Direction dir); diff --git a/src/include/miopen/convolution.hpp b/src/include/miopen/convolution.hpp index 48cd5882e8..f350591976 100644 --- a/src/include/miopen/convolution.hpp +++ b/src/include/miopen/convolution.hpp @@ -154,7 +154,7 @@ struct ConvolutionAttribute friend void from_json(const nlohmann::json& json, ConvolutionAttribute& conv); }; -struct ConvolutionDescriptor : miopenConvolutionDescriptor +struct MIOPEN_EXPORT ConvolutionDescriptor : miopenConvolutionDescriptor { ConvolutionDescriptor(std::size_t spatial_dim, miopenConvolutionMode_t c_mode, diff --git a/src/include/miopen/execution_context.hpp b/src/include/miopen/execution_context.hpp index 9a8d6ad197..1f0efbbe19 100644 --- a/src/include/miopen/execution_context.hpp +++ b/src/include/miopen/execution_context.hpp @@ -71,7 +71,8 @@ namespace debug { /// is in progress. The library can use this, for example, to disable some /// workarounds that would affect warm-up otherwise. /// WARNING: This switch is not intended for use in multi-threaded applications. -extern bool IsWarmupOngoing; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) +MIOPEN_EXPORT extern bool + IsWarmupOngoing; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) } // namespace debug diff --git a/src/include/miopen/find_controls.hpp b/src/include/miopen/find_controls.hpp index 65bb440c0d..d62937b89b 100644 --- a/src/include/miopen/find_controls.hpp +++ b/src/include/miopen/find_controls.hpp @@ -41,7 +41,8 @@ namespace debug { /// Disable MIOPEN_FIND_ENFORCE. Intended for debugging/testing purposes. /// Currently used during warm-up phase in MIOpenDriver. /// WARNING: This switch is not intended for use in multi-threaded applications. -extern bool FindEnforceDisable; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) +MIOPEN_EXPORT extern bool + FindEnforceDisable; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) } // namespace debug diff --git a/src/include/miopen/find_db.hpp b/src/include/miopen/find_db.hpp index 677c4345c7..c29fcf2c2b 100644 --- a/src/include/miopen/find_db.hpp +++ b/src/include/miopen/find_db.hpp @@ -66,8 +66,9 @@ using UserFindDbRecord = FindDbRecord_t; namespace debug { // For unit tests. -extern bool testing_find_db_enabled; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) -extern boost::optional& +MIOPEN_EXPORT extern bool + testing_find_db_enabled; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) +MIOPEN_EXPORT extern boost::optional& testing_find_db_path_override(); /// \todo Remove when #1723 is resolved. } // namespace debug diff --git a/src/include/miopen/gemm_v2.hpp b/src/include/miopen/gemm_v2.hpp index 9300ffa29b..5078123015 100644 --- a/src/include/miopen/gemm_v2.hpp +++ b/src/include/miopen/gemm_v2.hpp @@ -133,6 +133,7 @@ miopenStatus_t CallGemmTimeMeasure(const Handle& handle, CallGemmType_t call_gemm_type, GemmBackend_t gemm_backend = GemmBackend_t::rocblas); +MIOPEN_EXPORT miopenStatus_t CallGemm(const Handle& handle, GemmDescriptor gemm_desc, ConstData_t A, @@ -143,6 +144,7 @@ miopenStatus_t CallGemm(const Handle& handle, int c_offset, GemmBackend_t gemm_backend = GemmBackend_t::rocblas); +MIOPEN_EXPORT miopenStatus_t CallGemmStridedBatched(const Handle& handle, GemmDescriptor gemm_desc, ConstData_t A, diff --git a/src/include/miopen/handle.hpp b/src/include/miopen/handle.hpp index 7d1bb79a37..5fdc200d56 100644 --- a/src/include/miopen/handle.hpp +++ b/src/include/miopen/handle.hpp @@ -75,7 +75,7 @@ using GemmKey = std::pair; using rocblas_handle_ptr = MIOPEN_MANAGE_PTR(rocblas_handle, rocblas_destroy_handle); #endif -struct Handle : miopenHandle +struct MIOPEN_EXPORT Handle : miopenHandle { friend struct TargetProperties; diff --git a/src/include/miopen/logger.hpp b/src/include/miopen/logger.hpp index dc18eae5c0..998453df62 100644 --- a/src/include/miopen/logger.hpp +++ b/src/include/miopen/logger.hpp @@ -37,6 +37,7 @@ #include #include #include +#include #ifndef _WIN32 #include @@ -212,16 +213,17 @@ namespace debug { /// by MIOPEN_LOG_NQ* macros (that ignore this switch). /// /// WARNING: This switch is not intended for use in multi-threaded applications. -extern bool LoggingQuiet; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) +MIOPEN_EXPORT extern bool + LoggingQuiet; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) } // namespace debug -const char* LoggingLevelToCString(LoggingLevel level); -std::string LoggingPrefix(); +MIOPEN_EXPORT const char* LoggingLevelToCString(LoggingLevel level); +MIOPEN_EXPORT std::string LoggingPrefix(); /// \return true if level is enabled. /// \param level - one of the values defined in LoggingLevel. -bool IsLogging(LoggingLevel level, bool disableQuieting = false); +MIOPEN_EXPORT bool IsLogging(LoggingLevel level, bool disableQuieting = false); bool IsLoggingCmd(); bool IsLoggingFunctionCalls(); bool IsLoggingToRoctx(); @@ -334,6 +336,7 @@ LogParam(std::ostream& os, std::string name, const std::vector& vec, bool ind #define MIOPEN_LOG_FUNCTION(...) #endif +MIOPEN_EXPORT std::string LoggingParseFunction(const char* func, const char* pretty_func); #define MIOPEN_GET_FN_NAME() \ diff --git a/src/include/miopen/pooling.hpp b/src/include/miopen/pooling.hpp index d40cbe6628..0ab5ffa1c7 100644 --- a/src/include/miopen/pooling.hpp +++ b/src/include/miopen/pooling.hpp @@ -91,7 +91,7 @@ inline std::string get_pooling_index_type_max_name(miopenIndexType_t index_type) struct Handle; struct TensorDescriptor; -struct PoolingDescriptor : miopenPoolingDescriptor +struct MIOPEN_EXPORT PoolingDescriptor : miopenPoolingDescriptor { PoolingDescriptor(); diff --git a/src/include/miopen/solver.hpp b/src/include/miopen/solver.hpp index f7c2b7666d..a92e532f87 100644 --- a/src/include/miopen/solver.hpp +++ b/src/include/miopen/solver.hpp @@ -55,7 +55,7 @@ namespace debug { /// If set to true, then always enable ConvDirectNaive* solver, regardless of environment value /// MIOPEN_DEBUG_CONV_DIRECT_NAIVE_CONV_* that control enable/disable of these solvers. /// Currently used during driver using naive kernel as gpu reference. -extern bool +MIOPEN_EXPORT extern bool AlwaysEnableConvDirectNaive; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) } // namespace debug diff --git a/src/include/miopen/solver_id.hpp b/src/include/miopen/solver_id.hpp index 477053ed20..64d619ee60 100644 --- a/src/include/miopen/solver_id.hpp +++ b/src/include/miopen/solver_id.hpp @@ -55,7 +55,7 @@ enum class Primitive Normalization }; -struct Id +struct MIOPEN_EXPORT Id { static constexpr uint64_t invalid_value = 0; diff --git a/src/include/miopen/tensor.hpp b/src/include/miopen/tensor.hpp index 6fbf41a9e6..b7b7d3d568 100644 --- a/src/include/miopen/tensor.hpp +++ b/src/include/miopen/tensor.hpp @@ -123,7 +123,7 @@ std::ptrdiff_t integer_division_ceil(X x, Y y) return (tx + ty - 1) / ty; } -struct TensorDescriptor : miopenTensorDescriptor +struct MIOPEN_EXPORT TensorDescriptor : miopenTensorDescriptor { TensorDescriptor(); diff --git a/src/logger.cpp b/src/logger.cpp index 9a82f1c1ac..e482587d1c 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -65,7 +65,8 @@ MIOPEN_DECLARE_ENV_VAR(MIOPEN_ENABLE_LOGGING_ROCTX) namespace debug { -bool LoggingQuiet = false; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) +MIOPEN_EXPORT bool LoggingQuiet = + false; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) } // namespace debug diff --git a/src/solver/conv_direct_naive_conv.cpp b/src/solver/conv_direct_naive_conv.cpp index 66be299a70..d3549da41a 100644 --- a/src/solver/conv_direct_naive_conv.cpp +++ b/src/solver/conv_direct_naive_conv.cpp @@ -38,7 +38,7 @@ namespace miopen { namespace debug { // NOLINTNEXTLINE (cppcoreguidelines-avoid-non-const-global-variables) -bool AlwaysEnableConvDirectNaive = false; +MIOPEN_EXPORT bool AlwaysEnableConvDirectNaive = false; } // namespace debug diff --git a/test/gpu_conv.hpp b/test/gpu_conv.hpp index 3165ace5fc..5ab33e3bfe 100644 --- a/test/gpu_conv.hpp +++ b/test/gpu_conv.hpp @@ -35,9 +35,10 @@ namespace miopen { namespace debug { -extern bool +MIOPEN_EXPORT extern bool AlwaysEnableConvDirectNaive; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) -extern bool LoggingQuiet; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) +MIOPEN_EXPORT extern bool + LoggingQuiet; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) } // namespace debug } // namespace miopen From ae2606857b0e94d43e6f46aeb0ab77bcb48abf7f Mon Sep 17 00:00:00 2001 From: Jun Liu Date: Sun, 24 Dec 2023 23:19:09 -0800 Subject: [PATCH 3/3] fix format issues --- src/execution_context.cpp | 4 ++-- src/find_controls.cpp | 4 ++-- src/find_db.cpp | 4 ++-- src/logger.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/execution_context.cpp b/src/execution_context.cpp index e36f02b57a..aa95392591 100644 --- a/src/execution_context.cpp +++ b/src/execution_context.cpp @@ -46,8 +46,8 @@ MIOPEN_DECLARE_ENV_VAR_BOOL(MIOPEN_DEBUG_AMD_ROCM_METADATA_PREFER_OLDER) namespace miopen { namespace debug { -MIOPEN_EXPORT bool IsWarmupOngoing = - false; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) +// NOLINTNEXTLINE (cppcoreguidelines-avoid-non-const-global-variables) +MIOPEN_EXPORT bool IsWarmupOngoing = false; } // namespace debug } // namespace miopen diff --git a/src/find_controls.cpp b/src/find_controls.cpp index a2e440aee3..87a3449368 100644 --- a/src/find_controls.cpp +++ b/src/find_controls.cpp @@ -48,8 +48,8 @@ namespace miopen { namespace debug { -MIOPEN_EXPORT bool FindEnforceDisable = - false; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) +// NOLINTNEXTLINE (cppcoreguidelines-avoid-non-const-global-variables) +MIOPEN_EXPORT bool FindEnforceDisable = false; } // namespace debug diff --git a/src/find_db.cpp b/src/find_db.cpp index ec41e38d47..99d7de426b 100644 --- a/src/find_db.cpp +++ b/src/find_db.cpp @@ -40,8 +40,8 @@ namespace miopen { namespace debug { -MIOPEN_EXPORT bool testing_find_db_enabled = - true; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) +// NOLINTNEXTLINE (cppcoreguidelines-avoid-non-const-global-variables) +MIOPEN_EXPORT bool testing_find_db_enabled = true; /// \todo Remove when #1723 is resolved. boost::optional& testing_find_db_path_override() diff --git a/src/logger.cpp b/src/logger.cpp index 50a0de120c..6c8bc039da 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -68,8 +68,8 @@ namespace miopen { namespace debug { -MIOPEN_EXPORT bool LoggingQuiet = - false; // NOLINT (cppcoreguidelines-avoid-non-const-global-variables) +// NOLINTNEXTLINE (cppcoreguidelines-avoid-non-const-global-variables) +MIOPEN_EXPORT bool LoggingQuiet = false; } // namespace debug