Skip to content

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

[NPU] Add PLUGIN compiler type (#32312)

Stefania Hergane4c23beeefb4c
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 50d7b85607c..44beaae2e62 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
@@ -846,8 +846,8 @@ struct COMPILER_TYPE final : OptionBase<COMPILER_TYPE, ov::intel_npu::CompilerTy
}
static ov::intel_npu::CompilerType parse(std::string_view val) {
- if (val == "MLIR") {
- return ov::intel_npu::CompilerType::MLIR;
+ if (val == "PLUGIN" || val == "MLIR") {
+ return ov::intel_npu::CompilerType::PLUGIN;
} else if (val == "DRIVER") {
return ov::intel_npu::CompilerType::DRIVER;
}
@@ -857,8 +857,8 @@ struct COMPILER_TYPE final : OptionBase<COMPILER_TYPE, ov::intel_npu::CompilerTy
static std::string toString(const ov::intel_npu::CompilerType& val) {
std::stringstream strStream;
- if (val == ov::intel_npu::CompilerType::MLIR) {
- strStream << "MLIR";
+ if (val == ov::intel_npu::CompilerType::PLUGIN) {
+ strStream << "PLUGIN";
} else if (val == ov::intel_npu::CompilerType::DRIVER) {
strStream << "DRIVER";
} else {
diff --git a/src/plugins/intel_npu/src/al/include/intel_npu/npu_private_properties.hpp b/src/plugins/intel_npu/src/al/include/intel_npu/npu_private_properties.hpp
index c485af1e0a3..d043896789a 100644
--- a/src/plugins/intel_npu/src/al/include/intel_npu/npu_private_properties.hpp
+++ b/src/plugins/intel_npu/src/al/include/intel_npu/npu_private_properties.hpp
@@ -85,11 +85,11 @@ inline std::ostream& operator<<(std::ostream& out, const ColorFormat& fmt) {
/**
* @brief [Only for NPU Plugin]
- * Type: string, default is MLIR.
+ * Type: string, default is DRIVER.
* Type of NPU compiler to be used for compilation of a network
* @note Configuration API v 2.0
*/
-enum class CompilerType { MLIR, DRIVER };
+enum class CompilerType { MLIR = 0, PLUGIN = MLIR, DRIVER = 1 };
/**
* @brief Prints a string representation of ov::intel_npu::CompilerType to a stream
@@ -100,8 +100,8 @@ enum class CompilerType { MLIR, DRIVER };
*/
inline std::ostream& operator<<(std::ostream& out, const CompilerType& fmt) {
switch (fmt) {
- case CompilerType::MLIR: {
- out << "MLIR";
+ case CompilerType::PLUGIN: {
+ out << "PLUGIN";
} break;
case CompilerType::DRIVER: {
out << "DRIVER";
diff --git a/src/plugins/intel_npu/src/backend/src/zero_pipeline.cpp b/src/plugins/intel_npu/src/backend/src/zero_pipeline.cpp
index fd79939bcfc..c143dff4642 100644
--- a/src/plugins/intel_npu/src/backend/src/zero_pipeline.cpp
+++ b/src/plugins/intel_npu/src/backend/src/zero_pipeline.cpp
@@ -261,7 +261,7 @@ std::vector<ov::ProfilingInfo> Pipeline::get_profiling_info() const {
return _npu_profiling->getNpuInferStatistics();
}
/// PROFILING_TYPE = MODEL or undefined = fallback to model profiling
- if (_config.get<COMPILER_TYPE>() == ov::intel_npu::CompilerType::MLIR) {
+ if (_config.get<COMPILER_TYPE>() == ov::intel_npu::CompilerType::PLUGIN) {
// For plugin compiler retreive raw profiling data from backend and delegate
// processing to the compiler
_logger.debug("InferRequest::get_profiling_info complete with compiler->process_profiling_output().");
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 a0412f53c84..32e1fb38466 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
@@ -17,7 +17,7 @@ public:
std::unique_ptr<ICompilerAdapter> getCompiler(const ov::SoPtr<IEngineBackend>& engineBackend,
const ov::intel_npu::CompilerType type) const {
switch (type) {
- case ov::intel_npu::CompilerType::MLIR: {
+ case ov::intel_npu::CompilerType::PLUGIN: {
if (engineBackend == nullptr || engineBackend->getName() != "LEVEL0") {
return std::make_unique<PluginCompilerAdapter>(nullptr);
}
diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/plugin_compiler_adapter.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/plugin_compiler_adapter.cpp
index 1a3a1a51ac6..4720a1f94df 100644
--- a/src/plugins/intel_npu/src/compiler_adapter/src/plugin_compiler_adapter.cpp
+++ b/src/plugins/intel_npu/src/compiler_adapter/src/plugin_compiler_adapter.cpp
@@ -70,7 +70,7 @@ PluginCompilerAdapter::PluginCompilerAdapter(const std::shared_ptr<ZeroInitStruc
_logger("PluginCompilerAdapter", Logger::global().level()) {
_logger.debug("initialize PluginCompilerAdapter start");
- _logger.info("MLIR compiler will be used.");
+ _logger.info("PLUGIN compiler will be used.");
std::string baseName = "npu_mlir_compiler";
auto libPath = ov::util::make_plugin_library_name(ov::util::get_ov_lib_path(), baseName + OV_BUILD_POSTFIX);
_compiler = load_compiler(libPath);
diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cpp
index e1b585c151e..6a1316c53df 100644
--- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp
+++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp
@@ -605,8 +605,8 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<
const auto set_cache_dir = localConfig.get<CACHE_DIR>();
if (!set_cache_dir.empty()) {
const auto compilerType = localConfig.get<COMPILER_TYPE>();
- if (compilerType == ov::intel_npu::CompilerType::MLIR) {
- OPENVINO_THROW("Option 'CACHE_DIR' is not supported with MLIR compiler type");
+ if (compilerType == ov::intel_npu::CompilerType::PLUGIN) {
+ OPENVINO_THROW("Option 'CACHE_DIR' is not supported with PLUGIN compiler type");
}
}
diff --git a/src/plugins/intel_npu/tests/functional/behavior/fail_gracefully_forward_compatibility.hpp b/src/plugins/intel_npu/tests/functional/behavior/fail_gracefully_forward_compatibility.hpp
index db2cf47de0d..14e3e9685e9 100644
--- a/src/plugins/intel_npu/tests/functional/behavior/fail_gracefully_forward_compatibility.hpp
+++ b/src/plugins/intel_npu/tests/functional/behavior/fail_gracefully_forward_compatibility.hpp
@@ -116,7 +116,7 @@ TEST_P(FailGracefullyTest, OnUnsupportedOperator) {
core->compile_model(ov_model, target_device, configuration);
} catch (std::exception& ex) {
// TODO: the below error messages will be improved in E#64716
- if (compilerType == "MLIR") {
+ if (compilerType == "PLUGIN") {
EXPECT_THAT(ex.what(),
AllOf(HasSubstr("Unsupported operation"), HasSubstr("with type UnsupportedTestOperation")));
} else if (compilerType == "DRIVER") {
diff --git a/src/plugins/intel_npu/tests/functional/behavior/weights_separation.cpp b/src/plugins/intel_npu/tests/functional/behavior/weights_separation.cpp
index 550575927bd..ba7e6a9599e 100644
--- a/src/plugins/intel_npu/tests/functional/behavior/weights_separation.cpp
+++ b/src/plugins/intel_npu/tests/functional/behavior/weights_separation.cpp
@@ -8,7 +8,7 @@ using namespace ov::test::behavior;
const std::vector<ov::AnyMap> emptyConfig = {{}};
const std::vector<ov::AnyMap> cipConfig = {
- {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::MLIR),
+ {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::PLUGIN),
ov::intel_npu::platform(ov::test::utils::getTestsPlatformFromEnvironmentOr(ov::test::utils::DEVICE_NPU))}};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTest,
diff --git a/src/plugins/intel_npu/tests/functional/behavior/work_with_devices.hpp b/src/plugins/intel_npu/tests/functional/behavior/work_with_devices.hpp
index 0518449ba6d..16fab28439c 100644
--- a/src/plugins/intel_npu/tests/functional/behavior/work_with_devices.hpp
+++ b/src/plugins/intel_npu/tests/functional/behavior/work_with_devices.hpp
@@ -125,7 +125,7 @@ TEST_P(TestCompileModelWithoutDeviceNPU, NoThrowIfNoDeviceAndButPlatformPassed)
}
const std::map<std::string_view, std::array<std::string_view, 2>> wrongDevice = {
- // {orig, {wrong for MLIR}}
+ // {orig, {wrong for PLUGIN}}
{"VPU3720", {"VPU0000"}},
};
@@ -140,7 +140,7 @@ std::string getWrongDevice(const std::string_view platform, const CompilerType&)
}
const std::map<std::string_view, std::array<std::string_view, 2>> validDevice = {
- // {orig, {valid for MLIR}}
+ // {orig, {valid for PLUGIN}}
{"VPU3720", {"VPU3720"}}};
std::string getValidDevice(const std::string_view platform, const CompilerType&) {
@@ -155,22 +155,22 @@ std::string getValidDevice(const std::string_view platform, const CompilerType&)
TEST_P(TestCompileModelWithoutDeviceNPU, CheckDeviceInBlob) {
SKIP_IF_CURRENT_TEST_IS_DISABLED() {
// Compile model to target plugins, wrong platform specified -> expect an exception
- auto netConfigurationMLIR_wrong = configuration;
- netConfigurationMLIR_wrong[ov::intel_npu::platform.name()] =
- getWrongDevice(PlatformEnvironment::PLATFORM, CompilerType::MLIR);
- netConfigurationMLIR_wrong[ov::intel_npu::compiler_type.name()] = "MLIR";
+ auto netConfigurationPLUGIN_wrong = configuration;
+ netConfigurationPLUGIN_wrong[ov::intel_npu::platform.name()] =
+ getWrongDevice(PlatformEnvironment::PLATFORM, CompilerType::PLUGIN);
+ netConfigurationPLUGIN_wrong[ov::intel_npu::compiler_type.name()] = "PLUGIN";
const auto& ov_model1 = buildSingleLayerSoftMaxNetwork();
EXPECT_ANY_THROW(auto compiled_model =
- core->compile_model(ov_model1, target_device, netConfigurationMLIR_wrong));
+ core->compile_model(ov_model1, target_device, netConfigurationPLUGIN_wrong));
// Compile model to target plugins, valid platform specified -> expect no exception
- auto netConfigurationMLIR_valid = configuration;
- netConfigurationMLIR_valid[ov::intel_npu::platform.name()] =
- getValidDevice(PlatformEnvironment::PLATFORM, CompilerType::MLIR);
- netConfigurationMLIR_valid[ov::intel_npu::compiler_type.name()] = "MLIR";
+ auto netConfigurationPLUGIN_valid = configuration;
+ netConfigurationPLUGIN_valid[ov::intel_npu::platform.name()] =
+ getValidDevice(PlatformEnvironment::PLATFORM, CompilerType::PLUGIN);
+ netConfigurationPLUGIN_valid[ov::intel_npu::compiler_type.name()] = "PLUGIN";
const auto& ov_model2 = buildSingleLayerSoftMaxNetwork();
EXPECT_NO_THROW(auto compiled_model =
- core->compile_model(ov_model2, target_device, netConfigurationMLIR_valid));
+ core->compile_model(ov_model2, target_device, netConfigurationPLUGIN_valid));
}
}