OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[NPU] Fix turbo for specific driver version (#32602)
Bogdan Pereanua9431fb8aeda
diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cppindex 4fba7d414da..cd459b604f3 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cpp@@ -97,7 +97,8 @@ std::shared_ptr<IGraph> DriverCompilerAdapter::compile(const std::shared_ptr<con_logger.debug("build flags");buildFlags += irSerializer.serializeIOInfo(model, useIndices);buildFlags += " ";- buildFlags += irSerializer.serializeConfig(config, compilerVersion, is_option_supported("NPU_TURBO"));+ buildFlags +=+ irSerializer.serializeConfig(config, compilerVersion, _zeGraphExt->isTurboOptionSupported(compilerVersion));_logger.debug("compileIR Build flags : %s", buildFlags.c_str());diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/ir_serializer.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/ir_serializer.cppindex 0d9866cc969..723c27bc1cf 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/ir_serializer.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/ir_serializer.cpp@@ -461,14 +461,7 @@ std::string IRSerializer::serializeConfig(const Config& config,// and make use of it too If we have turbo in the config string, we check if compiler supports it. If it doesn't// support it, we remove itif (std::regex_search(content, std::regex("NPU_TURBO"))) {- bool is_supported = false;- try {- is_supported = turboSupported;- } catch (...) {- // mute it, not critical- is_supported = false;- }- if (!is_supported) {+ if (!turboSupported) {std::ostringstream turbostr;turbostr << ov::intel_npu::turbo.name() << KEY_VALUE_SEPARATOR << VALUE_DELIMITER << "\\S+"<< VALUE_DELIMITER;diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cppindex b7ec5af25f2..a37ebff363b 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cpp@@ -578,17 +578,25 @@ bool ZeGraphExtWrappers::isOptionSupported(std::string optname) const {}bool ZeGraphExtWrappers::isTurboOptionSupported(const ze_graph_compiler_version_info_t& compilerVersion) const {+ auto checkCompilerVersion = [](const ze_graph_compiler_version_info_t& compilerVersion) {+ if ((compilerVersion.major < 7) || (compilerVersion.major == 7 && compilerVersion.minor < 21)) {+ return false;+ }++ return true;+ };++ if (_graphExtVersion < ZE_MAKE_VERSION(1, 11)) {+ return checkCompilerVersion(compilerVersion);+ }+#ifdef _WIN32// Driver shall return NO_THROW_ON_UNSUPPORTED_FEATURE as supported to go further hereif (_zeroInitStruct->getGraphDdiTable().pfnCompilerIsOptionSupported(_zeroInitStruct->getDevice(),ZE_NPU_DRIVER_OPTIONS,"NO_THROW_ON_UNSUPPORTED_FEATURE",nullptr) != ZE_RESULT_SUCCESS) {- if ((compilerVersion.major < 7) || (compilerVersion.major == 7 && compilerVersion.minor < 21)) {- return false;- }-- return true;+ return checkCompilerVersion(compilerVersion);}#endifdiff --git a/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hpp b/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hppindex 16103292e1f..0c133c32f41 100644--- a/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hpp+++ b/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hpp@@ -425,4 +425,18 @@ TEST_P(ZeroGraphTest, SetAlignedBlob) {::operator delete(blob, std::align_val_t(::utils::STANDARD_PAGE_SIZE));}+#ifdef _WIN32+TEST_P(ZeroGraphTest, CheckNoThrowOnUnsupportedFeature) {+ if (zeroInitStruct->getGraphDdiTable().version() >= ZE_MAKE_VERSION(1, 11)) {+ // Driver shall return NO_THROW_ON_UNSUPPORTED_FEATURE as supported to go further here+ if (zeroInitStruct->getGraphDdiTable().pfnCompilerIsOptionSupported(zeroInitStruct->getDevice(),+ ZE_NPU_DRIVER_OPTIONS,+ "NO_THROW_ON_UNSUPPORTED_FEATURE",+ nullptr) != ZE_RESULT_SUCCESS) {+ ADD_FAILURE() << "NO_THROW_ON_UNSUPPORTED_FEATURE shall be supported.";+ }+ }+}+#endif+} // namespace ov::test::behavior