Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Update doc for using sync api with performance hints (#31121)

Wanglei Shenb2b8927f4774
diff --git a/docs/articles_en/openvino-workflow/running-inference/optimize-inference/high-level-performance-hints.rst b/docs/articles_en/openvino-workflow/running-inference/optimize-inference/high-level-performance-hints.rst
index 403709919a5..621bfdcdc35 100644
--- a/docs/articles_en/openvino-workflow/running-inference/optimize-inference/high-level-performance-hints.rst
+++ b/docs/articles_en/openvino-workflow/running-inference/optimize-inference/high-level-performance-hints.rst
@@ -25,7 +25,7 @@ Therefore, in order to ease the configuration of the device, OpenVINO offers two
For more information on conducting performance measurements with the ``benchmark_app``, refer to the last section in this document.
-Keep in mind that a typical model may take significantly more time to load with the ``ov::hint::PerformanceMode::THROUGHPUT`` and consume much more memory, compared to the ``ov::hint::PerformanceMode::LATENCY``. Also, the `THROUGHPUT` and `LATENCY` hints only improve performance in an asynchronous inference pipeline. For information on asynchronous inference, see the :ref:`Prefer Async API <prefer-async-api>` section of this document.
+Models may load slower and consume more memory when using ``ov::hint::PerformanceMode::THROUGHPUT`` compared to ``ov::hint::PerformanceMode::LATENCY``. ``THROUGHPUT`` and ``LATENCY`` hints can improve performance in asynchronous inference and support different use cases in synchronous inference. For more details on asynchronous inference, see the :ref:`Working with Sync/Async API <working-with-sync-async-api>` section of this document.
Performance Hints: How It Works
###############################
@@ -119,18 +119,14 @@ The hints are used on the presumption that the application queries ``ov::optimal
While an application is free to create more requests if needed (for example to support asynchronous inputs population) **it is very important to at least run the** ``ov::optimal_number_of_infer_requests`` **of the inference requests in parallel**. It is recommended for efficiency, or device utilization, reasons.
-.. _prefer-async-api:
+.. _working-with-sync-async-api:
-Prefer Async API
-################
+Working with Sync/Async API
+###########################
The API of the inference requests offers Sync and Async execution. The ``ov::InferRequest::infer()`` is inherently synchronous and simple to operate (as it serializes the execution flow in the current application thread). The Async "splits" the ``infer()`` into ``ov::InferRequest::start_async()`` and ``ov::InferRequest::wait()`` (or callbacks). For more information on synchronous and asynchronous modes, refer to the :doc:`OpenVINO Inference Request <../inference-request>`.
-Although the synchronous API can be easier to start with, it is recommended to use the asynchronous (callbacks-based) API in production code. It is the most general and scalable way to implement the flow control for any possible number of requests. The ``THROUGHPUT`` and ``LATENCY`` performance hints automatically configure the Asynchronous pipeline to use the optimal number of processing streams and inference requests.
-
-.. note::
-
- **Important:** Performance Hints only work when asynchronous execution mode is used. They do not affect the performance of a synchronous pipeline.
+Use the ``LATENCY`` hint with synchronous inference (a blocking inference call with a single inference request) for low latency. Use the ``THROUGHPUT`` hint with asynchronous inference (callbacks-based) for high throughput when the applications handles multiple concurrent inference requests at the same time. ``THROUGHPUT`` and ``LATENCY`` hints automatically configure the inference pipeline for the optimal number of streams and requests.
Combining the Hints and Individual Low-Level Settings
#####################################################