From 0d9ecb1b3ac88f1e4920bdf06f843570a16d8c41 Mon Sep 17 00:00:00 2001 From: Xin Wang Date: Tue, 9 Jul 2024 14:08:29 +0800 Subject: [PATCH] Skip new params for old driver compiler --- .../compiler/src/zero_compiler_in_driver.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/plugins/intel_npu/src/compiler/src/zero_compiler_in_driver.cpp b/src/plugins/intel_npu/src/compiler/src/zero_compiler_in_driver.cpp index b5ce38fe0a4f80..17fc8251e5147e 100644 --- a/src/plugins/intel_npu/src/compiler/src/zero_compiler_in_driver.cpp +++ b/src/plugins/intel_npu/src/compiler/src/zero_compiler_in_driver.cpp @@ -377,6 +377,25 @@ std::string LevelZeroCompilerInDriver::serializeConfig( ze_graph_compiler_version_info_t& compilerVersion) const { std::string content = config.toString(); + // Remove optimization_level and perf_hint_override for old driver which not support them + if ((compilerVersion.major < 5) || (compilerVersion.major == 5 && compilerVersion.minor < 7)) { + std::ostringstream optLevelStr; + optLevelStr << "optimization-level" << KEY_VALUE_SEPARATOR << "\\d+"; + std::ostringstream perfHintStr; + perfHintStr << "performance-hint-override" << KEY_VALUE_SEPARATOR << "\\S+"; + _logger.warning( + "optimization-level property is not suppored by this compiler version. Removing from parameters"); + content = std::regex_replace(content, std::regex(optLevelStr.str()), ""); + _logger.warning("performance-hint-override property is not suppored by this compiler version. Removing " + "from parameters"); + content = std::regex_replace(content, std::regex(perfHintStr.str()), ""); + + std::ostringstream compilationParamsStr; + compilationParamsStr << ov::intel_npu::compilation_mode_params.name() << KEY_VALUE_SEPARATOR << ""; + _logger.warning("Clear empty NPU_COMPILATION_MODE_PARAMS. Removing from parameters"); + content = std::regex_replace(content, std::regex(compilationParamsStr.str()), ""); + } + // As a consequence of complying to the conventions established in the 2.0 OV API, the set of values corresponding // to the "model priority" key has been modified // cpu_pinning property is not supported in compilers < v5.2 - need to remove it