Skip to content

Commit c585da2

Browse files
committed
changes default layout logic depending on model type to affect broader models scope
1 parent b6bb1cc commit c585da2

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/plugins/intel_cpu/src/nodes/eltwise.cpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -2574,14 +2574,6 @@ void Eltwise::initSupportedPrimitiveDescriptors() {
25742574
return;
25752575
}
25762576
#endif
2577-
// To make attention_mask process align with SDPA layout
2578-
if (getAlgorithm() == Algorithm::EltwiseClamp) {
2579-
auto parentNode = getParentEdgeAt(0)->getParent();
2580-
if (Config::ModelType::LLM == context->getConfig().modelType && "Ceiling" == parentNode->getTypeStr() &&
2581-
Algorithm::MathCeiling == parentNode->getAlgorithm()) {
2582-
isChannelsFirstApplicable = false;
2583-
}
2584-
}
25852577

25862578
#if defined(OV_CPU_WITH_SHL)
25872579
eltwiseAttrs = {algorithm, alpha, beta, gamma};
@@ -2599,11 +2591,19 @@ void Eltwise::initSupportedPrimitiveDescriptors() {
25992591
return;
26002592
#endif
26012593

2602-
if (isChannelsFirstApplicable)
2603-
supportedPrimitiveDescriptors.emplace_back(initDesc(ChannelsFirst));
2604-
if (isBlockedApplicable)
2605-
supportedPrimitiveDescriptors.emplace_back(initDesc(Blocked));
2606-
supportedPrimitiveDescriptors.emplace_back(initDesc(Planar));
2594+
if (context->getConfig().modelType == Config::ModelType::CNN) {
2595+
if (isChannelsFirstApplicable)
2596+
supportedPrimitiveDescriptors.emplace_back(initDesc(ChannelsFirst));
2597+
if (isBlockedApplicable)
2598+
supportedPrimitiveDescriptors.emplace_back(initDesc(Blocked));
2599+
supportedPrimitiveDescriptors.emplace_back(initDesc(Planar));
2600+
} else {
2601+
supportedPrimitiveDescriptors.emplace_back(initDesc(Planar));
2602+
if (isChannelsFirstApplicable)
2603+
supportedPrimitiveDescriptors.emplace_back(initDesc(ChannelsFirst));
2604+
if (isBlockedApplicable)
2605+
supportedPrimitiveDescriptors.emplace_back(initDesc(Blocked));
2606+
}
26072607
}
26082608

26092609
void Eltwise::createPrimitive() {

0 commit comments

Comments
 (0)