diff --git a/docs/template_plugin/src/template_config.cpp b/docs/template_plugin/src/template_config.cpp index e7ad8a473d0..32b637f8cb7 100644 --- a/docs/template_plugin/src/template_config.cpp +++ b/docs/template_plugin/src/template_config.cpp @@ -33,6 +33,9 @@ Configuration::Configuration(const ConfigMap& config, const Configuration& defau } } else if (CONFIG_KEY(PERF_COUNT) == key) { perfCount = (CONFIG_VALUE(YES) == value); + } else if (ov::hint::performance_mode == key) { + std::stringstream strm{value}; + strm >> performance_mode; } else if (throwOnUnsupported) { IE_THROW(NotFound) << ": " << key; } @@ -56,6 +59,8 @@ InferenceEngine::Parameter Configuration::Get(const std::string& name) const { return {std::to_string(_streamsExecutorConfig._threads)}; } else if (name == CONFIG_KEY_INTERNAL(CPU_THREADS_PER_STREAM)) { return {std::to_string(_streamsExecutorConfig._threadsPerStream)}; + } else if (name == ov::hint::performance_mode) { + return performance_mode; } else { IE_THROW(NotFound) << ": " << name; } diff --git a/docs/template_plugin/src/template_config.hpp b/docs/template_plugin/src/template_config.hpp index 997ef42e2d3..ffb185a7f69 100644 --- a/docs/template_plugin/src/template_config.hpp +++ b/docs/template_plugin/src/template_config.hpp @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -32,6 +33,7 @@ struct Configuration { int deviceId = 0; bool perfCount = true; InferenceEngine::IStreamsExecutor::Config _streamsExecutorConfig; + ov::hint::PerformanceMode performance_mode = ov::hint::PerformanceMode::UNDEFINED; }; // ! [configuration:header] diff --git a/docs/template_plugin/src/template_plugin.cpp b/docs/template_plugin/src/template_plugin.cpp index 2e95d2c674f..6f8c6fc98dc 100644 --- a/docs/template_plugin/src/template_plugin.cpp +++ b/docs/template_plugin/src/template_plugin.cpp @@ -262,6 +262,7 @@ InferenceEngine::Parameter Plugin::GetMetric(const std::string& name, } else if (METRIC_KEY(SUPPORTED_CONFIG_KEYS) == name) { std::vector configKeys = {CONFIG_KEY(DEVICE_ID), CONFIG_KEY(PERF_COUNT), + ov::hint::performance_mode.name(), TEMPLATE_CONFIG_KEY(THROUGHPUT_STREAMS)}; auto streamExecutorConfigKeys = InferenceEngine::IStreamsExecutor::Config{}.SupportedKeys(); for (auto&& configKey : streamExecutorConfigKeys) { diff --git a/docs/template_plugin/tests/functional/shared_tests_instances/behavior/ov_plugin/core_integration.cpp b/docs/template_plugin/tests/functional/shared_tests_instances/behavior/ov_plugin/core_integration.cpp new file mode 100644 index 00000000000..f5542b305a7 --- /dev/null +++ b/docs/template_plugin/tests/functional/shared_tests_instances/behavior/ov_plugin/core_integration.cpp @@ -0,0 +1,107 @@ +// Copyright (C) 2018-2022 Intel Corporation +// SPDX-License-Identifcorer: Apache-2.0 +// + +#include +#include +#include + +#include "behavior/ov_plugin/core_integration.hpp" + +using namespace ov::test::behavior; + +namespace { + +// +// OV Class Common tests with +// + +INSTANTIATE_TEST_SUITE_P( + smoke_OVClassBasicTestP, OVClassBasicTestP, + ::testing::Values(std::make_pair("ov_template_plugin", 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) { + ov::Core core = createCoreWithTemplate(); + + auto device_name = CommonTestUtils::DEVICE_TEMPLATE; + + for (auto&& property : core.get_property(device_name, ov::supported_properties)) { + 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; + } 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; + core.set_property(device_name, ov::hint::performance_mode(ov::hint::PerformanceMode::UNDEFINED)); + ASSERT_EQ(ov::hint::PerformanceMode::UNDEFINED, 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)); + } + } +} + +// OV Class Query network + +INSTANTIATE_TEST_SUITE_P( + smoke_OVClassQueryNetworkTest, OVClassQueryNetworkTest, + ::testing::Values(CommonTestUtils::DEVICE_TEMPLATE)); + +// OV Class Load network + +INSTANTIATE_TEST_SUITE_P( + smoke_OVClassLoadNetworkTest, OVClassLoadNetworkTest, + ::testing::Values(CommonTestUtils::DEVICE_TEMPLATE)); +} // namespace diff --git a/docs/template_plugin/tests/functional/skip_tests_config.cpp b/docs/template_plugin/tests/functional/skip_tests_config.cpp index 33eafc66560..e76e3ef1074 100644 --- a/docs/template_plugin/tests/functional/skip_tests_config.cpp +++ b/docs/template_plugin/tests/functional/skip_tests_config.cpp @@ -108,6 +108,7 @@ std::vector disabledTestPatterns() { // CVS-71891 R"(.*ReferenceTileTest.*rType=i4.*)", R"(.*ReferenceTileTest.*rType=u4.*)", + R"(.*DeviceID.*)", }; #ifdef _WIN32 diff --git a/src/inference/include/openvino/runtime/properties.hpp b/src/inference/include/openvino/runtime/properties.hpp index d9b51989a1b..5992b53d05b 100644 --- a/src/inference/include/openvino/runtime/properties.hpp +++ b/src/inference/include/openvino/runtime/properties.hpp @@ -237,13 +237,16 @@ static constexpr Property model_priority{"OV_MODEL_PRIORITY"}; * @brief Enum to define possible performance mode hints */ enum class PerformanceMode { - LATENCY = 0, - THROUGHPUT = 1, + UNDEFINED = -1, + LATENCY = 1, + THROUGHPUT = 2, }; /** @cond INTERNAL */ inline std::ostream& operator<<(std::ostream& os, const PerformanceMode& performance_mode) { switch (performance_mode) { + case PerformanceMode::UNDEFINED: + return os << ""; case PerformanceMode::LATENCY: return os << "LATENCY"; case PerformanceMode::THROUGHPUT: @@ -260,6 +263,8 @@ inline std::istream& operator>>(std::istream& is, PerformanceMode& performance_m performance_mode = PerformanceMode::LATENCY; } else if (str == "THROUGHPUT") { performance_mode = PerformanceMode::THROUGHPUT; + } else if (str == "") { + performance_mode = PerformanceMode::UNDEFINED; } else { throw ov::Exception{"Unsupported performance mode: " + str}; } diff --git a/src/plugins/auto/plugin.cpp b/src/plugins/auto/plugin.cpp index f9c1938720f..90918762d1c 100644 --- a/src/plugins/auto/plugin.cpp +++ b/src/plugins/auto/plugin.cpp @@ -140,7 +140,7 @@ std::vector MultiDeviceInferencePlugin::ParseMetaDevices(cons std::string fullDeviceName = ""; std::string uniqueName = ""; if (parsed.getDeviceName() == "GPU") { - std::vector supportedMetrics = GetCore()->GetMetric(deviceName, METRIC_KEY(SUPPORTED_METRICS)); + auto supportedMetrics = GetCore()->GetMetric(deviceName, METRIC_KEY(SUPPORTED_METRICS)).as>(); if (std::find(supportedMetrics.begin(), supportedMetrics.end(), METRIC_KEY(FULL_DEVICE_NAME)) != supportedMetrics.end()) { fullDeviceName = GetCore()->GetMetric(deviceName, METRIC_KEY(FULL_DEVICE_NAME)).as(); } @@ -451,7 +451,7 @@ DeviceInformation MultiDeviceInferencePlugin::SelectDevice(const std::vector 1) { auto selectSupportDev = [this, &devices, &validDevices](const std::string& networkPrecision) { for (auto iter = devices.begin(); iter != devices.end();) { - std::vector capability = GetCore()->GetMetric(iter->deviceName, METRIC_KEY(OPTIMIZATION_CAPABILITIES)); + auto capability = GetCore()->GetMetric(iter->deviceName, METRIC_KEY(OPTIMIZATION_CAPABILITIES)).as>(); auto supportNetwork = std::find(capability.begin(), capability.end(), (networkPrecision)); if (supportNetwork != capability.end()) { validDevices.push_back(std::move(*iter));