Skip to content

Commit

Permalink
changes default layout logic depending on model type to affect broade…
Browse files Browse the repository at this point in the history
…r models scope
  • Loading branch information
liubo-intel committed Sep 27, 2024
1 parent add5fec commit 9709fdc
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/plugins/intel_cpu/src/nodes/eltwise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2574,14 +2574,6 @@ void Eltwise::initSupportedPrimitiveDescriptors() {
return;
}
#endif
// To make attention_mask process align with SDPA layout
if (getAlgorithm() == Algorithm::EltwiseClamp) {
auto parentNode = getParentEdgeAt(0)->getParent();
if (Config::ModelType::LLM == context->getConfig().modelType && "Ceiling" == parentNode->getTypeStr() &&
Algorithm::MathCeiling == parentNode->getAlgorithm()) {
isChannelsFirstApplicable = false;
}
}

#if defined(OV_CPU_WITH_SHL)
eltwiseAttrs = {algorithm, alpha, beta, gamma};
Expand All @@ -2599,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 9709fdc

Please sign in to comment.