Skip to content

Commit 06b154a

Browse files
committed
FuseMOEExperts. Check if all inputs of postponed_constant are constants
1 parent f9a7055 commit 06b154a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/common/transformations/src/transformations/common_optimizations/fuse_moe_experts.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,14 @@ ov::pass::FuseMOEExperts::FuseMOEExperts() : MultiMatcher("FuseMOEExperts") {
396396
}
397397

398398
auto fused = std::make_shared<ov::op::v0::Concat>(inputs, 0);
399-
fused->get_rt_info()["postponed_constant"] = true;
399+
if (std::all_of(inputs.begin(), inputs.end(), [](const Output<Node>& input) {
400+
return ov::as_type_ptr<ov::op::v0::Constant>(input.get_node_shared_ptr()) != nullptr;
401+
})) {
402+
// postponed_constant attribute is needed to perform constant folding on serialization step
403+
fused->get_rt_info()["postponed_constant"] = true;
404+
// disable constant folding here to postpone it to serialization step
405+
ov::pass::disable_constant_folding(fused);
406+
}
400407
if (needs_decompress) {
401408
auto convert = std::make_shared<ov::op::v0::Convert>(fused, target_type);
402409
ov::mark_as_decompression(convert);

0 commit comments

Comments
 (0)