Skip to content

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

[NPU] Fix Turbo option (#31862)

Bogdan Pereanu9c3c20810540
diff --git a/src/plugins/intel_npu/src/compiler_adapter/include/ze_graph_ext_wrappers.hpp b/src/plugins/intel_npu/src/compiler_adapter/include/ze_graph_ext_wrappers.hpp
index cf52f367bb7..c7657e0213d 100644
--- a/src/plugins/intel_npu/src/compiler_adapter/include/ze_graph_ext_wrappers.hpp
+++ b/src/plugins/intel_npu/src/compiler_adapter/include/ze_graph_ext_wrappers.hpp
@@ -52,6 +52,7 @@ public:
std::string getCompilerSupportedOptions() const;
bool isOptionSupported(std::string optname) const;
+ bool isTurboOptionSupported(const ze_graph_compiler_version_info_t& compilerVersion) const;
void getGraphBinary(const GraphDescriptor& graphDescriptor,
std::vector<uint8_t>& blob,
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.cpp
index 204a413097b..808c6bd1fcb 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
@@ -688,13 +688,8 @@ std::string DriverCompilerAdapter::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 it
if (std::regex_search(content, std::regex("NPU_TURBO"))) {
- bool is_supported = false;
- try {
- is_supported = is_option_supported("NPU_TURBO");
- } catch (...) {
- // mute it, not critical
- is_supported = false;
- }
+ bool is_supported = _zeGraphExt->isTurboOptionSupported(compilerVersion);
+
if (!is_supported) {
std::ostringstream turbostr;
turbostr << ov::intel_npu::turbo.name() << KEY_VALUE_SEPARATOR << VALUE_DELIMITER << "\\S+"
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.cpp
index 7760ea45307..f9607256fb4 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
@@ -638,4 +638,30 @@ bool ZeGraphExtWrappers::isOptionSupported(std::string optname) const {
return false;
}
+bool ZeGraphExtWrappers::isTurboOptionSupported(const ze_graph_compiler_version_info_t& compilerVersion) const {
+#ifdef _WIN32
+ // 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) {
+ if ((compilerVersion.major < 7) || (compilerVersion.major == 7 && compilerVersion.minor < 21)) {
+ return false;
+ }
+
+ return true;
+ }
+#endif
+
+ bool is_supported = false;
+ try {
+ is_supported = isOptionSupported("NPU_TURBO");
+ } catch (...) {
+ // mute it, not critical
+ is_supported = false;
+ }
+
+ return is_supported;
+}
+
} // namespace intel_npu