Removed InferenceEngine dependency on Legacy library (#1932)

* Split libraries

* Small fixes

* Fixes after self-review

* Minimized legacy usage

* Fixed IE_CPU.onnx_prior_box

* Fixed linkage

* Temp WA for private plugins

* removed comments

* Reverted OneHot changes back
This commit is contained in:
Ilya Lavrenov 2020-10-29 10:54:57 +03:00 committed by GitHub
parent 53b865eb58
commit 901f1e0436
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 153 additions and 231 deletions

View File

@ -3,8 +3,7 @@
#
if(DEFINED IE_MAIN_SOURCE_DIR AND TARGET inference_engine)
set(InferenceEngine_LIBRARIES inference_engine_legacy inference_engine
inference_engine_c_api)
set(InferenceEngine_LIBRARIES inference_engine inference_engine_c_api)
else()
include("${CMAKE_CURRENT_LIST_DIR}/targets.cmake")
if(NOT MSVC)
@ -29,8 +28,7 @@ else()
endif()
get_target_property(InferenceEngine_INCLUDE_DIRS IE::inference_engine INTERFACE_INCLUDE_DIRECTORIES)
set(InferenceEngine_LIBRARIES IE::inference_engine_legacy IE::inference_engine
IE::inference_engine_c_api)
set(InferenceEngine_LIBRARIES IE::inference_engine IE::inference_engine_c_api)
foreach(library IN LISTS InferenceEngine_LIBRARIES)
if(CMAKE_CROSSCOMPILING AND NOT MSVC)

View File

@ -32,15 +32,11 @@ set(GNA "@GNA@")
include("${CMAKE_CURRENT_LIST_DIR}/targets_developer.cmake")
# for compatibility
set_property(TARGET IE::inference_engine_legacy APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${IE_MAIN_SOURCE_DIR}/src/legacy_api/include/legacy")
# to allow too create ALIAS for IE::inference_engine in 3rd-party projects
set_property(TARGET IE::inference_engine PROPERTY IMPORTED_GLOBAL TRUE)
get_target_property(InferenceEngine_INCLUDE_DIRS IE::inference_engine INTERFACE_INCLUDE_DIRECTORIES)
set(InferenceEngine_LIBRARIES IE::inference_engine_legacy IE::inference_engine)
set(InferenceEngine_LIBRARIES IE::inference_engine)
#
# Common cmake includes

View File

@ -56,9 +56,11 @@ function(ie_add_plugin)
target_compile_definitions(${IE_PLUGIN_NAME} PRIVATE IMPLEMENT_INFERENCE_ENGINE_PLUGIN)
if(TARGET IE::inference_engine_plugin_api)
target_link_libraries(${IE_PLUGIN_NAME} PRIVATE IE::inference_engine_plugin_api)
target_link_libraries(${IE_PLUGIN_NAME} PRIVATE IE::inference_engine_plugin_api
IE::inference_engine_legacy)
else()
target_link_libraries(${IE_PLUGIN_NAME} PRIVATE inference_engine_plugin_api)
target_link_libraries(${IE_PLUGIN_NAME} PRIVATE inference_engine_plugin_api
inference_engine_legacy)
endif()
if(WIN32)

View File

@ -16,7 +16,6 @@
# and the following imported targets:
#
# IE::inference_engine - The Inference Engine library
# IE::inference_engine_legacy - The Inference Engine library with legacy API for IR v7 and older.
# IE::inference_engine_c_api - The Inference Engine C API library
#
@ -38,7 +37,7 @@ set(InferenceEngine_FOUND FALSE)
if(TARGET IE::inference_engine)
set(InferenceEngine_FOUND TRUE)
get_target_property(InferenceEngine_INCLUDE_DIRS IE::inference_engine INTERFACE_INCLUDE_DIRECTORIES)
set(InferenceEngine_LIBRARIES IE::inference_engine_legacy IE::inference_engine
set(InferenceEngine_LIBRARIES IE::inference_engine
IE::inference_engine_c_api)
else()
if (WIN32)
@ -85,28 +84,25 @@ else()
if(WIN32)
find_library(IE_RELEASE_LIBRARY inference_engine@IE_RELEASE_POSTFIX_WIN@ "${IE_LIB_REL_DIR}" NO_DEFAULT_PATH)
find_library(IE_LEGACY_RELEASE_LIBRARY inference_engine_legacy@IE_RELEASE_POSTFIX_WIN@ "${IE_LIB_REL_DIR}" NO_DEFAULT_PATH)
find_library(IE_C_API_RELEASE_LIBRARY inference_engine_c_api@IE_RELEASE_POSTFIX_WIN@ "${IE_LIB_REL_DIR}" NO_DEFAULT_PATH)
elseif(APPLE)
find_library(IE_RELEASE_LIBRARY inference_engine@IE_RELEASE_POSTFIX_MAC@ "${IE_LIB_DIR}" NO_DEFAULT_PATH)
find_library(IE_LEGACY_RELEASE_LIBRARY inference_engine_legacy@IE_RELEASE_POSTFIX_MAC@ "${IE_LIB_DIR}" NO_DEFAULT_PATH)
find_library(IE_C_API_RELEASE_LIBRARY inference_engine_c_api@IE_RELEASE_POSTFIX_MAC@ "${IE_LIB_DIR}" NO_DEFAULT_PATH)
else()
find_library(IE_RELEASE_LIBRARY inference_engine@IE_RELEASE_POSTFIX_LIN@ "${IE_LIB_DIR}" NO_DEFAULT_PATH)
find_library(IE_LEGACY_RELEASE_LIBRARY inference_engine_legacy@IE_RELEASE_POSTFIX_LIN@ "${IE_LIB_DIR}" NO_DEFAULT_PATH)
find_library(IE_C_API_RELEASE_LIBRARY inference_engine_c_api@IE_RELEASE_POSTFIX_LIN@ "${IE_LIB_DIR}" NO_DEFAULT_PATH)
endif()
find_package_handle_standard_args( InferenceEngine
FOUND_VAR INFERENCEENGINE_FOUND
REQUIRED_VARS IE_RELEASE_LIBRARY IE_LEGACY_RELEASE_LIBRARY IE_C_API_RELEASE_LIBRARY IE_INCLUDE_DIR
REQUIRED_VARS IE_RELEASE_LIBRARY IE_C_API_RELEASE_LIBRARY IE_INCLUDE_DIR
FAIL_MESSAGE "Some of mandatory Inference Engine components are not found. Please consult InferenceEgnineConfig.cmake module's help page.")
if(INFERENCEENGINE_FOUND)
# to keep this line for successful execution in CMake 2.8
set(InferenceEngine_FOUND TRUE)
foreach(ie_library_suffix "" "_legacy" "_c_api")
foreach(ie_library_suffix "" "_c_api")
string(TOUPPER "${ie_library_suffix}" ie_library_usuffix)
add_library(IE::inference_engine${ie_library_suffix} SHARED IMPORTED GLOBAL)
@ -163,7 +159,7 @@ else()
endforeach()
set(InferenceEngine_INCLUDE_DIRS ${IE_INCLUDE_DIR})
set(InferenceEngine_LIBRARIES IE::inference_engine_legacy IE::inference_engine
set(InferenceEngine_LIBRARIES IE::inference_engine
IE::inference_engine_c_api)
set(IE_EXTERNAL_DIR "${IE_ROOT_DIR}/external")

View File

@ -18,10 +18,12 @@ elseif(ARCH STREQUAL "i386")
endif()
if(DEFINED IE_MAIN_SOURCE_DIR)
set(InferenceEngine_LIBRARIES inference_engine inference_engine_plugin_api)
set(InferenceEngine_LIBRARIES inference_engine)
list(APPEND InferenceEngine_LIBRARIES inference_engine_legacy) # TODO: remove in PR #2755
else()
find_package(InferenceEngineDeveloperPackage REQUIRED)
set(InferenceEngine_LIBRARIES IE::inference_engine IE::inference_engine_plugin_api)
set(InferenceEngine_LIBRARIES IE::inference_engine)
list(APPEND InferenceEngine_LIBRARIES IE::inference_engine_legacy) # TODO: remove in PR #2755
endif()
if(UNIX)

View File

@ -21,7 +21,9 @@ ie_add_plugin(NAME ${TARGET_NAME}
SOURCES ${MAIN_SRC} ${LIBRARY_HEADERS}
VERSION_DEFINES_FOR cldnn_engine.cpp)
target_link_libraries(${TARGET_NAME} PRIVATE clDNN_lib pugixml inference_engine inference_engine_transformations)
target_link_libraries(${TARGET_NAME} PRIVATE clDNN_lib pugixml
inference_engine inference_engine_legacy
inference_engine_transformations)
if(USE_CNNNETWORK_LPT)
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine_lp_transformations_legacy)

View File

@ -26,7 +26,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <exec_graph_info.hpp>
#include <legacy/ie_ngraph_utils.hpp>
#include <ie_ngraph_utils.hpp>
#include "generic_ie.hpp"
#include <ngraph/variant.hpp>

View File

@ -31,7 +31,7 @@ ie_add_plugin(NAME ${TARGET_NAME}
# saving rpath to GNA shared library be used by CI
log_rpath_from_dir(GNA ${libGNA_LIBRARIES_BASE_PATH})
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine Threads::Threads libGNA)
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine inference_engine_legacy Threads::Threads libGNA)
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(${TARGET_NAME}
@ -58,8 +58,8 @@ target_compile_definitions(${TARGET_NAME}_test_static
USE_STATIC_IE)
target_link_libraries(${TARGET_NAME}_test_static PUBLIC inference_engine_preproc_s libGNA::API)
target_include_directories(${TARGET_NAME}_test_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${TARGET_NAME}_test_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
$<TARGET_PROPERTY:inference_engine_legacy,INTERFACE_INCLUDE_DIRECTORIES>)
set_target_properties(${TARGET_NAME}_test_static PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME}_test_static)
set_target_properties(${TARGET_NAME} ${TARGET_NAME}_test_static

View File

@ -16,7 +16,8 @@ ie_faster_build(${TARGET_NAME}
UNITY
)
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine ade pugixml ${NGRAPH_LIBRARIES} inference_engine_transformations)
target_link_libraries(${TARGET_NAME} PRIVATE ade pugixml inference_engine
inference_engine_legacy ${NGRAPH_LIBRARIES} inference_engine_transformations)
ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})

View File

@ -23,7 +23,7 @@
#include <array>
#include <cstdint>
#include "legacy/ie_ngraph_utils.hpp"
#include "ie_ngraph_utils.hpp"
#include "ie_plugin_config.hpp"
#include "cpp_interfaces/interface/ie_internal_plugin_config.hpp"
#include "hetero/hetero_plugin_config.hpp"

View File

@ -7,27 +7,22 @@ set (TARGET_NAME "inference_engine")
file (GLOB LIBRARY_SRC
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/threading/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/shape_infer/ie_built_in_holder.cpp
)
# TODO: WA for OneHot pass usage in reshape
set(LEGACY_SRC_ROOT "${IE_MAIN_SOURCE_DIR}/src/legacy_api/src/")
list(APPEND LIBRARY_SRC
"${LEGACY_SRC_ROOT}/transformations/convert_opset1_to_legacy/convert_one_hot_to_one_hot_ie.cpp"
"${LEGACY_SRC_ROOT}/ngraph_ops/onehot_ie.cpp")
set(IE_STATIC_DEPENDENT_FILES ${CMAKE_CURRENT_SOURCE_DIR}/file_utils.cpp)
list(REMOVE_ITEM LIBRARY_SRC ${IE_STATIC_DEPENDENT_FILES})
set(IE_BASE_SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/cnn_network_ngraph_impl.cpp
# will be merged with file_utils.cpp after IE dependency on legacy is removed
${CMAKE_CURRENT_SOURCE_DIR}/ie_unicode.cpp
${CMAKE_CURRENT_SOURCE_DIR}/generic_ie.cpp
${CMAKE_CURRENT_SOURCE_DIR}/blob_factory.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ie_blob_common.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ie_data.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ie_layouts.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ie_memcpy.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ie_parameter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ie_rtti.cpp
${CMAKE_CURRENT_SOURCE_DIR}/precision_utils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/shape_infer/ie_built_in_holder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/system_allocator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/system_allocator.hpp)
file (GLOB LIBRARY_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/*.h
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp
)
if (LINUX)
file (GLOB LIBRARY_SRC
@ -36,10 +31,9 @@ if (LINUX)
file (GLOB LIBRARY_HEADERS
${LIBRARY_HEADERS}
${CMAKE_CURRENT_SOURCE_DIR}/os/lin/*.hpp)
endif()
if(UNIX)
list(APPEND IE_BASE_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/os/lin/lin_shared_object_loader.cpp)
elseif (UNIX)
list (APPEND LIBRARY_SRC
${CMAKE_CURRENT_SOURCE_DIR}/os/lin/lin_shared_object_loader.cpp)
endif()
if (WIN32)
@ -49,16 +43,8 @@ if (WIN32)
file (GLOB LIBRARY_HEADERS
${LIBRARY_HEADERS}
${CMAKE_CURRENT_SOURCE_DIR}/os/win/*.hpp)
list(APPEND IE_BASE_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/os/win/win_shared_object_loader.cpp)
endif()
list(REMOVE_ITEM LIBRARY_SRC ${IE_BASE_SOURCE_FILES})
file (GLOB LIBRARY_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/*.h
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp
)
if(ENABLE_SSE42)
file(GLOB SSE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/cpu_x86_sse42/*.cpp)
file(GLOB SSE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/cpu_x86_sse42/*.hpp)
@ -97,7 +83,6 @@ add_library(${TARGET_NAME}_plugin_api INTERFACE)
target_include_directories(${TARGET_NAME}_plugin_api INTERFACE
"${IE_MAIN_SOURCE_DIR}/src/plugin_api"
"${IE_MAIN_SOURCE_DIR}/src/legacy_api/include"
$<TARGET_PROPERTY:${TARGET_NAME}_preproc,INTERFACE_INCLUDE_DIRECTORIES>
${PUBLIC_HEADERS_DIR})
@ -110,26 +95,6 @@ file(GLOB_RECURSE plugin_api_src "${IE_MAIN_SOURCE_DIR}/src/plugin_api/*.hpp"
add_cpplint_target(${TARGET_NAME}_plugin_api_cpplint FOR_SOURCES ${plugin_api_src})
# Create common base object library
add_library(${TARGET_NAME}_common_obj OBJECT
${IE_BASE_SOURCE_FILES})
ie_faster_build(${TARGET_NAME}_common_obj
UNITY
PCH PRIVATE "precomp.hpp"
)
target_compile_definitions(${TARGET_NAME}_common_obj PRIVATE IMPLEMENT_INFERENCE_ENGINE_API)
target_include_directories(${TARGET_NAME}_common_obj PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}"
$<TARGET_PROPERTY:${TARGET_NAME}_transformations,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:${TARGET_NAME}_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>)
target_include_directories(${TARGET_NAME}_common_obj SYSTEM PRIVATE
$<TARGET_PROPERTY:pugixml,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ngraph::ngraph,INTERFACE_INCLUDE_DIRECTORIES>)
# Create object library
add_library(${TARGET_NAME}_obj OBJECT
@ -148,11 +113,11 @@ target_include_directories(${TARGET_NAME}_obj SYSTEM PRIVATE $<TARGET_PROPERTY:n
target_include_directories(${TARGET_NAME}_obj PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}"
"${IE_MAIN_SOURCE_DIR}/src/readers/ir_reader" # for ie_ir_version.hpp
$<TARGET_PROPERTY:${TARGET_NAME}_legacy,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:${TARGET_NAME}_transformations,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:${TARGET_NAME}_reader_api,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:${TARGET_NAME}_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>)
target_include_directories(${TARGET_NAME}_obj PRIVATE $<TARGET_PROPERTY:inference_engine_transformations,INTERFACE_INCLUDE_DIRECTORIES>)
if(ENABLE_MKL_DNN)
target_include_directories(${TARGET_NAME}_obj SYSTEM PRIVATE "${IE_MAIN_SOURCE_DIR}/thirdparty/mkl-dnn/src/cpu/xbyak")
endif()
@ -169,12 +134,11 @@ add_library(${TARGET_NAME} SHARED
set_ie_threading_interface_for(${TARGET_NAME})
target_link_libraries(${TARGET_NAME} PRIVATE ${CMAKE_DL_LIBS} Threads::Threads pugixml openvino::itt
${NGRAPH_LIBRARIES} inference_engine_transformations
PUBLIC ${TARGET_NAME}_legacy)
target_link_libraries(${TARGET_NAME} PRIVATE pugixml openvino::itt ${CMAKE_DL_LIBS} Threads::Threads
${NGRAPH_LIBRARIES} inference_engine_transformations)
target_include_directories(${TARGET_NAME} INTERFACE ${PUBLIC_HEADERS_DIR} PRIVATE
$<TARGET_PROPERTY:${TARGET_NAME}_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>)
target_include_directories(${TARGET_NAME} INTERFACE ${PUBLIC_HEADERS_DIR}
PRIVATE $<TARGET_PROPERTY:${TARGET_NAME}_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>)
if(WIN32)
set_target_properties(${TARGET_NAME} PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME})
@ -190,9 +154,8 @@ ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
# Static library used for unit tests which are always built
add_library(${TARGET_NAME}_s STATIC
$<TARGET_OBJECTS:${TARGET_NAME}_obj>
$<TARGET_OBJECTS:${TARGET_NAME}_common_obj>
$<TARGET_OBJECTS:${TARGET_NAME}_legacy_obj>
$<TARGET_OBJECTS:${TARGET_NAME}_obj>
${IE_STATIC_DEPENDENT_FILES})
set_ie_threading_interface_for(${TARGET_NAME}_s)
@ -205,15 +168,15 @@ if(WIN32)
set_target_properties(${TARGET_NAME}_s PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME}_s)
endif()
target_link_libraries(${TARGET_NAME}_s PRIVATE ${CMAKE_DL_LIBS} ${NGRAPH_LIBRARIES}
inference_engine_transformations openvino::itt
target_link_libraries(${TARGET_NAME}_s PRIVATE openvino::itt ${CMAKE_DL_LIBS} ${NGRAPH_LIBRARIES}
inference_engine_transformations
PUBLIC pugixml)
target_compile_definitions(${TARGET_NAME}_s PUBLIC USE_STATIC_IE)
# LTO
set_target_properties(${TARGET_NAME} ${TARGET_NAME}_obj ${TARGET_NAME}_s ${TARGET_NAME}_common_obj
set_target_properties(${TARGET_NAME} ${TARGET_NAME}_obj ${TARGET_NAME}_s
PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
# export targets

View File

@ -25,9 +25,10 @@
#include <transformations/smart_reshape/smart_reshape.hpp>
#include "transformations/serialize.hpp"
// TODO: remove this pass usage
#include <legacy/transformations/convert_opset1_to_legacy/convert_one_hot_to_one_hot_ie.hpp>
#include <legacy/ie_ngraph_utils.hpp>
#include "ie_ngraph_utils.hpp"
#include "exec_graph_info.hpp"
#include "ie_itt.hpp"
#include "generic_ie.hpp"
@ -67,6 +68,8 @@ CNNNetwork::CNNNetwork(const std::shared_ptr<ngraph::Function>& graph) {
}
}
ICNNNetwork::~ICNNNetwork() {}
void CNNNetworkNGraphImpl::createDataForResult(const ::ngraph::Output<::ngraph::Node>& output, const std::string& outName,
DataPtr& ptr) {
const auto isCompatible = [](size_t size, const Layout& l) -> bool {
@ -180,19 +183,14 @@ CNNNetworkNGraphImpl::CNNNetworkNGraphImpl(const ICNNNetwork& network) {
}
void CNNNetworkNGraphImpl::setInputInfo(InputInfo::Ptr data) {
if (cnnNetwork) cnnNetwork->setInputInfo(data);
_inputData[data->name()] = data;
}
const std::string& CNNNetworkNGraphImpl::getName() const noexcept {
if (cnnNetwork) {
return cnnNetwork->getName();
}
return _ngraph_function->get_friendly_name();
}
InputInfo::Ptr CNNNetworkNGraphImpl::getInput(const std::string& inputName) const noexcept {
if (cnnNetwork) return cnnNetwork->getInput(inputName);
auto it = _inputData.find(inputName);
if (it == _inputData.end()) {
return nullptr;
@ -201,41 +199,25 @@ InputInfo::Ptr CNNNetworkNGraphImpl::getInput(const std::string& inputName) cons
}
void CNNNetworkNGraphImpl::getOutputsInfo(OutputsDataMap& out) const noexcept {
if (cnnNetwork) {
cnnNetwork->getOutputsInfo(out);
return;
}
out = _outputData;
}
void CNNNetworkNGraphImpl::getInputsInfo(InputsDataMap& inputs) const noexcept {
if (cnnNetwork) {
cnnNetwork->getInputsInfo(inputs);
return;
}
inputs = _inputData;
}
size_t CNNNetworkNGraphImpl::layerCount() const noexcept {
if (cnnNetwork) return cnnNetwork->layerCount();
return _ngraph_function->get_ops().size();
}
void CNNNetworkNGraphImpl::validate(int version) {
if (cnnNetwork)
cnnNetwork->validate();
else
_ngraph_function->validate_nodes_and_infer_types();
_ngraph_function->validate_nodes_and_infer_types();
}
StatusCode CNNNetworkNGraphImpl::addOutput(const std::string& layerName, size_t outputIndex,
ResponseDesc* resp) noexcept {
OV_ITT_SCOPED_TASK(itt::domains::IE, "CNNNetworkNGraphImpl::addOutput");
if (cnnNetwork) {
return cnnNetwork->addOutput(layerName, outputIndex, resp);
}
try {
for (const auto & layer : _ngraph_function->get_ops()) {
if (layer->get_friendly_name() == layerName) {
@ -274,9 +256,6 @@ size_t CNNNetworkNGraphImpl::getBatchSize() const noexcept {
// The original code from CNNNetworkImpl just gets the first input and returns the first dimension.
// This is not correct in general. We can follow the same semantics, but order of inputs should be
// guaranteed to be the same.
if (cnnNetwork) {
return cnnNetwork->getBatchSize();
}
auto params = _ngraph_function->get_parameters();
for (const auto& param : params) {
if (param->get_partial_shape().rank().is_dynamic())
@ -306,8 +285,6 @@ void CNNNetworkNGraphImpl::reshape() {
StatusCode
CNNNetworkNGraphImpl::reshape(const std::map<std::string, std::vector<size_t>>& inputShapes,
ResponseDesc* responseDesc) noexcept {
if (cnnNetwork)
return cnnNetwork->reshape(inputShapes, responseDesc);
try {
auto params = _ngraph_function->get_parameters();
@ -318,8 +295,10 @@ CNNNetworkNGraphImpl::reshape(const std::map<std::string, std::vector<size_t>>&
auto it = inputShapes.find(param->get_friendly_name());
if (it == inputShapes.end())
continue;
if (param->get_partial_shape().is_dynamic() || param->get_shape() != it->second)
if (param->get_partial_shape().is_dynamic() || param->get_shape() != it->second) {
needReshape = true;
break;
}
}
if (needReshape) {
ngraph::pass::Manager ssr_manager;
@ -446,8 +425,6 @@ StatusCode CNNNetworkNGraphImpl::serialize(const std::string& xmlPath,
}
StatusCode CNNNetworkNGraphImpl::setBatchSize(size_t size, ResponseDesc* responseDesc) noexcept {
if (cnnNetwork)
return cnnNetwork->setBatchSize(size, responseDesc);
try {
if (getBatchSize() == size) return OK;
auto original_parameters = _ngraph_function->get_parameters();
@ -491,9 +468,3 @@ StatusCode CNNNetworkNGraphImpl::setBatchSize(size_t size, ResponseDesc* respons
return DescriptionBuffer(GENERAL_ERROR, responseDesc) << ex.what();
}
}
void CNNNetworkNGraphImpl::convertToCNNNetworkImpl() {
OV_ITT_SCOPED_TASK(itt::domains::IE, "CNNNetworkNGraphImpl::convertToCNNNetworkImpl");
if (!cnnNetwork)
cnnNetwork = std::make_shared<details::CNNNetworkImpl>(*this);
}

View File

@ -28,8 +28,6 @@
#include "ie_data.h"
#include "ie_input_info.hpp"
#include <legacy/cnn_network_impl.hpp>
namespace InferenceEngine {
namespace details {
@ -67,10 +65,10 @@ public:
}
std::shared_ptr<const ::ngraph::Function> getFunction() const noexcept override {
return !cnnNetwork ? _ngraph_function : nullptr;
return _ngraph_function;
}
std::shared_ptr<::ngraph::Function> getFunction() noexcept override {
return !cnnNetwork ? _ngraph_function : nullptr;
return _ngraph_function;
}
virtual void validate(int = 10);
@ -81,15 +79,15 @@ public:
StatusCode serialize(const std::string& xmlPath, const std::string& binPath, ResponseDesc* resp) const
noexcept override;
// used by convertFunctionToICNNNetwork from legacy library
std::map<std::string, DataPtr> _data;
protected:
virtual std::shared_ptr<::ngraph::Function> cloneFunction(bool constFolding = false) const;
std::shared_ptr<::ngraph::Function> _ngraph_function;
private:
std::map<std::string, DataPtr> _data;
InferenceEngine::InputsDataMap _inputData;
std::map<std::string, DataPtr> _outputData;
std::shared_ptr<CNNNetworkImpl> cnnNetwork;
/**
* @brief Create DataPtr for nGraph operation
@ -100,17 +98,6 @@ private:
*/
void createDataForResult(const ::ngraph::Output<::ngraph::Node>& output, const std::string& outName, DataPtr& ptr);
/**
* @brief Converts ngraph::Function to old CNNNetworkImpl representation
*/
void convertToCNNNetworkImpl();
friend INFERENCE_ENGINE_API_CPP(void)
convertFunctionToICNNNetwork(const std::shared_ptr<const ::ngraph::Function>& graph,
const ICNNNetwork& nGraphImpl,
CNNNetworkImpl* cnnNetworkImpl,
bool keep_constant_inputs);
/**
* @brief Reshape on the same shape
*/

View File

@ -18,6 +18,10 @@
# include <limits.h>
# include <unistd.h>
# include <dlfcn.h>
# ifdef ENABLE_UNICODE_PATH_SUPPORT
# include <locale>
# include <codecvt>
# endif
#else
# if defined(WINAPI_FAMILY) && !WINAPI_PARTITION_DESKTOP
# error "Only WINAPI_PARTITION_DESKTOP is supported, because of GetModuleHandleEx[A|W]"
@ -25,6 +29,36 @@
# include <Windows.h>
#endif
#ifdef ENABLE_UNICODE_PATH_SUPPORT
std::string FileUtils::wStringtoMBCSstringChar(const std::wstring& wstr) {
#ifdef _WIN32
int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL); // NOLINT
std::string strTo(size_needed, 0);
WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL); // NOLINT
return strTo;
#else
std::wstring_convert<std::codecvt_utf8<wchar_t>> wstring_decoder;
return wstring_decoder.to_bytes(wstr);
#endif
}
std::wstring FileUtils::multiByteCharToWString(const char* str) {
#ifdef _WIN32
int strSize = static_cast<int>(std::strlen(str));
int size_needed = MultiByteToWideChar(CP_UTF8, 0, str, strSize, NULL, 0);
std::wstring wstrTo(size_needed, 0);
MultiByteToWideChar(CP_UTF8, 0, str, strSize, &wstrTo[0], size_needed);
return wstrTo;
#else
std::wstring_convert<std::codecvt_utf8<wchar_t>> wstring_encoder;
std::wstring result = wstring_encoder.from_bytes(str);
return result;
#endif
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
long long FileUtils::fileSize(const char* charfilepath) {
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
std::wstring widefilename = FileUtils::multiByteCharToWString(charfilepath);

View File

@ -14,8 +14,8 @@
#include <vector>
#include "blob_factory.hpp"
#include <ie_ngraph_utils.hpp>
#include "shape_infer/ie_ishape_infer_extension.hpp"
#include <legacy/ie_ngraph_utils.hpp>
#include "ngraph/util.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/validation_util.hpp"

View File

@ -2,8 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
//
#include <legacy/ie_layers.h>
#include <map>
#include <memory>
#include <string>
@ -13,7 +11,6 @@
using namespace InferenceEngine;
Blob::Ptr Blob::CreateFromData(const DataPtr& data) {
// TODO Here some decision should be made about the layout.
// For now we just pass the layout and use conversion to NCHW for ANY.
@ -44,13 +41,28 @@ Blob::Ptr Blob::CreateFromData(const DataPtr& data) {
}
}
namespace InferenceEngine {
class CNNLayer;
/**
* @brief A smart pointer to the CNNLayer
*/
using CNNLayerPtr = std::shared_ptr<CNNLayer>;
/**
* @brief A smart weak pointer to the CNNLayer
*/
using CNNLayerWeakPtr = std::weak_ptr<CNNLayer>;
} // namespace InferenceEngine
class Data::Impl {
public:
/**
* @brief A pointer to the layer that creates this data element, null for input data elements
*/
CNNLayerWeakPtr creatorLayer;
/**
* @brief A map of layers that use this node as input.
* It is useful for recursive NN graph traversal.
@ -137,14 +149,18 @@ const SizeVector& Data::getDims() const {
// compatibility
CNNLayerWeakPtr& InferenceEngine::getCreatorLayer(const DataPtr & data) {
namespace InferenceEngine {
INFERENCE_ENGINE_API_CPP(CNNLayerWeakPtr&) getCreatorLayer(const DataPtr & data) {
return data->_impl->creatorLayer;
}
std::map<std::string, CNNLayerPtr>& InferenceEngine::getInputTo(const DataPtr & data) {
INFERENCE_ENGINE_API_CPP(std::map<std::string, CNNLayerPtr>&) getInputTo(const DataPtr & data) {
return data->_impl->inputTo;
}
std::map<std::string, CNNLayerPtr>& InferenceEngine::getInputTo(Data * data) {
INFERENCE_ENGINE_API_CPP(std::map<std::string, CNNLayerPtr>&) getInputTo(Data * data) {
return data->_impl->inputTo;
}
} // namespace InferenceEngine

View File

@ -1,46 +0,0 @@
// Copyright (C) 2018-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <string>
#include <file_utils.h>
#ifndef _WIN32
# ifdef ENABLE_UNICODE_PATH_SUPPORT
# include <locale>
# include <codecvt>
# endif
#else
# include <Windows.h>
#endif
#ifdef ENABLE_UNICODE_PATH_SUPPORT
std::string FileUtils::wStringtoMBCSstringChar(const std::wstring& wstr) {
#ifdef _WIN32
int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL); // NOLINT
std::string strTo(size_needed, 0);
WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL); // NOLINT
return strTo;
#else
std::wstring_convert<std::codecvt_utf8<wchar_t>> wstring_decoder;
return wstring_decoder.to_bytes(wstr);
#endif
}
std::wstring FileUtils::multiByteCharToWString(const char* str) {
#ifdef _WIN32
int strSize = static_cast<int>(std::strlen(str));
int size_needed = MultiByteToWideChar(CP_UTF8, 0, str, strSize, NULL, 0);
std::wstring wstrTo(size_needed, 0);
MultiByteToWideChar(CP_UTF8, 0, str, strSize, &wstrTo[0], size_needed);
return wstrTo;
#else
std::wstring_convert<std::codecvt_utf8<wchar_t>> wstring_encoder;
std::wstring result = wstring_encoder.from_bytes(str);
return result;
#endif
}
#endif // ENABLE_UNICODE_PATH_SUPPORT

View File

@ -19,7 +19,7 @@ namespace InferenceEngine {
namespace ShapeInfer {
/**
*@brief Holder of shape infer implementations for build-in IE layers, that plugins support out-of-the-box
* @brief Holder of shape infer implementations for build-in IE layers, that plugins support out-of-the-box
*/
class BuiltInShapeInferHolder : public IShapeInferExtension {
struct ImplsHolder {
@ -36,9 +36,9 @@ public:
void Release() noexcept override {
delete this;
};
}
void Unload() noexcept override {};
void Unload() noexcept override {}
static void AddImpl(const std::string& name, const IShapeInferImpl::Ptr& impl);

View File

@ -4,8 +4,6 @@
#pragma once
#include <legacy/ie_layers.h>
#include <description_buffer.hpp>
#include <map>
#include <memory>

View File

@ -35,8 +35,9 @@ set_ie_threading_interface_for(${TARGET_NAME}_obj)
target_compile_definitions(${TARGET_NAME}_obj PRIVATE IMPLEMENT_INFERENCE_ENGINE_API)
target_include_directories(${TARGET_NAME}_obj PRIVATE
${PUBLIC_HEADERS_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src
${IE_MAIN_SOURCE_DIR}/src/inference_engine # For CNNNetworkNGraphImpl
${PUBLIC_HEADERS_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src
${IE_MAIN_SOURCE_DIR}/src/inference_engine # For CNNNetworkNGraphImpl
$<TARGET_PROPERTY:inference_engine_transformations,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:inference_engine_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:ngraph::ngraph,INTERFACE_INCLUDE_DIRECTORIES>
@ -44,13 +45,15 @@ target_include_directories(${TARGET_NAME}_obj PRIVATE
# Create shared library
add_library(${TARGET_NAME} SHARED
$<TARGET_OBJECTS:${TARGET_NAME}_obj>
$<TARGET_OBJECTS:inference_engine_common_obj>)
add_library(${TARGET_NAME} SHARED $<TARGET_OBJECTS:${TARGET_NAME}_obj>)
set_ie_threading_interface_for(${TARGET_NAME})
target_link_libraries(${TARGET_NAME} PRIVATE ${CMAKE_DL_LIBS} ${NGRAPH_LIBRARIES} inference_engine_transformations pugixml openvino::itt)
target_link_libraries(${TARGET_NAME} PUBLIC inference_engine
PRIVATE pugixml openvino::itt
${NGRAPH_LIBRARIES} inference_engine_transformations)
target_include_directories(${TARGET_NAME} INTERFACE ${PUBLIC_HEADERS_DIR})
add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})

View File

@ -15,7 +15,6 @@
#include "ie_data.h"
#include "ie_input_info.hpp"
#include <ie_icnn_network.hpp>
#include "description_buffer.hpp"
#include <legacy/ie_layers.h>

View File

@ -5,7 +5,6 @@
#pragma once
#include <tuple>
#include "ie_api.h"
#include <legacy/ie_layers.h>
#include "legacy/ie_util_internal.hpp"

View File

@ -84,8 +84,6 @@ std::map<CNNLayer*, bool> getConstLayersMap(const ICNNNetwork& network) {
return result;
}
ICNNNetwork::~ICNNNetwork() {}
CNNNetworkImpl::CNNNetworkImpl() {}
CNNNetworkImpl::CNNNetworkImpl(const ICNNNetwork & ngraphImpl) {

View File

@ -18,7 +18,7 @@
#include "blob_factory.hpp"
#include <legacy/ie_layers.h>
#include <legacy/ie_ngraph_utils.hpp>
#include <ie_ngraph_utils.hpp>
namespace InferenceEngine {

View File

@ -29,7 +29,8 @@ ie_faster_build(${TARGET_NAME}
target_compile_definitions(${TARGET_NAME} PRIVATE IMPLEMENT_INFERENCE_ENGINE_API
PUBLIC USE_CNNNETWORK_LPT)
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine openvino::itt)
target_link_libraries(${TARGET_NAME} PUBLIC inference_engine_legacy
PRIVATE openvino::itt)
target_include_directories(${TARGET_NAME} PUBLIC ${PUBLIC_HEADERS_DIR}
$<TARGET_PROPERTY:inference_engine_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>)

View File

@ -168,7 +168,8 @@ set_ie_threading_interface_for(${TARGET_NAME})
target_compile_definitions(${TARGET_NAME} PUBLIC -DMKLDNN_THR=${MKLDNN_THR})
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine inference_engine_transformations mkldnn)
target_link_libraries(${TARGET_NAME} PRIVATE mkldnn inference_engine inference_engine_legacy
inference_engine_transformations)
if(USE_CNNNETWORK_LPT)
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine_lp_transformations_legacy)
@ -200,6 +201,7 @@ ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
add_library(${TARGET_NAME}_obj OBJECT ${SOURCES} ${HEADERS})
target_include_directories(${TARGET_NAME}_obj PRIVATE $<TARGET_PROPERTY:inference_engine_preproc_s,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:inference_engine_legacy,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:inference_engine_transformations,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:openvino::itt,INTERFACE_INCLUDE_DIRECTORIES>)

View File

@ -5,7 +5,7 @@
#include "mkldnn_graph_dumper.h"
#include <legacy/cnn_network_impl.hpp>
#include <legacy/ie_util_internal.hpp>
#include <legacy/ie_ngraph_utils.hpp>
#include <ie_ngraph_utils.hpp>
#include "exec_graph_info.hpp"
#include "mkldnn_debug.h"
#include "generic_ie.hpp"

View File

@ -19,7 +19,7 @@
#include <nodes/list.hpp>
#include <legacy/ie_util_internal.hpp>
#include <legacy/graph_transformer.h>
#include <legacy/ie_ngraph_utils.hpp>
#include <ie_ngraph_utils.hpp>
#include <legacy/convert_function_to_cnn_network.hpp>
#include <legacy/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.hpp>

View File

@ -12,7 +12,7 @@ ie_add_plugin(NAME ${TARGET_NAME}
SOURCES ${SOURCES} ${HEADERS}
VERSION_DEFINES_FOR multi_device.cpp)
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine)
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine_legacy inference_engine)
set_ie_threading_interface_for(${TARGET_NAME})

View File

@ -21,7 +21,7 @@ namespace InferenceEngine {
class IShapeInferExtension;
using IShapeInferExtensionPtr = std::shared_ptr<IShapeInferExtension>;
}
} // namespace InferenceEngine
namespace ngraph {
namespace op {
@ -133,4 +133,3 @@ private:
} // namespace op
} // namespace ngraph

View File

@ -27,7 +27,7 @@
#include <cpp/ie_cnn_network.h>
#include "ie_blob_stream.hpp"
#include "caseless.hpp"
#include <legacy/ie_ngraph_utils.hpp>
#include <ie_ngraph_utils.hpp>
#include "generic_ie.hpp"
#include "precision_utils.h"
#include "blob_factory.hpp"

View File

@ -7,12 +7,11 @@
#ifdef IR_READER_V10
# include <ngraph/node.hpp>
# include <ngraph/op/util/sub_graph_base.hpp>
# include <legacy/ie_ngraph_utils.hpp>
# include <cpp/ie_cnn_network.h>
# include <ie_ngraph_utils.hpp>
#endif // IR_READER_V10
#include <ie_blob.h>
#include <ie_icnn_network.hpp>
#include <cpp/ie_cnn_network.h>
#include <ie_iextension.h>
#include <xml_parse_utils.h>

View File

@ -29,7 +29,7 @@ target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/"
"${IE_MAIN_SOURCE_DIR}/src/readers/ir_reader")
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine_reader_api inference_engine_plugin_api
inference_engine pugixml openvino::itt)
inference_engine_legacy inference_engine pugixml openvino::itt)
ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})

View File

@ -3,6 +3,7 @@
//
#include <file_utils.h>
#include <description_buffer.hpp>
#include <ie_cnn_net_reader_impl.h>
#include <ie_blob_stream.hpp>

View File

@ -35,7 +35,8 @@ function(add_common_target TARGET_NAME STATIC_IE)
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC
$<TARGET_PROPERTY:${NGRAPH_LIBRARIES},INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:inference_engine_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>)
$<TARGET_PROPERTY:inference_engine_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:inference_engine_legacy,INTERFACE_INCLUDE_DIRECTORIES>)
if(WIN32)
target_compile_definitions(${TARGET_NAME} PRIVATE NOMINMAX)

View File

@ -7,7 +7,7 @@
#include "generic_ie.hpp"
#include <legacy/ie_util_internal.hpp>
#include <legacy/ie_ngraph_utils.hpp>
#include <ie_ngraph_utils.hpp>
#include <exec_graph_info.hpp>
#include <ngraph/variant.hpp>

View File

@ -39,7 +39,7 @@ endif()
# "mvnc" must be the first library in the link list
target_link_libraries(${TARGET_NAME}
PRIVATE
mvnc inference_engine vpu_graph_transformer)
mvnc inference_engine inference_engine_legacy vpu_graph_transformer)
# LTO

View File

@ -82,6 +82,7 @@ function(add_common_utils ADD_TARGET_NAME)
PUBLIC
${IE_TESTS_ROOT}/ie_test_utils
$<TARGET_PROPERTY:inference_engine,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:inference_engine_legacy,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:pugixml,INTERFACE_INCLUDE_DIRECTORIES>
PRIVATE
$<TARGET_PROPERTY:inference_engine_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>

View File

@ -4,9 +4,8 @@
set(TARGET_NAME funcTestUtils)
list(APPEND EXPORT_DEPENDENCIES commonTestUtils inference_engine inference_engine_legacy)
list(APPEND EXPORT_DEPENDENCIES inference_engine_lp_transformations)
list(APPEND EXPORT_DEPENDENCIES inference_engine_lp_transformations
commonTestUtils inference_engine inference_engine_legacy)
addIeTarget(
NAME ${TARGET_NAME}