From ff681ccf4c8d1b1c1710913cf93df4f00e6a4739 Mon Sep 17 00:00:00 2001 From: Xuejun Zhai Date: Thu, 25 Jan 2024 18:26:27 +0800 Subject: [PATCH] [AUTO Batch Plugin] clean 1.0 related def (#22300) * [AUTO Batch Plugin] clean 1.0 related def Signed-off-by: Zhai, Xuejun * Fix test error & clang format Signed-off-by: Zhai, Xuejun * Fix test error Signed-off-by: Zhai, Xuejun * Fix test error Signed-off-by: Zhai, Xuejun * Fix error Signed-off-by: Zhai, Xuejun * [AUTO Batch] fix review comments Signed-off-by: Zhai, Xuejun --------- Signed-off-by: Zhai, Xuejun --- src/plugins/auto_batch/src/compiled_model.cpp | 14 +--- src/plugins/auto_batch/src/plugin.cpp | 70 ++----------------- src/plugins/auto_batch/src/plugin.hpp | 1 - .../tests/unit/plugin_set_property_test.cpp | 5 +- .../ov_executable_network/exec_net_base.cpp | 4 +- .../behavior/ov_infer_request/io_tensor.cpp | 4 +- .../ov_executable_network/properties.cpp | 8 +-- .../behavior/ov_plugin/properties_tests.cpp | 4 +- .../behavior/ov_infer_request/io_tensor.cpp | 4 +- .../behavior/ov_plugin/properties_tests.cpp | 7 +- 10 files changed, 23 insertions(+), 98 deletions(-) diff --git a/src/plugins/auto_batch/src/compiled_model.cpp b/src/plugins/auto_batch/src/compiled_model.cpp index 8c44f48356a29f..8cc37d612c8518 100644 --- a/src/plugins/auto_batch/src/compiled_model.cpp +++ b/src/plugins/auto_batch/src/compiled_model.cpp @@ -195,15 +195,6 @@ ov::Any CompiledModel::get_property(const std::string& name) const { return num_request; } else if (name == ov::model_name.name()) { return m_compiled_model_without_batch->get_property(name); - OPENVINO_SUPPRESS_DEPRECATED_START - } else if (name == METRIC_KEY(SUPPORTED_METRICS)) { - return std::vector{ov::optimal_number_of_infer_requests.name(), - METRIC_KEY(SUPPORTED_METRICS), - ov::model_name.name(), - METRIC_KEY(SUPPORTED_CONFIG_KEYS), - ov::execution_devices.name()}; - } else if (name == METRIC_KEY(SUPPORTED_CONFIG_KEYS)) { - return std::vector{ov::auto_batch_timeout.name()}; } else if (name == ov::execution_devices) { return m_compiled_model_without_batch->get_property(name); } else if (name == ov::loaded_from_cache) { @@ -211,11 +202,9 @@ ov::Any CompiledModel::get_property(const std::string& name) const { } else if (name == ov::supported_properties) { return std::vector{ ov::PropertyName{ov::optimal_number_of_infer_requests.name(), ov::PropertyMutability::RO}, - ov::PropertyName{METRIC_KEY(SUPPORTED_METRICS), ov::PropertyMutability::RO}, ov::PropertyName{ov::model_name.name(), ov::PropertyMutability::RO}, - ov::PropertyName{METRIC_KEY(SUPPORTED_CONFIG_KEYS), ov::PropertyMutability::RO}, ov::PropertyName{ov::execution_devices.name(), ov::PropertyMutability::RO}, - ov::PropertyName{ov::auto_batch_timeout.name(), ov::PropertyMutability::RO}}; + ov::PropertyName{ov::auto_batch_timeout.name(), ov::PropertyMutability::RW}}; } else if (name == ov::auto_batch_timeout) { uint32_t time_out = m_time_out; return time_out; @@ -239,7 +228,6 @@ ov::Any CompiledModel::get_property(const std::string& name) const { OPENVINO_THROW("Unsupported Compiled Model Property: ", name); } } - OPENVINO_SUPPRESS_DEPRECATED_END } const std::vector>& CompiledModel::outputs() const { diff --git a/src/plugins/auto_batch/src/plugin.cpp b/src/plugins/auto_batch/src/plugin.cpp index d451dba5c49758..4024051f45c602 100644 --- a/src/plugins/auto_batch/src/plugin.cpp +++ b/src/plugins/auto_batch/src/plugin.cpp @@ -15,19 +15,11 @@ #include "transformations/common_optimizations/dimension_tracking.hpp" #include "transformations/init_node_info.hpp" #include "transformations/utils/utils.hpp" -OPENVINO_SUPPRESS_DEPRECATED_START -#include "ie_layouts.h" -OPENVINO_SUPPRESS_DEPRECATED_END namespace ov { namespace autobatch_plugin { -OPENVINO_SUPPRESS_DEPRECATED_START -std::vector supported_configKeys = {CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), - ov::device::priorities.name(), - ov::auto_batch_timeout.name(), - ov::cache_dir.name()}; -OPENVINO_SUPPRESS_DEPRECATED_END +std::vector supported_configKeys = {ov::device::priorities.name(), ov::auto_batch_timeout.name()}; inline ov::AnyMap merge_properties(ov::AnyMap config, const ov::AnyMap& user_config) { for (auto&& kvp : user_config) { @@ -69,11 +61,7 @@ DeviceInformation Plugin::parse_meta_device(const std::string& devices_batch_con ov::SoPtr Plugin::create_context(const ov::AnyMap& remote_properties) const { auto full_properties = remote_properties; - OPENVINO_SUPPRESS_DEPRECATED_START - auto it = full_properties.find(CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG)); - OPENVINO_SUPPRESS_DEPRECATED_END - if (it == full_properties.end()) - it = full_properties.find(ov::device::priorities.name()); + auto it = full_properties.find(ov::device::priorities.name()); if (it == full_properties.end()) OPENVINO_THROW("Value for ov::device::priorities is not set"); @@ -84,7 +72,6 @@ ov::SoPtr Plugin::create_context(const ov::AnyMap& remote_pr } ov::Any Plugin::get_property(const std::string& name, const ov::AnyMap& arguments) const { - OPENVINO_SUPPRESS_DEPRECATED_START if (supported_configKeys.end() != std::find(supported_configKeys.begin(), supported_configKeys.end(), name)) { auto it = m_plugin_config.find(name); if (it == m_plugin_config.end()) { @@ -92,10 +79,6 @@ ov::Any Plugin::get_property(const std::string& name, const ov::AnyMap& argument } else { return {it->second}; } - } else if (name == METRIC_KEY(SUPPORTED_METRICS)) { - return std::vector{METRIC_KEY(SUPPORTED_METRICS), - ov::device::full_name.name(), - METRIC_KEY(SUPPORTED_CONFIG_KEYS)}; } else if (name == ov::supported_properties.name()) { return std::vector{ ov::PropertyName{ov::supported_properties.name(), ov::PropertyMutability::RO}, @@ -104,12 +87,9 @@ ov::Any Plugin::get_property(const std::string& name, const ov::AnyMap& argument return decltype(ov::internal::supported_properties)::value_type{}; } else if (name == ov::device::full_name.name()) { return get_device_name(); - } else if (name == METRIC_KEY(SUPPORTED_CONFIG_KEYS)) { - return supported_configKeys; } else { OPENVINO_THROW("Unsupported property: ", name); } - OPENVINO_SUPPRESS_DEPRECATED_END } void Plugin::set_property(const ov::AnyMap& properties) { @@ -118,11 +98,9 @@ void Plugin::set_property(const ov::AnyMap& properties) { const auto& val = c.second; if (supported_configKeys.end() == std::find(supported_configKeys.begin(), supported_configKeys.end(), name)) OPENVINO_THROW("Unsupported config key: ", name); - OPENVINO_SUPPRESS_DEPRECATED_START - if (name == CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG) || name == ov::device::priorities.name()) { + if (name == ov::device::priorities.name()) { parse_batch_device(val.as()); } - OPENVINO_SUPPRESS_DEPRECATED_END m_plugin_config[name] = val; } } @@ -150,14 +128,10 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< // merge configs from func properties and m_plugin_config auto full_properties = merge_properties(m_plugin_config, properties); - OPENVINO_SUPPRESS_DEPRECATED_START - auto device_batch = full_properties.find(CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG)); - if (device_batch == full_properties.end()) - device_batch = full_properties.find(ov::device::priorities.name()); + auto device_batch = full_properties.find(ov::device::priorities.name()); if (device_batch == full_properties.end()) { OPENVINO_THROW("ov::device::priorities key for AUTO NATCH is not set for BATCH device"); } - OPENVINO_SUPPRESS_DEPRECATED_END auto meta_device = parse_meta_device(device_batch->second.as(), properties); const auto& device_name = meta_device.device_name; @@ -302,29 +276,6 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< } reshaped->reshape(partial_shapes); - - OPENVINO_SUPPRESS_DEPRECATED_START - for (auto&& input : reshaped->inputs()) { - auto& rt_info = input.get_rt_info(); - auto it = rt_info.find("ie_legacy_td"); - if (it != rt_info.end()) { - auto& td = it->second.as(); - rt_info["ie_legacy_td"] = - InferenceEngine::TensorDesc(td.getPrecision(), input.get_shape(), td.getLayout()); - } - } - for (auto&& result : reshaped->get_results()) { - auto output = result->input_value(0); - auto& rt_info = output.get_rt_info(); - auto it = rt_info.find("ie_legacy_td"); - if (it != rt_info.end()) { - auto& td = it->second.as(); - rt_info["ie_legacy_td"] = - InferenceEngine::TensorDesc(td.getPrecision(), output.get_shape(), td.getLayout()); - } - } - OPENVINO_SUPPRESS_DEPRECATED_END - compiled_model_with_batch = context ? core->compile_model(reshaped, context, device_config_no_auto_batch) : core->compile_model(reshaped, device_name, device_config_no_auto_batch); @@ -335,15 +286,12 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< ov::SoPtr device_context; if (!context) { - OPENVINO_SUPPRESS_DEPRECATED_START try { device_context = compiled_model_without_batch->get_context(); if (!device_context._so) device_context._so = compiled_model_without_batch._so; } catch (const ov::NotImplemented&) { - } catch (const InferenceEngine::NotImplemented&) { } - OPENVINO_SUPPRESS_DEPRECATED_END } else { device_context = context; } @@ -365,24 +313,18 @@ ov::SupportedOpsMap Plugin::query_model(const std::shared_ptr& OPENVINO_ASSERT(get_core(), "Core is missing!"); auto cfg = properties; for (const auto& c : cfg) { - OPENVINO_SUPPRESS_DEPRECATED_START - if (c.first == CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG) || c.first == ov::device::priorities.name()) { + if (c.first == ov::device::priorities.name()) { auto val = c.second; cfg.erase(c.first); auto metaDevice = parse_meta_device(val.as(), cfg); return get_core()->query_model(model, metaDevice.device_name, cfg); } - OPENVINO_SUPPRESS_DEPRECATED_END } OPENVINO_THROW("Value for ov::device::priorities for AUTO BATCH PLUGIN is not set"); } ov::SoPtr Plugin::get_default_context(const ov::AnyMap& remote_properties) const { - OPENVINO_SUPPRESS_DEPRECATED_START - auto it = remote_properties.find(CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG)); - OPENVINO_SUPPRESS_DEPRECATED_END - if (it == remote_properties.end()) - it = remote_properties.find(ov::device::priorities.name()); + auto it = remote_properties.find(ov::device::priorities.name()); if (it == remote_properties.end()) OPENVINO_THROW("Value for ov::device::priorities is not set"); diff --git a/src/plugins/auto_batch/src/plugin.hpp b/src/plugins/auto_batch/src/plugin.hpp index 68f0edf34c8fb3..9ca950bcc624af 100644 --- a/src/plugins/auto_batch/src/plugin.hpp +++ b/src/plugins/auto_batch/src/plugin.hpp @@ -7,7 +7,6 @@ #include -#include "ie/ie_plugin_config.hpp" #include "openvino/runtime/iplugin.hpp" #include "openvino/runtime/properties.hpp" diff --git a/src/plugins/auto_batch/tests/unit/plugin_set_property_test.cpp b/src/plugins/auto_batch/tests/unit/plugin_set_property_test.cpp index ef67def84bf216..9da4d4baa94ff9 100644 --- a/src/plugins/auto_batch/tests/unit/plugin_set_property_test.cpp +++ b/src/plugins/auto_batch/tests/unit/plugin_set_property_test.cpp @@ -58,12 +58,9 @@ TEST_P(SetPropertyTest, SetPropertyTestCase) { const std::vector plugin_set_property_params_test = { set_property_params{{{ov::auto_batch_timeout(static_cast(200))}}, false}, set_property_params{{{ov::device::priorities("CPU(4)")}}, false}, - set_property_params{{{"CACHE_DIR", "./xyz"}}, false}, set_property_params{{{ov::auto_batch_timeout(static_cast(200))}, {ov::device::priorities("CPU(4)")}}, false}, - set_property_params{{{ov::auto_batch_timeout(static_cast(200))}, {ov::device::priorities("CPU(4)")}, {"CACHE_DIR", "./xyz"}}, - false}, set_property_params{{{"XYZ", "200"}}, true}, - set_property_params{{{"XYZ", "200"}, {ov::device::priorities("CPU(4)")}, {"CACHE_DIR", "./xyz"}}, true}, + set_property_params{{{"XYZ", "200"}, {ov::device::priorities("CPU(4)")}}, true}, }; INSTANTIATE_TEST_SUITE_P(smoke_AutoBatch_BehaviorTests, diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_executable_network/exec_net_base.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_executable_network/exec_net_base.cpp index 8c39fd63103c24..f568096853e6d8 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_executable_network/exec_net_base.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_executable_network/exec_net_base.cpp @@ -16,9 +16,9 @@ auto configs = []() { auto autoBatchConfigs = []() { return std::vector{ // explicit batch size 4 to avoid fallback to no auto-batching (i.e. plain GPU) - {{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), std::string(ov::test::utils::DEVICE_GPU) + "(4)"}, + {{ov::device::priorities.name(), std::string(ov::test::utils::DEVICE_GPU) + "(4)"}, // no timeout to avoid increasing the test time - {CONFIG_KEY(AUTO_BATCH_TIMEOUT), "0 "}}}; + ov::auto_batch_timeout(0)}}; }; INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVCompiledModelBaseTest, diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp index 295da790320971..1d5abcbde1dcdf 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp @@ -26,9 +26,9 @@ auto configs = []() { auto AutoBatchConfigs = []() { return std::vector{ // explicit batch size 4 to avoid fallback to no auto-batching (i.e. plain GPU) - {{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), std::string(ov::test::utils::DEVICE_GPU) + "(4)"}, + {{ov::device::priorities.name(), std::string(ov::test::utils::DEVICE_GPU) + "(4)"}, // no timeout to avoid increasing the test time - {CONFIG_KEY(AUTO_BATCH_TIMEOUT), "0 "}}}; + ov::auto_batch_timeout(0)}}; }; INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestIOTensorTest, diff --git a/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_executable_network/properties.cpp b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_executable_network/properties.cpp index d279e2154c2bce..4f0d107387042c 100644 --- a/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_executable_network/properties.cpp +++ b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_executable_network/properties.cpp @@ -67,10 +67,10 @@ const std::vector multi_properties = { }; const std::vector auto_batch_properties = { - {{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), std::string(ov::test::utils::DEVICE_TEMPLATE) + "(4)"}}, - {{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), std::string(ov::test::utils::DEVICE_TEMPLATE) + "(4)"}, - {CONFIG_KEY(AUTO_BATCH_TIMEOUT), "1"}}, - {{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), std::string(ov::test::utils::DEVICE_TEMPLATE) + "(4)"}, + {{ov::device::priorities.name(), std::string(ov::test::utils::DEVICE_TEMPLATE) + "(4)"}}, + {{ov::device::priorities.name(), std::string(ov::test::utils::DEVICE_TEMPLATE) + "(4)"}, + {ov::auto_batch_timeout(1)}}, + {{ov::device::priorities.name(), std::string(ov::test::utils::DEVICE_TEMPLATE) + "(4)"}, {ov::auto_batch_timeout(10)}}, }; diff --git a/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_plugin/properties_tests.cpp b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_plugin/properties_tests.cpp index f6d55269b6cbf2..43f2e9a61f8a98 100644 --- a/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_plugin/properties_tests.cpp +++ b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_plugin/properties_tests.cpp @@ -55,8 +55,8 @@ const std::vector multi_properties = { }; const std::vector auto_batch_properties = { - {{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), ov::test::utils::DEVICE_TEMPLATE}}, - {{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), ov::test::utils::DEVICE_TEMPLATE}, {CONFIG_KEY(AUTO_BATCH_TIMEOUT), "1"}}, + {{ov::device::priorities.name(), ov::test::utils::DEVICE_TEMPLATE}}, + {{ov::device::priorities.name(), ov::test::utils::DEVICE_TEMPLATE}, {CONFIG_KEY(AUTO_BATCH_TIMEOUT), "1"}}, }; INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, diff --git a/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/io_tensor.cpp b/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/io_tensor.cpp index 4f55c443118208..c716486a369951 100644 --- a/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/io_tensor.cpp +++ b/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/io_tensor.cpp @@ -222,8 +222,8 @@ TEST_P(OVInferRequestIOTensorTest, canInferWithGetOut) { } TEST_P(OVInferRequestIOTensorTest, InferStaticNetworkSetChangedInputTensorThrow) { - const ov::Shape shape1 = {1, 2, 32, 32}; - const ov::Shape shape2 = {1, 2, 40, 40}; + const ov::Shape shape1 = {1, 2, 40, 40}; + const ov::Shape shape2 = {1, 2, 32, 32}; std::map shapes; shapes[function->inputs().back().get_any_name()] = shape1; OV_ASSERT_NO_THROW(function->reshape(shapes)); diff --git a/src/tests/functional/plugin/shared/src/behavior/ov_plugin/properties_tests.cpp b/src/tests/functional/plugin/shared/src/behavior/ov_plugin/properties_tests.cpp index 37c6e88ae6d6d5..1f95c73dba5861 100644 --- a/src/tests/functional/plugin/shared/src/behavior/ov_plugin/properties_tests.cpp +++ b/src/tests/functional/plugin/shared/src/behavior/ov_plugin/properties_tests.cpp @@ -93,10 +93,9 @@ void OVPropertiesTestsWithCompileModelProps::SetUp() { if (target_device == std::string(ov::test::utils::DEVICE_MULTI) || target_device == std::string(ov::test::utils::DEVICE_AUTO) || - target_device == std::string(ov::test::utils::DEVICE_HETERO)) { - compileModelProperties = { ov::device::priorities(hw_device) }; - } else if (target_device == std::string(ov::test::utils::DEVICE_BATCH)) { - compileModelProperties = {{ CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG) , hw_device}}; + target_device == std::string(ov::test::utils::DEVICE_HETERO) || + target_device == std::string(ov::test::utils::DEVICE_BATCH)) { + compileModelProperties = {ov::device::priorities(hw_device)}; } model = ov::test::utils::make_split_concat();