Skip to content

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

[TRANSFORMATIONS][CPU][GPU] Remove redundant Transpose operations in plugins. (#35427)

Mikhail Ryzhov9cd82d48e086
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp
index 30240f139d3..c50d333be81 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp
@@ -28,6 +28,7 @@
#include "transformations/common_optimizations/convert_tiled_moe_block_to_gather_matmuls.hpp"
#include "transformations/common_optimizations/nop_elimination.hpp"
#include "transformations/common_optimizations/reshape_sequence_fusion.hpp"
+#include "transformations/common_optimizations/transpose_to_reshape.hpp"
#include "transformations/convert_precision.hpp"
#include "transformations/defs.hpp"
#include "transformations/op_conversions/convert_fc_to_compressed.hpp"
@@ -77,9 +78,15 @@ inline void ConvertToCPUSpecificOpset(std::shared_ptr<ov::Model>& model, const C
CPU_REGISTER_PASS_COMMON(manager, ConvertToLeakyRelu);
CPU_REGISTER_PASS_COMMON(manager, ConvertToSwishCPU);
CPU_REGISTER_PASS_COMMON(manager, OptimizeSequenceTransposes);
- // after transformation "MoveEltwiseUpThroughDataMov" there can be reshaped sequences that should be eliminated or
- // fused
- CPU_REGISTER_PASS_COMMON(manager, ov::pass::ReshapeSequenceFusion);
+ // TransposeToReshape is also registered in MOC, but plugin-specific transformations
+ // can introduce new Transpose nodes after MOC runs.
+ CPU_REGISTER_PASS_COMMON(
+ manager,
+ ov::pass::TransposeToReshape); // Should be after all transformations that can produce transposes
+ CPU_REGISTER_PASS_COMMON(
+ manager,
+ ov::pass::ReshapeSequenceFusion); // after transformation "MoveEltwiseUpThroughDataMov" there can be reshaped
+ // sequences that should be eliminated or fused
CPU_REGISTER_PASS_COMMON(manager, ov::pass::ConstantFolding);
CPU_REGISTER_PASS_COMMON(manager,
ov::pass::ConvertPrecision,
diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/lora_pattern.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/lora_pattern.cpp
index ed4b6780c9f..ae980b95014 100644
--- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/lora_pattern.cpp
+++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/lora_pattern.cpp
@@ -287,16 +287,16 @@ TEST_P(LoraPatternMatmulCPUTest, CompareWithRefs) {
SKIP_IF_CURRENT_TEST_IS_DISABLED();
targetStaticShapes = {{{{1, 20, K}}, {{N, K}}}};
run_test();
- CPUTestUtils::CheckNumberOfNodesWithType(compiledModel, "LoRA", 1);
- CPUTestUtils::CheckNumberOfNodesWithType(compiledModel, "MatMul", 1);
+ CheckNumberOfNodesWithType(compiledModel, "LoRA", 1);
+ CheckNumberOfNodesWithType(compiledModel, "MatMul", 1);
}
TEST_P(LoraPatternConvolutionCPUTest, CompareWithRefs) {
SKIP_IF_CURRENT_TEST_IS_DISABLED();
targetStaticShapes = {{{1, num_channels, 10, 15}}};
run_test();
- CPUTestUtils::CheckNumberOfNodesWithType(compiledModel, "LoRA", 1);
- CPUTestUtils::CheckNumberOfNodesWithType(compiledModel, "MatMul", 0);
+ CheckNumberOfNodesWithType(compiledModel, "LoRA", 1);
+ CheckNumberOfNodesWithType(compiledModel, "MatMul", 0);
}
const ov::element::TypeVector states_precisions {ov::element::f32, ov::element::f16};
diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/conv_u8_fuse_sum_i8.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/conv_u8_fuse_sum_i8.cpp
index 4f77ef86742..e338da4bec0 100644
--- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/conv_u8_fuse_sum_i8.cpp
+++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/conv_u8_fuse_sum_i8.cpp
@@ -95,7 +95,7 @@ TEST_F(ConvU8FuseSumI8, smoke_CompareWithRefs) {
run();
// 2 input reorders (abcd -> acdb) before 2 convolutions + one output reorderr (acdb -> abcd) before result
// No reorder (i8 -> u8) is expected on the port for a fused sum
- CPUTestUtils::CheckNumberOfNodesWithType(compiledModel, "Reorder", 3);
+ CheckNumberOfNodesWithType(compiledModel, "Reorder", 3);
}
} // namespace test
diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/interpolate_with_post_ops.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/interpolate_with_post_ops.cpp
index 5e1f2c33f5c..1a27ab516de 100644
--- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/interpolate_with_post_ops.cpp
+++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/interpolate_with_post_ops.cpp
@@ -98,9 +98,9 @@ protected:
TEST_P(InterpolateWithPostOps, CheckInterpolateWithPostOps) {
run();
if (NCHWAsNHWC_NoFuse) {
- CPUTestUtils::CheckNumberOfNodesWithTypes(compiledModel, {"Subgraph", "Eltwise"}, 1);
+ CheckNumberOfNodesWithTypes(compiledModel, {"Subgraph", "Eltwise"}, 1);
} else {
- CPUTestUtils::CheckNumberOfNodesWithTypes(compiledModel, {"Subgraph", "Eltwise"}, 0);
+ CheckNumberOfNodesWithTypes(compiledModel, {"Subgraph", "Eltwise"}, 0);
}
}
@@ -110,4 +110,4 @@ INSTANTIATE_TEST_SUITE_P(InterpolateWithPostOpsFusion,
InterpolateWithPostOps::getTestCaseName);
} // namespace test
-} // namespace ov
\ No newline at end of file
+} // namespace ov
diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/subgraph_caching.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/subgraph_caching.cpp
index f992bef48ee..b0a17046559 100644
--- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/subgraph_caching.cpp
+++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/subgraph_caching.cpp
@@ -95,8 +95,8 @@ protected:
TEST_P(SubgraphCacheTest, CompareWithRefs) {
run();
- CPUTestUtils::CheckNumberOfNodesWithType(compiledModel, "MatMul", 0);
- CPUTestUtils::CheckNumberOfNodesWithType(compiledModel, "Subgraph", 2);
+ CheckNumberOfNodesWithType(compiledModel, "MatMul", 0);
+ CheckNumberOfNodesWithType(compiledModel, "Subgraph", 2);
}
namespace {
diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/subgraph_tests/matmul_transpose_to_reshape.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/subgraph_tests/matmul_transpose_to_reshape.cpp
new file mode 100644
index 00000000000..0a383d5bb2e
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/subgraph_tests/matmul_transpose_to_reshape.cpp
@@ -0,0 +1,25 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "subgraph_tests/matmul_transpose_to_reshape.hpp"
+
+#include <vector>
+
+namespace {
+
+std::vector<ov::element::Type> netPrecisions = {ov::element::f32};
+
+} // namespace
+
+namespace ov {
+namespace test {
+
+INSTANTIATE_TEST_SUITE_P(smoke_basic,
+ MatMulTransposeToReshape,
+ ::testing::Combine(::testing::ValuesIn(netPrecisions),
+ ::testing::Values(ov::test::utils::DEVICE_CPU)),
+ MatMulTransposeToReshape::getTestCaseName);
+
+} // namespace test
+} // namespace ov
diff --git a/src/plugins/intel_cpu/tests/functional/utils/cpu_test_utils.cpp b/src/plugins/intel_cpu/tests/functional/utils/cpu_test_utils.cpp
index 64da2d1edc9..00565737740 100644
--- a/src/plugins/intel_cpu/tests/functional/utils/cpu_test_utils.cpp
+++ b/src/plugins/intel_cpu/tests/functional/utils/cpu_test_utils.cpp
@@ -321,21 +321,6 @@ std::string CPUTestsBase::getISA(bool skip_amx) const {
return isaType;
}
-static std::string setToString(const std::unordered_set<std::string> s) {
- if (s.empty())
- return {};
-
- std::string result;
- result.append("{");
- for (const auto& str : s) {
- result.append(str);
- result.append(",");
- }
- result.append("}");
-
- return result;
-}
-
CPUTestsBase::CPUInfo CPUTestsBase::makeCPUInfo(const std::vector<cpu_memory_format_t>& inFmts,
const std::vector<cpu_memory_format_t>& outFmts,
const std::vector<std::string>& priority) {
@@ -455,46 +440,6 @@ void CPUTestsBase::updateSelectedType(const std::string& primitiveType,
selectedType += execType.get_type_name();
}
-inline void CheckNumberOfNodesWithTypeImpl(std::shared_ptr<const ov::Model> function,
- const std::unordered_set<std::string>& nodeTypes,
- size_t expectedCount) {
- ASSERT_NE(nullptr, function);
- size_t actualNodeCount = 0;
- for (const auto& node : function->get_ops()) {
- const auto& rtInfo = node->get_rt_info();
- auto getExecValue = [&rtInfo](const std::string& paramName) -> std::string {
- auto it = rtInfo.find(paramName);
- OPENVINO_ASSERT(rtInfo.end() != it);
- return it->second.as<std::string>();
- };
-
- if (nodeTypes.count(getExecValue(ov::exec_model_info::LAYER_TYPE))) {
- actualNodeCount++;
- }
- }
-
- ASSERT_EQ(expectedCount, actualNodeCount)
- << "Unexpected count of the node types '" << setToString(nodeTypes) << "' ";
-}
-
-void CheckNumberOfNodesWithTypes(const ov::CompiledModel& compiledModel,
- const std::unordered_set<std::string>& nodeTypes,
- size_t expectedCount) {
- if (!compiledModel)
- return;
-
- std::shared_ptr<const ov::Model> function = compiledModel.get_runtime_model();
-
- CheckNumberOfNodesWithTypeImpl(function, nodeTypes, expectedCount);
-}
-
-void CheckNumberOfNodesWithType(const ov::CompiledModel& compiledModel,
- const std::string& nodeType,
- size_t expectedCount) {
- CheckNumberOfNodesWithTypes(compiledModel, {nodeType}, expectedCount);
-}
-
-
// deduce the actual precision of the operation given the ngraph level operation precision and the plugin config
ov::element::Type
CPUTestsBase::deduce_expected_precision(const ov::element::Type& opPrecision,
diff --git a/src/plugins/intel_cpu/tests/functional/utils/cpu_test_utils.hpp b/src/plugins/intel_cpu/tests/functional/utils/cpu_test_utils.hpp
index 1ceae15735b..85102f85b8b 100644
--- a/src/plugins/intel_cpu/tests/functional/utils/cpu_test_utils.hpp
+++ b/src/plugins/intel_cpu/tests/functional/utils/cpu_test_utils.hpp
@@ -187,12 +187,6 @@ const ov::AnyMap cpu_bf16_plugin_config = {{ov::hint::inference_precision(ov::el
const ov::AnyMap cpu_f32_plugin_config = {{ov::hint::inference_precision(ov::element::f32)}};
// utility functions
-void CheckNumberOfNodesWithType(const ov::CompiledModel& compiledModel,
- const std::string& nodeType,
- size_t expectedCount);
-void CheckNumberOfNodesWithTypes(const ov::CompiledModel& compiledModel,
- const std::unordered_set<std::string>& nodeTypes,
- size_t expectedCount);
bool containsNonSupportedFormat(const std::vector<cpu_memory_format_t>& formats,
const std::vector<cpu_memory_format_t>& non_supported_f);
bool containsSupportedFormatsOnly(const std::vector<cpu_memory_format_t>& formats,
diff --git a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp
index 9d0e6c293b9..d90042bfe64 100644
--- a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp
+++ b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp
@@ -128,6 +128,7 @@
#include "transformations/common_optimizations/sdpa_scale_fusion.hpp"
#include "transformations/common_optimizations/shared_ops_optimization.hpp"
#include "transformations/common_optimizations/softmax_fusion.hpp"
+#include "transformations/common_optimizations/transpose_to_reshape.hpp"
#include "transformations/common_optimizations/transpose_sinking.hpp"
#include "transformations/common_optimizations/weights_dequantize_to_fake_quantize.hpp"
#include "transformations/common_optimizations/wrap_interpolate_into_transposes.hpp"
@@ -1498,6 +1499,8 @@ void TransformationsPipeline::apply(std::shared_ptr<ov::Model> func) {
const size_t zp_pad_size = device_info.supports_immad ? 16 : 32;
manager.register_pass<ov::intel_gpu::BroadcastAndPadZeroPointBuffers>(zp_pad_size, device_info.supports_immad);
+ manager.register_pass<ov::pass::TransposeToReshape>(); // Should be after all transformations that can produce transposes
+
manager.register_pass<ov::intel_gpu::OptimizeSubsequentReshapes>();
manager.register_pass<ov::intel_gpu::SinkReshape>();
diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/subgraph_tests/matmul_transpose_to_reshape.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/subgraph_tests/matmul_transpose_to_reshape.cpp
new file mode 100644
index 00000000000..dd515275e0c
--- /dev/null
+++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/subgraph_tests/matmul_transpose_to_reshape.cpp
@@ -0,0 +1,25 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "subgraph_tests/matmul_transpose_to_reshape.hpp"
+
+#include <vector>
+
+namespace {
+
+std::vector<ov::element::Type> netPrecisions = {ov::element::f32};
+
+} // namespace
+
+namespace ov {
+namespace test {
+
+INSTANTIATE_TEST_SUITE_P(smoke_basic,
+ MatMulTransposeToReshape,
+ ::testing::Combine(::testing::ValuesIn(netPrecisions),
+ ::testing::Values(ov::test::utils::DEVICE_GPU)),
+ MatMulTransposeToReshape::getTestCaseName);
+
+} // namespace test
+} // namespace ov
diff --git a/src/tests/functional/base_func_tests/include/shared_test_classes/base/ov_subgraph.hpp b/src/tests/functional/base_func_tests/include/shared_test_classes/base/ov_subgraph.hpp
index 42eec56a441..ad2929d90ff 100644
--- a/src/tests/functional/base_func_tests/include/shared_test_classes/base/ov_subgraph.hpp
+++ b/src/tests/functional/base_func_tests/include/shared_test_classes/base/ov_subgraph.hpp
@@ -8,9 +8,12 @@
#include "common_test_utils/ov_plugin_cache.hpp"
#include "functional_test_utils/summary/op_summary.hpp"
#include "openvino/core/model.hpp"
+#include "openvino/runtime/exec_model_info.hpp"
#include "transformations/convert_precision.hpp"
#include "functional_test_utils/skip_tests_config.hpp"
+#include <unordered_set>
+
namespace ov {
namespace test {
@@ -128,6 +131,52 @@ inline std::vector<InputShape> static_shapes_to_test_representation(const std::v
return result;
}
+inline void CheckNumberOfNodesWithTypes(std::shared_ptr<const ov::Model> function,
+ const std::unordered_set<std::string>& nodeTypes,
+ size_t expectedCount) {
+ ASSERT_NE(nullptr, function);
+ size_t actualNodeCount = 0;
+ for (const auto& node : function->get_ops()) {
+ const auto& rtInfo = node->get_rt_info();
+ auto getExecValue = [&rtInfo](const std::string& paramName) -> std::string {
+ auto it = rtInfo.find(paramName);
+ OPENVINO_ASSERT(rtInfo.end() != it);
+ return it->second.as<std::string>();
+ };
+
+ if (nodeTypes.count(getExecValue(ov::exec_model_info::LAYER_TYPE))) {
+ actualNodeCount++;
+ }
+ }
+
+ std::string nodeTypesStr;
+ for (const auto& t : nodeTypes) {
+ nodeTypesStr += t + ",";
+ }
+ ASSERT_EQ(expectedCount, actualNodeCount)
+ << "Unexpected count of the node types '{" << nodeTypesStr << "}'";
+}
+
+inline void CheckNumberOfNodesWithTypes(const ov::CompiledModel& compiledModel,
+ const std::unordered_set<std::string>& nodeTypes,
+ size_t expectedCount) {
+ if (!compiledModel)
+ return;
+ CheckNumberOfNodesWithTypes(compiledModel.get_runtime_model(), nodeTypes, expectedCount);
+}
+
+inline void CheckNumberOfNodesWithType(const ov::CompiledModel& compiledModel,
+ const std::string& nodeType,
+ size_t expectedCount) {
+ CheckNumberOfNodesWithTypes(compiledModel, {nodeType}, expectedCount);
+}
+
+inline void CheckNumberOfNodesWithType(std::shared_ptr<const ov::Model> function,
+ const std::string& nodeType,
+ size_t expectedCount) {
+ CheckNumberOfNodesWithTypes(function, {nodeType}, expectedCount);
+}
+
class SubgraphBaseStaticTest : public ov::test::SubgraphBaseTest {
public:
void run() override {
diff --git a/src/tests/functional/plugin/shared/include/shared_test_classes/subgraph/matmul_transpose_to_reshape.hpp b/src/tests/functional/plugin/shared/include/shared_test_classes/subgraph/matmul_transpose_to_reshape.hpp
new file mode 100644
index 00000000000..d45b9d4e370
--- /dev/null
+++ b/src/tests/functional/plugin/shared/include/shared_test_classes/subgraph/matmul_transpose_to_reshape.hpp
@@ -0,0 +1,27 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include <tuple>
+
+#include "shared_test_classes/base/ov_subgraph.hpp"
+
+namespace ov {
+namespace test {
+
+using MatMulTransposeToReshapeParams = std::tuple<ov::element::Type, // Network precision
+ std::string>; // Target device
+
+class MatMulTransposeToReshape : public testing::WithParamInterface<MatMulTransposeToReshapeParams>,
+ virtual public ov::test::SubgraphBaseStaticTest {
+public:
+ static std::string getTestCaseName(const testing::TestParamInfo<MatMulTransposeToReshapeParams>& obj);
+
+protected:
+ void SetUp() override;
+};
+
+} // namespace test
+} // namespace ov
diff --git a/src/tests/functional/plugin/shared/include/subgraph_tests/gated_delta_net.hpp b/src/tests/functional/plugin/shared/include/subgraph_tests/gated_delta_net.hpp
index 1ec3cf420b4..526381e13b9 100644
--- a/src/tests/functional/plugin/shared/include/subgraph_tests/gated_delta_net.hpp
+++ b/src/tests/functional/plugin/shared/include/subgraph_tests/gated_delta_net.hpp
@@ -8,21 +8,6 @@
namespace ov::test {
-inline void CheckNumberOfNodesWithType(std::shared_ptr<const ov::Model> function,
- const std::unordered_set<std::string>& nodeTypes,
- size_t expectedCount) {
- ASSERT_NE(nullptr, function);
- int num_ops = 0;
- for (const auto& node : function->get_ordered_ops()) {
- const auto& rt_info = node->get_rt_info();
- const auto layer_type = rt_info.find("layerType")->second.as<std::string>();
- if (nodeTypes.count(layer_type)) {
- num_ops++;
- }
- }
- ASSERT_EQ(num_ops, expectedCount);
-}
-
TEST_P(GatedDeltaNet, CompareWithRefs) {
SKIP_IF_CURRENT_TEST_IS_DISABLED();
run();
@@ -34,4 +19,4 @@ TEST_P(GatedDeltaNet, CompareWithRefs) {
CheckNumberOfNodesWithType(function, {"Multiply"}, 0);
CheckNumberOfNodesWithType(function, {"Divide"}, 0);
};
-} // namespace ov::test
\ No newline at end of file
+} // namespace ov::test
diff --git a/src/tests/functional/plugin/shared/include/subgraph_tests/matmul_transpose_to_reshape.hpp b/src/tests/functional/plugin/shared/include/subgraph_tests/matmul_transpose_to_reshape.hpp
new file mode 100644
index 00000000000..1a1265fd358
--- /dev/null
+++ b/src/tests/functional/plugin/shared/include/subgraph_tests/matmul_transpose_to_reshape.hpp
@@ -0,0 +1,23 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include "shared_test_classes/subgraph/matmul_transpose_to_reshape.hpp"
+
+namespace ov {
+namespace test {
+
+TEST_P(MatMulTransposeToReshape, CompareWithRefs) {
+ SKIP_IF_CURRENT_TEST_IS_DISABLED();
+ run();
+
+ const auto runtime_model = compiledModel.get_runtime_model();
+ CheckNumberOfNodesWithTypes(runtime_model, {"FullyConnected"}, 1);
+ CheckNumberOfNodesWithTypes(runtime_model, {"Transpose"}, 0);
+ CheckNumberOfNodesWithTypes(runtime_model, {"Permute"}, 0);
+}
+
+} // namespace test
+} // namespace ov
diff --git a/src/tests/functional/plugin/shared/include/subgraph_tests/rotary_pos_emb.hpp b/src/tests/functional/plugin/shared/include/subgraph_tests/rotary_pos_emb.hpp
index 86d62f0ec6f..1ba90d6eb30 100644
--- a/src/tests/functional/plugin/shared/include/subgraph_tests/rotary_pos_emb.hpp
+++ b/src/tests/functional/plugin/shared/include/subgraph_tests/rotary_pos_emb.hpp
@@ -9,21 +9,6 @@
namespace ov {
namespace test {
-inline void CheckNumberOfNodesWithType(std::shared_ptr<const ov::Model> function,
- const std::unordered_set<std::string>& nodeTypes,
- size_t expectedCount) {
- ASSERT_NE(nullptr, function);
- int num_ops = 0;
- for (const auto& node : function->get_ordered_ops()) {
- const auto& rt_info = node->get_rt_info();
- const auto layer_type = rt_info.find("layerType")->second.as<std::string>();
- if (nodeTypes.count(layer_type)) {
- num_ops++;
- }
- }
- ASSERT_EQ(num_ops, expectedCount);
-}
-
TEST_P(RoPETestFlux, CompareWithRefs) {
SKIP_IF_CURRENT_TEST_IS_DISABLED();
run();
diff --git a/src/tests/functional/plugin/shared/src/subgraph/matmul_transpose_to_reshape.cpp b/src/tests/functional/plugin/shared/src/subgraph/matmul_transpose_to_reshape.cpp
new file mode 100644
index 00000000000..a12bf0fae01
--- /dev/null
+++ b/src/tests/functional/plugin/shared/src/subgraph/matmul_transpose_to_reshape.cpp
@@ -0,0 +1,35 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "shared_test_classes/subgraph/matmul_transpose_to_reshape.hpp"
+
+#include "common_test_utils/node_builders/constant.hpp"
+#include "openvino/op/matmul.hpp"
+
+namespace ov {
+namespace test {
+
+std::string MatMulTransposeToReshape::getTestCaseName(const testing::TestParamInfo<MatMulTransposeToReshapeParams>& obj) {
+ const auto& [element_type, target_name] = obj.param;
+
+ std::ostringstream result;
+ result << "ET=" << element_type << "_";
+ result << "targetDevice=" << target_name;
+ return result.str();
+}
+
+void MatMulTransposeToReshape::SetUp() {
+ const auto& [element_type, _targetDevice] = GetParam();
+
+ targetDevice = _targetDevice;
+
+ const auto data = std::make_shared<ov::op::v0::Parameter>(element_type, ov::Shape{3, 2, 1});
+ const auto weights = ov::test::utils::make_constant(element_type, ov::Shape{1, 2, 1});
+ const auto matmul = std::make_shared<ov::op::v0::MatMul>(data, weights, true, false);
+
+ function = std::make_shared<ov::Model>(ov::OutputVector{matmul}, ov::ParameterVector{data}, "MatMulTransposeToReshape");
+}
+
+} // namespace test
+} // namespace ov