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] Make NPU_ENABLE_STRIDES_FOR option public (#33704)
Bogdan Pereanuf375c34a38bc
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 519d65800a0..d70b45573b5 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@@ -155,6 +155,7 @@ offer a limited set of supported OpenVINO features.ov::intel_npu::run_inferences_sequentiallyov::intel_npu::disable_idle_memory_prunningov::intel_npu::compiler_type+ ov::intel_npu::enable_strides_for.. tab-item:: Read-only propertiesdiff --git a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp b/src/bindings/python/src/pyopenvino/core/properties/properties.cppindex 847f4e40c77..8bb56d5528f 100644--- a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp+++ b/src/bindings/python/src/pyopenvino/core/properties/properties.cpp@@ -353,6 +353,7 @@ void regmodule_properties(py::module m) {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");wrap_property_RW(m_intel_npu, ov::intel_npu::disable_idle_memory_prunning, "disable_idle_memory_prunning");+ wrap_property_RW(m_intel_npu, ov::intel_npu::enable_strides_for, "enable_strides_for");py::enum_<ov::intel_npu::CompilerType>(m_intel_npu, "CompilerType", py::arithmetic()).value("DRIVER", ov::intel_npu::CompilerType::DRIVER)diff --git a/src/bindings/python/tests/test_runtime/test_properties.py b/src/bindings/python/tests/test_runtime/test_properties.pyindex f7c53d843c0..6d02fc4cf3f 100644--- a/src/bindings/python/tests/test_runtime/test_properties.py+++ b/src/bindings/python/tests/test_runtime/test_properties.py@@ -508,6 +508,11 @@ def test_properties_ro(ov_property_ro, expected_value):"NPU_DISABLE_IDLE_MEMORY_PRUNING",((True, True),),),+ (+ intel_npu.enable_strides_for,+ "NPU_ENABLE_STRIDES_FOR",+ (("inputs,outputs", "inputs,outputs"),),+ ),(intel_npu.compiler_type,"NPU_COMPILER_TYPE",diff --git a/src/inference/include/openvino/runtime/intel_npu/properties.hpp b/src/inference/include/openvino/runtime/intel_npu/properties.hppindex afb106d148e..871d8e9be0c 100644--- a/src/inference/include/openvino/runtime/intel_npu/properties.hpp+++ b/src/inference/include/openvino/runtime/intel_npu/properties.hpp@@ -205,5 +205,15 @@ static constexpr ov::Property<bool> run_inferences_sequentially{"NPU_RUN_INFEREN*/static constexpr ov::Property<bool> disable_idle_memory_prunning{"NPU_DISABLE_IDLE_MEMORY_PRUNING"};+/**+ * @brief [Only for NPU Plugin]+ * Type: std::string, default is empty+ * Enables custom stride support for specified input/output tensors by name. This allows working with non-contiguous+ * memory layouts without copying data. The plugin automatically maps these names to the appropriate input/output+ * indices for the compiler.+ * @ingroup ov_runtime_npu_prop_cpp_api+ */+static constexpr ov::Property<std::string> enable_strides_for("NPU_ENABLE_STRIDES_FOR");+} // namespace intel_npu} // namespace ovdiff --git a/src/plugins/intel_npu/README.md b/src/plugins/intel_npu/README.mdindex c8d36ac2dc5..d99fa0440c4 100644--- a/src/plugins/intel_npu/README.md+++ b/src/plugins/intel_npu/README.md@@ -210,6 +210,7 @@ The following properties are supported (may differ based on current system confi| `ov::intel_npu::defer_weights_load`/</br>`NPU_DEFER_WEIGHTS_LOAD` | RW | Delay loading the weights until inference is created. | `YES`/ `NO`| `NO` || `ov::intel_npu::run_inferences_sequentially`/</br>`NPU_RUN_INFERENCES_SEQUENTIALLY` | RW | Run inferences in async mode sequentially in the order in which they are started to optimize host scheduling. | `YES`/ `NO`| `NO` || `ov::intel_npu::disable_idle_memory_prunning`/</br>`NPU_DISABLE_IDLE_MEMORY_PRUNING` | RW | Enable/Disable pruning of memory during idle time. | `YES` / `NO` | `NO` |+| `ov::intel_npu::enable_strides_for`/</br>`NPU_ENABLE_STRIDES_FOR` | RW | List of input/output tensor names that should support custom strides. | Tensor names, e.g., `"input,output"` | `N/A` |<br>### Compiled_model properties VS Plugin propertiesdiff --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 feb98b35a5a..3643c43c4de 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@@ -1493,6 +1493,10 @@ struct ENABLE_STRIDES_FOR final : OptionBase<ENABLE_STRIDES_FOR, std::string> {static OptionMode mode() {return OptionMode::CompileTime;}++ static bool isPublic() {+ return true;+ }};struct DISABLE_IDLE_MEMORY_PRUNING final : OptionBase<DISABLE_IDLE_MEMORY_PRUNING, bool> {diff --git a/src/plugins/intel_npu/src/al/include/intel_npu/npu_private_properties.hpp b/src/plugins/intel_npu/src/al/include/intel_npu/npu_private_properties.hppindex 56649144a61..90daca2bf74 100644--- a/src/plugins/intel_npu/src/al/include/intel_npu/npu_private_properties.hpp+++ b/src/plugins/intel_npu/src/al/include/intel_npu/npu_private_properties.hpp@@ -465,14 +465,5 @@ static constexpr ov::Property<bool> import_raw_blob{"NPU_IMPORT_RAW_BLOB"};*/static constexpr ov::Property<bool> export_raw_blob{"NPU_EXPORT_RAW_BLOB"};-/**- * @brief [Only for NPU Plugin]- * Type: std::string, default is empty- * Enables custom stride support for specified input/output tensors by name. This allows working with non-contiguous- * memory layouts without copying data. The plugin automatically maps these names to the appropriate input/output- * indices for the compiler.- */-static constexpr ov::Property<std::string> enable_strides_for("NPU_ENABLE_STRIDES_FOR");-} // namespace intel_npu} // namespace ovdiff --git a/src/plugins/intel_npu/tests/functional/behavior/roi_tensors_tests/roi_tensors_tests.hpp b/src/plugins/intel_npu/tests/functional/behavior/roi_tensors_tests/roi_tensors_tests.hppindex 40c5f190c5f..0bdf061908f 100644--- a/src/plugins/intel_npu/tests/functional/behavior/roi_tensors_tests/roi_tensors_tests.hpp+++ b/src/plugins/intel_npu/tests/functional/behavior/roi_tensors_tests/roi_tensors_tests.hpp@@ -66,8 +66,7 @@ public:std::tie(target_device, configuration) = this->GetParam();OVPluginTestBase::SetUp();- // TODO: Enable property check when enable_strides_for becomes part of public properties- // isStridedEnabled();+ isStridedEnabled();}void TearDown() override {@@ -969,7 +968,7 @@ TEST_P(RoiTensorsTestsRun, RunStridedTensorWithDynamicBoundedBatching) {output_data[i] = 10.0f;}- configuration[ov::intel_npu::enable_strides_for.name()] = "input0 Result0";+ configuration[ov::intel_npu::enable_strides_for.name()] = "input0,Result0";OV_ASSERT_NO_THROW(compiled_model = core->compile_model(model, target_device, configuration));ov::InferRequest req;@@ -1020,7 +1019,7 @@ TEST_P(RoiTensorsTestsRun, CreateRoiTensorFromHostTensorUpdateCommandListAndRunIoutput_data[i] = 10.0f;}- configuration[ov::intel_npu::enable_strides_for.name()] = "input0, Result0";+ configuration[ov::intel_npu::enable_strides_for.name()] = "input0,Result0";OV_ASSERT_NO_THROW(compiled_model = core->compile_model(model, target_device, configuration));ov::InferRequest req;diff --git a/src/plugins/intel_npu/tests/functional/shared_tests_instances/npu_skip_func_tests.xml b/src/plugins/intel_npu/tests/functional/shared_tests_instances/npu_skip_func_tests.xmlindex f7fc94f99ee..3a6bbd910b2 100644--- a/src/plugins/intel_npu/tests/functional/shared_tests_instances/npu_skip_func_tests.xml+++ b/src/plugins/intel_npu/tests/functional/shared_tests_instances/npu_skip_func_tests.xml@@ -834,13 +834,6 @@ Example:</filters></skip_config>- <skip_config>- <message>Strides are not supported with the current driver</message>- <filters>- <filter>.*RoiTensorsTestsRun.*</filter>- </filters>- </skip_config>-<skip_config><message>Blobs for OVBlobCompatibilityNPU need to be updated for NPU5010</message><enable_rules>