Skip to content

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

[Snippets] Implemented TokenizeGatedMLPSnippets pass (#30882)

Alexandra Sidorova2c94b8c5616b
diff --git a/src/common/snippets/include/snippets/pass/gated_mlp_tokenization.hpp b/src/common/snippets/include/snippets/pass/gated_mlp_tokenization.hpp
new file mode 100644
index 00000000000..a27eae4630a
--- /dev/null
+++ b/src/common/snippets/include/snippets/pass/gated_mlp_tokenization.hpp
@@ -0,0 +1,37 @@
+// Copyright (C) 2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include "openvino/pass/matcher_pass.hpp"
+#include "snippets/pass/tokenization.hpp"
+
+namespace ov {
+namespace snippets {
+namespace pass {
+
+/**
+ * @interface TokenizeGatedMLPSnippets
+ * @brief The pass tokenizes Gated MLP pattern into Subgraph
+ * Pattern:
+ * Input
+ * / \
+ * FullyConnected FullyConnected
+ * | |
+ * Activation /
+ * \ /
+ * Multiply
+ * |
+ * FullyConnected
+ * @ingroup snippets
+ */
+class TokenizeGatedMLPSnippets: public ov::pass::MatcherPass {
+public:
+ OPENVINO_MATCHER_PASS_RTTI("snippets::pass::TokenizeGatedMLPSnippets");
+ TokenizeGatedMLPSnippets(const SnippetsTokenization::Config& config);
+};
+
+} // namespace pass
+} // namespace snippets
+} // namespace ov
diff --git a/src/common/snippets/src/pass/gated_mlp_tokenization.cpp b/src/common/snippets/src/pass/gated_mlp_tokenization.cpp
new file mode 100644
index 00000000000..98b819b67c6
--- /dev/null
+++ b/src/common/snippets/src/pass/gated_mlp_tokenization.cpp
@@ -0,0 +1,111 @@
+// Copyright (C) 2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "snippets/pass/gated_mlp_tokenization.hpp"
+
+#include "snippets/itt.hpp"
+#include "snippets/op/brgemm.hpp"
+#include "snippets/op/subgraph.hpp"
+#include "snippets/pass/collapse_subgraph.hpp"
+#include "snippets/utils/utils.hpp"
+#include "snippets/utils/tokenization_utils.hpp"
+
+#include "openvino/core/rt_info.hpp"
+#include "openvino/core/validation_util.hpp"
+#include "openvino/pass/pattern/op/or.hpp"
+#include "openvino/pass/pattern/op/wrap_type.hpp"
+#include "transformations/utils/utils.hpp"
+
+namespace ov {
+namespace snippets {
+namespace pass {
+
+using namespace ov::pass::pattern;
+
+namespace {
+ov::pass::pattern::op::Predicate act_predicate() {
+ return ov::pass::pattern::op::Predicate(
+ [](const Output<Node>& output) -> bool {
+ return consumers_count(1)(output) && ov::snippets::pass::TokenizeSnippets::AppropriateForSubgraph(output.get_node_shared_ptr());
+ },
+ "act_predicate");
+}
+
+ov::pass::pattern::op::Predicate scalar_predicate() {
+ return ov::pass::pattern::op::Predicate(
+ [](const Output<Node>& output) -> bool {
+ return ov::snippets::utils::is_scalar_constant(output.get_node_shared_ptr());
+ },
+ "scalar_predicate");
+}
+
+ov::pass::pattern::op::Predicate fc_predicate(bool is_down) {
+ return ov::pass::pattern::op::Predicate(
+ [=](const Output<Node>& output) -> bool {
+ const auto node = output.get_node_shared_ptr();
+ return ov::is_type<ov::op::v0::MatMul>(node) && ((!is_down && consumers_count(1)(output)) || is_down) &&
+ (op::Brgemm::get_output_type(node->get_input_element_type(0), node->get_input_element_type(1)) != element::dynamic);
+ },
+ "fc_predicate");
+}
+
+} // namespace
+
+TokenizeGatedMLPSnippets::TokenizeGatedMLPSnippets(const SnippetsTokenization::Config& config) {
+ MATCHER_SCOPE(TokenizeGatedMLPSnippets);
+
+ auto make_weights = [](){
+ // TODO: Add decompressed weights
+ return wrap_type<ov::op::v0::Constant>();
+ };
+
+ auto m_input = any_input(ov::pass::pattern::has_static_rank());
+ auto m_fc_gate = wrap_type<ov::opset1::MatMul>({m_input, make_weights()}, fc_predicate(false));
+ auto m_fc_up = wrap_type<ov::opset1::MatMul>({m_input, make_weights()}, fc_predicate(false));
+
+ auto m_act_unary = wrap_type<ov::op::util::UnaryElementwiseArithmetic, ov::op::v0::HardSigmoid>({m_fc_gate}, act_predicate());
+ auto m_act_binary_scalar = wrap_type<ov::op::v0::Constant>(scalar_predicate());
+ auto m_act_binary =
+ wrap_type<ov::op::util::BinaryElementwiseArithmetic, ov::op::v4::Swish, ov::op::v0::PRelu>({m_fc_gate, m_act_binary_scalar}, act_predicate());
+ auto m_act = std::make_shared<ov::pass::pattern::op::Or>(ov::OutputVector{m_act_unary, m_act_binary});
+
+ auto m_mul = wrap_type<ov::opset1::Multiply>({m_act, m_fc_up}, consumers_count(1));
+ auto m_fc_down = wrap_type<ov::opset1::MatMul>({m_mul, make_weights()}, fc_predicate(true));
+
+ register_matcher(std::make_shared<ov::pass::pattern::Matcher>(m_fc_down, matcher_name),
+ [OV_CAPTURE_CPY_AND_THIS](ov::pass::pattern::Matcher &m) {
+ OV_ITT_SCOPED_TASK(ov::pass::itt::domains::SnippetsTransform, "Snippets::op::TokenizeGatedMLPSnippets")
+ auto& pattern_map = m.get_pattern_value_map();
+
+ const auto fc_gate = pattern_map.at(m_fc_gate).get_node_shared_ptr();
+ const auto fc_up = pattern_map.at(m_fc_up).get_node_shared_ptr();
+ const auto act = pattern_map.at(m_act).get_node_shared_ptr();
+ const auto mul = pattern_map.at(m_mul).get_node_shared_ptr();
+ const auto fc_down = pattern_map.at(m_fc_down).get_node_shared_ptr();
+
+ if (transformation_callback(fc_gate) || transformation_callback(fc_up) || transformation_callback(fc_down)) {
+ return false;
+ }
+
+ static const auto body_params_count = 5; // 2xinput + 3x fc
+ static const auto body_result_count = 1; // one output
+ static const auto reg_group_count = 5; // upper-bound of possible buffer count
+
+ // TODO [75567]: move this plugin-specific constraint to the plugin callback
+ if (body_params_count + body_result_count + reg_group_count > config.get_data_ptr_gpr_count()) {
+ return false;
+ }
+
+ const auto ordered_ops = ov::NodeVector{fc_gate, fc_up, act, mul, fc_down};
+ const auto subgraph = ov::snippets::utils::tokenize_ordered_nodes(ordered_ops);
+
+ // mark the Subgraph as Completed to not allow Snippets to include any nodes into this Subgraph in common Tokenization
+ SetSnippetsSubgraphType(subgraph, SnippetsSubgraphType::Completed);
+ return true;
+ });
+}
+
+} // namespace pass
+} // namespace snippets
+} // namespace ov
diff --git a/src/common/snippets/src/pass/tokenization.cpp b/src/common/snippets/src/pass/tokenization.cpp
index 7a19dc610df..d3412ae9082 100644
--- a/src/common/snippets/src/pass/tokenization.cpp
+++ b/src/common/snippets/src/pass/tokenization.cpp
@@ -11,6 +11,7 @@
#include "snippets/pass/common_optimizations.hpp"
#include "snippets/pass/extract_reshapes_from_mha.hpp"
#include "snippets/pass/fc_tokenization.hpp"
+#include "snippets/pass/gated_mlp_tokenization.hpp"
#include "snippets/pass/gn_tokenization.hpp"
#include "snippets/pass/mha_tokenization.hpp"
#include "snippets/pass/mlp_seq_tokenization.hpp"
@@ -87,6 +88,7 @@ bool SnippetsTokenization::run_on_model(const std::shared_ptr<ov::Model>& m) {
// 1. They have higher priority than other tokenization passes
// 2. They change the nodes after the matched root node
manager.register_pass<TokenizeMHASnippets>(m_config);
+ manager.register_pass<TokenizeGatedMLPSnippets>(m_config);
manager.register_pass<TokenizeMLPSeqSnippets>(m_config);
auto tokenization_passes = manager.register_pass<ov::pass::GraphRewrite>();
diff --git a/src/common/snippets/tests/include/pass/gated_mlp_tokenization.hpp b/src/common/snippets/tests/include/pass/gated_mlp_tokenization.hpp
new file mode 100644
index 00000000000..65acf41924b
--- /dev/null
+++ b/src/common/snippets/tests/include/pass/gated_mlp_tokenization.hpp
@@ -0,0 +1,26 @@
+// Copyright (C) 2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include <common_test_utils/ov_test_utils.hpp>
+
+#include "snippets/pass/tokenization.hpp"
+#include "utils.hpp"
+
+namespace ov {
+namespace test {
+namespace snippets {
+
+class TokenizeGatedMLPSnippetsTests : public TransformationTestsF {
+public:
+ virtual void run();
+
+protected:
+ ov::snippets::pass::SnippetsTokenization::Config config = get_default_tokenization_config();
+};
+
+} // namespace snippets
+} // namespace test
+} // namespace ov
diff --git a/src/common/snippets/tests/include/pass/mlp_tokenization.hpp b/src/common/snippets/tests/include/pass/mlp_seq_tokenization.hpp
similarity index 100%
rename from src/common/snippets/tests/include/pass/mlp_tokenization.hpp
rename to src/common/snippets/tests/include/pass/mlp_seq_tokenization.hpp
diff --git a/src/common/snippets/tests/src/pass/gated_mlp_tokenization.cpp b/src/common/snippets/tests/src/pass/gated_mlp_tokenization.cpp
new file mode 100644
index 00000000000..b8e643b9618
--- /dev/null
+++ b/src/common/snippets/tests/src/pass/gated_mlp_tokenization.cpp
@@ -0,0 +1,85 @@
+// Copyright (C) 2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include <gtest/gtest.h>
+
+#include "pass/gated_mlp_tokenization.hpp"
+
+#include "common_test_utils/common_utils.hpp"
+#include "common_test_utils/test_enums.hpp"
+#include "snippets/pass/common_optimizations.hpp"
+#include "snippets/pass/explicit_transpose_matmul_inputs.hpp"
+#include "snippets/pass/gated_mlp_tokenization.hpp"
+#include "snippets/pass/tokenization.hpp"
+#include "subgraph_gated_mlp.hpp"
+
+namespace ov {
+namespace test {
+namespace snippets {
+
+void TokenizeGatedMLPSnippetsTests::run() {
+ ASSERT_TRUE(model);
+ manager.register_pass<ov::snippets::pass::EnumerateNodes>();
+ manager.register_pass<ov::snippets::pass::TokenizeGatedMLPSnippets>(config);
+ manager.register_pass<ov::snippets::pass::CommonOptimizations>(config);
+ disable_rt_info_check();
+
+ // To avoid Transpose extraction from MatMuls
+ manager.get_pass_config()->set_callback<ov::snippets::pass::ExplicitTransposeMatMulInputs>(
+ [](const std::shared_ptr<const ov::Node>& n) {
+ return true;
+ });
+}
+
+using TokenizeGatedMLPSnippetsParam = std::tuple<
+ PartialShape,
+ std::vector<Shape>,
+ GatedMLPFunction::WeightFormat,
+ ov::test::utils::ActivationTypes
+>;
+class TokenizeGatedMLPSnippetsParamTests : public TokenizeGatedMLPSnippetsTests,
+ public testing::WithParamInterface<TokenizeGatedMLPSnippetsParam> {
+protected:
+ void SetUp() override {
+ TransformationTestsF::SetUp();
+ auto [inputShape, weightsShapes, weightFormat, ActType] = GetParam();
+
+ const auto& f = GatedMLPFunction({inputShape}, weightsShapes, weightFormat, ActType);
+ model = f.getOriginal();
+
+ // Currently we support only Constants on second inputs of MatMuls
+ // Weights decompression in not supported and not tokenized
+ if (weightFormat == GatedMLPFunction::WeightFormat::FP32) {
+ model_ref = f.getReference();
+ }
+ }
+};
+
+TEST_P(TokenizeGatedMLPSnippetsParamTests, GatedMLP) {
+ run();
+}
+
+static std::string getTestCaseName(const testing::TestParamInfo<TokenizeGatedMLPSnippetsParam>& info) {
+ auto [inputShape, weightsShapes, weightFormat, ActType] = info.param;
+ std::ostringstream result;
+ result << "InputShape=" << ov::test::utils::partialShape2str({inputShape}) << "_";
+ result << "weightsShapes=" << ov::test::utils::vec2str(weightsShapes) << "_";
+ result << "WeightFormat=" << weightFormat << "_";
+ result << "ActType=" << ActType;
+ return result.str();
+}
+
+INSTANTIATE_TEST_SUITE_P(
+ smoke_Snippets_GatedMLP,
+ TokenizeGatedMLPSnippetsParamTests,
+ testing::Combine(
+ testing::Values(PartialShape{-1, -1, 896}),
+ testing::Values(std::vector<Shape>{{4864, 896}, {4864, 896}, {896, 4864}}),
+ testing::Values(GatedMLPFunction::WeightFormat::FP32, GatedMLPFunction::WeightFormat::FP16),
+ testing::Values(utils::ActivationTypes::Swish, utils::ActivationTypes::Relu)),
+ getTestCaseName);
+
+} // namespace snippets
+} // namespace test
+} // namespace ov
diff --git a/src/common/snippets/tests/src/pass/mlp_tokenization.cpp b/src/common/snippets/tests/src/pass/mlp_seq_tokenization.cpp
similarity index 86%
rename from src/common/snippets/tests/src/pass/mlp_tokenization.cpp
rename to src/common/snippets/tests/src/pass/mlp_seq_tokenization.cpp
index 577914e2432..7ce78c2d314 100644
--- a/src/common/snippets/tests/src/pass/mlp_tokenization.cpp
+++ b/src/common/snippets/tests/src/pass/mlp_seq_tokenization.cpp
@@ -4,13 +4,14 @@
#include <gtest/gtest.h>
-#include <pass/mlp_tokenization.hpp>
+#include <pass/mlp_seq_tokenization.hpp>
#include <subgraph_mlp_seq.hpp>
#include "common_test_utils/common_utils.hpp"
#include "snippets/pass/common_optimizations.hpp"
#include "snippets/pass/mlp_seq_tokenization.hpp"
#include "snippets/pass/tokenization.hpp"
+
namespace ov {
namespace test {
namespace snippets {
@@ -22,8 +23,8 @@ void TokenizeMLPSeqSnippetsTests::run() {
manager.register_pass<ov::snippets::pass::CommonOptimizations>(config);
disable_rt_info_check();
}
-class TokenizeMLPSnippetsParamTests : public TokenizeMLPSeqSnippetsTests,
- public testing::WithParamInterface<std::tuple<std::vector<PartialShape>, ov::element::Type, int>> {
+class TokenizeMLPSeqSnippetsParamTests : public TokenizeMLPSeqSnippetsTests,
+ public testing::WithParamInterface<std::tuple<std::vector<PartialShape>, ov::element::Type, int>> {
protected:
void SetUp() override {
TransformationTestsF::SetUp();
@@ -41,7 +42,7 @@ protected:
}
};
-TEST_P(TokenizeMLPSnippetsParamTests, TypeRelaxed_2D) {
+TEST_P(TokenizeMLPSeqSnippetsParamTests, TypeRelaxed_2D) {
run();
}
@@ -59,7 +60,7 @@ static std::string getTestCaseName(const testing::TestParamInfo<std::tuple<std::
INSTANTIATE_TEST_SUITE_P(
smoke_Snippets_MLP_SEQ,
- TokenizeMLPSnippetsParamTests,
+ TokenizeMLPSeqSnippetsParamTests,
testing::Combine(
testing::Values(std::vector<PartialShape>{{64, 64}}, std::vector<PartialShape>{{128, 128}}),
testing::Values(ov::element::f32, ov::element::u8),
diff --git a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp
index 593a3ab56b2..4b7c0cc2c9b 100644
--- a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp
+++ b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp
@@ -188,6 +188,7 @@
#include "snippets/pass/explicit_transpose_matmul_inputs.hpp"
#include "snippets/pass/extract_reshapes_from_mha.hpp"
#include "snippets/pass/fc_tokenization.hpp"
+#include "snippets/pass/gated_mlp_tokenization.hpp"
#include "snippets/pass/mha_tokenization.hpp"
#include "snippets/pass/mlp_seq_tokenization.hpp"
#include "snippets/pass/split_dimension_m.hpp"
@@ -1199,6 +1200,7 @@ void Transformations::MainSnippets() {
CPU_REGISTER_PASS_ARM64(snippetsManager, SnippetsMarkSkipped);
CPU_REGISTER_PASS_X64(snippetsManager, SnippetsMarkSkipped, config.inferencePrecision == ov::element::bf16);
CPU_DISABLE_PASS_COMMON(snippetsManager, snippets::pass::TokenizeFCSnippets);
+ CPU_DISABLE_PASS_COMMON(snippetsManager, snippets::pass::TokenizeGatedMLPSnippets);
}
CPU_REGISTER_PASS_COMMON(snippetsManager, snippets::pass::SnippetsTokenization, tokenization_config);
diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp
index 87c6026a2ba..306ac70dd03 100644
--- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp
+++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp
@@ -608,7 +608,7 @@ std::vector<std::string> disabledTestPatterns() {
retVector.emplace_back(R"(.*smoke_Snippets_MHAWOTransposeEnforceBF16.*)");
retVector.emplace_back(R"(.*smoke_Snippets_FullyConnected_EnforceBF16.*)");
retVector.emplace_back(R"(.*smoke_Snippets_MHA.*EnforceBF16.*)");
- retVector.emplace_back(R"(.*smoke_Snippets_MLP.*bf16.*)");
+ retVector.emplace_back(R"(.*smoke_Snippets_.*MLP.*bf16.*)");
retVector.emplace_back(R"(.*ConcatSDPTest.*bf16.*)");
}
if (!ov::test::snippets::is_fp16_supported_by_brgemm()) {
diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/gated_mlp.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/gated_mlp.cpp
new file mode 100644
index 00000000000..6ea2d64b37b
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/gated_mlp.cpp
@@ -0,0 +1,59 @@
+// Copyright (C) 2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "snippets/gated_mlp.hpp"
+
+#include "utils.hpp"
+
+namespace ov {
+namespace test {
+namespace snippets {
+
+namespace {
+
+static std::vector<utils::ActivationTypes> activations {
+ utils::ActivationTypes::Relu, utils::ActivationTypes::Swish, utils::ActivationTypes::Gelu,
+};
+
+static std::vector<std::pair<InputShape, std::vector<Shape>>> shapes {
+ {
+ InputShape{{-1, -1, 1024}, {{2, 128, 1024}, {2, 1, 1024}, {16, 128, 1024}, {2, 1, 1024}}},
+ std::vector<Shape>{{256, 1024}, {256, 1024}, {1024, 256}}
+ },
+ {
+ InputShape{{-1, -1, 757}, {{21, 39, 757}, {12, 121, 757}, {12, 3, 757}}},
+ std::vector<Shape>{{127, 757}, {127, 757}, {757, 127}}
+ },
+};
+
+INSTANTIATE_TEST_SUITE_P(smoke_Snippets_GatedMLP_f32,
+ GatedMLP,
+ ::testing::Combine(::testing::ValuesIn(shapes),
+ ::testing::Values(GatedMLPFunction::WeightFormat::FP32),
+ ::testing::ValuesIn(activations),
+ ::testing::Values(ov::element::f32),
+ ::testing::Values(1),
+ ::testing::Values(1),
+ ::testing::Values(ov::test::utils::DEVICE_CPU),
+ ::testing::Values(CPUTestUtils::empty_plugin_config)),
+ GatedMLP::getTestCaseName);
+
+INSTANTIATE_TEST_SUITE_P(smoke_Snippets_GatedMLP_bf16,
+ GatedMLP,
+ ::testing::Combine(::testing::ValuesIn(shapes),
+ ::testing::Values(GatedMLPFunction::WeightFormat::FP32),
+ ::testing::ValuesIn(activations),
+ ::testing::Values(ov::element::bf16),
+ ::testing::Values(6), // 3 x Subgraphs + 3 x Reorders on weights
+ ::testing::Values(3), // 3 Subgraphs - In/Out Converts + gMLP
+ ::testing::Values(ov::test::utils::DEVICE_CPU),
+ ::testing::Values(CPUTestUtils::empty_plugin_config)),
+ GatedMLP::getTestCaseName);
+
+
+
+} // namespace
+} // namespace snippets
+} // namespace test
+} // namespace ov
diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/mlp_seq.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/mlp_seq.cpp
index 7096032902d..d996761bf7d 100644
--- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/mlp_seq.cpp
+++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/mlp_seq.cpp
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
-#include "snippets/mlp.hpp"
+#include "snippets/mlp_seq.hpp"
#include "utils.hpp"
diff --git a/src/tests/functional/plugin/shared/include/snippets/gated_mlp.hpp b/src/tests/functional/plugin/shared/include/snippets/gated_mlp.hpp
new file mode 100644
index 00000000000..43c726a641f
--- /dev/null
+++ b/src/tests/functional/plugin/shared/include/snippets/gated_mlp.hpp
@@ -0,0 +1,36 @@
+// Copyright (C) 2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include "shared_test_classes/base/snippets_test_utils.hpp"
+#include "snippets_helpers.hpp"
+#include "subgraph_gated_mlp.hpp"
+
+namespace ov {
+namespace test {
+namespace snippets {
+
+using GatedMLPParams = std::tuple<
+ std::pair<InputShape, std::vector<Shape>>, // InputShape + Weights shape
+ GatedMLPFunction::WeightFormat, // Weight format
+ ov::test::utils::ActivationTypes, // Activation function type
+ ov::element::Type, // Inference precision
+ size_t, // Expected num nodes
+ size_t, // Expected num subgraphs
+ std::string, // Target Device
+ ov::AnyMap // Config
+>;
+
+class GatedMLP : public testing::WithParamInterface<GatedMLPParams>,
+ virtual public SnippetsTestsCommon {
+public:
+ static std::string getTestCaseName(testing::TestParamInfo<ov::test::snippets::GatedMLPParams> obj);
+protected:
+ void SetUp() override;
+};
+
+} // namespace snippets
+} // namespace test
+} // namespace ov
diff --git a/src/tests/functional/plugin/shared/include/snippets/mlp.hpp b/src/tests/functional/plugin/shared/include/snippets/mlp_seq.hpp
similarity index 100%
rename from src/tests/functional/plugin/shared/include/snippets/mlp.hpp
rename to src/tests/functional/plugin/shared/include/snippets/mlp_seq.hpp
diff --git a/src/tests/functional/plugin/shared/src/snippets/gated_mlp.cpp b/src/tests/functional/plugin/shared/src/snippets/gated_mlp.cpp
new file mode 100644
index 00000000000..d3b27b397c2
--- /dev/null
+++ b/src/tests/functional/plugin/shared/src/snippets/gated_mlp.cpp
@@ -0,0 +1,70 @@
+// Copyright (C) 2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "snippets/gated_mlp.hpp"
+
+#include <common_test_utils/ov_tensor_utils.hpp>
+
+#include "common_test_utils/common_utils.hpp"
+#include "functional_test_utils/skip_tests_config.hpp"
+#include "subgraph_gated_mlp.hpp"
+
+namespace ov {
+namespace test {
+namespace snippets {
+
+void GatedMLP::SetUp() {
+ const auto [shapes, weightFormat, ActType, prc, target_num_nodes, target_num_subgraphs, device, additional_config] = this->GetParam();
+ auto [inShape, weightsShapes] = shapes;
+
+ ref_num_nodes = target_num_nodes;
+ ref_num_subgraphs = target_num_subgraphs;
+ targetDevice = device;
+
+ init_input_shapes({inShape});
+
+ const auto subgraph_model = ov::test::snippets::GatedMLPFunction(inputDynamicShapes, weightsShapes, weightFormat, ActType);
+ function = subgraph_model.getOriginal();
+
+ configuration.insert(additional_config.begin(), additional_config.end());
+ if (!configuration.count("SNIPPETS_MODE")) {
+ configuration.insert({"SNIPPETS_MODE", "IGNORE_CALLBACK"});
+ }
+
+ inType = outType = prc;
+ setInferenceType(prc);
+}
+
+std::string GatedMLP::getTestCaseName(testing::TestParamInfo<ov::test::snippets::GatedMLPParams> obj) {
+ auto [shapes, weightFormat, ActType, prc, num_nodes, num_subgraphs, target_device, additional_config] = obj.param;
+ auto [inputShape, weightsShapes] = shapes;
+
+ std::ostringstream result;
+ result << "InputShape=" << inputShape << "_";
+ result << "weightsShapes=" << ov::test::utils::vec2str(weightsShapes) << "_";
+ result << "WeightFormat=" << weightFormat << "_";
+ result << "ActType=" << ActType << "_";
+ result << "Prc=" << prc << "_";
+ result << "#N=" << num_nodes << "_";
+ result << "#S=" << num_subgraphs << "_";
+ result << "targetDevice=" << target_device << "_";
+
+ if (!additional_config.empty()) {
+ result << "_PluginConf";
+ for (auto& item : additional_config) {
+ result << "_" << item.first << "=" << item.second.as<std::string>();
+ }
+ }
+ return result.str();
+}
+
+TEST_P(GatedMLP, CompareWithRefImpl) {
+ SKIP_IF_CURRENT_TEST_IS_DISABLED()
+ run();
+ validateNumSubgraphs();
+}
+
+} // namespace snippets
+} // namespace test
+} // namespace ov
diff --git a/src/tests/functional/plugin/shared/src/snippets/mlp.cpp b/src/tests/functional/plugin/shared/src/snippets/mlp_seq.cpp
similarity index 99%
rename from src/tests/functional/plugin/shared/src/snippets/mlp.cpp
rename to src/tests/functional/plugin/shared/src/snippets/mlp_seq.cpp
index e904bb124dc..3c75d09f7d0 100644
--- a/src/tests/functional/plugin/shared/src/snippets/mlp.cpp
+++ b/src/tests/functional/plugin/shared/src/snippets/mlp_seq.cpp
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
-#include "snippets/mlp.hpp"
+#include "snippets/mlp_seq.hpp"
#include <common_test_utils/ov_tensor_utils.hpp>
diff --git a/src/tests/ov_helpers/ov_snippets_models/include/subgraph_gated_mlp.hpp b/src/tests/ov_helpers/ov_snippets_models/include/subgraph_gated_mlp.hpp
new file mode 100644
index 00000000000..39633881b1e
--- /dev/null
+++ b/src/tests/ov_helpers/ov_snippets_models/include/subgraph_gated_mlp.hpp
@@ -0,0 +1,62 @@
+// Copyright (C) 2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include "snippets_helpers.hpp"
+
+#include "common_test_utils/test_enums.hpp"
+
+/* The file contains graphs with different GatedMLP:
+ * Skeleton of GatedMLP pattern is:
+ * Pattern:
+ * Input
+ * / \
+ * FullyConnected FullyConnected
+ * | |
+ * Activation /
+ * \ /
+ * Multiply
+ * |
+ * FullyConnected
+ */
+
+namespace ov::test::snippets {
+
+class GatedMLPFunction : public SnippetsFunctionBase {
+public:
+ // TODO: Add more (INT8_ASYM, INT8_SYM, INT4 etc)
+ enum class WeightFormat {
+ FP32,
+ FP16,
+ };
+
+ explicit GatedMLPFunction(const std::vector<PartialShape>& input_shapes,
+ const std::vector<Shape>& weights_shapes,
+ WeightFormat wei_format,
+ utils::ActivationTypes act_type)
+ : SnippetsFunctionBase(input_shapes),
+ m_weights_shapes(weights_shapes),
+ m_wei_format(wei_format),
+ m_act_type(act_type) {
+ OPENVINO_ASSERT(input_shapes.size() == 1, "MLPFunction expects 1 input shape");
+ OPENVINO_ASSERT(weights_shapes.size() == 3, "MLPFunction expects 3 weights shapes");
+ }
+
+protected:
+ std::shared_ptr<ov::Model> initOriginal() const override;
+ std::shared_ptr<ov::Model> initReference() const override;
+
+ std::shared_ptr<ov::Node> makeWeights(const Shape& shape, int32_t seed = 1) const;
+ std::shared_ptr<ov::Node> makeFC(const ov::Output<ov::Node>& output, const Shape& shape, int32_t seed = 1) const;
+ std::shared_ptr<ov::Node> makeFC(const ov::Output<ov::Node>& output, const ov::Output<ov::Node>& weights) const;
+
+ const std::vector<Shape> m_weights_shapes {};
+ const WeightFormat m_wei_format = {};
+ const utils::ActivationTypes m_act_type = {};
+};
+
+std::ostream& operator<<(std::ostream& os, GatedMLPFunction::WeightFormat type);
+
+} // namespace ov::test::snippets
diff --git a/src/tests/ov_helpers/ov_snippets_models/src/subgraph_gated_mlp.cpp b/src/tests/ov_helpers/ov_snippets_models/src/subgraph_gated_mlp.cpp
new file mode 100644
index 00000000000..2e72451ac05
--- /dev/null
+++ b/src/tests/ov_helpers/ov_snippets_models/src/subgraph_gated_mlp.cpp
@@ -0,0 +1,98 @@
+// Copyright (C) 2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "subgraph_gated_mlp.hpp"
+
+#include "common_test_utils/node_builders/constant.hpp"
+#include "common_test_utils/node_builders/activation.hpp"
+#include "openvino/opsets/opset1.hpp"
+#include "snippets/op/subgraph.hpp"
+
+namespace ov {
+namespace test {
+namespace snippets {
+
+std::ostream& operator<<(std::ostream& os, GatedMLPFunction::WeightFormat type) {
+ switch (type) {
+ case GatedMLPFunction::WeightFormat::FP32:
+ os << "FP32";
+ break;
+ case GatedMLPFunction::WeightFormat::FP16:
+ os << "FP16";
+ break;
+ default:
+ OPENVINO_THROW("Unexpected weight format!");
+ }
+ return os;
+}
+
+std::shared_ptr<ov::Node> GatedMLPFunction::makeWeights(const Shape& shape, int32_t seed) const {
+ utils::InputGenerateData gen_data;
+ gen_data.seed = seed;
+ switch (m_wei_format) {
+ case WeightFormat::FP32:
+ return ov::test::utils::make_constant(ov::element::f32, shape, gen_data);
+ case WeightFormat::FP16:
+ return ov::test::utils::make_constant(ov::element::f16, shape, gen_data);
+ default:
+ OPENVINO_THROW("Unexpected weight format!");
+ }
+}
+
+std::shared_ptr<ov::Node> GatedMLPFunction::makeFC(const ov::Output<ov::Node>& output, const ov::Output<ov::Node>& weights) const {
+ return std::make_shared<ov::op::v0::MatMul>(output, weights, false, true);
+}
+
+std::shared_ptr<ov::Node> GatedMLPFunction::makeFC(const ov::Output<ov::Node>& output, const Shape& shape, int32_t seed) const {
+ std::shared_ptr<ov::Node> weights = makeWeights(shape, seed);
+ if (weights->get_output_element_type(0) != output.get_element_type()) {
+ weights = std::make_shared<ov::op::v0::Convert>(weights, output.get_element_type());
+ }
+ return makeFC(output, weights->output(0));
+}
+
+std::shared_ptr<ov::Model> GatedMLPFunction::initOriginal() const {
+ auto param = std::make_shared<ov::op::v0::Parameter>(precision, input_shapes[0]);
+
+ auto fc_gate = makeFC(param, m_weights_shapes[0], 3);
+ auto fc_up = makeFC(param, m_weights_shapes[1], 7);
+ auto act = ov::test::utils::make_activation(fc_gate, precision, m_act_type, ov::Shape{}, std::vector<float>{0.5});
+ auto mul = std::make_shared<ov::op::v1::Multiply>(act, fc_up);
+ auto fc_down = makeFC(mul, m_weights_shapes[2], 11);
+
+ auto result = std::make_shared<ov::op::v0::Result>(fc_down);
+ return std::make_shared<Model>(ResultVector{result}, ParameterVector{param});
+}
+
+std::shared_ptr<ov::Model> GatedMLPFunction::initReference() const {
+ auto data = std::make_shared<ov::op::v0::Parameter>(precision, input_shapes[0]);
+
+ auto fc_gate_weights = makeWeights(m_weights_shapes[0], 3);
+ auto fc_up_weights = makeWeights(m_weights_shapes[1], 7);
+ auto fc_down_weights = makeWeights(m_weights_shapes[2], 11);
+
+ NodeVector subgraph_inputs = {data, fc_gate_weights, data, fc_up_weights, fc_down_weights};
+
+ auto param0 = std::make_shared<ov::op::v0::Parameter>(data->get_element_type(), data->get_output_partial_shape(0));
+ auto param1 = std::make_shared<ov::op::v0::Parameter>(data->get_element_type(), data->get_output_partial_shape(0));
+ auto param2 = std::make_shared<ov::op::v0::Parameter>(fc_gate_weights->get_element_type(), fc_gate_weights->get_output_partial_shape(0));
+ auto param3 = std::make_shared<ov::op::v0::Parameter>(fc_up_weights->get_element_type(), fc_up_weights->get_output_partial_shape(0));
+ auto param4 = std::make_shared<ov::op::v0::Parameter>(fc_down_weights->get_element_type(), fc_down_weights->get_output_partial_shape(0));
+
+ auto fc_gate = makeFC(param0, param2);
+ auto fc_up = makeFC(param1, param3);
+ auto act = ov::test::utils::make_activation(fc_gate, precision, m_act_type, ov::Shape{}, std::vector<float>{0.5});
+ auto mul = std::make_shared<ov::op::v1::Multiply>(act, fc_up);
+ auto fc_down = makeFC(mul, param4);
+
+ auto subgraph = std::make_shared<ov::snippets::op::Subgraph>(
+ subgraph_inputs,
+ std::make_shared<ov::Model>(OutputVector{fc_down}, ParameterVector{param0, param2, param1, param3, param4}));
+
+ return std::make_shared<Model>(OutputVector{subgraph}, ParameterVector{data});
+}
+
+} // namespace snippets
+} // namespace test
+} // namespace ov