[apiConformance] Refactoor core_integration.cpp (#16416)

This commit is contained in:
Sofya Balandina 2023-04-15 00:15:41 +01:00 committed by GitHub
parent 4ba0ac5476
commit 9f3bc22e7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 2320 additions and 1718 deletions

View File

@ -3,77 +3,76 @@
//
#include "behavior/ov_executable_network/properties.hpp"
#include "openvino/runtime/properties.hpp"
#include "ie_system_conf.h"
#include "openvino/runtime/properties.hpp"
using namespace ov::test::behavior;
namespace {
const std::vector<ov::AnyMap> inproperties = {
{ov::num_streams(-100)},
{ov::num_streams(-100)},
};
const std::vector<ov::AnyMap> hetero_inproperties = {
{ov::num_streams(-100)},
{ov::num_streams(-100)},
};
const std::vector<ov::AnyMap> multi_inproperties = {
{ov::num_streams(-100)},
{ov::num_streams(-100)},
};
const std::vector<ov::AnyMap> auto_inproperties = {
{ov::num_streams(-100)},
{ov::num_streams(-100)},
};
const std::vector<ov::AnyMap> auto_batch_inproperties = {
{ov::num_streams(-100)},
{{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG) , std::string(CommonTestUtils::DEVICE_CPU) + "(4)"}, {ov::auto_batch_timeout(-1)}},
{ov::num_streams(-100)},
{{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), std::string(CommonTestUtils::DEVICE_CPU) + "(4)"},
{ov::auto_batch_timeout(-1)}},
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVCompiledModelPropertiesIncorrectTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(inproperties)),
OVCompiledModelPropertiesIncorrectTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
OVCompiledModelPropertiesIncorrectTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(inproperties)),
OVCompiledModelPropertiesIncorrectTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, OVCompiledModelPropertiesIncorrectTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(hetero_inproperties)),
OVCompiledModelPropertiesIncorrectTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests,
OVCompiledModelPropertiesIncorrectTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(hetero_inproperties)),
OVCompiledModelPropertiesIncorrectTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVCompiledModelPropertiesIncorrectTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multi_inproperties)),
OVCompiledModelPropertiesIncorrectTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests,
OVCompiledModelPropertiesIncorrectTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multi_inproperties)),
OVCompiledModelPropertiesIncorrectTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVCompiledModelPropertiesIncorrectTests,
::testing::Combine(
::testing::Values("AUTO:CPU"),
::testing::ValuesIn(auto_inproperties)),
OVCompiledModelPropertiesIncorrectTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests,
OVCompiledModelPropertiesIncorrectTests,
::testing::Combine(::testing::Values("AUTO:CPU"), ::testing::ValuesIn(auto_inproperties)),
OVCompiledModelPropertiesIncorrectTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_AutoBatch_BehaviorTests, OVCompiledModelPropertiesIncorrectTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_BATCH),
::testing::ValuesIn(auto_batch_inproperties)),
OVCompiledModelPropertiesIncorrectTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_AutoBatch_BehaviorTests,
OVCompiledModelPropertiesIncorrectTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_BATCH),
::testing::ValuesIn(auto_batch_inproperties)),
OVCompiledModelPropertiesIncorrectTests::getTestCaseName);
#if (defined(__APPLE__) || defined(_WIN32))
auto default_affinity = [] {
auto numaNodes = InferenceEngine::getAvailableNUMANodes();
auto coreTypes = InferenceEngine::getAvailableCoresTypes();
if (coreTypes.size() > 1) {
return ov::Affinity::HYBRID_AWARE;
} else if (numaNodes.size() > 1) {
return ov::Affinity::NUMA;
} else {
return ov::Affinity::NONE;
}
auto numaNodes = InferenceEngine::getAvailableNUMANodes();
auto coreTypes = InferenceEngine::getAvailableCoresTypes();
if (coreTypes.size() > 1) {
return ov::Affinity::HYBRID_AWARE;
} else if (numaNodes.size() > 1) {
return ov::Affinity::NUMA;
} else {
return ov::Affinity::NONE;
}
}();
#else
auto default_affinity = [] {
@ -87,63 +86,67 @@ auto default_affinity = [] {
#endif
const std::vector<ov::AnyMap> default_properties = {
{ov::affinity(default_affinity)},
{ov::affinity(default_affinity)},
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVCompiledModelPropertiesDefaultTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(default_properties)),
OVCompiledModelPropertiesDefaultTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
OVCompiledModelPropertiesDefaultTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(default_properties)),
OVCompiledModelPropertiesDefaultTests::getTestCaseName);
const std::vector<ov::AnyMap> properties = {
{ov::num_streams(ov::streams::NUMA)},
{ov::num_streams(ov::streams::AUTO)},
{ov::num_streams(0), ov::inference_num_threads(1)},
{ov::num_streams(1), ov::inference_num_threads(1)},
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}
};
const std::vector<ov::AnyMap> properties = {{ov::num_streams(ov::streams::NUMA)},
{ov::num_streams(ov::streams::AUTO)},
{ov::num_streams(0), ov::inference_num_threads(1)},
{ov::num_streams(1), ov::inference_num_threads(1)},
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS,
InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}};
const std::vector<ov::AnyMap> hetero_properties = {
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::num_streams(ov::streams::AUTO)},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::num_streams(ov::streams::AUTO)},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS,
InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}},
};
const std::vector<ov::AnyMap> multi_properties = {
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::num_streams(ov::streams::AUTO)},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::num_streams(ov::streams::AUTO)},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS,
InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}},
};
const std::vector<ov::AnyMap> auto_batch_properties = {
{{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG) , std::string(CommonTestUtils::DEVICE_CPU) + "(4)"}},
{{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG) , std::string(CommonTestUtils::DEVICE_CPU) + "(4)"}, {CONFIG_KEY(AUTO_BATCH_TIMEOUT) , "1"}},
{{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG) , std::string(CommonTestUtils::DEVICE_CPU) + "(4)"}, {ov::auto_batch_timeout(10)}},
{{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), std::string(CommonTestUtils::DEVICE_CPU) + "(4)"}},
{{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), std::string(CommonTestUtils::DEVICE_CPU) + "(4)"},
{CONFIG_KEY(AUTO_BATCH_TIMEOUT), "1"}},
{{CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), std::string(CommonTestUtils::DEVICE_CPU) + "(4)"},
{ov::auto_batch_timeout(10)}},
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVCompiledModelPropertiesTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(properties)),
OVCompiledModelPropertiesTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
OVCompiledModelPropertiesTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(properties)),
OVCompiledModelPropertiesTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, OVCompiledModelPropertiesTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(hetero_properties)),
OVCompiledModelPropertiesTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests,
OVCompiledModelPropertiesTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(hetero_properties)),
OVCompiledModelPropertiesTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVCompiledModelPropertiesTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multi_properties)),
OVCompiledModelPropertiesTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests,
OVCompiledModelPropertiesTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multi_properties)),
OVCompiledModelPropertiesTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_AutoBatch_BehaviorTests, OVCompiledModelPropertiesTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_BATCH),
::testing::ValuesIn(auto_batch_properties)),
OVCompiledModelPropertiesTests::getTestCaseName);
} // namespace
INSTANTIATE_TEST_SUITE_P(smoke_AutoBatch_BehaviorTests,
OVCompiledModelPropertiesTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_BATCH),
::testing::ValuesIn(auto_batch_properties)),
OVCompiledModelPropertiesTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_OVClassCompileModelTest, OVClassCompileModelTest, ::testing::Values("CPU"));
} // namespace

View File

@ -3,10 +3,13 @@
//
#include "behavior/ov_plugin/core_integration.hpp"
#include <openvino/runtime/properties.hpp>
#include "ie_system_conf.h"
#include "openvino/runtime/core.hpp"
#include "behavior/ov_plugin/core_integration_sw.hpp"
#include "behavior/ov_plugin/query_model.hpp"
#include "openvino/core/type/element_type.hpp"
#include "openvino/runtime/core.hpp"
using namespace ov::test::behavior;
using namespace InferenceEngine::PluginConfigParams;
@ -19,439 +22,12 @@ namespace {
// IE Class Common tests with <pluginName, deviceName params>
//
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassCommon, OVClassBasicTestP,
::testing::Values(std::make_pair(cpu_plugin_file_name, "CPU")));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassNetworkTestP, OVClassNetworkTestP,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassImportExportTestP, OVClassImportExportTestP,
::testing::Values("HETERO:CPU"));
//
// IE Class GetMetric
//
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetMetricTest, OVClassGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("CPU", "MULTI", "HETERO", "AUTO"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetMetricTest, OVClassGetMetricTest_SUPPORTED_METRICS,
::testing::Values("CPU", "MULTI", "HETERO", "AUTO"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetMetricTest, OVClassGetMetricTest_AVAILABLE_DEVICES,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetMetricTest, OVClassGetMetricTest_FULL_DEVICE_NAME,
::testing::Values("CPU", "MULTI", "HETERO", "AUTO"));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassSetConfigTest,
OVClassSetEnableHyperThreadingHintConfigTest,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassSetConfigTest,
OVClassSetSchedulingCoreTypeHintConfigTest,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetMetricTest, OVClassGetMetricTest_OPTIMIZATION_CAPABILITIES,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetMetricTest, OVClassGetMetricTest_RANGE_FOR_ASYNC_INFER_REQUESTS,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetMetricTest, OVClassGetMetricTest_RANGE_FOR_STREAMS,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetMetricTest, OVClassGetMetricTest_ThrowUnsupported,
::testing::Values("CPU", "MULTI", "HETERO", "AUTO"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetConfigTest, OVClassGetConfigTest_ThrowUnsupported,
::testing::Values("CPU", "MULTI", "HETERO", "AUTO"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetAvailableDevices, OVClassGetAvailableDevices,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassSetConfigTest, OVClassSetEnableCpuPinningHintConfigTest, ::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassSetModelPriorityConfigTest, OVClassSetModelPriorityConfigTest,
::testing::Values("MULTI", "AUTO"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassSetTBBForceTerminatePropertyTest, OVClassSetTBBForceTerminatePropertyTest,
::testing::Values("AUTO", "GPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassSetLogLevelConfigTest, OVClassSetLogLevelConfigTest,
::testing::Values("MULTI", "AUTO"));
const std::vector<ov::AnyMap> multiConfigs = {
{ov::device::priorities(CommonTestUtils::DEVICE_CPU)}
};
const std::vector<ov::AnyMap> configsDeviceProperties = {{ov::device::properties("CPU", ov::num_streams(3))},
{ov::device::properties(ov::AnyMap{{"CPU", ov::AnyMap{ov::num_streams(3)}}})}};
const std::vector<ov::AnyMap> configsDevicePropertiesDouble = {{ov::device::properties("CPU", ov::num_streams(5)),
ov::num_streams(3)},
{ov::device::properties("CPU", ov::num_streams(5)),
ov::device::properties(ov::AnyMap{{"CPU", ov::AnyMap{ov::num_streams(7)}}}),
ov::num_streams(3)},
{ov::device::properties("CPU", ov::num_streams(3)),
ov::device::properties("CPU", ov::num_streams(5))},
{ov::device::properties("CPU", ov::num_streams(3)),
ov::device::properties(ov::AnyMap{{"CPU", ov::AnyMap{ov::num_streams(5)}}})},
{ov::device::properties(ov::AnyMap{{"CPU", ov::AnyMap{ov::num_streams(3)}}}),
ov::device::properties(ov::AnyMap{{"CPU", ov::AnyMap{ov::num_streams(5)}}})}};
const std::vector<ov::AnyMap> configsWithSecondaryProperties = {
{ov::device::properties("CPU", ov::num_streams(4))},
{ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)),
ov::device::properties("GPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY))}};
const std::vector<ov::AnyMap> multiConfigsWithSecondaryProperties = {
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)),
ov::device::properties("GPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY))}};
const std::vector<ov::AnyMap> autoConfigsWithSecondaryProperties = {
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("AUTO",
ov::enable_profiling(false),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)),
ov::device::properties("GPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY))},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("AUTO",
ov::enable_profiling(false),
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::device::properties("AUTO",
ov::enable_profiling(false),
ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)),
ov::device::properties("GPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY))}};
const std::vector<ov::AnyMap> heteroConfigsWithSecondaryProperties = {
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("HETERO",
ov::enable_profiling(false),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)),
ov::device::properties("GPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY))},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("HETERO",
ov::enable_profiling(false),
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::device::properties("HETERO",
ov::enable_profiling(false),
ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)),
ov::device::properties("GPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY))}};
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassSetDevicePriorityConfigTest, OVClassSetDevicePriorityConfigTest,
::testing::Combine(::testing::Values("MULTI", "AUTO", "HETERO"),
::testing::ValuesIn(multiConfigs)));
//
// IE Class GetConfig
//
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetConfigTest, OVClassGetConfigTest,
::testing::Values("CPU"));
//////////////////////////////////////////////////////////////////////////////////////////
TEST(OVClassBasicTest, smoke_SetConfigInferenceNumThreads) {
ov::Core ie;
int32_t value = 0;
int32_t num_threads = 1;
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::inference_num_threads(num_threads)));
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::inference_num_threads));
ASSERT_EQ(num_threads, value);
num_threads = 4;
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::inference_num_threads(num_threads)));
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::inference_num_threads));
ASSERT_EQ(num_threads, value);
}
TEST(OVClassBasicTest, smoke_SetConfigStreamsNum) {
ov::Core ie;
int32_t value = 0;
int32_t num_streams = 1;
auto setGetProperty = [&ie](int32_t& getProperty, int32_t setProperty){
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::num_streams(setProperty)));
OV_ASSERT_NO_THROW(getProperty = ie.get_property("CPU", ov::num_streams));
};
setGetProperty(value, num_streams);
ASSERT_EQ(num_streams, value);
num_streams = ov::streams::NUMA;
setGetProperty(value, num_streams);
ASSERT_GT(value, 0); // value has been configured automatically
num_streams = ov::streams::AUTO;
setGetProperty(value, num_streams);
ASSERT_GT(value, 0); // value has been configured automatically
}
TEST(OVClassBasicTest, smoke_SetConfigAffinity) {
SKIP_IF_CURRENT_TEST_IS_DISABLED();
ov::Core ie;
ov::Affinity value = ov::Affinity::NONE;
#if (defined(__APPLE__) || defined(_WIN32))
auto numaNodes = InferenceEngine::getAvailableNUMANodes();
auto coreTypes = InferenceEngine::getAvailableCoresTypes();
auto defaultBindThreadParameter = ov::Affinity::NONE;
if (coreTypes.size() > 1) {
defaultBindThreadParameter = ov::Affinity::HYBRID_AWARE;
} else if (numaNodes.size() > 1) {
defaultBindThreadParameter = ov::Affinity::NUMA;
}
#else
auto defaultBindThreadParameter = ov::Affinity::CORE;
auto coreTypes = InferenceEngine::getAvailableCoresTypes();
if (coreTypes.size() > 1) {
defaultBindThreadParameter = ov::Affinity::HYBRID_AWARE;
}
#endif
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::affinity));
ASSERT_EQ(defaultBindThreadParameter, value);
const ov::Affinity affinity = defaultBindThreadParameter == ov::Affinity::HYBRID_AWARE ? ov::Affinity::NUMA : ov::Affinity::HYBRID_AWARE;
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::affinity(affinity)));
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::affinity));
ASSERT_EQ(affinity, value);
}
TEST(OVClassBasicTest, smoke_SetConfigHintInferencePrecision) {
ov::Core ie;
auto value = ov::element::f32;
const auto precision = InferenceEngine::with_cpu_x86_bfloat16() ? ov::element::bf16 : ov::element::f32;
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::hint::inference_precision));
ASSERT_EQ(precision, value);
const auto forcedPrecision = ov::element::f32;
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::hint::inference_precision(forcedPrecision)));
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::hint::inference_precision));
ASSERT_EQ(value, forcedPrecision);
OPENVINO_SUPPRESS_DEPRECATED_START
const auto forced_precision_deprecated = ov::element::f32;
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::hint::inference_precision(forced_precision_deprecated)));
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::hint::inference_precision));
ASSERT_EQ(value, forced_precision_deprecated);
OPENVINO_SUPPRESS_DEPRECATED_END
}
TEST(OVClassBasicTest, smoke_SetConfigEnableProfiling) {
ov::Core ie;
auto value = false;
const bool enableProfilingDefault = false;
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::enable_profiling));
ASSERT_EQ(enableProfilingDefault, value);
const bool enableProfiling = true;
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::enable_profiling(enableProfiling)));
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::enable_profiling));
ASSERT_EQ(enableProfiling, value);
}
const auto bf16_if_supported = InferenceEngine::with_cpu_x86_bfloat16() ? ov::element::bf16 : ov::element::f32;
const auto bf16_if_can_be_emulated = InferenceEngine::with_cpu_x86_avx512_core() ? ov::element::bf16 : ov::element::f32;
using ExpectedModeAndType = std::pair<ov::hint::ExecutionMode, ov::element::Type>;
const std::map<ov::hint::ExecutionMode, ExpectedModeAndType> exectedTypeByMode {
{ov::hint::ExecutionMode::PERFORMANCE, {ov::hint::ExecutionMode::PERFORMANCE,
bf16_if_supported}},
{ov::hint::ExecutionMode::ACCURACY, {ov::hint::ExecutionMode::ACCURACY,
ov::element::f32}},
};
TEST(OVClassBasicTest, smoke_SetConfigExecutionModeExpectCorrespondingInferencePrecision) {
ov::Core ie;
const auto inference_precision_default = bf16_if_supported;
const auto execution_mode_default = ov::hint::ExecutionMode::PERFORMANCE;
auto execution_mode_value = ov::hint::ExecutionMode::PERFORMANCE;
auto inference_precision_value = ov::element::undefined;
// check default values
OV_ASSERT_NO_THROW(inference_precision_value = ie.get_property("CPU", ov::hint::inference_precision));
ASSERT_EQ(inference_precision_value, inference_precision_default);
OV_ASSERT_NO_THROW(execution_mode_value = ie.get_property("CPU", ov::hint::execution_mode));
ASSERT_EQ(execution_mode_value, execution_mode_default);
for (const auto& m : exectedTypeByMode) {
const auto execution_mode = m.first;
const auto execution_mode_exected = m.second.first;
const auto inference_precision_exected = m.second.second;
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::hint::execution_mode(execution_mode)));
OV_ASSERT_NO_THROW(execution_mode_value = ie.get_property("CPU", ov::hint::execution_mode));
ASSERT_EQ(execution_mode_value, execution_mode_exected);
OV_ASSERT_NO_THROW(inference_precision_value = ie.get_property("CPU", ov::hint::inference_precision));
ASSERT_EQ(inference_precision_value, inference_precision_exected);
}
}
TEST(OVClassBasicTest, smoke_SetConfigExecutionModeAndInferencePrecision) {
ov::Core ie;
const auto inference_precision_default = bf16_if_supported;
const auto execution_mode_default = ov::hint::ExecutionMode::PERFORMANCE;
auto expect_execution_mode = [&](const ov::hint::ExecutionMode expected_value) {
auto execution_mode_value = ov::hint::ExecutionMode::ACCURACY;
OV_ASSERT_NO_THROW(execution_mode_value = ie.get_property("CPU", ov::hint::execution_mode));
ASSERT_EQ(execution_mode_value, expected_value);
};
auto expect_inference_precision = [&](const ov::element::Type expected_value) {
auto inference_precision_value = ov::element::undefined;;
OV_ASSERT_NO_THROW(inference_precision_value = ie.get_property("CPU", ov::hint::inference_precision));
ASSERT_EQ(inference_precision_value, expected_value);
};
// check default values
expect_execution_mode(execution_mode_default);
expect_inference_precision(inference_precision_default);
// verify that conflicting property values work as expect
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::hint::execution_mode(ov::hint::ExecutionMode::PERFORMANCE)));
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::hint::inference_precision(ov::element::f32)));
expect_execution_mode(ov::hint::ExecutionMode::PERFORMANCE); // inference_preicision does not affect execution_mode property itself
expect_inference_precision(ov::element::f32); // inference_preicision has more priority than performance mode
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::hint::execution_mode(ov::hint::ExecutionMode::ACCURACY)));
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::hint::inference_precision(bf16_if_can_be_emulated)));
expect_execution_mode(ov::hint::ExecutionMode::ACCURACY);
expect_inference_precision(bf16_if_can_be_emulated);
}
// IE Class Query network
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassQueryNetworkTest, OVClassQueryNetworkTest,
::testing::Values("CPU"));
// IE Class Load network
INSTANTIATE_TEST_SUITE_P(smoke_CPU_OVClassLoadNetworkWithCorrectSecondaryPropertiesTest,
OVClassLoadNetworkWithCorrectPropertiesTest,
::testing::Combine(::testing::Values("CPU", "AUTO:CPU", "MULTI:CPU", "HETERO:CPU"),
::testing::ValuesIn(configsWithSecondaryProperties)));
INSTANTIATE_TEST_SUITE_P(smoke_Multi_OVClassLoadNetworkWithSecondaryPropertiesTest,
OVClassLoadNetworkWithCorrectPropertiesTest,
::testing::Combine(::testing::Values("MULTI"),
::testing::ValuesIn(multiConfigsWithSecondaryProperties)));
INSTANTIATE_TEST_SUITE_P(smoke_AUTO_OVClassLoadNetworkWithSecondaryPropertiesTest,
OVClassLoadNetworkWithCorrectPropertiesTest,
::testing::Combine(::testing::Values("AUTO"),
::testing::ValuesIn(autoConfigsWithSecondaryProperties)));
INSTANTIATE_TEST_SUITE_P(smoke_HETERO_OVClassLoadNetworkWithSecondaryPropertiesTest,
OVClassLoadNetworkWithCorrectPropertiesTest,
::testing::Combine(::testing::Values("HETERO"),
::testing::ValuesIn(heteroConfigsWithSecondaryProperties)));
// IE Class load and check network with ov::device::properties
INSTANTIATE_TEST_SUITE_P(smoke_CPU_OVClassLoadNetworkAndCheckWithSecondaryPropertiesTest,
OVClassLoadNetworkAndCheckSecondaryPropertiesTest,
::testing::Combine(::testing::Values("CPU"),
::testing::ValuesIn(configsDeviceProperties)));
INSTANTIATE_TEST_SUITE_P(smoke_CPU_OVClassLoadNetworkAndCheckWithSecondaryPropertiesDoubleTest,
OVClassLoadNetworkAndCheckSecondaryPropertiesTest,
::testing::Combine(::testing::Values("CPU"),
::testing::ValuesIn(configsDevicePropertiesDouble)));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassLoadNetworkTest, OVClassLoadNetworkTest,
::testing::Values("CPU"));
const std::vector<ov::AnyMap> auto_multi_default_properties = {{}, {ov::hint::allow_auto_batching(true)}};
INSTANTIATE_TEST_SUITE_P(smoke_AUTO_MULTI_ReturnDefaultHintTest,
OVClassLoadNetWorkReturnDefaultHintTest,
::testing::Combine(::testing::Values("AUTO:CPU", "MULTI:CPU"),
::testing::ValuesIn(auto_multi_default_properties)));
// For AUTO, User sets perf_hint, AUTO's perf_hint should not return default value LATENCY
const std::vector<ov::AnyMap> default_auto_properties = {
{ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)}};
// For MULTI, User sets perf_hint or Affinity or num_streams or infer_num_threads, MULTI's perf_hint should
// not return default value THROUGHPUT
// For Secondary property test about default hint is in auto_load_network_properties_test.cpp
const std::vector<ov::AnyMap> default_multi_properties = {
{ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)},
{ov::affinity(ov::Affinity::NONE)},
{ov::num_streams(ov::streams::AUTO)},
{ov::inference_num_threads(1)}};
INSTANTIATE_TEST_SUITE_P(smoke_AUTO_DoNotReturnDefaultHintTest,
OVClassLoadNetWorkDoNotReturnDefaultHintTest,
::testing::Combine(::testing::Values("AUTO:CPU"),
::testing::ValuesIn(default_auto_properties)));
INSTANTIATE_TEST_SUITE_P(smoke_MULTI_DoNotReturnDefaultHintTest,
OVClassLoadNetWorkDoNotReturnDefaultHintTest,
::testing::Combine(::testing::Values("MULTI:CPU"),
::testing::ValuesIn(default_multi_properties)));
// IE Class Query model
INSTANTIATE_TEST_SUITE_P(smoke_OVClassQueryModelTest, OVClassQueryModelTest, ::testing::Values("CPU"));
const std::vector<ov::AnyMap> configsWithEmpty = {{}};
const std::vector<ov::AnyMap> configsWithMetaPlugin = {{ov::device::priorities("AUTO")},
@ -462,14 +38,15 @@ const std::vector<ov::AnyMap> configsWithMetaPlugin = {{ov::device::priorities("
INSTANTIATE_TEST_SUITE_P(
smoke_MULTI_AUTO_DoNotSupportMetaPluginLoadingItselfRepeatedlyWithEmptyConfigTest,
OVClassLoadNetworkWithCondidateDeviceListContainedMetaPluginTest,
OVClassCompileModelWithCondidateDeviceListContainedMetaPluginTest,
::testing::Combine(::testing::Values("MULTI:AUTO", "AUTO:MULTI", "MULTI:CPU,AUTO", "AUTO:CPU,MULTI"),
::testing::ValuesIn(configsWithEmpty)),
::testing::PrintToStringParamName());
INSTANTIATE_TEST_SUITE_P(smoke_MULTI_AUTO_DoNotSupportMetaPluginLoadingItselfRepeatedlyTest,
OVClassLoadNetworkWithCondidateDeviceListContainedMetaPluginTest,
OVClassCompileModelWithCondidateDeviceListContainedMetaPluginTest,
::testing::Combine(::testing::Values("MULTI", "AUTO"),
::testing::ValuesIn(configsWithMetaPlugin)),
::testing::PrintToStringParamName());
} // namespace

View File

@ -3,41 +3,230 @@
//
#include "behavior/ov_plugin/properties_tests.hpp"
#include <openvino/runtime/auto/properties.hpp>
#include "ie_system_conf.h"
using namespace ov::test::behavior;
using namespace InferenceEngine::PluginConfigParams;
namespace {
const std::vector<ov::AnyMap> cpu_properties = {
{ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)},
{ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)},
INSTANTIATE_TEST_SUITE_P(smoke_OVClassCommon,
OVClassBasicPropsTestP,
::testing::Values(std::make_pair("openvino_intel_cpu_plugin", "CPU")));
//////////////////////////////////////////////////////////////////////////////////////////
TEST(OVClassBasicPropsTest, smoke_SetConfigInferenceNumThreads) {
ov::Core ie;
int32_t value = 0;
int32_t num_threads = 1;
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::inference_num_threads(num_threads)));
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::inference_num_threads));
ASSERT_EQ(num_threads, value);
num_threads = 4;
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::inference_num_threads(num_threads)));
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::inference_num_threads));
ASSERT_EQ(num_threads, value);
}
TEST(OVClassBasicPropsTest, smoke_SetConfigStreamsNum) {
ov::Core ie;
int32_t value = 0;
int32_t num_streams = 1;
auto setGetProperty = [&ie](int32_t& getProperty, int32_t setProperty) {
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::num_streams(setProperty)));
OV_ASSERT_NO_THROW(getProperty = ie.get_property("CPU", ov::num_streams));
};
setGetProperty(value, num_streams);
ASSERT_EQ(num_streams, value);
num_streams = ov::streams::NUMA;
setGetProperty(value, num_streams);
ASSERT_GT(value, 0); // value has been configured automatically
num_streams = ov::streams::AUTO;
setGetProperty(value, num_streams);
ASSERT_GT(value, 0); // value has been configured automatically
}
TEST(OVClassBasicPropsTest, smoke_SetConfigAffinity) {
ov::Core ie;
ov::Affinity value = ov::Affinity::NONE;
#if (defined(__APPLE__) || defined(_WIN32))
auto numaNodes = InferenceEngine::getAvailableNUMANodes();
auto coreTypes = InferenceEngine::getAvailableCoresTypes();
auto defaultBindThreadParameter = ov::Affinity::NONE;
if (coreTypes.size() > 1) {
defaultBindThreadParameter = ov::Affinity::HYBRID_AWARE;
} else if (numaNodes.size() > 1) {
defaultBindThreadParameter = ov::Affinity::NUMA;
}
#else
auto defaultBindThreadParameter = ov::Affinity::CORE;
auto coreTypes = InferenceEngine::getAvailableCoresTypes();
if (coreTypes.size() > 1) {
defaultBindThreadParameter = ov::Affinity::HYBRID_AWARE;
}
#endif
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::affinity));
ASSERT_EQ(defaultBindThreadParameter, value);
const ov::Affinity affinity =
defaultBindThreadParameter == ov::Affinity::HYBRID_AWARE ? ov::Affinity::NUMA : ov::Affinity::HYBRID_AWARE;
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::affinity(affinity)));
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::affinity));
ASSERT_EQ(affinity, value);
}
TEST(OVClassBasicPropsTest, smoke_SetConfigHintInferencePrecision) {
ov::Core ie;
auto value = ov::element::f32;
const auto precision = InferenceEngine::with_cpu_x86_bfloat16() ? ov::element::bf16 : ov::element::f32;
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::hint::inference_precision));
ASSERT_EQ(precision, value);
const auto forcedPrecision = ov::element::f32;
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::hint::inference_precision(forcedPrecision)));
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::hint::inference_precision));
ASSERT_EQ(value, forcedPrecision);
OPENVINO_SUPPRESS_DEPRECATED_START
const auto forced_precision_deprecated = ov::element::f32;
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::hint::inference_precision(forced_precision_deprecated)));
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::hint::inference_precision));
ASSERT_EQ(value, forced_precision_deprecated);
OPENVINO_SUPPRESS_DEPRECATED_END
}
TEST(OVClassBasicPropsTest, smoke_SetConfigEnableProfiling) {
ov::Core ie;
auto value = false;
const bool enableProfilingDefault = false;
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::enable_profiling));
ASSERT_EQ(enableProfilingDefault, value);
const bool enableProfiling = true;
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::enable_profiling(enableProfiling)));
OV_ASSERT_NO_THROW(value = ie.get_property("CPU", ov::enable_profiling));
ASSERT_EQ(enableProfiling, value);
}
const auto bf16_if_supported = InferenceEngine::with_cpu_x86_bfloat16() ? ov::element::bf16 : ov::element::f32;
const auto bf16_if_can_be_emulated = InferenceEngine::with_cpu_x86_avx512_core() ? ov::element::bf16 : ov::element::f32;
using ExpectedModeAndType = std::pair<ov::hint::ExecutionMode, ov::element::Type>;
const std::map<ov::hint::ExecutionMode, ExpectedModeAndType> exectedTypeByMode{
{ov::hint::ExecutionMode::PERFORMANCE, {ov::hint::ExecutionMode::PERFORMANCE, bf16_if_supported}},
{ov::hint::ExecutionMode::ACCURACY, {ov::hint::ExecutionMode::ACCURACY, ov::element::f32}},
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVPropertiesTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(cpu_properties)),
OVPropertiesTests::getTestCaseName);
TEST(OVClassBasicPropsTest, smoke_SetConfigExecutionModeExpectCorrespondingInferencePrecision) {
ov::Core ie;
const auto inference_precision_default = bf16_if_supported;
const auto execution_mode_default = ov::hint::ExecutionMode::PERFORMANCE;
auto execution_mode_value = ov::hint::ExecutionMode::PERFORMANCE;
auto inference_precision_value = ov::element::undefined;
// check default values
OV_ASSERT_NO_THROW(inference_precision_value = ie.get_property("CPU", ov::hint::inference_precision));
ASSERT_EQ(inference_precision_value, inference_precision_default);
OV_ASSERT_NO_THROW(execution_mode_value = ie.get_property("CPU", ov::hint::execution_mode));
ASSERT_EQ(execution_mode_value, execution_mode_default);
for (const auto& m : exectedTypeByMode) {
const auto execution_mode = m.first;
const auto execution_mode_exected = m.second.first;
const auto inference_precision_exected = m.second.second;
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::hint::execution_mode(execution_mode)));
OV_ASSERT_NO_THROW(execution_mode_value = ie.get_property("CPU", ov::hint::execution_mode));
ASSERT_EQ(execution_mode_value, execution_mode_exected);
OV_ASSERT_NO_THROW(inference_precision_value = ie.get_property("CPU", ov::hint::inference_precision));
ASSERT_EQ(inference_precision_value, inference_precision_exected);
}
}
TEST(OVClassBasicPropsTest, smoke_SetConfigExecutionModeAndInferencePrecision) {
ov::Core ie;
const auto inference_precision_default = bf16_if_supported;
const auto execution_mode_default = ov::hint::ExecutionMode::PERFORMANCE;
auto expect_execution_mode = [&](const ov::hint::ExecutionMode expected_value) {
auto execution_mode_value = ov::hint::ExecutionMode::ACCURACY;
OV_ASSERT_NO_THROW(execution_mode_value = ie.get_property("CPU", ov::hint::execution_mode));
ASSERT_EQ(execution_mode_value, expected_value);
};
auto expect_inference_precision = [&](const ov::element::Type expected_value) {
auto inference_precision_value = ov::element::undefined;
OV_ASSERT_NO_THROW(inference_precision_value = ie.get_property("CPU", ov::hint::inference_precision));
ASSERT_EQ(inference_precision_value, expected_value);
};
// check default values
expect_execution_mode(execution_mode_default);
expect_inference_precision(inference_precision_default);
// verify that conflicting property values work as expect
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::hint::execution_mode(ov::hint::ExecutionMode::PERFORMANCE)));
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::hint::inference_precision(ov::element::f32)));
expect_execution_mode(
ov::hint::ExecutionMode::PERFORMANCE); // inference_preicision does not affect execution_mode property itself
expect_inference_precision(ov::element::f32); // inference_preicision has more priority than performance mode
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::hint::execution_mode(ov::hint::ExecutionMode::ACCURACY)));
OV_ASSERT_NO_THROW(ie.set_property("CPU", ov::hint::inference_precision(bf16_if_can_be_emulated)));
expect_execution_mode(ov::hint::ExecutionMode::ACCURACY);
expect_inference_precision(bf16_if_can_be_emulated);
}
const std::vector<ov::AnyMap> cpu_properties = {
{ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)},
{ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)},
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
OVPropertiesTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(cpu_properties)),
OVPropertiesTests::getTestCaseName);
const std::vector<ov::AnyMap> multi_Auto_properties = {
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::hint::performance_mode(ov::hint::PerformanceMode::CUMULATIVE_THROUGHPUT)},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::hint::execution_mode(ov::hint::ExecutionMode::ACCURACY)},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::hint::execution_mode(ov::hint::ExecutionMode::PERFORMANCE)},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::intel_auto::device_bind_buffer("YES")},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::intel_auto::device_bind_buffer("NO")},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::intel_auto::enable_startup_fallback("YES")},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::intel_auto::enable_startup_fallback("NO")}
};
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::CUMULATIVE_THROUGHPUT)},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::hint::execution_mode(ov::hint::ExecutionMode::ACCURACY)},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::hint::execution_mode(ov::hint::ExecutionMode::PERFORMANCE)},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::intel_auto::device_bind_buffer("YES")},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::intel_auto::device_bind_buffer("NO")},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::intel_auto::enable_startup_fallback("YES")},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU), ov::intel_auto::enable_startup_fallback("NO")}};
INSTANTIATE_TEST_SUITE_P(smoke_AutoMultiBehaviorTests, OVPropertiesTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_AUTO, CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multi_Auto_properties)),
OVPropertiesTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_AutoMultiBehaviorTests,
OVPropertiesTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_AUTO,
CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multi_Auto_properties)),
OVPropertiesTests::getTestCaseName);
const std::vector<ov::AnyMap> cpu_setcore_properties = {
{ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
@ -115,8 +304,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_AutoBehaviorTests, OVPropertiesDefaultTests,
OVPropertiesDefaultTests::getTestCaseName);
const std::vector<std::pair<ov::AnyMap, std::string>> automultiExeDeviceConfigs = {
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_CPU)}}, "CPU")
};
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_CPU)}}, "CPU")};
INSTANTIATE_TEST_SUITE_P(smoke_AutoMultiCompileModelBehaviorTests,
OVCompileModelGetExecutionDeviceTests,
@ -131,8 +319,7 @@ const std::vector<ov::AnyMap> auto_multi_device_properties = {
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("CPU", ov::num_streams(4), ov::enable_profiling(true))},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties(ov::AnyMap{{"CPU", ov::AnyMap{{ov::num_streams(4), ov::enable_profiling(true)}}}})}
};
ov::device::properties(ov::AnyMap{{"CPU", ov::AnyMap{{ov::num_streams(4), ov::enable_profiling(true)}}}})}};
const std::vector<ov::AnyMap> auto_multi_incorrect_device_properties = {
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
@ -157,4 +344,180 @@ INSTANTIATE_TEST_SUITE_P(smoke_AutoMultiSetAndCompileModelBehaviorTestsThrow,
CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(auto_multi_incorrect_device_properties)),
OVSetUnsupportPropCompileModelWithoutConfigTests::getTestCaseName);
} // namespace
//
// IE Class GetMetric
//
INSTANTIATE_TEST_SUITE_P(smoke_OVClassSetConfigTest, OVSetEnableHyperThreadingHintConfigTest, ::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassSetConfigTest, OVSetSchedulingCoreTypeHintConfigTest, ::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(smoke_AutoMultiHeteroOVGetMetricPropsTest,
OVGetMetricPropsTest,
::testing::Values("MULTI", "HETERO", "AUTO"));
INSTANTIATE_TEST_SUITE_P(smoke_OVGetMetricPropsTest, OVGetMetricPropsTest, ::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(smoke_OVGetConfigTest,
OVGetConfigTest_ThrowUnsupported,
::testing::Values("CPU", "MULTI", "HETERO", "AUTO"));
INSTANTIATE_TEST_SUITE_P(smoke_OVGetAvailableDevicesPropsTest,
OVGetAvailableDevicesPropsTest,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassSetConfigTest, OVSetEnableCpuPinningHintConfigTest, ::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(smoke_OVSetModelPriorityConfigTest,
OVSetModelPriorityConfigTest,
::testing::Values("MULTI", "AUTO"));
INSTANTIATE_TEST_SUITE_P(smoke_OVSetLogLevelConfigTest, OVSetLogLevelConfigTest, ::testing::Values("MULTI", "AUTO"));
const std::vector<ov::AnyMap> multiConfigs = {{ov::device::priorities(CommonTestUtils::DEVICE_CPU)}};
const std::vector<ov::AnyMap> configsDeviceProperties = {
{ov::device::properties("CPU", ov::num_streams(3))},
{ov::device::properties(ov::AnyMap{{"CPU", ov::AnyMap{ov::num_streams(3)}}})}};
const std::vector<ov::AnyMap> configsDevicePropertiesDouble = {
{ov::device::properties("CPU", ov::num_streams(5)), ov::num_streams(3)},
{ov::device::properties("CPU", ov::num_streams(5)),
ov::device::properties(ov::AnyMap{{"CPU", ov::AnyMap{ov::num_streams(7)}}}),
ov::num_streams(3)},
{ov::device::properties("CPU", ov::num_streams(3)), ov::device::properties("CPU", ov::num_streams(5))},
{ov::device::properties("CPU", ov::num_streams(3)),
ov::device::properties(ov::AnyMap{{"CPU", ov::AnyMap{ov::num_streams(5)}}})},
{ov::device::properties(ov::AnyMap{{"CPU", ov::AnyMap{ov::num_streams(3)}}}),
ov::device::properties(ov::AnyMap{{"CPU", ov::AnyMap{ov::num_streams(5)}}})}};
const std::vector<ov::AnyMap> configsWithSecondaryProperties = {
{ov::device::properties("CPU", ov::num_streams(4))},
{ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)),
ov::device::properties("GPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY))}};
const std::vector<ov::AnyMap> multiConfigsWithSecondaryProperties = {
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)),
ov::device::properties("GPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY))}};
const std::vector<ov::AnyMap> autoConfigsWithSecondaryProperties = {
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("AUTO",
ov::enable_profiling(false),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)),
ov::device::properties("GPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY))},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("AUTO",
ov::enable_profiling(false),
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::device::properties("AUTO",
ov::enable_profiling(false),
ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)),
ov::device::properties("GPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY))}};
const std::vector<ov::AnyMap> heteroConfigsWithSecondaryProperties = {
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("HETERO",
ov::enable_profiling(false),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)),
ov::device::properties("GPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY))},
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::device::properties("HETERO",
ov::enable_profiling(false),
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT))},
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::device::properties("HETERO",
ov::enable_profiling(false),
ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)),
ov::device::properties("CPU",
ov::num_streams(4),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)),
ov::device::properties("GPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY))}};
INSTANTIATE_TEST_SUITE_P(smoke_OVClassSetDevicePriorityConfigPropsTest,
OVClassSetDevicePriorityConfigPropsTest,
::testing::Combine(::testing::Values("MULTI", "AUTO", "HETERO"),
::testing::ValuesIn(multiConfigs)));
// IE Class Load network
INSTANTIATE_TEST_SUITE_P(smoke_CPUOVClassCompileModelWithCorrectPropertiesTest,
OVClassCompileModelWithCorrectPropertiesTest,
::testing::Combine(::testing::Values("CPU", "AUTO:CPU", "MULTI:CPU", "HETERO:CPU"),
::testing::ValuesIn(configsWithSecondaryProperties)));
INSTANTIATE_TEST_SUITE_P(smoke_Multi_OVClassCompileModelWithCorrectPropertiesTest,
OVClassCompileModelWithCorrectPropertiesTest,
::testing::Combine(::testing::Values("MULTI"),
::testing::ValuesIn(multiConfigsWithSecondaryProperties)));
INSTANTIATE_TEST_SUITE_P(smoke_AUTO_OVClassCompileModelWithCorrectPropertiesTest,
OVClassCompileModelWithCorrectPropertiesTest,
::testing::Combine(::testing::Values("AUTO"),
::testing::ValuesIn(autoConfigsWithSecondaryProperties)));
INSTANTIATE_TEST_SUITE_P(smoke_HETERO_OVClassCompileModelWithCorrectPropertiesTest,
OVClassCompileModelWithCorrectPropertiesTest,
::testing::Combine(::testing::Values("HETERO"),
::testing::ValuesIn(heteroConfigsWithSecondaryProperties)));
// IE Class load and check network with ov::device::properties
INSTANTIATE_TEST_SUITE_P(smoke_CPU_OVClassCompileModelAndCheckSecondaryPropertiesTest,
OVClassCompileModelAndCheckSecondaryPropertiesTest,
::testing::Combine(::testing::Values("CPU"),
::testing::ValuesIn(configsDeviceProperties)));
INSTANTIATE_TEST_SUITE_P(smoke_CPU_OVClassCompileModelAndCheckWithSecondaryPropertiesDoubleTest,
OVClassCompileModelAndCheckSecondaryPropertiesTest,
::testing::Combine(::testing::Values("CPU"),
::testing::ValuesIn(configsDevicePropertiesDouble)));
//
// IE Class GetConfig
//
INSTANTIATE_TEST_SUITE_P(smoke_OVGetConfigTest, OVGetConfigTest, ::testing::Values("CPU"));
// IE Class load and check network with ov::device::properties
} // namespace

View File

@ -116,6 +116,11 @@ std::vector<std::string> disabledTestPatterns() {
R"(.*smoke_Hetero_BehaviorTests.*DynamicInputToDynamicOutput.*)",
R"(.*smoke_Auto_BehaviorTests.*DynamicOutputToDynamicInput.*)",
R"(.*smoke_Auto_BehaviorTests.*DynamicInputToDynamicOutput.*)",
// unsupported metrics
R"(.*OVGetMetricPropsTest.*OVGetMetricPropsTest.*(DEVICE_UUID|FULL_DEVICE_NAME_with_DEVICE_ID|DEVICE_GOPS|DEVICE_TYPE|MAX_BATCH_SIZE).*)",
R"(.*smoke_AutoMultiHeteroOVGetMetricPropsTest.*OVGetMetricPropsTest.*(AVAILABLE_DEVICES|OPTIMIZATION_CAPABILITIES|RANGE_FOR_ASYNC_INFER_REQUESTS|RANGE_FOR_STREAMS).*)",
// supports only '' as device id
R"(.*OVClassQueryModelTest.*QueryModelWithDeviceID.*)",
// Issue 67214
R"(smoke_PrePostProcess.*resize_and_convert_layout_i8.*)",
@ -215,6 +220,8 @@ std::vector<std::string> disabledTestPatterns() {
retVector.emplace_back(R"(smoke_LPT.*)");
retVector.emplace_back(R"(smoke_CPU_OVClassLoadNetworkAndCheckWithSecondaryPropertiesTest/OVClassLoadNetworkAndCheckSecondaryPropertiesTest.LoadNetworkAndCheckSecondaryPropertiesTest.*)");
retVector.emplace_back(R"(smoke_CPU_OVClassLoadNetworkAndCheckWithSecondaryPropertiesDoubleTest/OVClassLoadNetworkAndCheckSecondaryPropertiesTest.LoadNetworkAndCheckSecondaryPropertiesTest.*)");
retVector.emplace_back(R"(smoke_CPU_OVClassCompileModelAndCheckSecondaryPropertiesTest/OVClassCompileModelAndCheckSecondaryPropertiesTest.CompileModelAndCheckSecondaryPropertiesTest.*)");
retVector.emplace_back(R"(smoke_CPU_OVClassCompileModelAndCheckSecondaryPropertiesDoubleTest/OVClassCompileModelAndCheckSecondaryPropertiesTest.CompileModelAndCheckSecondaryPropertiesTest.*)");
retVector.emplace_back(R"(smoke_Activation_Basic/ActivationLayerTest.CompareWithRefs.*)");
retVector.emplace_back(R"(smoke_Integer_Activation_Basic/ActivationLayerTest.CompareWithRefs/(Tanh|Negative|Sqrt).*)");
retVector.emplace_back(R"(smoke_Activation_Basic_Prelu_Const/ActivationLayerTest.CompareWithRefs/(LeakyRelu|PReLu).*)");

View File

@ -6,6 +6,7 @@
#include <gna/gna_config.hpp>
#include "behavior/ov_executable_network/properties.hpp"
#include "openvino/runtime/intel_gna/properties.hpp"
using namespace ov::test::behavior;
@ -255,4 +256,8 @@ INSTANTIATE_TEST_SUITE_P(smoke_OVClassHeteroExecutableNetworkGetMetricTest,
INSTANTIATE_TEST_SUITE_P(smoke_OVClassHeteroExecutableNetworkGetMetricTest,
OVClassHeteroExecutableNetworkGetMetricTest_TARGET_FALLBACK,
::testing::Values("GNA"));
// IE Class Load network
INSTANTIATE_TEST_SUITE_P(smoke_OVClassCompileModelTest, OVClassCompileModelTest, ::testing::Values("GNA"));
} // namespace

View File

@ -6,7 +6,9 @@
#include <gna/gna_config.hpp>
#include "behavior/ov_plugin/core_integration_sw.hpp"
#include "behavior/ov_plugin/properties_tests.hpp"
#include "behavior/ov_plugin/query_model.hpp"
#include "openvino/runtime/intel_gna/properties.hpp"
using namespace ov::test::behavior;
@ -17,66 +19,46 @@ namespace {
// IE Class Common tests with <pluginName, deviceName params>
//
INSTANTIATE_TEST_SUITE_P(nightly_OVClassBasicTestP,
OVClassBasicTestP,
INSTANTIATE_TEST_SUITE_P(nightly_OVClassBasicPropsTestP,
OVClassBasicPropsTestP,
::testing::Values(std::make_pair("openvino_intel_gna_plugin", "GNA")));
// TODO
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassNetworkTestP, OVClassNetworkTestP, ::testing::Values("GNA"));
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassModelTestP, OVClassModelTestP, ::testing::Values("GNA"));
//
// IE Class GetMetric
//
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(smoke_MultiHeteroOVGetMetricPropsTest,
OVGetMetricPropsTest,
::testing::Values("MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_SUPPORTED_METRICS,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(nightly_OVGetMetricPropsTest, OVGetMetricPropsTest, ::testing::Values("GNA"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_AVAILABLE_DEVICES,
::testing::Values("GNA"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_FULL_DEVICE_NAME,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassGetMetricTest,
OVClassGetMetricTest_OPTIMIZATION_CAPABILITIES,
::testing::Values("GNA"));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassGetMetricTest,
OVClassGetMetricTest_RANGE_FOR_ASYNC_INFER_REQUESTS,
::testing::Values("GNA"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_ThrowUnsupported,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetConfigTest,
OVClassGetConfigTest_ThrowUnsupported,
INSTANTIATE_TEST_SUITE_P(nightly_OVGetConfigTest,
OVGetConfigTest_ThrowUnsupported,
::testing::Values("GNA", "MULTI", "HETERO"));
const std::vector<std::tuple<std::string, std::pair<ov::AnyMap, std::string>>> GetMetricTest_ExecutionDevice_GNA = {
{"GNA", std::make_pair(ov::AnyMap{}, "GNA")}};
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
INSTANTIATE_TEST_SUITE_P(nightly_OVGetMetricPropsTest,
OVClassExecutableNetworkGetMetricTest_EXEC_DEVICES,
::testing::ValuesIn(GetMetricTest_ExecutionDevice_GNA),
OVCompileModelGetExecutionDeviceTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetAvailableDevices, OVClassGetAvailableDevices, ::testing::Values("GNA"));
INSTANTIATE_TEST_SUITE_P(nightly_OVGetAvailableDevicesPropsTest,
OVGetAvailableDevicesPropsTest,
::testing::Values("GNA"));
//
// IE Class GetConfig
//
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetConfigTest, OVClassGetConfigTest, ::testing::Values("GNA"));
INSTANTIATE_TEST_SUITE_P(nightly_OVGetConfigTest, OVGetConfigTest, ::testing::Values("GNA"));
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedScaleFactors) {
TEST(OVClassBasicPropsTest, smoke_SetConfigAfterCreatedScaleFactors) {
ov::Core core;
float sf1, sf2;
OV_ASSERT_NO_THROW(core.set_property({{"GNA_SCALE_FACTOR_0", "1634.0"}, {"GNA_SCALE_FACTOR_1", "2000.0"}}));
@ -93,7 +75,7 @@ TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedScaleFactors) {
ov::Exception);
}
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedScaleFactorsPerInput) {
TEST(OVClassBasicPropsTest, smoke_SetConfigAfterCreatedScaleFactorsPerInput) {
ov::Core core;
std::map<std::string, float> scale_factors_per_input;
@ -113,7 +95,7 @@ TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedScaleFactorsPerInput) {
ASSERT_FLOAT_EQ(1.0f, scale_factors_per_input["0"]);
}
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedPrecisionHint) {
TEST(OVClassBasicPropsTest, smoke_SetConfigAfterCreatedPrecisionHint) {
ov::Core core;
ov::element::Type precision;
@ -148,7 +130,7 @@ TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedPrecisionHint) {
ASSERT_THROW(core.set_property("GNA", {{ov::hint::inference_precision.name(), "ABC"}}), ov::Exception);
}
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedPerformanceHint) {
TEST(OVClassBasicPropsTest, smoke_SetConfigAfterCreatedPerformanceHint) {
ov::Core core;
ov::hint::PerformanceMode mode;
@ -163,7 +145,7 @@ TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedPerformanceHint) {
ASSERT_THROW(core.set_property("GNA", {{ov::hint::performance_mode.name(), "ABC"}}), ov::Exception);
}
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedNumRequests) {
TEST(OVClassBasicPropsTest, smoke_SetConfigAfterCreatedNumRequests) {
ov::Core core;
uint32_t num_requests;
@ -191,7 +173,7 @@ TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedNumRequests) {
ASSERT_THROW(core.set_property("GNA", {{ov::hint::num_requests.name(), "ABC"}}), ov::Exception);
}
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedExecutionMode) {
TEST(OVClassBasicPropsTest, smoke_SetConfigAfterCreatedExecutionMode) {
ov::Core core;
auto execution_mode = ov::intel_gna::ExecutionMode::AUTO;
@ -224,7 +206,7 @@ TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedExecutionMode) {
ASSERT_EQ(ov::intel_gna::ExecutionMode::AUTO, execution_mode);
}
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedTargetDevice) {
TEST(OVClassBasicPropsTest, smoke_SetConfigAfterCreatedTargetDevice) {
ov::Core core;
auto execution_target = ov::intel_gna::HWGeneration::UNDEFINED;
auto compile_target = ov::intel_gna::HWGeneration::UNDEFINED;
@ -268,7 +250,7 @@ TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedTargetDevice) {
ASSERT_THROW(core.set_property("GNA", {{ov::intel_gna::compile_target.name(), "ABC"}}), ov::Exception);
}
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedPwlAlgorithm) {
TEST(OVClassBasicPropsTest, smoke_SetConfigAfterCreatedPwlAlgorithm) {
ov::Core core;
auto pwl_algo = ov::intel_gna::PWLDesignAlgorithm::UNDEFINED;
float pwl_max_error = 0.0f;
@ -306,7 +288,7 @@ TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedPwlAlgorithm) {
ASSERT_THROW(core.set_property("GNA", ov::intel_gna::pwl_max_error_percent(146.0f)), ov::Exception);
}
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedLogLevel) {
TEST(OVClassBasicPropsTest, smoke_SetConfigAfterCreatedLogLevel) {
ov::Core core;
auto level = ov::log::Level::NO;
@ -337,7 +319,7 @@ TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedLogLevel) {
ASSERT_THROW(core.set_property("GNA", {{ov::log::level.name(), "NO"}}), ov::Exception);
}
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedFwModelPath) {
TEST(OVClassBasicPropsTest, smoke_SetConfigAfterCreatedFwModelPath) {
ov::Core core;
std::string path = "";
@ -348,10 +330,6 @@ TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedFwModelPath) {
// IE Class Query network
INSTANTIATE_TEST_SUITE_P(smoke_OVClassQueryNetworkTest, OVClassQueryNetworkTest, ::testing::Values("GNA"));
// IE Class Load network
INSTANTIATE_TEST_SUITE_P(smoke_OVClassLoadNetworkTest, OVClassLoadNetworkTest, ::testing::Values("GNA"));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassQueryModelTest, OVClassQueryModelTest, ::testing::Values("GNA"));
} // namespace

View File

@ -71,6 +71,7 @@ std::vector<std::string> disabledTestPatterns() {
R"(.*(OVClass|IEClass)HeteroExecutableNetworkGetMetricTest_TARGET_FALLBACK.*GetMetricNoThrow.*)",
R"(.*LoadNetwork*.*LoadNetwork(HETEROWithDeviceIDNoThrow|WithBigDeviceID|WithInvalidDeviceID)*.*)",
R"(.*QueryNetwork*.*QueryNetwork(HETEROWithDeviceIDNoThrow|WithBigDeviceID|WithInvalidDeviceID)*.*)",
R"(.*QueryModel*.*QueryModel(HETEROWithDeviceIDNoThrow|WithBigDeviceID|WithInvalidDeviceID)*.*)",
R"(.*LoadNetworkTest.*QueryNetwork(MULTIWithHETERO|HETEROWithMULTI)NoThrow_V10.*)",
R"(.*Behavior.*OVCompiledModelBaseTest.*get(Inputs|Outputs)FromFunctionWithSeveral(Inputs|Outputs).*)",
// TODO: temporary disabled. Need to be enabled when PR 9282 is merged
@ -95,5 +96,8 @@ std::vector<std::string> disabledTestPatterns() {
R"(.*CachingSupportCase.*LoadNet.*(Bias|Split|Concat|KSO|SingleConv).*)",
R"(.*CachingSupportCase.*LoadNet.*(ConvPoolRelu|TIwithLSTMcell1)_f32_batch2.*)",
R"(.*smoke_Multi_BehaviorTests.*)",
// unsupported metrics
R"(.*OVGetMetricPropsTest.*OVGetMetricPropsTest.*(DEVICE_UUID|FULL_DEVICE_NAME_with_DEVICE_ID|DEVICE_GOPS|DEVICE_TYPE|MAX_BATCH_SIZE).*)",
R"(.*smoke_MultiHeteroOVGetMetricPropsTest.*OVGetMetricPropsTest.*(AVAILABLE_DEVICES|OPTIMIZATION_CAPABILITIES|RANGE_FOR_ASYNC_INFER_REQUESTS|RANGE_FOR_STREAMS).*)",
};
}

View File

@ -125,4 +125,11 @@ INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
OVCompiledModelEmptyPropertiesTests,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
OVCompiledModelEmptyPropertiesTests::getTestCaseName);
// OV Class Load network
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassCompileModelTest, OVClassCompileModelTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
} // namespace

View File

@ -2,11 +2,12 @@
// SPDX-License-Identifcorer: Apache-2.0
//
#include <utility>
#include <string>
#include <utility>
#include <vector>
#include "behavior/ov_plugin/core_integration.hpp"
#include "behavior/ov_plugin/core_integration_sw.hpp"
#include "behavior/ov_plugin/query_model.hpp"
using namespace ov::test::behavior;
@ -16,64 +17,11 @@ namespace {
// OV Class Common tests with <pluginName, device_name params>
//
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassBasicTestP, OVClassBasicTestP,
::testing::Values(std::make_pair("openvino_template_plugin", CommonTestUtils::DEVICE_TEMPLATE)));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassModelTestP,
OVClassModelTestP,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassNetworkTestP, OVClassNetworkTestP,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
//
// OV Class GetMetric
//
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetMetricTest, OVClassGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetMetricTest, OVClassGetMetricTest_SUPPORTED_METRICS,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetMetricTest, OVClassGetMetricTest_AVAILABLE_DEVICES,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetMetricTest, OVClassGetMetricTest_FULL_DEVICE_NAME,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetMetricTest, OVClassGetMetricTest_OPTIMIZATION_CAPABILITIES,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetMetricTest, OVClassGetMetricTest_RANGE_FOR_ASYNC_INFER_REQUESTS,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetMetricTest, OVClassGetMetricTest_ThrowUnsupported,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetConfigTest, OVClassGetConfigTest_ThrowUnsupported,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetAvailableDevices, OVClassGetAvailableDevices,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
//
// OV Class GetConfig
//
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetConfigTest, OVClassGetConfigTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
TEST(OVClassBasicTest, smoke_TEMPLATEGetSetConfigNoThrow) {
TEST(OVClassBasicPropsTest, smoke_TEMPLATEGetSetConfigNoThrow) {
ov::Core core = createCoreWithTemplate();
auto device_name = CommonTestUtils::DEVICE_TEMPLATE;
@ -82,26 +30,24 @@ TEST(OVClassBasicTest, smoke_TEMPLATEGetSetConfigNoThrow) {
if (ov::device::id == property) {
std::cout << ov::device::id.name() << " : " << core.get_property(device_name, ov::device::id) << std::endl;
} else if (ov::enable_profiling == property) {
std::cout << ov::enable_profiling.name() << " : " << core.get_property(device_name, ov::enable_profiling) << std::endl;
std::cout << ov::enable_profiling.name() << " : " << core.get_property(device_name, ov::enable_profiling)
<< std::endl;
} else if (ov::hint::performance_mode == property) {
std::cout << "Default " << ov::hint::performance_mode.name() << " : " << core.get_property(device_name, ov::hint::performance_mode) << std::endl;
std::cout << "Default " << ov::hint::performance_mode.name() << " : "
<< core.get_property(device_name, ov::hint::performance_mode) << std::endl;
core.set_property(device_name, ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY));
ASSERT_EQ(ov::hint::PerformanceMode::LATENCY, core.get_property(device_name, ov::hint::performance_mode));
core.set_property(device_name, ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT));
ASSERT_EQ(ov::hint::PerformanceMode::THROUGHPUT, core.get_property(device_name, ov::hint::performance_mode));
ASSERT_EQ(ov::hint::PerformanceMode::THROUGHPUT,
core.get_property(device_name, ov::hint::performance_mode));
}
}
}
// OV Class Query network
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassQueryNetworkTest, OVClassQueryNetworkTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassQueryModelTest,
OVClassQueryModelTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
// OV Class Load network
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassLoadNetworkTest, OVClassLoadNetworkTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
} // namespace
} // namespace

View File

@ -125,4 +125,33 @@ INSTANTIATE_TEST_SUITE_P(
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_EXEC_DEVICES,
::testing::ValuesIn(GetMetricTest_ExecutionDevice_TEMPLATE),
OVCompileModelGetExecutionDeviceTests::getTestCaseName);
//
// OV Class GetMetric
//
INSTANTIATE_TEST_SUITE_P(
smoke_OVGetMetricPropsTest, OVGetMetricPropsTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_OVGetConfigTest, OVGetConfigTest_ThrowUnsupported,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_OVGetAvailableDevicesPropsTest, OVGetAvailableDevicesPropsTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
//
// OV Class GetConfig
//
INSTANTIATE_TEST_SUITE_P(
smoke_OVGetConfigTest, OVGetConfigTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassBasicPropsTestP, OVClassBasicPropsTestP,
::testing::Values(std::make_pair("openvino_template_plugin", CommonTestUtils::DEVICE_TEMPLATE)));
} // namespace

View File

@ -23,6 +23,9 @@ std::vector<std::string> disabledTestPatterns() {
R"(.*OVClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS.*GetMetricNoThrow.*)",
R"(.*OVClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_METRICS.*GetMetricNoThrow.*)",
// unsupported metrics
R"(.*smoke_OVGetMetricPropsTest.*OVGetMetricPropsTest.*(DEVICE_UUID|FULL_DEVICE_NAME_with_DEVICE_ID|RANGE_FOR_STREAMS|DEVICE_GOPS|DEVICE_TYPE|MAX_BATCH_SIZE).*)",
// TODO: Round with f16 is not supported
R"(.*smoke_Hetero_BehaviorTests.*OVExecGraphImportExportTest.*readFromV10IR.*)",
// TODO: support import / export of precisions in template plugin

View File

@ -59,4 +59,10 @@ INSTANTIATE_TEST_SUITE_P(ov_compiled_model_AutoBatch, OVCompiledModelPropertiesT
::testing::Values(CommonTestUtils::DEVICE_BATCH),
::testing::ValuesIn(ov::test::conformance::generate_ov_configs(CommonTestUtils::DEVICE_BATCH, auto_batch_properties))),
OVCompiledModelPropertiesTests::getTestCaseName);
// IE Class Load network
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassCompileModelTest,
::testing::Values(targetDevice));
} // namespace

View File

@ -2,7 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/ov_plugin/core_integration.hpp"
#include "behavior/ov_plugin/core_integration_sw.hpp"
#include "behavior/ov_plugin/query_model.hpp"
#include "openvino/runtime/core.hpp"
#include "ov_api_conformance_helpers.hpp"
@ -15,76 +16,13 @@ namespace {
// IE Class Common tests with <pluginName, deviceName params>
//
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassBasicTestP,
::testing::ValuesIn(generate_pairs_plugin_name_by_device()));
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassNetworkTestP,
::testing::ValuesIn(return_all_possible_device_combination()));
//
// IE Class GetMetric
//
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::ValuesIn(return_all_possible_device_combination(false)));
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassGetMetricTest_SUPPORTED_METRICS,
::testing::ValuesIn(return_all_possible_device_combination(false)));
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassGetMetricTest_AVAILABLE_DEVICES,
::testing::ValuesIn(return_all_possible_device_combination(false)));
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassGetMetricTest_FULL_DEVICE_NAME,
::testing::ValuesIn(return_all_possible_device_combination(false)));
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassGetMetricTest_OPTIMIZATION_CAPABILITIES,
::testing::ValuesIn(return_all_possible_device_combination(false)));
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassGetMetricTest_RANGE_FOR_ASYNC_INFER_REQUESTS,
::testing::ValuesIn(return_all_possible_device_combination(false)));
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassGetMetricTest_RANGE_FOR_STREAMS,
::testing::ValuesIn(return_all_possible_device_combination(false)));
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassGetMetricTest_ThrowUnsupported,
::testing::ValuesIn(return_all_possible_device_combination(false)));
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassGetConfigTest_ThrowUnsupported,
::testing::ValuesIn(return_all_possible_device_combination(false)));
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassGetAvailableDevices,
::testing::ValuesIn(return_all_possible_device_combination(false)));
//
// IE Class GetConfig
//
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassGetConfigTest,
::testing::ValuesIn(return_all_possible_device_combination(false)));
INSTANTIATE_TEST_SUITE_P(ov_plugin_mandatory,
OVClassModelTestP,
::testing::ValuesIn(return_all_possible_device_combination()));
// IE Class Query network
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassQueryNetworkTest,
::testing::ValuesIn(return_all_possible_device_combination(false)));
// IE Class Load network
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVClassLoadNetworkTest,
::testing::Values(targetDevice));
} // namespace
INSTANTIATE_TEST_SUITE_P(ov_plugin_mandatory,
OVClassQueryModelTest,
::testing::ValuesIn(return_all_possible_device_combination(false)));
} // namespace

View File

@ -76,4 +76,28 @@ INSTANTIATE_TEST_SUITE_P(ov_plugin, OVCheckChangePropComplieModleGetPropTests_Mo
::testing::ValuesIn(return_all_possible_device_combination()),
::testing::ValuesIn(OVCheckChangePropComplieModleGetPropTests::getModelDependcePropertiesValues())),
OVCheckChangePropComplieModleGetPropTests_ModelDependceProps::getTestCaseName);
//
// IE Class GetMetric
//
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVGetMetricPropsTest,
::testing::ValuesIn(return_all_possible_device_combination(false)));
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVGetAvailableDevicesPropsTest,
::testing::ValuesIn(return_all_possible_device_combination(false)));
//
// IE Class GetConfig
//
INSTANTIATE_TEST_SUITE_P(
ov_plugin, OVGetConfigTest,
::testing::ValuesIn(return_all_possible_device_combination(false)));
INSTANTIATE_TEST_SUITE_P(
ov_plugin_remove, OVClassBasicPropsTestP,
::testing::ValuesIn(generate_pairs_plugin_name_by_device()));
} // namespace

View File

@ -3,6 +3,8 @@
//
#include "behavior/ov_executable_network/get_metric.hpp"
#include "behavior/ov_executable_network/properties.hpp"
#include "behavior/ov_plugin/properties_tests.hpp"
#include "openvino/runtime/core.hpp"
@ -36,9 +38,9 @@ INSTANTIATE_TEST_SUITE_P(nightly_OVClassExecutableNetworkGetMetricTest,
::testing::Values("GPU", "MULTI:GPU", "HETERO:GPU", "AUTO:GPU,CPU", "BATCH:GPU"));
const std::vector<std::tuple<std::string, std::pair<ov::AnyMap, std::string>>> GetMetricTest_ExecutionDevice_GPU = {
{"GPU", std::make_pair(ov::AnyMap{}, "GPU.0")},
{"GPU.0", std::make_pair(ov::AnyMap{}, "GPU.0")},
{"BATCH:GPU", std::make_pair(ov::AnyMap{}, "GPU.0")}};
{"GPU", std::make_pair(ov::AnyMap{}, "GPU.0")},
{"GPU.0", std::make_pair(ov::AnyMap{}, "GPU.0")},
{"BATCH:GPU", std::make_pair(ov::AnyMap{}, "GPU.0")}};
INSTANTIATE_TEST_SUITE_P(nightly_OVClassExecutableNetworkGetMetricTest,
OVClassExecutableNetworkGetMetricTest_EXEC_DEVICES,
@ -68,7 +70,6 @@ INSTANTIATE_TEST_SUITE_P(nightly_OVClassExecutableNetworkGetMetricTest,
::testing::ValuesIn(multiModelPriorityConfigs())),
OVClassExecutableNetworkGetMetricTest_MODEL_PRIORITY::getTestCaseName);
//
// Executable Network GetConfig / SetConfig
//
@ -105,5 +106,8 @@ INSTANTIATE_TEST_SUITE_P(nightly_OVClassHeteroExecutableNetworlGetMetricTest,
OVClassHeteroExecutableNetworkGetMetricTest_EXEC_DEVICES,
::testing::Values("GPU.0"));
} // namespace
// IE Class Load network
INSTANTIATE_TEST_SUITE_P(smoke_OVClassCompileModelTest, OVClassCompileModelTest, ::testing::Values("GPU"));
} // namespace

View File

@ -2,899 +2,37 @@
// SPDX-License-Identifier: Apache-2.0
//
#include <thread>
#include "behavior/ov_plugin/core_integration.hpp"
#include "openvino/runtime/intel_gpu/properties.hpp"
#include "cpp_interfaces/interface/ie_internal_plugin_config.hpp"
#include "intel_gpu/runtime/internal_properties.hpp"
#ifdef _WIN32
# include "gpu/gpu_context_api_dx.hpp"
#elif defined ENABLE_LIBVA
# include <gpu/gpu_context_api_va.hpp>
#endif
#include "gpu/gpu_config.hpp"
#include "gpu/gpu_context_api_ocl.hpp"
#include "behavior/ov_plugin/core_integration_sw.hpp"
#include "behavior/ov_plugin/query_model.hpp"
using namespace ov::test::behavior;
namespace {
// IE Class Common tests with <pluginName, target_device params>
//
INSTANTIATE_TEST_SUITE_P(nightly_OVClassCommon,
OVClassBasicTestP,
::testing::Values(std::make_pair("openvino_intel_gpu_plugin", "GPU")));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassNetworkTestP, OVClassNetworkTestP, ::testing::Values("GPU"));
//
// IE Class GetMetric
//
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("GPU", "MULTI", "HETERO", "AUTO", "BATCH"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_SUPPORTED_METRICS,
::testing::Values("GPU", "MULTI", "HETERO", "AUTO", "BATCH"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_AVAILABLE_DEVICES,
::testing::Values("GPU"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_FULL_DEVICE_NAME,
::testing::Values("GPU", "MULTI", "HETERO", "AUTO", "BATCH"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_DEVICE_UUID,
::testing::Values("GPU"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_OPTIMIZATION_CAPABILITIES,
::testing::Values("GPU"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_MAX_BATCH_SIZE,
::testing::Values("GPU"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest, OVClassGetMetricTest_DEVICE_GOPS, ::testing::Values("GPU"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest, OVClassGetMetricTest_DEVICE_TYPE, ::testing::Values("GPU"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_RANGE_FOR_ASYNC_INFER_REQUESTS,
::testing::Values("GPU"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_RANGE_FOR_STREAMS,
::testing::Values("GPU"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_ThrowUnsupported,
::testing::Values("GPU", "MULTI", "HETERO", "AUTO", "BATCH"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetConfigTest,
OVClassGetConfigTest_ThrowUnsupported,
::testing::Values("GPU", "MULTI", "HETERO", "AUTO", "BATCH"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetAvailableDevices, OVClassGetAvailableDevices, ::testing::Values("GPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassSetModelPriorityConfigTest, OVClassSetModelPriorityConfigTest,
::testing::Values("MULTI", "AUTO"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassSetExecutionModeHintConfigTest, OVClassSetExecutionModeHintConfigTest,
::testing::Values(CommonTestUtils::DEVICE_GPU));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassSetTBBForceTerminatePropertyTest, OVClassSetTBBForceTerminatePropertyTest,
::testing::Values("CPU", "GPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassSetLogLevelConfigTest, OVClassSetLogLevelConfigTest,
::testing::Values("MULTI", "AUTO"));
auto multiConfigs = []() {
return std::vector<ov::AnyMap>{
{ov::device::priorities(CommonTestUtils::DEVICE_CPU)},
{ov::device::priorities(CommonTestUtils::DEVICE_GPU)},
};
};
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassSetDevicePriorityConfigTest, OVClassSetDevicePriorityConfigTest,
::testing::Combine(::testing::Values("MULTI", "AUTO", "HETERO"),
::testing::ValuesIn(multiConfigs())));
//
// GPU specific metrics
//
using OVClassGetMetricTest_GPU_DEVICE_TOTAL_MEM_SIZE = OVClassBaseTestP;
TEST_P(OVClassGetMetricTest_GPU_DEVICE_TOTAL_MEM_SIZE, GetMetricAndPrintNoThrow) {
ov::Core ie;
ov::Any p;
ASSERT_NO_THROW(p = ie.get_property(target_device, GPU_METRIC_KEY(DEVICE_TOTAL_MEM_SIZE)));
auto t = p.as<uint64_t>();
std::cout << "GPU device total memory size: " << t << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(GPU_METRIC_KEY(DEVICE_TOTAL_MEM_SIZE));
}
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_GPU_DEVICE_TOTAL_MEM_SIZE,
::testing::Values("GPU"));
using OVClassGetMetricTest_GPU_UARCH_VERSION = OVClassBaseTestP;
TEST_P(OVClassGetMetricTest_GPU_UARCH_VERSION, GetMetricAndPrintNoThrow) {
ov::Core ie;
ov::Any p;
ASSERT_NO_THROW(p = ie.get_property(target_device, GPU_METRIC_KEY(UARCH_VERSION)));
auto t = p.as<std::string>();
std::cout << "GPU device uarch: " << t << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(GPU_METRIC_KEY(UARCH_VERSION));
}
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_GPU_UARCH_VERSION,
::testing::Values("GPU"));
using OVClassGetMetricTest_GPU_EXECUTION_UNITS_COUNT = OVClassBaseTestP;
TEST_P(OVClassGetMetricTest_GPU_EXECUTION_UNITS_COUNT, GetMetricAndPrintNoThrow) {
ov::Core ie;
ov::Any p;
ASSERT_NO_THROW(p = ie.get_property(target_device, GPU_METRIC_KEY(EXECUTION_UNITS_COUNT)));
auto t = p.as<int>();
std::cout << "GPU EUs count: " << t << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(GPU_METRIC_KEY(EXECUTION_UNITS_COUNT));
}
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_GPU_EXECUTION_UNITS_COUNT,
::testing::Values("GPU"));
using OVClassGetPropertyTest_GPU = OVClassBaseTestP;
TEST_P(OVClassGetPropertyTest_GPU, GetMetricAvailableDevicesAndPrintNoThrow) {
ov::Core ie;
std::vector<std::string> properties;
ASSERT_NO_THROW(properties = ie.get_property(target_device, ov::available_devices));
std::cout << "AVAILABLE_DEVICES: ";
for (const auto& prop : properties) {
std::cout << prop << " ";
}
std::cout << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::available_devices);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricRangeForAsyncInferRequestsAndPrintNoThrow) {
ov::Core ie;
std::tuple<unsigned int, unsigned int, unsigned int> property;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::range_for_async_infer_requests));
std::cout << "RANGE_FOR_ASYNC_INFER_REQUESTS: " << std::get<0>(property) << " " <<
std::get<1>(property) << " " <<
std::get<2>(property) << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::range_for_async_infer_requests);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricRangeForStreamsAndPrintNoThrow) {
ov::Core ie;
std::tuple<unsigned int, unsigned int> property;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::range_for_streams));
std::cout << "RANGE_FOR_STREAMS: " << std::get<0>(property) << " " <<
std::get<1>(property) << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::range_for_streams);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricOptimalBatchSizeAndPrintNoThrow) {
ov::Core ie;
unsigned int property = 0;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::optimal_batch_size));
std::cout << "OPTIMAL_BATCH_SIZE: " << property << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::optimal_batch_size);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricFullNameAndPrintNoThrow) {
ov::Core ie;
std::string property;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::device::full_name));
std::cout << "FULL_DEVICE_NAME: " << property << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::device::full_name);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricTypeAndPrintNoThrow) {
ov::Core ie;
ov::device::Type property = ov::device::Type::INTEGRATED;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::device::type));
std::cout << "DEVICE_TYPE: " << property << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::device::type);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricGopsAndPrintNoThrow) {
ov::Core ie;
std::map<ov::element::Type, float> properties;
ASSERT_NO_THROW(properties = ie.get_property(target_device, ov::device::gops));
std::cout << "DEVICE_GOPS: " << std::endl;
for (const auto& prop : properties) {
std::cout << "- " << prop.first << ": " << prop.second << std::endl;
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::device::gops);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricCapabilitiesAndPrintNoThrow) {
ov::Core ie;
std::vector<std::string> properties;
ASSERT_NO_THROW(properties = ie.get_property(target_device, ov::device::capabilities));
std::cout << "OPTIMIZATION_CAPABILITIES: " << std::endl;
for (const auto& prop : properties) {
std::cout << "- " << prop << std::endl;
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::device::capabilities);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricDeviceTotalMemSizeAndPrintNoThrow) {
ov::Core ie;
uint64_t property = 0;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::intel_gpu::device_total_mem_size));
std::cout << "GPU_DEVICE_TOTAL_MEM_SIZE: " << property << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::device_total_mem_size);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricUarchVersionAndPrintNoThrow) {
ov::Core ie;
std::string property;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::intel_gpu::uarch_version));
std::cout << "GPU_UARCH_VERSION: " << property << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::uarch_version);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricExecutionUnitsCountAndPrintNoThrow) {
ov::Core ie;
int32_t property = 0;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::intel_gpu::execution_units_count));
std::cout << "GPU_EXECUTION_UNITS_COUNT: " << property << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::execution_units_count);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricMemoryStatisticsAndPrintNoThrow) {
ov::Core ie;
std::map<std::string, uint64_t> properties;
ASSERT_NO_THROW(properties = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
std::cout << "GPU_MEMORY_STATISTICS: " << std::endl;
for (const auto& prop : properties) {
std::cout << " " << prop.first << " - " << prop.second << std::endl;
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::memory_statistics);
}
TEST_P(OVClassGetPropertyTest_GPU, GetAndSetPerformanceModeNoThrow) {
ov::Core ie;
ov::hint::PerformanceMode defaultMode{};
ASSERT_NO_THROW(defaultMode = ie.get_property(target_device, ov::hint::performance_mode));
std::cout << "Default PERFORMANCE_HINT: \"" << defaultMode << "\"" << std::endl;
ie.set_property(target_device, ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY));
ASSERT_EQ(ov::hint::PerformanceMode::LATENCY, ie.get_property(target_device, ov::hint::performance_mode));
ie.set_property(target_device, ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT));
ASSERT_EQ(ov::hint::PerformanceMode::THROUGHPUT, ie.get_property(target_device, ov::hint::performance_mode));
OV_ASSERT_PROPERTY_SUPPORTED(ov::hint::performance_mode);
}
TEST_P(OVClassGetPropertyTest_GPU, GetAndSetEnableProfilingNoThrow) {
ov::Core ie;
bool defaultValue = false;
ASSERT_NO_THROW(defaultValue = ie.get_property(target_device, ov::enable_profiling));
std::cout << "Default PERF_COUNT: " << defaultValue << std::endl;
ie.set_property(target_device, ov::enable_profiling(true));
ASSERT_EQ(true, ie.get_property(target_device, ov::enable_profiling));
OV_ASSERT_PROPERTY_SUPPORTED(ov::enable_profiling);
}
TEST_P(OVClassGetPropertyTest_GPU, GetAndSetInferencePrecisionNoThrow) {
ov::Core ie;
auto value = ov::element::undefined;
const auto expected_default_precision = ov::element::f16;
OV_ASSERT_NO_THROW(value = ie.get_property(target_device, ov::hint::inference_precision));
ASSERT_EQ(expected_default_precision, value);
const auto forced_precision = ov::element::f32;
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::hint::inference_precision(forced_precision)));
OV_ASSERT_NO_THROW(value = ie.get_property(target_device, ov::hint::inference_precision));
ASSERT_EQ(value, forced_precision);
OPENVINO_SUPPRESS_DEPRECATED_START
const auto forced_precision_deprecated = ov::element::f16;
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::hint::inference_precision(forced_precision_deprecated)));
OV_ASSERT_NO_THROW(value = ie.get_property(target_device, ov::hint::inference_precision));
ASSERT_EQ(value, forced_precision_deprecated);
OPENVINO_SUPPRESS_DEPRECATED_END
}
TEST_P(OVClassGetPropertyTest_GPU, GetAndSetModelPriorityNoThrow) {
ov::Core ie;
ov::hint::Priority defaultValue{};
ASSERT_NO_THROW(defaultValue = ie.get_property(target_device, ov::hint::model_priority));
std::cout << "Default model_priority: " << defaultValue << std::endl;
ie.set_property(target_device, ov::hint::model_priority(ov::hint::Priority::HIGH));
ASSERT_EQ(ov::hint::Priority::HIGH, ie.get_property(target_device, ov::hint::model_priority));
ASSERT_EQ(ov::hint::Priority::MEDIUM, ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
ie.set_property(target_device, ov::hint::model_priority(ov::hint::Priority::LOW));
ASSERT_EQ(ov::hint::Priority::LOW, ie.get_property(target_device, ov::hint::model_priority));
ASSERT_EQ(ov::hint::Priority::MEDIUM, ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
ie.set_property(target_device, ov::hint::model_priority(ov::hint::Priority::MEDIUM));
ASSERT_EQ(ov::hint::Priority::MEDIUM, ie.get_property(target_device, ov::hint::model_priority));
ASSERT_EQ(ov::hint::Priority::MEDIUM, ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
ie.set_property(target_device, ov::intel_gpu::hint::queue_priority(ov::hint::Priority::HIGH));
ASSERT_EQ(ov::hint::Priority::HIGH, ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
OV_ASSERT_PROPERTY_SUPPORTED(ov::hint::model_priority);
}
TEST_P(OVClassGetPropertyTest_GPU, GetAndSetQueuePriorityNoThrow) {
ov::Core ie;
ov::hint::Priority defaultValue{};
ASSERT_NO_THROW(defaultValue = ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
std::cout << "Default GPU_QUEUE_PRIORITY: " << defaultValue << std::endl;
ie.set_property(target_device, ov::intel_gpu::hint::queue_priority(ov::hint::Priority::HIGH));
ASSERT_EQ(ov::hint::Priority::HIGH, ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
ie.set_property(target_device, ov::intel_gpu::hint::queue_priority(ov::hint::Priority::LOW));
ASSERT_EQ(ov::hint::Priority::LOW, ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
ie.set_property(target_device, ov::intel_gpu::hint::queue_priority(ov::hint::Priority::MEDIUM));
ASSERT_EQ(ov::hint::Priority::MEDIUM, ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::hint::queue_priority);
}
TEST_P(OVClassGetPropertyTest_GPU, GetAndSetThrottleLevelNoThrow) {
ov::Core ie;
ov::intel_gpu::hint::ThrottleLevel defaultValue{};
ASSERT_NO_THROW(defaultValue = ie.get_property(target_device, ov::intel_gpu::hint::queue_throttle));
std::cout << "Default GPU_QUEUE_THROTTLE: " << defaultValue << std::endl;
ie.set_property(target_device, ov::intel_gpu::hint::queue_throttle(ov::intel_gpu::hint::ThrottleLevel::HIGH));
ASSERT_EQ(ov::intel_gpu::hint::ThrottleLevel::HIGH, ie.get_property(target_device, ov::intel_gpu::hint::queue_throttle));
ie.set_property(target_device, ov::intel_gpu::hint::queue_throttle(ov::intel_gpu::hint::ThrottleLevel::LOW));
ASSERT_EQ(ov::intel_gpu::hint::ThrottleLevel::LOW, ie.get_property(target_device, ov::intel_gpu::hint::queue_throttle));
ie.set_property(target_device, ov::intel_gpu::hint::queue_throttle(ov::intel_gpu::hint::ThrottleLevel::MEDIUM));
ASSERT_EQ(ov::intel_gpu::hint::ThrottleLevel::MEDIUM, ie.get_property(target_device, ov::intel_gpu::hint::queue_throttle));
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::hint::queue_throttle);
}
TEST_P(OVClassGetPropertyTest_GPU, CanSetDefaultValueBackToPluginNewAPI) {
ov::Core ie;
std::vector<ov::PropertyName> properties;
ASSERT_NO_THROW(properties = ie.get_property(target_device, ov::supported_properties));
std::cout << "SUPPORTED_PROPERTIES:" << std::endl;
for (const auto& property : properties) {
ov::Any prop;
if (property.is_mutable()) {
std::cout << "RW: " << property << " ";
ASSERT_NO_THROW(prop = ie.get_property(target_device, property));
prop.print(std::cout);
std::cout << std::endl;
ASSERT_NO_THROW(ie.set_property(target_device, {{property, prop}}));
} else {
std::cout << "RO: " << property << " ";
ASSERT_NO_THROW(prop = ie.get_property(target_device, property));
prop.print(std::cout);
std::cout << std::endl;
}
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::supported_properties);
}
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetPropertyTest_GPU,
::testing::Values("GPU"));
using OVClassGetMetricTest_GPU_OPTIMAL_BATCH_SIZE = OVClassBaseTestP;
TEST_P(OVClassGetMetricTest_GPU_OPTIMAL_BATCH_SIZE, GetMetricAndPrintNoThrow) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
ov::Core ie;
unsigned int p = 0;
ov::AnyMap _options = {ov::hint::model(simpleNetwork)};
ASSERT_NO_THROW(p = ie.get_property(target_device, ov::optimal_batch_size.name(), _options).as<unsigned int>());
std::cout << "GPU device optimal batch size: " << p << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::optimal_batch_size);
}
INSTANTIATE_TEST_SUITE_P(
nightly_OVClassExecutableNetworkGetMetricTest, OVClassGetMetricTest_GPU_OPTIMAL_BATCH_SIZE,
::testing::Values("GPU")
);
using OVClassGetMetricTest_GPU_MAX_BATCH_SIZE_DEFAULT = OVClassBaseTestP;
TEST_P(OVClassGetMetricTest_GPU_MAX_BATCH_SIZE_DEFAULT, GetMetricAndPrintNoThrow) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
ov::Core ie;
unsigned int p = 0;
ov::AnyMap _options = {ov::hint::model(simpleNetwork)};
ASSERT_NO_THROW(p = ie.get_property(target_device, ov::max_batch_size.name(), _options).as<unsigned int>());
std::cout << "GPU device max available batch size: " << p << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::max_batch_size);
}
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassExecutableNetworkGetMetricTest, OVClassGetMetricTest_GPU_MAX_BATCH_SIZE_DEFAULT,
::testing::Values("GPU")
);
using OVClassGetMetricTest_GPU_MAX_BATCH_SIZE_STREAM_DEVICE_MEM = OVClassBaseTestP;
TEST_P(OVClassGetMetricTest_GPU_MAX_BATCH_SIZE_STREAM_DEVICE_MEM, GetMetricAndPrintNoThrow) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
ov::Core ie;
unsigned int p = 0;
auto exec_net1 = ie.compile_model(simpleNetwork, target_device);
uint32_t n_streams = 2;
int64_t available_device_mem_size = 1073741824;
ov::AnyMap _options = {ov::hint::model(simpleNetwork),
ov::num_streams(n_streams),
ov::intel_gpu::hint::available_device_mem(available_device_mem_size)};
ASSERT_NO_THROW(p = ie.get_property(target_device, ov::max_batch_size.name(), _options).as<unsigned int>());
std::cout << "GPU device max available batch size: " << p << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::max_batch_size);
}
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassExecutableNetworkGetMetricTest, OVClassGetMetricTest_GPU_MAX_BATCH_SIZE_STREAM_DEVICE_MEM,
::testing::Values("GPU")
);
using OVClassGetMetricTest_GPU_MEMORY_STATISTICS_DEFAULT = OVClassBaseTestP;
TEST_P(OVClassGetMetricTest_GPU_MEMORY_STATISTICS_DEFAULT, GetMetricAndPrintNoThrow) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
ov::Core ie;
std::map<std::string, uint64_t> p;
auto exec_net = ie.compile_model(simpleNetwork, target_device);
ASSERT_NO_THROW(p = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(p.empty());
std::cout << "Memory Statistics: " << std::endl;
for (auto &&kv : p) {
ASSERT_NE(kv.second, 0);
std::cout << kv.first << ": " << kv.second << " bytes" << std::endl;
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::memory_statistics);
}
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetMetricTest, OVClassGetMetricTest_GPU_MEMORY_STATISTICS_DEFAULT,
::testing::Values("GPU")
);
using OVClassGetMetricTest_GPU_MEMORY_STATISTICS_MULTIPLE_NETWORKS = OVClassBaseTestP;
TEST_P(OVClassGetMetricTest_GPU_MEMORY_STATISTICS_MULTIPLE_NETWORKS, GetMetricAndPrintNoThrow) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
ov::Core ie;
std::map<std::string, uint64_t> t1;
std::map<std::string, uint64_t> t2;
auto exec_net1 = ie.compile_model(simpleNetwork, target_device);
ASSERT_NO_THROW(t1 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t1.empty());
for (auto &&kv : t1) {
ASSERT_NE(kv.second, 0);
}
auto exec_net2 = ie.compile_model(simpleNetwork, target_device);
ASSERT_NO_THROW(t2 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t2.empty());
for (auto &&kv : t2) {
ASSERT_NE(kv.second, 0);
auto iter = t1.find(kv.first);
if (iter != t1.end()) {
ASSERT_EQ(kv.second, t1[kv.first] * 2);
}
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::memory_statistics);
}
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetMetricTest, OVClassGetMetricTest_GPU_MEMORY_STATISTICS_MULTIPLE_NETWORKS,
::testing::Values("GPU")
);
using OVClassGetMetricTest_GPU_MEMORY_STATISTICS_CHECK_VALUES = OVClassBaseTestP;
TEST_P(OVClassGetMetricTest_GPU_MEMORY_STATISTICS_CHECK_VALUES, GetMetricAndPrintNoThrow) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
ov::Core ie;
std::map<std::string, uint64_t> t1;
ASSERT_NO_THROW(t1 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_TRUE(t1.empty());
{
auto exec_net1 = ie.compile_model(simpleNetwork, target_device);
std::map<std::string, uint64_t> t2;
ASSERT_NO_THROW(t2 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t2.empty());
for (auto &&kv : t2) {
ASSERT_NE(kv.second, 0);
}
{
auto exec_net2 = ie.compile_model(actualNetwork, target_device);
std::map<std::string, uint64_t> t3;
ASSERT_NO_THROW(t3 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t3.empty());
for (auto &&kv : t3) {
ASSERT_NE(kv.second, 0);
}
}
std::map<std::string, uint64_t> t4;
ASSERT_NO_THROW(t4 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t4.empty());
for (auto &&kv : t4) {
ASSERT_NE(kv.second, 0);
if (kv.first.find("_cur") != std::string::npos) {
auto iter = t2.find(kv.first);
if (iter != t2.end()) {
ASSERT_EQ(t2[kv.first], kv.second);
}
}
}
}
std::map<std::string, uint64_t> t5;
ASSERT_NO_THROW(t5 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t5.empty());
for (auto &&kv : t5) {
if (kv.first.find("_cur") != std::string::npos) {
ASSERT_EQ(kv.second, 0);
}
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::memory_statistics);
}
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetMetricTest, OVClassGetMetricTest_GPU_MEMORY_STATISTICS_CHECK_VALUES,
::testing::Values("GPU")
);
using OVClassGetMetricTest_GPU_MEMORY_STATISTICS_MULTI_THREADS = OVClassBaseTestP;
TEST_P(OVClassGetMetricTest_GPU_MEMORY_STATISTICS_MULTI_THREADS, GetMetricAndPrintNoThrow) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
ov::Core ie;
std::map<std::string, uint64_t> t1;
std::map<std::string, uint64_t> t2;
std::atomic<uint32_t> counter{0u};
std::vector<std::thread> threads(2);
// key: thread id, value: executable network
std::map<uint32_t, ov::CompiledModel> exec_net_map;
std::vector<std::shared_ptr<ngraph::Function>> networks;
networks.emplace_back(simpleNetwork);
networks.emplace_back(simpleNetwork);
auto exec_net1 = ie.compile_model(simpleNetwork, target_device);
ASSERT_NO_THROW(t1 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t1.empty());
for (auto &&kv : t1) {
ASSERT_NE(kv.second, 0);
}
for (auto & thread : threads) {
thread = std::thread([&](){
auto value = counter++;
exec_net_map[value] = ie.compile_model(networks[value], target_device);
});
}
for (auto & thread : threads) {
if (thread.joinable()) {
thread.join();
}
}
ASSERT_NO_THROW(t2 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t2.empty());
for (auto &&kv : t2) {
ASSERT_NE(kv.second, 0);
auto iter = t1.find(kv.first);
if (iter != t1.end()) {
ASSERT_EQ(kv.second, t1[kv.first] * 3);
}
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::memory_statistics);
}
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetMetricTest, OVClassGetMetricTest_GPU_MEMORY_STATISTICS_MULTI_THREADS,
::testing::Values("GPU")
);
//
// IE Class GetConfig
//
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetConfigTest, OVClassGetConfigTest, ::testing::Values("GPU"));
// IE Class Query network
INSTANTIATE_TEST_SUITE_P(smoke_OVClassQueryNetworkTest, OVClassQueryNetworkTest, ::testing::Values("GPU"));
// IE Class Load network
INSTANTIATE_TEST_SUITE_P(smoke_OVClassLoadNetworkTest, OVClassLoadNetworkTest, ::testing::Values("GPU"));
const std::vector<ov::AnyMap> gpuCorrectConfigs = {
{
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(false)
},
{
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(true)
}
};
auto gpuCorrectConfigsWithSecondaryProperties = []() {
return std::vector<ov::AnyMap>{
{ov::device::properties(CommonTestUtils::DEVICE_GPU,
ov::hint::execution_mode(ov::hint::ExecutionMode::PERFORMANCE),
ov::hint::inference_precision(ov::element::f32))},
{ov::device::properties(CommonTestUtils::DEVICE_GPU,
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(false))},
{ov::device::properties(CommonTestUtils::DEVICE_GPU,
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(false)),
ov::device::properties(CommonTestUtils::DEVICE_CPU,
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY),
ov::hint::allow_auto_batching(false))}};
};
INSTANTIATE_TEST_SUITE_P(smoke_OVClassLoadNetworkWithCorrectPropertiesAutoBatchingTest, OVClassLoadNetworkWithCorrectPropertiesTest,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(gpuCorrectConfigs)));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassLoadNetworkWithCorrectSecondaryPropertiesTest,
OVClassLoadNetworkWithCorrectPropertiesTest,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(gpuCorrectConfigsWithSecondaryProperties())),
::testing::PrintToStringParamName());
INSTANTIATE_TEST_SUITE_P(smoke_AUTO_OVClassLoadNetworkWithCorrectSecondaryPropertiesTest,
OVClassLoadNetworkWithCorrectPropertiesTest,
::testing::Combine(::testing::Values("AUTO:GPU", "MULTI:GPU", "HETERO:GPU"),
::testing::ValuesIn(gpuCorrectConfigsWithSecondaryProperties())));
auto autoCorrectConfigs = []() {
return std::vector<ov::AnyMap>{{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(false)},
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(true)}};
};
auto autoCorrectConfigsWithSecondaryProperties = []() {
return std::vector<ov::AnyMap>{
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::device::properties(CommonTestUtils::DEVICE_AUTO,
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(false))},
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::device::properties(CommonTestUtils::DEVICE_GPU,
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(false))},
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::device::properties(CommonTestUtils::DEVICE_GPU,
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(false)),
ov::device::properties(CommonTestUtils::DEVICE_CPU,
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY),
ov::hint::allow_auto_batching(false))},
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::device::properties("GPU.0",
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(false)),
ov::device::properties(CommonTestUtils::DEVICE_CPU,
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY),
ov::hint::allow_auto_batching(false))}};
};
INSTANTIATE_TEST_SUITE_P(smoke_Auto_OVClassLoadNetworkWithCorrectPropertiesAutoBatchingTest, OVClassLoadNetworkWithCorrectPropertiesTest,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_MULTI, CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(autoCorrectConfigs())));
INSTANTIATE_TEST_SUITE_P(smoke_Auto_OVClassLoadNetworkWithCorrectSecondaryPropertiesTest,
OVClassLoadNetworkWithCorrectPropertiesTest,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_MULTI,
CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(autoCorrectConfigsWithSecondaryProperties())),
::testing::PrintToStringParamName());
const std::vector<ov::AnyMap> batchCorrectConfigs = {
{}
};
INSTANTIATE_TEST_SUITE_P(smoke_Auto_Batch_OVClassLoadNetworkWithCorrectPropertiesAutoBatchingTest, OVClassLoadNetworkWithCorrectPropertiesTest,
::testing::Combine(::testing::Values("BATCH:GPU"),
::testing::ValuesIn(batchCorrectConfigs)));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassHeteroExecutableNetworkGetMetricTest,
OVClassLoadNetworkAfterCoreRecreateTest,
::testing::Values("GPU"));
using OVClassGetMetricTest_CACHING_PROPERTIES = OVClassBaseTestP;
TEST_P(OVClassGetMetricTest_CACHING_PROPERTIES, GetMetricAndPrintNoThrow) {
ov::Core ie = createCoreWithTemplate();
std::vector<ov::PropertyName> caching_properties = {};
const std::vector<ov::PropertyName> expected_properties = {
ov::device::architecture.name(),
ov::intel_gpu::execution_units_count.name(),
ov::intel_gpu::driver_version.name(),
ov::hint::inference_precision.name(),
ov::hint::execution_mode.name(),
};
ASSERT_NO_THROW(caching_properties = ie.get_property(target_device, ov::caching_properties));
std::cout << "GPU Caching properties: " << std::endl;
for (auto& prop : caching_properties) {
std::cout << prop << std::endl;
}
ASSERT_EQ(caching_properties.size(), expected_properties.size());
for (const auto& property_name : expected_properties) {
ASSERT_TRUE(std::find(caching_properties.begin(),
caching_properties.end(),
property_name) != caching_properties.end());
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::caching_properties);
}
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_CACHING_PROPERTIES,
::testing::Values("GPU"));
// GetConfig / SetConfig for specific device
INSTANTIATE_TEST_SUITE_P(
nightly_OVClassSpecificDevice0Test, OVClassSpecificDeviceTestGetConfig,
::testing::Values("GPU.0")
);
INSTANTIATE_TEST_SUITE_P(
nightly_OVClassSpecificDevice1Test, OVClassSpecificDeviceTestGetConfig,
::testing::Values("GPU.1")
);
INSTANTIATE_TEST_SUITE_P(
nightly_OVClassSpecificDevice0Test, OVClassSpecificDeviceTestSetConfig,
::testing::Values("GPU.0")
);
INSTANTIATE_TEST_SUITE_P(
nightly_OVClassSpecificDevice1Test, OVClassSpecificDeviceTestSetConfig,
::testing::Values("GPU.1")
);
INSTANTIATE_TEST_SUITE_P(nightly_OVClassModelTestP, OVClassModelTestP, ::testing::Values("GPU"));
// Several devices case
INSTANTIATE_TEST_SUITE_P(nightly_OVClassSeveralDevicesTest,
OVClassSeveralDevicesTestCompileModel,
::testing::Values(std::vector<std::string>({"GPU.0", "GPU.1"})));
INSTANTIATE_TEST_SUITE_P(
nightly_OVClassSeveralDevicesTest, OVClassSeveralDevicesTestLoadNetwork,
::testing::Values(std::vector<std::string>({"GPU.0", "GPU.1"}))
);
INSTANTIATE_TEST_SUITE_P(nightly_OVClassSeveralDevicesTest,
OVClassSeveralDevicesTestQueryModel,
::testing::Values(std::vector<std::string>({"GPU.0", "GPU.1"})));
INSTANTIATE_TEST_SUITE_P(
nightly_OVClassSeveralDevicesTest, OVClassSeveralDevicesTestQueryNetwork,
::testing::Values(std::vector<std::string>({"GPU.0", "GPU.1"}))
);
INSTANTIATE_TEST_SUITE_P(
nightly_OVClassSeveralDevicesTest, OVClassSeveralDevicesTestDefaultCore,
::testing::Values(std::vector<std::string>({"GPU.0", "GPU.1"}))
);
// Set default device ID
INSTANTIATE_TEST_SUITE_P(
nightly_OVClassSetDefaultDeviceIDTest, OVClassSetDefaultDeviceIDTest,
::testing::Values(std::make_pair("GPU", "1"))
);
INSTANTIATE_TEST_SUITE_P(nightly_OVClassSeveralDevicesTest,
OVClassSeveralDevicesTestDefaultCore,
::testing::Values(std::vector<std::string>({"GPU.0", "GPU.1"})));
// Set config for all GPU devices
INSTANTIATE_TEST_SUITE_P(
nightly_OVClassSetGlobalConfigTest, OVClassSetGlobalConfigTest,
::testing::Values("GPU")
);
INSTANTIATE_TEST_SUITE_P(nightly_OVClassSetGlobalConfigTest, OVClassSetGlobalConfigTest, ::testing::Values("GPU"));
// IE Class Query network
INSTANTIATE_TEST_SUITE_P(smoke_OVClassQueryModelTest, OVClassQueryModelTest, ::testing::Values("GPU"));
} // namespace

View File

@ -3,7 +3,21 @@
//
#include "behavior/ov_plugin/properties_tests.hpp"
#include <openvino/runtime/auto/properties.hpp>
#include <thread>
#include "cpp_interfaces/interface/ie_internal_plugin_config.hpp"
#include "intel_gpu/runtime/internal_properties.hpp"
#include "openvino/runtime/intel_gpu/properties.hpp"
#ifdef _WIN32
# include "gpu/gpu_context_api_dx.hpp"
#elif defined ENABLE_LIBVA
# include <gpu/gpu_context_api_va.hpp>
#endif
#include "gpu/gpu_config.hpp"
#include "gpu/gpu_context_api_ocl.hpp"
using namespace ov::test::behavior;
using namespace InferenceEngine::PluginConfigParams;
@ -11,15 +25,15 @@ using namespace InferenceEngine::PluginConfigParams;
namespace {
const std::vector<ov::AnyMap> gpu_properties = {
{ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)},
{ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)},
{ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)},
{ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)},
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVPropertiesTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(gpu_properties)),
OVPropertiesTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
OVPropertiesTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(gpu_properties)),
OVPropertiesTests::getTestCaseName);
auto auto_multi_properties = []() {
return std::vector<ov::AnyMap>{
@ -35,60 +49,52 @@ auto auto_multi_properties = []() {
{ov::device::priorities(CommonTestUtils::DEVICE_GPU), ov::intel_auto::enable_startup_fallback("NO")}};
};
const std::vector<ov::AnyMap> multi_properties = {
{ov::device::priorities("CPU", "GPU")},
{ov::device::priorities("CPU(1)", "GPU")},
{ov::device::priorities("CPU(1)", "GPU(2)")}
};
const std::vector<ov::AnyMap> multi_properties = {{ov::device::priorities("CPU", "GPU")},
{ov::device::priorities("CPU(1)", "GPU")},
{ov::device::priorities("CPU(1)", "GPU(2)")}};
const std::vector<ov::AnyMap> auto_properties = {
{ov::device::priorities("CPU", "GPU")},
{ov::device::priorities("-CPU", "GPU")},
{ov::device::priorities("CPU(1)", "GPU")},
{ov::device::priorities("CPU(1)", "GPU(2)")},
{ov::device::priorities("CPU", "-GPU")}
};
const std::vector<ov::AnyMap> auto_properties = {{ov::device::priorities("CPU", "GPU")},
{ov::device::priorities("-CPU", "GPU")},
{ov::device::priorities("CPU(1)", "GPU")},
{ov::device::priorities("CPU(1)", "GPU(2)")},
{ov::device::priorities("CPU", "-GPU")}};
const std::vector<ov::AnyMap> compiled_empty_properties = {{}};
const std::vector<ov::AnyMap> compiled_empty_properties = {
{}
};
const std::vector<ov::AnyMap> incorrect_device_priorities_properties = {{ov::device::priorities("NONE")},
{ov::device::priorities("NONE", "GPU")},
{ov::device::priorities("-", "GPU")},
{ov::device::priorities("-NONE", "CPU")},
{ov::device::priorities("-CPU", "-NONE")},
{ov::device::priorities("-NONE", "-NONE")}};
const std::vector<ov::AnyMap> incorrect_device_priorities_properties = {
{ov::device::priorities("NONE")},
{ov::device::priorities("NONE", "GPU")},
{ov::device::priorities("-", "GPU")},
{ov::device::priorities("-NONE", "CPU")},
{ov::device::priorities("-CPU", "-NONE")},
{ov::device::priorities("-NONE", "-NONE")}
};
INSTANTIATE_TEST_SUITE_P(smoke_AutoMultiBehaviorTests,
OVPropertiesTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_AUTO,
CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(auto_multi_properties())),
OVPropertiesTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_AutoMultiBehaviorTests, OVPropertiesTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_AUTO, CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(auto_multi_properties())),
OVPropertiesTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_AutoBehaviorTests,
OVPropertiesTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(auto_properties)),
OVPropertiesTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_AutoBehaviorTests, OVPropertiesTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(auto_properties)),
OVPropertiesTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_MultiBehaviorTests,
OVPropertiesTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multi_properties)),
OVPropertiesTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_MultiBehaviorTests, OVPropertiesTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multi_properties)),
OVPropertiesTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorIncorrectPropertiesTests, OVSetPropCompileModelWithIncorrectPropTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_AUTO,
CommonTestUtils::DEVICE_MULTI,
CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(incorrect_device_priorities_properties),
::testing::ValuesIn(compiled_empty_properties)),
OVSetPropCompileModelWithIncorrectPropTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorIncorrectPropertiesTests,
OVSetPropCompileModelWithIncorrectPropTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_AUTO,
CommonTestUtils::DEVICE_MULTI,
CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(incorrect_device_priorities_properties),
::testing::ValuesIn(compiled_empty_properties)),
OVSetPropCompileModelWithIncorrectPropTests::getTestCaseName);
const std::vector<ov::AnyMap> gpu_setcore_properties = {
{ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
@ -151,34 +157,44 @@ INSTANTIATE_TEST_SUITE_P(smoke_AutoCompileModelBehaviorTests,
OVSetPropComplieModleGetPropTests::getTestCaseName);
const std::vector<std::pair<ov::AnyMap, std::string>> autoExeDeviceConfigs = {
std::make_pair(ov::AnyMap{{ov::device::priorities("GPU.0")}}, "GPU.0"),
#ifdef ENABLE_INTEL_CPU
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_GPU, CommonTestUtils::DEVICE_CPU)}}, "undefined"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_CPU, CommonTestUtils::DEVICE_GPU)}}, "CPU"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_CPU, CommonTestUtils::DEVICE_GPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::CUMULATIVE_THROUGHPUT)}}, "CPU,GPU"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_GPU, CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::CUMULATIVE_THROUGHPUT)}}, "GPU,CPU"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_GPU, CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::CUMULATIVE_THROUGHPUT),
ov::hint::allow_auto_batching(true)}}, "GPU,CPU"),
#endif
};
std::make_pair(ov::AnyMap{{ov::device::priorities("GPU.0")}}, "GPU.0"),
#ifdef ENABLE_INTEL_CPU
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_GPU, CommonTestUtils::DEVICE_CPU)}},
"undefined"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_CPU, CommonTestUtils::DEVICE_GPU)}},
"CPU"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_CPU, CommonTestUtils::DEVICE_GPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::CUMULATIVE_THROUGHPUT)}},
"CPU,GPU"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_GPU, CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::CUMULATIVE_THROUGHPUT)}},
"GPU,CPU"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_GPU, CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::CUMULATIVE_THROUGHPUT),
ov::hint::allow_auto_batching(true)}},
"GPU,CPU"),
#endif
};
const std::vector<std::pair<ov::AnyMap, std::string>> multiExeDeviceConfigs = {
std::make_pair(ov::AnyMap{{ov::device::priorities("GPU.0")}}, "GPU.0"),
#ifdef ENABLE_INTEL_CPU
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_GPU, CommonTestUtils::DEVICE_CPU)}}, "GPU,CPU"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_CPU, CommonTestUtils::DEVICE_GPU)}}, "CPU,GPU"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_CPU, CommonTestUtils::DEVICE_GPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::CUMULATIVE_THROUGHPUT)}}, "CPU,GPU"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_GPU, CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::CUMULATIVE_THROUGHPUT)}}, "GPU,CPU"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_GPU, CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::CUMULATIVE_THROUGHPUT),
ov::hint::allow_auto_batching(true)}}, "GPU,CPU"),
#endif
};
std::make_pair(ov::AnyMap{{ov::device::priorities("GPU.0")}}, "GPU.0"),
#ifdef ENABLE_INTEL_CPU
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_GPU, CommonTestUtils::DEVICE_CPU)}},
"GPU,CPU"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_CPU, CommonTestUtils::DEVICE_GPU)}},
"CPU,GPU"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_CPU, CommonTestUtils::DEVICE_GPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::CUMULATIVE_THROUGHPUT)}},
"CPU,GPU"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_GPU, CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::CUMULATIVE_THROUGHPUT)}},
"GPU,CPU"),
std::make_pair(ov::AnyMap{{ov::device::priorities(CommonTestUtils::DEVICE_GPU, CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::CUMULATIVE_THROUGHPUT),
ov::hint::allow_auto_batching(true)}},
"GPU,CPU"),
#endif
};
INSTANTIATE_TEST_SUITE_P(smoke_AutoMultiCompileModelBehaviorTests,
OVCompileModelGetExecutionDeviceTests,
@ -191,4 +207,771 @@ INSTANTIATE_TEST_SUITE_P(smoke_MultiCompileModelBehaviorTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multiExeDeviceConfigs)),
OVCompileModelGetExecutionDeviceTests::getTestCaseName);
} // namespace
INSTANTIATE_TEST_SUITE_P(nightly_OVClassCommon,
OVClassBasicPropsTestP,
::testing::Values(std::make_pair("openvino_intel_gpu_plugin", "GPU")));
//
// IE Class GetMetric
//
INSTANTIATE_TEST_SUITE_P(nightly_MultiHeteroAutoBatchOVGetMetricPropsTest,
OVGetMetricPropsTest,
::testing::Values("MULTI", "HETERO", "AUTO", "BATCH"));
INSTANTIATE_TEST_SUITE_P(nightly_gpuOVGetMetricPropsTest, OVGetMetricPropsTest, ::testing::Values("GPU"));
INSTANTIATE_TEST_SUITE_P(nightly_OVGetConfigTest,
OVGetConfigTest_ThrowUnsupported,
::testing::Values("GPU", "MULTI", "HETERO", "AUTO", "BATCH"));
INSTANTIATE_TEST_SUITE_P(nightly_OVGetAvailableDevicesPropsTest,
OVGetAvailableDevicesPropsTest,
::testing::Values("GPU"));
INSTANTIATE_TEST_SUITE_P(smoke_OVSetModelPriorityConfigTest,
OVSetModelPriorityConfigTest,
::testing::Values("MULTI", "AUTO"));
INSTANTIATE_TEST_SUITE_P(smoke_OVSetExecutionModeHintConfigTest,
OVSetExecutionModeHintConfigTest,
::testing::Values(CommonTestUtils::DEVICE_GPU));
INSTANTIATE_TEST_SUITE_P(smoke_OVSetLogLevelConfigTest, OVSetLogLevelConfigTest, ::testing::Values("MULTI", "AUTO"));
auto multiConfigs = []() {
return std::vector<ov::AnyMap>{
{ov::device::priorities(CommonTestUtils::DEVICE_CPU)},
{ov::device::priorities(CommonTestUtils::DEVICE_GPU)},
};
};
INSTANTIATE_TEST_SUITE_P(smoke_OVClassSetDevicePriorityConfigPropsTest,
OVClassSetDevicePriorityConfigPropsTest,
::testing::Combine(::testing::Values("MULTI", "AUTO", "HETERO"),
::testing::ValuesIn(multiConfigs())));
//
// GPU specific metrics
//
using OVGetMetricPropsTest_GPU_DEVICE_TOTAL_MEM_SIZE = OVClassBaseTestP;
TEST_P(OVGetMetricPropsTest_GPU_DEVICE_TOTAL_MEM_SIZE, GetMetricAndPrintNoThrow) {
ov::Core ie;
ov::Any p;
ASSERT_NO_THROW(p = ie.get_property(target_device, GPU_METRIC_KEY(DEVICE_TOTAL_MEM_SIZE)));
auto t = p.as<uint64_t>();
std::cout << "GPU device total memory size: " << t << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(GPU_METRIC_KEY(DEVICE_TOTAL_MEM_SIZE));
}
INSTANTIATE_TEST_SUITE_P(nightly_OVGetMetricPropsTest,
OVGetMetricPropsTest_GPU_DEVICE_TOTAL_MEM_SIZE,
::testing::Values("GPU"));
using OVGetMetricPropsTest_GPU_UARCH_VERSION = OVClassBaseTestP;
TEST_P(OVGetMetricPropsTest_GPU_UARCH_VERSION, GetMetricAndPrintNoThrow) {
ov::Core ie;
ov::Any p;
ASSERT_NO_THROW(p = ie.get_property(target_device, GPU_METRIC_KEY(UARCH_VERSION)));
auto t = p.as<std::string>();
std::cout << "GPU device uarch: " << t << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(GPU_METRIC_KEY(UARCH_VERSION));
}
INSTANTIATE_TEST_SUITE_P(nightly_OVGetMetricPropsTest,
OVGetMetricPropsTest_GPU_UARCH_VERSION,
::testing::Values("GPU"));
using OVGetMetricPropsTest_GPU_EXECUTION_UNITS_COUNT = OVClassBaseTestP;
TEST_P(OVGetMetricPropsTest_GPU_EXECUTION_UNITS_COUNT, GetMetricAndPrintNoThrow) {
ov::Core ie;
ov::Any p;
ASSERT_NO_THROW(p = ie.get_property(target_device, GPU_METRIC_KEY(EXECUTION_UNITS_COUNT)));
auto t = p.as<int>();
std::cout << "GPU EUs count: " << t << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(GPU_METRIC_KEY(EXECUTION_UNITS_COUNT));
}
INSTANTIATE_TEST_SUITE_P(nightly_OVGetMetricPropsTest,
OVGetMetricPropsTest_GPU_EXECUTION_UNITS_COUNT,
::testing::Values("GPU"));
using OVClassGetPropertyTest_GPU = OVClassBaseTestP;
TEST_P(OVClassGetPropertyTest_GPU, GetMetricAvailableDevicesAndPrintNoThrow) {
ov::Core ie;
std::vector<std::string> properties;
ASSERT_NO_THROW(properties = ie.get_property(target_device, ov::available_devices));
std::cout << "AVAILABLE_DEVICES: ";
for (const auto& prop : properties) {
std::cout << prop << " ";
}
std::cout << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::available_devices);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricRangeForAsyncInferRequestsAndPrintNoThrow) {
ov::Core ie;
std::tuple<unsigned int, unsigned int, unsigned int> property;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::range_for_async_infer_requests));
std::cout << "RANGE_FOR_ASYNC_INFER_REQUESTS: " << std::get<0>(property) << " " << std::get<1>(property) << " "
<< std::get<2>(property) << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::range_for_async_infer_requests);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricRangeForStreamsAndPrintNoThrow) {
ov::Core ie;
std::tuple<unsigned int, unsigned int> property;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::range_for_streams));
std::cout << "RANGE_FOR_STREAMS: " << std::get<0>(property) << " " << std::get<1>(property) << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::range_for_streams);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricOptimalBatchSizeAndPrintNoThrow) {
ov::Core ie;
unsigned int property = 0;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::optimal_batch_size));
std::cout << "OPTIMAL_BATCH_SIZE: " << property << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::optimal_batch_size);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricFullNameAndPrintNoThrow) {
ov::Core ie;
std::string property;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::device::full_name));
std::cout << "FULL_DEVICE_NAME: " << property << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::device::full_name);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricTypeAndPrintNoThrow) {
ov::Core ie;
ov::device::Type property = ov::device::Type::INTEGRATED;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::device::type));
std::cout << "DEVICE_TYPE: " << property << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::device::type);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricGopsAndPrintNoThrow) {
ov::Core ie;
std::map<ov::element::Type, float> properties;
ASSERT_NO_THROW(properties = ie.get_property(target_device, ov::device::gops));
std::cout << "DEVICE_GOPS: " << std::endl;
for (const auto& prop : properties) {
std::cout << "- " << prop.first << ": " << prop.second << std::endl;
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::device::gops);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricCapabilitiesAndPrintNoThrow) {
ov::Core ie;
std::vector<std::string> properties;
ASSERT_NO_THROW(properties = ie.get_property(target_device, ov::device::capabilities));
std::cout << "OPTIMIZATION_CAPABILITIES: " << std::endl;
for (const auto& prop : properties) {
std::cout << "- " << prop << std::endl;
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::device::capabilities);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricDeviceTotalMemSizeAndPrintNoThrow) {
ov::Core ie;
uint64_t property = 0;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::intel_gpu::device_total_mem_size));
std::cout << "GPU_DEVICE_TOTAL_MEM_SIZE: " << property << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::device_total_mem_size);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricUarchVersionAndPrintNoThrow) {
ov::Core ie;
std::string property;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::intel_gpu::uarch_version));
std::cout << "GPU_UARCH_VERSION: " << property << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::uarch_version);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricExecutionUnitsCountAndPrintNoThrow) {
ov::Core ie;
int32_t property = 0;
ASSERT_NO_THROW(property = ie.get_property(target_device, ov::intel_gpu::execution_units_count));
std::cout << "GPU_EXECUTION_UNITS_COUNT: " << property << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::execution_units_count);
}
TEST_P(OVClassGetPropertyTest_GPU, GetMetricMemoryStatisticsAndPrintNoThrow) {
ov::Core ie;
std::map<std::string, uint64_t> properties;
ASSERT_NO_THROW(properties = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
std::cout << "GPU_MEMORY_STATISTICS: " << std::endl;
for (const auto& prop : properties) {
std::cout << " " << prop.first << " - " << prop.second << std::endl;
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::memory_statistics);
}
TEST_P(OVClassGetPropertyTest_GPU, GetAndSetPerformanceModeNoThrow) {
ov::Core ie;
ov::hint::PerformanceMode defaultMode{};
ASSERT_NO_THROW(defaultMode = ie.get_property(target_device, ov::hint::performance_mode));
std::cout << "Default PERFORMANCE_HINT: \"" << defaultMode << "\"" << std::endl;
ie.set_property(target_device, ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY));
ASSERT_EQ(ov::hint::PerformanceMode::LATENCY, ie.get_property(target_device, ov::hint::performance_mode));
ie.set_property(target_device, ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT));
ASSERT_EQ(ov::hint::PerformanceMode::THROUGHPUT, ie.get_property(target_device, ov::hint::performance_mode));
OV_ASSERT_PROPERTY_SUPPORTED(ov::hint::performance_mode);
}
TEST_P(OVClassGetPropertyTest_GPU, GetAndSetEnableProfilingNoThrow) {
ov::Core ie;
bool defaultValue = false;
ASSERT_NO_THROW(defaultValue = ie.get_property(target_device, ov::enable_profiling));
std::cout << "Default PERF_COUNT: " << defaultValue << std::endl;
ie.set_property(target_device, ov::enable_profiling(true));
ASSERT_EQ(true, ie.get_property(target_device, ov::enable_profiling));
OV_ASSERT_PROPERTY_SUPPORTED(ov::enable_profiling);
}
TEST_P(OVClassGetPropertyTest_GPU, GetAndSetInferencePrecisionNoThrow) {
ov::Core ie;
auto value = ov::element::undefined;
const auto expected_default_precision = ov::element::f16;
OV_ASSERT_NO_THROW(value = ie.get_property(target_device, ov::hint::inference_precision));
ASSERT_EQ(expected_default_precision, value);
const auto forced_precision = ov::element::f32;
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::hint::inference_precision(forced_precision)));
OV_ASSERT_NO_THROW(value = ie.get_property(target_device, ov::hint::inference_precision));
ASSERT_EQ(value, forced_precision);
OPENVINO_SUPPRESS_DEPRECATED_START
const auto forced_precision_deprecated = ov::element::f16;
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::hint::inference_precision(forced_precision_deprecated)));
OV_ASSERT_NO_THROW(value = ie.get_property(target_device, ov::hint::inference_precision));
ASSERT_EQ(value, forced_precision_deprecated);
OPENVINO_SUPPRESS_DEPRECATED_END
}
TEST_P(OVClassGetPropertyTest_GPU, GetAndSetModelPriorityNoThrow) {
ov::Core ie;
ov::hint::Priority defaultValue{};
ASSERT_NO_THROW(defaultValue = ie.get_property(target_device, ov::hint::model_priority));
std::cout << "Default model_priority: " << defaultValue << std::endl;
ie.set_property(target_device, ov::hint::model_priority(ov::hint::Priority::HIGH));
ASSERT_EQ(ov::hint::Priority::HIGH, ie.get_property(target_device, ov::hint::model_priority));
ASSERT_EQ(ov::hint::Priority::MEDIUM, ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
ie.set_property(target_device, ov::hint::model_priority(ov::hint::Priority::LOW));
ASSERT_EQ(ov::hint::Priority::LOW, ie.get_property(target_device, ov::hint::model_priority));
ASSERT_EQ(ov::hint::Priority::MEDIUM, ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
ie.set_property(target_device, ov::hint::model_priority(ov::hint::Priority::MEDIUM));
ASSERT_EQ(ov::hint::Priority::MEDIUM, ie.get_property(target_device, ov::hint::model_priority));
ASSERT_EQ(ov::hint::Priority::MEDIUM, ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
ie.set_property(target_device, ov::intel_gpu::hint::queue_priority(ov::hint::Priority::HIGH));
ASSERT_EQ(ov::hint::Priority::HIGH, ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
OV_ASSERT_PROPERTY_SUPPORTED(ov::hint::model_priority);
}
TEST_P(OVClassGetPropertyTest_GPU, GetAndSetQueuePriorityNoThrow) {
ov::Core ie;
ov::hint::Priority defaultValue{};
ASSERT_NO_THROW(defaultValue = ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
std::cout << "Default GPU_QUEUE_PRIORITY: " << defaultValue << std::endl;
ie.set_property(target_device, ov::intel_gpu::hint::queue_priority(ov::hint::Priority::HIGH));
ASSERT_EQ(ov::hint::Priority::HIGH, ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
ie.set_property(target_device, ov::intel_gpu::hint::queue_priority(ov::hint::Priority::LOW));
ASSERT_EQ(ov::hint::Priority::LOW, ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
ie.set_property(target_device, ov::intel_gpu::hint::queue_priority(ov::hint::Priority::MEDIUM));
ASSERT_EQ(ov::hint::Priority::MEDIUM, ie.get_property(target_device, ov::intel_gpu::hint::queue_priority));
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::hint::queue_priority);
}
TEST_P(OVClassGetPropertyTest_GPU, GetAndSetThrottleLevelNoThrow) {
ov::Core ie;
ov::intel_gpu::hint::ThrottleLevel defaultValue{};
ASSERT_NO_THROW(defaultValue = ie.get_property(target_device, ov::intel_gpu::hint::queue_throttle));
std::cout << "Default GPU_QUEUE_THROTTLE: " << defaultValue << std::endl;
ie.set_property(target_device, ov::intel_gpu::hint::queue_throttle(ov::intel_gpu::hint::ThrottleLevel::HIGH));
ASSERT_EQ(ov::intel_gpu::hint::ThrottleLevel::HIGH,
ie.get_property(target_device, ov::intel_gpu::hint::queue_throttle));
ie.set_property(target_device, ov::intel_gpu::hint::queue_throttle(ov::intel_gpu::hint::ThrottleLevel::LOW));
ASSERT_EQ(ov::intel_gpu::hint::ThrottleLevel::LOW,
ie.get_property(target_device, ov::intel_gpu::hint::queue_throttle));
ie.set_property(target_device, ov::intel_gpu::hint::queue_throttle(ov::intel_gpu::hint::ThrottleLevel::MEDIUM));
ASSERT_EQ(ov::intel_gpu::hint::ThrottleLevel::MEDIUM,
ie.get_property(target_device, ov::intel_gpu::hint::queue_throttle));
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::hint::queue_throttle);
}
TEST_P(OVClassGetPropertyTest_GPU, CanSetDefaultValueBackToPluginNewAPI) {
ov::Core ie;
std::vector<ov::PropertyName> properties;
ASSERT_NO_THROW(properties = ie.get_property(target_device, ov::supported_properties));
std::cout << "SUPPORTED_PROPERTIES:" << std::endl;
for (const auto& property : properties) {
ov::Any prop;
if (property.is_mutable()) {
std::cout << "RW: " << property << " ";
ASSERT_NO_THROW(prop = ie.get_property(target_device, property));
prop.print(std::cout);
std::cout << std::endl;
ASSERT_NO_THROW(ie.set_property(target_device, {{property, prop}}));
} else {
std::cout << "RO: " << property << " ";
ASSERT_NO_THROW(prop = ie.get_property(target_device, property));
prop.print(std::cout);
std::cout << std::endl;
}
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::supported_properties);
}
INSTANTIATE_TEST_SUITE_P(nightly_OVGetMetricPropsTest, OVClassGetPropertyTest_GPU, ::testing::Values("GPU"));
using OVGetMetricPropsTest_GPU_OPTIMAL_BATCH_SIZE = OVClassBaseTestP;
TEST_P(OVGetMetricPropsTest_GPU_OPTIMAL_BATCH_SIZE, GetMetricAndPrintNoThrow) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
ov::Core ie;
unsigned int p = 0;
ov::AnyMap _options = {ov::hint::model(simpleNetwork)};
ASSERT_NO_THROW(p = ie.get_property(target_device, ov::optimal_batch_size.name(), _options).as<unsigned int>());
std::cout << "GPU device optimal batch size: " << p << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::optimal_batch_size);
}
INSTANTIATE_TEST_SUITE_P(nightly_OVClassExecutableNetworkGetMetricTest,
OVGetMetricPropsTest_GPU_OPTIMAL_BATCH_SIZE,
::testing::Values("GPU"));
using OVGetMetricPropsTest_GPU_MAX_BATCH_SIZE_DEFAULT = OVClassBaseTestP;
TEST_P(OVGetMetricPropsTest_GPU_MAX_BATCH_SIZE_DEFAULT, GetMetricAndPrintNoThrow) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
ov::Core ie;
unsigned int p = 0;
ov::AnyMap _options = {ov::hint::model(simpleNetwork)};
ASSERT_NO_THROW(p = ie.get_property(target_device, ov::max_batch_size.name(), _options).as<unsigned int>());
std::cout << "GPU device max available batch size: " << p << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::max_batch_size);
}
INSTANTIATE_TEST_SUITE_P(nightly_IEClassExecutableNetworkGetMetricTest,
OVGetMetricPropsTest_GPU_MAX_BATCH_SIZE_DEFAULT,
::testing::Values("GPU"));
using OVGetMetricPropsTest_GPU_MAX_BATCH_SIZE_STREAM_DEVICE_MEM = OVClassBaseTestP;
TEST_P(OVGetMetricPropsTest_GPU_MAX_BATCH_SIZE_STREAM_DEVICE_MEM, GetMetricAndPrintNoThrow) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
ov::Core ie;
unsigned int p = 0;
auto exec_net1 = ie.compile_model(simpleNetwork, target_device);
uint32_t n_streams = 2;
int64_t available_device_mem_size = 1073741824;
ov::AnyMap _options = {ov::hint::model(simpleNetwork),
ov::num_streams(n_streams),
ov::intel_gpu::hint::available_device_mem(available_device_mem_size)};
ASSERT_NO_THROW(p = ie.get_property(target_device, ov::max_batch_size.name(), _options).as<unsigned int>());
std::cout << "GPU device max available batch size: " << p << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::max_batch_size);
}
INSTANTIATE_TEST_SUITE_P(nightly_IEClassExecutableNetworkGetMetricTest,
OVGetMetricPropsTest_GPU_MAX_BATCH_SIZE_STREAM_DEVICE_MEM,
::testing::Values("GPU"));
using OVGetMetricPropsTest_GPU_MEMORY_STATISTICS_DEFAULT = OVClassBaseTestP;
TEST_P(OVGetMetricPropsTest_GPU_MEMORY_STATISTICS_DEFAULT, GetMetricAndPrintNoThrow) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
ov::Core ie;
std::map<std::string, uint64_t> p;
auto exec_net = ie.compile_model(simpleNetwork, target_device);
ASSERT_NO_THROW(p = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(p.empty());
std::cout << "Memory Statistics: " << std::endl;
for (auto&& kv : p) {
ASSERT_NE(kv.second, 0);
std::cout << kv.first << ": " << kv.second << " bytes" << std::endl;
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::memory_statistics);
}
INSTANTIATE_TEST_SUITE_P(nightly_IEClassGetMetricTest,
OVGetMetricPropsTest_GPU_MEMORY_STATISTICS_DEFAULT,
::testing::Values("GPU"));
using OVGetMetricPropsTest_GPU_MEMORY_STATISTICS_MULTIPLE_NETWORKS = OVClassBaseTestP;
TEST_P(OVGetMetricPropsTest_GPU_MEMORY_STATISTICS_MULTIPLE_NETWORKS, GetMetricAndPrintNoThrow) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
ov::Core ie;
std::map<std::string, uint64_t> t1;
std::map<std::string, uint64_t> t2;
auto exec_net1 = ie.compile_model(simpleNetwork, target_device);
ASSERT_NO_THROW(t1 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t1.empty());
for (auto&& kv : t1) {
ASSERT_NE(kv.second, 0);
}
auto exec_net2 = ie.compile_model(simpleNetwork, target_device);
ASSERT_NO_THROW(t2 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t2.empty());
for (auto&& kv : t2) {
ASSERT_NE(kv.second, 0);
auto iter = t1.find(kv.first);
if (iter != t1.end()) {
ASSERT_EQ(kv.second, t1[kv.first] * 2);
}
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::memory_statistics);
}
INSTANTIATE_TEST_SUITE_P(nightly_IEClassGetMetricTest,
OVGetMetricPropsTest_GPU_MEMORY_STATISTICS_MULTIPLE_NETWORKS,
::testing::Values("GPU"));
using OVGetMetricPropsTest_GPU_MEMORY_STATISTICS_CHECK_VALUES = OVClassBaseTestP;
TEST_P(OVGetMetricPropsTest_GPU_MEMORY_STATISTICS_CHECK_VALUES, GetMetricAndPrintNoThrow) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
ov::Core ie;
std::map<std::string, uint64_t> t1;
ASSERT_NO_THROW(t1 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_TRUE(t1.empty());
{
auto exec_net1 = ie.compile_model(simpleNetwork, target_device);
std::map<std::string, uint64_t> t2;
ASSERT_NO_THROW(t2 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t2.empty());
for (auto&& kv : t2) {
ASSERT_NE(kv.second, 0);
}
{
auto exec_net2 = ie.compile_model(actualNetwork, target_device);
std::map<std::string, uint64_t> t3;
ASSERT_NO_THROW(t3 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t3.empty());
for (auto&& kv : t3) {
ASSERT_NE(kv.second, 0);
}
}
std::map<std::string, uint64_t> t4;
ASSERT_NO_THROW(t4 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t4.empty());
for (auto&& kv : t4) {
ASSERT_NE(kv.second, 0);
if (kv.first.find("_cur") != std::string::npos) {
auto iter = t2.find(kv.first);
if (iter != t2.end()) {
ASSERT_EQ(t2[kv.first], kv.second);
}
}
}
}
std::map<std::string, uint64_t> t5;
ASSERT_NO_THROW(t5 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t5.empty());
for (auto&& kv : t5) {
if (kv.first.find("_cur") != std::string::npos) {
ASSERT_EQ(kv.second, 0);
}
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::memory_statistics);
}
INSTANTIATE_TEST_SUITE_P(nightly_IEClassGetMetricTest,
OVGetMetricPropsTest_GPU_MEMORY_STATISTICS_CHECK_VALUES,
::testing::Values("GPU"));
using OVGetMetricPropsTest_GPU_MEMORY_STATISTICS_MULTI_THREADS = OVClassBaseTestP;
TEST_P(OVGetMetricPropsTest_GPU_MEMORY_STATISTICS_MULTI_THREADS, GetMetricAndPrintNoThrow) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
ov::Core ie;
std::map<std::string, uint64_t> t1;
std::map<std::string, uint64_t> t2;
std::atomic<uint32_t> counter{0u};
std::vector<std::thread> threads(2);
// key: thread id, value: executable network
std::map<uint32_t, ov::CompiledModel> exec_net_map;
std::vector<std::shared_ptr<ngraph::Function>> networks;
networks.emplace_back(simpleNetwork);
networks.emplace_back(simpleNetwork);
auto exec_net1 = ie.compile_model(simpleNetwork, target_device);
ASSERT_NO_THROW(t1 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t1.empty());
for (auto&& kv : t1) {
ASSERT_NE(kv.second, 0);
}
for (auto& thread : threads) {
thread = std::thread([&]() {
auto value = counter++;
exec_net_map[value] = ie.compile_model(networks[value], target_device);
});
}
for (auto& thread : threads) {
if (thread.joinable()) {
thread.join();
}
}
ASSERT_NO_THROW(t2 = ie.get_property(target_device, ov::intel_gpu::memory_statistics));
ASSERT_FALSE(t2.empty());
for (auto&& kv : t2) {
ASSERT_NE(kv.second, 0);
auto iter = t1.find(kv.first);
if (iter != t1.end()) {
ASSERT_EQ(kv.second, t1[kv.first] * 3);
}
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::intel_gpu::memory_statistics);
}
INSTANTIATE_TEST_SUITE_P(nightly_IEClassGetMetricTest,
OVGetMetricPropsTest_GPU_MEMORY_STATISTICS_MULTI_THREADS,
::testing::Values("GPU"));
const std::vector<ov::AnyMap> gpuCorrectConfigs = {
{ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT), ov::hint::allow_auto_batching(false)},
{ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT), ov::hint::allow_auto_batching(true)}};
auto gpuCorrectConfigsWithSecondaryProperties = []() {
return std::vector<ov::AnyMap>{
{ov::device::properties(CommonTestUtils::DEVICE_GPU,
ov::hint::execution_mode(ov::hint::ExecutionMode::PERFORMANCE),
ov::hint::inference_precision(ov::element::f32))},
{ov::device::properties(CommonTestUtils::DEVICE_GPU,
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(false))},
{ov::device::properties(CommonTestUtils::DEVICE_GPU,
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(false)),
ov::device::properties(CommonTestUtils::DEVICE_CPU,
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY),
ov::hint::allow_auto_batching(false))}};
};
INSTANTIATE_TEST_SUITE_P(smoke_OVClassCompileModelWithCorrectPropertiesAutoBatchingTest,
OVClassCompileModelWithCorrectPropertiesTest,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(gpuCorrectConfigs)));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassCompileModelWithCorrectSecondaryPropertiesTest,
OVClassCompileModelWithCorrectPropertiesTest,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(gpuCorrectConfigsWithSecondaryProperties())),
::testing::PrintToStringParamName());
INSTANTIATE_TEST_SUITE_P(smoke_AUTO_OVClassCompileModelWithCorrectSecondaryPropertiesTest,
OVClassCompileModelWithCorrectPropertiesTest,
::testing::Combine(::testing::Values("AUTO:GPU", "MULTI:GPU", "HETERO:GPU"),
::testing::ValuesIn(gpuCorrectConfigsWithSecondaryProperties())));
auto autoCorrectConfigs = []() {
return std::vector<ov::AnyMap>{{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(false)},
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(true)}};
};
auto autoCorrectConfigsWithSecondaryProperties = []() {
return std::vector<ov::AnyMap>{
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::device::properties(CommonTestUtils::DEVICE_AUTO,
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(false))},
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::device::properties(CommonTestUtils::DEVICE_GPU,
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(false))},
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::device::properties(CommonTestUtils::DEVICE_GPU,
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(false)),
ov::device::properties(CommonTestUtils::DEVICE_CPU,
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY),
ov::hint::allow_auto_batching(false))},
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::device::properties("GPU.0",
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::allow_auto_batching(false)),
ov::device::properties(CommonTestUtils::DEVICE_CPU,
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY),
ov::hint::allow_auto_batching(false))}};
};
INSTANTIATE_TEST_SUITE_P(smoke_Auto_OVClassCompileModelWithCorrectPropertiesAutoBatchingTest,
OVClassCompileModelWithCorrectPropertiesTest,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_MULTI,
CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(autoCorrectConfigs())));
INSTANTIATE_TEST_SUITE_P(smoke_Auto_OVClassCompileModelWithCorrectSecondaryPropertiesTest,
OVClassCompileModelWithCorrectPropertiesTest,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_MULTI,
CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(autoCorrectConfigsWithSecondaryProperties())),
::testing::PrintToStringParamName());
const std::vector<ov::AnyMap> batchCorrectConfigs = {{}};
INSTANTIATE_TEST_SUITE_P(smoke_Auto_Batch_OVClassCompileModelWithCorrectPropertiesAutoBatchingTest,
OVClassCompileModelWithCorrectPropertiesTest,
::testing::Combine(::testing::Values("BATCH:GPU"), ::testing::ValuesIn(batchCorrectConfigs)));
using OVGetMetricPropsTest_CACHING_PROPERTIES = OVClassBaseTestP;
TEST_P(OVGetMetricPropsTest_CACHING_PROPERTIES, GetMetricAndPrintNoThrow) {
ov::Core ie = createCoreWithTemplate();
std::vector<ov::PropertyName> caching_properties = {};
const std::vector<ov::PropertyName> expected_properties = {
ov::device::architecture.name(),
ov::intel_gpu::execution_units_count.name(),
ov::intel_gpu::driver_version.name(),
ov::hint::inference_precision.name(),
ov::hint::execution_mode.name(),
};
ASSERT_NO_THROW(caching_properties = ie.get_property(target_device, ov::caching_properties));
std::cout << "GPU Caching properties: " << std::endl;
for (auto& prop : caching_properties) {
std::cout << prop << std::endl;
}
ASSERT_EQ(caching_properties.size(), expected_properties.size());
for (const auto& property_name : expected_properties) {
ASSERT_TRUE(std::find(caching_properties.begin(), caching_properties.end(), property_name) !=
caching_properties.end());
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::caching_properties);
}
INSTANTIATE_TEST_SUITE_P(nightly_OVGetMetricPropsTest,
OVGetMetricPropsTest_CACHING_PROPERTIES,
::testing::Values("GPU"));
// GetConfig / SetConfig for specific device
INSTANTIATE_TEST_SUITE_P(nightly_OVClassSpecificDevice0Test, OVSpecificDeviceGetConfigTest, ::testing::Values("GPU.0"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassSpecificDevice1Test, OVSpecificDeviceGetConfigTest, ::testing::Values("GPU.1"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassSpecificDevice0Test, OVSpecificDeviceTestSetConfig, ::testing::Values("GPU.0"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassSpecificDevice1Test, OVSpecificDeviceTestSetConfig, ::testing::Values("GPU.1"));
// Set default device ID
INSTANTIATE_TEST_SUITE_P(nightly_OVClassSetDefaultDeviceIDPropTest,
OVClassSetDefaultDeviceIDPropTest,
::testing::Values(std::make_pair("GPU", "1")));
//
// IE Class GetConfig
//
INSTANTIATE_TEST_SUITE_P(nightly_OVGetConfigTest, OVGetConfigTest, ::testing::Values("GPU"));
} // namespace

View File

@ -128,5 +128,7 @@ std::vector<std::string> disabledTestPatterns() {
// TODO: support getconfig in auto/multi CVS-104942
// TODO: move auto/multi cases to dedicated unit tests
R"(.*(Auto|Multi).*SetPropLoadNetWorkGetPropTests.*)",
// unsupported metrics
R"(.*nightly_MultiHeteroAutoBatchOVGetMetricPropsTest.*OVGetMetricPropsTest.*(AVAILABLE_DEVICES|DEVICE_UUID|OPTIMIZATION_CAPABILITIES|MAX_BATCH_SIZE|DEVICE_GOPS|DEVICE_GOPS|RANGE_FOR_ASYNC_INFER_REQUESTS|RANGE_FOR_STREAMS).*)",
};
}

View File

@ -213,6 +213,7 @@ public:
OVClassNetworkTest::SetUp();
}
};
using OVClassModelTestP = OVClassBaseTestP;
class OVCompiledModelClassBaseTestP : public OVClassNetworkTest,
public ::testing::WithParamInterface<std::string>,
@ -248,6 +249,22 @@ public:
using OVClassExecutableNetworkGetMetricTest_DEVICE_PRIORITY = OVClassExecutableNetworkGetMetricTest_Priority;
using OVClassExecutableNetworkGetMetricTest_MODEL_PRIORITY = OVClassExecutableNetworkGetMetricTest_Priority;
class OVClassSetDevicePriorityConfigPropsTest : public OVPluginTestBase,
public ::testing::WithParamInterface<std::tuple<std::string, AnyMap>> {
protected:
std::string deviceName;
ov::AnyMap configuration;
std::shared_ptr<ngraph::Function> actualNetwork;
public:
void SetUp() override {
std::tie(target_device, configuration) = GetParam();
SKIP_IF_CURRENT_TEST_IS_DISABLED();
APIBaseTest::SetUp();
actualNetwork = ngraph::builder::subgraph::makeSplitConvConcat();
}
};
#define SKIP_IF_NOT_IMPLEMENTED(...) \
{ \
try { \

View File

@ -354,6 +354,34 @@ TEST_P(OVExecutableNetworkBaseTest, CheckExecGraphInfoAfterExecution) {
}
}
TEST_P(OVExecutableNetworkBaseTest, LoadNetworkCreateDefaultExecGraphResult) {
auto net = core->compile_model(function, target_device, configuration);
auto runtime_function = net.get_runtime_model();
ASSERT_NE(nullptr, runtime_function);
auto actual_parameters = runtime_function->get_parameters();
auto actual_results = runtime_function->get_results();
auto expected_parameters = function->get_parameters();
auto expected_results = function->get_results();
ASSERT_EQ(expected_parameters.size(), actual_parameters.size());
for (std::size_t i = 0; i < expected_parameters.size(); ++i) {
auto expected_element_type = expected_parameters[i]->get_output_element_type(0);
auto actual_element_type = actual_parameters[i]->get_output_element_type(0);
ASSERT_EQ(expected_element_type, actual_element_type) << "For index: " << i;
auto expected_shape = expected_parameters[i]->get_output_shape(0);
auto actual_shape = actual_parameters[i]->get_output_shape(0);
ASSERT_EQ(expected_shape, actual_shape) << "For index: " << i;
}
ASSERT_EQ(expected_results.size(), actual_results.size());
for (std::size_t i = 0; i < expected_results.size(); ++i) {
auto expected_element_type = expected_results[i]->get_input_element_type(0);
auto actual_element_type = actual_results[i]->get_input_element_type(0);
ASSERT_EQ(expected_element_type, actual_element_type) << "For index: " << i;
auto expected_shape = expected_results[i]->get_input_shape(0);
auto actual_shape = actual_results[i]->get_input_shape(0);
ASSERT_EQ(expected_shape, actual_shape) << "For index: " << i;
}
}
TEST_P(OVExecutableNetworkBaseTest, canExport) {
auto ts = CommonTestUtils::GetTimestamp();
std::string modelName = GetTestName().substr(0, CommonTestUtils::maxFileNameLength) + "_" + ts;

View File

@ -43,6 +43,8 @@ public:
using OVCompiledModelPropertiesIncorrectTests = OVCompiledModelPropertiesTests;
using OVCompiledModelPropertiesDefaultTests = OVCompiledModelPropertiesTests;
using OVClassCompileModelTest = OVClassBaseTestP;
} // namespace behavior
} // namespace test
} // namespace ov

View File

@ -0,0 +1,104 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include "base/ov_behavior_test_utils.hpp"
namespace ov {
namespace test {
namespace behavior {
class OVClassSeveralDevicesTests : public OVPluginTestBase,
public OVClassNetworkTest,
public ::testing::WithParamInterface<std::vector<std::string>> {
public:
std::vector<std::string> target_devices;
void SetUp() override {
target_device = CommonTestUtils::DEVICE_MULTI;
SKIP_IF_CURRENT_TEST_IS_DISABLED()
APIBaseTest::SetUp();
OVClassNetworkTest::SetUp();
target_devices = GetParam();
}
};
using OVClassSeveralDevicesTestCompileModel = OVClassSeveralDevicesTests;
using OVClassSeveralDevicesTestQueryModel = OVClassSeveralDevicesTests;
using OVClassCompileModelWithCondidateDeviceListContainedMetaPluginTest = OVClassSetDevicePriorityConfigPropsTest;
TEST_P(OVClassCompileModelWithCondidateDeviceListContainedMetaPluginTest,
CompileModelRepeatedlyWithMetaPluginTestThrow) {
ov::Core ie = createCoreWithTemplate();
ASSERT_THROW(ie.compile_model(actualNetwork, target_device, configuration), ov::Exception);
}
TEST_P(OVClassSeveralDevicesTestCompileModel, CompileModelActualSeveralDevicesNoThrow) {
ov::Core ie = createCoreWithTemplate();
std::string clear_target_device;
auto pos = target_devices.begin()->find('.');
if (pos != std::string::npos) {
clear_target_device = target_devices.begin()->substr(0, pos);
}
auto deviceIDs = ie.get_property(clear_target_device, ov::available_devices);
if (deviceIDs.size() < target_devices.size())
GTEST_FAIL() << "Incorrect DeviceID" << std::endl;
std::string multitarget_device = CommonTestUtils::DEVICE_MULTI + std::string(":");
for (auto& dev_name : target_devices) {
multitarget_device += dev_name;
if (&dev_name != &(target_devices.back())) {
multitarget_device += ",";
}
}
OV_ASSERT_NO_THROW(ie.compile_model(actualNetwork, multitarget_device));
}
TEST_P(OVClassModelTestP, CompileModelMultiWithoutSettingDevicePrioritiesThrows) {
ov::Core ie = createCoreWithTemplate();
try {
ie.compile_model(actualNetwork, CommonTestUtils::DEVICE_MULTI);
} catch (ov::Exception& error) {
EXPECT_PRED_FORMAT2(testing::IsSubstring,
std::string("KEY_MULTI_DEVICE_PRIORITIES key is not set for"),
error.what());
} catch (...) {
FAIL() << "compile_model is failed for unexpected reason.";
}
}
TEST_P(OVClassModelTestP, CompileModelActualHeteroDeviceUsingDevicePropertiesNoThrow) {
ov::Core ie = createCoreWithTemplate();
OV_ASSERT_NO_THROW(ie.compile_model(actualNetwork,
CommonTestUtils::DEVICE_HETERO,
ov::device::priorities(target_device),
ov::device::properties(target_device, ov::enable_profiling(true))));
}
TEST_P(OVClassSeveralDevicesTestQueryModel, QueryNetworkActualSeveralDevicesNoThrow) {
ov::Core ie = createCoreWithTemplate();
std::string clear_target_device;
auto pos = target_devices.begin()->find('.');
if (pos != std::string::npos) {
clear_target_device = target_devices.begin()->substr(0, pos);
}
auto deviceIDs = ie.get_property(clear_target_device, ov::available_devices);
ASSERT_LT(deviceIDs.size(), target_devices.size());
std::string multi_target_device = CommonTestUtils::DEVICE_MULTI + std::string(":");
for (auto& dev_name : target_devices) {
multi_target_device += dev_name;
if (&dev_name != &(target_devices.back())) {
multi_target_device += ",";
}
}
OV_ASSERT_NO_THROW(ie.query_model(actualNetwork, multi_target_device));
}
} // namespace behavior
} // namespace test
} // namespace ov

View File

@ -5,17 +5,23 @@
#pragma once
#include "base/ov_behavior_test_utils.hpp"
#include "common_test_utils/file_utils.hpp"
#include "common_test_utils/test_assertions.hpp"
#include "common_test_utils/unicode_utils.hpp"
#include "openvino/runtime/properties.hpp"
#include "openvino/util/common_util.hpp"
#include "common_test_utils/test_assertions.hpp"
#include "common_test_utils/file_utils.hpp"
#include "common_test_utils/unicode_utils.hpp"
namespace ov {
namespace test {
namespace behavior {
#define OV_ASSERT_PROPERTY_SUPPORTED(property_key) \
{ \
auto properties = ie.get_property(target_device, ov::supported_properties); \
auto it = std::find(properties.begin(), properties.end(), property_key); \
ASSERT_NE(properties.end(), it); \
}
class OVPropertiesBase : public OVPluginTestBase {
public:
std::shared_ptr<Core> core = utils::PluginCache::get().core();
@ -23,8 +29,7 @@ public:
AnyMap properties;
};
class OVEmptyPropertiesTests : public testing::WithParamInterface<std::string>,
public OVPropertiesBase {
class OVEmptyPropertiesTests : public testing::WithParamInterface<std::string>, public OVPropertiesBase {
public:
static std::string getTestCaseName(testing::TestParamInfo<std::string> obj);
@ -33,8 +38,7 @@ public:
using PropertiesParams = std::tuple<std::string, AnyMap>;
class OVPropertiesTests : public testing::WithParamInterface<PropertiesParams>,
public OVPropertiesBase {
class OVPropertiesTests : public testing::WithParamInterface<PropertiesParams>, public OVPropertiesBase {
public:
static std::string getTestCaseName(testing::TestParamInfo<PropertiesParams> obj);
@ -80,12 +84,12 @@ using OVCheckChangePropComplieModleGetPropTests = OVPropertiesTestsWithComplieMo
using OVCheckChangePropComplieModleGetPropTests_DEVICE_ID = OVPropertiesTestsWithComplieModelProps;
using OVCheckChangePropComplieModleGetPropTests_ModelDependceProps = OVPropertiesTestsWithComplieModelProps;
using OvPropertiesParams = std::tuple<
std::string, // device name
std::pair<ov::AnyMap, std::string> // device and expect execution device configuration
>;
using OvPropertiesParams =
std::tuple<std::string, // device name
std::pair<ov::AnyMap, std::string> // device and expect execution device configuration
>;
class OVCompileModelGetExecutionDeviceTests : public testing::WithParamInterface<OvPropertiesParams>,
public OVPropertiesBase {
public OVPropertiesBase {
public:
static std::string getTestCaseName(testing::TestParamInfo<OvPropertiesParams> obj);
@ -97,6 +101,59 @@ public:
};
using OVClassExecutableNetworkGetMetricTest_EXEC_DEVICES = OVCompileModelGetExecutionDeviceTests;
class OVClassSetDefaultDeviceIDPropTest : public OVPluginTestBase,
public ::testing::WithParamInterface<std::pair<std::string, std::string>> {
protected:
std::string deviceName;
std::string deviceID;
public:
void SetUp() override {
std::tie(target_device, deviceID) = GetParam();
APIBaseTest::SetUp();
SKIP_IF_CURRENT_TEST_IS_DISABLED();
}
};
using OVClassCompileModelWithCorrectPropertiesTest = OVClassSetDevicePriorityConfigPropsTest;
using OVClassCompileModelWithCondidateDeviceListContainedMetaPluginTest = OVClassSetDevicePriorityConfigPropsTest;
using OVClassCompileModelReturnDefaultHintTest = OVClassSetDevicePriorityConfigPropsTest;
using OVClassCompileModelDoNotReturnDefaultHintTest = OVClassSetDevicePriorityConfigPropsTest;
using OVClassCompileModelAndCheckSecondaryPropertiesTest = OVClassSetDevicePriorityConfigPropsTest;
using OVGetConfigTest = OVClassBaseTestP;
using OVSpecificDeviceGetConfigTest = OVClassBaseTestP;
using OVGetConfigTest_ThrowUnsupported = OVClassBaseTestP;
using OVGetAvailableDevicesPropsTest = OVClassBaseTestP;
using OVGetMetricPropsTest = OVClassBaseTestP;
using OVSetEnableCpuPinningHintConfigTest = OVClassBaseTestP;
using OVSetSchedulingCoreTypeHintConfigTest = OVClassBaseTestP;
using OVSetEnableHyperThreadingHintConfigTest = OVClassBaseTestP;
using OVSetModelPriorityConfigTest = OVClassBaseTestP;
using OVSetExecutionModeHintConfigTest = OVClassBaseTestP;
using OVSetLogLevelConfigTest = OVClassBaseTestP;
using OVSpecificDeviceTestSetConfig = OVClassBaseTestP;
class OVClassBasicPropsTestP : public OVPluginTestBase,
public ::testing::WithParamInterface<std::pair<std::string, std::string>> {
protected:
std::string deviceName;
std::string pluginName;
public:
void SetUp() override {
std::tie(pluginName, target_device) = GetParam();
SKIP_IF_CURRENT_TEST_IS_DISABLED();
APIBaseTest::SetUp();
pluginName += IE_BUILD_POSTFIX;
if (pluginName == (std::string("openvino_template_plugin") + IE_BUILD_POSTFIX)) {
pluginName = ov::util::make_plugin_library_name(CommonTestUtils::getExecutableDirectory(), pluginName);
}
}
};
} // namespace behavior
} // namespace test
} // namespace ov

View File

@ -0,0 +1,104 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include "base/ov_behavior_test_utils.hpp"
namespace ov {
namespace test {
namespace behavior {
using OVClassQueryModelTest = OVClassBaseTestP;
TEST_P(OVClassModelTestP, QueryModelActualNoThrow) {
ov::Core ie = createCoreWithTemplate();
ie.query_model(actualNetwork, target_device);
}
TEST_P(OVClassModelTestP, QueryModelWithKSO) {
ov::Core ie = createCoreWithTemplate();
auto rl_map = ie.query_model(ksoNetwork, target_device);
auto func = ksoNetwork;
for (const auto& op : func->get_ops()) {
if (!rl_map.count(op->get_friendly_name())) {
FAIL() << "Op " << op->get_friendly_name() << " is not supported by " << target_device;
}
}
}
TEST_P(OVClassModelTestP, SetAffinityWithConstantBranches) {
ov::Core ie = createCoreWithTemplate();
std::shared_ptr<ngraph::Function> func;
{
ngraph::PartialShape shape({1, 84});
ngraph::element::Type type(ngraph::element::Type_t::f32);
auto param = std::make_shared<ngraph::opset6::Parameter>(type, shape);
auto matMulWeights = ngraph::opset6::Constant::create(ngraph::element::Type_t::f32, {10, 84}, {1});
auto shapeOf = std::make_shared<ngraph::opset6::ShapeOf>(matMulWeights);
auto gConst1 = ngraph::opset6::Constant::create(ngraph::element::Type_t::i32, {1}, {1});
auto gConst2 = ngraph::opset6::Constant::create(ngraph::element::Type_t::i64, {}, {0});
auto gather = std::make_shared<ngraph::opset6::Gather>(shapeOf, gConst1, gConst2);
auto concatConst = ngraph::opset6::Constant::create(ngraph::element::Type_t::i64, {1}, {1});
auto concat = std::make_shared<ngraph::opset6::Concat>(ngraph::NodeVector{concatConst, gather}, 0);
auto relu = std::make_shared<ngraph::opset6::Relu>(param);
auto reshape = std::make_shared<ngraph::opset6::Reshape>(relu, concat, false);
auto matMul = std::make_shared<ngraph::opset6::MatMul>(reshape, matMulWeights, false, true);
auto matMulBias = ngraph::opset6::Constant::create(ngraph::element::Type_t::f32, {1, 10}, {1});
auto addBias = std::make_shared<ngraph::opset6::Add>(matMul, matMulBias);
auto result = std::make_shared<ngraph::opset6::Result>(addBias);
ngraph::ParameterVector params = {param};
ngraph::ResultVector results = {result};
func = std::make_shared<ngraph::Function>(results, params);
}
auto rl_map = ie.query_model(func, target_device);
for (const auto& op : func->get_ops()) {
if (!rl_map.count(op->get_friendly_name())) {
FAIL() << "Op " << op->get_friendly_name() << " is not supported by " << target_device;
}
}
}
TEST_P(OVClassQueryModelTest, QueryModelHETEROWithDeviceIDNoThrow) {
ov::Core ie = createCoreWithTemplate();
auto deviceIDs = ie.get_property(target_device, ov::available_devices);
if (deviceIDs.empty())
GTEST_FAIL();
OV_ASSERT_NO_THROW(ie.query_model(actualNetwork,
CommonTestUtils::DEVICE_HETERO,
ov::device::priorities(target_device + "." + deviceIDs[0], target_device)));
}
TEST_P(OVClassQueryModelTest, QueryModelWithDeviceID) {
ov::Core ie = createCoreWithTemplate();
ie.query_model(simpleNetwork, target_device + ".0");
}
TEST_P(OVClassQueryModelTest, QueryModelWithBigDeviceIDThrows) {
ov::Core ie = createCoreWithTemplate();
ASSERT_THROW(ie.query_model(actualNetwork, target_device + ".110"), ov::Exception);
}
TEST_P(OVClassQueryModelTest, QueryModelWithInvalidDeviceIDThrows) {
ov::Core ie = createCoreWithTemplate();
ASSERT_THROW(ie.query_model(actualNetwork, target_device + ".l0"), ov::Exception);
}
TEST_P(OVClassQueryModelTest, QueryModelHETEROWithBigDeviceIDThrows) {
ov::Core ie = createCoreWithTemplate();
ASSERT_THROW(ie.query_model(actualNetwork,
CommonTestUtils::DEVICE_HETERO,
ov::device::priorities(target_device + ".100", target_device)),
ov::Exception);
}
} // namespace behavior
} // namespace test
} // namespace ov

View File

@ -80,6 +80,11 @@ TEST_P(OVCompiledModelPropertiesIncorrectTests, CanNotCompileModelWithIncorrectP
ASSERT_THROW(core->compile_model(model, target_device, properties), ov::Exception);
}
TEST_P(OVClassCompileModelTest, LoadNetworkWithBigDeviceIDThrows) {
ov::Core ie = createCoreWithTemplate();
ASSERT_THROW(ie.compile_model(actualNetwork, target_device + ".10"), ov::Exception);
}
TEST_P(OVCompiledModelPropertiesDefaultTests, CanCompileWithDefaultValueFromPlugin) {
std::vector<ov::PropertyName> supported_properties;
OV_ASSERT_NO_THROW(supported_properties = core->get_property(target_device, ov::supported_properties));

View File

@ -431,6 +431,474 @@ TEST_P(OVCheckChangePropComplieModleGetPropTests_ModelDependceProps, ChangeCorre
OV_ASSERT_NO_THROW(default_property = core->get_property(target_device, property_item.first));
}
}
TEST_P(OVClassSetDefaultDeviceIDPropTest, SetDefaultDeviceIDNoThrow) {
ov::Core ie = createCoreWithTemplate();
auto deviceIDs = ie.get_property(target_device, ov::available_devices);
if (std::find(deviceIDs.begin(), deviceIDs.end(), deviceID) == deviceIDs.end()) {
GTEST_FAIL();
}
std::string value;
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::device::id(deviceID), ov::enable_profiling(true)));
ASSERT_TRUE(ie.get_property(target_device, ov::enable_profiling));
OV_ASSERT_NO_THROW(value = ie.get_property(target_device, ov::enable_profiling.name()).as<std::string>());
ASSERT_EQ(value, "YES");
}
TEST_P(OVClassBasicPropsTestP, SetConfigAllThrows) {
ov::Core ie = createCoreWithTemplate();
OV_ASSERT_NO_THROW(ie.set_property({{"unsupported_key", "4"}}));
ASSERT_ANY_THROW(ie.get_versions(target_device));
}
TEST_P(OVClassBasicPropsTestP, SetConfigForUnRegisteredDeviceThrows) {
ov::Core ie = createCoreWithTemplate();
ASSERT_THROW(ie.set_property("unregistered_device", {{"unsupported_key", "4"}}), ov::Exception);
}
TEST_P(OVClassBasicPropsTestP, SetConfigNoThrow) {
ov::Core ie = createCoreWithTemplate();
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::enable_profiling(true)));
}
TEST_P(OVClassBasicPropsTestP, SetConfigAllNoThrow) {
ov::Core ie = createCoreWithTemplate();
OV_ASSERT_NO_THROW(ie.set_property(ov::enable_profiling(true)));
OV_ASSERT_NO_THROW(ie.get_versions(target_device));
}
TEST_P(OVClassBasicPropsTestP, SetConfigHeteroTargetFallbackThrows) {
ov::Core ie = createCoreWithTemplate();
OV_ASSERT_NO_THROW(ie.set_property(CommonTestUtils::DEVICE_HETERO, ov::device::priorities(target_device)));
}
TEST_P(OVClassBasicPropsTestP, smoke_SetConfigHeteroNoThrow) {
ov::Core ie = createCoreWithTemplate();
std::string value;
OV_ASSERT_NO_THROW(ie.set_property(CommonTestUtils::DEVICE_HETERO, ov::device::priorities(target_device)));
OV_ASSERT_NO_THROW(value = ie.get_property(CommonTestUtils::DEVICE_HETERO, ov::device::priorities));
ASSERT_EQ(target_device, value);
OV_ASSERT_NO_THROW(ie.set_property(CommonTestUtils::DEVICE_HETERO, ov::device::priorities(target_device)));
OV_ASSERT_NO_THROW(value = ie.get_property(CommonTestUtils::DEVICE_HETERO, ov::device::priorities));
ASSERT_EQ(target_device, value);
}
TEST_P(OVSetModelPriorityConfigTest, SetConfigNoThrow) {
ov::Core ie = createCoreWithTemplate();
// priority config test
ov::hint::Priority value;
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::hint::model_priority(ov::hint::Priority::LOW)));
OV_ASSERT_NO_THROW(value = ie.get_property(target_device, ov::hint::model_priority));
EXPECT_EQ(value, ov::hint::Priority::LOW);
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::hint::model_priority(ov::hint::Priority::MEDIUM)));
OV_ASSERT_NO_THROW(value = ie.get_property(target_device, ov::hint::model_priority));
EXPECT_EQ(value, ov::hint::Priority::MEDIUM);
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::hint::model_priority(ov::hint::Priority::HIGH)));
OV_ASSERT_NO_THROW(value = ie.get_property(target_device, ov::hint::model_priority));
EXPECT_EQ(value, ov::hint::Priority::HIGH);
}
TEST_P(OVSpecificDeviceGetConfigTest, GetConfigSpecificDeviceNoThrow) {
ov::Core ie = createCoreWithTemplate();
ov::Any p;
std::string deviceID, clear_target_device;
auto pos = target_device.find('.');
if (pos != std::string::npos) {
clear_target_device = target_device.substr(0, pos);
deviceID = target_device.substr(pos + 1, target_device.size());
}
auto deviceIDs = ie.get_property(clear_target_device, ov::available_devices);
if (std::find(deviceIDs.begin(), deviceIDs.end(), deviceID) == deviceIDs.end()) {
GTEST_FAIL() << "No DeviceID" << std::endl;
}
std::vector<ov::PropertyName> configValues;
OV_ASSERT_NO_THROW(configValues = ie.get_property(target_device, ov::supported_properties));
for (auto &&confKey : configValues) {
ov::Any defaultValue;
OV_ASSERT_NO_THROW(defaultValue = ie.get_property(target_device, confKey));
ASSERT_FALSE(defaultValue.empty());
}
}
TEST_P(OVGetAvailableDevicesPropsTest, GetAvailableDevicesNoThrow) {
ov::Core ie = createCoreWithTemplate();
std::vector<std::string> devices;
OV_ASSERT_NO_THROW(devices = ie.get_available_devices());
bool deviceFound = false;
std::cout << "Available devices: " << std::endl;
for (auto&& device : devices) {
if (device.find(target_device) != std::string::npos) {
deviceFound = true;
}
std::cout << device << " ";
}
std::cout << std::endl;
ASSERT_TRUE(deviceFound);
}
TEST_P(OVSpecificDeviceTestSetConfig, SetConfigSpecificDeviceNoThrow) {
ov::Core ie = createCoreWithTemplate();
std::string deviceID, cleartarget_device;
auto pos = target_device.find('.');
if (pos != std::string::npos) {
cleartarget_device = target_device.substr(0, pos);
deviceID = target_device.substr(pos + 1, target_device.size());
}
auto deviceIDs = ie.get_property(cleartarget_device, ov::available_devices);
if (std::find(deviceIDs.begin(), deviceIDs.end(), deviceID) == deviceIDs.end()) {
GTEST_FAIL();
}
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::enable_profiling(true)));
bool value = false;
OV_ASSERT_NO_THROW(value = ie.get_property(target_device, ov::enable_profiling));
ASSERT_TRUE(value);
}
TEST_P(OVSetExecutionModeHintConfigTest, SetConfigNoThrow) {
ov::Core ie = createCoreWithTemplate();
OV_ASSERT_PROPERTY_SUPPORTED(ov::hint::execution_mode);
ov::hint::ExecutionMode defaultMode{};
ASSERT_NO_THROW(defaultMode = ie.get_property(target_device, ov::hint::execution_mode));
(void)defaultMode;
ie.set_property(target_device, ov::hint::execution_mode(ov::hint::ExecutionMode::ACCURACY));
ASSERT_EQ(ov::hint::ExecutionMode::ACCURACY, ie.get_property(target_device, ov::hint::execution_mode));
ie.set_property(target_device, ov::hint::execution_mode(ov::hint::ExecutionMode::PERFORMANCE));
ASSERT_EQ(ov::hint::ExecutionMode::PERFORMANCE, ie.get_property(target_device, ov::hint::execution_mode));
}
TEST_P(OVClassSetDevicePriorityConfigPropsTest, SetConfigAndCheckGetConfigNoThrow) {
ov::Core ie = createCoreWithTemplate();
std::string devicePriority;
OV_ASSERT_NO_THROW(ie.set_property(target_device, configuration));
OV_ASSERT_NO_THROW(devicePriority = ie.get_property(target_device, ov::device::priorities));
ASSERT_EQ(devicePriority, configuration[ov::device::priorities.name()].as<std::string>());
}
TEST_P(OVSetLogLevelConfigTest, SetConfigNoThrow) {
ov::Core ie = createCoreWithTemplate();
// log level
ov::log::Level logValue;
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::log::level(ov::log::Level::NO)));
OV_ASSERT_NO_THROW(logValue = ie.get_property(target_device, ov::log::level));
EXPECT_EQ(logValue, ov::log::Level::NO);
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::log::level(ov::log::Level::ERR)));
OV_ASSERT_NO_THROW(logValue = ie.get_property(target_device, ov::log::level));
EXPECT_EQ(logValue, ov::log::Level::ERR);
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::log::level(ov::log::Level::WARNING)));
OV_ASSERT_NO_THROW(logValue = ie.get_property(target_device, ov::log::level));
EXPECT_EQ(logValue, ov::log::Level::WARNING);
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::log::level(ov::log::Level::INFO)));
OV_ASSERT_NO_THROW(logValue = ie.get_property(target_device, ov::log::level));
EXPECT_EQ(logValue, ov::log::Level::INFO);
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::log::level(ov::log::Level::DEBUG)));
OV_ASSERT_NO_THROW(logValue = ie.get_property(target_device, ov::log::level));
EXPECT_EQ(logValue, ov::log::Level::DEBUG);
OV_ASSERT_NO_THROW(ie.set_property(target_device, ov::log::level(ov::log::Level::TRACE)));
OV_ASSERT_NO_THROW(logValue = ie.get_property(target_device, ov::log::level));
EXPECT_EQ(logValue, ov::log::Level::TRACE);
}
TEST_P(OVGetMetricPropsTest, GetMetricAndPrintNoThrow_SUPPORTED_METRICS) {
ov::Core ie = createCoreWithTemplate();
std::vector<ov::PropertyName> t;
OV_ASSERT_NO_THROW(t = ie.get_property(target_device, ov::supported_properties));
std::cout << "Supported properties: " << std::endl;
for (auto&& str : t) {
std::cout << str << " is_mutable: " << str.is_mutable() << std::endl;
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::supported_properties);
}
TEST_P(OVGetMetricPropsTest, GetMetricAndPrintNoThrow_AVAILABLE_DEVICES) {
ov::Core ie = createCoreWithTemplate();
std::vector<std::string> t;
OV_ASSERT_NO_THROW(t = ie.get_property(target_device, ov::available_devices));
std::cout << "Available devices: " << std::endl;
for (auto&& str : t) {
std::cout << str << std::endl;
}
// TODO: get full_device_name
OV_ASSERT_PROPERTY_SUPPORTED(ov::available_devices);
}
TEST_P(OVGetMetricPropsTest, GetMetricAndPrintNoThrow_FULL_DEVICE_NAME) {
ov::Core ie = createCoreWithTemplate();
std::string t;
OV_ASSERT_NO_THROW(t = ie.get_property(target_device, ov::device::full_name));
std::cout << "Full device name: " << std::endl << t << std::endl;
// TODO: check not empty
OV_ASSERT_PROPERTY_SUPPORTED(ov::device::full_name);
}
TEST_P(OVGetMetricPropsTest, GetMetricAndPrintNoThrow_FULL_DEVICE_NAME_with_DEVICE_ID) {
ov::Core ie = createCoreWithTemplate();
std::string t;
auto device_ids = ie.get_property(target_device, ov::available_devices);
ASSERT_GT(device_ids.size(), 0);
OV_ASSERT_NO_THROW(t = ie.get_property(target_device, ov::device::full_name, ov::device::id(device_ids.front())));
std::cout << "Device " << device_ids.front() << " " << ", Full device name: " << std::endl << t << std::endl;
// TODO: check that not empty
OV_ASSERT_PROPERTY_SUPPORTED(ov::device::full_name);
}
TEST_P(OVGetMetricPropsTest, GetMetricAndPrintNoThrow_DEVICE_UUID) {
ov::Core ie = createCoreWithTemplate();
ov::device::UUID t;
OV_ASSERT_NO_THROW(t = ie.get_property(target_device, ov::device::uuid));
std::cout << "Device uuid: " << std::endl << t << std::endl;
OV_ASSERT_PROPERTY_SUPPORTED(ov::device::uuid);
}
TEST_P(OVGetMetricPropsTest, GetMetricAndPrintNoThrow_OPTIMIZATION_CAPABILITIES) {
ov::Core ie = createCoreWithTemplate();
std::vector<std::string> t;
OV_ASSERT_NO_THROW(t = ie.get_property(target_device, ov::device::capabilities));
std::cout << "Optimization capabilities: " << std::endl;
for (auto&& str : t) {
std::cout << str << std::endl;
}
// TODO: check that value from list of sutable values
OV_ASSERT_PROPERTY_SUPPORTED(ov::device::capabilities);
}
TEST_P(OVGetMetricPropsTest, GetMetricAndPrintNoThrow_MAX_BATCH_SIZE) {
ov::Core ie;
uint32_t max_batch_size = 0;
ASSERT_NO_THROW(max_batch_size = ie.get_property(target_device, ov::max_batch_size));
std::cout << "Max batch size: " << max_batch_size << std::endl;
// TODO: add compile model and ov::hint::model
OV_ASSERT_PROPERTY_SUPPORTED(ov::max_batch_size);
}
TEST_P(OVGetMetricPropsTest, GetMetricAndPrintNoThrow_DEVICE_GOPS) {
ov::Core ie = createCoreWithTemplate();
std::cout << "Device GOPS: " << std::endl;
for (auto&& kv : ie.get_property(target_device, ov::device::gops)) {
std::cout << kv.first << ": " << kv.second << std::endl;
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::device::gops);
}
TEST_P(OVGetMetricPropsTest, GetMetricAndPrintNoThrow_DEVICE_TYPE) {
ov::Core ie = createCoreWithTemplate();
OV_ASSERT_PROPERTY_SUPPORTED(ov::device::type);
ov::device::Type t = {};
OV_ASSERT_NO_THROW(t = ie.get_property(target_device, ov::device::type));
std::cout << "Device Type: " << t << std::endl;
}
TEST_P(OVGetMetricPropsTest, GetMetricAndPrintNoThrow_RANGE_FOR_ASYNC_INFER_REQUESTS) {
ov::Core ie = createCoreWithTemplate();
unsigned int start{0}, end{0}, step{0};
ASSERT_NO_THROW(std::tie(start, end, step) = ie.get_property(target_device, ov::range_for_async_infer_requests));
std::cout << "Range for async infer requests: " << std::endl
<< start << std::endl
<< end << std::endl
<< step << std::endl
<< std::endl;
ASSERT_LE(start, end);
ASSERT_GE(step, 1u);
OV_ASSERT_PROPERTY_SUPPORTED(ov::range_for_async_infer_requests);
}
TEST_P(OVGetMetricPropsTest, GetMetricAndPrintNoThrow_RANGE_FOR_STREAMS) {
ov::Core ie = createCoreWithTemplate();
unsigned int start = 0, end = 0;
ASSERT_NO_THROW(std::tie(start, end) = ie.get_property(target_device, ov::range_for_streams));
std::cout << "Range for streams: " << std::endl
<< start << std::endl
<< end << std::endl
<< std::endl;
ASSERT_LE(start, end);
OV_ASSERT_PROPERTY_SUPPORTED(ov::range_for_streams);
}
TEST_P(OVGetMetricPropsTest, GetMetricThrowUnsupported) {
ov::Core ie = createCoreWithTemplate();
ASSERT_THROW(ie.get_property(target_device, "unsupported_metric"), ov::Exception);
}
TEST_P(OVGetConfigTest, GetConfigNoThrow) {
ov::Core ie = createCoreWithTemplate();
std::vector<ov::PropertyName> configValues;
OV_ASSERT_NO_THROW(configValues = ie.get_property(target_device, ov::supported_properties));
for (auto&& confKey : configValues) {
ov::Any defaultValue;
OV_ASSERT_NO_THROW(defaultValue = ie.get_property(target_device, confKey));
ASSERT_FALSE(defaultValue.empty());
}
}
TEST_P(OVSetEnableHyperThreadingHintConfigTest, SetConfigNoThrow) {
ov::Core ie = createCoreWithTemplate();
OV_ASSERT_PROPERTY_SUPPORTED(ov::hint::enable_hyper_threading);
bool defaultMode{};
ASSERT_NO_THROW(defaultMode = ie.get_property(target_device, ov::hint::enable_hyper_threading));
(void)defaultMode;
ASSERT_EQ(true, ie.get_property(target_device, ov::hint::enable_hyper_threading));
ie.set_property(target_device, ov::hint::enable_hyper_threading(false));
ASSERT_EQ(false, ie.get_property(target_device, ov::hint::enable_hyper_threading));
ie.set_property(target_device, ov::hint::enable_hyper_threading(true));
ASSERT_EQ(true, ie.get_property(target_device, ov::hint::enable_hyper_threading));
}
TEST_P(OVSetEnableCpuPinningHintConfigTest, SetConfigNoThrow) {
ov::Core ie = createCoreWithTemplate();
OV_ASSERT_PROPERTY_SUPPORTED(ov::hint::enable_cpu_pinning);
bool defaultMode{};
ASSERT_NO_THROW(defaultMode = ie.get_property(target_device, ov::hint::enable_cpu_pinning));
(void)defaultMode;
ASSERT_EQ(true, ie.get_property(target_device, ov::hint::enable_cpu_pinning));
ie.set_property(target_device, ov::hint::enable_cpu_pinning(false));
ASSERT_EQ(false, ie.get_property(target_device, ov::hint::enable_cpu_pinning));
ie.set_property(target_device, ov::hint::enable_cpu_pinning(true));
ASSERT_EQ(true, ie.get_property(target_device, ov::hint::enable_cpu_pinning));
}
TEST_P(OVSetSchedulingCoreTypeHintConfigTest, SetConfigNoThrow) {
ov::Core ie = createCoreWithTemplate();
OV_ASSERT_PROPERTY_SUPPORTED(ov::hint::scheduling_core_type);
ov::hint::SchedulingCoreType defaultMode{};
ASSERT_NO_THROW(defaultMode = ie.get_property(target_device, ov::hint::scheduling_core_type));
(void)defaultMode;
ASSERT_EQ(ov::hint::SchedulingCoreType::ANY_CORE, ie.get_property(target_device, ov::hint::scheduling_core_type));
ie.set_property(target_device, ov::hint::scheduling_core_type(ov::hint::SchedulingCoreType::PCORE_ONLY));
ASSERT_EQ(ov::hint::SchedulingCoreType::PCORE_ONLY, ie.get_property(target_device, ov::hint::scheduling_core_type));
ie.set_property(target_device, ov::hint::scheduling_core_type(ov::hint::SchedulingCoreType::ECORE_ONLY));
ASSERT_EQ(ov::hint::SchedulingCoreType::ECORE_ONLY, ie.get_property(target_device, ov::hint::scheduling_core_type));
ie.set_property(target_device, ov::hint::scheduling_core_type(ov::hint::SchedulingCoreType::ANY_CORE));
ASSERT_EQ(ov::hint::SchedulingCoreType::ANY_CORE, ie.get_property(target_device, ov::hint::scheduling_core_type));
}
TEST_P(OVGetConfigTest_ThrowUnsupported, GetConfigThrow) {
ov::Core ie = createCoreWithTemplate();
ASSERT_THROW(ie.get_property(target_device, "unsupported_config"), ov::Exception);
}
TEST_P(OVClassBasicPropsTestP, getVersionsByDeviceClassNoThrow) {
ov::Core ie = createCoreWithTemplate();
OV_ASSERT_NO_THROW(ie.get_versions(target_device));
}
TEST_P(OVClassBasicPropsTestP, getVersionsByExactDeviceNoThrow) {
ov::Core ie = createCoreWithTemplate();
// get real id from avalible devices
OV_ASSERT_NO_THROW(ie.get_versions(target_device + ".0"));
}
TEST_P(OVClassCompileModelWithCorrectPropertiesTest, CompileModelWithCorrectPropertiesTest) {
ov::Core ie = createCoreWithTemplate();
OV_ASSERT_NO_THROW(ie.compile_model(actualNetwork, target_device, configuration));
}
TEST_P(OVClassCompileModelAndCheckSecondaryPropertiesTest, CompileModelAndCheckSecondaryPropertiesTest) {
ov::Core ie = createCoreWithTemplate();
ov::CompiledModel model;
OV_ASSERT_NO_THROW(model = ie.compile_model(actualNetwork, target_device, configuration));
ov::AnyMap property = configuration;
ov::AnyMap::iterator it = configuration.end();
// device properties in form ov::device::properties(DEVICE, ...) has the first priority
for (it = configuration.begin(); it != configuration.end(); it++) {
if ((it->first.find(ov::device::properties.name()) != std::string::npos) &&
(it->first != ov::device::properties.name())) {
break;
}
}
if (it != configuration.end()) {
// DEVICE_PROPERTIES_<DEVICE_NAME> found
property = it->second.as<ov::AnyMap>();
} else {
// search for DEVICE_PROPERTIES
it = configuration.find(ov::device::properties.name());
ASSERT_TRUE(it != configuration.end());
property = it->second.as<ov::AnyMap>().begin()->second.as<ov::AnyMap>();
if (it == configuration.end()) {
it = configuration.find(ov::num_streams.name());
}
}
ASSERT_TRUE(property.count(ov::num_streams.name()));
auto actual = property.at(ov::num_streams.name()).as<int32_t>();
ov::Any value;
//AutoExcutableNetwork GetMetric() does not support key ov::num_streams
OV_ASSERT_NO_THROW(value = model.get_property(ov::num_streams.name()));
int32_t expect = value.as<int32_t>();
ASSERT_EQ(actual, expect);
}
TEST_P(OVClassCompileModelReturnDefaultHintTest, CompileModelReturnDefaultHintTest) {
ov::Core ie = createCoreWithTemplate();
ov::CompiledModel model;
ov::hint::PerformanceMode value;
OV_ASSERT_NO_THROW(model = ie.compile_model(actualNetwork, target_device, configuration));
OV_ASSERT_NO_THROW(value = model.get_property(ov::hint::performance_mode));
if (target_device.find("AUTO") != std::string::npos) {
ASSERT_EQ(value, ov::hint::PerformanceMode::LATENCY);
} else {
ASSERT_EQ(value, ov::hint::PerformanceMode::THROUGHPUT);
}
}
TEST_P(OVClassCompileModelDoNotReturnDefaultHintTest, CompileModelDoNotReturnDefaultHintTest) {
ov::Core ie = createCoreWithTemplate();
ov::CompiledModel model;
ov::hint::PerformanceMode value;
OV_ASSERT_NO_THROW(model = ie.compile_model(actualNetwork, target_device, configuration));
OV_ASSERT_NO_THROW(value = model.get_property(ov::hint::performance_mode));
if (target_device.find("AUTO") != std::string::npos) {
ASSERT_NE(value, ov::hint::PerformanceMode::LATENCY);
} else {
ASSERT_EQ(value, ov::hint::PerformanceMode::THROUGHPUT);
}
}
} // namespace behavior
} // namespace test
} // namespace ov