Skip to content

Commit c8df30f

Browse files
[NPU] Add PLUGIN compiler type
Signed-off-by: Stefania Hergane <[email protected]>
1 parent 80e587b commit c8df30f

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

src/plugins/intel_npu/src/al/include/intel_npu/config/options.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,9 @@ struct COMPILER_TYPE final : OptionBase<COMPILER_TYPE, ov::intel_npu::CompilerTy
845845
}
846846

847847
static ov::intel_npu::CompilerType parse(std::string_view val) {
848-
if (val == "MLIR") {
848+
if (val == "PLUGIN") {
849+
return ov::intel_npu::CompilerType::PLUGIN;
850+
} else if (val == "MLIR") {
849851
return ov::intel_npu::CompilerType::MLIR;
850852
} else if (val == "DRIVER") {
851853
return ov::intel_npu::CompilerType::DRIVER;
@@ -856,7 +858,9 @@ struct COMPILER_TYPE final : OptionBase<COMPILER_TYPE, ov::intel_npu::CompilerTy
856858

857859
static std::string toString(const ov::intel_npu::CompilerType& val) {
858860
std::stringstream strStream;
859-
if (val == ov::intel_npu::CompilerType::MLIR) {
861+
if (val == ov::intel_npu::CompilerType::PLUGIN) {
862+
strStream << "PLUGIN";
863+
} else if (val == ov::intel_npu::CompilerType::MLIR) {
860864
strStream << "MLIR";
861865
} else if (val == ov::intel_npu::CompilerType::DRIVER) {
862866
strStream << "DRIVER";

src/plugins/intel_npu/src/al/include/intel_npu/npu_private_properties.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ inline std::ostream& operator<<(std::ostream& out, const ColorFormat& fmt) {
8585

8686
/**
8787
* @brief [Only for NPU Plugin]
88-
* Type: string, default is MLIR.
88+
* Type: string, default is MLIR / PLUGIN.
8989
* Type of NPU compiler to be used for compilation of a network
9090
* @note Configuration API v 2.0
9191
*/
92-
enum class CompilerType { MLIR, DRIVER };
92+
enum class CompilerType { PLUGIN, MLIR, DRIVER };
9393

9494
/**
9595
* @brief Prints a string representation of ov::intel_npu::CompilerType to a stream
@@ -100,6 +100,9 @@ enum class CompilerType { MLIR, DRIVER };
100100
*/
101101
inline std::ostream& operator<<(std::ostream& out, const CompilerType& fmt) {
102102
switch (fmt) {
103+
case CompilerType::PLUGIN: {
104+
out << "PLUGIN";
105+
} break;
103106
case CompilerType::MLIR: {
104107
out << "MLIR";
105108
} break;

src/plugins/intel_npu/src/backend/src/zero_pipeline.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ std::vector<ov::ProfilingInfo> Pipeline::get_profiling_info() const {
261261
return _npu_profiling->getNpuInferStatistics();
262262
}
263263
/// PROFILING_TYPE = MODEL or undefined = fallback to model profiling
264-
if (_config.get<COMPILER_TYPE>() == ov::intel_npu::CompilerType::MLIR) {
264+
if (_config.get<COMPILER_TYPE>() == ov::intel_npu::CompilerType::MLIR ||
265+
_config.get<COMPILER_TYPE>() == ov::intel_npu::CompilerType::PLUGIN) {
265266
// For plugin compiler retreive raw profiling data from backend and delegate
266267
// processing to the compiler
267268
_logger.debug("InferRequest::get_profiling_info complete with compiler->process_profiling_output().");

src/plugins/intel_npu/src/compiler_adapter/include/compiler_adapter_factory.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ class CompilerAdapterFactory final {
1717
std::unique_ptr<ICompilerAdapter> getCompiler(const ov::SoPtr<IEngineBackend>& engineBackend,
1818
const ov::intel_npu::CompilerType type) const {
1919
switch (type) {
20-
case ov::intel_npu::CompilerType::MLIR: {
20+
case ov::intel_npu::CompilerType::MLIR:
21+
case ov::intel_npu::CompilerType::PLUGIN: {
2122
if (engineBackend == nullptr || engineBackend->getName() != "LEVEL0") {
2223
return std::make_unique<PluginCompilerAdapter>(nullptr);
2324
}

src/plugins/intel_npu/src/compiler_adapter/src/plugin_compiler_adapter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ PluginCompilerAdapter::PluginCompilerAdapter(const std::shared_ptr<ZeroInitStruc
7070
_logger("PluginCompilerAdapter", Logger::global().level()) {
7171
_logger.debug("initialize PluginCompilerAdapter start");
7272

73-
_logger.info("MLIR compiler will be used.");
73+
_logger.info("PLUGIN (MLIR) compiler will be used.");
7474
std::string baseName = "npu_mlir_compiler";
7575
auto libPath = ov::util::make_plugin_library_name(ov::util::get_ov_lib_path(), baseName + OV_BUILD_POSTFIX);
7676
_compiler = load_compiler(libPath);

src/plugins/intel_npu/src/plugin/src/plugin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,8 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<
577577
const auto set_cache_dir = localConfig.get<CACHE_DIR>();
578578
if (!set_cache_dir.empty()) {
579579
const auto compilerType = localConfig.get<COMPILER_TYPE>();
580-
if (compilerType == ov::intel_npu::CompilerType::MLIR) {
581-
OPENVINO_THROW("Option 'CACHE_DIR' is not supported with MLIR compiler type");
580+
if (compilerType == ov::intel_npu::CompilerType::MLIR || compilerType == ov::intel_npu::CompilerType::PLUGIN) {
581+
OPENVINO_THROW("Option 'CACHE_DIR' is not supported with PLUGIN (MLIR) compiler type");
582582
}
583583
}
584584

0 commit comments

Comments
 (0)