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
[PyOV] Add npu properties (#28358)
Anastasia Kuporosovafcf8ce5beba2
diff --git a/src/bindings/python/src/openvino/properties/intel_npu/__init__.py b/src/bindings/python/src/openvino/properties/intel_npu/__init__.pynew file mode 100644index 00000000000..7a9b8c77790--- /dev/null+++ b/src/bindings/python/src/openvino/properties/intel_npu/__init__.py@@ -0,0 +1,9 @@+# -*- coding: utf-8 -*-+# Copyright (C) 2018-2025 Intel Corporation+# SPDX-License-Identifier: Apache-2.0++# Properties+import openvino._pyopenvino.properties.intel_npu as __intel_npu+from openvino.properties._properties import __make_properties++__make_properties(__intel_npu, __name__)diff --git a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp b/src/bindings/python/src/pyopenvino/core/properties/properties.cppindex 2e3a2c8d1c9..d434cd3f573 100644--- a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp+++ b/src/bindings/python/src/pyopenvino/core/properties/properties.cpp@@ -4,6 +4,10 @@#include "pyopenvino/core/properties/properties.hpp"+#include "openvino/runtime/auto/properties.hpp"+#include "openvino/runtime/intel_cpu/properties.hpp"+#include "openvino/runtime/intel_gpu/properties.hpp"+#include "openvino/runtime/intel_npu/properties.hpp"#include "pyopenvino/core/common.hpp"#include "pyopenvino/graph/any.hpp"#include "pyopenvino/utils/utils.hpp"@@ -316,4 +320,19 @@ void regmodule_properties(py::module m) {wrap_property_RW(m_intel_auto, ov::intel_auto::enable_startup_fallback, "enable_startup_fallback");wrap_property_RW(m_intel_auto, ov::intel_auto::enable_runtime_fallback, "enable_runtime_fallback");wrap_property_RW(m_intel_auto, ov::intel_auto::schedule_policy, "schedule_policy");++ // Submodule npu+ py::module m_intel_npu =+ m_properties.def_submodule("intel_npu", "openvino.properties.intel_npu submodule that simulates ov::intel_npu");++ wrap_property_RO(m_intel_npu, ov::intel_npu::device_alloc_mem_size, "device_alloc_mem_size");+ wrap_property_RO(m_intel_npu, ov::intel_npu::device_total_mem_size, "device_total_mem_size");+ wrap_property_RO(m_intel_npu, ov::intel_npu::driver_version, "driver_version");++ wrap_property_RW(m_intel_npu, ov::intel_npu::compilation_mode_params, "compilation_mode_params");+ wrap_property_RW(m_intel_npu, ov::intel_npu::turbo, "turbo");+ wrap_property_RW(m_intel_npu, ov::intel_npu::tiles, "tiles");+ wrap_property_RW(m_intel_npu, ov::intel_npu::max_tiles, "max_tiles");+ wrap_property_RW(m_intel_npu, ov::intel_npu::bypass_umd_caching, "bypass_umd_caching");+ wrap_property_RW(m_intel_npu, ov::intel_npu::defer_weights_load, "defer_weights_load");}diff --git a/src/bindings/python/src/pyopenvino/core/properties/properties.hpp b/src/bindings/python/src/pyopenvino/core/properties/properties.hppindex 831c8336de8..955e5711ff3 100644--- a/src/bindings/python/src/pyopenvino/core/properties/properties.hpp+++ b/src/bindings/python/src/pyopenvino/core/properties/properties.hpp@@ -8,10 +8,6 @@#include <pybind11/stl.h>#include "openvino/runtime/properties.hpp"-#include "openvino/runtime/intel_cpu/properties.hpp"-#include "openvino/runtime/intel_gpu/properties.hpp"-#include "openvino/runtime/auto/properties.hpp"-#include "pyopenvino/core/properties/properties.hpp"namespace py = pybind11;diff --git a/src/bindings/python/tests/test_runtime/test_properties.py b/src/bindings/python/tests/test_runtime/test_properties.pyindex 15e2d86ead4..4cdd598e0ee 100644--- a/src/bindings/python/tests/test_runtime/test_properties.py+++ b/src/bindings/python/tests/test_runtime/test_properties.py@@ -13,6 +13,7 @@ import openvino.properties.intel_cpu as intel_cpuimport openvino.properties.intel_auto as intel_autoimport openvino.properties.intel_gpu as intel_gpuimport openvino.properties.intel_gpu.hint as intel_gpu_hint+import openvino.properties.intel_npu as intel_npuimport openvino.properties.device as deviceimport openvino.properties.log as logimport openvino.properties.streams as streams@@ -190,6 +191,9 @@ def test_conflicting_enum(proxy_enums, expected_values):(intel_gpu.uarch_version, "GPU_UARCH_VERSION"),(intel_gpu.execution_units_count, "GPU_EXECUTION_UNITS_COUNT"),(intel_gpu.memory_statistics, "GPU_MEMORY_STATISTICS"),+ (intel_npu.device_alloc_mem_size, "NPU_DEVICE_ALLOC_MEM_SIZE"),+ (intel_npu.device_total_mem_size, "NPU_DEVICE_TOTAL_MEM_SIZE"),+ (intel_npu.driver_version, "NPU_DRIVER_VERSION"),],)def test_properties_ro(ov_property_ro, expected_value):@@ -417,6 +421,36 @@ def test_properties_ro(ov_property_ro, expected_value):"AVAILABLE_DEVICE_MEM_SIZE",((128, 128),),),+ (+ intel_npu.compilation_mode_params,+ "NPU_COMPILATION_MODE_PARAMS",+ (("dummy-op-replacement=true", "dummy-op-replacement=true"),),+ ),+ (+ intel_npu.turbo,+ "NPU_TURBO",+ ((True, True),),+ ),+ (+ intel_npu.tiles,+ "NPU_TILES",+ ((128, 128),),+ ),+ (+ intel_npu.max_tiles,+ "NPU_MAX_TILES",+ ((128, 128),),+ ),+ (+ intel_npu.bypass_umd_caching,+ "NPU_BYPASS_UMD_CACHING",+ ((True, True),),+ ),+ (+ intel_npu.defer_weights_load,+ "NPU_DEFER_WEIGHTS_LOAD",+ ((True, True),),+ ),],)def test_properties_rw(ov_property_rw, expected_value, test_values):