OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[NPU] Add support for QDQ_OPTIMIZATION_AGGRESSIVE compiler property (#31686)
Bogdan Pereanu16019721928e
diff --git a/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.rst b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.rstindex 279ad1dfcfe..e9fe925e535 100644--- a/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.rst+++ b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.rst@@ -145,6 +145,7 @@ offer a limited set of supported OpenVINO features.ov::intel_npu::compilation_mode_paramsov::intel_npu::compiler_dynamic_quantizationov::intel_npu::qdq_optimization+ ov::intel_npu::qdq_optimization_aggressiveov::intel_npu::turboov::intel_npu::tilesov::intel_npu::max_tilesdiff --git a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp b/src/bindings/python/src/pyopenvino/core/properties/properties.cppindex 168c8d75913..c7b8225d88d 100644--- a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp+++ b/src/bindings/python/src/pyopenvino/core/properties/properties.cpp@@ -342,5 +342,6 @@ void regmodule_properties(py::module m) {wrap_property_RW(m_intel_npu, ov::intel_npu::defer_weights_load, "defer_weights_load");wrap_property_RW(m_intel_npu, ov::intel_npu::compiler_dynamic_quantization, "compiler_dynamic_quantization");wrap_property_RW(m_intel_npu, ov::intel_npu::qdq_optimization, "qdq_optimization");+ wrap_property_RW(m_intel_npu, ov::intel_npu::qdq_optimization_aggressive, "qdq_optimization_aggressive");wrap_property_RW(m_intel_npu, ov::intel_npu::run_inferences_sequentially, "run_inferences_sequentially");}diff --git a/src/bindings/python/tests/test_runtime/test_properties.py b/src/bindings/python/tests/test_runtime/test_properties.pyindex 83456f4b820..d2df1f65d5f 100644--- a/src/bindings/python/tests/test_runtime/test_properties.py+++ b/src/bindings/python/tests/test_runtime/test_properties.py@@ -477,6 +477,11 @@ def test_properties_ro(ov_property_ro, expected_value):"NPU_RUN_INFERENCES_SEQUENTIALLY",((True, True),),),+ (+ intel_npu.qdq_optimization_aggressive,+ "NPU_QDQ_OPTIMIZATION_AGGRESSIVE",+ ((True, True),),+ ),],)def test_properties_rw(ov_property_rw, expected_value, test_values):diff --git a/src/inference/include/openvino/runtime/intel_npu/properties.hpp b/src/inference/include/openvino/runtime/intel_npu/properties.hppindex 5deabd6ba61..2f6a5f31da1 100644--- a/src/inference/include/openvino/runtime/intel_npu/properties.hpp+++ b/src/inference/include/openvino/runtime/intel_npu/properties.hpp@@ -86,6 +86,15 @@ static constexpr ov::Property<bool> compiler_dynamic_quantization{"NPU_COMPILER_*/static constexpr ov::Property<bool> qdq_optimization{"NPU_QDQ_OPTIMIZATION"};+/**+ * @brief [Only for NPU compiler]+ * Type: boolean+ * This option enables additional optimizations to improve performance for QDQ format models, quantized using ONNX+ * Runtime+ * @ingroup ov_runtime_npu_prop_cpp_api+ */+static constexpr ov::Property<bool> qdq_optimization_aggressive{"NPU_QDQ_OPTIMIZATION_AGGRESSIVE"};+/*** @brief [Only for NPU plugin]* Type: std::booldiff --git a/src/plugins/intel_npu/README.md b/src/plugins/intel_npu/README.mdindex ecf95b4e753..a0e1ef1a2d9 100644--- a/src/plugins/intel_npu/README.md+++ b/src/plugins/intel_npu/README.md@@ -198,6 +198,7 @@ The following properties are supported (may differ based on current system confi| `ov::intel_npu::compilation_mode_params`/</br>`NPU_COMPILATION_MODE_PARAMS` | RW | Set various parameters supported by the NPU compiler. (See bellow) | `<std::string>`| `N/A` || `ov::intel_npu::compiler_dynamic_quantization`/</br>`NPU_COMPILER_DYNAMIC_QUANTIZATION` | RW | Enable/Disable dynamic quantization by NPU compiler | `YES` / `NO` | `N/A` || `ov::intel_npu::qdq_optimization`/</br>`NPU_QDQ_OPTIMIZATION` | RW | Enable/Disable additional optimizations and balances performance and accuracy for QDQ format models, quantized using ONNX Runtime | `YES` / `NO` | `NO` |+| `ov::intel_npu::qdq_optimization_aggressive`/</br>`NPU_QDQ_OPTIMIZATION_AGGRESSIVE` | RW | Enable/Disable additional optimizations to improve performance for QDQ format models, quantized using ONNX Runtime | `YES` / `NO` | `NO` || `ov::intel_npu::turbo`/</br>`NPU_TURBO` | RW | Set Turbo mode on/off | `YES`/ `NO`| `NO` || `ov::intel_npu::tiles`/</br>`NPU_TILES` | RW | Sets the number of npu tiles to compile the model for | `[0-]` | `-1` || `ov::intel_npu::max_tiles`/</br>`NPU_MAX_TILES` | RW | Maximum number of tiles supported by the device we compile for. Can be set for offline compilation. If not set, it will be populated by driver.| `[0-]` | `[1-6] depends on npu platform` |diff --git a/src/plugins/intel_npu/src/al/include/intel_npu/config/options.hpp b/src/plugins/intel_npu/src/al/include/intel_npu/config/options.hppindex f5a60124672..f9682b94338 100644--- a/src/plugins/intel_npu/src/al/include/intel_npu/config/options.hpp+++ b/src/plugins/intel_npu/src/al/include/intel_npu/config/options.hpp@@ -1226,6 +1226,28 @@ struct QDQ_OPTIMIZATION final : OptionBase<QDQ_OPTIMIZATION, bool> {}};+struct QDQ_OPTIMIZATION_AGGRESSIVE final : OptionBase<QDQ_OPTIMIZATION_AGGRESSIVE, bool> {+ static std::string_view key() {+ return ov::intel_npu::qdq_optimization_aggressive.name();+ }++ static bool defaultValue() {+ return false;+ }++ static OptionMode mode() {+ return OptionMode::CompileTime;+ }++ static bool isPublic() {+ return true;+ }++ static uint32_t compilerSupportVersion() {+ return ONEAPI_MAKE_VERSION(7, 21);+ }+};+struct DISABLE_VERSION_CHECK final : OptionBase<DISABLE_VERSION_CHECK, bool> {static std::string_view key() {return ov::intel_npu::disable_version_check.name();diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cppindex ffaf292fc66..94c6299388a 100644--- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp+++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp@@ -270,6 +270,7 @@ void Plugin::init_options() {REGISTER_OPTION(RUN_INFERENCES_SEQUENTIALLY);REGISTER_OPTION(COMPILER_DYNAMIC_QUANTIZATION);REGISTER_OPTION(QDQ_OPTIMIZATION);+ REGISTER_OPTION(QDQ_OPTIMIZATION_AGGRESSIVE);REGISTER_OPTION(STEPPING);REGISTER_OPTION(MAX_TILES);REGISTER_OPTION(DISABLE_VERSION_CHECK);diff --git a/src/plugins/intel_npu/src/plugin/src/properties.cpp b/src/plugins/intel_npu/src/plugin/src/properties.cppindex 13957d98941..72c588ef0c2 100644--- a/src/plugins/intel_npu/src/plugin/src/properties.cpp+++ b/src/plugins/intel_npu/src/plugin/src/properties.cpp@@ -376,6 +376,7 @@ void Properties::registerPluginProperties() {TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::defer_weights_load, DEFER_WEIGHTS_LOAD);TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::compiler_dynamic_quantization, COMPILER_DYNAMIC_QUANTIZATION);TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::qdq_optimization, QDQ_OPTIMIZATION);+ TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::qdq_optimization_aggressive, QDQ_OPTIMIZATION_AGGRESSIVE);TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::disable_version_check, DISABLE_VERSION_CHECK);TRY_REGISTER_SIMPLE_PROPERTY(ov::intel_npu::batch_compiler_mode_settings, BATCH_COMPILER_MODE_SETTINGS);TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::enable_cpu_pinning, ENABLE_CPU_PINNING);@@ -582,6 +583,7 @@ void Properties::registerCompiledModelProperties() {TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::compiler_dynamic_quantization,COMPILER_DYNAMIC_QUANTIZATION);TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::qdq_optimization, QDQ_OPTIMIZATION);+ TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::qdq_optimization_aggressive, QDQ_OPTIMIZATION_AGGRESSIVE);TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::disable_version_check, DISABLE_VERSION_CHECK);TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::batch_compiler_mode_settings,BATCH_COMPILER_MODE_SETTINGS);