Skip to content

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

[NPU] Set MAX_TILES Read Only (#34768)

Sorin Butnariuec3920cc77f8
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.rst
index d4253fc67ff..fa6295237a5 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
@@ -152,7 +152,6 @@ The NPU device is currently supported by AUTO inference modes
ov::intel_npu::turbo
ov::intel_npu::platform
ov::intel_npu::tiles
- ov::intel_npu::max_tiles
ov::intel_npu::bypass_umd_caching
ov::intel_npu::defer_weights_load
ov::intel_npu::run_inferences_sequentially
@@ -183,6 +182,7 @@ The NPU device is currently supported by AUTO inference modes
ov::intel_npu::device_total_mem_size
ov::intel_npu::driver_version
ov::intel_npu::compiler_version
+ ov::intel_npu::max_tiles
.. note::
@@ -270,7 +270,7 @@ or
For on-device compilation, the plugin queries the driver for the available number of tiles and sets ``ov::intel_npu::max_tiles``.
-``ov::intel_npu::max_tiles`` is a read-write property to allow users to set it during offline compilation.
+``ov::intel_npu::max_tiles`` is a read-only property, and it will not be listed as supported in cases where no device is present.
Note that ``ov::intel_npu::max_tiles`` represents the maximum number of tiles available,
but the compiler may target a lower number of tiles depending on other properties.
diff --git a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp b/src/bindings/python/src/pyopenvino/core/properties/properties.cpp
index 3c3e9d1cd03..11a06e70a6f 100644
--- a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp
+++ b/src/bindings/python/src/pyopenvino/core/properties/properties.cpp
@@ -341,12 +341,12 @@ void regmodule_properties(py::module m) {
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_RO(m_intel_npu, ov::intel_npu::compiler_version, "compiler_version");
+ wrap_property_RO(m_intel_npu, ov::intel_npu::max_tiles, "max_tiles");
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::platform, "platform");
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");
wrap_property_RW(m_intel_npu, ov::intel_npu::compiler_dynamic_quantization, "compiler_dynamic_quantization");
diff --git a/src/bindings/python/tests/test_runtime/test_properties.py b/src/bindings/python/tests/test_runtime/test_properties.py
index 48e82234b26..98c1231c54f 100644
--- a/src/bindings/python/tests/test_runtime/test_properties.py
+++ b/src/bindings/python/tests/test_runtime/test_properties.py
@@ -204,6 +204,7 @@ def test_conflicting_enum(proxy_enums, expected_values):
(intel_npu.device_total_mem_size, "NPU_DEVICE_TOTAL_MEM_SIZE"),
(intel_npu.driver_version, "NPU_DRIVER_VERSION"),
(intel_npu.compiler_version, "NPU_COMPILER_VERSION"),
+ (intel_npu.max_tiles, "NPU_MAX_TILES")
],
)
def test_properties_ro(ov_property_ro, expected_value):
@@ -479,11 +480,6 @@ def test_properties_ro(ov_property_ro, expected_value):
"NPU_TILES",
((128, 128),),
),
- (
- intel_npu.max_tiles,
- "NPU_MAX_TILES",
- ((128, 128),),
- ),
(
intel_npu.bypass_umd_caching,
"NPU_BYPASS_UMD_CACHING",
diff --git a/src/inference/include/openvino/runtime/intel_npu/properties.hpp b/src/inference/include/openvino/runtime/intel_npu/properties.hpp
index 871d8e9be0c..fb7402d6fc9 100644
--- a/src/inference/include/openvino/runtime/intel_npu/properties.hpp
+++ b/src/inference/include/openvino/runtime/intel_npu/properties.hpp
@@ -170,7 +170,7 @@ static constexpr ov::Property<int64_t> tiles{"NPU_TILES"};
* will be populated by driver.
* @ingroup ov_runtime_npu_prop_cpp_api
*/
-static constexpr ov::Property<int64_t> max_tiles{"NPU_MAX_TILES"};
+static constexpr ov::Property<int64_t, ov::PropertyMutability::RO> max_tiles{"NPU_MAX_TILES"};
/**
* @brief [Only for NPU plugin]
diff --git a/src/plugins/intel_npu/README.md b/src/plugins/intel_npu/README.md
index 28684661716..a6b3116ed43 100644
--- a/src/plugins/intel_npu/README.md
+++ b/src/plugins/intel_npu/README.md
@@ -222,7 +222,7 @@ The following properties are supported (may differ based on current system confi
| `ov::intel_npu::turbo`/</br>`NPU_TURBO` | RW | Set Turbo mode on/off | `YES`/ `NO`| `NO` |
| `ov::intel_npu::platform`/</br>`NPU_PLATFORM` | RW | Selects the target compilation platform. Used in offline compilation | `3720`/</br>`4000`</br>`5010` | `AUTO_DETECT` |
| `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` |
+| `ov::intel_npu::max_tiles`/</br>`NPU_MAX_TILES` | RO | Maximum number of tiles supported by the device we compile for. It will be populated by driver, if present. | `[1-6] depends on npu platform` | `[-1]` |
| `ov::intel_npu::bypass_umd_caching`/</br>`NPU_BYPASS_UMD_CACHING` | RW | Bypass the caching of compiled models in UMD. | `YES`/ `NO`| `NO` |
| `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` |
@@ -296,7 +296,7 @@ Supported values:
### ov::intel_npu::max_tiles and ov::intel_npu::tiles
For on-device compilation, the plugin queries the driver for the available number of tiles and sets `ov::intel_npu::max_tiles`.
-`ov::intel_npu::max_tiles` is a read-write property to allow users to set it during offline compilation.
+`ov::intel_npu::max_tiles` is a read-only property, and it will not be listed as supported in cases where no device is present.
Note that `ov::intel_npu::max_tiles` represents the maximum number of tiles available, but the compiler may target a lower number of tiles depending on other properties. Users can set ``ov::intel_npu::tiles`` to override the number of tiles selected by the compiler based on other properties.
When setting ``ov::intel_npu::tiles``, users must ensure that the value does not exceed ``ov::intel_npu::max_tiles``.
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.hpp
index 3400c312979..7dc2aaf72ba 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
@@ -1075,7 +1075,7 @@ struct MAX_TILES final : OptionBase<MAX_TILES, int64_t> {
}
static ov::PropertyMutability mutability() {
- return ov::PropertyMutability::RW;
+ return ov::PropertyMutability::RO;
}
};
diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cpp
index a552dd6a160..52945e0fc64 100644
--- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp
+++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp
@@ -244,7 +244,6 @@ void init_config(const IEngineBackend* backend, OptionsDesc& options, FilteredCo
REGISTER_OPTION(QDQ_OPTIMIZATION);
REGISTER_OPTION(QDQ_OPTIMIZATION_AGGRESSIVE);
REGISTER_OPTION(STEPPING);
- REGISTER_OPTION(MAX_TILES);
REGISTER_OPTION(DISABLE_VERSION_CHECK);
REGISTER_OPTION(EXPORT_RAW_BLOB);
REGISTER_OPTION(IMPORT_RAW_BLOB);
@@ -261,6 +260,9 @@ void init_config(const IEngineBackend* backend, OptionsDesc& options, FilteredCo
REGISTER_OPTION(SHARED_COMMON_QUEUE);
if (backend) {
+ // Options registered only if drivers is present and supports the corresponding extension
+ REGISTER_OPTION(MAX_TILES);
+
if (backend->isCommandQueueExtSupported()) {
REGISTER_OPTION(WORKLOAD_TYPE);
}
@@ -508,7 +510,7 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<
}
// Update stepping w/ information from driver, unless provided by user or we are off-device
- // Ignore, if compilation was requested for platform, different from current
+ // Ignore if compilation was requested for a platform that is different from the current one
if (!localConfig.has<STEPPING>() && device != nullptr && device->getName() == compilationPlatform) {
try {
localConfig.update({{ov::intel_npu::stepping.name(), std::to_string(device->getSubDevId())}});
@@ -518,13 +520,12 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<
}
}
// Update max_tiles w/ information from driver, unless provided by user or we are off-device
- // Ignore, if compilation was requested for platform, different from current
+ // Ignore if compilation was requested for a platform that is different from the current one
if (!localConfig.has<MAX_TILES>() && device != nullptr && device->getName() == compilationPlatform) {
try {
localConfig.update({{ov::intel_npu::max_tiles.name(), std::to_string(device->getMaxNumSlices())}});
} catch (...) {
- _logger.warning("Max tiles information not implemented by selected backend. Skipping. Please provide "
- "NPU_MAX_TILES if required.");
+ _logger.warning("Max tiles information not implemented by selected backend. Default value will be used.");
}
}
diff --git a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.cpp b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.cpp
index 6a8a04138d1..e1987dd8043 100644
--- a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.cpp
+++ b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.cpp
@@ -50,8 +50,7 @@ std::vector<std::pair<std::string, ov::Any>> compat_plugin_internal_mutable_prop
};
std::vector<std::pair<std::string, ov::Any>> plugin_internal_mutable_properties = {
- {ov::intel_npu::max_tiles.name(), ov::Any(8)},
- {ov::intel_npu::stepping.name(), ov::Any(4)},
+ {ov::intel_npu::stepping.name(), ov::Any(4)}
};
std::vector<std::pair<std::string, ov::Any>> plugin_public_immutable_properties = {
@@ -66,6 +65,7 @@ std::vector<std::pair<std::string, ov::Any>> plugin_public_immutable_properties
{ov::optimal_number_of_infer_requests.name(), ov::Any(4)},
{ov::intel_npu::device_alloc_mem_size.name(), ov::Any(2)},
{ov::intel_npu::device_total_mem_size.name(), ov::Any(2)},
+ {ov::intel_npu::max_tiles.name(), ov::Any(9999)}
};
std::vector<std::pair<std::string, ov::Any>> invalid_device_ids = {
diff --git a/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.hpp b/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.hpp
index ebea7ac69b4..581fc84fbb7 100644
--- a/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.hpp
+++ b/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.hpp
@@ -159,7 +159,6 @@ public:
REGISTER_OPTION(QDQ_OPTIMIZATION);
REGISTER_OPTION(QDQ_OPTIMIZATION_AGGRESSIVE);
REGISTER_OPTION(STEPPING);
- REGISTER_OPTION(MAX_TILES);
REGISTER_OPTION(DISABLE_VERSION_CHECK);
REGISTER_OPTION(EXPORT_RAW_BLOB);
REGISTER_OPTION(IMPORT_RAW_BLOB);
@@ -173,6 +172,8 @@ public:
REGISTER_OPTION(SHARED_COMMON_QUEUE);
if (backend) {
+ REGISTER_OPTION(MAX_TILES);
+
if (backend->isCommandQueueExtSupported()) {
REGISTER_OPTION(WORKLOAD_TYPE);
}
diff --git a/src/plugins/intel_npu/tests/functional/shared_tests_instances/behavior/ov_plugin/caching_tests.cpp b/src/plugins/intel_npu/tests/functional/shared_tests_instances/behavior/ov_plugin/caching_tests.cpp
index 87ef3f05efb..e35701b19a6 100644
--- a/src/plugins/intel_npu/tests/functional/shared_tests_instances/behavior/ov_plugin/caching_tests.cpp
+++ b/src/plugins/intel_npu/tests/functional/shared_tests_instances/behavior/ov_plugin/caching_tests.cpp
@@ -133,7 +133,6 @@ const std::vector<ov::AnyMap> cachingProperties = {
{ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER)},
{ov::intel_npu::dma_engines(1)},
{ov::intel_npu::dynamic_shape_to_static("true")},
- {ov::intel_npu::max_tiles(64)},
{ov::intel_npu::stepping(1)},
{ov::intel_npu::tiles(2)},
{ov::intel_npu::turbo(true)},
diff --git a/src/plugins/intel_npu/tests/unit/npu/offline_compilation.cpp b/src/plugins/intel_npu/tests/unit/npu/offline_compilation.cpp
index 13bed5e6eb8..740d9e8ffc1 100644
--- a/src/plugins/intel_npu/tests/unit/npu/offline_compilation.cpp
+++ b/src/plugins/intel_npu/tests/unit/npu/offline_compilation.cpp
@@ -58,6 +58,22 @@ TEST_P(OfflineCompilationUnitTests, ExpectThrowWhenCreateInferRequestWhenDriverN
"No available devices. Failed to create infer request!");
}
+TEST_P(OfflineCompilationUnitTests, ReadMaxTilesAndExpectThrow) {
+ core.set_property(DEVICE_NPU, config);
+ OV_EXPECT_THROW_HAS_SUBSTRING(core.get_property(DEVICE_NPU, ov::intel_npu::max_tiles),
+ ov::Exception,
+ "Unsupported configuration key");
+}
+
+TEST_P(OfflineCompilationUnitTests, ReadSupportedPropertiesMaxTilesNotPresent) {
+ core.set_property(DEVICE_NPU, config);
+ std::vector<ov::PropertyName> supportedProperties;
+ OV_ASSERT_NO_THROW(supportedProperties = core.get_property(DEVICE_NPU, ov::supported_properties));
+ ASSERT_TRUE(std::find(supportedProperties.begin(),
+ supportedProperties.end(),
+ ov::intel_npu::max_tiles.name()) == supportedProperties.end());
+}
+
INSTANTIATE_TEST_SUITE_P(
OfflineCompilationPlatforms,
OfflineCompilationUnitTests,