Added undefined perfomnance hint value (#10082)
* Added undefined perfomnance hint value * Added tests * Fixed tests * fixed dormat
This commit is contained in:
1 parent
168bfe58c4
commit
5c9b6915dc
7 files changed
+125
-4
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <ie_parameter.hpp>
|
||||
#include <map>
|
||||
#include <openvino/runtime/properties.hpp>
|
||||
#include <string>
|
||||
#include <threading/ie_istreams_executor.hpp>
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -262,6 +262,7 @@ InferenceEngine::Parameter Plugin::GetMetric(const std::string& name,
|
||||
} else if (METRIC_KEY(SUPPORTED_CONFIG_KEYS) == name) {
|
||||
std::vector<std::string> 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) {
|
||||
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
// Copyright (C) 2018-2022 Intel Corporation
|
||||
// SPDX-License-Identifcorer: Apache-2.0
|
||||
//
|
||||
|
||||
#include <utility>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "behavior/ov_plugin/core_integration.hpp"
|
||||
|
||||
using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
|
||||
//
|
||||
// OV Class Common tests with <pluginName, device_name params>
|
||||
//
|
||||
|
||||
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
|
||||
@@ -108,6 +108,7 @@ std::vector<std::string> disabledTestPatterns() {
|
||||
// CVS-71891
|
||||
R"(.*ReferenceTileTest.*rType=i4.*)",
|
||||
R"(.*ReferenceTileTest.*rType=u4.*)",
|
||||
R"(.*DeviceID.*)",
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -237,13 +237,16 @@ static constexpr Property<Priority> 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};
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ std::vector<DeviceInformation> MultiDeviceInferencePlugin::ParseMetaDevices(cons
|
||||
std::string fullDeviceName = "";
|
||||
std::string uniqueName = "";
|
||||
if (parsed.getDeviceName() == "GPU") {
|
||||
std::vector<std::string> supportedMetrics = GetCore()->GetMetric(deviceName, METRIC_KEY(SUPPORTED_METRICS));
|
||||
auto supportedMetrics = GetCore()->GetMetric(deviceName, METRIC_KEY(SUPPORTED_METRICS)).as<std::vector<std::string>>();
|
||||
if (std::find(supportedMetrics.begin(), supportedMetrics.end(), METRIC_KEY(FULL_DEVICE_NAME)) != supportedMetrics.end()) {
|
||||
fullDeviceName = GetCore()->GetMetric(deviceName, METRIC_KEY(FULL_DEVICE_NAME)).as<std::string>();
|
||||
}
|
||||
@@ -451,7 +451,7 @@ DeviceInformation MultiDeviceInferencePlugin::SelectDevice(const std::vector<Dev
|
||||
if (metaDevices.size() > 1) {
|
||||
auto selectSupportDev = [this, &devices, &validDevices](const std::string& networkPrecision) {
|
||||
for (auto iter = devices.begin(); iter != devices.end();) {
|
||||
std::vector<std::string> capability = GetCore()->GetMetric(iter->deviceName, METRIC_KEY(OPTIMIZATION_CAPABILITIES));
|
||||
auto capability = GetCore()->GetMetric(iter->deviceName, METRIC_KEY(OPTIMIZATION_CAPABILITIES)).as<std::vector<std::string>>();
|
||||
auto supportNetwork = std::find(capability.begin(), capability.end(), (networkPrecision));
|
||||
if (supportNetwork != capability.end()) {
|
||||
validDevices.push_back(std::move(*iter));
|
||||
|
||||
Reference in new issue
Block a user