Skip to content

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

[NPU] Fix offline compilation path (#33782)

Bogdan Pereanub62cc7f238ff
diff --git a/src/plugins/intel_npu/src/compiler_adapter/include/compiler_adapter_factory.hpp b/src/plugins/intel_npu/src/compiler_adapter/include/compiler_adapter_factory.hpp
index eac9caa0c1c..dc1a76a342e 100644
--- a/src/plugins/intel_npu/src/compiler_adapter/include/compiler_adapter_factory.hpp
+++ b/src/plugins/intel_npu/src/compiler_adapter/include/compiler_adapter_factory.hpp
@@ -27,18 +27,23 @@ public:
std::unique_ptr<ICompilerAdapter> getCompiler(const ov::SoPtr<IEngineBackend>& engineBackend,
ov::intel_npu::CompilerType& compilerType) const {
- if (_pluginCompilerIsPresent) {
- if (compilerType == ov::intel_npu::CompilerType::PREFER_PLUGIN) {
- try {
- compilerType = ov::intel_npu::CompilerType::PLUGIN;
- return std::make_unique<PluginCompilerAdapter>(engineBackend->getInitStructs());
- } catch (...) {
- _pluginCompilerIsPresent = false;
- compilerType = ov::intel_npu::CompilerType::DRIVER;
+ if (engineBackend) {
+ if (_pluginCompilerIsPresent) {
+ if (compilerType == ov::intel_npu::CompilerType::PREFER_PLUGIN) {
+ try {
+ compilerType = ov::intel_npu::CompilerType::PLUGIN;
+ return std::make_unique<PluginCompilerAdapter>(engineBackend->getInitStructs());
+ } catch (...) {
+ _pluginCompilerIsPresent = false;
+ compilerType = ov::intel_npu::CompilerType::DRIVER;
+ }
}
+ } else {
+ compilerType = ov::intel_npu::CompilerType::DRIVER;
}
} else {
- compilerType = ov::intel_npu::CompilerType::DRIVER;
+ // no backend present, offline compilation only
+ compilerType = ov::intel_npu::CompilerType::PLUGIN;
}
if (compilerType == ov::intel_npu::CompilerType::PLUGIN) {