Move template plugin to plugin folder (#13269)

* Moved template_plugin

* Move template extension

* Changed cmake configs

* Try to fix build

* Moved plugin to standalone folder and fixed build

* Try to fix doc

* Try to fix doc

* Update CMakeLists.txt

* Moved extensions to src/core
This commit is contained in:
Ilya Churaev 2022-10-03 15:47:20 +04:00 committed by GitHub
parent 9d02de9cc0
commit 943f77d9ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
302 changed files with 57 additions and 62 deletions

1
.gitignore vendored
View File

@ -23,7 +23,6 @@ doc/
docs/build_documentation/work_dir/
temp/
.repo/
docs/template_plugin/html/
CMakeLists.txt.user
docs/IE_PLUGIN_DG/html/

View File

@ -107,9 +107,9 @@ add_subdirectory(thirdparty)
add_subdirectory(src)
add_subdirectory(samples)
# Enable interpreter backend
# Enable interpreter backend for tests
if (ENABLE_TESTS OR ENABLE_TEMPLATE)
add_subdirectory(docs/template_plugin/backend)
add_subdirectory(src/plugins/template/backend)
endif()
include(cmake/extra_modules.cmake)
add_subdirectory(docs)

View File

@ -98,10 +98,9 @@ CMakeLists.txt @openvinotoolkit/openvino-ie-maintainers
# Documentation:
/docs/ @openvinotoolkit/openvino-docs-maintainers
/docs/template_plugin/ @openvinotoolkit/openvino-ie-template-maintainers
/docs/template_extension/ @openvinotoolkit/openvino-ie-template-maintainers
*.md @openvinotoolkit/openvino-docs-maintainers
README @openvinotoolkit/openvino-docs-maintainers
/src/plugins/template/ @openvinotoolkit/openvino-ie-template-maintainers
# Control 3d party dependencies
**/*requirements*.* @openvinotoolkit/openvino-configuration-mgmt

View File

@ -115,7 +115,7 @@ endif()
if(ENABLE_TEMPLATE)
ov_coverage_extract(INPUT "openvino" OUTPUT "template_plugin"
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/docs/template_plugin/*")
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/src/plugins/template/*")
ov_coverage_genhtml(INFO_FILE "template_plugin"
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
endif()

View File

@ -35,13 +35,15 @@ function(ov_generate_dev_package_config)
find_package(OpenCV QUIET)
foreach(component IN LISTS openvino_export_components)
string(FIND "${component}" "_legacy" index)
if(index EQUAL -1)
# TODO: remove legacy targets from tests
# string(FIND "${component}" "_legacy" index)
# if(index EQUAL -1)
# export all targets with prefix and use them during extra modules build
export(TARGETS ${${component}} NAMESPACE openvino::
APPEND FILE "${CMAKE_BINARY_DIR}/ov_${component}_dev_targets.cmake")
list(APPEND all_dev_targets ${${component}})
endif()
# endif()
endforeach()
add_custom_target(ov_dev_targets DEPENDS ${all_dev_targets})
@ -72,6 +74,8 @@ function(register_extra_modules)
set(InferenceEngineDeveloperPackage_DIR "${CMAKE_CURRENT_BINARY_DIR}/runtime")
set(OpenVINODeveloperPackage_DIR "${CMAKE_BINARY_DIR}/runtime")
set(OpenVINO_DIR ${CMAKE_BINARY_DIR})
function(generate_fake_dev_package NS)
if(NS STREQUAL "openvino")
@ -107,8 +111,9 @@ function(register_extra_modules)
# add template plugin
if(ENABLE_TEMPLATE)
list(APPEND extra_modules "${OpenVINO_SOURCE_DIR}/docs/template_plugin")
list(APPEND extra_modules "${OpenVINO_SOURCE_DIR}/src/plugins/template")
endif()
list(APPEND extra_modules "${OpenVINO_SOURCE_DIR}/src/core/template_extension")
# add each extra module
foreach(module_path IN LISTS extra_modules)

View File

@ -44,10 +44,11 @@ find_dependency(OpenVINO
NO_DEFAULT_PATH)
foreach(component @openvino_export_components@)
string(FIND "${component}" "_legacy" index)
if (index EQUAL -1)
# TODO: remove legacy targets from some tests
# string(FIND "${component}" "_legacy" index)
# if (index EQUAL -1)
include("${CMAKE_CURRENT_LIST_DIR}/ov_${component}_dev_targets.cmake")
endif()
# endif()
endforeach()
if(ENABLE_SYSTEM_PUGIXML)

View File

@ -17,8 +17,6 @@ if(NOT ENABLE_DOCKER)
add_subdirectory(snippets)
add_subdirectory(template_extension)
set(all_docs_targets
ie_docs_snippets ov_template_func_tests
template_extension openvino_template_extension openvino_template_plugin)

View File

@ -1041,16 +1041,12 @@ EXCLUDE_SYMBOLS = InferenceEngine::details \
EXAMPLE_PATH = "@OpenVINO_SOURCE_DIR@" \
"@OpenVINO_SOURCE_DIR@/docs/HOWTO/" \
"@OpenVINO_SOURCE_DIR@/docs/" \
"@OpenVINO_SOURCE_DIR@/docs/template_extension/" \
"@OpenVINO_SOURCE_DIR@/docs/template_extension/old/" \
"@OpenVINO_SOURCE_DIR@/docs/template_extension/new/" \
"@OpenVINO_SOURCE_DIR@/docs/template_plugin/" \
"@OpenVINO_SOURCE_DIR@/docs/template_plugin/src/" \
"@OpenVINO_SOURCE_DIR@/docs/template_plugin/include/" \
"@OpenVINO_SOURCE_DIR@/docs/template_plugin/src/CMakeLists.txt" \
"@OpenVINO_SOURCE_DIR@/docs/template_plugin/tests/functional/CMakeLists.txt" \
"@OpenVINO_SOURCE_DIR@/docs/template_plugin/tests/functional/transformations/" \
"@OpenVINO_SOURCE_DIR@/docs/template_plugin/tests/functional/shared_tests_instances/" \
"@OpenVINO_SOURCE_DIR@/src/plugins/" \
"@OpenVINO_SOURCE_DIR@/src/core/" \
"@OpenVINO_SOURCE_DIR@/src/plugins/template/" \
"@OpenVINO_SOURCE_DIR@/src/plugins/template/tests/functional/CMakeLists.txt" \
"@OpenVINO_SOURCE_DIR@/src/plugins/template/tests/functional/transformations/" \
"@OpenVINO_SOURCE_DIR@/src/plugins/template/tests/functional/shared_tests_instances/" \
"@OpenVINO_SOURCE_DIR@/docs/snippets/" \
"@OpenVINO_SOURCE_DIR@/src/tests/functional/plugin/shared/include/" \
"@OpenVINO_SOURCE_DIR@/docs/HOWTO/mo_extensions/ops/" \

View File

@ -68,7 +68,7 @@ Remaining part of this guide uses Frontend Extension API applicable for new fron
A custom operation class and a new mapping frontend extension class object should be registered to be usable in OpenVINO runtime.
> **NOTE**: This documentation is written based on the [Template extension](https://github.com/openvinotoolkit/openvino/tree/master/docs/template_extension/new), which demonstrates extension development details based on minimalistic `Identity` operation that is a placeholder for your real custom operation. You can review the complete code, which is fully compliable, to see how it works.
> **NOTE**: This documentation is written based on the [Template extension](https://github.com/openvinotoolkit/openvino/tree/master/src/core/template_extension/new), which demonstrates extension development details based on minimalistic `Identity` operation that is a placeholder for your real custom operation. You can review the complete code, which is fully compliable, to see how it works.
To load the extensions to the `ov::Core` object, use the `ov::Core::add_extension` method, this method allows to load library with extensions or extensions from the code.
@ -138,7 +138,7 @@ This CMake script finds the OpenVINO™ using the `find_package` CMake command.
To build the extension library, run the commands below:
```sh
$ cd docs/template_extension/new
$ cd src/core/template_extension/new
$ mkdir build
$ cd build
$ cmake -DOpenVINO_DIR=<OpenVINO_DIR> ../

View File

@ -4,7 +4,7 @@ The goal of this chapter is to explain how to use Frontend extension classes to
This API is applicable for new frontends only, which exist for ONNX and PaddlePaddle. If a different model format is used, follow legacy [Model Optimizer Extensions](../MO_DG/prepare_model/customize_model_optimizer/Customize_Model_Optimizer.md) guide.
> **NOTE**: This documentation is written based on the [Template extension](https://github.com/openvinotoolkit/openvino/tree/master/docs/template_extension/new), which demonstrates extension development details based on minimalistic `Identity` operation that is a placeholder for your real custom operation. You can review the complete code, which is fully compliable, to see how it works.
> **NOTE**: This documentation is written based on the [Template extension](https://github.com/openvinotoolkit/openvino/tree/master/src/core/template_extension/new), which demonstrates extension development details based on minimalistic `Identity` operation that is a placeholder for your real custom operation. You can review the complete code, which is fully compliable, to see how it works.
## Single Operation Mapping with OpExtension

View File

@ -91,12 +91,12 @@ endif()
- `src/CMakeLists.txt` to build a plugin shared library from sources:
@snippet template_plugin/src/CMakeLists.txt cmake:plugin
@snippet template/src/CMakeLists.txt cmake:plugin
> **NOTE**: `IE::inference_engine` target is imported from the Inference Engine Developer Package.
- `tests/functional/CMakeLists.txt` to build a set of functional plugin tests:
@snippet template_plugin/tests/functional/CMakeLists.txt cmake:functional_tests
@snippet template/tests/functional/CMakeLists.txt cmake:functional_tests
> **NOTE**: The `IE::funcSharedTests` static library with common functional Inference Engine Plugin tests is imported via the Inference Engine Developer Package.

View File

@ -862,12 +862,10 @@ EXCLUDE_SYMBOLS =
# that contain example code fragments that are included (see the \include
# command).
EXAMPLE_PATH = ../template_plugin/src \
../template_plugin/include \
../template_plugin/src/CMakeLists.txt \
../template_plugin/tests/functional/CMakeLists.txt \
../template_plugin/tests/functional/transformations \
../template_plugin/tests/functional/shared_tests_instances/ \
EXAMPLE_PATH = ../../src/plugins/ \
../../src/plugins/template/tests/functional/CMakeLists.txt \
../../src/plugins/template/tests/functional/transformations \
../../src/plugins/template/tests/functional/shared_tests_instances/ \
../../src/tests/functional/plugin/shared/include \
../snippets

View File

@ -48,7 +48,7 @@ Inference Engine plugin dynamic library consists of several main components:
> **NOTE**: This documentation is written based on the `Template` plugin, which demonstrates plugin
development details. Find the complete code of the `Template`, which is fully compilable and up-to-date,
at `<openvino source dir>/docs/template_plugin`.
at `<openvino source dir>/src/plugins/template`.
Detailed guides
-----------------------

View File

@ -24,7 +24,7 @@ Plugin Class
Inference Engine Plugin API provides the helper InferenceEngine::IInferencePlugin class recommended to use as a base class for a plugin.
Based on that, declaration of a plugin class can look as follows:
@snippet template_plugin/src/template_plugin.hpp plugin:header
@snippet template/src/template_plugin.hpp plugin:header
#### Class Fields
@ -34,7 +34,7 @@ The provided plugin class also has several fields:
* `_waitExecutor` - a task executor that waits for a response from a device about device tasks completion.
* `_cfg` of type `Configuration`:
@snippet template_plugin/src/template_config.hpp configuration:header
@snippet template/src/template_config.hpp configuration:header
As an example, a plugin configuration has three value parameters:
@ -52,7 +52,7 @@ must be thrown from a plugin constructor.
A plugin must define a device name enabled via the `_pluginName` field of a base class:
@snippet template_plugin/src/template_plugin.cpp plugin:ctor
@snippet template/src/template_plugin.cpp plugin:ctor
### `LoadExeNetworkImpl()`
@ -62,7 +62,7 @@ of the public InferenceEngine::IInferencePlugin::LoadNetwork method that calls p
This is the most important function of the `Plugin` class and creates an instance of compiled `ExecutableNetwork`,
which holds a backend-dependent compiled graph in an internal representation:
@snippet template_plugin/src/template_plugin.cpp plugin:load_exe_network_impl
@snippet template/src/template_plugin.cpp plugin:load_exe_network_impl
Before a creation of an `ExecutableNetwork` instance via a constructor, a plugin may check if a provided
InferenceEngine::ICNNNetwork object is supported by a device. In the example above, the plugin checks precision information.
@ -84,7 +84,7 @@ The function accepts a const shared pointer to `ov::Model` object and performs t
* [Intermediate Representation and Operation Sets](../_docs_MO_DG_IR_and_opsets.html)
* [Quantized networks](@ref openvino_docs_ie_plugin_dg_quantized_networks).
@snippet template_plugin/src/template_plugin.cpp plugin:transform_network
@snippet template/src/template_plugin.cpp plugin:transform_network
> **NOTE**: After all these transformations, a `ov::Model` object contains operations which can be perfectly mapped to backend kernels. E.g. if backend has kernel computing `A + B` operations at once, the `TransformNetwork` function should contain a pass which fuses operations `A` and `B` into a single custom operation `A + B` which fits backend kernels set.
@ -100,20 +100,20 @@ operations via the InferenceEngine::QueryNetworkResult structure. The `QueryNetw
3. Construct `supported` and `unsupported` maps which contains names of original operations. Note, that since the inference is performed using OpenVINO™ reference backend, the decision whether the operation is supported or not depends on whether the latest OpenVINO opset contains such operation.
4. `QueryNetworkResult.supportedLayersMap` contains only operations which are fully supported by `_backend`.
@snippet template_plugin/src/template_plugin.cpp plugin:query_network
@snippet template/src/template_plugin.cpp plugin:query_network
### `AddExtension()`
Adds an extension of the InferenceEngine::IExtensionPtr type to a plugin. If a plugin does not
support extensions, the method must throw an exception:
@snippet template_plugin/src/template_plugin.cpp plugin:add_extension
@snippet template/src/template_plugin.cpp plugin:add_extension
### `SetConfig()`
Sets new values for plugin configuration keys:
@snippet template_plugin/src/template_plugin.cpp plugin:set_config
@snippet template/src/template_plugin.cpp plugin:set_config
In the snippet above, the `Configuration` class overrides previous configuration values with the new
ones. All these values are used during backend specific graph compilation and execution of inference requests.
@ -124,7 +124,7 @@ ones. All these values are used during backend specific graph compilation and ex
Returns a current value for a specified configuration key:
@snippet template_plugin/src/template_plugin.cpp plugin:get_config
@snippet template/src/template_plugin.cpp plugin:get_config
The function is implemented with the `Configuration::Get` method, which wraps an actual configuration
key value to the InferenceEngine::Parameter and returns it.
@ -155,7 +155,7 @@ demonstrates the definition of a new optimization capability value specific for
The snippet below provides an example of the implementation for `GetMetric`:
@snippet template_plugin/src/template_plugin.cpp plugin:get_metric
@snippet template/src/template_plugin.cpp plugin:get_metric
> **NOTE**: If an unsupported metric key is passed to the function, it must throw an exception.
@ -178,13 +178,13 @@ information must be stored and checked during the import.
- Compiled backend specific graph itself
- Information about precisions and shapes set by the user
@snippet template_plugin/src/template_plugin.cpp plugin:import_network
@snippet template/src/template_plugin.cpp plugin:import_network
Create Instance of Plugin Class
------------------------
Inference Engine plugin library must export only one function creating a plugin instance using IE_DEFINE_PLUGIN_CREATE_FUNCTION macro:
@snippet template_plugin/src/template_plugin.cpp plugin:create_plugin_engine
@snippet template/src/template_plugin.cpp plugin:create_plugin_engine
Next step in a plugin library implementation is the [ExecutableNetwork](@ref openvino_docs_ie_plugin_dg_executable_network) class.

View File

@ -77,7 +77,7 @@ list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/dldt_optimization_guide2.c
# create a static library
add_library(${TARGET_NAME} STATIC ${SOURCES})
target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../template_extension/new/")
target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src/core/template_extension/new/")
if(OpenCL_FOUND AND OpenCL_HEADERS)
target_link_libraries(${TARGET_NAME} PRIVATE ${OpenCL_LIB})

View File

@ -1,7 +1,6 @@
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
add_subdirectory(old)
add_subdirectory(new)

View File

@ -2,12 +2,15 @@
# SPDX-License-Identifier: Apache-2.0
#
set(skip_module "${CMAKE_CURRENT_SOURCE_DIR}/template")
file(GLOB local_modules "${CMAKE_CURRENT_SOURCE_DIR}/*")
foreach(module_path IN LISTS local_modules)
if( # Skip files
NOT IS_DIRECTORY ${module_path} OR
# or directories without cmake
NOT EXISTS "${module_path}/CMakeLists.txt")
NOT EXISTS "${module_path}/CMakeLists.txt" OR
# module in the skip list
${module_path} STREQUAL ${skip_module})
continue()
endif()
add_subdirectory(${module_path})

View File

@ -18,6 +18,7 @@ set (SRC
)
add_library(interpreter_backend STATIC EXCLUDE_FROM_ALL ${SRC})
add_library(openvino::interpreter_backend ALIAS interpreter_backend)
if(CMAKE_COMPILER_IS_GNUCXX)
ie_add_compiler_flags(-Wno-missing-declarations)

View File

@ -30,7 +30,7 @@ target_include_directories(${TARGET_NAME} PRIVATE
# link common Inference Engine libraries
target_link_libraries(${TARGET_NAME} PRIVATE
interpreter_backend
openvino::interpreter_backend
openvino::ngraph_reference)
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})

View File

@ -21,10 +21,6 @@ ov_add_test_target(
TEMPLATE
)
if(ENABLE_HETERO)
add_dependencies(${TARGET_NAME} openvino_hetero_plugin)
endif()
find_package(OpenCV QUIET COMPONENTS core imgproc)
if(OpenCV_FOUND)

Some files were not shown because too many files have changed in this diff Show More