Skip to content

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

Info -> warning: Override performance mode to THROUGHPUT for compilation (#34666)

Daria Mityagina4d11778288f2
diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cpp
index c603ee8d2e4..e4beaaf25f9 100644
--- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp
+++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp
@@ -626,17 +626,31 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<
// Determine which model to use
auto modelToCompile = successfullyDebatched ? batchedModel : model->clone();
- if (successfullyDebatched && localConfig.get<PERFORMANCE_HINT>() == ov::hint::PerformanceMode::LATENCY) {
- _logger.info("Override performance mode to THROUGHPUT for compilation");
+ const bool performanceHintSetByUser = localConfig.has(ov::hint::performance_mode.name());
+ const bool shouldForceThroughput = successfullyDebatched && !performanceHintSetByUser;
+ const bool shouldWarnAboutLatency = successfullyDebatched && performanceHintSetByUser &&
+ localConfig.get<PERFORMANCE_HINT>() == ov::hint::PerformanceMode::LATENCY;
+
+ if (shouldWarnAboutLatency) {
+ _logger.warning("PERFORMANCE_HINT is explicitly set to LATENCY mode, but batch dimension (N) is "
+ "detected in the model. The NPU Plugin will reshape the model to batch size 1 and "
+ "process each batch slice separately.");
+ _logger.warning("For optimal performance with batched models, THROUGHPUT mode is highly recommended, "
+ "as LATENCY mode prevents parallel batch processing.");
+ _logger.warning("If batch detection appears incorrect, verify that the input and output layouts are "
+ "configured properly.");
+ }
+
+ if (shouldForceThroughput) {
+ _logger.info("Setting performance mode to THROUGHPUT for batched model compilation.");
auto modifiedConfig = localConfig; // Copy only when needed
std::stringstream strStream;
strStream << ov::hint::PerformanceMode::THROUGHPUT;
modifiedConfig.update({{ov::hint::performance_mode.name(), strStream.str()}});
-
graph = compileWithConfig(std::move(modelToCompile), modifiedConfig);
} else {
- graph = compileWithConfig(std::move(modelToCompile), localConfig); // No copy
+ graph = compileWithConfig(std::move(modelToCompile), localConfig);
}
} catch (const std::exception& ex) {
OPENVINO_THROW(ex.what());
diff --git a/src/plugins/intel_npu/src/plugin/src/transformations.cpp b/src/plugins/intel_npu/src/plugin/src/transformations.cpp
index f776f25af67..ce3ff26717b 100644
--- a/src/plugins/intel_npu/src/plugin/src/transformations.cpp
+++ b/src/plugins/intel_npu/src/plugin/src/transformations.cpp
@@ -243,6 +243,7 @@ std::tuple<std::shared_ptr<ov::Model>, bool> handlePluginBatching(
if (batchModeIsAvailable) {
// If we have successfully debatched the model on the PLUGIN side, we should
// avoid repeating the same in the compiler by resetting the batch mode
+ logger.info("The model was reshaped to batch size 1 on the plugin side.");
updateBatchMode(ov::intel_npu::BatchMode::COMPILER);
}
} catch (const std::exception& ex) {