Skip to content

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

[CPU] change Eltwise layout selection logic for x86 non-CNN ModelType (#26419)

Bo Liuce1bcd2a765f
diff --git a/src/plugins/intel_cpu/src/nodes/eltwise.cpp b/src/plugins/intel_cpu/src/nodes/eltwise.cpp
index 1a898655769..f2f6ce503bd 100644
--- a/src/plugins/intel_cpu/src/nodes/eltwise.cpp
+++ b/src/plugins/intel_cpu/src/nodes/eltwise.cpp
@@ -2591,11 +2591,19 @@ void Eltwise::initSupportedPrimitiveDescriptors() {
return;
#endif
- if (isChannelsFirstApplicable)
- supportedPrimitiveDescriptors.emplace_back(initDesc(ChannelsFirst));
- if (isBlockedApplicable)
- supportedPrimitiveDescriptors.emplace_back(initDesc(Blocked));
- supportedPrimitiveDescriptors.emplace_back(initDesc(Planar));
+ if (context->getConfig().modelType == Config::ModelType::CNN) {
+ if (isChannelsFirstApplicable)
+ supportedPrimitiveDescriptors.emplace_back(initDesc(ChannelsFirst));
+ if (isBlockedApplicable)
+ supportedPrimitiveDescriptors.emplace_back(initDesc(Blocked));
+ supportedPrimitiveDescriptors.emplace_back(initDesc(Planar));
+ } else {
+ supportedPrimitiveDescriptors.emplace_back(initDesc(Planar));
+ if (isChannelsFirstApplicable)
+ supportedPrimitiveDescriptors.emplace_back(initDesc(ChannelsFirst));
+ if (isBlockedApplicable)
+ supportedPrimitiveDescriptors.emplace_back(initDesc(Blocked));
+ }
}
void Eltwise::createPrimitive() {