From 8f232278e3ef9c439cd30702f8d91e3a9bc38988 Mon Sep 17 00:00:00 2001 From: Oleg Pipikin Date: Wed, 7 Feb 2024 04:53:46 +0100 Subject: [PATCH] Cleaning and refactoring test utils (#22653) ### Details: - Cleaning and refactoring test utils ### Tickets: - [CVS-111359](https://jira.devtools.intel.com/browse/CVS-111359) --- .../fq_mul_fusion_test.cpp | 1 - .../src/concat_const_inplace.cpp | 1 + .../execution_graph_tests/add_output.cpp | 1 - .../concurrency/gpu_concurrency_tests.cpp | 13 +- .../gpu_remote_tensor_tests.cpp | 19 +- .../src/read_ir/read_ir.cpp | 2 +- .../include/base/behavior_test_utils.hpp | 188 ------ .../include/base/ov_behavior_test_utils.hpp | 4 +- .../compiled_model/compiled_model_base.hpp | 7 +- .../ov_infer_request/batched_tensors.hpp | 2 +- .../infer_request_dynamic.hpp | 4 +- .../behavior/ov_infer_request/inference.hpp | 2 +- .../ov_infer_request/inference_chaining.hpp | 2 +- .../ov_infer_request/iteration_chaining.hpp | 2 +- .../ov_infer_request/memory_states.hpp | 2 +- .../ov_infer_request/properties_tests.hpp | 5 +- .../ov_plugin/auto_batching_tests.hpp | 1 - .../behavior/ov_plugin/caching_tests.hpp | 1 - .../include/behavior/ov_plugin/version.hpp | 2 +- .../ov_infer_request/batched_tensors.cpp | 2 +- .../ov_infer_request/memory_states.cpp | 2 - .../num_inputs_fusing_bin_conv.cpp | 2 +- .../convolution_qdq_transformation.cpp | 2 - .../convolution_transformation.cpp | 2 - .../convolution_with_incorrect_weights.cpp | 2 - .../depth_to_space_transformation.cpp | 3 +- ...d_two_output_branches_with_convolution.cpp | 2 - .../fully_connected_transformation.cpp | 2 - .../fuse_convert_transformation.cpp | 2 - .../gemm_transformation.cpp | 2 - .../group_convolution_transformation.cpp | 2 - .../groupconvolution_qdq_transformation.cpp | 2 - .../mat_mul_with_optimized_constant_fq.cpp | 2 - .../move_fake_quantize_transformation.cpp | 1 - ...ly_to_group_convolution_transformation.cpp | 2 - .../mvn_transformation.cpp | 2 - .../normalize_transformation.cpp | 2 - .../output_layers_concat.cpp | 2 - .../output_layers_concat_multi_channel.cpp | 2 - ...put_layers_handling_in_transformations.cpp | 2 - ..._through_dequantization_transformation.cpp | 2 - .../recurrent_cell_transformation.cpp | 2 - .../shuffle_channels_transformation.cpp | 1 - .../transpose_after_matmul_transformation.cpp | 2 - .../base/layer_test_utils.hpp | 2 +- .../layer_transformation.cpp | 2 - .../src/subgraph/perm_conv_perm_concat.cpp | 2 +- .../include/common_test_utils/data_utils.hpp | 230 +------ .../common_test_utils/src/data_utils.cpp | 200 +----- .../common_test_utils/tests/utils_tests.cpp | 3 +- .../functional_test_utils/blob_utils.hpp | 583 ------------------ .../functional_test_utils/plugin_cache.hpp | 34 - .../functional_test_utils/precision_utils.hpp | 62 -- .../src/plugin_cache.cpp | 109 ---- .../mocks/mock_engine/mock_plugin.cpp | 1 - .../mocks/mock_engine/mock_plugin.hpp | 4 - 56 files changed, 41 insertions(+), 1499 deletions(-) delete mode 100644 src/tests/functional/plugin/shared/include/base/behavior_test_utils.hpp delete mode 100644 src/tests/test_utils/functional_test_utils/include/functional_test_utils/blob_utils.hpp delete mode 100644 src/tests/test_utils/functional_test_utils/include/functional_test_utils/plugin_cache.hpp delete mode 100644 src/tests/test_utils/functional_test_utils/include/functional_test_utils/precision_utils.hpp delete mode 100644 src/tests/test_utils/functional_test_utils/src/plugin_cache.cpp diff --git a/src/common/transformations/tests/common_optimizations/fq_mul_fusion_test.cpp b/src/common/transformations/tests/common_optimizations/fq_mul_fusion_test.cpp index 7dcf6a9c44b3c3..f9036fb5eadda2 100644 --- a/src/common/transformations/tests/common_optimizations/fq_mul_fusion_test.cpp +++ b/src/common/transformations/tests/common_optimizations/fq_mul_fusion_test.cpp @@ -12,7 +12,6 @@ #include "common_test_utils/common_utils.hpp" #include "common_test_utils/ov_test_utils.hpp" #include "common_test_utils/test_common.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "openvino/core/model.hpp" #include "openvino/opsets/opset4.hpp" #include "openvino/pass/manager.hpp" diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/concat_const_inplace.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/concat_const_inplace.cpp index bb12b5de29b23d..0844ce4a2b85f8 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/concat_const_inplace.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/concat_const_inplace.cpp @@ -5,6 +5,7 @@ #include "ov_models/utils/ov_helpers.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" #include "utils/cpu_test_utils.hpp" +#include "common_test_utils/ov_tensor_utils.hpp" using namespace CPUTestUtils; diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/execution_graph_tests/add_output.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/execution_graph_tests/add_output.cpp index 786a204488c5ee..f01cfa5db36cc2 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/execution_graph_tests/add_output.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/execution_graph_tests/add_output.cpp @@ -4,7 +4,6 @@ #include #include "execution_graph_tests/add_output.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "openvino/op/multiply.hpp" #include "openvino/op/sigmoid.hpp" #include "openvino/op/constant.hpp" diff --git a/src/plugins/intel_gpu/tests/functional/concurrency/gpu_concurrency_tests.cpp b/src/plugins/intel_gpu/tests/functional/concurrency/gpu_concurrency_tests.cpp index e493792d58d2dc..32418b94b52e66 100644 --- a/src/plugins/intel_gpu/tests/functional/concurrency/gpu_concurrency_tests.cpp +++ b/src/plugins/intel_gpu/tests/functional/concurrency/gpu_concurrency_tests.cpp @@ -4,8 +4,6 @@ #include "common_test_utils/test_common.hpp" -#include "functional_test_utils/plugin_cache.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "openvino/core/preprocess/pre_post_process.hpp" #include "transformations/utils/utils.hpp" #include "common_test_utils/file_utils.hpp" @@ -242,20 +240,15 @@ TEST(smoke_InferRequestDeviceMemoryAllocation, usmHostIsNotChanged) { // Modify tensor somehow and save as a reference values ov::test::utils::fill_tensor_random(output_tensor2); - std::vector ref_values; - ref_values.resize(output_tensor2.get_byte_size()); - std::memcpy(ref_values.data(), output_tensor2.data(), output_tensor2.get_byte_size()); + ov::Tensor ref_tensor(output_tensor2.get_element_type(), output_tensor2.get_shape()); + output_tensor2.copy_to(ref_tensor); // Perform second infer() call with a system host memory tensor infer_request1.set_output_tensor(output_tensor1); ASSERT_NO_THROW(infer_request1.infer()); // Expect that output_tensor2 will not change it's data after infer() call - FuncTestUtils::compareRawBuffers(ref_values.data(), - output_tensor2.data(), - ref_values.size(), - ov::shape_size(output_tensor2.get_shape()), - 1e-4f); + ov::test::utils::compare(ref_tensor, output_tensor2, 1e-4); } TEST(smoke_InferRequestDeviceMemoryAllocation, canSetSystemHostTensor) { diff --git a/src/plugins/intel_gpu/tests/functional/remote_tensor_tests/gpu_remote_tensor_tests.cpp b/src/plugins/intel_gpu/tests/functional/remote_tensor_tests/gpu_remote_tensor_tests.cpp index 300d88ec88240a..74fda0a8dc3263 100644 --- a/src/plugins/intel_gpu/tests/functional/remote_tensor_tests/gpu_remote_tensor_tests.cpp +++ b/src/plugins/intel_gpu/tests/functional/remote_tensor_tests/gpu_remote_tensor_tests.cpp @@ -9,6 +9,7 @@ #include "remote_tensor_tests/helpers.hpp" #include "common_test_utils/ov_tensor_utils.hpp" +#include "common_test_utils/data_utils.hpp" #include "base/ov_behavior_test_utils.hpp" #include "common_test_utils/subgraph_builders/conv_pool_relu.hpp" #include "common_test_utils/subgraph_builders/split_multi_conv_concat.hpp" @@ -1891,9 +1892,9 @@ TEST_P(OVRemoteTensorBatched_Test, NV12toBGR_image_single_plane) { ASSERT_EQ(output_tensor_regular.get_size() * num_batch, output_tensor_shared.get_size()); float thr = 0.1f; - FuncTestUtils::compareRawBuffers(static_cast(output_tensor_shared.data()) + i * output_tensor_regular.get_size(), + ov::test::utils::compare_raw_data(static_cast(output_tensor_shared.data()) + i * output_tensor_regular.get_size(), static_cast(output_tensor_regular.data()), - output_tensor_regular.get_size(), output_tensor_regular.get_size(), thr); + output_tensor_regular.get_size(), thr); } } @@ -2022,9 +2023,9 @@ TEST_P(OVRemoteTensorBatched_Test, NV12toBGR_image_two_planes) { ASSERT_EQ(output_tensor_regular.get_size() * num_batch, output_tensor_shared.get_size()); float thr = 0.1f; - FuncTestUtils::compareRawBuffers(static_cast(output_tensor_shared.data()) + i * output_tensor_regular.get_size(), + ov::test::utils::compare_raw_data(static_cast(output_tensor_shared.data()) + i * output_tensor_regular.get_size(), static_cast(output_tensor_regular.data()), - output_tensor_regular.get_size(), output_tensor_regular.get_size(), thr); + output_tensor_regular.get_size(), thr); } } @@ -2145,9 +2146,9 @@ TEST_P(OVRemoteTensorBatched_Test, NV12toGray) { ASSERT_EQ(output_tensor_regular.get_size() * num_batch, output_tensor_shared.get_size()); float thr = 0.1f; - FuncTestUtils::compareRawBuffers(static_cast(output_tensor_shared.data()) + i * output_tensor_regular.get_size(), + ov::test::utils::compare_raw_data(static_cast(output_tensor_shared.data()) + i * output_tensor_regular.get_size(), static_cast(output_tensor_regular.data()), - output_tensor_regular.get_size(), output_tensor_regular.get_size(), thr); + output_tensor_regular.get_size(), thr); } } @@ -2304,9 +2305,9 @@ TEST_P(OVRemoteTensorBatched_Test, NV12toBGR_buffer) { ASSERT_EQ(output_tensor_regular.get_size() * num_batch, out_tensor_new.get_size()); float thr = 0.1f; - FuncTestUtils::compareRawBuffers(static_cast(out_tensor_new.data()) + i * output_tensor_regular.get_size(), - static_cast(output_tensor_regular.data()), - output_tensor_regular.get_size(), output_tensor_regular.get_size(), thr); + ov::test::utils::compare_raw_data(static_cast(out_tensor_new.data()) + i * output_tensor_regular.get_size(), + static_cast(output_tensor_regular.data()), + output_tensor_regular.get_size(), thr); } } diff --git a/src/tests/functional/plugin/conformance/test_runner/op_conformance_runner/src/read_ir/read_ir.cpp b/src/tests/functional/plugin/conformance/test_runner/op_conformance_runner/src/read_ir/read_ir.cpp index 10db7aebd9d195..b289ebe5549b6b 100644 --- a/src/tests/functional/plugin/conformance/test_runner/op_conformance_runner/src/read_ir/read_ir.cpp +++ b/src/tests/functional/plugin/conformance/test_runner/op_conformance_runner/src/read_ir/read_ir.cpp @@ -301,7 +301,7 @@ std::vector ReadIRTest::calculate_refs() { std::ifstream ref_data_ifstream(path_to_ref_tensor, std::ifstream::binary); ref_data_ifstream.open(path_to_ref_tensor, std::ios::binary); if (!ref_data_ifstream.is_open()) - IE_THROW() << "Weights file " << path_to_ref_tensor << " cannot be opened!"; + OPENVINO_THROW("Weights file ", path_to_ref_tensor, " cannot be opened!"); size_t buf_size = 0; for (const auto& output : functionRefs->outputs()) { diff --git a/src/tests/functional/plugin/shared/include/base/behavior_test_utils.hpp b/src/tests/functional/plugin/shared/include/base/behavior_test_utils.hpp deleted file mode 100644 index 5d446bb5043d80..00000000000000 --- a/src/tests/functional/plugin/shared/include/base/behavior_test_utils.hpp +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include "ov_behavior_test_utils.hpp" - -#include "ie_core.hpp" -#include "functional_test_utils/plugin_cache.hpp" -#include "common_test_utils/file_utils.hpp" -#include "openvino/util/file_util.hpp" -#include "functional_test_utils/summary/api_summary.hpp" -#include "common_test_utils/subgraph_builders/conv_pool_relu.hpp" - -namespace BehaviorTestsUtils { - -class IEInferRequestTestBase : public ov::test::behavior::APIBaseTest { -private: - void set_api_entity() override { - api_entity = ov::test::utils::ov_entity::ie_infer_request; - }; -}; - -class IEExecutableNetworkTestBase : public ov::test::behavior::APIBaseTest { -private: - void set_api_entity() override { - api_entity = ov::test::utils::ov_entity::ie_executable_network; - }; -}; - -class IEPluginTestBase : public ov::test::behavior::APIBaseTest { -private: - void set_api_entity() override { - api_entity = ov::test::utils::ov_entity::ie_plugin; - }; -}; - -typedef std::tuple< - std::string, // Device name - std::map // Config -> InferRequestParams; - -class InferRequestTests : public testing::WithParamInterface, - public IEInferRequestTestBase { -public: - static std::string getTestCaseName(testing::TestParamInfo obj) { - std::string targetDevice; - std::map configuration; - std::tie(targetDevice, configuration) = obj.param; - std::ostringstream result; - std::replace(targetDevice.begin(), targetDevice.end(), ':', '.'); - result << "targetDevice=" << targetDevice << "_"; - if (!configuration.empty()) { - for (auto &configItem : configuration) { - result << "configItem=" << configItem.first << "_" << configItem.second << "_"; - } - } - return result.str(); - } - - void SetUp() override { - std::tie(target_device, configuration) = this->GetParam(); - // Skip test according to plugin specific disabledTestPatterns() (if any) - SKIP_IF_CURRENT_TEST_IS_DISABLED() - APIBaseTest::SetUp(); - function = ov::test::behavior::getDefaultNGraphFunctionForTheDevice(); - cnnNet = InferenceEngine::CNNNetwork(function); - // Load CNNNetwork to target plugins - execNet = ie->LoadNetwork(cnnNet, target_device, configuration); - } - - void TearDown() override { - if (!configuration.empty()) { - PluginCache::get().reset(); - } - APIBaseTest::TearDown(); - } - -protected: - InferenceEngine::CNNNetwork cnnNet; - InferenceEngine::ExecutableNetwork execNet; - std::shared_ptr ie = PluginCache::get().ie(); - std::shared_ptr function; - std::map configuration;; -}; - -inline InferenceEngine::Core createIECoreWithTemplate() { - PluginCache::get().reset(); - InferenceEngine::Core ie; -#ifndef OPENVINO_STATIC_LIBRARY - std::string pluginName = "openvino_template_plugin" OV_BUILD_POSTFIX; - ie.RegisterPlugin(ov::util::make_plugin_library_name(ov::test::utils::getExecutableDirectory(), pluginName), - ov::test::utils::DEVICE_TEMPLATE); -#endif // !OPENVINO_STATIC_LIBRARY - return ie; -} - -class IEClassNetworkTest : public ov::test::behavior::OVClassNetworkTest { -public: - InferenceEngine::CNNNetwork actualCnnNetwork, simpleCnnNetwork, multinputCnnNetwork, ksoCnnNetwork; - - void SetUp() { - SKIP_IF_CURRENT_TEST_IS_DISABLED(); - OVClassNetworkTest::SetUp(); - // Generic network - ASSERT_NO_THROW(actualCnnNetwork = InferenceEngine::CNNNetwork(actualNetwork)); - // Quite simple network - ASSERT_NO_THROW(simpleCnnNetwork = InferenceEngine::CNNNetwork(simpleNetwork)); - // Multinput to substruct network - ASSERT_NO_THROW(multinputCnnNetwork = InferenceEngine::CNNNetwork(multinputNetwork)); - // Network with KSO - ASSERT_NO_THROW(ksoCnnNetwork = InferenceEngine::CNNNetwork(ksoNetwork)); - } -}; - -class IEClassBaseTestP : public IEClassNetworkTest, - public ::testing::WithParamInterface, - public IEPluginTestBase { -public: - void SetUp() override { - target_device = GetParam(); - SKIP_IF_CURRENT_TEST_IS_DISABLED(); - APIBaseTest::SetUp(); - IEClassNetworkTest::SetUp(); - } -}; - -class IEExecNetClassBaseTestP : public IEClassNetworkTest, - public ::testing::WithParamInterface, - public IEExecutableNetworkTestBase { -public: - void SetUp() override { - target_device = GetParam(); - SKIP_IF_CURRENT_TEST_IS_DISABLED(); - APIBaseTest::SetUp(); - IEClassNetworkTest::SetUp(); - } -}; - -typedef std::tuple< - InferenceEngine::Precision, // Network precision - std::string, // Device name - std::map // Config -> BehaviorBasicParams; - -class BehaviorTestsBasicBase : public testing::WithParamInterface { -public: - static std::string getTestCaseName(testing::TestParamInfo obj) { - using namespace ov::test::utils; - - InferenceEngine::Precision netPrecision; - std::string targetDevice; - std::map configuration; - std::tie(netPrecision, targetDevice, configuration) = obj.param; - std::replace(targetDevice.begin(), targetDevice.end(), ':', '_'); - std::ostringstream result; - result << "netPRC=" << netPrecision.name() << "_"; - result << "targetDevice=" << targetDevice << "_"; - if (!configuration.empty()) { - result << "config=" << configuration; - } - return result.str(); - } - - std::shared_ptr ie = PluginCache::get().ie(); - std::shared_ptr function; - InferenceEngine::Precision netPrecision; - std::map configuration; -}; - -class BehaviorTestsBasic : public BehaviorTestsBasicBase, - public IEPluginTestBase { -protected: - void SetUp() override { - std::tie(netPrecision, target_device, configuration) = this->GetParam(); - SKIP_IF_CURRENT_TEST_IS_DISABLED() - APIBaseTest::SetUp(); - function = ov::test::utils::make_conv_pool_relu(); - } - void TearDown() override { - if (!configuration.empty()) { - PluginCache::get().reset(); - } - APIBaseTest::TearDown(); - } -}; -} // namespace BehaviorTestsUtils diff --git a/src/tests/functional/plugin/shared/include/base/ov_behavior_test_utils.hpp b/src/tests/functional/plugin/shared/include/base/ov_behavior_test_utils.hpp index e8b3278a69c590..b7f27d1819022e 100644 --- a/src/tests/functional/plugin/shared/include/base/ov_behavior_test_utils.hpp +++ b/src/tests/functional/plugin/shared/include/base/ov_behavior_test_utils.hpp @@ -20,10 +20,8 @@ #include "functional_test_utils/crash_handler.hpp" #include "common_test_utils/file_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "functional_test_utils/ov_plugin_cache.hpp" #include "functional_test_utils/skip_tests_config.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "functional_test_utils/summary/api_summary.hpp" #include "openvino/util/file_util.hpp" #include "common_test_utils/subgraph_builders/split_conv_concat.hpp" @@ -147,7 +145,7 @@ class OVInferRequestTests : public testing::WithParamInterface std::string { auto it = rtInfo.find(paramName); - IE_ASSERT(rtInfo.end() != it); + OPENVINO_ASSERT(rtInfo.end() != it); return it->second.as(); }; @@ -414,7 +413,7 @@ TEST_P(OVCompiledModelBaseTestOptional, CheckExecGraphInfoAfterExecution) { auto getExecValue = [&rtInfo](const std::string& paramName) -> std::string { auto it = rtInfo.find(paramName); - IE_ASSERT(rtInfo.end() != it); + OPENVINO_ASSERT(rtInfo.end() != it); return it->second.as(); }; @@ -682,7 +681,7 @@ class CompiledModelSetType : public testing::WithParamInterface #include #include "functional_test_utils/ov_plugin_cache.hpp" -#include +#include "base/ov_behavior_test_utils.hpp" namespace ov { namespace test { diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/infer_request_dynamic.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/infer_request_dynamic.hpp index 6c309643c99334..89d0f092274aaf 100644 --- a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/infer_request_dynamic.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/infer_request_dynamic.hpp @@ -16,10 +16,8 @@ #include "shared_test_classes/base/layer_test_utils.hpp" #include #include -#include +#include "base/ov_behavior_test_utils.hpp" #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" // TODO [mandrono]: move current test case inside CPU plug-in and return the original tests diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/inference.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/inference.hpp index 929ce1472c5746..636b164c96912e 100644 --- a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/inference.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/inference.hpp @@ -7,7 +7,7 @@ #include #include #include "functional_test_utils/ov_plugin_cache.hpp" -#include +#include "base/ov_behavior_test_utils.hpp" namespace ov { namespace test { diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/inference_chaining.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/inference_chaining.hpp index 9ff9f9144f8bc2..4965ac87ee8fe6 100644 --- a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/inference_chaining.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/inference_chaining.hpp @@ -11,7 +11,7 @@ #include #include -#include "base/behavior_test_utils.hpp" +#include "base/ov_behavior_test_utils.hpp" #include "openvino/core/attribute_visitor.hpp" #include "openvino/core/model.hpp" #include "openvino/core/node.hpp" diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/iteration_chaining.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/iteration_chaining.hpp index 725899cd075c44..966632f62c73bb 100644 --- a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/iteration_chaining.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/iteration_chaining.hpp @@ -11,7 +11,7 @@ #include #include -#include "base/behavior_test_utils.hpp" +#include "base/ov_behavior_test_utils.hpp" #include "openvino/core/attribute_visitor.hpp" #include "openvino/core/model.hpp" #include "openvino/core/node.hpp" diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/memory_states.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/memory_states.hpp index d9b93c2f8352f5..ca971cfa02e2d9 100644 --- a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/memory_states.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/memory_states.hpp @@ -4,7 +4,7 @@ #pragma once -#include "base/behavior_test_utils.hpp" +#include "base/ov_behavior_test_utils.hpp" #include "common_test_utils/test_common.hpp" namespace ov { diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/properties_tests.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/properties_tests.hpp index 22435559e792bf..ac191f2966bbd8 100644 --- a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/properties_tests.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/properties_tests.hpp @@ -4,7 +4,7 @@ #pragma once -#include "base/behavior_test_utils.hpp" +#include "base/ov_behavior_test_utils.hpp" #include "openvino/runtime/threading/executor_manager.hpp" namespace ov { @@ -31,7 +31,7 @@ class InferRequestPropertiesTest : public testing::WithParamInterfaceclear(); ASSERT_EQ(0u, ov::threading::executor_manager()->get_executors_number()); ASSERT_EQ(0u, ov::threading::executor_manager()->get_idle_cpu_streams_executors_number()); diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_plugin/auto_batching_tests.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_plugin/auto_batching_tests.hpp index 180894fef92a56..6d1288adbebeb6 100644 --- a/src/tests/functional/plugin/shared/include/behavior/ov_plugin/auto_batching_tests.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/ov_plugin/auto_batching_tests.hpp @@ -12,7 +12,6 @@ #include "common_test_utils/subgraph_builders/single_conv.hpp" #include "common_test_utils/subgraph_builders/detection_output.hpp" #include "common_test_utils/subgraph_builders/multi_single_conv.hpp" -#include "functional_test_utils/plugin_cache.hpp" namespace ov { namespace test { diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_plugin/caching_tests.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_plugin/caching_tests.hpp index 4dafda58404f08..5e91f3f8e8db73 100644 --- a/src/tests/functional/plugin/shared/include/behavior/ov_plugin/caching_tests.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/ov_plugin/caching_tests.hpp @@ -8,7 +8,6 @@ #include #include "shared_test_classes/base/ov_subgraph.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "common_test_utils/unicode_utils.hpp" #include "openvino/util/common_util.hpp" #include "base/ov_behavior_test_utils.hpp" diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_plugin/version.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_plugin/version.hpp index 437261507d435d..19cbdf7154c031 100644 --- a/src/tests/functional/plugin/shared/include/behavior/ov_plugin/version.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/ov_plugin/version.hpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "base/behavior_test_utils.hpp" +#include "base/ov_behavior_test_utils.hpp" namespace ov { namespace test { diff --git a/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/batched_tensors.cpp b/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/batched_tensors.cpp index 45df311d407153..590c7ab16b912c 100644 --- a/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/batched_tensors.cpp +++ b/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/batched_tensors.cpp @@ -39,7 +39,7 @@ void OVInferRequestBatchedTests::TearDown() { if (m_need_reset_core) { ie->set_property({ov::cache_dir()}); ie.reset(); - PluginCache::get().reset(); + ov::test::utils::PluginCache::get().reset(); ov::test::utils::removeFilesWithExt(m_cache_dir, "blob"); ov::test::utils::removeDir(m_cache_dir); } diff --git a/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/memory_states.cpp b/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/memory_states.cpp index 9ed8d89bad7afc..bac86ba34646f1 100644 --- a/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/memory_states.cpp +++ b/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/memory_states.cpp @@ -4,9 +4,7 @@ #include "behavior/ov_infer_request/memory_states.hpp" -#include "base/behavior_test_utils.hpp" #include "common_test_utils/ov_tensor_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "openvino/op/multiply.hpp" #include "openvino/op/sigmoid.hpp" diff --git a/src/tests/functional/plugin/shared/src/execution_graph_tests/num_inputs_fusing_bin_conv.cpp b/src/tests/functional/plugin/shared/src/execution_graph_tests/num_inputs_fusing_bin_conv.cpp index ddfd51d9b7f271..cc52f0157cfa79 100644 --- a/src/tests/functional/plugin/shared/src/execution_graph_tests/num_inputs_fusing_bin_conv.cpp +++ b/src/tests/functional/plugin/shared/src/execution_graph_tests/num_inputs_fusing_bin_conv.cpp @@ -58,7 +58,7 @@ TEST_P(ExecGraphInputsFusingBinConv, CheckNumInputsInBinConvFusingWithConv) { const auto & rtInfo = op->get_rt_info(); auto getExecValue = [&rtInfo](const std::string & paramName) -> std::string { auto it = rtInfo.find(paramName); - IE_ASSERT(rtInfo.end() != it); + OPENVINO_ASSERT(rtInfo.end() != it); return it->second.as(); }; diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/convolution_qdq_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/convolution_qdq_transformation.cpp index e98dca9eec9bb1..62818c22a05557 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/convolution_qdq_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/convolution_qdq_transformation.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_models/pass/convert_prc.hpp" #include "ov_lpt_models/fake_quantize_and_convolution.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/convolution_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/convolution_transformation.cpp index b1acadbb73dc5d..90ba837d86ae01 100755 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/convolution_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/convolution_transformation.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_models/pass/convert_prc.hpp" #include "ov_lpt_models/fake_quantize_and_convolution.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/convolution_with_incorrect_weights.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/convolution_with_incorrect_weights.cpp index f79028e3ccb4cc..a799cd8fc2929a 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/convolution_with_incorrect_weights.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/convolution_with_incorrect_weights.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_models/pass/convert_prc.hpp" #include "ov_lpt_models/convolution.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/depth_to_space_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/depth_to_space_transformation.cpp index 31270f5180f684..68ce95d492a2fa 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/depth_to_space_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/depth_to_space_transformation.cpp @@ -8,7 +8,6 @@ #include #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "low_precision_transformations/depth_to_space_transformation.hpp" #include "openvino/core/model.hpp" #include "openvino/op/depth_to_space.hpp" @@ -52,7 +51,7 @@ void DepthToSpaceTransformation::SetUp() { init_input_shapes(inputShape); if (inputShape.rank().is_dynamic() || inputShape.rank().get_length() != 4) { - IE_THROW() << "not supported input shape size " << inputShape.rank(); + OPENVINO_THROW("not supported input shape size ", inputShape.rank()); } function = ov::builder::subgraph::DepthToSpaceFunction::getOriginal(precision, inputShape, mode, blockSize); diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp index f80290734b2cff..449110e7fe55e1 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_models/pass/convert_prc.hpp" namespace LayerTestsDefinitions { diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/fully_connected_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/fully_connected_transformation.cpp index b26f67cc07d444..694962036010b1 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/fully_connected_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/fully_connected_transformation.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_models/pass/convert_prc.hpp" #include "ov_lpt_models/mat_mul.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/fuse_convert_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/fuse_convert_transformation.cpp index 503ffe24462700..09be58373119de 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/fuse_convert_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/fuse_convert_transformation.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_models/pass/convert_prc.hpp" #include "ov_lpt_models/fuse_convert.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/gemm_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/gemm_transformation.cpp index 150f8c146feedb..b915fe21762141 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/gemm_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/gemm_transformation.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_lpt_models/mat_mul.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/group_convolution_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/group_convolution_transformation.cpp index db409a1cd3c63c..796f5d7d609ddb 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/group_convolution_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/group_convolution_transformation.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_models/pass/convert_prc.hpp" #include "ov_lpt_models/group_convolution.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/groupconvolution_qdq_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/groupconvolution_qdq_transformation.cpp index 4658d4a9a684e0..57c92ecd4c411d 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/groupconvolution_qdq_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/groupconvolution_qdq_transformation.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_models/pass/convert_prc.hpp" #include "ov_lpt_models/fake_quantize_and_convolution.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/mat_mul_with_optimized_constant_fq.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/mat_mul_with_optimized_constant_fq.cpp index 9b70e211c1ae38..f5981ec8e77f74 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/mat_mul_with_optimized_constant_fq.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/mat_mul_with_optimized_constant_fq.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_models/pass/convert_prc.hpp" #include "ov_lpt_models/mat_mul_with_optimized_constant_fake_quantize.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/move_fake_quantize_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/move_fake_quantize_transformation.cpp index d41e69a80763e5..0767ffb272b00f 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/move_fake_quantize_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/move_fake_quantize_transformation.cpp @@ -12,7 +12,6 @@ #include "common_test_utils/common_utils.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_lpt_models/move_fake_quantize.hpp" namespace LayerTestsDefinitions { diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/multiply_to_group_convolution_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/multiply_to_group_convolution_transformation.cpp index 32fdb92de0ab8a..2827bc00ec6834 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/multiply_to_group_convolution_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/multiply_to_group_convolution_transformation.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_models/pass/convert_prc.hpp" #include "ov_lpt_models/multiply_to_group_convolution.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/mvn_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/mvn_transformation.cpp index f94a99c14035cc..38d001149ea0e3 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/mvn_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/mvn_transformation.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_models/pass/convert_prc.hpp" #include "ov_lpt_models/mvn.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/normalize_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/normalize_transformation.cpp index 1a14675855a89d..e8ab412cc19366 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/normalize_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/normalize_transformation.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_models/pass/convert_prc.hpp" #include "ov_lpt_models/normalize_l2.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/output_layers_concat.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/output_layers_concat.cpp index be639c37df1085..f216fbe18e16d3 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/output_layers_concat.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/output_layers_concat.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "common_test_utils/node_builders/fake_quantize.hpp" #include "ov_models/pass/convert_prc.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/output_layers_concat_multi_channel.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/output_layers_concat_multi_channel.cpp index 83e2a3cb6e05b1..eb6c2d3ce3791d 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/output_layers_concat_multi_channel.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/output_layers_concat_multi_channel.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "common_test_utils/node_builders/fake_quantize.hpp" #include "ov_models/pass/convert_prc.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/output_layers_handling_in_transformations.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/output_layers_handling_in_transformations.cpp index ff3399d346c4eb..676f69d53c9458 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/output_layers_handling_in_transformations.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/output_layers_handling_in_transformations.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "common_test_utils/node_builders/fake_quantize.hpp" #include "ov_models/pass/convert_prc.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp index bb7e5b3900e1f0..fe39393189e3d5 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_models/pass/convert_prc.hpp" #include "ov_lpt_models/fake_quantize_and_convolution.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/recurrent_cell_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/recurrent_cell_transformation.cpp index 82491301482760..c61577faa8f1f5 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/recurrent_cell_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/recurrent_cell_transformation.cpp @@ -9,10 +9,8 @@ #include #include - #include "common_test_utils/common_utils.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_lpt_models/recurrent_cell.hpp" namespace LayerTestsDefinitions { diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/shuffle_channels_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/shuffle_channels_transformation.cpp index aba4da9c6a0372..479418a3d2dca2 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/shuffle_channels_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/shuffle_channels_transformation.cpp @@ -11,7 +11,6 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" #include "ov_lpt_models/shuffle_channels.hpp" diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/transpose_after_matmul_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/transpose_after_matmul_transformation.cpp index ca93bb11c46800..0a70a1727d189e 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/transpose_after_matmul_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/transpose_after_matmul_transformation.cpp @@ -11,9 +11,7 @@ #include "common_test_utils/common_utils.hpp" -#include "functional_test_utils/plugin_cache.hpp" #include "shared_test_classes/base/layer_test_utils.hpp" -#include "functional_test_utils/blob_utils.hpp" #include "ov_lpt_models/transpose_after_mat_mul.hpp" diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/layer_test_utils.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/layer_test_utils.hpp index a23e1be0e84943..8a6237856bbbf1 100644 --- a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/layer_test_utils.hpp +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/layer_test_utils.hpp @@ -7,9 +7,9 @@ #include #include "common_test_utils/common_utils.hpp" +#include "common_test_utils/data_utils.hpp" #include "common_test_utils/ov_test_utils.hpp" #include "common_test_utils/test_common.hpp" -#include "common_test_utils/data_utils.hpp" #include "functional_test_utils/crash_handler.hpp" #include "functional_test_utils/skip_tests_config.hpp" #include "functional_test_utils/summary/environment.hpp" diff --git a/src/tests/functional/shared_test_classes/src/base/low_precision_transformations/layer_transformation.cpp b/src/tests/functional/shared_test_classes/src/base/low_precision_transformations/layer_transformation.cpp index 6ff1d2a6e23a2b..61de1970774a86 100644 --- a/src/tests/functional/shared_test_classes/src/base/low_precision_transformations/layer_transformation.cpp +++ b/src/tests/functional/shared_test_classes/src/base/low_precision_transformations/layer_transformation.cpp @@ -7,8 +7,6 @@ #include #include -#include "functional_test_utils/blob_utils.hpp" - #include "ov_models/pass/convert_prc.hpp" namespace LayerTestsUtils { diff --git a/src/tests/functional/shared_test_classes/src/subgraph/perm_conv_perm_concat.cpp b/src/tests/functional/shared_test_classes/src/subgraph/perm_conv_perm_concat.cpp index 0e2a53737bdaac..7cc5f2a4f5fe73 100644 --- a/src/tests/functional/shared_test_classes/src/subgraph/perm_conv_perm_concat.cpp +++ b/src/tests/functional/shared_test_classes/src/subgraph/perm_conv_perm_concat.cpp @@ -91,7 +91,7 @@ void PermConvPermConcat::SetUp() { auto reshape_out_pattern = std::make_shared( ov::element::i64, ov::Shape{2}, - InferenceEngine::SizeVector({1, (permute_out_shape[2] + 1) * permute_out_shape[3]})); + std::vector({1, (permute_out_shape[2] + 1) * permute_out_shape[3]})); auto reshape_out = std::make_shared(concat, reshape_out_pattern, false); function = std::make_shared(reshape_out, input_parameter, "perm_conv_perm_concat"); diff --git a/src/tests/test_utils/common_test_utils/include/common_test_utils/data_utils.hpp b/src/tests/test_utils/common_test_utils/include/common_test_utils/data_utils.hpp index a41bbd4e61b2ff..1c4a169e896033 100644 --- a/src/tests/test_utils/common_test_utils/include/common_test_utils/data_utils.hpp +++ b/src/tests/test_utils/common_test_utils/include/common_test_utils/data_utils.hpp @@ -11,7 +11,6 @@ #include "common_test_utils/common_utils.hpp" #include "gtest/gtest.h" -#include "ie_blob.h" #include "openvino/core/type/element_type_traits.hpp" #include "openvino/runtime/tensor.hpp" @@ -45,51 +44,22 @@ inline std::vector generate_float_numbers(std::size_t vec_len, float min, } /** - * Fill blob with value data blob. Broadcast semantic is included. + * Fill tensor with value data. Broadcast semantic is included. * Broadcasting with alignment through last dimension. * - * @param blob tensor to fill in + * @param tensor tensor to fill in * @param values src tensor which should be broadcast */ -OPENVINO_SUPPRESS_DEPRECATED_START -void fill_data_with_broadcast(InferenceEngine::Blob::Ptr& blob, InferenceEngine::Blob::Ptr& values); -OPENVINO_SUPPRESS_DEPRECATED_END void fill_data_with_broadcast(ov::Tensor& tensor, ov::Tensor& values); /** * Wrapper on top of fill_data_with_broadcast with simplified signature * - * @param blob the destination blob to fill in + * @param tensor tensor to fill in * @param axis Axis to apply values * @param values data to broadcast */ -OPENVINO_SUPPRESS_DEPRECATED_START -void fill_data_with_broadcast(InferenceEngine::Blob::Ptr& blob, size_t axis, std::vector values); -OPENVINO_SUPPRESS_DEPRECATED_END void fill_data_with_broadcast(ov::Tensor& tensor, size_t axis, std::vector values); -/** - * Make a view blob with new shape. It will reinterpret original tensor data as a tensor with new shape. - * - * NB! Limitation: the nwe one blob will no have ownership of data buffer. The original blob should be alive - * while view is in use. - * - * @param tensor original source tensor - * @param new_shape new one shape for view blob - * @return new one blob view - */ -OPENVINO_SUPPRESS_DEPRECATED_START -InferenceEngine::Blob::Ptr make_reshape_view(const InferenceEngine::Blob::Ptr& blob, - InferenceEngine::SizeVector new_shape); -OPENVINO_SUPPRESS_DEPRECATED_END - -/** - * Calculate size of buffer required for provided tensor descriptor. - * @param tdesc provided tensor descriptor - * @return size in bytes - */ -OPENVINO_SUPPRESS_DEPRECATED_START -size_t byte_size(const InferenceEngine::TensorDesc& tdesc); -OPENVINO_SUPPRESS_DEPRECATED_END ov::Tensor make_tensor_with_precision_convert(const ov::Tensor& tensor, ov::element::Type prc); @@ -139,27 +109,6 @@ inline void fill_roi_raw_ptr(T* data, } } -OPENVINO_SUPPRESS_DEPRECATED_START -template -inline void fill_data_roi(InferenceEngine::Blob::Ptr& blob, - const uint32_t range, - const int height, - const int width, - const float omega, - const bool is_roi_max_mode, - const int seed = 1, - void (*propGenerator)(InferenceEngine::Blob::Ptr&) = nullptr) { - if (propGenerator != nullptr) { - propGenerator(blob); - return; - } - using T = typename InferenceEngine::PrecisionTrait::value_type; - auto* data = blob->buffer().as(); - fill_roi_raw_ptr(data, blob->size(), range, height, width, omega, is_roi_max_mode, seed); -} - -OPENVINO_SUPPRESS_DEPRECATED_END - void fill_psroi(ov::Tensor& tensor, int batchSize, int height, @@ -308,82 +257,6 @@ void fill_tensor_random(ov::Tensor& tensor, const int32_t k = 1, const int seed = 1); -/** @brief Fill blob with random data. - * - * @param blob Target blob - * @param range Values range - * @param start_from Value from which range should start - * @param k Resolution of floating point numbers. - * - With k = 1 every random number will be basically integer number. - * - With k = 2 numbers resolution will 1/2 so outputs only .0 or .50 - * - With k = 4 numbers resolution will 1/4 so outputs only .0 .25 .50 0.75 and etc. - */ -OPENVINO_SUPPRESS_DEPRECATED_START -template -void inline fill_data_random(InferenceEngine::Blob::Ptr& blob, - const uint32_t range = 10, - int32_t start_from = 0, - const int32_t k = 1, - const int seed = 1) { - using T = typename InferenceEngine::PrecisionTrait::value_type; - auto* rawBlobDataPtr = blob->buffer().as(); - if (PRC == InferenceEngine::Precision::U4 || PRC == InferenceEngine::Precision::I4 || - PRC == InferenceEngine::Precision::BIN) { - fill_data_random(rawBlobDataPtr, blob->byteSize(), range, start_from, k, seed); - } else { - fill_data_random(rawBlobDataPtr, blob->size(), range, start_from, k, seed); - } -} -OPENVINO_SUPPRESS_DEPRECATED_END - -/** @brief Fill blob with a sorted sequence of unique elements randomly generated. - * - * This function generates and fills a blob of a certain precision, with a - * sorted sequence of unique elements. - * - * @param blob Target blob - * @param range Values range - * @param start_from Value from which range should start - * @param k Resolution of floating point numbers. - * - With k = 1 every random number will be basically integer number. - * - With k = 2 numbers resolution will 1/2 so outputs only .0 or .50 - * - With k = 4 numbers resolution will 1/4 so outputs only .0 .25 .50 0.75 and etc. - */ -OPENVINO_SUPPRESS_DEPRECATED_START -template -void inline fill_random_unique_sequence(InferenceEngine::Blob::Ptr& blob, - uint64_t range, - int64_t start_from = 0, - const int64_t k = 1, - const int32_t seed = 1) { - using T = typename InferenceEngine::PrecisionTrait::value_type; - auto* rawBlobDataPtr = blob->buffer().as(); - - if (start_from < 0 && !std::is_signed::value) { - start_from = 0; - } - - if (range < blob->size()) { - range = blob->size() * 2; - } - - std::mt19937 generator(seed); - std::uniform_int_distribution dist(k * start_from, k * (start_from + range)); - - std::set elems; - while (elems.size() != blob->size()) { - auto value = static_cast(dist(generator)); - value /= static_cast(k); - if (PRC == InferenceEngine::Precision::FP16) { - elems.insert(static_cast(ov::float16(value).to_bits())); - } else { - elems.insert(static_cast(value)); - } - } - std::copy(elems.begin(), elems.end(), rawBlobDataPtr); -} -OPENVINO_SUPPRESS_DEPRECATED_END - template void inline fill_data_ptr_consistently(T* data, size_t size, @@ -402,45 +275,6 @@ void inline fill_data_ptr_consistently(T* data, } } -OPENVINO_SUPPRESS_DEPRECATED_START -template -void inline fill_data_consistently(InferenceEngine::Blob::Ptr& blob, - const uint32_t range = 10, - int32_t start_from = 0, - const int32_t k = 1) { - using T = typename InferenceEngine::PrecisionTrait::value_type; - auto* rawBlobDataPtr = blob->buffer().as(); - if (start_from < 0 && !std::is_signed::value) { - start_from = 0; - } - fill_data_ptr_consistently(rawBlobDataPtr, blob->size(), range, start_from, k); -} - -template -void inline fill_data_random_float(InferenceEngine::Blob::Ptr& blob, - const uint32_t range, - int32_t start_from, - const int32_t k, - const int seed = 1) { - using T = typename InferenceEngine::PrecisionTrait::value_type; - std::default_random_engine random(seed); - // 1/k is the resolution of the floating point numbers - std::uniform_int_distribution distribution(k * start_from, k * (start_from + range)); - - auto* rawBlobDataPtr = blob->buffer().as(); - for (size_t i = 0; i < blob->size(); i++) { - auto value = static_cast(distribution(random)); - value /= static_cast(k); - if (PRC == InferenceEngine::Precision::FP16) { - rawBlobDataPtr[i] = static_cast(ov::float16(value).to_bits()); - } else if (PRC == InferenceEngine::Precision::BF16) { - rawBlobDataPtr[i] = static_cast(ov::bfloat16(value).to_bits()); - } else { - rawBlobDataPtr[i] = static_cast(value); - } - } -} - template void inline fill_data_ptr_normal_random_float(T* data, size_t size, @@ -451,8 +285,7 @@ void inline fill_data_ptr_normal_random_float(T* data, std::normal_distribution<> normal_d{mean, stddev}; for (size_t i = 0; i < size; i++) { auto value = static_cast(normal_d(random)); - if (typeid(T) == - typeid(typename InferenceEngine::PrecisionTrait::value_type)) { + if (typeid(T) == typeid(typename ov::fundamental_type_for)) { data[i] = static_cast(ov::float16(value).to_bits()); } else { data[i] = static_cast(value); @@ -460,61 +293,6 @@ void inline fill_data_ptr_normal_random_float(T* data, } } -template -void inline fill_data_normal_random_float(InferenceEngine::Blob::Ptr& blob, - const float mean, - const float stddev, - const int seed = 1) { - using T = typename InferenceEngine::PrecisionTrait::value_type; - auto* rawBlobDataPtr = blob->buffer().as(); - fill_data_ptr_normal_random_float(rawBlobDataPtr, blob->size(), mean, stddev, seed); -} - -template -void inline fill_data_float_array(InferenceEngine::Blob::Ptr& blob, const T values[], const size_t size) { - using Type = typename InferenceEngine::PrecisionTrait::value_type; - - auto* rawBlobDataPtr = blob->buffer().as(); - for (size_t i = 0; i < std::min(size, blob->size()); i++) { - auto value = values[i]; - if (typeid(Type) == - typeid(typename InferenceEngine::PrecisionTrait::value_type)) { - rawBlobDataPtr[i] = static_cast(ov::float16(value).to_bits()); - - } else { - rawBlobDataPtr[i] = static_cast(value); - } - } -} - -template <> -void inline fill_data_random(InferenceEngine::Blob::Ptr& blob, - const uint32_t range, - int32_t start_from, - const int32_t k, - const int seed) { - fill_data_random_float(blob, range, start_from, k, seed); -} - -template <> -void inline fill_data_random(InferenceEngine::Blob::Ptr& blob, - const uint32_t range, - int32_t start_from, - const int32_t k, - const int seed) { - fill_data_random_float(blob, range, start_from, k, seed); -} - -template <> -void inline fill_data_random(InferenceEngine::Blob::Ptr& blob, - const uint32_t range, - int32_t start_from, - const int32_t k, - const int seed) { - fill_data_random_float(blob, range, start_from, k, seed); -} -OPENVINO_SUPPRESS_DEPRECATED_END - void fill_random_string(std::string* dst, const size_t size, const size_t len_range = 10lu, diff --git a/src/tests/test_utils/common_test_utils/src/data_utils.cpp b/src/tests/test_utils/common_test_utils/src/data_utils.cpp index c9c25f82235cec..8d2f91aab3a69d 100644 --- a/src/tests/test_utils/common_test_utils/src/data_utils.cpp +++ b/src/tests/test_utils/common_test_utils/src/data_utils.cpp @@ -4,42 +4,14 @@ #include "common_test_utils/data_utils.hpp" -#include "blob_factory.hpp" -#include "ie_blob.h" -#include "openvino/core/deprecated.hpp" #include "openvino/core/type/element_type_traits.hpp" #include "openvino/runtime/tensor.hpp" #include "precomp.hpp" -using namespace InferenceEngine::details; - namespace ov { namespace test { namespace utils { - -OPENVINO_SUPPRESS_DEPRECATED_START - -bool isDenseBlob(const InferenceEngine::Blob::Ptr& blob) { - auto blk_desc = blob->getTensorDesc().getBlockingDesc(); - auto dims = blk_desc.getBlockDims(); - auto strs = blk_desc.getStrides(); - - IE_ASSERT(dims.size() == strs.size()) << " isDenseBlob: inconsistent tensor descriptor"; - - auto size = dims.size(); - if (size == 0) - return true; - if (size == 1) - return strs[0] == 1; - - for (auto i = size - 1; i > 0; i--) { - if (strs[i - 1] != strs[i - 1] * dims[i]) - return false; - } - - return true; -} - +namespace { template void copy_7D(void* src_raw_ptr, std::vector& src_str, @@ -79,175 +51,7 @@ void copy_7D(void* src_raw_ptr, } } } - -void fill_data_with_broadcast(InferenceEngine::Blob::Ptr& blob, InferenceEngine::Blob::Ptr& values) { - using InferenceEngine::SizeVector; - constexpr size_t MAX_N_DIMS = 7; // Suppose it's enough - - IE_ASSERT(blob->getTensorDesc().getPrecision() == values->getTensorDesc().getPrecision()); - - auto values_dims = values->getTensorDesc().getDims(); - auto blob_dims = blob->getTensorDesc().getDims(); - auto n_dims = blob_dims.size(); - IE_ASSERT(values_dims.size() <= n_dims); - IE_ASSERT(n_dims <= MAX_N_DIMS); - - ov::Shape src_dims(MAX_N_DIMS, 1); - std::copy(values_dims.rbegin(), values_dims.rend(), src_dims.rbegin()); - - ov::Shape dst_dims(MAX_N_DIMS, 1); - std::copy(blob_dims.rbegin(), blob_dims.rend(), dst_dims.rbegin()); - - bool compatible = true; - for (int i = 0; i < MAX_N_DIMS; i++) { - if (src_dims[i] != dst_dims[i] && src_dims[i] != 1) - compatible = false; - } - - IE_ASSERT(compatible); - - auto fill_strides_like_plain = [](ov::Shape dims) { - ov::Shape str(dims.size()); - if (str.empty()) - return str; - else - str.back() = 1; - - // stride[i] = stride[i+1]*d[i+1] - std::transform(dims.rbegin(), dims.rend() - 1, str.rbegin(), str.rbegin() + 1, [](size_t d, size_t s) { - return d * s; - }); - - // zeroing broadcast dimension equal 1 - std::transform(str.begin(), str.end(), dims.begin(), str.begin(), [](size_t s, size_t d) { - return d == 1 ? 0 : s; - }); - - return str; - }; - - SizeVector src_strides = fill_strides_like_plain(src_dims); - SizeVector dst_strides = fill_strides_like_plain(dst_dims); - - auto get_data = [](InferenceEngine::Blob::Ptr& blob) { - auto mem_blob = dynamic_cast(blob.get()); - auto mem = mem_blob->rwmap(); - return mem.as(); - }; - - auto dst_ptr = get_data(blob); - auto src_ptr = get_data(values); - - switch (blob->getTensorDesc().getPrecision()) { - case InferenceEngine::Precision::U64: - case InferenceEngine::Precision::I64: - copy_7D(src_ptr, src_strides, dst_ptr, dst_strides, dst_dims); - break; - case InferenceEngine::Precision::FP32: - case InferenceEngine::Precision::I32: - copy_7D(src_ptr, src_strides, dst_ptr, dst_strides, dst_dims); - break; - case InferenceEngine::Precision::I16: - case InferenceEngine::Precision::U16: - case InferenceEngine::Precision::FP16: - case InferenceEngine::Precision::BF16: - copy_7D(src_ptr, src_strides, dst_ptr, dst_strides, dst_dims); - break; - case InferenceEngine::Precision::U8: - case InferenceEngine::Precision::I8: - copy_7D(src_ptr, src_strides, dst_ptr, dst_strides, dst_dims); - break; - default: - IE_THROW() << "Unsupported precision by fill_data_with_broadcast function"; - } -} - -template -void copy_with_convert(InferenceEngine::Blob::Ptr& src_blob, InferenceEngine::Blob::Ptr& dst_blob) { - using SRC_TYPE = typename InferenceEngine::PrecisionTrait::value_type; - using DST_TYPE = typename InferenceEngine::PrecisionTrait::value_type; - - auto src_lock_m = src_blob->as()->rwmap(); - auto src_ptr = src_lock_m.as(); - auto src_size = src_blob->size(); - - auto dst_lock_m = dst_blob->as()->rwmap(); - auto dst_ptr = dst_lock_m.as(); - - std::copy(src_ptr, src_ptr + src_size, dst_ptr); -} - -InferenceEngine::Blob::Ptr make_with_precision_convert(InferenceEngine::Blob::Ptr& blob, - InferenceEngine::Precision prc) { - IE_ASSERT(isDenseBlob(blob)); - auto td = blob->getTensorDesc(); - td.setPrecision(prc); - - auto new_blob = make_blob_with_precision(td); - new_blob->allocate(); - -#define CASE(_PRC) \ - case InferenceEngine::Precision::_PRC: \ - copy_with_convert(blob, new_blob); \ - break - switch (prc) { - CASE(FP32); - CASE(I64); - CASE(U64); - CASE(I32); - CASE(U32); - CASE(I16); - CASE(U16); - CASE(I8); - CASE(U8); - default: - IE_THROW() << "Unsupported precision case"; - } -#undef CASE - - return new_blob; -} - -void fill_data_with_broadcast(InferenceEngine::Blob::Ptr& blob, size_t axis, std::vector values) { - InferenceEngine::SizeVector value_dims(blob->getTensorDesc().getDims().size() - axis, 1); - value_dims.front() = values.size(); - auto prc = blob->getTensorDesc().getPrecision(); - auto layout = InferenceEngine::TensorDesc::getLayoutByDims(value_dims); - InferenceEngine::TensorDesc value_tdesc(prc, value_dims, layout); - - InferenceEngine::Blob::Ptr values_blob; - if (prc == InferenceEngine::Precision::FP32) { - values_blob = make_blob_with_precision(value_tdesc, values.data()); - } else { - values_blob = make_blob_with_precision(value_tdesc, values.data()); - values_blob = make_with_precision_convert(values_blob, prc); - } - - fill_data_with_broadcast(blob, values_blob); -} - -InferenceEngine::Blob::Ptr make_reshape_view(const InferenceEngine::Blob::Ptr& blob, - InferenceEngine::SizeVector new_shape) { - using InferenceEngine::TensorDesc; - auto new_size = std::accumulate(new_shape.begin(), new_shape.end(), 1, std::multiplies()); - IE_ASSERT(new_size == blob->size()); - - auto orig_mem_blob = dynamic_cast(blob.get()); - auto orig_mem = orig_mem_blob->rwmap(); - auto orig_ptr = orig_mem.as(); - - auto new_tdesc = - TensorDesc(blob->getTensorDesc().getPrecision(), new_shape, TensorDesc::getLayoutByDims(new_shape)); - auto new_blob = make_blob_with_precision(new_tdesc, orig_ptr); - return new_blob; -} - -size_t byte_size(const InferenceEngine::TensorDesc& tdesc) { - auto prc = tdesc.getPrecision(); - auto dims = tdesc.getDims(); - return prc.size() * std::accumulate(std::begin(dims), std::end(dims), (size_t)1, std::multiplies()); -} -OPENVINO_SUPPRESS_DEPRECATED_END +} // namespace namespace { static int randInt(int low, int high) { diff --git a/src/tests/test_utils/common_test_utils/tests/utils_tests.cpp b/src/tests/test_utils/common_test_utils/tests/utils_tests.cpp index 141a1dee3f82ea..9bab74bcb8ea05 100644 --- a/src/tests/test_utils/common_test_utils/tests/utils_tests.cpp +++ b/src/tests/test_utils/common_test_utils/tests/utils_tests.cpp @@ -4,8 +4,8 @@ #include -#include "openvino/util/file_util.hpp" #include "openvino/util/common_util.hpp" +#include "openvino/util/file_util.hpp" using namespace testing; using namespace ov::util; @@ -14,7 +14,6 @@ TEST(UtilsTests, get_directory_returns_root) { ASSERT_EQ(get_directory("/test"), "/"); } - TEST(UtilsTests, filter_lines_by_prefix) { auto lines = "abc\nkkb\nabpp\n"; auto res = filter_lines_by_prefix(lines, "ab"); diff --git a/src/tests/test_utils/functional_test_utils/include/functional_test_utils/blob_utils.hpp b/src/tests/test_utils/functional_test_utils/include/functional_test_utils/blob_utils.hpp deleted file mode 100644 index ed45a216537072..00000000000000 --- a/src/tests/test_utils/functional_test_utils/include/functional_test_utils/blob_utils.hpp +++ /dev/null @@ -1,583 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include - -#include -#include -#include -#include -#include - -#include "blob_factory.hpp" -#include "common_test_utils/data_utils.hpp" -#include "common_test_utils/test_constants.hpp" -#include "openvino/runtime/common.hpp" - -namespace FuncTestUtils { -namespace Bf16TestUtils { -inline short reducePrecisionBitwiseS(const float in); -} // namespace Bf16TestUtils - -enum CompareType { - ABS, - REL, - ABS_AND_REL // if absolute and relative differences are too high, an exception is thrown -}; -/** - * @brief Checks values of two blobs according to given algorithm and thresholds. - * In ABS and REL cases thr1 corresponds to the single threshold, - * In ABS_AND_REL case thr1 and thr2 mean absolute and relative threshold - * - * @tparam dType Type of blob data - * @param res Pointer to considered blob - * @param ref Pointer to reference blob - * @param resSize Size of considered blob - * @param refSize Size of reference blob - * @param compareType Defines an algorithm of comparison - * @param thr1 First threshold of difference - * @param thr2 Second threshold of difference - * @param printData A flag if data printing is demanded - */ -template -inline void compareRawBuffers(const dType* res, - const dType* ref, - size_t resSize, - size_t refSize, - CompareType compareType, - float thr1 = 0.01, - float thr2 = 0.01, - bool printData = false) { - if (printData) { - std::cout << "Reference results: " << std::endl; - for (size_t i = 0; i < refSize; i++) { - std::cout << ref[i] << " "; - } - std::cout << std::endl; - std::cout << "Test results: " << std::endl; - for (size_t i = 0; i < resSize; i++) { - std::cout << res[i] << " "; - } - std::cout << std::endl; - } - - switch (compareType) { - case CompareType::ABS: - for (size_t i = 0; i < refSize; i++) { - float absDiff = std::abs(res[i] - ref[i]); - ASSERT_LE(absDiff, thr1) << "Relative comparison of values ref: " << ref[i] << " and res: " << res[i] - << " , index in blobs: " << i << " failed!"; - } - break; - case CompareType::REL: - for (size_t i = 0; i < refSize; i++) { - float absDiff = std::abs(res[i] - ref[i]); - float relDiff = absDiff / std::max(res[i], ref[i]); - ASSERT_LE(relDiff, thr2) << "Relative comparison of values ref: " << ref[i] << " and res: " << res[i] - << " , index in blobs: " << i << " failed!"; - } - break; - case CompareType::ABS_AND_REL: - for (size_t i = 0; i < refSize; i++) { - float absDiff = std::abs(res[i] - ref[i]); - if (absDiff > thr1) { - float relDiff = absDiff / std::max(res[i], ref[i]); - ASSERT_LE(relDiff, thr2) << "Comparison of values ref: " << ref[i] << " and res: " << res[i] - << " , index in blobs: " << i << " failed!"; - } - } - break; - } -} -/** - * @brief Checks absolute and relative difference of blob values according to given threshold. - * - * @tparam dType Type of blob data - * @param res Pointer to considered blob - * @param ref Pointer to reference blob - * @param resSize Size of considered blob - * @param refSize Size of reference blob - * @param thr Threshold of difference, absolute and relative simultaneously - * @param printData Flag if data printing is demanded - */ -template -inline void compareRawBuffers(const dType* res, - const dType* ref, - size_t resSize, - size_t refSize, - float thr = 0.01, - bool printData = false) { - compareRawBuffers(res, ref, resSize, refSize, CompareType::ABS_AND_REL, thr, thr, printData); -} -/** - * @brief Checks values of two blobs according to given algorithm and thresholds. - * In ABS and REL cases thr1 corresponds to the single threshold, - * In ABS_AND_REL case thr1 and thr2 mean absolute and relative threshold - * - * @tparam dType Type of blob data - * @param res Vector of considered blob values - * @param ref Vector of reference blob values - * @param resSize Size of considered blob - * @param refSize Size of reference blob - * @param compareType Defines an algorithm of comparision - * @param thr1 First threshold of difference - * @param thr2 Second threshold of difference - * @param printData A flag if data printing is demanded - */ -template -inline void compareRawBuffers(const std::vector res, - const std::vector ref, - const std::vector& resSizes, - const std::vector& refSizes, - CompareType compareType, - float thr1 = 0.01, - float thr2 = 0.01, - bool printData = false) { - ASSERT_TRUE(res.size() == ref.size()) << "Reference and Results vector have to be same length"; - ASSERT_TRUE(res.size() == resSizes.size()) << "Results vector and elements count vector have to be same length"; - ASSERT_TRUE(ref.size() == refSizes.size()) << "Reference vector and elements count vector have to be same length"; - for (size_t i = 0; i < res.size(); i++) { - if (printData) - std::cout << "BEGIN CHECK BUFFER [" << i << "]" << std::endl; - compareRawBuffers(res[i], ref[i], resSizes[i], refSizes[i], compareType, thr1, thr2, printData); - if (printData) - std::cout << "END CHECK BUFFER [" << i << "]" << std::endl; - } -} -/** - * @brief Checks absolute and relative difference of blob values according to given threshold. - * - * @tparam dType Type of blob data - * @param res Vector of considered blob values - * @param ref Vector of reference blob values - * @param resSize Size of considered blob - * @param refSize Size of reference blob - * @param thr Threshold of difference, absolute and relative simultaneously - * @param printData A flag if data printing is demanded - */ -template -inline void compareRawBuffers(const std::vector res, - const std::vector ref, - const std::vector& resSizes, - const std::vector& refSizes, - float thr = 0.01, - bool printData = false) { - compareRawBuffers(res, ref, resSizes, refSizes, CompareType::ABS_AND_REL, thr, thr, printData); -} -/** - * @brief Checks values of two blobs according to given algorithm and thresholds. - * In ABS and REL cases thr1 corresponds to the single threshold, - * In ABS_AND_REL case thr1 and thr2 mean absolute and relative threshold - * - * @tparam dType Type of blob data - * @param res Vector of considered blob values - * @param ref Vector of reference blob values - * @param resSize Size of considered blob - * @param refSize Size of reference blob - * @param compareType Defines an algorithm of comparision - * @param thr1 First threshold of difference - * @param thr2 Second threshold of difference - * @param printData A flag if data printing is demanded - */ -template -inline void compareRawBuffers(const std::vector res, - const std::vector> ref, - const std::vector& resSizes, - const std::vector& refSizes, - CompareType compareType, - float thr1 = 0.01, - float thr2 = 0.01, - bool printData = false) { - ASSERT_TRUE(res.size() == ref.size()) << "Reference and Results vector have to be same length"; - ASSERT_TRUE(res.size() == resSizes.size()) << "Results vector and elements count vector have to be same length"; - ASSERT_TRUE(ref.size() == refSizes.size()) << "Reference vector and elements count vector have to be same length"; - for (size_t i = 0; i < res.size(); i++) { - if (printData) - std::cout << "BEGIN CHECK BUFFER [" << i << "]" << std::endl; - compareRawBuffers(res[i], *ref[i], resSizes[i], refSizes[i], compareType, thr1, thr2, printData); - if (printData) - std::cout << "END CHECK BUFFER [" << i << "]" << std::endl; - } -} -/** - * @brief Checks absolute and relative difference of blob values according to given threshold. - * - * @tparam dType Type of blob data - * @param res Vector of considered blob values - * @param ref Vector of reference blob values - * @param resSize Size of considered blob - * @param refSize Size of reference blob - * @param thr Threshold of difference, absolute and relative simultaneously - * @param printData A flag if data printing is demanded - */ -template -inline void compareRawBuffers(const std::vector res, - const std::vector> ref, - const std::vector& resSizes, - const std::vector& refSizes, - float thr = 0.01, - bool printData = false) { - compareRawBuffers(res, ref, resSizes, refSizes, CompareType::ABS_AND_REL, thr, thr, printData); -} - -inline void GetComparisonThreshold(InferenceEngine::Precision prc, float& absoluteThreshold, float& relativeThreshold) { - switch (prc) { - case InferenceEngine::Precision::FP32: - absoluteThreshold = relativeThreshold = 1e-4f; - break; - case InferenceEngine::Precision::FP16: - absoluteThreshold = relativeThreshold = 1e-2f; - break; - case InferenceEngine::Precision::I16: - case InferenceEngine::Precision::I8: - case InferenceEngine::Precision::U8: - absoluteThreshold = relativeThreshold = 1; - break; - default: - IE_THROW() << "Unhandled precision " << prc << " passed to the GetComparisonThreshold()"; - } -} - -inline float GetComparisonThreshold(InferenceEngine::Precision prc) { - float res; - GetComparisonThreshold(prc, res, res); - return res; -} - -// Copy from net_pass.h -template -inline void convertArrayPrecision(typename InferenceEngine::PrecisionTrait::value_type* dst, - const typename InferenceEngine::PrecisionTrait::value_type* src, - size_t nelem) { - using dst_type = typename InferenceEngine::PrecisionTrait::value_type; - - for (size_t i = 0; i < nelem; i++) { - dst[i] = static_cast(src[i]); - } -} - -template <> -inline void convertArrayPrecision(float* dst, - const short* src, - size_t nelem) { - auto srcBf16 = reinterpret_cast(src); - for (size_t i = 0; i < nelem; i++) { - dst[i] = static_cast(srcBf16[i]); - } -} - -template -inline InferenceEngine::Blob::Ptr convertBlobPrecision(const InferenceEngine::Blob::Ptr& blob) { - using from_d_type = typename InferenceEngine::PrecisionTrait::value_type; - using to_d_type = typename InferenceEngine::PrecisionTrait::value_type; - - auto tensor_desc = blob->getTensorDesc(); - InferenceEngine::Blob::Ptr new_blob = InferenceEngine::make_shared_blob( - InferenceEngine::TensorDesc{PREC_TO, tensor_desc.getDims(), tensor_desc.getLayout()}); - new_blob->allocate(); - auto target = new_blob->buffer().as(); - auto source = blob->buffer().as(); - convertArrayPrecision(target, source, blob->size()); - return new_blob; -} - -inline InferenceEngine::Blob::Ptr createAndFillBlobFloatNormalDistribution(const InferenceEngine::TensorDesc& td, - const float mean, - const float stddev, - const int32_t seed = 1) { - InferenceEngine::Blob::Ptr blob = make_blob_with_precision(td); - blob->allocate(); - switch (td.getPrecision()) { -#define CASE(X) \ - case X: \ - ov::test::utils::fill_data_normal_random_float(blob, mean, stddev, seed); \ - break; - CASE(InferenceEngine::Precision::FP32) - CASE(InferenceEngine::Precision::FP16) - CASE(InferenceEngine::Precision::U8) - CASE(InferenceEngine::Precision::U16) - CASE(InferenceEngine::Precision::I8) - CASE(InferenceEngine::Precision::I16) - CASE(InferenceEngine::Precision::I64) - CASE(InferenceEngine::Precision::BIN) - CASE(InferenceEngine::Precision::I32) - CASE(InferenceEngine::Precision::BOOL) -#undef CASE - default: - IE_THROW() << "Wrong precision specified: " << td.getPrecision().name(); - } - return blob; -} - -inline InferenceEngine::Blob::Ptr createAndFillBlobFloat(const InferenceEngine::TensorDesc& td, - const uint32_t range = 10, - const int32_t start_from = 0, - const int32_t resolution = 1, - const int32_t seed = 1) { - InferenceEngine::Blob::Ptr blob = make_blob_with_precision(td); - - blob->allocate(); - switch (td.getPrecision()) { -#define CASE(X) \ - case X: \ - ov::test::utils::fill_data_random_float(blob, range, start_from, resolution, seed); \ - break; - CASE(InferenceEngine::Precision::FP32) - CASE(InferenceEngine::Precision::FP16) - CASE(InferenceEngine::Precision::U8) - CASE(InferenceEngine::Precision::U16) - CASE(InferenceEngine::Precision::I8) - CASE(InferenceEngine::Precision::I16) - CASE(InferenceEngine::Precision::I64) - CASE(InferenceEngine::Precision::BIN) - CASE(InferenceEngine::Precision::I32) - CASE(InferenceEngine::Precision::BOOL) -#undef CASE - default: - IE_THROW() << "Wrong precision specified: " << td.getPrecision().name(); - } - return blob; -} - -template -inline InferenceEngine::Blob::Ptr createAndFillBlobWithFloatArray(const InferenceEngine::TensorDesc& td, - const T values[], - const int size) { - InferenceEngine::Blob::Ptr blob = make_blob_with_precision(td); - blob->allocate(); - switch (td.getPrecision()) { -#define CASE(X) \ - case X: \ - ov::test::utils::fill_data_float_array(blob, values, size); \ - break; - CASE(InferenceEngine::Precision::FP32) - CASE(InferenceEngine::Precision::FP16) - CASE(InferenceEngine::Precision::U8) - CASE(InferenceEngine::Precision::U16) - CASE(InferenceEngine::Precision::I8) - CASE(InferenceEngine::Precision::I16) - CASE(InferenceEngine::Precision::I64) - CASE(InferenceEngine::Precision::BIN) - CASE(InferenceEngine::Precision::I32) - CASE(InferenceEngine::Precision::BOOL) -#undef CASE - default: - IE_THROW() << "Wrong precision specified: " << td.getPrecision().name(); - } - return blob; -} - -inline InferenceEngine::Blob::Ptr createAndFillBlob(const InferenceEngine::TensorDesc& td, - const uint32_t range = 10, - const int32_t start_from = 0, - const int32_t resolution = 1, - const int seed = 1) { - InferenceEngine::Blob::Ptr blob = make_blob_with_precision(td); - blob->allocate(); - switch (td.getPrecision()) { -#define CASE(X) \ - case X: \ - ov::test::utils::fill_data_random(blob, range, start_from, resolution, seed); \ - break; - CASE(InferenceEngine::Precision::FP64) - CASE(InferenceEngine::Precision::FP32) - CASE(InferenceEngine::Precision::FP16) - CASE(InferenceEngine::Precision::BF16) - CASE(InferenceEngine::Precision::U4) - CASE(InferenceEngine::Precision::U8) - CASE(InferenceEngine::Precision::U32) - CASE(InferenceEngine::Precision::U16) - CASE(InferenceEngine::Precision::U64) - CASE(InferenceEngine::Precision::I4) - CASE(InferenceEngine::Precision::I8) - CASE(InferenceEngine::Precision::I16) - CASE(InferenceEngine::Precision::I32) - CASE(InferenceEngine::Precision::I64) - CASE(InferenceEngine::Precision::BIN) - CASE(InferenceEngine::Precision::BOOL) -#undef CASE - default: - IE_THROW() << "Wrong precision specified: " << td.getPrecision().name(); - } - return blob; -} - -inline InferenceEngine::Blob::Ptr createAndFillBlobConsistently(const InferenceEngine::TensorDesc& td, - const uint32_t range, - const int32_t start_from, - const int32_t resolution) { - InferenceEngine::Blob::Ptr blob = make_blob_with_precision(td); - blob->allocate(); - switch (td.getPrecision()) { -#define CASE(X) \ - case X: \ - ov::test::utils::fill_data_consistently(blob, range, start_from, resolution); \ - break; - CASE(InferenceEngine::Precision::FP32) - CASE(InferenceEngine::Precision::FP16) - CASE(InferenceEngine::Precision::U8) - CASE(InferenceEngine::Precision::U16) - CASE(InferenceEngine::Precision::I8) - CASE(InferenceEngine::Precision::I16) - CASE(InferenceEngine::Precision::I64) - CASE(InferenceEngine::Precision::BIN) - CASE(InferenceEngine::Precision::I32) - CASE(InferenceEngine::Precision::BOOL) -#undef CASE - default: - IE_THROW() << "Wrong precision specified: " << td.getPrecision().name(); - } - return blob; -} - -inline InferenceEngine::Blob::Ptr createAndFillBlobUniqueSequence(const InferenceEngine::TensorDesc& td, - const int32_t start_from = 0, - const int32_t resolution = 1, - const int32_t seed = 1) { - InferenceEngine::Blob::Ptr blob = make_blob_with_precision(td); - blob->allocate(); - auto shape = td.getDims(); - auto range = std::accumulate(begin(shape), end(shape), uint64_t(1), std::multiplies()) * 2; - switch (td.getPrecision()) { -#define CASE(X) \ - case X: \ - ov::test::utils::fill_random_unique_sequence(blob, range, start_from, resolution, seed); \ - break; - CASE(InferenceEngine::Precision::FP32) - CASE(InferenceEngine::Precision::FP16) - CASE(InferenceEngine::Precision::U8) - CASE(InferenceEngine::Precision::U16) - CASE(InferenceEngine::Precision::I8) - CASE(InferenceEngine::Precision::I16) - CASE(InferenceEngine::Precision::I64) - CASE(InferenceEngine::Precision::I32) -#undef CASE - default: - IE_THROW() << "Wrong precision specified: " << td.getPrecision().name(); - } - return blob; -} - -template -inline void fillInputsBySinValues(dType* data, size_t size) { - if (std::is_same::value) { - for (size_t i = 0; i < size; i++) { - data[i] = sin(static_cast(i)); - } - } else if (std::is_same::value) { - for (size_t i = 0; i < size; i++) { - data[i] = FuncTestUtils::Bf16TestUtils::reducePrecisionBitwiseS(sin(static_cast(i))); - } - } -} - -inline int fillInputsBySinValues(InferenceEngine::Blob::Ptr blob) { - InferenceEngine::MemoryBlob::Ptr mblob = InferenceEngine::as(blob); - if (!mblob) { - return -1; - } - if (mblob->getTensorDesc().getPrecision() != InferenceEngine::Precision::FP32) { - return -2; - } - auto lm = mblob->rwmap(); - fillInputsBySinValues(lm.as(), mblob->size()); - return 0; -} - -namespace Bf16TestUtils { - -#if defined __GNUC__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wstrict-aliasing" -# pragma GCC diagnostic ignored "-Wuninitialized" -#endif - -inline float reducePrecisionBitwise(const float in) { - float f = in; - int* i = reinterpret_cast(&f); - int t2 = *i & 0xFFFF0000; - float ft1; - memcpy(&ft1, &t2, sizeof(float)); - if ((*i & 0x8000) && (*i & 0x007F0000) != 0x007F0000) { - t2 += 0x10000; - memcpy(&ft1, &t2, sizeof(float)); - } - return ft1; -} - -inline short reducePrecisionBitwiseS(const float in) { - float f = reducePrecisionBitwise(in); - int intf = *reinterpret_cast(&f); - intf = intf >> 16; - short s = intf; - return s; -} - -#if defined __GNUC__ -# pragma GCC diagnostic pop -#endif - -} // namespace Bf16TestUtils - -enum class BlobType { - Memory, - Compound, - Remote, -}; - -inline std::ostream& operator<<(std::ostream& os, BlobType type) { - switch (type) { - case BlobType::Memory: - return os << "Memory"; - case BlobType::Remote: - return os << "Remote"; - default: - IE_THROW() << "Not supported blob type"; - } -} - -inline bool checkLayout(InferenceEngine::Layout layout, const std::vector& inputShapes) { - bool check = false; - switch (layout) { - case InferenceEngine::Layout::SCALAR: - check = inputShapes.size() == 0; - break; - case InferenceEngine::Layout::C: - check = 1 == inputShapes.size(); - break; - case InferenceEngine::Layout::BLOCKED: - case InferenceEngine::Layout::ANY: - check = true; - break; - case InferenceEngine::Layout::GOIDHW: - check = 6 == inputShapes.size(); - break; - case InferenceEngine::Layout::NCDHW: - case InferenceEngine::Layout::NDHWC: - case InferenceEngine::Layout::OIDHW: - case InferenceEngine::Layout::GOIHW: - check = 5 == inputShapes.size(); - break; - case InferenceEngine::Layout::OIHW: - case InferenceEngine::Layout::NCHW: - case InferenceEngine::Layout::NHWC: - check = 4 == inputShapes.size(); - break; - case InferenceEngine::Layout::CHW: - case InferenceEngine::Layout::HWC: - check = 3 == inputShapes.size(); - break; - case InferenceEngine::Layout::CN: - case InferenceEngine::Layout::NC: - case InferenceEngine::Layout::HW: - check = 2 == inputShapes.size(); - break; - default: - break; - } - return check; -} -} // namespace FuncTestUtils diff --git a/src/tests/test_utils/functional_test_utils/include/functional_test_utils/plugin_cache.hpp b/src/tests/test_utils/functional_test_utils/include/functional_test_utils/plugin_cache.hpp deleted file mode 100644 index 20ebb92ed0d10e..00000000000000 --- a/src/tests/test_utils/functional_test_utils/include/functional_test_utils/plugin_cache.hpp +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include -#include -#include - -namespace InferenceEngine { - -class Core; - -} // namespace InferenceEngine - -class PluginCache { -public: - std::shared_ptr ie(const std::string& deviceToCheck = std::string()); - - static PluginCache& get(); - - void reset(); - - PluginCache(const PluginCache&) = delete; - PluginCache& operator=(const PluginCache&) = delete; - -private: - PluginCache(); - ~PluginCache() = default; - - std::mutex g_mtx; - std::shared_ptr ie_core; -}; diff --git a/src/tests/test_utils/functional_test_utils/include/functional_test_utils/precision_utils.hpp b/src/tests/test_utils/functional_test_utils/include/functional_test_utils/precision_utils.hpp deleted file mode 100644 index 38ba8b8ea515f3..00000000000000 --- a/src/tests/test_utils/functional_test_utils/include/functional_test_utils/precision_utils.hpp +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include - -#include "ie_precision.hpp" -#include "openvino/core/type/element_type.hpp" - -namespace FuncTestUtils { -namespace PrecisionUtils { - -// Copied from inference-engine/src/inference_engine/src/ie_ngraph_utils.hpp -inline ::ov::element::Type convertIE2nGraphPrc(const InferenceEngine::Precision& precision) { - InferenceEngine::Precision::ePrecision pType = precision; - switch (pType) { - case InferenceEngine::Precision::UNSPECIFIED: - return ::ov::element::Type(::ov::element::Type_t::undefined); - case InferenceEngine::Precision::FP64: - return ::ov::element::Type(::ov::element::Type_t::f64); - case InferenceEngine::Precision::FP32: - return ::ov::element::Type(::ov::element::Type_t::f32); - case InferenceEngine::Precision::FP16: - return ::ov::element::Type(::ov::element::Type_t::f16); - case InferenceEngine::Precision::BF16: - return ::ov::element::Type(::ov::element::Type_t::bf16); - case InferenceEngine::Precision::U4: - return ::ov::element::Type(::ov::element::Type_t::u4); - case InferenceEngine::Precision::I4: - return ::ov::element::Type(::ov::element::Type_t::i4); - case InferenceEngine::Precision::U8: - return ::ov::element::Type(::ov::element::Type_t::u8); - case InferenceEngine::Precision::I8: - return ::ov::element::Type(::ov::element::Type_t::i8); - case InferenceEngine::Precision::U16: - return ::ov::element::Type(::ov::element::Type_t::u16); - case InferenceEngine::Precision::I16: - return ::ov::element::Type(::ov::element::Type_t::i16); - case InferenceEngine::Precision::U32: - return ::ov::element::Type(::ov::element::Type_t::u32); - case InferenceEngine::Precision::I32: - return ::ov::element::Type(::ov::element::Type_t::i32); - case InferenceEngine::Precision::I64: - return ::ov::element::Type(::ov::element::Type_t::i64); - case InferenceEngine::Precision::U64: - return ::ov::element::Type(::ov::element::Type_t::u64); - case InferenceEngine::Precision::BOOL: - return ::ov::element::Type(::ov::element::Type_t::boolean); - case InferenceEngine::Precision::BIN: - return ::ov::element::Type(::ov::element::Type_t::u1); - case InferenceEngine::Precision::Q78: - case InferenceEngine::Precision::MIXED: - case InferenceEngine::Precision::CUSTOM: - default: - IE_THROW() << "Incorrect precision!"; - } -} - -} // namespace PrecisionUtils -} // namespace FuncTestUtils \ No newline at end of file diff --git a/src/tests/test_utils/functional_test_utils/src/plugin_cache.cpp b/src/tests/test_utils/functional_test_utils/src/plugin_cache.cpp deleted file mode 100644 index e809f9d260ca89..00000000000000 --- a/src/tests/test_utils/functional_test_utils/src/plugin_cache.cpp +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "functional_test_utils/plugin_cache.hpp" - -#include - -#include -#include - -#include "common_test_utils/file_utils.hpp" -#include "common_test_utils/test_constants.hpp" -#include "functional_test_utils/ov_plugin_cache.hpp" -#include "ie_core.hpp" -#include "openvino/util/file_util.hpp" - -namespace { -class TestListener : public testing::EmptyTestEventListener { -public: - void OnTestEnd(const testing::TestInfo& testInfo) override { - if (auto testResult = testInfo.result()) { - if (testResult->Failed()) { - PluginCache::get().reset(); - } - } - } -}; -} // namespace - -PluginCache& PluginCache::get() { - static PluginCache instance; - return instance; -} - -std::shared_ptr PluginCache::ie(const std::string& deviceToCheck) { - std::lock_guard lock(g_mtx); - if (std::getenv("DISABLE_PLUGIN_CACHE") != nullptr) { -#ifndef NDEBUG - std::cout << "'DISABLE_PLUGIN_CACHE' environment variable is set. New Core object will be created!" - << std::endl; -#endif - return std::make_shared(); - } -#ifndef NDEBUG - std::cout << "Access PluginCache ie core. IE Core use count: " << ie_core.use_count() << std::endl; -#endif - - if (!ie_core) { -#ifndef NDEBUG - std::cout << "Created ie core." << std::endl; -#endif - ie_core = std::make_shared(); - } - assert(0 != ie_core.use_count()); - - // register template plugin if it is needed - try { - std::string pluginName = "openvino_template_plugin"; - pluginName += OV_BUILD_POSTFIX; - ie_core->RegisterPlugin( - ov::util::make_plugin_library_name(ov::test::utils::getExecutableDirectory(), pluginName), - "TEMPLATE"); - } catch (...) { - } - - if (!deviceToCheck.empty()) { - std::vector metrics; - if (deviceToCheck.find(':') != std::string::npos) { - std::string realDevice = deviceToCheck.substr(0, deviceToCheck.find(':')); - metrics = {ie_core->GetMetric(realDevice, ov::supported_properties.name()).as()}; - } else { - metrics = {ie_core->GetMetric(deviceToCheck, ov::supported_properties.name()).as()}; - } - if (std::find(metrics.begin(), metrics.end(), ov::supported_properties.name()) != metrics.end()) { - auto availableDevices = - ie_core->GetMetric(deviceToCheck, ov::supported_properties.name()).as>(); - - if (availableDevices.empty()) { - std::cerr << "No available devices for " << deviceToCheck << std::endl; - std::exit(EXIT_FAILURE); - } - -#ifndef NDEBUG - std::cout << "Available devices for " << deviceToCheck << ":" << std::endl; - - for (const auto& device : availableDevices) { - std::cout << " " << device << std::endl; - } -#endif - } - } - return ie_core; -} - -void PluginCache::reset() { - std::lock_guard lock(g_mtx); - -#ifndef NDEBUG - std::cout << "Reset PluginCache. IE Core use count: " << ie_core.use_count() << std::endl; -#endif - - ie_core.reset(); -} - -PluginCache::PluginCache() { - auto& listeners = testing::UnitTest::GetInstance()->listeners(); - listeners.Append(new TestListener); -} diff --git a/src/tests/test_utils/unit_test_utils/mocks/mock_engine/mock_plugin.cpp b/src/tests/test_utils/unit_test_utils/mocks/mock_engine/mock_plugin.cpp index a528596a468884..ae619f66f2a2a4 100644 --- a/src/tests/test_utils/unit_test_utils/mocks/mock_engine/mock_plugin.cpp +++ b/src/tests/test_utils/unit_test_utils/mocks/mock_engine/mock_plugin.cpp @@ -12,7 +12,6 @@ #include #include -#include "cpp_interfaces/interface/ie_iplugin_internal.hpp" #include "description_buffer.hpp" #include "openvino/core/except.hpp" #include "openvino/runtime/common.hpp" diff --git a/src/tests/test_utils/unit_test_utils/mocks/mock_engine/mock_plugin.hpp b/src/tests/test_utils/unit_test_utils/mocks/mock_engine/mock_plugin.hpp index 505eeca3a32ee0..f06422af2a46a2 100644 --- a/src/tests/test_utils/unit_test_utils/mocks/mock_engine/mock_plugin.hpp +++ b/src/tests/test_utils/unit_test_utils/mocks/mock_engine/mock_plugin.hpp @@ -9,10 +9,6 @@ #include "openvino/runtime/iplugin.hpp" -namespace InferenceEngine { -class IInferencePlugin; -} - class MockPlugin : public ov::IPlugin { std::shared_ptr m_plugin; void set_parameters_if_need() const;