Skip to content

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

[ BUG FIX ] Fix performance regression caused by incorrect ModelType detection (#33671)

Sun Xiaoxia65b74941de22
diff --git a/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp b/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp
index 68084ff3863..f5d95c25e3d 100644
--- a/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp
+++ b/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp
@@ -609,7 +609,7 @@ int get_model_prefer_threads(const int num_streams,
const std::shared_ptr<ov::Model>& model,
Config& config) {
bool int8_intensive = ov::op::util::has_op_with_type<ov::op::v0::FakeQuantize>(model);
- bool is_LLM = config.modelType == Config::ModelType::LLM;
+ bool is_LLM = config.modelType != Config::ModelType::CNN;
auto default_prefer_threads_latency = [&]() {
const int int8_threshold = 4; // ~relative efficiency of the VNNI-intensive code for Big vs Little cores;
diff --git a/src/plugins/intel_cpu/src/plugin.cpp b/src/plugins/intel_cpu/src/plugin.cpp
index 01a8af5d41f..8d8df9c1f0e 100644
--- a/src/plugins/intel_cpu/src/plugin.cpp
+++ b/src/plugins/intel_cpu/src/plugin.cpp
@@ -312,8 +312,13 @@ void Plugin::calculate_streams(Config& conf, const std::shared_ptr<ov::Model>& m
}
static Config::ModelType getModelType(const std::shared_ptr<const Model>& model) {
- if (op::util::has_op_with_type<op::v13::ScaledDotProductAttention>(model) ||
- op::util::has_op_with_type<ov::op::PagedAttentionExtension>(model)) {
+ if (op::util::has_op_with_type<op::v13::ScaledDotProductAttention>(model)) {
+ if (!model->get_variables().empty()) {
+ return Config::ModelType::LLM;
+ }
+ return Config::ModelType::Unknown;
+ }
+ if (op::util::has_op_with_type<ov::op::PagedAttentionExtension>(model)) {
return Config::ModelType::LLM;
}
if (op::util::has_op_with_type<op::v1::Convolution>(model) ||