Skip to content

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

[CPU][TESTS] Added CPU func tests for Comparison and Logical ops (#31492)

Alexandra Sidorova98157dd2b048
diff --git a/.github/workflows/linux_riscv_xuantie_dev_cpu.yml b/.github/workflows/linux_riscv_xuantie_dev_cpu.yml
index 07e67e97a6e..4500f5fa1d1 100644
--- a/.github/workflows/linux_riscv_xuantie_dev_cpu.yml
+++ b/.github/workflows/linux_riscv_xuantie_dev_cpu.yml
@@ -19,6 +19,14 @@ on:
- 'src/plugins/intel_cpu/src/nodes/executors/aarch64/**'
- 'src/plugins/intel_cpu/src/nodes/executors/shl/**'
- 'src/plugins/intel_cpu/src/nodes/kernels/riscv64/**'
+ - 'src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/activation.*'
+ - 'src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/comparison.*'
+ - 'src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/eltwise.*'
+ - 'src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/logical.*'
+ - 'src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/activation.*'
+ - 'src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/comparison.*'
+ - 'src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/eltwise.*'
+ - 'src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/logical.*'
- 'src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/riscv64/**'
- 'src/plugins/intel_cpu/thirdparty/xbyak_riscv/**'
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/comparison.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/comparison.cpp
new file mode 100644
index 00000000000..d2a947c261c
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/comparison.cpp
@@ -0,0 +1,192 @@
+// Copyright (C) 2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "comparison.hpp"
+
+#include "internal_properties.hpp"
+#include "utils/general_utils.h"
+#include "utils/precision_support.h"
+#include "common_test_utils/node_builders/comparison.hpp"
+
+#if defined(OPENVINO_ARCH_RISCV64)
+# include "nodes/kernels/riscv64/cpu_isa_traits.hpp"
+#endif
+
+using namespace CPUTestUtils;
+using namespace ov::test::utils;
+
+namespace ov {
+namespace test {
+std::string ComparisonLayerCPUTest::getTestCaseName(const testing::TestParamInfo<ComparisonLayerCPUTestParamSet> &obj) {
+ const auto& [shapes, comparisonType, secondInType, modelPrc, inferPrc, enforceSnippets] = obj.param;
+
+ std::ostringstream result;
+ result << "IS=(";
+ for (const auto& shape : shapes) {
+ result << ov::test::utils::partialShape2str({shape.first}) << "_";
+ }
+ result << ")_TS=(";
+ for (const auto& shape : shapes) {
+ for (const auto& item : shape.second) {
+ result << ov::test::utils::vec2str(item) << "_";
+ }
+ }
+ result << "OpType=" << comparisonType << "_";
+ result << "secondInType=" << secondInType << "_";
+ result << "modelPrc=" << modelPrc.to_string() << "_";
+ result << "inferPrc=" << inferPrc.to_string() << "_";
+ result << "_enforceSnippets=" << enforceSnippets;
+
+ return result.str();
+}
+
+void ComparisonLayerCPUTest::SetUp() {
+ const auto& [shapes, comparisonType, secondInType, modelPrc, inferPrc, enforceSnippets] = this->GetParam();
+ targetDevice = ov::test::utils::DEVICE_CPU;
+
+ // we have to change model precision as well, otherwise inference precision won't affect single-node graph
+ // due to enforce inference precision optimization for the eltwise as first node of the model
+ const auto currModelPrc = ov::element::Type(modelPrc).is_real() ? inferPrc : modelPrc;
+
+ const auto primitiveType = getPrimitiveType(comparisonType, currModelPrc);
+ const auto primiticePrcType =
+ ov::intel_cpu::any_of(primitiveType, "ref", "acl") ? ov::element::f32.to_string() : currModelPrc.to_string();
+ selectedType = primitiveType.empty() ? "" : primitiveType + "_" + primiticePrcType;
+
+ init_input_shapes(shapes);
+
+ if (enforceSnippets) {
+ configuration.insert(ov::intel_cpu::snippets_mode(ov::intel_cpu::SnippetsMode::IGNORE_CALLBACK));
+ } else {
+ configuration.insert(ov::intel_cpu::snippets_mode(ov::intel_cpu::SnippetsMode::DISABLE));
+ }
+ configuration.insert(ov::hint::inference_precision(inferPrc));
+
+ ov::ParameterVector params {std::make_shared<ov::op::v0::Parameter>(currModelPrc, inputDynamicShapes[0])};
+
+ std::shared_ptr<ov::Node> secondInput;
+ if (ov::test::utils::InputLayerType::CONSTANT == secondInType) {
+ auto tensor = ov::test::utils::create_and_fill_tensor(currModelPrc, targetStaticShapes[0][1]);
+ secondInput = std::make_shared<ov::op::v0::Constant>(tensor);
+ } else {
+ auto param = std::make_shared<ov::op::v0::Parameter>(currModelPrc, inputDynamicShapes[1]);
+ secondInput = param;
+ params.push_back(param);
+ }
+ const auto comparison_node = ov::test::utils::make_comparison(params[0], secondInput, comparisonType);
+
+ function = makeNgraphFunction(currModelPrc, params, comparison_node, "Comparison");
+}
+
+std::string ComparisonLayerCPUTest::getPrimitiveType(const utils::ComparisonTypes& type, ov::element::Type modelType) const {
+#if defined(OPENVINO_ARCH_ARM64)
+ return "jit";
+#endif
+#if defined(OPENVINO_ARCH_ARM) && defined(OV_CPU_WITH_ACL)
+ // TODO [171225] : On ARM there is ACL executor support which requires U8 on output.
+ // This requirement is not met in Eltwise CPU node - ref impl is used.
+ return modelType == ov::element::i32 ? "acl" : "ref";
+#endif
+#if defined(OPENVINO_ARCH_RISCV64)
+ if (ov::intel_cpu::riscv64::mayiuse(ov::intel_cpu::riscv64::gv)) {
+ if (ov::intel_cpu::any_of(type, utils::ComparisonTypes::EQUAL,
+ utils::ComparisonTypes::NOT_EQUAL,
+ utils::ComparisonTypes::LESS,
+ utils::ComparisonTypes::LESS_EQUAL,
+ utils::ComparisonTypes::GREATER_EQUAL))
+ return "jit";
+ }
+#endif
+ return CPUTestsBase::getPrimitiveType();
+}
+
+TEST_P(ComparisonLayerCPUTest, CompareWithRefs) {
+ run();
+ CheckPluginRelatedResults(compiledModel, std::set<std::string>{"Eltwise", "Subgraph"});
+}
+
+namespace comparison {
+
+const std::vector<std::vector<InputShape>>& inShapesWithParameter() {
+ static const std::vector<std::vector<InputShape>> shapes {
+ {
+ { {}, {{3, 33, 245}} },
+ { {}, {{1, 33, 245}} },
+ },
+ {
+ { {-1, -1}, {{3, 128}, {3, 128}, {5, 1}, {3, 128}} },
+ { {-1, -1}, {{3, 128}, {1, 1}, {5, 128}, {3, 128}} }
+ },
+ };
+
+ return shapes;
+}
+
+const std::vector<std::vector<InputShape>>& inShapesWithConstant() {
+ static const std::vector<std::vector<InputShape>> shapes {
+ {
+ { {}, {{3, 33, 245}} },
+ { {}, {{1, 1, 1}} },
+ },
+ {
+ { {-1, -1}, {{5, 197}, {1, 197}, {1, 1}, {5, 197}} },
+ { {}, {{1, 1}} }
+ },
+ };
+
+ return shapes;
+}
+
+const std::vector<utils::ComparisonTypes>& comparisonTypes() {
+ static const std::vector<utils::ComparisonTypes> types {
+ utils::ComparisonTypes::EQUAL,
+ utils::ComparisonTypes::NOT_EQUAL,
+ utils::ComparisonTypes::GREATER,
+ utils::ComparisonTypes::GREATER_EQUAL,
+ utils::ComparisonTypes::LESS,
+ utils::ComparisonTypes::LESS_EQUAL,
+ };
+
+ return types;
+}
+
+const std::vector<bool>& enforceSnippets() {
+ static const std::vector<bool> enforce = {
+#if defined(OPENVINO_ARCH_ARM64) || defined(OPENVINO_ARCH_X86_64)
+ true,
+#endif
+ false
+ };
+
+ return enforce;
+}
+
+const std::vector<ov::element::Type>& modelPrc() {
+ static const std::vector<ov::element::Type> prc {
+ ov::element::i32,
+ ov::element::f32,
+ ov::element::f16,
+ };
+
+ return prc;
+}
+
+const std::vector<ov::element::Type> inferPrc() {
+ std::vector<ov::element::Type> prc {
+ ov::element::f32
+ };
+ if (ov::intel_cpu::hasHardwareSupport(ov::element::f16)) {
+ prc.push_back(ov::element::f16);
+ }
+ if (ov::intel_cpu::hasHardwareSupport(ov::element::bf16)) {
+ prc.push_back(ov::element::bf16);
+ }
+
+ return prc;
+}
+
+} // namespace comparison
+
+} // namespace test
+} // namespace ov
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/comparison.hpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/comparison.hpp
new file mode 100644
index 00000000000..480b314d6ed
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/comparison.hpp
@@ -0,0 +1,53 @@
+// Copyright (C) 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 "common_test_utils/test_enums.hpp"
+#include "utils/cpu_test_utils.hpp"
+#include "gtest/gtest.h"
+#include "common_test_utils/test_enums.hpp"
+
+namespace ov {
+namespace test {
+
+using ComparisonLayerCPUTestParamSet =
+ std::tuple<std::vector<ov::test::InputShape>, // Input shapes
+ utils::ComparisonTypes, // Comparison type
+ ov::test::utils::InputLayerType, // Second input type
+ ov::element::Type, // Model precision
+ ov::element::Type, // Infer precision
+ bool>; // Enforce Snippets
+
+class ComparisonLayerCPUTest : public testing::WithParamInterface<ComparisonLayerCPUTestParamSet>,
+ virtual public ov::test::SubgraphBaseTest,
+ public CPUTestUtils::CPUTestsBase {
+public:
+ static std::string getTestCaseName(const testing::TestParamInfo<ComparisonLayerCPUTestParamSet> &obj);
+
+protected:
+ void SetUp() override;
+
+private:
+ std::string getPrimitiveType(const utils::ComparisonTypes& comparison_type, ov::element::Type modelType) const;
+};
+
+namespace comparison {
+
+const std::vector<std::vector<InputShape>>& inShapesWithParameter();
+const std::vector<std::vector<InputShape>>& inShapesWithConstant();
+
+const std::vector<utils::ComparisonTypes>& comparisonTypes();
+const std::vector<bool>& enforceSnippets();
+
+const std::vector<ov::element::Type>& modelPrc();
+const std::vector<ov::element::Type> inferPrc();
+
+} // namespace comparison
+
+} // namespace test
+} // namespace ov
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/logical.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/logical.cpp
new file mode 100644
index 00000000000..aaf25405478
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/logical.cpp
@@ -0,0 +1,178 @@
+// Copyright (C) 2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "logical.hpp"
+
+#include "internal_properties.hpp"
+#include "utils/general_utils.h"
+#include "common_test_utils/node_builders/logical.hpp"
+#include "openvino/op/logical_not.hpp"
+
+#if defined(OPENVINO_ARCH_RISCV64)
+# include "nodes/kernels/riscv64/cpu_isa_traits.hpp"
+#endif
+
+using namespace CPUTestUtils;
+using namespace ov::test::utils;
+
+namespace ov {
+namespace test {
+std::string LogicalLayerCPUTest::getTestCaseName(const testing::TestParamInfo<LogicalLayerCPUTestParamSet> &obj) {
+ const auto& [shapes, logicalType, secondInType, enforceSnippets] = obj.param;
+
+ std::ostringstream result;
+ result << "IS=(";
+ for (size_t i = 0lu; i < shapes.size(); i++) {
+ result << ov::test::utils::partialShape2str({shapes[i].first}) << (i < shapes.size() - 1lu ? "_" : "");
+ }
+ result << ")_TS=";
+ for (size_t i = 0lu; i < shapes.front().second.size(); i++) {
+ result << "{";
+ for (size_t j = 0lu; j < shapes.size(); j++) {
+ result << ov::test::utils::vec2str(shapes[j].second[i]) << (j < shapes.size() - 1lu ? "_" : "");
+ }
+ result << "}_";
+ }
+ result << "OpType=" << logicalType << "_";
+ if (ov::test::utils::LogicalTypes::LOGICAL_NOT != logicalType) {
+ result << "secondInType=" << secondInType << "_";
+ }
+ result << "_enforceSnippets=" << enforceSnippets;
+
+ return result.str();
+}
+
+void LogicalLayerCPUTest::SetUp() {
+ const auto& [shapes, logicalType, secondInType, enforceSnippets] = this->GetParam();
+ targetDevice = ov::test::utils::DEVICE_CPU;
+
+ const auto primitiveType = getPrimitiveType(logicalType);
+ const auto primiticePrcType = primitiveType == "ref" ? ov::element::f32.to_string() : "I8";
+ selectedType = primitiveType.empty() ? "" : primitiveType + "_" + primiticePrcType;
+
+ init_input_shapes(shapes);
+
+ if (enforceSnippets) {
+ configuration.insert(ov::intel_cpu::snippets_mode(ov::intel_cpu::SnippetsMode::IGNORE_CALLBACK));
+ } else {
+ configuration.insert(ov::intel_cpu::snippets_mode(ov::intel_cpu::SnippetsMode::DISABLE));
+ }
+
+ const auto prc = ov::element::boolean; // Because ngraph supports only boolean input for logical ops
+ ov::ParameterVector params {std::make_shared<ov::op::v0::Parameter>(prc, inputDynamicShapes[0])};
+
+ std::shared_ptr<ov::Node> logical_node;
+ if (ov::test::utils::LogicalTypes::LOGICAL_NOT != logicalType) {
+ std::shared_ptr<ov::Node> secondInput;
+ if (ov::test::utils::InputLayerType::CONSTANT == secondInType) {
+ auto tensor = ov::test::utils::create_and_fill_tensor(prc, targetStaticShapes[0][1]);
+ secondInput = std::make_shared<ov::op::v0::Constant>(tensor);
+ } else {
+ auto param = std::make_shared<ov::op::v0::Parameter>(prc, inputDynamicShapes[1]);
+ secondInput = param;
+ params.push_back(param);
+ }
+ logical_node = ov::test::utils::make_logical(params[0], secondInput, logicalType);
+ } else {
+ logical_node = std::make_shared<ov::op::v1::LogicalNot>(params[0]);
+ }
+
+ function = makeNgraphFunction(prc, params, logical_node, "Logical");
+}
+
+std::string LogicalLayerCPUTest::getPrimitiveType(const utils::LogicalTypes& type) const {
+#if defined(OPENVINO_ARCH_ARM64)
+ return "jit";
+#endif
+#if defined(OPENVINO_ARCH_ARM)
+ return "ref";
+#endif
+#if defined(OPENVINO_ARCH_RISCV64)
+ if (ov::intel_cpu::riscv64::mayiuse(ov::intel_cpu::riscv64::gv)) {
+ return "jit";
+ }
+#endif
+ return CPUTestsBase::getPrimitiveType();
+}
+
+TEST_P(LogicalLayerCPUTest, CompareWithRefs) {
+ run();
+ CheckPluginRelatedResults(compiledModel, std::set<std::string>{"Eltwise", "Subgraph"});
+}
+
+namespace logical {
+
+const std::vector<std::vector<InputShape>>& inUnaryShapes() {
+ static const std::vector<std::vector<InputShape>> shapes {
+ {
+ { {}, {{3, 33, 245}} }
+ },
+ {
+ { {-1, -1}, {{3, 128}, {3, 128}, {5, 1}, {1, 128}} }
+ },
+ };
+
+ return shapes;
+}
+
+const std::vector<std::vector<InputShape>>& inBinaryShapes() {
+ static const std::vector<std::vector<InputShape>> shapes {
+ {
+ { {}, {{3, 33, 245}} },
+ { {}, {{1, 33, 245}} },
+ },
+ {
+ { {}, {{3, 33, 245}} },
+ { {}, {{1, 1, 1}} },
+ },
+ {
+ { {-1, -1}, {{3, 128}, {3, 128}, {5, 1}, {3, 128}} },
+ { {-1, -1}, {{3, 128}, {1, 1}, {5, 128}, {3, 128}} }
+ },
+ };
+
+ return shapes;
+}
+
+const std::vector<ov::test::utils::InputLayerType>& secondInTypes() {
+ static const std::vector<ov::test::utils::InputLayerType> types {
+ ov::test::utils::InputLayerType::PARAMETER,
+ };
+
+ return types;
+}
+
+const std::vector<utils::LogicalTypes>& logicalUnaryTypes() {
+ static const std::vector<utils::LogicalTypes> types {
+ utils::LogicalTypes::LOGICAL_NOT
+ };
+
+ return types;
+}
+
+const std::vector<utils::LogicalTypes>& logicalBinaryTypes() {
+ static const std::vector<utils::LogicalTypes> types {
+ utils::LogicalTypes::LOGICAL_AND,
+ utils::LogicalTypes::LOGICAL_XOR,
+ utils::LogicalTypes::LOGICAL_OR
+ };
+
+ return types;
+}
+
+const std::vector<bool>& enforceSnippets() {
+ static const std::vector<bool> enforce = {
+#if defined(OPENVINO_ARCH_ARM64) || defined(OPENVINO_ARCH_X86_64)
+ true,
+#endif
+ false
+ };
+
+ return enforce;
+}
+
+} // namespace logical
+
+} // namespace test
+} // namespace ov
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/logical.hpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/logical.hpp
new file mode 100644
index 00000000000..4da46974397
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/logical.hpp
@@ -0,0 +1,51 @@
+// Copyright (C) 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 "common_test_utils/test_enums.hpp"
+#include "utils/cpu_test_utils.hpp"
+#include "gtest/gtest.h"
+#include "common_test_utils/test_enums.hpp"
+
+namespace ov {
+namespace test {
+
+using LogicalLayerCPUTestParamSet =
+ std::tuple<std::vector<ov::test::InputShape>, // Input shapes
+ utils::LogicalTypes, // Logical type
+ ov::test::utils::InputLayerType, // Second input type
+ bool>; // Enforce Snippets
+
+class LogicalLayerCPUTest : public testing::WithParamInterface<LogicalLayerCPUTestParamSet>,
+ virtual public ov::test::SubgraphBaseTest,
+ public CPUTestUtils::CPUTestsBase {
+public:
+ static std::string getTestCaseName(const testing::TestParamInfo<LogicalLayerCPUTestParamSet> &obj);
+
+protected:
+ void SetUp() override;
+
+private:
+ std::string getPrimitiveType(const utils::LogicalTypes& logical_type) const;
+};
+
+namespace logical {
+
+const std::vector<std::vector<InputShape>>& inUnaryShapes();
+const std::vector<std::vector<InputShape>>& inBinaryShapes();
+const std::vector<ov::test::utils::InputLayerType>& secondInTypes();
+
+const std::vector<utils::LogicalTypes>& logicalUnaryTypes();
+const std::vector<utils::LogicalTypes>& logicalBinaryTypes();
+
+const std::vector<bool>& enforceSnippets();
+
+} // namespace logical
+
+} // namespace test
+} // namespace ov
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/comparison.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/comparison.cpp
new file mode 100644
index 00000000000..7eff84918b1
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/comparison.cpp
@@ -0,0 +1,35 @@
+// Copyright (C) 2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "custom/single_layer_tests/classes/comparison.hpp"
+
+using namespace CPUTestUtils;
+
+namespace ov {
+namespace test {
+namespace comparison {
+
+const auto withParameterCases = ::testing::Combine(
+ ::testing::ValuesIn(inShapesWithParameter()),
+ ::testing::ValuesIn(comparisonTypes()),
+ ::testing::Values(ov::test::utils::InputLayerType::PARAMETER),
+ ::testing::ValuesIn(modelPrc()),
+ ::testing::ValuesIn(inferPrc()),
+ ::testing::ValuesIn(enforceSnippets())
+);
+INSTANTIATE_TEST_SUITE_P(smoke_Comparison_WithParameter, ComparisonLayerCPUTest, withParameterCases, ComparisonLayerCPUTest::getTestCaseName);
+
+const auto withConstantCases = ::testing::Combine(
+ ::testing::ValuesIn(inShapesWithConstant()),
+ ::testing::ValuesIn(comparisonTypes()),
+ ::testing::Values(ov::test::utils::InputLayerType::CONSTANT),
+ ::testing::ValuesIn(modelPrc()),
+ ::testing::ValuesIn(inferPrc()),
+ ::testing::ValuesIn(enforceSnippets())
+);
+INSTANTIATE_TEST_SUITE_P(smoke_Comparison_WithConstant, ComparisonLayerCPUTest, withConstantCases, ComparisonLayerCPUTest::getTestCaseName);
+
+} // namespace comparison
+} // namespace test
+} // namespace ov
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/logical.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/logical.cpp
new file mode 100644
index 00000000000..5a145282da8
--- /dev/null
+++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/logical.cpp
@@ -0,0 +1,31 @@
+// Copyright (C) 2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "custom/single_layer_tests/classes/logical.hpp"
+
+using namespace CPUTestUtils;
+
+namespace ov {
+namespace test {
+namespace logical {
+
+const auto unaryCases = ::testing::Combine(
+ ::testing::ValuesIn(inUnaryShapes()),
+ ::testing::ValuesIn(logicalUnaryTypes()),
+ ::testing::Values(ov::test::utils::InputLayerType::CONSTANT), // skipped
+ ::testing::ValuesIn(enforceSnippets())
+);
+INSTANTIATE_TEST_SUITE_P(smoke_Logical_Unary, LogicalLayerCPUTest, unaryCases, LogicalLayerCPUTest::getTestCaseName);
+
+const auto binaryCases = ::testing::Combine(
+ ::testing::ValuesIn(inBinaryShapes()),
+ ::testing::ValuesIn(logicalBinaryTypes()),
+ ::testing::ValuesIn(secondInTypes()),
+ ::testing::ValuesIn(enforceSnippets())
+);
+INSTANTIATE_TEST_SUITE_P(smoke_Logical_Binary, LogicalLayerCPUTest, binaryCases, LogicalLayerCPUTest::getTestCaseName);
+
+} // namespace logical
+} // namespace test
+} // namespace ov
diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/logical.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/logical.cpp
deleted file mode 100644
index 5125f19ba82..00000000000
--- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/logical.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-// Copyright (C) 2018-2025 Intel Corporation
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include "shared_test_classes/single_op/logical.hpp"
-
-#include "common_test_utils/node_builders/logical.hpp"
-#include "common_test_utils/ov_tensor_utils.hpp"
-#include "shared_test_classes/base/ov_subgraph.hpp"
-#include "utils/cpu_test_utils.hpp"
-
-using namespace CPUTestUtils;
-
-namespace ov {
-namespace test {
-
-typedef std::tuple<ov::test::LogicalTestParams, CPUSpecificParams> LogicalLayerCPUTestParamSet;
-
-class LogicalLayerCPUTest : public testing::WithParamInterface<LogicalLayerCPUTestParamSet>,
- virtual public ov::test::SubgraphBaseTest,
- public CPUTestsBase {
-public:
- static std::string getTestCaseName(const testing::TestParamInfo<LogicalLayerCPUTestParamSet>& obj) {
- const auto& [basicParamsSet, cpuParams] = obj.param;
- std::ostringstream result;
- result << ov::test::LogicalLayerTest::getTestCaseName(
- testing::TestParamInfo<ov::test::LogicalTestParams>(basicParamsSet, 0));
-
- result << CPUTestsBase::getTestCaseName(cpuParams);
-
- return result.str();
- }
-
-protected:
- void SetUp() override {
- const auto& [basicParamsSet, cpuParams] = this->GetParam();
- std::tie(inFmts, outFmts, priority, selectedType) = cpuParams;
- std::string targetName;
- const auto& [inputShapes, logicalOpType, secondInputType, netPrecision, _targetDevice, additional_config] =
- basicParamsSet;
- targetDevice = _targetDevice;
- init_input_shapes(inputShapes);
-
- selectedType = getPrimitiveType() + "_" + ov::element::Type(inType).get_type_name();
-
- auto ngInputsPrc = ov::element::boolean; // Because ngraph supports only boolean input for logical ops
- configuration.insert(additional_config.begin(), additional_config.end());
-
- ov::ParameterVector inputs{std::make_shared<ov::op::v0::Parameter>(ngInputsPrc, inputDynamicShapes[0])};
- std::shared_ptr<ov::Node> logicalNode;
- if (logicalOpType != ov::test::utils::LogicalTypes::LOGICAL_NOT) {
- std::shared_ptr<ov::Node> secondInput;
- if (secondInputType == ov::test::utils::InputLayerType::PARAMETER) {
- auto param = std::make_shared<ov::op::v0::Parameter>(ngInputsPrc, inputDynamicShapes[1]);
- secondInput = param;
- inputs.push_back(param);
- } else {
- auto tensor = ov::test::utils::create_and_fill_tensor(ngInputsPrc, targetStaticShapes[0][1]);
- secondInput = std::make_shared<ov::op::v0::Constant>(tensor);
- }
- logicalNode = ov::test::utils::make_logical(inputs[0], secondInput, logicalOpType);
- } else {
- logicalNode = ov::test::utils::make_logical(inputs[0], ov::Output<ov::Node>(), logicalOpType);
- }
-
- logicalNode->get_rt_info() = getCPUInfo();
-
- function = std::make_shared<ov::Model>(logicalNode, inputs, "Logical");
- }
-};
-
-TEST_P(LogicalLayerCPUTest, CompareWithRefs) {
- run();
- CheckPluginRelatedResults(compiledModel, "Eltwise");
-}
-
-namespace {
-
-std::map<ov::Shape, std::vector<ov::Shape>> inputShapes = {
- {{1}, {{1}, {17}, {1, 1}, {2, 18}, {1, 1, 2}, {2, 2, 3}, {1, 1, 2, 3}}},
- {{5}, {{1}, {1, 1}, {2, 5}, {1, 1, 1}, {2, 2, 5}}},
- {{2, 200}, {{1}, {200}, {1, 200}, {2, 200}, {2, 2, 200}}},
- {{1, 3, 20}, {{20}, {2, 1, 1}}},
- {{2, 17, 3, 4}, {{4}, {1, 3, 4}, {2, 1, 3, 4}}},
- {{2, 1, 1, 3, 1}, {{1}, {1, 3, 4}, {2, 1, 3, 4}, {1, 1, 1, 1, 1}}},
-};
-
-std::map<ov::Shape, std::vector<ov::Shape>> inputShapesNot = {
- {{1}, {}},
- {{5}, {}},
- {{2, 200}, {}},
- {{1, 3, 20}, {}},
- {{2, 17, 3, 4}, {}},
- {{2, 1, 1, 3, 1}, {}},
-};
-
-std::vector<ov::test::utils::LogicalTypes> logicalOpTypes = {
- ov::test::utils::LogicalTypes::LOGICAL_AND,
- ov::test::utils::LogicalTypes::LOGICAL_OR,
- ov::test::utils::LogicalTypes::LOGICAL_XOR,
-};
-
-std::vector<ov::test::utils::InputLayerType> secondInputTypes = {
- ov::test::utils::InputLayerType::CONSTANT,
- ov::test::utils::InputLayerType::PARAMETER,
-};
-
-std::map<std::string, std::string> additional_config;
-
-std::vector<std::vector<ov::Shape>> combine_shapes(
- const std::map<ov::Shape, std::vector<ov::Shape>>& input_shapes_static) {
- std::vector<std::vector<ov::Shape>> result;
- for (const auto& input_shape : input_shapes_static) {
- for (auto& item : input_shape.second) {
- result.push_back({input_shape.first, item});
- }
-
- if (input_shape.second.empty()) {
- result.push_back({input_shape.first, {}});
- }
- }
- return result;
-}
-
-const auto LogicalTestParams = ::testing::Combine(
- ::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(combine_shapes(inputShapes))),
- ::testing::ValuesIn(logicalOpTypes),
- ::testing::ValuesIn(secondInputTypes),
- ::testing::Values(ov::element::bf16),
- ::testing::Values(ov::test::utils::DEVICE_CPU),
- ::testing::Values(additional_config)),
- ::testing::Values(emptyCPUSpec));
-
-const auto LogicalTestParamsNot = ::testing::Combine(
- ::testing::Combine(
- ::testing::ValuesIn(ov::test::static_shapes_to_test_representation(combine_shapes(inputShapesNot))),
- ::testing::Values(ov::test::utils::LogicalTypes::LOGICAL_NOT),
- ::testing::Values(ov::test::utils::InputLayerType::CONSTANT),
- ::testing::Values(ov::element::bf16),
- ::testing::Values(ov::test::utils::DEVICE_CPU),
- ::testing::Values(additional_config)),
- ::testing::Values(emptyCPUSpec));
-
-INSTANTIATE_TEST_SUITE_P(smoke_Logical_Eltwise_CPU_BF16,
- LogicalLayerCPUTest,
- LogicalTestParams,
- LogicalLayerCPUTest::getTestCaseName);
-
-INSTANTIATE_TEST_SUITE_P(smoke_Logical_Not_Eltwise_CPU_BF16,
- LogicalLayerCPUTest,
- LogicalTestParamsNot,
- LogicalLayerCPUTest::getTestCaseName);
-
-} // namespace
-} // namespace test
-} // namespace ov