Skip to content

Commit

Permalink
[CPU] change Eltwise layout selection logic for x86 non-CNN ModelType (
Browse files Browse the repository at this point in the history
…openvinotoolkit#26419)

### Details:
- *change Eltwise layout selection logic for x86 non-CNN ModelType,
several llm models gain performance benefits from this change since
additional reorder operators have been avoided, e.g. phi3 and bloomz*
- *details can be found in the [ticket
discussion](https://jira.devtools.intel.com/browse/CVS-148780).)*


### Tickets:
 - *148780*
  • Loading branch information
liubo-intel authored Sep 27, 2024
1 parent f6fa29b commit ce1bcd2
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/plugins/intel_cpu/src/nodes/eltwise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit ce1bcd2

Please sign in to comment.