From eb9228c33d7ef58444facb6a47743216c9148be7 Mon Sep 17 00:00:00 2001 From: River Li Date: Fri, 2 Feb 2024 06:26:41 +0800 Subject: [PATCH] Remove legacy ie::Version and replaced by ov::Version (#22582) Co-authored-by: Ilya Lavrenov --- cmake/developer_package/version.cmake | 2 +- src/cmake/openvino.cmake | 1 - src/inference/CMakeLists.txt | 1 - .../interface/ie_iplugin_internal.hpp | 9 +- src/inference/include/ie/ie_core.hpp | 4 +- src/inference/include/ie/ie_version.hpp | 127 ------------------ .../interface/ie_iplugin_internal.cpp | 5 +- src/inference/src/dev/converter_utils.cpp | 3 +- src/inference/src/dev/core_impl.cpp | 2 +- src/inference/src/dev/core_impl.hpp | 2 +- src/inference/src/dev/core_impl_ie.cpp | 4 +- src/inference/src/ie_core.cpp | 2 +- src/inference/src/ie_version.cpp | 18 --- 13 files changed, 15 insertions(+), 165 deletions(-) delete mode 100644 src/inference/include/ie/ie_version.hpp delete mode 100644 src/inference/src/ie_version.cpp diff --git a/cmake/developer_package/version.cmake b/cmake/developer_package/version.cmake index cfefa2303d8fba..f6114ab58c304d 100644 --- a/cmake/developer_package/version.cmake +++ b/cmake/developer_package/version.cmake @@ -108,7 +108,7 @@ macro(ov_parse_ci_build_number repo_root) endforeach() endfunction() - # detect OpenVINO version via openvino/core/version.hpp and ie_version.hpp + # detect OpenVINO version via openvino/core/version.hpp ov_compare_version_with_headers() # detect commit number diff --git a/src/cmake/openvino.cmake b/src/cmake/openvino.cmake index e093302dd55129..770615d9365010 100644 --- a/src/cmake/openvino.cmake +++ b/src/cmake/openvino.cmake @@ -23,7 +23,6 @@ add_library(${TARGET_NAME} $ $ $ - $ $ $ $<$:$>) diff --git a/src/inference/CMakeLists.txt b/src/inference/CMakeLists.txt index abdf8f57e979c7..86cf96924a8062 100644 --- a/src/inference/CMakeLists.txt +++ b/src/inference/CMakeLists.txt @@ -84,7 +84,6 @@ add_library(${TARGET_NAME}_obj OBJECT ${LIBRARY_HEADERS} ${PUBLIC_HEADERS}) -ov_add_version_defines(src/ie_version.cpp ${TARGET_NAME}_obj) if(NOT BUILD_SHARED_LIBS) target_compile_definitions(${TARGET_NAME}_obj PUBLIC OPENVINO_STATIC_LIBRARY) diff --git a/src/inference/dev_api/cpp_interfaces/interface/ie_iplugin_internal.hpp b/src/inference/dev_api/cpp_interfaces/interface/ie_iplugin_internal.hpp index 7adc5b06bc7115..8480eef310b5be 100644 --- a/src/inference/dev_api/cpp_interfaces/interface/ie_iplugin_internal.hpp +++ b/src/inference/dev_api/cpp_interfaces/interface/ie_iplugin_internal.hpp @@ -21,7 +21,6 @@ #include "openvino/runtime/iplugin.hpp" #include "openvino/runtime/so_ptr.hpp" #include "openvino/util/pp.hpp" -#include "ie_version.hpp" using namespace ov::threading; @@ -119,7 +118,7 @@ GetSupportedNodes(const std::shared_ptr& model, */ class INFERENCE_ENGINE_1_0_DEPRECATED INFERENCE_ENGINE_API_CLASS(IInferencePlugin) : public std::enable_shared_from_this { - class VersionStore : public Version { + class VersionStore : public ov::Version { void copyFrom(const Version& v); public: @@ -140,13 +139,13 @@ class INFERENCE_ENGINE_1_0_DEPRECATED INFERENCE_ENGINE_API_CLASS(IInferencePlugi * @brief Sets a plugin version * @param version A version to set */ - void SetVersion(const Version& version); + void SetVersion(const ov::Version& version); /** * @brief Gets a plugin version - * @return A const InferenceEngine::Version object + * @return A const ov::Version object */ - const Version& GetVersion() const; + const ov::Version& GetVersion() const; /** * @brief Provides a name of a plugin diff --git a/src/inference/include/ie/ie_core.hpp b/src/inference/include/ie/ie_core.hpp index 69269374c7dbc4..a18cba26cbca7f 100644 --- a/src/inference/include/ie/ie_core.hpp +++ b/src/inference/include/ie/ie_core.hpp @@ -26,7 +26,7 @@ #include #include "cpp/ie_executable_network.hpp" -#include "ie_version.hpp" +#include "openvino/core/version.hpp" namespace InferenceEngine { @@ -61,7 +61,7 @@ class INFERENCE_ENGINE_1_0_DEPRECATED INFERENCE_ENGINE_API_CLASS(Core) { * @param deviceName Device name to identify plugin * @return A vector of versions */ - std::map GetVersions(const std::string& deviceName) const; + std::map GetVersions(const std::string& deviceName) const; #ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT /** diff --git a/src/inference/include/ie/ie_version.hpp b/src/inference/include/ie/ie_version.hpp deleted file mode 100644 index 9363aa7d82be5f..00000000000000 --- a/src/inference/include/ie/ie_version.hpp +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -/** - * @brief A header file that provides versioning information for the Inference Engine library - * - * @file ie_version.hpp - */ -#pragma once - -#if !defined(IN_OV_COMPONENT) && !defined(IE_LEGACY_HEADER_INCLUDED) -# define IE_LEGACY_HEADER_INCLUDED -# ifdef _MSC_VER -# pragma message( \ - "The Inference Engine API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html") -# else -# warning("The Inference Engine API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html") -# endif -#endif - -/** - * @def IE_VERSION_MAJOR - * @brief Defines Inference Engine major version - * - * @def IE_VERSION_MINOR - * @brief Defines Inference Engine minor version - * - * @def IE_VERSION_PATCH - * @brief Defines Inference Engine patch version - */ - -#define IE_VERSION_MAJOR 2024 -#define IE_VERSION_MINOR 0 -#define IE_VERSION_PATCH 0 - -#include "ie_api.h" - -/** - * @brief Inference Engine C++ API - */ -namespace InferenceEngine { -IE_SUPPRESS_DEPRECATED_START - -/** - * @struct Version - * @brief Represents version information that describes plugins and the inference engine runtime library - */ -#pragma pack(push, 1) -struct INFERENCE_ENGINE_1_0_DEPRECATED Version { - IE_SUPPRESS_DEPRECATED_START - /** - * @deprecated Use IE_VERSION_[MAJOR|MINOR|PATCH] definitions, buildNumber property - * @brief An API version reflects the set of supported features - */ - struct INFERENCE_ENGINE_1_0_DEPRECATED ApiVersion { - INFERENCE_ENGINE_DEPRECATED("Use IE_VERSION_[MAJOR|MINOR|PATCH] definitions, buildNumber property") - int major; //!< A major version - INFERENCE_ENGINE_DEPRECATED("Use IE_VERSION_[MAJOR|MINOR|PATCH] definitions, buildNumber property") - int minor; //!< A minor version - - /** - * @brief A default construtor - */ - ApiVersion() { - major = 0; - minor = 0; - } - - /** - * @brief A default construtor - * @param v A version to copy - */ - ApiVersion(const ApiVersion& v) { - major = v.major; - minor = v.minor; - } - - /** - * @brief A default construtor - * @param _major A major version to copy - * @param _minor A minor version to copy - */ - ApiVersion(int _major, int _minor) { - major = _major; - minor = _minor; - } - - /** - * @brief A copy operator - * @param other An object to copy - * @return A copy - */ - ApiVersion& operator=(const ApiVersion& other) { - major = other.major; - minor = other.minor; - return *this; - } - }; - - /** - * @brief An API version reflects the set of supported features - */ - ApiVersion apiVersion; - IE_SUPPRESS_DEPRECATED_END - - /** - * @brief A null terminated string with build number - */ - const char* buildNumber; - - /** - * @brief A null terminated description string - */ - const char* description; -}; -#pragma pack(pop) - -/** - * @brief Gets the current Inference Engine version - * - * @return The current Inference Engine version - */ -INFERENCE_ENGINE_API(const Version*) GetInferenceEngineVersion() noexcept; - -IE_SUPPRESS_DEPRECATED_END -} // namespace InferenceEngine diff --git a/src/inference/src/cpp_interfaces/interface/ie_iplugin_internal.cpp b/src/inference/src/cpp_interfaces/interface/ie_iplugin_internal.cpp index 0e2ab407e70a39..8612b7b64f0a49 100644 --- a/src/inference/src/cpp_interfaces/interface/ie_iplugin_internal.cpp +++ b/src/inference/src/cpp_interfaces/interface/ie_iplugin_internal.cpp @@ -69,7 +69,6 @@ IInferencePlugin::IInferencePlugin() : _executorManager(ov::threading::executor_ void IInferencePlugin::VersionStore::copyFrom(const Version& v) { description = v.description; buildNumber = v.buildNumber; - apiVersion = v.apiVersion; } IInferencePlugin::VersionStore::VersionStore(const Version& v) { @@ -83,11 +82,11 @@ IInferencePlugin::VersionStore& IInferencePlugin::VersionStore::operator=(const return *this; } -void IInferencePlugin::SetVersion(const Version& version) { +void IInferencePlugin::SetVersion(const ov::Version& version) { _version = VersionStore(version); } -const Version& IInferencePlugin::GetVersion() const { +const ov::Version& IInferencePlugin::GetVersion() const { return _version; } diff --git a/src/inference/src/dev/converter_utils.cpp b/src/inference/src/dev/converter_utils.cpp index f0eecf133c3101..0c3423fa546ae9 100644 --- a/src/inference/src/dev/converter_utils.cpp +++ b/src/inference/src/dev/converter_utils.cpp @@ -20,7 +20,6 @@ #include "ie_input_info.hpp" #include "ie_layouts.h" #include "ie_ngraph_utils.hpp" -#include "ie_version.hpp" #include "iplugin_wrapper.hpp" #include "legacy_op_extension.hpp" #include "openvino/core/except.hpp" @@ -212,7 +211,7 @@ class IInferencePluginWrapper : public InferenceEngine::IInferencePlugin { public: IInferencePluginWrapper(const ov::SoPtr& plugin) : m_plugin(plugin) { auto& ver = plugin->get_version(); - InferenceEngine::Version version; + ov::Version version; version.buildNumber = ver.buildNumber; version.description = ver.description; SetVersion(version); diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cpp index f93bddf42a727e..5de1ef066e52a8 100644 --- a/src/inference/src/dev/core_impl.cpp +++ b/src/inference/src/dev/core_impl.cpp @@ -1422,7 +1422,7 @@ ov::SoPtr ov::CoreImpl::compile_model_and_cache(const std::s plugin.get_property(ov::internal::compiled_model_runtime_properties.name(), {}).as(); } cacheContent.cacheManager->write_cache_entry(cacheContent.blobId, [&](std::ostream& networkStream) { - networkStream << ov::CompiledBlobHeader(InferenceEngine::GetInferenceEngineVersion()->buildNumber, + networkStream << ov::CompiledBlobHeader(ov::get_openvino_version().buildNumber, ov::ModelCache::calculate_file_info(cacheContent.modelPath), compiled_model_runtime_properties); execNetwork->export_model(networkStream); diff --git a/src/inference/src/dev/core_impl.hpp b/src/inference/src/dev/core_impl.hpp index a0663737db9e03..e5b4ec64d9f2f8 100644 --- a/src/inference/src/dev/core_impl.hpp +++ b/src/inference/src/dev/core_impl.hpp @@ -277,7 +277,7 @@ class CoreImpl : public InferenceEngine::ICore, public std::enable_shared_from_t bool DeviceSupportsModelCaching(const std::string& deviceName) const override; - std::map GetVersions(const std::string& deviceName) const; + std::map GetVersions(const std::string& deviceName) const; // Common API diff --git a/src/inference/src/dev/core_impl_ie.cpp b/src/inference/src/dev/core_impl_ie.cpp index 2a051a5f61fd4e..5be5624aba8151 100644 --- a/src/inference/src/dev/core_impl_ie.cpp +++ b/src/inference/src/dev/core_impl_ie.cpp @@ -184,8 +184,8 @@ std::map ov::CoreImpl::GetSupportedConfig(const std::s return ov::any_copy(get_supported_property(deviceName, any_copy(configs))); } -std::map ov::CoreImpl::GetVersions(const std::string& deviceName) const { - std::map versions; +std::map ov::CoreImpl::GetVersions(const std::string& deviceName) const { + std::map versions; std::vector deviceNames; { diff --git a/src/inference/src/ie_core.cpp b/src/inference/src/ie_core.cpp index 468f488b2043de..3073ae4f65be06 100644 --- a/src/inference/src/ie_core.cpp +++ b/src/inference/src/ie_core.cpp @@ -89,7 +89,7 @@ Core::Core(const std::string& xmlConfigFile) { } } -std::map Core::GetVersions(const std::string& deviceName) const { +std::map Core::GetVersions(const std::string& deviceName) const { return _impl->GetVersions(deviceName); } diff --git a/src/inference/src/ie_version.cpp b/src/inference/src/ie_version.cpp deleted file mode 100644 index 462a92e27d3aa2..00000000000000 --- a/src/inference/src/ie_version.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "ie_version.hpp" - -IE_SUPPRESS_DEPRECATED_START -namespace InferenceEngine { - -const Version* GetInferenceEngineVersion() noexcept { - // Use local static variable to make sure it is always properly initialized - // even if called from global constructor - static Version inferenceEngineVersion = {{2, 1}, // inference engine API version - CI_BUILD_NUMBER, - "IE"}; - return &inferenceEngineVersion; -} -} // namespace InferenceEngine