Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feature/snippets/…
Browse files Browse the repository at this point in the history
…matmul_i8_bf16
  • Loading branch information
a-sidorova committed Mar 23, 2023
2 parents 5deb3c3 + 448654e commit 586263e
Show file tree
Hide file tree
Showing 889 changed files with 20,033 additions and 10,699 deletions.
5 changes: 3 additions & 2 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,11 @@ function(ov_download_tbbbind_2_5)

if(WIN32 AND X86_64)
RESOLVE_DEPENDENCY(TBBBIND_2_5
ARCHIVE_WIN "tbbbind_2_5_static_win_v1.zip"
ARCHIVE_WIN "tbbbind_2_5_static_win_v2.zip"
TARGET_PATH "${TEMP}/tbbbind_2_5"
ENVIRONMENT "TBBBIND_2_5_ROOT"
SHA256 "a67afeea8cf194f97968c800dab5b5459972908295242e282045d6b8953573c1")
SHA256 "49ae93b13a13953842ff9ae8d01681b269b5b0bc205daf18619ea9a828c44bee"
USE_NEW_LOCATION TRUE)
elseif(LINUX AND X86_64)
RESOLVE_DEPENDENCY(TBBBIND_2_5
ARCHIVE_LIN "tbbbind_2_5_static_lin_v2.tgz"
Expand Down
50 changes: 28 additions & 22 deletions cmake/developer_package/plugins/create_plugins_hpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,23 @@
# SPDX-License-Identifier: Apache-2.0
#

foreach(var IE_DEVICE_MAPPING IE_PLUGINS_HPP_HEADER IE_PLUGINS_HPP_HEADER_IN)
foreach(var OV_DEVICE_MAPPING BUILD_SHARED_LIBS OV_PLUGINS_HPP_HEADER OV_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
set(OV_PLUGINS_DECLARATIONS "")
set(OV_PLUGINS_MAP_DEFINITION
" static const std::map<Key, Value> plugins_hpp = {")

foreach(dev_map IN LISTS IE_DEVICE_MAPPING)
foreach(dev_map IN LISTS OV_DEVICE_MAPPING)
string(REPLACE ":" ";" dev_map "${dev_map}")
list(GET dev_map 0 mapped_dev_name)
list(GET dev_map 1 actual_dev_name)

# common
set(_IE_CREATE_PLUGIN_FUNC "CreatePluginEngine${actual_dev_name}")
set(_IE_CREATE_EXTENSION_FUNC "CreateExtensionShared${actual_dev_name}")

# declarations
set(IE_PLUGINS_DECLARATIONS "${IE_PLUGINS_DECLARATIONS}
IE_DEFINE_PLUGIN_CREATE_FUNCTION_DECLARATION(${_IE_CREATE_PLUGIN_FUNC});")
if(${actual_dev_name}_AS_EXTENSION)
set(IE_PLUGINS_DECLARATIONS "${IE_PLUGINS_DECLARATIONS}
IE_DEFINE_EXTENSION_CREATE_FUNCTION_DECLARATION(${_IE_CREATE_EXTENSION_FUNC});")
else()
set(_IE_CREATE_EXTENSION_FUNC "nullptr")
endif()

# definitions
set(dev_config "{")
if(${mapped_dev_name}_CONFIG)
Expand All @@ -48,11 +34,31 @@ IE_DEFINE_EXTENSION_CREATE_FUNCTION_DECLARATION(${_IE_CREATE_EXTENSION_FUNC});")
endif()
set(dev_config "${dev_config}}")

set(IE_PLUGINS_MAP_DEFINITION "${IE_PLUGINS_MAP_DEFINITION}
{ \"${mapped_dev_name}\", Value { ${_IE_CREATE_PLUGIN_FUNC}, ${_IE_CREATE_EXTENSION_FUNC}, ${dev_config} } },")

if(NOT BUILD_SHARED_LIBS)
# common
set(_OV_CREATE_PLUGIN_FUNC "CreatePluginEngine${actual_dev_name}")
set(_OV_CREATE_EXTENSION_FUNC "CreateExtensionShared${actual_dev_name}")

# declarations
set(OV_PLUGINS_DECLARATIONS "${OV_PLUGINS_DECLARATIONS}
IE_DEFINE_PLUGIN_CREATE_FUNCTION_DECLARATION(${_OV_CREATE_PLUGIN_FUNC});")
if(${actual_dev_name}_AS_EXTENSION)
set(OV_PLUGINS_DECLARATIONS "${OV_PLUGINS_DECLARATIONS}
IE_DEFINE_EXTENSION_CREATE_FUNCTION_DECLARATION(${_OV_CREATE_EXTENSION_FUNC});")
else()
set(_OV_CREATE_EXTENSION_FUNC "nullptr")
endif()

set(OV_PLUGINS_MAP_DEFINITION "${OV_PLUGINS_MAP_DEFINITION}
{ \"${mapped_dev_name}\", Value { ${_OV_CREATE_PLUGIN_FUNC}, ${_OV_CREATE_EXTENSION_FUNC}, ${dev_config} } },")
else()
set(OV_PLUGINS_MAP_DEFINITION "${OV_PLUGINS_MAP_DEFINITION}
{ \"${mapped_dev_name}\", Value { \"${actual_dev_name}\", ${dev_config} } },")
endif()
endforeach()

set(IE_PLUGINS_MAP_DEFINITION "${IE_PLUGINS_MAP_DEFINITION}
set(OV_PLUGINS_MAP_DEFINITION "${OV_PLUGINS_MAP_DEFINITION}
};\n")

configure_file("${IE_PLUGINS_HPP_HEADER_IN}" "${IE_PLUGINS_HPP_HEADER}" @ONLY)
configure_file("${OV_PLUGINS_HPP_HEADER_IN}" "${OV_PLUGINS_HPP_HEADER}" @ONLY)
75 changes: 40 additions & 35 deletions cmake/developer_package/plugins/plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function(ie_add_plugin)
if(IE_PLUGIN_PSEUDO_DEVICE)
set(plugin_hidden HIDDEN)
endif()
ie_cpack_add_component(${install_component}
ie_cpack_add_component(${install_component}
DISPLAY_NAME "${IE_PLUGIN_DEVICE_NAME} runtime"
DESCRIPTION "${IE_PLUGIN_DEVICE_NAME} runtime"
${plugin_hidden}
Expand Down Expand Up @@ -227,16 +227,18 @@ macro(ie_register_plugins_dynamic)

# Combine all <device_name>.xml files into plugins.xml

add_custom_command(TARGET ${IE_REGISTER_MAIN_TARGET} POST_BUILD
COMMAND
"${CMAKE_COMMAND}"
-D "CMAKE_SHARED_MODULE_PREFIX=${CMAKE_SHARED_MODULE_PREFIX}"
-D "IE_CONFIG_OUTPUT_FILE=${config_output_file}"
-D "IE_CONFIGS_DIR=${CMAKE_BINARY_DIR}/plugins"
-P "${IEDevScripts_DIR}/plugins/register_plugin_cmake.cmake"
COMMENT
"Registering plugins to plugins.xml config file"
VERBATIM)
if(ENABLE_PLUGINS_XML)
add_custom_command(TARGET ${IE_REGISTER_MAIN_TARGET} POST_BUILD
COMMAND
"${CMAKE_COMMAND}"
-D "CMAKE_SHARED_MODULE_PREFIX=${CMAKE_SHARED_MODULE_PREFIX}"
-D "IE_CONFIG_OUTPUT_FILE=${config_output_file}"
-D "IE_CONFIGS_DIR=${CMAKE_BINARY_DIR}/plugins"
-P "${IEDevScripts_DIR}/plugins/register_plugin_cmake.cmake"
COMMENT
"Registering plugins to plugins.xml config file"
VERBATIM)
endif()
endmacro()

#
Expand Down Expand Up @@ -279,13 +281,9 @@ function(ie_target_link_plugins TARGET_NAME)
endfunction()

#
# ie_generate_plugins_hpp()
# ov_generate_plugins_hpp()
#
function(ie_generate_plugins_hpp)
if(BUILD_SHARED_LIBS)
return()
endif()

function(ov_generate_plugins_hpp)
set(device_mapping)
set(device_configs)
set(as_extension)
Expand All @@ -296,17 +294,23 @@ function(ie_generate_plugins_hpp)
message(FATAL_ERROR "Unexpected error, please, contact developer of this script")
endif()

# create device mapping: preudo device => actual device
# create device mapping: pseudo device => actual device
list(GET name 0 device_name)
if(${device_name}_PSEUDO_PLUGIN_FOR)
list(APPEND device_mapping "${device_name}:${${device_name}_PSEUDO_PLUGIN_FOR}")
if(BUILD_SHARED_LIBS)
list(GET name 1 library_name)
ie_plugin_get_file_name(${library_name} library_name)
list(APPEND device_mapping "${device_name}:${library_name}")
else()
list(APPEND device_mapping "${device_name}:${device_name}")
endif()
if(${device_name}_PSEUDO_PLUGIN_FOR)
list(APPEND device_mapping "${device_name}:${${device_name}_PSEUDO_PLUGIN_FOR}")
else()
list(APPEND device_mapping "${device_name}:${device_name}")
endif()

# register plugin as extension
if(${device_name}_AS_EXTENSION)
list(APPEND as_extension -D "${device_name}_AS_EXTENSION=ON")
# register plugin as extension
if(${device_name}_AS_EXTENSION)
list(APPEND as_extension -D "${device_name}_AS_EXTENSION=ON")
endif()
endif()

# add default plugin config options
Expand All @@ -317,35 +321,36 @@ function(ie_generate_plugins_hpp)
endif()
endforeach()

# add plugins to libraries including ie_plugins.hpp
# add plugins to libraries including ov_plugins.hpp
ie_target_link_plugins(openvino)
if(TARGET inference_engine_s)
ie_target_link_plugins(inference_engine_s)
endif()

set(ie_plugins_hpp "${CMAKE_BINARY_DIR}/src/inference/ie_plugins.hpp")
set(ov_plugins_hpp "${CMAKE_BINARY_DIR}/src/inference/ov_plugins.hpp")
set(plugins_hpp_in "${IEDevScripts_DIR}/plugins/plugins.hpp.in")

add_custom_command(OUTPUT "${ie_plugins_hpp}"
add_custom_command(OUTPUT "${ov_plugins_hpp}"
COMMAND
"${CMAKE_COMMAND}"
-D "IE_DEVICE_MAPPING=${device_mapping}"
-D "IE_PLUGINS_HPP_HEADER_IN=${plugins_hpp_in}"
-D "IE_PLUGINS_HPP_HEADER=${ie_plugins_hpp}"
-D "BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}"
-D "OV_DEVICE_MAPPING=${device_mapping}"
-D "OV_PLUGINS_HPP_HEADER_IN=${plugins_hpp_in}"
-D "OV_PLUGINS_HPP_HEADER=${ov_plugins_hpp}"
${device_configs}
${as_extension}
-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"
"Generate ov_plugins.hpp for build"
VERBATIM)

# for some reason dependency on source files does not work
# so, we have to use explicit target and make it dependency for inference_engine
add_custom_target(_ie_plugins_hpp DEPENDS ${ie_plugins_hpp})
add_dependencies(inference_engine_obj _ie_plugins_hpp)
add_custom_target(_ov_plugins_hpp DEPENDS ${ov_plugins_hpp})
add_dependencies(inference_engine_obj _ov_plugins_hpp)

# add dependency for object files
get_target_property(sources inference_engine_obj SOURCES)
Expand All @@ -362,5 +367,5 @@ function(ie_generate_plugins_hpp)
endforeach()

# add dependency on header file generation for all inference_engine source files
set_source_files_properties(${all_sources} PROPERTIES OBJECT_DEPENDS ${ie_plugins_hpp})
set_source_files_properties(${all_sources} PROPERTIES OBJECT_DEPENDS ${ov_plugins_hpp})
endfunction()
21 changes: 18 additions & 3 deletions cmake/developer_package/plugins/plugins.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,35 @@

#pragma once

#include <map>
#include <string>

#ifdef OPENVINO_STATIC_LIBRARY

#include "cpp_interfaces/interface/ie_iplugin_internal.hpp"

@IE_PLUGINS_DECLARATIONS@
@OV_PLUGINS_DECLARATIONS@

struct Value {
InferenceEngine::CreatePluginEngineFunc * m_create_plugin_func;
InferenceEngine::CreateExtensionFunc * m_create_extension_func;
std::map<std::string, std::string> m_default_config;
};

#else

struct Value {
std::string m_plugin_path;
std::map<std::string, std::string> m_default_config;
};

#endif

using Key = std::string;
using PluginsStaticRegistry = std::map<Key, Value>;

inline const std::map<Key, Value> getStaticPluginsRegistry() {
@IE_PLUGINS_MAP_DEFINITION@

inline const std::map<Key, Value> getCompiledPluginsRegistry() {
@OV_PLUGINS_MAP_DEFINITION@
return plugins_hpp;
}
4 changes: 2 additions & 2 deletions cmake/extra_modules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ ov_generate_dev_package_config()
# with all imported developer targets
register_extra_modules()

# for static libraries case we need to generate final ie_plugins.hpp
# for static libraries case we need to generate final ov_plugins.hpp
# with all the information about plugins
ie_generate_plugins_hpp()
ov_generate_plugins_hpp()

# used for static build
ov_generate_frontends_hpp()
2 changes: 2 additions & 0 deletions cmake/features.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ ie_option (ENABLE_HETERO "Enables Hetero Device Plugin" ON)

ie_option (ENABLE_TEMPLATE "Enable template plugin" ON)

ie_dependent_option (ENABLE_PLUGINS_XML "Generate plugins.xml configuration file or not" OFF "NOT BUILD_SHARED_LIBS" OFF)

ie_dependent_option (GAPI_TEST_PERF "if GAPI unit tests should examine performance" OFF "ENABLE_TESTS;ENABLE_GAPI_PREPROCESSING" OFF)

ie_dependent_option (ENABLE_DATA "fetch models from testdata repo" ON "ENABLE_FUNCTIONAL_TESTS;NOT ANDROID" OFF)
Expand Down
3 changes: 3 additions & 0 deletions cmake/templates/OpenVINODeveloperPackageConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ foreach(option IN LISTS ov_options)
endforeach()
message(" ")

# activate generation of plugins.xml
set(ENABLE_PLUGINS_XML ON)

# for samples in 3rd party projects
if(ENABLE_SAMPLES)
set_and_check(gflags_DIR "@gflags_BINARY_DIR@")
Expand Down
8 changes: 2 additions & 6 deletions docs/Documentation/deployment_guide_introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@
Run and Deploy Locally <openvino_deployment_guide>
Deploy via Model Serving <ovms_what_is_openvino_model_server>

@endsphinxdirective


Once you have a model that meets both OpenVINO™ and your requirements, you can choose how to deploy it with your application.

@sphinxdirective
.. panels::

:doc:`Deploy via OpenVINO Runtime <openvino_deployment_guide>`
Expand All @@ -30,8 +27,7 @@ Once you have a model that meets both OpenVINO™ and your requirements, you can
Deployment via OpenVINO Model Server allows the application to connect to the inference server set up remotely.
This way inference can use external resources instead of those available to the application itself.

@endsphinxdirective


Apart from the default deployment options, you may also :doc:`deploy your application for the TensorFlow framework with OpenVINO Integration <ovtf_integration>`

Apart from the default deployment options, you may also [deploy your application for the TensorFlow framework with OpenVINO Integration](./openvino_ecosystem_ovtf.md).
@endsphinxdirective
14 changes: 7 additions & 7 deletions docs/Documentation/inference_modes_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
openvino_docs_OV_UG_Running_on_multiple_devices
openvino_docs_OV_UG_Hetero_execution
openvino_docs_OV_UG_Automatic_Batching

@endsphinxdirective

OpenVINO Runtime offers multiple inference modes to allow optimum hardware utilization under different conditions. The most basic one is a single-device mode, which defines just one device responsible for the entire inference workload. It supports a range of Intel hardware by means of plugins embedded in the Runtime library, each set up to offer the best possible performance. For a complete list of supported devices and instructions on how to use them, refer to the [guide on inference devices](../OV_Runtime_UG/supported_plugins/Device_Plugins.md).

OpenVINO Runtime offers multiple inference modes to allow optimum hardware utilization under different conditions. The most basic one is a single-device mode, which defines just one device responsible for the entire inference workload. It supports a range of Intel hardware by means of plugins embedded in the Runtime library, each set up to offer the best possible performance. For a complete list of supported devices and instructions on how to use them, refer to the :doc:`guide on inference devices <openvino_docs_OV_UG_Working_with_devices>`.

The remaining modes assume certain levels of automation in selecting devices for inference. Using them in the deployed solution may potentially increase its performance and portability. The automated modes are:

* [Automatic Device Selection (AUTO)](../OV_Runtime_UG/auto_device_selection.md)
* [Multi-Device Execution (MULTI)](../OV_Runtime_UG/multi_device.md)
* [Heterogeneous Execution (HETERO)](../OV_Runtime_UG/hetero_execution.md)
* [Automatic Batching Execution (Auto-batching)](../OV_Runtime_UG/automatic_batching.md)
* :doc:`Automatic Device Selection (AUTO) <openvino_docs_OV_UG_supported_plugins_AUTO>`
* :doc:``Multi-Device Execution (MULTI) <openvino_docs_OV_UG_Running_on_multiple_devices>`
* :doc:`Heterogeneous Execution (HETERO) <openvino_docs_OV_UG_Hetero_execution>`
* :doc:`Automatic Batching Execution (Auto-batching) <openvino_docs_OV_UG_Automatic_Batching>`

@endsphinxdirective
Loading

0 comments on commit 586263e

Please sign in to comment.