Static compilation for inference plugins (#8197)
* 1. Removed explicit SHARED from libraries 2. Fixed double definition for ie_layer_validators * Fixed SEG in unit-test: order of initialization for global vars * Added an ability to find plugins.xml from static IE * Fixes in unit-test * Migrated to new macro for import / export * Minimized number of custom dllexport * Don't use IR v7 for static libraries * Revert for merge * Don't enable tests with dlopen for static libraries * Code style * Added condition for export * Revert format_reader * Removed forward decalaration with external linkage * Fixed IE linkage on Windows * Reverted back 2 flags * Minimal RRTI for cpuFuncTests * Minimal RRTI for cpuFuncTests * Still need IR v7 reader * Fixed build * Fixed compilation * clang-format fix * Removed BUILD_AS_IS and used USE_STATIC_IE * Enable IR v7 reader as static library * Fixed compilation for GPU plugin * Trying to build plugins as static library * Plugins are able provide their own name for CreatePluginEngine function * Fixed CPU * Fixed comments * Fixed ENABLE_IR_V7_READER usage * Fixed VPU * clang-format * Fixes * Fix * Load multiple plugins at once * Fixed interpreter undefined symbols * Trying to dynamically register static plugins * Reverted some ngraph changes * Fixed cpuUnitTests compilation * Fixed compilation * Fixed myriad * Fixed custom_opset tests * Reverted linker flags * Support both static and dynamic plugins * Fixed compilation of myriadFuncTests * Removed duplication * Fixes after self-review * Fixed linkage for preprocessing * Fixes for Windows * Fixes * Fixed cmake options * Fix * Fix * Fix 2
This commit is contained in:
parent
a91725cedd
commit
8fb699a42c
@ -51,6 +51,12 @@ endfunction()
|
||||
set(VALIDATED_LIBRARIES "" CACHE INTERNAL "")
|
||||
|
||||
function(_ie_add_api_validator_post_build_step)
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
# since _ie_add_api_validator_post_build_step
|
||||
# is currently run only on shared libraries, we have nothing to test
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(UWP_API_VALIDATOR_APIS "${PROGRAMFILES}/Windows Kits/10/build/universalDDIs/x64/UniversalDDIs.xml")
|
||||
set(UWP_API_VALIDATOR_EXCLUSION "${UWP_SDK_PATH}/BinaryExclusionlist.xml")
|
||||
|
||||
|
32
cmake/developer_package/plugins/create_plugins_hpp.cmake
Normal file
32
cmake/developer_package/plugins/create_plugins_hpp.cmake
Normal file
@ -0,0 +1,32 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
foreach(var IE_DEVICE_NAMES IE_PLUGINS_HPP_HEADER IE_PLUGINS_HPP_HEADER_IN)
|
||||
if(NOT DEFINED ${var})
|
||||
message(FATAL_ERROR "${var} is required, but not defined")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# configure variables
|
||||
|
||||
set(IE_PLUGINS_DECLARATIONS "")
|
||||
set(IE_PLUGINS_MAP_DEFINITION
|
||||
"std::map<std::string, InferenceEngine::CreatePluginEngineFunc *> plugins_hpp = {")
|
||||
|
||||
foreach(dev_name IN LISTS IE_DEVICE_NAMES)
|
||||
set(_IE_CREATE_PLUGIN_FUNC "CreatePluginEngine${dev_name}")
|
||||
set(IE_PLUGINS_DECLARATIONS "${IE_PLUGINS_DECLARATIONS}
|
||||
IE_DEFINE_PLUGIN_CREATE_FUNCTION_DECLARATION(${_IE_CREATE_PLUGIN_FUNC})")
|
||||
set(IE_PLUGINS_MAP_DEFINITION "${IE_PLUGINS_MAP_DEFINITION}
|
||||
{ \"${dev_name}\", ${_IE_CREATE_PLUGIN_FUNC} },")
|
||||
endforeach()
|
||||
|
||||
set(IE_PLUGINS_MAP_DEFINITION "${IE_PLUGINS_MAP_DEFINITION}
|
||||
};\n")
|
||||
|
||||
|
||||
message("${IE_PLUGINS_DECLARATIONS}")
|
||||
message("${IE_PLUGINS_MAP_DEFINITION}")
|
||||
|
||||
configure_file("${IE_PLUGINS_HPP_HEADER_IN}" "${IE_PLUGINS_HPP_HEADER}" @ONLY)
|
@ -55,8 +55,20 @@ function(ie_add_plugin)
|
||||
add_cpplint_target(${obj_lib}_cpplint FOR_TARGETS ${obj_lib})
|
||||
endforeach()
|
||||
|
||||
add_library(${IE_PLUGIN_NAME} MODULE ${input_files})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(library_type MODULE)
|
||||
else()
|
||||
set(library_type STATIC)
|
||||
endif()
|
||||
|
||||
add_library(${IE_PLUGIN_NAME} ${library_type} ${input_files})
|
||||
|
||||
target_compile_definitions(${IE_PLUGIN_NAME} PRIVATE IMPLEMENT_INFERENCE_ENGINE_PLUGIN)
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
# to distinguish functions creating plugin objects
|
||||
target_compile_definitions(${IE_PLUGIN_NAME} PRIVATE
|
||||
IE_CREATE_PLUGIN=CreatePluginEngine${IE_PLUGIN_DEVICE_NAME})
|
||||
endif()
|
||||
|
||||
ie_add_vs_version_file(NAME ${IE_PLUGIN_NAME}
|
||||
FILEDESCRIPTION "Inference Engine ${IE_PLUGIN_DEVICE_NAME} device plugin library")
|
||||
@ -87,23 +99,25 @@ function(ie_add_plugin)
|
||||
endif()
|
||||
|
||||
add_dependencies(ie_plugins ${IE_PLUGIN_NAME})
|
||||
if(TARGET inference_engine_preproc)
|
||||
if(TARGET inference_engine_preproc AND BUILD_SHARED_LIBS)
|
||||
add_dependencies(${IE_PLUGIN_NAME} inference_engine_preproc)
|
||||
endif()
|
||||
|
||||
# fake dependencies to build in the following order:
|
||||
# IE -> IE readers -> IE inference plugins -> IE-based apps
|
||||
if(TARGET ir_ngraph_frontend)
|
||||
add_dependencies(${IE_PLUGIN_NAME} ir_ngraph_frontend)
|
||||
endif()
|
||||
if(TARGET inference_engine_ir_v7_reader)
|
||||
add_dependencies(${IE_PLUGIN_NAME} inference_engine_ir_v7_reader)
|
||||
endif()
|
||||
if(TARGET onnx_ngraph_frontend)
|
||||
add_dependencies(${IE_PLUGIN_NAME} onnx_ngraph_frontend)
|
||||
endif()
|
||||
if(TARGET paddlepaddle_ngraph_frontend)
|
||||
add_dependencies(${IE_PLUGIN_NAME} paddlepaddle_ngraph_frontend)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if(TARGET ir_ngraph_frontend)
|
||||
add_dependencies(${IE_PLUGIN_NAME} ir_ngraph_frontend)
|
||||
endif()
|
||||
if(TARGET inference_engine_ir_v7_reader)
|
||||
add_dependencies(${IE_PLUGIN_NAME} inference_engine_ir_v7_reader)
|
||||
endif()
|
||||
if(TARGET onnx_ngraph_frontend)
|
||||
add_dependencies(${IE_PLUGIN_NAME} onnx_ngraph_frontend)
|
||||
endif()
|
||||
if(TARGET paddlepaddle_ngraph_frontend)
|
||||
add_dependencies(${IE_PLUGIN_NAME} paddlepaddle_ngraph_frontend)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# install rules
|
||||
@ -137,10 +151,10 @@ function(ie_add_plugin)
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# ie_register_plugins(MAIN_TARGET <main target name>
|
||||
# POSSIBLE_PLUGINS <list of plugins which can be build by this repo>)
|
||||
# ie_register_plugins_dynamic(MAIN_TARGET <main target name>
|
||||
# POSSIBLE_PLUGINS <list of plugins which can be build by this repo>)
|
||||
#
|
||||
macro(ie_register_plugins)
|
||||
macro(ie_register_plugins_dynamic)
|
||||
set(options)
|
||||
set(oneValueArgs MAIN_TARGET)
|
||||
set(multiValueArgs POSSIBLE_PLUGINS)
|
||||
@ -205,3 +219,73 @@ macro(ie_register_plugins)
|
||||
"Registering plugins to plugins.xml config file"
|
||||
VERBATIM)
|
||||
endmacro()
|
||||
|
||||
#
|
||||
# ie_register_plugins_static(MAIN_TARGET <main target name>
|
||||
# POSSIBLE_PLUGINS <list of plugins which can be build by this repo>)
|
||||
#
|
||||
macro(ie_register_plugins_static)
|
||||
set(options)
|
||||
set(oneValueArgs MAIN_TARGET)
|
||||
set(multiValueArgs POSSIBLE_PLUGINS)
|
||||
cmake_parse_arguments(IE_REGISTER "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
set(device_names)
|
||||
foreach(name IN LISTS PLUGIN_FILES)
|
||||
string(REPLACE ":" ";" name "${name}")
|
||||
list(LENGTH name length)
|
||||
if(NOT ${length} EQUAL 2)
|
||||
message(FATAL_ERROR "Unexpected error, please, contact developer of this script")
|
||||
endif()
|
||||
|
||||
list(GET name 0 device_name)
|
||||
list(APPEND device_names ${device_name})
|
||||
|
||||
list(GET name 1 plugin_name)
|
||||
target_link_libraries(${IE_REGISTER_MAIN_TARGET} PRIVATE ${plugin_name})
|
||||
endforeach()
|
||||
|
||||
set(ie_plugins_hpp "${CMAKE_CURRENT_BINARY_DIR}/ie_plugins.hpp")
|
||||
set(plugins_hpp_in "${IEDevScripts_DIR}/plugins/plugins.hpp.in")
|
||||
|
||||
add_custom_command(OUTPUT "${ie_plugins_hpp}"
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}"
|
||||
-D "IE_DEVICE_NAMES=${device_names}"
|
||||
-D "IE_PLUGINS_HPP_HEADER_IN=${plugins_hpp_in}"
|
||||
-D "IE_PLUGINS_HPP_HEADER=${ie_plugins_hpp}"
|
||||
-P "${IEDevScripts_DIR}/plugins/create_plugins_hpp.cmake"
|
||||
DEPENDS
|
||||
"${plugins_hpp_in}"
|
||||
"${IEDevScripts_DIR}/plugins/create_plugins_hpp.cmake"
|
||||
COMMENT
|
||||
"Generate ie_plugins.hpp for static build"
|
||||
VERBATIM)
|
||||
|
||||
# add dependency for object files
|
||||
get_target_property(sources ${IE_REGISTER_MAIN_TARGET} SOURCES)
|
||||
foreach(source IN LISTS sources)
|
||||
if("${source}" MATCHES "\\$\\<TARGET_OBJECTS\\:([A-Za-z0-9_]*)\\>")
|
||||
# object library
|
||||
set(obj_library ${CMAKE_MATCH_1})
|
||||
get_target_property(obj_sources ${obj_library} SOURCES)
|
||||
list(APPEND patched_sources ${obj_sources})
|
||||
else()
|
||||
# usual source
|
||||
list(APPEND patched_sources ${source})
|
||||
endif()
|
||||
endforeach()
|
||||
set_source_files_properties(${patched_sources} PROPERTIES OBJECT_DEPENDS ${ie_plugins_hpp})
|
||||
endmacro()
|
||||
|
||||
#
|
||||
# ie_register_plugins(MAIN_TARGET <main target name>
|
||||
# POSSIBLE_PLUGINS <list of plugins which can be build by this repo>)
|
||||
#
|
||||
macro(ie_register_plugins)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
ie_register_plugins_dynamic(${ARGN})
|
||||
else()
|
||||
ie_register_plugins_static(${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
14
cmake/developer_package/plugins/plugins.hpp.in
Normal file
14
cmake/developer_package/plugins/plugins.hpp.in
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cpp_interfaces/interface/ie_iplugin_internal.hpp"
|
||||
|
||||
namespace {
|
||||
@IE_PLUGINS_DECLARATIONS@
|
||||
|
||||
@IE_PLUGINS_MAP_DEFINITION@
|
||||
|
||||
} // namespace
|
@ -26,7 +26,7 @@ set(IE_VS_VER_COMMENTS_STR "https://docs.openvinotoolkit.org/")
|
||||
# [PRODUCTVERSION_QUAD <name>])
|
||||
#
|
||||
function(ie_add_vs_version_file)
|
||||
if(NOT WIN32)
|
||||
if(NOT WIN32 OR NOT BUILD_SHARED_LIBS)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
@ -78,6 +78,18 @@ if (ENABLE_GNA)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS OR BUILD_SHARED_LIBS)
|
||||
set(ENABLE_IR_V7_READER_DEFAULT ON)
|
||||
else()
|
||||
set(ENABLE_IR_V7_READER_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
ie_option (ENABLE_IR_V7_READER "Enables IR v7 reader" ${ENABLE_IR_V7_READER_DEFAULT})
|
||||
|
||||
ie_option (ENABLE_MULTI "Enables Multi Device Plugin" ON)
|
||||
|
||||
ie_option (ENABLE_HETERO "Enables Hetero Device Plugin" ON)
|
||||
|
||||
ie_dependent_option (ENABLE_VPU "vpu targeted plugins for inference engine" ON "NOT WINDOWS_PHONE;NOT WINDOWS_STORE" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_MYRIAD "myriad targeted plugin for inference engine" ON "ENABLE_VPU" OFF)
|
||||
|
@ -10,7 +10,6 @@ addIeTargetTest(
|
||||
ROOT ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDENCIES
|
||||
templatePlugin
|
||||
HeteroPlugin
|
||||
LINK_LIBRARIES
|
||||
IE::funcSharedTests
|
||||
INCLUDES
|
||||
@ -21,6 +20,10 @@ addIeTargetTest(
|
||||
TEMPLATE
|
||||
)
|
||||
|
||||
if(ENABLE_HETERO)
|
||||
add_dependencies(${TARGET_NAME} HeteroPlugin)
|
||||
endif()
|
||||
|
||||
find_package(OpenCV QUIET COMPONENTS core imgproc)
|
||||
|
||||
if(OpenCV_FOUND)
|
||||
|
@ -26,7 +26,9 @@ target_compile_definitions(${TARGET_NAME}
|
||||
DATA_PATH=\"${DATA_PATH}\"
|
||||
MODELS_PATH=\"${MODELS_PATH}\" )
|
||||
|
||||
add_dependencies(${TARGET_NAME} MultiDevicePlugin)
|
||||
if(ENABLE_MULTI)
|
||||
add_dependencies(${TARGET_NAME} MultiDevicePlugin)
|
||||
endif()
|
||||
|
||||
if(ENABLE_MKL_DNN)
|
||||
add_dependencies(${TARGET_NAME} MKLDNNPlugin)
|
||||
|
@ -9,8 +9,6 @@ endif()
|
||||
|
||||
add_subdirectory(preprocessing)
|
||||
|
||||
add_subdirectory(readers)
|
||||
|
||||
add_subdirectory(legacy_api)
|
||||
|
||||
if(ENABLE_MKL_DNN)
|
||||
@ -29,13 +27,19 @@ if(ENABLE_GNA)
|
||||
add_subdirectory(gna_plugin)
|
||||
endif()
|
||||
|
||||
add_subdirectory(hetero_plugin)
|
||||
if(ENABLE_HETERO)
|
||||
add_subdirectory(hetero_plugin)
|
||||
endif()
|
||||
|
||||
add_subdirectory(multi_device)
|
||||
if(ENABLE_MULTI)
|
||||
add_subdirectory(multi_device)
|
||||
endif()
|
||||
|
||||
add_subdirectory(inference_engine)
|
||||
|
||||
add_subdirectory(transformations)
|
||||
|
||||
add_subdirectory(inference_engine)
|
||||
add_subdirectory(readers)
|
||||
|
||||
add_subdirectory(low_precision_transformations)
|
||||
|
||||
@ -48,9 +52,24 @@ add_subdirectory(snippets)
|
||||
add_custom_target(ie_libraries ALL
|
||||
DEPENDS inference_engine_transformations inference_engine_legacy
|
||||
inference_engine inference_engine_preproc
|
||||
inference_engine_ir_v7_reader ir_ngraph_frontend
|
||||
inference_engine_lp_transformations inference_engine_snippets)
|
||||
|
||||
if(ENABLE_IR_V7_READER)
|
||||
add_dependencies(ie_libraries inference_engine_ir_v7_reader)
|
||||
endif()
|
||||
|
||||
if(NGRAPH_IR_FRONTEND_ENABLE)
|
||||
add_dependencies(ie_libraries ir_ngraph_frontend)
|
||||
endif()
|
||||
|
||||
if(NGRAPH_ONNX_FRONTEND_ENABLE)
|
||||
add_dependencies(ie_libraries onnx_ngraph_frontend)
|
||||
endif()
|
||||
|
||||
if(NGRAPH_PDPD_FRONTEND_ENABLE)
|
||||
add_dependencies(ie_libraries paddlepaddle_ngraph_frontend)
|
||||
endif()
|
||||
|
||||
if(NGRAPH_TF_FRONTEND_ENABLE)
|
||||
add_dependencies(ie_libraries tensorflow_ngraph_frontend)
|
||||
endif()
|
||||
|
@ -28,11 +28,16 @@ set(LEGACY_LIBRARY_SHARED_SRCS
|
||||
"${LEGACY_SRC_ROOT}/ngraph_ops/onehot_ie.cpp")
|
||||
|
||||
set_source_files_properties(${LEGACY_LIBRARY_SHARED_SRCS} PROPERTIES
|
||||
COMPILE_DEFINITIONS "BUILD_AS_IE_SOURCES")
|
||||
COMPILE_DEFINITIONS "USE_STATIC_IE")
|
||||
|
||||
set(IE_STATIC_DEPENDENT_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/file_utils.cpp)
|
||||
list(REMOVE_ITEM LIBRARY_SRC ${IE_STATIC_DEPENDENT_FILES})
|
||||
|
||||
if(ENABLE_IR_V7_READER)
|
||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/ie_network_reader.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "ENABLE_IR_V7_READER")
|
||||
endif()
|
||||
|
||||
file (GLOB LIBRARY_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/*.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp
|
||||
@ -94,7 +99,8 @@ add_library(${TARGET_NAME}_plugin_api INTERFACE)
|
||||
target_include_directories(${TARGET_NAME}_plugin_api INTERFACE
|
||||
"${IE_MAIN_SOURCE_DIR}/src/plugin_api"
|
||||
$<TARGET_PROPERTY:${TARGET_NAME}_preproc,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
${PUBLIC_HEADERS_DIR} ${PUBLIC_HEADERS_DIR}/ie)
|
||||
${PUBLIC_HEADERS_DIR}
|
||||
${PUBLIC_HEADERS_DIR}/ie)
|
||||
|
||||
target_link_libraries(${TARGET_NAME}_plugin_api INTERFACE pugixml::static openvino::itt openvino::util)
|
||||
|
||||
@ -126,6 +132,7 @@ target_include_directories(${TARGET_NAME}_obj SYSTEM PRIVATE $<TARGET_PROPERTY:n
|
||||
$<TARGET_PROPERTY:xbyak,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
|
||||
target_include_directories(${TARGET_NAME}_obj PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}" # for static ie_plugins.hpp
|
||||
"${IE_MAIN_SOURCE_DIR}/src/readers/ir_reader_v7" # for ie_ir_version.hpp
|
||||
$<TARGET_PROPERTY:${TARGET_NAME}_legacy,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:${TARGET_NAME}_transformations,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
@ -187,35 +194,48 @@ 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 EXCLUDE_FROM_ALL
|
||||
$<TARGET_OBJECTS:${TARGET_NAME}_legacy_obj>
|
||||
$<TARGET_OBJECTS:${TARGET_NAME}_obj>
|
||||
${IE_STATIC_DEPENDENT_FILES})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
add_library(${TARGET_NAME}_s STATIC EXCLUDE_FROM_ALL
|
||||
$<TARGET_OBJECTS:${TARGET_NAME}_legacy_obj>
|
||||
$<TARGET_OBJECTS:${TARGET_NAME}_obj>
|
||||
${IE_STATIC_DEPENDENT_FILES})
|
||||
|
||||
set_ie_threading_interface_for(${TARGET_NAME}_s)
|
||||
if (TBBBIND_2_4_FOUND)
|
||||
target_compile_definitions(${TARGET_NAME}_s PRIVATE -DTBBBIND_2_4_AVAILABLE)
|
||||
target_link_libraries(${TARGET_NAME}_s PRIVATE ${TBBBIND_2_4_IMPORTED_TARGETS})
|
||||
set_ie_threading_interface_for(${TARGET_NAME}_s)
|
||||
if (TBBBIND_2_4_FOUND)
|
||||
target_compile_definitions(${TARGET_NAME}_s PRIVATE -DTBBBIND_2_4_AVAILABLE)
|
||||
target_link_libraries(${TARGET_NAME}_s PRIVATE ${TBBBIND_2_4_IMPORTED_TARGETS})
|
||||
endif()
|
||||
|
||||
target_include_directories(${TARGET_NAME}_s PUBLIC
|
||||
$<TARGET_PROPERTY:inference_engine_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
"${IE_MAIN_SOURCE_DIR}/src/legacy_api/src")
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties(${TARGET_NAME}_s PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME}_s)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${TARGET_NAME}_s PRIVATE openvino::itt ${CMAKE_DL_LIBS} ngraph
|
||||
frontend_manager::static inference_engine_transformations pugixml::static)
|
||||
|
||||
target_compile_definitions(${TARGET_NAME}_s PUBLIC USE_STATIC_IE)
|
||||
|
||||
set_target_properties(${TARGET_NAME}_s PROPERTIES
|
||||
EXCLUDE_FROM_ALL ON
|
||||
INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
|
||||
else()
|
||||
# for static OpenVINO build we can re-use inference_engine which is already static
|
||||
add_library(${TARGET_NAME}_s ALIAS ${TARGET_NAME})
|
||||
|
||||
target_include_directories(${TARGET_NAME} PUBLIC
|
||||
$<TARGET_PROPERTY:inference_engine_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
"${IE_MAIN_SOURCE_DIR}/src/legacy_api/src")
|
||||
endif()
|
||||
|
||||
target_include_directories(${TARGET_NAME}_s PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
$<TARGET_PROPERTY:inference_engine_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
"${IE_MAIN_SOURCE_DIR}/src/legacy_api/src")
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties(${TARGET_NAME}_s PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME}_s)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${TARGET_NAME}_s PRIVATE openvino::itt ${CMAKE_DL_LIBS} ngraph frontend_manager::static
|
||||
inference_engine_transformations pugixml::static)
|
||||
|
||||
target_compile_definitions(${TARGET_NAME}_s PUBLIC USE_STATIC_IE)
|
||||
|
||||
set_target_properties(${TARGET_NAME}_s PROPERTIES EXCLUDE_FROM_ALL ON)
|
||||
|
||||
# LTO
|
||||
|
||||
set_target_properties(${TARGET_NAME} ${TARGET_NAME}_obj ${TARGET_NAME}_s
|
||||
set_target_properties(${TARGET_NAME} ${TARGET_NAME}_obj
|
||||
PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
|
||||
|
||||
# Export for build tree
|
||||
|
@ -37,11 +37,10 @@ namespace InferenceEngine {
|
||||
*
|
||||
* It can throw exceptions safely for the application, where it is properly handled.
|
||||
*/
|
||||
class InferencePlugin : protected details::SOPointer<IInferencePlugin> {
|
||||
using details::SOPointer<IInferencePlugin>::SOPointer;
|
||||
friend class ICore;
|
||||
struct InferencePlugin {
|
||||
std::shared_ptr<void> _so;
|
||||
std::shared_ptr<InferenceEngine::IInferencePlugin> _ptr;
|
||||
|
||||
public:
|
||||
void SetName(const std::string & deviceName) {
|
||||
PLUGIN_CALL_STATEMENT(_ptr->SetName(deviceName));
|
||||
}
|
||||
@ -139,10 +138,13 @@ namespace runtime {
|
||||
*
|
||||
* It can throw exceptions safely for the application, where it is properly handled.
|
||||
*/
|
||||
struct InferencePlugin {
|
||||
class InferencePlugin {
|
||||
std::shared_ptr<void> _so;
|
||||
std::shared_ptr<ie::IInferencePlugin> _ptr;
|
||||
|
||||
public:
|
||||
InferencePlugin() = default;
|
||||
|
||||
InferencePlugin(const std::shared_ptr<void>& so, const std::shared_ptr<ie::IInferencePlugin>& impl) :
|
||||
_so{so},
|
||||
_ptr{impl} {
|
||||
|
@ -40,6 +40,10 @@
|
||||
#include "openvino/util/shared_object.hpp"
|
||||
#include "xml_parse_utils.h"
|
||||
|
||||
#ifdef OPENVINO_STATIC_LIBRARY
|
||||
# include "ie_plugins.hpp"
|
||||
#endif
|
||||
|
||||
using namespace InferenceEngine::PluginConfigParams;
|
||||
using namespace std::placeholders;
|
||||
|
||||
@ -48,11 +52,7 @@ namespace runtime {
|
||||
|
||||
namespace {
|
||||
|
||||
template <typename T>
|
||||
struct Parsed {
|
||||
std::string _deviceName;
|
||||
std::map<std::string, T> _config;
|
||||
};
|
||||
#ifndef OPENVINO_STATIC_LIBRARY
|
||||
|
||||
std::string parseXmlConfig(const std::string& xmlFile) {
|
||||
std::string xmlConfigFile_ = xmlFile;
|
||||
@ -65,6 +65,14 @@ std::string parseXmlConfig(const std::string& xmlFile) {
|
||||
return xmlConfigFile_;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
struct Parsed {
|
||||
std::string _deviceName;
|
||||
std::map<std::string, T> _config;
|
||||
};
|
||||
|
||||
template <typename T = ie::Parameter>
|
||||
Parsed<T> parseDeviceNameIntoConfig(const std::string& deviceName, const std::map<std::string, T>& config = {}) {
|
||||
auto config_ = config;
|
||||
@ -179,10 +187,13 @@ class CoreImpl : public ie::ICore, public std::enable_shared_from_this<ie::ICore
|
||||
struct PluginDescriptor {
|
||||
ov::util::FilePath libraryLocation;
|
||||
std::map<std::string, std::string> defaultConfig;
|
||||
// TODO: make extensions to be optional with conditional compilation
|
||||
std::vector<ov::util::FilePath> listOfExtentions;
|
||||
InferenceEngine::CreatePluginEngineFunc* pluginCreateFunc;
|
||||
};
|
||||
|
||||
mutable std::unordered_set<std::string> opsetNames;
|
||||
// TODO: make extensions to be optional with conditional compilation
|
||||
mutable std::vector<ie::IExtensionPtr> extensions;
|
||||
|
||||
std::map<std::string, PluginDescriptor> pluginRegistry;
|
||||
@ -225,7 +236,7 @@ class CoreImpl : public ie::ICore, public std::enable_shared_from_this<ie::ICore
|
||||
|
||||
ov::runtime::SoPtr<ie::IExecutableNetworkInternal> compile_model_impl(
|
||||
const InferenceEngine::CNNNetwork& network,
|
||||
InferencePlugin& plugin,
|
||||
ov::runtime::InferencePlugin& plugin,
|
||||
const std::map<std::string, std::string>& parsedConfig,
|
||||
const ie::RemoteContext::Ptr& context,
|
||||
const std::string& blobID,
|
||||
@ -363,13 +374,14 @@ public:
|
||||
opsetNames.insert("opset5");
|
||||
opsetNames.insert("opset6");
|
||||
opsetNames.insert("opset7");
|
||||
opsetNames.insert("opset8");
|
||||
}
|
||||
|
||||
~CoreImpl() override = default;
|
||||
|
||||
/**
|
||||
* @brief Register plugins for devices which are located in .xml configuration file. The function supports UNICODE
|
||||
* path
|
||||
* @brief Register plugins for devices which are located in .xml configuration file.
|
||||
* @note The function supports UNICODE path
|
||||
* @param xmlConfigFile An .xml configuraion with device / plugin information
|
||||
*/
|
||||
void RegisterPluginsInRegistry(const std::string& xmlConfigFile) {
|
||||
@ -427,12 +439,32 @@ public:
|
||||
|
||||
// fill value in plugin registry for later lazy initialization
|
||||
{
|
||||
PluginDescriptor desc = {pluginPath, config, listOfExtentions};
|
||||
PluginDescriptor desc = {pluginPath, config, listOfExtentions, nullptr};
|
||||
pluginRegistry[deviceName] = desc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register plugins for devices which are located in .xml configuration file.
|
||||
* @note The function supports UNICODE path
|
||||
* @param xmlConfigFile An .xml configuraion with device / plugin information
|
||||
*/
|
||||
void RegisterPluginsInRegistry(
|
||||
const std::map<std::string, InferenceEngine::CreatePluginEngineFunc*>& static_registry) {
|
||||
std::lock_guard<std::mutex> lock(pluginsMutex);
|
||||
|
||||
for (const auto& plugin : static_registry) {
|
||||
const auto& deviceName = plugin.first;
|
||||
if (deviceName.find('.') != std::string::npos) {
|
||||
IE_THROW() << "Device name must not contain dot '.' symbol";
|
||||
}
|
||||
// TODO: add properties support to enable AUTO device
|
||||
PluginDescriptor desc = {{}, {}, {}, plugin.second};
|
||||
pluginRegistry[deviceName] = desc;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// ICore public API
|
||||
//
|
||||
@ -727,12 +759,21 @@ public:
|
||||
auto it_plugin = plugins.find(deviceName);
|
||||
if (it_plugin == plugins.end()) {
|
||||
PluginDescriptor desc = it->second;
|
||||
auto so = ov::util::load_shared_object(desc.libraryLocation.c_str());
|
||||
std::shared_ptr<void> so;
|
||||
try {
|
||||
using CreateF = void(std::shared_ptr<ie::IInferencePlugin>&);
|
||||
std::shared_ptr<ie::IInferencePlugin> plugin_impl;
|
||||
reinterpret_cast<CreateF*>(ov::util::get_symbol(so, OV_PP_TOSTRING(IE_CREATE_PLUGIN)))(plugin_impl);
|
||||
auto plugin = InferencePlugin{so, plugin_impl};
|
||||
ov::runtime::InferencePlugin plugin;
|
||||
|
||||
if (desc.pluginCreateFunc) { // static OpenVINO case
|
||||
std::shared_ptr<ie::IInferencePlugin> plugin_impl;
|
||||
desc.pluginCreateFunc(plugin_impl);
|
||||
plugin = InferencePlugin{nullptr, plugin_impl};
|
||||
} else {
|
||||
so = ov::util::load_shared_object(desc.libraryLocation.c_str());
|
||||
std::shared_ptr<ie::IInferencePlugin> plugin_impl;
|
||||
reinterpret_cast<InferenceEngine::CreatePluginEngineFunc*>(
|
||||
ov::util::get_symbol(so, InferenceEngine::create_plugin_function))(plugin_impl);
|
||||
plugin = InferencePlugin{so, plugin_impl};
|
||||
}
|
||||
|
||||
{
|
||||
plugin.set_name(deviceName);
|
||||
@ -788,6 +829,7 @@ public:
|
||||
|
||||
auto result = plugins.emplace(deviceName, plugin).first->second;
|
||||
|
||||
// TODO CVS-69016: need to enable for CPU plugin cache
|
||||
TryToRegisterLibraryAsExtensionUnsafe(desc.libraryLocation);
|
||||
|
||||
return result;
|
||||
@ -842,7 +884,7 @@ public:
|
||||
pluginPath = absFilePath;
|
||||
}
|
||||
|
||||
PluginDescriptor desc = {pluginPath, {}, {}};
|
||||
PluginDescriptor desc = {pluginPath, {}, {}, nullptr};
|
||||
pluginRegistry[deviceName] = desc;
|
||||
}
|
||||
|
||||
@ -1092,7 +1134,11 @@ public:
|
||||
Core::Core(const std::string& xmlConfigFile) {
|
||||
_impl = std::make_shared<Impl>();
|
||||
|
||||
#ifdef OPENVINO_STATIC_LIBRARY
|
||||
_impl->RegisterPluginsInRegistry(::plugins_hpp);
|
||||
#else
|
||||
RegisterPlugins(ov::runtime::parseXmlConfig(xmlConfigFile));
|
||||
#endif
|
||||
}
|
||||
|
||||
std::map<std::string, Version> Core::GetVersions(const std::string& deviceName) const {
|
||||
@ -1351,7 +1397,11 @@ public:
|
||||
Core::Core(const std::string& xmlConfigFile) {
|
||||
_impl = std::make_shared<Impl>();
|
||||
|
||||
OV_CORE_CALL_STATEMENT(register_plugins(parseXmlConfig(xmlConfigFile)));
|
||||
#ifdef OPENVINO_STATIC_LIBRARY
|
||||
_impl->RegisterPluginsInRegistry(::plugins_hpp);
|
||||
#else
|
||||
register_plugins(parseXmlConfig(xmlConfigFile));
|
||||
#endif
|
||||
}
|
||||
|
||||
std::map<std::string, Version> Core::get_versions(const std::string& deviceName) const {
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
namespace InferenceEngine {
|
||||
|
||||
#ifndef OPENVINO_STATIC_LIBRARY
|
||||
#ifdef ENABLE_IR_V7_READER
|
||||
|
||||
namespace details {
|
||||
|
||||
@ -59,34 +59,46 @@ public:
|
||||
* @brief This class is a wrapper for reader interfaces
|
||||
*/
|
||||
class Reader : public IReader {
|
||||
InferenceEngine::details::SOPointer<IReader> ptr;
|
||||
# ifdef OPENVINO_STATIC_LIBRARY
|
||||
using ReaderPtr = std::shared_ptr<IReader>;
|
||||
# else
|
||||
using ReaderPtr = InferenceEngine::details::SOPointer<IReader>;
|
||||
# endif
|
||||
ReaderPtr ptr;
|
||||
std::once_flag readFlag;
|
||||
std::string name;
|
||||
std::string location;
|
||||
|
||||
InferenceEngine::details::SOPointer<IReader> getReaderPtr() {
|
||||
ReaderPtr getReaderPtr() {
|
||||
std::call_once(readFlag, [&]() {
|
||||
# ifdef OPENVINO_STATIC_LIBRARY
|
||||
// call library creator directly, since we are in the same application
|
||||
InferenceEngine::CreateReader(ptr);
|
||||
OPENVINO_ASSERT(ptr != nullptr, "Failed to create static version of IR v7 reader");
|
||||
# else
|
||||
ov::util::FilePath libraryName = ov::util::to_file_path(location);
|
||||
ov::util::FilePath readersLibraryPath =
|
||||
FileUtils::makePluginLibraryName(getInferenceEngineLibraryPath(), libraryName);
|
||||
|
||||
if (!FileUtils::fileExist(readersLibraryPath)) {
|
||||
IE_THROW() << "Please, make sure that Inference Engine ONNX reader library "
|
||||
IE_THROW() << "Please, make sure that Inference Engine reader library exists "
|
||||
<< ov::util::from_file_path(::FileUtils::makePluginLibraryName({}, libraryName)) << " is in "
|
||||
<< getIELibraryPath();
|
||||
}
|
||||
ptr = {readersLibraryPath};
|
||||
# endif // OPENVINO_STATIC_LIBRARY
|
||||
});
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
InferenceEngine::details::SOPointer<IReader> getReaderPtr() const {
|
||||
ReaderPtr getReaderPtr() const {
|
||||
return const_cast<Reader*>(this)->getReaderPtr();
|
||||
}
|
||||
|
||||
public:
|
||||
using Ptr = std::shared_ptr<Reader>;
|
||||
|
||||
Reader(const std::string& name, const std::string location) : name(name), location(location) {}
|
||||
bool supportModel(std::istream& model) const override {
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::IE, "Reader::supportModel");
|
||||
@ -126,12 +138,14 @@ void registerReaders() {
|
||||
return;
|
||||
|
||||
auto create_if_exists = [](const std::string name, const std::string library_name) {
|
||||
# ifndef OPENVINO_STATIC_LIBRARY
|
||||
ov::util::FilePath libraryName = ov::util::to_file_path(library_name);
|
||||
ov::util::FilePath readersLibraryPath =
|
||||
FileUtils::makePluginLibraryName(getInferenceEngineLibraryPath(), libraryName);
|
||||
|
||||
if (!FileUtils::fileExist(readersLibraryPath))
|
||||
return std::shared_ptr<Reader>();
|
||||
# endif // !OPENVINO_STATIC_LIBRARY
|
||||
return std::make_shared<Reader>(name, library_name);
|
||||
};
|
||||
|
||||
@ -243,7 +257,7 @@ CNNNetwork load_ir_v7_network(const std::string& modelPath,
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // OPENVINO_STATIC_LIBRARY
|
||||
#endif // ENABLE_IR_V7_READER
|
||||
|
||||
namespace {
|
||||
|
||||
@ -396,7 +410,7 @@ CNNNetwork details::ReadNetwork(const std::string& modelPath,
|
||||
const std::string& binPath,
|
||||
const std::vector<IExtensionPtr>& exts,
|
||||
bool newAPI) {
|
||||
#ifndef OPENVINO_STATIC_LIBRARY
|
||||
#ifdef ENABLE_IR_V7_READER
|
||||
// IR v7 obsolete code
|
||||
{
|
||||
// Register readers if it is needed
|
||||
@ -410,7 +424,7 @@ CNNNetwork details::ReadNetwork(const std::string& modelPath,
|
||||
}
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
#endif // OPENVINO_STATIC_LIBRARY
|
||||
#endif // ENABLE_IR_V7_READER
|
||||
|
||||
// Fix unicode name
|
||||
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
|
||||
@ -460,12 +474,11 @@ CNNNetwork details::ReadNetwork(const std::string& model,
|
||||
std::istringstream modelStringStream(model);
|
||||
std::istream& modelStream = modelStringStream;
|
||||
|
||||
#ifndef OPENVINO_STATIC_LIBRARY
|
||||
#ifdef ENABLE_IR_V7_READER
|
||||
// IR v7 obsolete code
|
||||
{
|
||||
// Register readers if it is needed
|
||||
registerReaders();
|
||||
|
||||
assertIfIRv7LikeModel(modelStream);
|
||||
|
||||
for (auto it = readers.begin(); it != readers.end(); it++) {
|
||||
@ -478,7 +491,7 @@ CNNNetwork details::ReadNetwork(const std::string& model,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // OPENVINO_STATIC_LIBRARY
|
||||
#endif // ENABLE_IR_V7_READER
|
||||
|
||||
// Try to load with FrontEndManager
|
||||
auto& manager = get_frontend_manager();
|
||||
|
@ -14,15 +14,9 @@
|
||||
namespace ngraph {
|
||||
namespace op {
|
||||
|
||||
#ifdef BUILD_AS_IE_SOURCES
|
||||
class NonMaxSuppressionIE;
|
||||
class NonMaxSuppressionIE2;
|
||||
class NonMaxSuppressionIE3;
|
||||
#else
|
||||
class INFERENCE_ENGINE_API_CLASS(NonMaxSuppressionIE);
|
||||
class INFERENCE_ENGINE_API_CLASS(NonMaxSuppressionIE2);
|
||||
class INFERENCE_ENGINE_API_CLASS(NonMaxSuppressionIE3);
|
||||
#endif
|
||||
|
||||
} // namespace op
|
||||
} // namespace ngraph
|
||||
|
@ -16,11 +16,7 @@
|
||||
namespace ngraph {
|
||||
namespace op {
|
||||
|
||||
#ifdef BUILD_AS_IE_SOURCES
|
||||
class OneHotIE;
|
||||
#else
|
||||
class INFERENCE_ENGINE_API_CLASS(OneHotIE);
|
||||
#endif
|
||||
|
||||
} // namespace op
|
||||
} // namespace ngraph
|
||||
|
@ -14,11 +14,7 @@
|
||||
namespace ngraph {
|
||||
namespace pass {
|
||||
|
||||
#ifdef BUILD_AS_IE_SOURCES
|
||||
class ConvertNMS5ToLegacyMatcher;
|
||||
#else
|
||||
class INFERENCE_ENGINE_API_CLASS(ConvertNMS5ToLegacyMatcher);
|
||||
#endif
|
||||
|
||||
} // namespace pass
|
||||
} // namespace ngraph
|
||||
|
@ -15,11 +15,7 @@
|
||||
namespace ngraph {
|
||||
namespace pass {
|
||||
|
||||
#ifdef BUILD_AS_IE_SOURCES
|
||||
class ConvertOneHotToOneHotIEMatcher;
|
||||
#else
|
||||
class INFERENCE_ENGINE_API_CLASS(ConvertOneHotToOneHotIEMatcher);
|
||||
#endif
|
||||
|
||||
} // namespace pass
|
||||
} // namespace ngraph
|
||||
|
@ -12,6 +12,7 @@ ie_add_plugin(NAME ${TARGET_NAME}
|
||||
SOURCES ${SOURCES} ${HEADERS}
|
||||
VERSION_DEFINES_FOR multi_device_plugin.cpp)
|
||||
|
||||
# TODO: add fix for this case since DEFAULT_CONFIG is not used now
|
||||
ie_add_plugin(NAME ${TARGET_NAME}
|
||||
DEVICE_NAME "AUTO"
|
||||
PSEUDO_PLUGIN
|
||||
|
@ -322,22 +322,37 @@ protected:
|
||||
std::weak_ptr<ICore> _core; //!< A pointer to ICore interface
|
||||
};
|
||||
|
||||
#define IE_CREATE_PLUGIN CreatePluginEngine
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
using CreatePluginEngineFunc = void(std::shared_ptr<IInferencePlugin>&);
|
||||
|
||||
/**
|
||||
* @def IE_CREATE_PLUGIN
|
||||
* @brief Defines a name of a function creating plugin instance
|
||||
* @ingroup ie_dev_api_plugin_api
|
||||
*/
|
||||
#ifndef IE_CREATE_PLUGIN
|
||||
# define IE_CREATE_PLUGIN CreatePluginEngine
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constexpr static const auto create_plugin_function = OV_PP_TOSTRING(IE_CREATE_PLUGIN);
|
||||
|
||||
namespace details {
|
||||
template <>
|
||||
class SOCreatorTrait<IInferencePlugin> {
|
||||
public:
|
||||
static constexpr auto name = OV_PP_TOSTRING(IE_CREATE_PLUGIN);
|
||||
static constexpr auto name = create_plugin_function;
|
||||
};
|
||||
} // namespace details
|
||||
} // namespace InferenceEngine
|
||||
|
||||
/**
|
||||
* @def IE_DEFINE_PLUGIN_CREATE_FUNCTION(PluginType, version)
|
||||
* @brief Defines the exported `CreatePluginEngine` function which is used to create a plugin instance
|
||||
* @brief Defines the exported `IE_CREATE_PLUGIN` function which is used to create a plugin instance
|
||||
* @ingroup ie_dev_api_plugin_api
|
||||
*/
|
||||
#define IE_DEFINE_PLUGIN_CREATE_FUNCTION(PluginType, version, ...) \
|
||||
@ -355,3 +370,12 @@ public:
|
||||
} \
|
||||
plugin->SetVersion(version); \
|
||||
}
|
||||
|
||||
/**
|
||||
* @def IE_DEFINE_PLUGIN_CREATE_FUNCTION_DEFINITION(_IE_CREATE_PLUGIN_FUNC)
|
||||
* @brief Declares the exported `CreatePluginEngine` function which is used to create a plugin instance
|
||||
* @ingroup ie_dev_api_plugin_api
|
||||
*/
|
||||
#define IE_DEFINE_PLUGIN_CREATE_FUNCTION_DECLARATION(_IE_CREATE_PLUGIN_FUNC) \
|
||||
INFERENCE_PLUGIN_API(void) \
|
||||
_IE_CREATE_PLUGIN_FUNC(::std::shared_ptr<::InferenceEngine::IInferencePlugin>& plugin) noexcept(false);
|
||||
|
@ -115,6 +115,12 @@ add_cpplint_target(${TARGET_NAME}_obj_cpplint FOR_TARGETS ${TARGET_NAME}_obj)
|
||||
|
||||
# Create module library file from object library
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(library_type MODULE)
|
||||
else()
|
||||
set(library_type STATIC)
|
||||
endif()
|
||||
|
||||
add_library(${TARGET_NAME} MODULE
|
||||
$<TARGET_OBJECTS:${TARGET_NAME}_obj>)
|
||||
|
||||
@ -123,10 +129,15 @@ ie_add_vs_version_file(NAME ${TARGET_NAME}
|
||||
|
||||
set_ie_threading_interface_for(${TARGET_NAME})
|
||||
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE fluid openvino::itt openvino::util
|
||||
PUBLIC inference_engine)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE fluid openvino::itt openvino::util)
|
||||
|
||||
target_include_directories(${TARGET_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
if(BUILD_SHARED_LIBS)
|
||||
# for static linkage the dependencies are in opposite order
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine)
|
||||
endif()
|
||||
|
||||
target_include_directories(${TARGET_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
$<TARGET_PROPERTY:inference_engine,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
|
||||
# Workaround to avoid warnings caused with bug in the avx512intrin.h of GCC5
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND
|
||||
|
@ -15,4 +15,6 @@ file(GLOB_RECURSE reader_api_hpp "${CMAKE_CURRENT_SOURCE_DIR}/reader_api/*.hpp")
|
||||
|
||||
add_cpplint_target(${TARGET_NAME}_cpplint FOR_SOURCES ${reader_api_hpp})
|
||||
|
||||
add_subdirectory(ir_reader_v7)
|
||||
if(ENABLE_IR_V7_READER)
|
||||
add_subdirectory(ir_reader_v7)
|
||||
endif()
|
||||
|
@ -15,7 +15,13 @@ source_group("src" FILES ${LIBRARY_SRC})
|
||||
|
||||
# Create module library
|
||||
|
||||
add_library(${TARGET_NAME} MODULE ${LIBRARY_SRC})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(library_type MODULE)
|
||||
else()
|
||||
set(library_type STATIC)
|
||||
endif()
|
||||
|
||||
add_library(${TARGET_NAME} ${library_type} ${LIBRARY_SRC})
|
||||
|
||||
ie_faster_build(${TARGET_NAME}
|
||||
UNITY
|
||||
@ -39,6 +45,10 @@ if(WIN32)
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME})
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
target_link_libraries(inference_engine PRIVATE ${TARGET_NAME})
|
||||
endif()
|
||||
|
||||
# code style
|
||||
|
||||
add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})
|
||||
|
@ -42,6 +42,6 @@ CNNNetwork IRReader::read(std::istream& model, const Blob::CPtr& weights, const
|
||||
return CNNNetwork(parser.parse(root, weights));
|
||||
}
|
||||
|
||||
OPENVINO_PLUGIN_API void InferenceEngine::CreateReader(std::shared_ptr<IReader>& reader) {
|
||||
INFERENCE_PLUGIN_API(void) InferenceEngine::CreateReader(std::shared_ptr<IReader>& reader) {
|
||||
reader = std::make_shared<IRReader>();
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "openvino/runtime/common.hpp"
|
||||
#include <cpp/ie_cnn_network.h>
|
||||
#include <ie_iextension.h>
|
||||
#include <istream>
|
||||
@ -58,6 +57,6 @@ protected:
|
||||
* @brief Creates the default instance of the reader
|
||||
* @return Reader interface
|
||||
*/
|
||||
OPENVINO_PLUGIN_API void CreateReader(std::shared_ptr<IReader>& reader);
|
||||
INFERENCE_PLUGIN_API(void) CreateReader(std::shared_ptr<IReader>& reader);
|
||||
|
||||
} // namespace InferenceEngine
|
||||
|
@ -25,16 +25,28 @@ set(LINK_LIBRARIES
|
||||
|
||||
set(DEPENDENCIES
|
||||
mock_engine
|
||||
ir_ngraph_frontend
|
||||
inference_engine_ir_v7_reader
|
||||
HeteroPlugin
|
||||
MultiDevicePlugin
|
||||
template_extension
|
||||
lptNgraphFunctions
|
||||
sharedTestClasses
|
||||
test_model_zoo
|
||||
)
|
||||
|
||||
if(NGRAPH_IR_FRONTEND_ENABLE)
|
||||
list(APPEND DEPENDENCIES ir_ngraph_frontend)
|
||||
endif()
|
||||
|
||||
if(ENABLE_IR_V7_READER)
|
||||
list(APPEND DEPENDENCIES inference_engine_ir_v7_reader)
|
||||
endif()
|
||||
|
||||
if(ENABLE_HETERO)
|
||||
list(APPEND DEPENDENCIES HeteroPlugin)
|
||||
endif()
|
||||
|
||||
if(ENABLE_MULTI)
|
||||
list(APPEND DEPENDENCIES MultiDevicePlugin)
|
||||
endif()
|
||||
|
||||
if (NOT NGRAPH_ONNX_FRONTEND_ENABLE)
|
||||
list(APPEND EXCLUDED_SOURCE_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/onnx_reader")
|
||||
endif()
|
||||
|
@ -19,8 +19,8 @@ addIeTargetTest(
|
||||
DEPENDENCIES
|
||||
myriadPlugin
|
||||
LINK_LIBRARIES
|
||||
vpu_common_lib
|
||||
vpu_graph_transformer
|
||||
vpu_common_lib
|
||||
funcSharedTests
|
||||
mvnc
|
||||
ADD_CPPLINT
|
||||
|
@ -6,7 +6,16 @@ set(TARGET_NAME funcSharedTests)
|
||||
|
||||
set(PUBLIC_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
|
||||
set(DEPENDENCIES inference_engine mock_engine HeteroPlugin MultiDevicePlugin)
|
||||
set(DEPENDENCIES mock_engine)
|
||||
|
||||
if(ENABLE_HETERO)
|
||||
list(APPEND DEPENDENCIES HeteroPlugin)
|
||||
endif()
|
||||
|
||||
if(ENABLE_MULTI)
|
||||
list(APPEND DEPENDENCIES MultiDevicePlugin)
|
||||
endif()
|
||||
|
||||
if (NGRAPH_ONNX_FRONTEND_ENABLE)
|
||||
list(APPEND DEPENDENCIES test_model_zoo)
|
||||
list(APPEND DEFINES TEST_MODELS="${TEST_MODEL_ZOO}/func_tests/models/")
|
||||
|
@ -8,7 +8,11 @@ file(GLOB_RECURSE SHARED_TESTS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
|
||||
|
||||
add_library(${TARGET_NAME} STATIC ${SHARED_TESTS_SRC})
|
||||
add_dependencies(${TARGET_NAME} MultiDevicePlugin inference_engine_preproc)
|
||||
add_dependencies(${TARGET_NAME} inference_engine_preproc)
|
||||
|
||||
if(ENABLE_MULTI)
|
||||
add_dependencies(${TARGET_NAME} MultiDevicePlugin)
|
||||
endif()
|
||||
|
||||
target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/plugin_tests")
|
||||
|
||||
|
@ -13,9 +13,11 @@ file(GLOB TEST_SRC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shared_tests_instance/single_layer_tests/*.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/backward_compatibility/*.cpp)
|
||||
|
||||
list(APPEND DEPENDENCIES
|
||||
HeteroPlugin
|
||||
GNAPlugin)
|
||||
list(APPEND DEPENDENCIES GNAPlugin)
|
||||
|
||||
if(ENABLE_HETERO)
|
||||
list(APPEND DEPENDENCIES HeteroPlugin)
|
||||
endif()
|
||||
|
||||
if(ENABLE_MKL_DNN)
|
||||
list(APPEND DEPENDENCIES
|
||||
|
@ -18,7 +18,12 @@ file(GLOB SHARED_TESTS_SRC
|
||||
)
|
||||
|
||||
add_library(${TARGET_NAME} STATIC ${SHARED_TESTS_SRC})
|
||||
add_dependencies(${TARGET_NAME} inference_engine_preproc MultiDevicePlugin mock_engine)
|
||||
|
||||
add_dependencies(${TARGET_NAME} inference_engine_preproc mock_engine)
|
||||
|
||||
if(ENABLE_MULTI)
|
||||
add_dependencies(${TARGET_NAME} MultiDevicePlugin)
|
||||
endif()
|
||||
|
||||
set_ie_threading_interface_for(${TARGET_NAME})
|
||||
|
||||
@ -51,7 +56,9 @@ endif()
|
||||
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC ${SHARED_LIBRARIES})
|
||||
|
||||
add_dependencies(${TARGET_NAME} HeteroPlugin)
|
||||
if(ENABLE_HETERO)
|
||||
add_dependencies(${TARGET_NAME} HeteroPlugin)
|
||||
endif()
|
||||
|
||||
# developer package
|
||||
|
||||
|
@ -6,9 +6,10 @@ set(VPU_DEPENDENCIES
|
||||
vpu_copy_firmware)
|
||||
|
||||
if (ENABLE_CLDNN)
|
||||
list(APPEND VPU_DEPENDENCIES
|
||||
clDNNPlugin
|
||||
HeteroPlugin)
|
||||
list(APPEND VPU_DEPENDENCIES clDNNPlugin)
|
||||
if(ENABLE_HETERO)
|
||||
list(APPEND VPU_DEPENDENCIES HeteroPlugin)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
addIeTarget(
|
||||
|
@ -175,7 +175,7 @@ public:
|
||||
return m_dimensions;
|
||||
}
|
||||
friend OPENVINO_API std::ostream& operator<<(std::ostream& str, const PartialShape& shape);
|
||||
friend PartialShape operator+(const PartialShape& s1, const PartialShape& s2);
|
||||
friend OPENVINO_API PartialShape operator+(const PartialShape& s1, const PartialShape& s2);
|
||||
bool operator==(const PartialShape& partial_shape) const;
|
||||
bool operator!=(const PartialShape& partial_shape) const;
|
||||
/// Get the max bounding shape
|
||||
@ -375,7 +375,7 @@ private:
|
||||
/// std::invalid_argument.
|
||||
/// \li If `s1` and `s2` both have static rank, and their ranks are equal,
|
||||
/// returns a new shape whose `i`th dimension is `s1[i] + s2[i]`.
|
||||
PartialShape operator+(const PartialShape& s1, const PartialShape& s2);
|
||||
OPENVINO_API PartialShape operator+(const PartialShape& s1, const PartialShape& s2);
|
||||
|
||||
/// \brief Inserts a human-readable representation of a PartialShape into an output stream.
|
||||
/// \param str The output stream targeted for insertion.
|
||||
|
@ -200,7 +200,11 @@ TEST(opset, custom_opset) {
|
||||
opset.insert<MyOpIncorrect>();
|
||||
#endif
|
||||
opset.insert<MyOpNew>();
|
||||
#ifdef OPENVINO_STATIC_LIBRARY
|
||||
ASSERT_EQ(opset.get_types_info().size(), 1);
|
||||
#else
|
||||
ASSERT_EQ(opset.get_types_info().size(), 3);
|
||||
#endif
|
||||
ASSERT_TRUE(opset.contains_type("MyOpNew"));
|
||||
ASSERT_TRUE(opset.contains_type("MyOpOld"));
|
||||
ASSERT_TRUE(opset.contains_type("MyOpNewFromOld"));
|
||||
|
@ -21,7 +21,7 @@ if(COMMAND ie_add_vs_version_file)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(interpreter_backend PRIVATE INTERPRETER_BACKEND_EXPORTS)
|
||||
target_link_libraries(interpreter_backend PUBLIC ngraph_backend)
|
||||
target_link_libraries(interpreter_backend PUBLIC ngraph_backend PRIVATE ngraph_reference)
|
||||
|
||||
install(TARGETS interpreter_backend
|
||||
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL
|
||||
|
Loading…
Reference in New Issue
Block a user