From 71880aadd37ef806ea01573bb2f752b6c3108807 Mon Sep 17 00:00:00 2001 From: Ilya Churaev Date: Thu, 20 Apr 2023 00:21:18 +0400 Subject: [PATCH] Deprecate set batch method (#17057) * Deprecate set batch method * Fixed some errors * Suppress warning in tests * Fixed warning in GPU * Deprecate python --- src/bindings/c/include/c_api/ie_c_api.h | 3 ++- .../src/compatibility/openvino/inference_engine/ie_api.pyx | 2 ++ .../impl/ie_infer_async_request_thread_safe_default.hpp | 2 ++ .../cpp_interfaces/interface/ie_iinfer_request_internal.hpp | 2 ++ src/inference/include/ie/cpp/ie_infer_request.hpp | 2 ++ src/inference/include/ie/ie_iinfer_request.hpp | 2 ++ src/inference/include/ie/ie_plugin_config.hpp | 4 ++++ src/inference/tests/functional/async_infer_request_test.cpp | 2 ++ src/plugins/intel_cpu/src/config.cpp | 4 ++++ src/plugins/intel_gpu/src/plugin/legacy_api_helper.cpp | 2 ++ 10 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/bindings/c/include/c_api/ie_c_api.h b/src/bindings/c/include/c_api/ie_c_api.h index 7f81a2ded42..507675379fd 100644 --- a/src/bindings/c/include/c_api/ie_c_api.h +++ b/src/bindings/c/include/c_api/ie_c_api.h @@ -758,7 +758,8 @@ ie_infer_request_wait(ie_infer_request_t* infer_request, const int64_t timeout); * @param size New batch size to be used by all the following inference calls for this request. * @return Status code of the operation: OK(0) for success. */ -INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) +INFERENCE_ENGINE_C_API(OPENVINO_DEPRECATED("This function is deprecated and will be removed in 2023.1 release") + IE_NODISCARD IEStatusCode) ie_infer_request_set_batch(ie_infer_request_t* infer_request, const size_t size); /** @} */ // end of InferRequest diff --git a/src/bindings/python/src/compatibility/openvino/inference_engine/ie_api.pyx b/src/bindings/python/src/compatibility/openvino/inference_engine/ie_api.pyx index aba817139fc..cce3e6326c9 100644 --- a/src/bindings/python/src/compatibility/openvino/inference_engine/ie_api.pyx +++ b/src/bindings/python/src/compatibility/openvino/inference_engine/ie_api.pyx @@ -1549,6 +1549,8 @@ cdef class InferRequest: def set_batch(self, size): """Sets new batch size for certain infer request when dynamic batching is enabled in executable network that created this request. + + This method is deprecated and will be removed in 2023.1 release. .. note:: Support of dynamic batch size depends on the target plugin. diff --git a/src/inference/dev_api/cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp b/src/inference/dev_api/cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp index 62bb634ea6a..e0899c431ec 100644 --- a/src/inference/dev_api/cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp +++ b/src/inference/dev_api/cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp @@ -263,10 +263,12 @@ public: return _syncRequest->GetPreProcess(name); } + OPENVINO_SUPPRESS_DEPRECATED_START void SetBatch(int batch) override { CheckState(); _syncRequest->SetBatch(batch); }; + OPENVINO_SUPPRESS_DEPRECATED_END void SetCallback(Callback callback) override { CheckState(); diff --git a/src/inference/dev_api/cpp_interfaces/interface/ie_iinfer_request_internal.hpp b/src/inference/dev_api/cpp_interfaces/interface/ie_iinfer_request_internal.hpp index e77c121d425..3be236d7f76 100644 --- a/src/inference/dev_api/cpp_interfaces/interface/ie_iinfer_request_internal.hpp +++ b/src/inference/dev_api/cpp_interfaces/interface/ie_iinfer_request_internal.hpp @@ -147,8 +147,10 @@ public: /** * @brief Sets new batch size when dynamic batching is enabled in executable network that created this request. + * @deprecated * @param batch - new batch size to be used by all the following inference calls for this request. */ + INFERENCE_ENGINE_DEPRECATED("This method is deprecated and will be removed in 2023.1 release") virtual void SetBatch(int batch); /** diff --git a/src/inference/include/ie/cpp/ie_infer_request.hpp b/src/inference/include/ie/cpp/ie_infer_request.hpp index 9aec243f71c..70e4cd40a2f 100644 --- a/src/inference/include/ie/cpp/ie_infer_request.hpp +++ b/src/inference/include/ie/cpp/ie_infer_request.hpp @@ -165,9 +165,11 @@ public: /** * @brief Sets new batch size when dynamic batching is enabled in executable network that created this request. + * @deprecated * * @param batch new batch size to be used by all the following inference calls for this request. */ + INFERENCE_ENGINE_DEPRECATED("This method is deprecated and will be removed in 2023.1 release") void SetBatch(const int batch); /** diff --git a/src/inference/include/ie/ie_iinfer_request.hpp b/src/inference/include/ie/ie_iinfer_request.hpp index 05da3ed1442..99371c31a9c 100644 --- a/src/inference/include/ie/ie_iinfer_request.hpp +++ b/src/inference/include/ie/ie_iinfer_request.hpp @@ -194,11 +194,13 @@ public: /** * @brief Sets new batch size when dynamic batching is enabled in executable network that created this request. * + * @deprecated * @param batch_size new batch size to be used by all the following inference calls for this request. * @param resp Optional: a pointer to an already allocated object to contain extra information of a failure (if * occurred) * @return Enumeration of the resulted action: InferenceEngine::OK (0) for success */ + INFERENCE_ENGINE_DEPRECATED("This method is deprecated and will be removed in 2023.1 release") virtual InferenceEngine::StatusCode SetBatch(int batch_size, ResponseDesc* resp) noexcept = 0; protected: diff --git a/src/inference/include/ie/ie_plugin_config.hpp b/src/inference/include/ie/ie_plugin_config.hpp index 73ae94b3d1b..8894fe5acd7 100644 --- a/src/inference/include/ie/ie_plugin_config.hpp +++ b/src/inference/include/ie/ie_plugin_config.hpp @@ -346,6 +346,7 @@ DECLARE_CONFIG_KEY(PERF_COUNT); /** * @brief The key defines dynamic limit of batch processing. + * @deprecated * * Specified value is applied to all following Infer() calls. Inference Engine processes * min(batch_limit, original_batch_size) first pictures from input blob. For example, if input @@ -357,11 +358,14 @@ DECLARE_CONFIG_KEY(PERF_COUNT); * -1 - Do not limit batch processing * >0 - Direct value of limit. Batch size to process is min(new batch_limit, original_batch) */ +INFERENCE_ENGINE_DEPRECATED("This config is deprecated and will be removed in 2023.1 release") DECLARE_CONFIG_KEY(DYN_BATCH_LIMIT); /** * @brief The key checks whether dynamic batch is enabled. + * @deprecated */ +INFERENCE_ENGINE_DEPRECATED("This config is deprecated and will be removed in 2023.1 release") DECLARE_CONFIG_KEY(DYN_BATCH_ENABLED); /** diff --git a/src/inference/tests/functional/async_infer_request_test.cpp b/src/inference/tests/functional/async_infer_request_test.cpp index 529652f7482..540c7c0b725 100644 --- a/src/inference/tests/functional/async_infer_request_test.cpp +++ b/src/inference/tests/functional/async_infer_request_test.cpp @@ -55,7 +55,9 @@ TEST(InferRequestCPPTests, throwsOnUninitializedSetOutput) { TEST(InferRequestCPPTests, throwsOnUninitializedSetBatch) { InferRequest req; + IE_SUPPRESS_DEPRECATED_START ASSERT_THROW(req.SetBatch({}), InferenceEngine::NotAllocated); + IE_SUPPRESS_DEPRECATED_END } TEST(InferRequestCPPTests, throwsOnUninitializedStartAsync) { diff --git a/src/plugins/intel_cpu/src/config.cpp b/src/plugins/intel_cpu/src/config.cpp index 3f51a7ab007..435781c404f 100644 --- a/src/plugins/intel_cpu/src/config.cpp +++ b/src/plugins/intel_cpu/src/config.cpp @@ -74,6 +74,7 @@ void Config::readProperties(const std::map &prop) { for (const auto& kvp : prop) { const auto& key = kvp.first; const auto& val = kvp.second; + IE_SUPPRESS_DEPRECATED_START if (streamExecutorConfigKeys.end() != std::find(std::begin(streamExecutorConfigKeys), std::end(streamExecutorConfigKeys), key)) { streamExecutorConfig.SetConfig(key, val); @@ -246,6 +247,7 @@ void Config::readProperties(const std::map &prop) { } else { IE_THROW(NotFound) << "Unsupported property " << key << " by CPU plugin"; } + IE_SUPPRESS_DEPRECATED_END } // apply execution mode after all the params are handled to prevent possible conflicts // when both execution_mode and inference_precision are specified @@ -298,12 +300,14 @@ void Config::updateProperties() { _config.insert({ PluginConfigParams::KEY_EXCLUSIVE_ASYNC_REQUESTS, PluginConfigParams::YES }); else _config.insert({ PluginConfigParams::KEY_EXCLUSIVE_ASYNC_REQUESTS, PluginConfigParams::NO }); + IE_SUPPRESS_DEPRECATED_START if (enableDynamicBatch == true) _config.insert({ PluginConfigParams::KEY_DYN_BATCH_ENABLED, PluginConfigParams::YES }); else _config.insert({ PluginConfigParams::KEY_DYN_BATCH_ENABLED, PluginConfigParams::NO }); _config.insert({ PluginConfigParams::KEY_DYN_BATCH_LIMIT, std::to_string(batchLimit) }); + IE_SUPPRESS_DEPRECATED_END _config.insert({ PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, std::to_string(streamExecutorConfig._streams) }); diff --git a/src/plugins/intel_gpu/src/plugin/legacy_api_helper.cpp b/src/plugins/intel_gpu/src/plugin/legacy_api_helper.cpp index 4945e76716b..8425e71cba9 100644 --- a/src/plugins/intel_gpu/src/plugin/legacy_api_helper.cpp +++ b/src/plugins/intel_gpu/src/plugin/legacy_api_helper.cpp @@ -223,6 +223,7 @@ std::pair LegacyAPIHelper::convert_to_legacy_property(cons } std::vector LegacyAPIHelper::get_supported_configs() { + OPENVINO_SUPPRESS_DEPRECATED_START static const std::vector supported_config = { CONFIG_KEY(MODEL_PRIORITY), CONFIG_KEY(PERFORMANCE_HINT), @@ -241,6 +242,7 @@ std::vector LegacyAPIHelper::get_supported_configs() { GPU_CONFIG_KEY(MAX_NUM_THREADS), GPU_CONFIG_KEY(ENABLE_LOOP_UNROLLING), }; + OPENVINO_SUPPRESS_DEPRECATED_END return supported_config; }