From df7381e730a015439dc9b5624c3215be2bd56d2f Mon Sep 17 00:00:00 2001 From: "Anastasiya(Asya) Pronina" Date: Wed, 7 Aug 2024 16:04:58 +0100 Subject: [PATCH] Fixed "NPU_USE_NPUW" : "NO" case (#25926) ### Details: - When "NPU_USE_NPUW" : "NO"/`false` is passed to `intel_npu::Plugin::compile_model(...)`, it is not removed from incoming OV properties and passes on right to npu plugin's `intel_npu::Config` config causing: ``` [ NOT_FOUND ] Option 'NPU_USE_NPUW' is not supported for current configuration ``` - However, workaround for issue is available: just not passing "NPU_USE_NPUW" : "NO" will result in right behavior is you don't need NPUW. ### Tickets: - *ticket-id* Co-authored-by: Dmitry Matveev --- .../intel_npu/src/plugin/src/plugin.cpp | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cpp index 18ed219f26fc11..53e6be848649b7 100644 --- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp +++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp @@ -596,17 +596,23 @@ std::shared_ptr 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()) { - // CACHE_DIR isn't supported with NPU_USE_NPUW - if (properties.count(ov::cache_dir.name()) || !_globalConfig.get().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() == true) { + // CACHE_DIR isn't supported with NPU_USE_NPUW + if (localProperties.count(ov::cache_dir.name()) || !_globalConfig.get().empty()) { + OPENVINO_THROW("Option 'CACHE_DIR' is not supported with NPU_USE_NPUW"); + } + return std::make_shared(model->clone(), shared_from_this(), localProperties); + } else { + // NPUW is disabled, remove the key from the properties + localProperties.erase(useNpuwKey); } - return std::make_shared(model->clone(), shared_from_this(), properties); } - const std::map propertiesMap = any_copy(properties); - update_log_level(propertiesMap); - auto localConfig = merge_configs(_globalConfig, propertiesMap); + const std::map localPropertiesMap = any_copy(localProperties); + update_log_level(localPropertiesMap); + auto localConfig = merge_configs(_globalConfig, localPropertiesMap); const auto set_cache_dir = localConfig.get(); if (!set_cache_dir.empty()) {