Skip to content

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

Extend CPU Plugin with `SegmentMax-16` reference implementation (#28979)

Przemyslaw Wysockiaa213c35773e
diff --git a/src/core/reference/include/openvino/reference/segment_max.hpp b/src/core/reference/include/openvino/reference/segment_max.hpp
index 3af1ff253c1..d1d120e1714 100644
--- a/src/core/reference/include/openvino/reference/segment_max.hpp
+++ b/src/core/reference/include/openvino/reference/segment_max.hpp
@@ -12,7 +12,9 @@
namespace ov::reference {
-template <typename T, typename T_idx, std::enable_if_t<std::is_same<std::decay_t<T_idx>, int64_t>::value>* = nullptr>
+template <typename T,
+ typename T_idx,
+ typename std::enable_if_t<std::is_same_v<typename std::decay_t<T_idx>, int64_t>>* = nullptr>
void segment_max(const T* data,
const Shape& data_shape,
const T_idx* segment_ids,
@@ -41,7 +43,9 @@ void segment_max(const T* data,
}
}
-template <typename T, typename T_idx, std::enable_if_t<!std::is_same<std::decay_t<T_idx>, int64_t>::value>* = nullptr>
+template <typename T,
+ typename T_idx,
+ typename std::enable_if_t<!std::is_same_v<typename std::decay_t<T_idx>, int64_t>>* = nullptr>
void segment_max(const T* data,
const Shape& data_shape,
const T_idx* segment_ids,
diff --git a/src/plugins/intel_cpu/src/cpu_types.cpp b/src/plugins/intel_cpu/src/cpu_types.cpp
index 219da020087..79712f13683 100644
--- a/src/plugins/intel_cpu/src/cpu_types.cpp
+++ b/src/plugins/intel_cpu/src/cpu_types.cpp
@@ -91,6 +91,7 @@ static const TypeToNameMap& get_type_to_name_tbl() {
{"Erf", Type::Eltwise},
{"SoftPlus", Type::Eltwise},
{"SoftSign", Type::Eltwise},
+ {"SegmentMax", Type::SegmentMax},
{"Select", Type::Eltwise},
{"Log", Type::Eltwise},
{"BitwiseAnd", Type::Eltwise},
@@ -394,6 +395,7 @@ std::string NameFromType(const Type type) {
CASE(QKVProjection);
CASE(RMS);
CASE(SearchSorted);
+ CASE(SegmentMax);
CASE(LoRA);
CASE(Unknown);
}
diff --git a/src/plugins/intel_cpu/src/cpu_types.h b/src/plugins/intel_cpu/src/cpu_types.h
index ffe9752efe1..45f5ddfc3d5 100644
--- a/src/plugins/intel_cpu/src/cpu_types.h
+++ b/src/plugins/intel_cpu/src/cpu_types.h
@@ -135,6 +135,7 @@ enum class Type {
QKVProjection,
RMS,
SearchSorted,
+ SegmentMax,
LoRA
};
diff --git a/src/plugins/intel_cpu/src/nodes/segment_max.cpp b/src/plugins/intel_cpu/src/nodes/segment_max.cpp
new file mode 100644
index 00000000000..a1f11dfe6c3
--- /dev/null
+++ b/src/plugins/intel_cpu/src/nodes/segment_max.cpp
@@ -0,0 +1,153 @@
+// Copyright (C) 2018-2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "segment_max.h"
+
+#include "openvino/op/segment_max.hpp"
+#include "openvino/reference/segment_max.hpp"
+
+namespace ov::intel_cpu::node {
+SegmentMax::SegmentMax(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)
+ : Node(op, context, NgraphShapeInferFactory(op)) {
+ std::string errorMessage;
+ if (!isSupportedOperation(op, errorMessage)) {
+ OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);
+ }
+ fillMode = ov::as_type_ptr<const ov::op::v16::SegmentMax>(op)->get_fill_mode();
+}
+
+bool SegmentMax::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::string& errorMessage) noexcept {
+ try {
+ if (!ov::is_type<ov::op::v16::SegmentMax>(op)) {
+ errorMessage = "Only opset16 SegmentMax operation is supported";
+ return false;
+ }
+ } catch (...) {
+ return false;
+ }
+ return true;
+}
+
+void SegmentMax::getSupportedDescriptors() {
+ // Validation is already done in the ov::opset16::SegmentMax
+}
+
+void SegmentMax::initSupportedPrimitiveDescriptors() {
+ if (!supportedPrimitiveDescriptors.empty()) {
+ return;
+ }
+ ov::element::Type dataPrecision = getOriginalInputPrecisionAtPort(0);
+ if (getOriginalInputsNumber() == 2) {
+ addSupportedPrimDesc({{LayoutType::ncsp, dataPrecision}, {LayoutType::ncsp, ov::element::i32}},
+ {{LayoutType::ncsp, dataPrecision}},
+ impl_desc_type::ref);
+ } else {
+ addSupportedPrimDesc({{LayoutType::ncsp, dataPrecision},
+ {LayoutType::ncsp, ov::element::i32},
+ {LayoutType::ncsp, ov::element::i32}},
+ {{LayoutType::ncsp, dataPrecision}},
+ impl_desc_type::ref);
+ }
+}
+
+bool SegmentMax::created() const {
+ return getType() == Type::SegmentMax;
+}
+
+bool SegmentMax::needPrepareParams() const {
+ return false;
+}
+
+void SegmentMax::executeDynamicImpl(const dnnl::stream& strm) {
+ execute(strm);
+
+ // Update lastSegmentIds
+ const auto* srcSegmentIds = getSrcDataAtPortAs<const int32_t>(1);
+ lastSegmentIds.assign(srcSegmentIds, srcSegmentIds + getSrcMemoryAtPort(1)->getSize());
+
+ // Update lastNumSegments
+ if (getOriginalInputsNumber() == 3) {
+ const auto* numSegmentsValue = getSrcDataAtPortAs<const int32_t>(2);
+ if (lastNumSegments.empty()) {
+ lastNumSegments.push_back(*numSegmentsValue);
+ } else {
+ lastNumSegments[0] = *numSegmentsValue;
+ }
+ }
+}
+
+bool SegmentMax::needShapeInfer() const {
+ if (inputShapesModified()) {
+ return true;
+ }
+ if (lastSegmentIds.empty()) {
+ return true;
+ }
+
+ // Check if segmentIds has changed
+ if (lastSegmentIds.size() != getSrcMemoryAtPort(1)->getSize()) {
+ return true;
+ }
+ const auto* segmentIds = getSrcDataAtPortAs<const int32_t>(1);
+ for (size_t i = 0; i < lastSegmentIds.size(); i++) {
+ if (lastSegmentIds[i] != segmentIds[i]) {
+ return true;
+ }
+ }
+
+ // Check if numSegments has changed
+ if (getOriginalInputsNumber() == 3) {
+ if (lastNumSegments.empty()) {
+ return true;
+ }
+ const auto* numSegments = getSrcDataAtPortAs<const int32_t>(2);
+ if (*numSegments != lastNumSegments[0]) {
+ return true;
+ }
+ }
+ return false;
+}
+
+template <class T>
+void SegmentMax::executeImpl() {
+ const auto& data_shape = getSrcMemoryAtPort(0)->getStaticDims();
+ const auto& output_shape = getDstMemoryAtPort(0)->getShape().getStaticDims();
+ const auto empty_segment_value = fillMode == ov::op::FillMode::ZERO ? T(0) : std::numeric_limits<T>::lowest();
+ ov::reference::segment_max(getSrcDataAtPortAs<const T>(0),
+ data_shape,
+ getSrcDataAtPortAs<const int32_t>(1),
+ getDstDataAtPortAs<T>(0),
+ output_shape,
+ empty_segment_value);
+}
+
+namespace {
+struct SegmentMaxContext {
+ SegmentMax& node;
+};
+} // namespace
+
+template <class T>
+struct SegmentMax::SegmentMaxExecute {
+ void operator()(SegmentMaxContext& ctx) {
+ ctx.node.executeImpl<T>();
+ }
+};
+
+void SegmentMax::execute(const dnnl::stream& strm) {
+ auto dataPrecision = getParentEdgeAt(0)->getMemory().getDesc().getPrecision();
+ SegmentMaxContext ctx = {*this};
+ OV_SWITCH(intel_cpu,
+ SegmentMaxExecute,
+ ctx,
+ dataPrecision,
+ OV_CASE(ov::element::f32, float),
+ OV_CASE(ov::element::f16, ov::float16),
+ OV_CASE(ov::element::bf16, ov::bfloat16),
+ OV_CASE(ov::element::i8, int8_t),
+ OV_CASE(ov::element::u8, uint8_t),
+ OV_CASE(ov::element::i32, int32_t),
+ OV_CASE(ov::element::i64, int64_t))
+}
+} // namespace ov::intel_cpu::node
diff --git a/src/plugins/intel_cpu/src/nodes/segment_max.h b/src/plugins/intel_cpu/src/nodes/segment_max.h
new file mode 100644
index 00000000000..6cf2678bcb7
--- /dev/null
+++ b/src/plugins/intel_cpu/src/nodes/segment_max.h
@@ -0,0 +1,40 @@
+// Copyright (C) 2018-2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include "node.h"
+
+namespace ov {
+namespace intel_cpu {
+namespace node {
+
+class SegmentMax : public Node {
+public:
+ SegmentMax(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context);
+
+ static bool isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::string& errorMessage) noexcept;
+ void getSupportedDescriptors() override;
+ void initSupportedPrimitiveDescriptors() override;
+ void execute(const dnnl::stream& strm) override;
+ bool created() const override;
+ bool needPrepareParams() const override;
+ void executeDynamicImpl(const dnnl::stream& strm) override;
+ bool needShapeInfer() const override;
+
+private:
+ template <class OV_DATA_TYPE>
+ void executeImpl();
+
+ template <class T>
+ struct SegmentMaxExecute;
+
+ ov::op::FillMode fillMode;
+ std::vector<int32_t> lastSegmentIds;
+ std::vector<int32_t> lastNumSegments;
+};
+
+} // namespace node
+} // namespace intel_cpu
+} // namespace ov
diff --git a/src/plugins/intel_cpu/src/nodes_factory.cpp b/src/plugins/intel_cpu/src/nodes_factory.cpp
index 6a4fe414d18..1f84bd6f8f9 100644
--- a/src/plugins/intel_cpu/src/nodes_factory.cpp
+++ b/src/plugins/intel_cpu/src/nodes_factory.cpp
@@ -94,6 +94,7 @@
#include "nodes/scaled_attn.h"
#include "nodes/scatter_update.h"
#include "nodes/search_sorted.h"
+#include "nodes/segment_max.h"
#include "nodes/shapeof.h"
#include "nodes/shuffle_channels.h"
#include "nodes/softmax.h"
@@ -223,6 +224,7 @@ Node::NodesFactory::NodesFactory() : Factory("NodesFactory") {
INTEL_CPU_NODE(Composite, Type::SubModel);
INTEL_CPU_NODE(ScaledDotProductAttention, Type::ScaledDotProductAttention);
INTEL_CPU_NODE(SearchSorted, Type::SearchSorted);
+ INTEL_CPU_NODE(SegmentMax, Type::SegmentMax);
INTEL_CPU_NODE(LoRA, Type::LoRA);
#if defined(OPENVINO_ARCH_X86_64)
INTEL_CPU_NODE(FakeQuantize, Type::FakeQuantize);
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/segment_max.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/segment_max.cpp
new file mode 100644
index 00000000000..d2e184d6f11
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/segment_max.cpp
@@ -0,0 +1,209 @@
+// Copyright (C) 2018-2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "segment_max.hpp"
+#include "utils/cpu_test_utils.hpp"
+#include "common_test_utils/ov_tensor_utils.hpp"
+#include "shared_test_classes/base/ov_subgraph.hpp"
+#include "utils/precision_support.h"
+
+using namespace CPUTestUtils;
+
+namespace ov {
+namespace test {
+namespace SegmentMax {
+std::string SegmentMaxLayerCPUTest::getTestCaseName(testing::TestParamInfo<SegmentMaxLayerCPUTestParamsSet> obj) {
+ SegmentMaxLayerTestParams basicParamsSet;
+ CPUSpecificParams cpuParams;
+ SegmentMaxSpecificParams SegmentMaxPar;
+ std::tie(basicParamsSet, cpuParams) = obj.param;
+ std::string td;
+ ElementType dataPrecision;
+ bool useNumSegments;
+ ov::test::utils::InputLayerType secondaryInputType;
+ std::tie(SegmentMaxPar, dataPrecision, useNumSegments, secondaryInputType, td) = basicParamsSet;
+
+ InputShape dataShape;
+ std::vector<int64_t> segmentIdsValues;
+ int64_t numSegments;
+ ov::op::FillMode fillMode;
+ std::tie(dataShape, segmentIdsValues, numSegments, fillMode) = SegmentMaxPar;
+ std::ostringstream result;
+
+ result << ov::test::utils::partialShape2str({ dataShape.first }) << "_";
+ result << "TS=";
+ result << "(";
+ for (const auto& targetShape : dataShape.second) {
+ result << ov::test::utils::vec2str(targetShape);
+ }
+ result << ")";
+ result << "_segmentIds=" << ov::test::utils::vec2str(segmentIdsValues);
+ if (useNumSegments) {
+ result << "_numSegments=" << numSegments;
+ }
+ result << "_dataPrecision=" << dataPrecision;
+ result << "_secondaryInputType=" << secondaryInputType;
+ result << CPUTestsBase::getTestCaseName(cpuParams);
+
+ return result.str();
+ }
+
+void SegmentMaxLayerCPUTest::generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) {
+ inputs.clear();
+ const auto& funcInputs = function->inputs();
+ const auto dataType = funcInputs[0].get_element_type();
+ const auto& dataShape = targetInputStaticShapes[0];
+
+ ov::test::utils::InputGenerateData in_data;
+ in_data.start_from = 0;
+ in_data.range = 10;
+ const auto dataTensor = ov::test::utils::create_and_fill_tensor(dataType, dataShape, in_data);
+ inputs.insert({funcInputs[0].get_node_shared_ptr(), dataTensor});
+
+ const auto secondaryInputType = std::get<3>(std::get<0>(this->GetParam()));
+ if (secondaryInputType == ov::test::utils::InputLayerType::PARAMETER) {
+ const auto segmentIdsTensor = ov::test::utils::create_and_fill_tensor(
+ ov::element::i32,
+ {dataShape[0]},
+ 0,
+ 20);
+ inputs.insert({funcInputs[1].get_node_shared_ptr(), segmentIdsTensor});
+
+ const auto useNumSegments = std::get<2>(std::get<0>(this->GetParam()));
+ if (useNumSegments) {
+ const auto numSegmentsValue = std::get<2>(std::get<0>(std::get<0>(this->GetParam())));
+ const auto numSegmentsTensor = ov::test::utils::create_and_fill_tensor(
+ funcInputs[2].get_element_type(),
+ {},
+ static_cast<unsigned int>(numSegmentsValue));
+ inputs.insert({funcInputs[2].get_node_shared_ptr(), numSegmentsTensor});
+ }
+ }
+}
+
+void SegmentMaxLayerCPUTest::SetUp() {
+ SegmentMaxLayerTestParams basicParamsSet;
+ CPUSpecificParams cpuParams;
+ std::tie(basicParamsSet, cpuParams) = this->GetParam();
+ std::tie(inFmts, outFmts, priority, selectedType) = cpuParams;
+
+ SegmentMaxSpecificParams SegmentMaxParams;
+ ElementType inputPrecision;
+ bool useNumSegments;
+ ov::test::utils::InputLayerType secondaryInputType;
+ std::tie(SegmentMaxParams, inputPrecision, useNumSegments, secondaryInputType, targetDevice) = basicParamsSet;
+
+ InputShape dataShape;
+ std::vector<int64_t> segmentIdsValues;
+ int64_t numSegmentsValue;
+ ov::op::FillMode fillMode;
+ std::tie(dataShape, segmentIdsValues, numSegmentsValue, fillMode) = SegmentMaxParams;
+ const ov::test::InputShape segmentIdsShape = {
+ ov::PartialShape{static_cast<ov::Dimension::value_type>(segmentIdsValues.size())}, std::vector<ov::Shape>{segmentIdsValues.size()}
+ };
+
+ std::vector<ov::test::InputShape> input_shapes = { dataShape, segmentIdsShape };
+ if (useNumSegments) {
+ const ov::test::InputShape numSegmentsShape = {
+ ov::PartialShape{}, std::vector<ov::Shape>{ov::Shape{}}
+ };
+ input_shapes.emplace_back(numSegmentsShape);
+ }
+ init_input_shapes(input_shapes);
+ auto dataParameter = std::make_shared<ov::op::v0::Parameter>(inputPrecision, inputDynamicShapes[0]);
+ ov::ParameterVector params{ dataParameter };
+ std::shared_ptr<ov::Node> segmentMax;
+ if (secondaryInputType == ov::test::utils::InputLayerType::CONSTANT) {
+ auto segmentIdsConst = std::make_shared<ov::op::v0::Constant>(ov::element::i32, ov::Shape{segmentIdsValues.size()}, segmentIdsValues);
+ if (useNumSegments) {
+ auto numSegmentsConst = std::make_shared<ov::op::v0::Constant>(ov::element::i32, ov::Shape{}, numSegmentsValue);
+ segmentMax = std::make_shared<ov::op::v16::SegmentMax>(dataParameter, segmentIdsConst, numSegmentsConst, fillMode);
+ } else {
+ segmentMax = std::make_shared<ov::op::v16::SegmentMax>(dataParameter, segmentIdsConst, fillMode);
+ }
+
+ } else {
+ auto segmentIdsParameter = std::make_shared<ov::op::v0::Parameter>(ov::element::i32, ov::Shape{segmentIdsValues.size()});
+ params.push_back(segmentIdsParameter);
+ if (useNumSegments) {
+ auto numSegmentsParameter = std::make_shared<ov::op::v0::Parameter>(ov::element::i32, ov::Shape{});
+ segmentMax = std::make_shared<ov::op::v16::SegmentMax>(dataParameter, segmentIdsParameter, numSegmentsParameter, fillMode);
+ params.push_back(numSegmentsParameter);
+ } else {
+ segmentMax = std::make_shared<ov::op::v16::SegmentMax>(dataParameter, segmentIdsParameter, fillMode);
+ }
+ }
+ function = makeNgraphFunction(inputPrecision, params, segmentMax, "SegmentMax");
+}
+
+TEST_P(SegmentMaxLayerCPUTest, CompareWithRefs) {
+ run();
+ CheckPluginRelatedResults(compiledModel, "SegmentMax");
+}
+
+const std::vector<ov::test::utils::InputLayerType> secondaryInputTypes = {ov::test::utils::InputLayerType::CONSTANT,
+ ov::test::utils::InputLayerType::PARAMETER};
+
+const std::vector<SegmentMaxSpecificParams> SegmentMaxParamsVector = {
+ // Simple test case
+ SegmentMaxSpecificParams {
+ InputShape{{}, {{4}}},
+ std::vector<int64_t>{0, 0, 3, 3},
+ 5,
+ ov::op::FillMode::ZERO
+ },
+ // 2D data
+ SegmentMaxSpecificParams {
+ InputShape{{}, {{6, 6}}},
+ std::vector<int64_t>{0, 0, 3, 3, 9, 10},
+ 3,
+ ov::op::FillMode::LOWEST
+ },
+ // 5D data
+ SegmentMaxSpecificParams {
+ InputShape{{}, {{6, 6, 3, 1, 1}}},
+ std::vector<int64_t>{0, 0, 3, 3, 9, 10},
+ 3,
+ ov::op::FillMode::ZERO
+ },
+ // Empty data tensor
+ SegmentMaxSpecificParams {
+ InputShape{{}, {{5, 0}}},
+ std::vector<int64_t>{0, 3, 3, 9, 10},
+ 4,
+ ov::op::FillMode::LOWEST
+ },
+ // single segment
+ SegmentMaxSpecificParams {
+ InputShape{{}, {{5, 3}}},
+ std::vector<int64_t>{0, 0, 0, 0, 0},
+ 4,
+ ov::op::FillMode::ZERO
+ },
+ // numSegments = 0
+ SegmentMaxSpecificParams {
+ InputShape{{}, {{5, 7}}},
+ std::vector<int64_t>{0, 3, 3, 9, 10},
+ 0,
+ ov::op::FillMode::LOWEST
+ },
+ // Sequential dynamic inputs
+ SegmentMaxSpecificParams {
+ InputShape{{-1, -1}, {{5, 7}, {5, 15}, {5, 0}}},
+ std::vector<int64_t>{0, 3, 3, 9, 10},
+ 12,
+ ov::op::FillMode::ZERO
+ },
+ // Sequential dynamic inputs with ranges
+ SegmentMaxSpecificParams {
+ InputShape{{{0, 10}, {-1, 16}}, {{5, 7}, {5, 15}, {5, 0}}},
+ std::vector<int64_t>{0, 3, 3, 9, 10},
+ 12,
+ ov::op::FillMode::LOWEST
+ },
+};
+
+} // namespace SegmentMax
+} // namespace test
+} // namespace ov
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/segment_max.hpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/segment_max.hpp
new file mode 100644
index 00000000000..6e2c295f39b
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/segment_max.hpp
@@ -0,0 +1,48 @@
+// Copyright (C) 2018-2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include "shared_test_classes/base/ov_subgraph.hpp"
+#include "common_test_utils/ov_tensor_utils.hpp"
+#include "utils/fusing_test_utils.hpp"
+#include "utils/cpu_test_utils.hpp"
+#include "gtest/gtest.h"
+
+namespace ov {
+namespace test {
+namespace SegmentMax {
+using SegmentMaxSpecificParams = std::tuple<
+ InputShape,
+ std::vector<int64_t>,
+ int64_t,
+ ov::op::FillMode
+>;
+
+using SegmentMaxLayerTestParams = std::tuple<
+ SegmentMaxSpecificParams,
+ ElementType,
+ bool,
+ ov::test::utils::InputLayerType,
+ ov::test::TargetDevice
+>;
+
+using SegmentMaxLayerCPUTestParamsSet = std::tuple<
+ SegmentMaxLayerTestParams,
+ CPUTestUtils::CPUSpecificParams>;
+
+class SegmentMaxLayerCPUTest : public testing::WithParamInterface<SegmentMaxLayerCPUTestParamsSet>,
+ public SubgraphBaseTest, public CPUTestUtils::CPUTestsBase {
+public:
+ static std::string getTestCaseName(testing::TestParamInfo<SegmentMaxLayerCPUTestParamsSet> obj);
+protected:
+ void SetUp() override;
+ void generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) override;
+};
+
+extern const std::vector<SegmentMaxSpecificParams> SegmentMaxParamsVector;
+extern const std::vector<ov::test::utils::InputLayerType> secondaryInputTypes;
+} // namespace SegmentMax
+} // namespace test
+} // namespace ov
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/segment_max.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/segment_max.cpp
new file mode 100644
index 00000000000..e9dd7d79dfe
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/segment_max.cpp
@@ -0,0 +1,48 @@
+// Copyright (C) 2018-2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "custom/single_layer_tests/classes/segment_max.hpp"
+#include "utils/cpu_test_utils.hpp"
+#include "utils/fusing_test_utils.hpp"
+
+using namespace CPUTestUtils;
+
+namespace ov {
+namespace test {
+namespace SegmentMax {
+INSTANTIATE_TEST_SUITE_P(smoke_SegmentMaxLayoutTestF32, SegmentMaxLayerCPUTest,
+ ::testing::Combine(
+ ::testing::Combine(
+ ::testing::ValuesIn(SegmentMaxParamsVector),
+ ::testing::ValuesIn(std::vector<ElementType>{ElementType::f32, ElementType::f16}),
+ ::testing::Bool(),
+ ::testing::ValuesIn(secondaryInputTypes),
+ ::testing::Values(ov::test::utils::DEVICE_CPU)),
+ ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref_f32"})),
+ SegmentMaxLayerCPUTest::getTestCaseName);
+
+INSTANTIATE_TEST_SUITE_P(smoke_SegmentMaxLayoutTestI32, SegmentMaxLayerCPUTest,
+ ::testing::Combine(
+ ::testing::Combine(
+ ::testing::ValuesIn(SegmentMaxParamsVector),
+ ::testing::Values(ElementType::i32),
+ ::testing::Bool(),
+ ::testing::ValuesIn(secondaryInputTypes),
+ ::testing::Values(ov::test::utils::DEVICE_CPU)),
+ ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref_i32"})),
+ SegmentMaxLayerCPUTest::getTestCaseName);
+
+INSTANTIATE_TEST_SUITE_P(smoke_SegmentMaxLayoutTestUI8, SegmentMaxLayerCPUTest,
+ ::testing::Combine(
+ ::testing::Combine(
+ ::testing::ValuesIn(SegmentMaxParamsVector),
+ ::testing::Values(ElementType::u8, ElementType::i8),
+ ::testing::Bool(),
+ ::testing::ValuesIn(secondaryInputTypes),
+ ::testing::Values(ov::test::utils::DEVICE_CPU)),
+ ::testing::Values(CPUSpecificParams{{}, {}, {}, "ref_i8"})),
+ SegmentMaxLayerCPUTest::getTestCaseName);
+} // namespace SegmentMax
+} // namespace test
+} // namespace ov