From abc2899df84884a42cca4f7c64c6063d4af8290c Mon Sep 17 00:00:00 2001 From: Oleg Pipikin Date: Mon, 5 Feb 2024 09:31:34 +0100 Subject: [PATCH] Add test instantiations for template plugin (#22627) ### Details: - Add test instantiations for template plugin ### Tickets: - [CVS-130342](https://jira.devtools.intel.com/browse/CVS-130342) --- .../ov_infer_request/memory_states.cpp | 20 ++++ .../ov_infer_request/properties_tests.cpp | 21 ++++ .../behavior/ov_plugin/hetero_synthetic.cpp | 107 ++++++++++++++++++ .../behavior/ov_plugin/hetero_synthetic.hpp | 5 + .../behavior/ov_plugin/hetero_synthetic.cpp | 8 ++ 5 files changed, 161 insertions(+) create mode 100644 src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/memory_states.cpp create mode 100644 src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/properties_tests.cpp create mode 100644 src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_plugin/hetero_synthetic.cpp diff --git a/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/memory_states.cpp b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/memory_states.cpp new file mode 100644 index 00000000000000..6d8fd09d192786 --- /dev/null +++ b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/memory_states.cpp @@ -0,0 +1,20 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "behavior/ov_infer_request/memory_states.hpp" + +namespace { +using ov::test::behavior::memoryStateParams; +using ov::test::behavior::OVInferRequestVariableStateTest; + +std::vector memoryStateTestCases = {memoryStateParams(OVInferRequestVariableStateTest::get_network(), + {"c_1-3", "r_1-3"}, + ov::test::utils::DEVICE_TEMPLATE, + {})}; + +INSTANTIATE_TEST_SUITE_P(smoke_Template_BehaviorTests, + OVInferRequestVariableStateTest, + ::testing::ValuesIn(memoryStateTestCases), + OVInferRequestVariableStateTest::getTestCaseName); +} // namespace diff --git a/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/properties_tests.cpp b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/properties_tests.cpp new file mode 100644 index 00000000000000..8aae5e01116c62 --- /dev/null +++ b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/properties_tests.cpp @@ -0,0 +1,21 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "behavior/ov_infer_request/properties_tests.hpp" + +#include + +namespace { +using ov::test::behavior::InferRequestPropertiesTest; + +const std::vector configs = {{}}; + +INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, + InferRequestPropertiesTest, + ::testing::Combine(::testing::Values(1u), + ::testing::Values(ov::test::utils::DEVICE_TEMPLATE), + ::testing::ValuesIn(configs)), + InferRequestPropertiesTest::getTestCaseName); + +} // namespace diff --git a/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_plugin/hetero_synthetic.cpp b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_plugin/hetero_synthetic.cpp new file mode 100644 index 00000000000000..090ce0e32f1917 --- /dev/null +++ b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_plugin/hetero_synthetic.cpp @@ -0,0 +1,107 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "behavior/ov_plugin/hetero_synthetic.hpp" + +#include + +#include "common_test_utils/subgraph_builders/conv_pool_relu.hpp" +#include "common_test_utils/subgraph_builders/conv_pool_relu_non_zero.hpp" + +namespace { +using ov::test::behavior::OVHeteroSyntheticTest; +using ov::test::behavior::PluginParameter; + +// this tests load plugin by library name: this is not available during static linkage +#ifndef OPENVINO_STATIC_LIBRARY + +INSTANTIATE_TEST_SUITE_P(smoke_manyTargetInputs, + OVHeteroSyntheticTest, + ::testing::Combine(::testing::Values(std::vector{ + {"TEMPLATE0", "openvino_template_plugin"}, + {"TEMPLATE1", "openvino_template_plugin"}}), + ::testing::ValuesIn(OVHeteroSyntheticTest::withMajorNodesFunctions( + [] { + return ov::test::utils::make_conv_pool2_relu2(); + }, + {"Conv_1"}, + true))), + OVHeteroSyntheticTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_SingleMajorNode, + OVHeteroSyntheticTest, + ::testing::Combine(::testing::Values(std::vector{ + {"TEMPLATE0", "openvino_template_plugin"}, + {"TEMPLATE1", "openvino_template_plugin"}}), + ::testing::ValuesIn(OVHeteroSyntheticTest::_singleMajorNodeFunctions)), + OVHeteroSyntheticTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(nightly_RandomMajorNodes, + OVHeteroSyntheticTest, + ::testing::Combine(::testing::Values(std::vector{ + {"TEMPLATE0", "openvino_template_plugin"}, + {"TEMPLATE1", "openvino_template_plugin"}}), + ::testing::ValuesIn(OVHeteroSyntheticTest::_randomMajorNodeFunctions)), + OVHeteroSyntheticTest::getTestCaseName); + +static std::vector()>> dynamicBuilders = { + [] { + return ov::test::utils::make_conv_pool_relu_non_zero(); + }, +}; + +INSTANTIATE_TEST_SUITE_P( + smoke_NonZeroMajorNode_dynamic, + OVHeteroSyntheticTest, + ::testing::Combine(::testing::Values(std::vector{{"TEMPLATE0", "openvino_template_plugin"}, + {"TEMPLATE1", "openvino_template_plugin"}}), + ::testing::ValuesIn(OVHeteroSyntheticTest::withMajorNodesFunctions(dynamicBuilders.front(), + {"nonZero_1"}))), + OVHeteroSyntheticTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P( + smoke_NonZeroMajorNode_dynamic_batch, + OVHeteroSyntheticTest, + ::testing::Combine(::testing::Values(std::vector{{"TEMPLATE0", "openvino_template_plugin"}, + {"TEMPLATE1", "openvino_template_plugin"}}), + ::testing::ValuesIn(OVHeteroSyntheticTest::withMajorNodesFunctions(dynamicBuilders.front(), + {"nonZero_1"}, + true))), + OVHeteroSyntheticTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P( + smoke_SingleMajorNode_dynamic, + OVHeteroSyntheticTest, + ::testing::Combine(::testing::Values(std::vector{{"TEMPLATE0", "openvino_template_plugin"}, + {"TEMPLATE1", "openvino_template_plugin"}}), + ::testing::ValuesIn(OVHeteroSyntheticTest::singleMajorNodeFunctions(dynamicBuilders))), + OVHeteroSyntheticTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P( + nightly_RandomMajorNodes_dynamic, + OVHeteroSyntheticTest, + ::testing::Combine(::testing::Values(std::vector{{"TEMPLATE0", "openvino_template_plugin"}, + {"TEMPLATE1", "openvino_template_plugin"}}), + ::testing::ValuesIn(OVHeteroSyntheticTest::randomMajorNodeFunctions(dynamicBuilders))), + OVHeteroSyntheticTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P( + smoke_SingleMajorNode_dynamic_batch, + OVHeteroSyntheticTest, + ::testing::Combine(::testing::Values(std::vector{{"TEMPLATE0", "openvino_template_plugin"}, + {"TEMPLATE1", "openvino_template_plugin"}}), + ::testing::ValuesIn(OVHeteroSyntheticTest::singleMajorNodeFunctions(dynamicBuilders, true))), + OVHeteroSyntheticTest::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P( + nightly_RandomMajorNodes_dynamic_batch, + OVHeteroSyntheticTest, + ::testing::Combine(::testing::Values(std::vector{{"TEMPLATE0", "openvino_template_plugin"}, + {"TEMPLATE1", "openvino_template_plugin"}}), + ::testing::ValuesIn(OVHeteroSyntheticTest::randomMajorNodeFunctions(dynamicBuilders, true))), + OVHeteroSyntheticTest::getTestCaseName); + +#endif // !OPENVINO_STATIC_LIBRARY + +} // namespace diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_plugin/hetero_synthetic.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_plugin/hetero_synthetic.hpp index 53eac08ca97ded..3d9141df798c09 100644 --- a/src/tests/functional/plugin/shared/include/behavior/ov_plugin/hetero_synthetic.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/ov_plugin/hetero_synthetic.hpp @@ -55,6 +55,11 @@ class OVHeteroSyntheticTest : public testing::WithParamInterface randomMajorNodeFunctions( const std::vector()>>& builders, bool dynamic_batch = false, uint32_t seed = 0); + static std::vector withMajorNodesFunctions( + const std::function()>& builder, + const std::unordered_set& majorNodes, + bool dynamic_batch = false); + static std::vector _singleMajorNodeFunctions; static std::vector _randomMajorNodeFunctions; }; diff --git a/src/tests/functional/plugin/shared/src/behavior/ov_plugin/hetero_synthetic.cpp b/src/tests/functional/plugin/shared/src/behavior/ov_plugin/hetero_synthetic.cpp index 125735eb476fd1..232146386fe254 100644 --- a/src/tests/functional/plugin/shared/src/behavior/ov_plugin/hetero_synthetic.cpp +++ b/src/tests/functional/plugin/shared/src/behavior/ov_plugin/hetero_synthetic.cpp @@ -184,6 +184,14 @@ std::vector OVHeteroSyntheticTest::randomMajorNodeFunctions( return results; } +std::vector OVHeteroSyntheticTest::withMajorNodesFunctions(const std::function()>& builder, + const std::unordered_set& majorNodes, + bool dynamic_batch) { + auto function = builder(); + std::vector result; + result.push_back(FunctionParameter{majorNodes, function, dynamic_batch, 0}); + return result; +} std::vector OVHeteroSyntheticTest::_singleMajorNodeFunctions = OVHeteroSyntheticTest::singleMajorNodeFunctions(builders);