Skip to content

Commit

Permalink
Fixed "NPU_USE_NPUW" : "NO" case (#25926)
Browse files Browse the repository at this point in the history
### 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 <[email protected]>
  • Loading branch information
AsyaPronina and dmatveev authored Aug 7, 2024
1 parent 7481ff2 commit df7381e
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/plugins/intel_npu/src/plugin/src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,17 +596,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);
update_log_level(propertiesMap);
auto localConfig = merge_configs(_globalConfig, propertiesMap);
const std::map<std::string, std::string> localPropertiesMap = any_copy(localProperties);
update_log_level(localPropertiesMap);
auto localConfig = merge_configs(_globalConfig, localPropertiesMap);

const auto set_cache_dir = localConfig.get<CACHE_DIR>();
if (!set_cache_dir.empty()) {
Expand Down

0 comments on commit df7381e

Please sign in to comment.