Skip to content

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

Fixed "NPU_USE_NPUW" : "NO" case (#25933)

Anastasiya(Asya) Proninafb5551baa3d5
diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cpp
index 1155f313a3c..79066ca73ca 100644
--- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp
+++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp
@@ -601,17 +601,23 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<
// ... 2 - this request is NOT coming from NPUW,
// activate the NPUW path
auto useNpuwKey = ov::intel_npu::use_npuw.name();
- if (properties.count(useNpuwKey) && properties.at(useNpuwKey).as<bool>()) {
- // CACHE_DIR isn't supported with NPU_USE_NPUW
- if (properties.count(ov::cache_dir.name()) || !_globalConfig.get<CACHE_DIR>().empty()) {
- OPENVINO_THROW("Option 'CACHE_DIR' is not supported with NPU_USE_NPUW");
+ ov::AnyMap localProperties = properties;
+ if (localProperties.count(useNpuwKey)) {
+ if (localProperties.at(useNpuwKey).as<bool>() == true) {
+ // CACHE_DIR isn't supported with NPU_USE_NPUW
+ if (localProperties.count(ov::cache_dir.name()) || !_globalConfig.get<CACHE_DIR>().empty()) {
+ OPENVINO_THROW("Option 'CACHE_DIR' is not supported with NPU_USE_NPUW");
+ }
+ return std::make_shared<ov::npuw::CompiledModel>(model->clone(), shared_from_this(), localProperties);
+ } else {
+ // NPUW is disabled, remove the key from the properties
+ localProperties.erase(useNpuwKey);
}
- return std::make_shared<ov::npuw::CompiledModel>(model->clone(), shared_from_this(), properties);
}
- const std::map<std::string, std::string> propertiesMap = any_copy(properties);
- auto localConfig = merge_configs(_globalConfig, propertiesMap);
- _logger.setLevel(localConfig.get<LOG_LEVEL>());
+ const std::map<std::string, std::string> localPropertiesMap = any_copy(localProperties);
+ auto localConfig = merge_configs(_globalConfig, localPropertiesMap);
+ update_log_level(localPropertiesMap);
const auto set_cache_dir = localConfig.get<CACHE_DIR>();
if (!set_cache_dir.empty()) {