diff --git a/docs/IE_PLUGIN_DG/Intro.md b/docs/IE_PLUGIN_DG/Intro.md index ed3d101ea4a..8334f2db744 100644 --- a/docs/IE_PLUGIN_DG/Intro.md +++ b/docs/IE_PLUGIN_DG/Intro.md @@ -11,6 +11,7 @@ Implement Compiled Model Functionality Implement Synchronous Inference Request Implement Asynchronous Inference Request + Provide Plugin Specific Properties Implement Remote Context Implement Remote Tensor openvino_docs_ov_plugin_dg_plugin_build @@ -45,9 +46,11 @@ OpenVINO plugin dynamic library consists of several main components: - Can extract performance counters for an inference pipeline execution profiling. 4. [Asynchronous Inference Request class](@ref openvino_docs_ov_plugin_dg_async_infer_request): - Wraps the [Inference Request](@ref openvino_docs_ov_plugin_dg_infer_request) class and runs pipeline stages in parallel on several task executors based on a device-specific pipeline structure. -5. [Remote Context](@ref openvino_docs_ov_plugin_dg_remote_context): +5. [Plugin specific properties](@ref openvino_docs_ov_plugin_dg_properties): + - Provides the plugin specific properties. +6. [Remote Context](@ref openvino_docs_ov_plugin_dg_remote_context): - Provides the device specific remote context. Context allows to create remote tensors. -6. [Remote Tensor](@ref openvino_docs_ov_plugin_dg_remote_tensor) +7. [Remote Tensor](@ref openvino_docs_ov_plugin_dg_remote_tensor) - Provides the device specific remote tensor API and implementation. > **NOTE**: This documentation is written based on the `Template` plugin, which demonstrates plugin diff --git a/docs/IE_PLUGIN_DG/Plugin.md b/docs/IE_PLUGIN_DG/Plugin.md index 96326fabcb5..124852d6cf6 100644 --- a/docs/IE_PLUGIN_DG/Plugin.md +++ b/docs/IE_PLUGIN_DG/Plugin.md @@ -42,6 +42,7 @@ As an example, a plugin configuration has three value parameters: - `perf_counts` - boolean value to identify whether to collect performance counters during [Inference Request](@ref openvino_docs_ov_plugin_dg_infer_request) execution. - `streams_executor_config` - configuration of `ov::threading::IStreamsExecutor` to handle settings of multi-threaded context. - `performance_mode` - configuration of `ov::hint::PerformanceMode` to set the performance mode. +- `disable_transformations` - allows to disable transformations which are applied in the process of model compilation. ### Plugin Constructor diff --git a/docs/IE_PLUGIN_DG/Properties.md b/docs/IE_PLUGIN_DG/Properties.md new file mode 100644 index 00000000000..a8459181e74 --- /dev/null +++ b/docs/IE_PLUGIN_DG/Properties.md @@ -0,0 +1,10 @@ +# Plugin Properties {#openvino_docs_ov_plugin_dg_properties} + +Plugin can provide own device specific properties. + +Property Class +------------------------ + +OpenVINO API provides the interface ov::Property which allows to define the property and access rights. Based on that, a declaration of plugin specific properties can look as follows: + +@snippet include/template/properties.hpp properties:public_header diff --git a/docs/IE_PLUGIN_DG/layout.xml b/docs/IE_PLUGIN_DG/layout.xml index 44137896ee7..dbd424edc2c 100644 --- a/docs/IE_PLUGIN_DG/layout.xml +++ b/docs/IE_PLUGIN_DG/layout.xml @@ -79,6 +79,7 @@ + diff --git a/src/plugins/template/include/template/config.hpp b/src/plugins/template/include/template/properties.hpp similarity index 58% rename from src/plugins/template/include/template/config.hpp rename to src/plugins/template/include/template/properties.hpp index 8b0267c1374..f00e6e1474f 100644 --- a/src/plugins/template/include/template/config.hpp +++ b/src/plugins/template/include/template/properties.hpp @@ -3,10 +3,10 @@ // /** - * @brief A header that defines advanced related properties for DLIA plugins. + * @brief A header that defines advanced related properties for Template plugin. * These properties should be used in set_property() and compile_model() methods of plugins * - * @file template/config.hpp + * @file template/properties.hpp */ #pragma once @@ -18,14 +18,14 @@ namespace ov { namespace template_plugin { -// ! [public_header:properties] +// ! [properties:public_header] /** - * @brief Defines the number of throutput streams used by TEMPLATE plugin. + * @brief Allows to disable all transformations for execution inside the TEMPLATE plugin. */ -static constexpr Property throughput_streams{"THROUGHPUT_STREAMS"}; +static constexpr Property disable_transformations{"DISABLE_TRANSFORMATIONS"}; -// ! [public_header:properties] +// ! [properties:public_header] } // namespace template_plugin } // namespace ov diff --git a/src/plugins/template/src/compiled_model.cpp b/src/plugins/template/src/compiled_model.cpp index 3bdd0616304..5961280c12a 100644 --- a/src/plugins/template/src/compiled_model.cpp +++ b/src/plugins/template/src/compiled_model.cpp @@ -12,7 +12,6 @@ #include "itt.hpp" #include "openvino/runtime/properties.hpp" #include "plugin.hpp" -#include "template/config.hpp" #include "transformations/utils/utils.hpp" // ! [compiled_model:ctor] @@ -47,6 +46,8 @@ ov::template_plugin::CompiledModel::CompiledModel(const std::shared_ptr& model); void ov::template_plugin::CompiledModel::compile_model(const std::shared_ptr& model) { + if (m_cfg.disable_transformations) + return; // apply plugins transformations transform_model(model); // Perform any other steps like allocation and filling backend specific memory handles and so on @@ -107,9 +108,7 @@ ov::Any ov::template_plugin::CompiledModel::get_property(const std::string& name return ro_properties; }; const auto& default_rw_properties = []() { - std::vector rw_properties{ov::device::id, - ov::enable_profiling, - ov::template_plugin::throughput_streams}; + std::vector rw_properties{ov::device::id, ov::enable_profiling}; return rw_properties; }; const auto& to_string_vector = [](const std::vector& properties) { diff --git a/src/plugins/template/src/config.cpp b/src/plugins/template/src/config.cpp index 90842ead1df..2e2075d39bd 100644 --- a/src/plugins/template/src/config.cpp +++ b/src/plugins/template/src/config.cpp @@ -7,7 +7,8 @@ #include #include -#include "template/config.hpp" +#include "openvino/runtime/properties.hpp" +#include "template/properties.hpp" using namespace ov::template_plugin; @@ -22,8 +23,8 @@ Configuration::Configuration(const ov::AnyMap& config, const Configuration& defa const auto& key = c.first; const auto& value = c.second; - if (ov::template_plugin::throughput_streams == key) { - streams_executor_config.set_property(CONFIG_KEY(CPU_THROUGHPUT_STREAMS), value); + if (ov::template_plugin::disable_transformations == key) { + disable_transformations = value.as(); } else if (streamExecutorConfigKeys.end() != std::find(std::begin(streamExecutorConfigKeys), std::end(streamExecutorConfigKeys), key)) { streams_executor_config.set_property(key, value); @@ -51,7 +52,9 @@ ov::Any Configuration::Get(const std::string& name) const { return {std::to_string(device_id)}; } else if (name == CONFIG_KEY(PERF_COUNT)) { return {perf_count}; - } else if (name == ov::template_plugin::throughput_streams || name == CONFIG_KEY(CPU_THROUGHPUT_STREAMS)) { + } else if (name == ov::template_plugin::disable_transformations) { + return {disable_transformations}; + } else if (name == ov::num_streams) { return {std::to_string(streams_executor_config._streams)}; } else if (name == CONFIG_KEY(CPU_BIND_THREAD)) { return streams_executor_config.get_property(name); diff --git a/src/plugins/template/src/config.hpp b/src/plugins/template/src/config.hpp index c8066a91ebd..5a9732d382d 100644 --- a/src/plugins/template/src/config.hpp +++ b/src/plugins/template/src/config.hpp @@ -34,6 +34,7 @@ struct Configuration { bool perf_count = true; ov::threading::IStreamsExecutor::Config streams_executor_config; ov::hint::PerformanceMode performance_mode = ov::hint::PerformanceMode::UNDEFINED; + bool disable_transformations = false; }; // ! [configuration:header] diff --git a/src/plugins/template/src/plugin.cpp b/src/plugins/template/src/plugin.cpp index 25c44ed062d..6747d88cb8e 100644 --- a/src/plugins/template/src/plugin.cpp +++ b/src/plugins/template/src/plugin.cpp @@ -12,7 +12,7 @@ #include "openvino/pass/manager.hpp" #include "openvino/runtime/properties.hpp" #include "remote_context.hpp" -#include "template/config.hpp" +#include "template/properties.hpp" #include "transformations/common_optimizations/common_optimizations.hpp" #include "transformations/common_optimizations/convert_compression_only_to_legacy.hpp" #include "transformations/control_flow/unroll_if.hpp" @@ -171,6 +171,9 @@ ov::SupportedOpsMap ov::template_plugin::Plugin::query_model(const std::shared_p auto supported = ov::get_supported_nodes( model, [&](std::shared_ptr& model) { + // skip transformations in case of user config + if (fullConfig.disable_transformations) + return; // 1. It is needed to apply all transformations as it is done in compile_model transform_model(model); }, @@ -228,7 +231,7 @@ ov::Any ov::template_plugin::Plugin::get_property(const std::string& name, const std::vector rw_properties{ov::device::id, ov::enable_profiling, ov::hint::performance_mode, - ov::template_plugin::throughput_streams}; + ov::template_plugin::disable_transformations}; return rw_properties; }; const auto& to_string_vector = [](const std::vector& properties) { diff --git a/src/plugins/template/tests/functional/shared_tests_instances/behavior/plugin/configuration_tests.cpp b/src/plugins/template/tests/functional/shared_tests_instances/behavior/plugin/configuration_tests.cpp index c0a9a5d63f0..15d04bf9cb3 100644 --- a/src/plugins/template/tests/functional/shared_tests_instances/behavior/plugin/configuration_tests.cpp +++ b/src/plugins/template/tests/functional/shared_tests_instances/behavior/plugin/configuration_tests.cpp @@ -4,7 +4,7 @@ #include "behavior/plugin/configuration_tests.hpp" -#include