[Auto Plugin] Auto plugin component in IE (#5366)

* Implement AUTO plugin

Usage:
	1. -d AUTO
	2. -d ""

Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>

* Add tests for AUTO plugin

Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>

* cleaned impl, that was incorrect from the async perspective, ansl also capturing the blobs in the constructor

* Revert benchmark_app modification

Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>

* Address reviewer's comments: need CI tests to verify

Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>

Co-authored-by: myshevts <maxim.y.shevtsov@intel.com>
This commit is contained in:
Shoujiang Maandmyshevts authored and GitHub committed 2021-05-13 17:04:38 +03:00
1 parent 05b62258c7
commit 40ffca6fa2
25 files changed
+670 -17

No files matched your search

+2
View File
@@ -30,6 +30,8 @@ endif()
add_subdirectory(hetero_plugin)
add_subdirectory(auto_plugin)
add_subdirectory(multi_device)
add_subdirectory(transformations)
@@ -0,0 +1,19 @@
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
set (TARGET_NAME "AutoPlugin")
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
file(GLOB HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
ie_add_plugin(NAME ${TARGET_NAME}
DEVICE_NAME "AUTO"
SOURCES ${SOURCES} ${HEADERS}
VERSION_DEFINES_FOR auto_plugin.cpp)
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine)
ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
@@ -0,0 +1,59 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <string>
#include <vector>
#include <memory>
#include <map>
#include <unordered_map>
#include "ie_metric_helpers.hpp"
#include "auto_exec_network.hpp"
#include "auto_infer_request.hpp"
namespace AutoPlugin {
using namespace InferenceEngine;
AutoExecutableNetwork::AutoExecutableNetwork(const ExecutableNetwork& network,
const DeviceInformation& deviceInfo,
const bool needPerfCounters) :
_deviceInfo(deviceInfo),
_network(network),
_config(deviceInfo.config.begin(), deviceInfo.config.end()),
_needPerfCounters(needPerfCounters) {
}
AutoExecutableNetwork::~AutoExecutableNetwork() = default;
IInferRequestInternal::Ptr AutoExecutableNetwork::CreateInferRequestImpl(InputsDataMap networkInputs,
OutputsDataMap networkOutputs) {
auto inferRequest = _network.CreateInferRequest();
return std::make_shared<AutoInferRequest>(networkInputs, networkOutputs, inferRequest);
}
void AutoExecutableNetwork::Export(std::ostream& networkModel) {
_network.Export(networkModel);
}
RemoteContext::Ptr AutoExecutableNetwork::GetContext() const {
return _network.GetContext();
}
InferenceEngine::CNNNetwork AutoExecutableNetwork::GetExecGraphInfo() {
return _network.GetExecGraphInfo();
}
Parameter AutoExecutableNetwork::GetMetric(const std::string &name) const {
return _network.GetMetric(name);
}
void AutoExecutableNetwork::SetConfig(const std::map<std::string, Parameter>& config) {
_network.SetConfig(config);
}
Parameter AutoExecutableNetwork::GetConfig(const std::string& name) const {
return _network.GetConfig(name);
}
} // namespace AutoPlugin
@@ -0,0 +1,51 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <atomic>
#include <mutex>
#include <queue>
#include <unordered_map>
#include <map>
#include <vector>
#include <string>
#include <cpp_interfaces/impl/ie_executable_network_thread_safe_default.hpp>
#include <threading/ie_itask_executor.hpp>
namespace AutoPlugin {
using DeviceName = std::string;
struct DeviceInformation {
DeviceName deviceName;
std::map<std::string, std::string> config;
};
class AutoExecutableNetwork : public InferenceEngine::ExecutableNetworkThreadSafeDefault {
public:
using Ptr = std::shared_ptr<AutoExecutableNetwork>;
AutoExecutableNetwork(const InferenceEngine::ExecutableNetwork& network,
const DeviceInformation& deviceInfo,
const bool needPerfCounters = false);
void Export(std::ostream& networkModel) override;
InferenceEngine::RemoteContext::Ptr GetContext() const override;
InferenceEngine::CNNNetwork GetExecGraphInfo() override;
InferenceEngine::Parameter GetMetric(const std::string &name) const override;
void SetConfig(const std::map<std::string, InferenceEngine::Parameter>& config) override;
InferenceEngine::Parameter GetConfig(const std::string& name) const override;
InferenceEngine::IInferRequestInternal::Ptr CreateInferRequestImpl(InferenceEngine::InputsDataMap networkInputs,
InferenceEngine::OutputsDataMap networkOutputs) override;
~AutoExecutableNetwork() override;
DeviceInformation _deviceInfo;
InferenceEngine::ExecutableNetwork _network;
std::unordered_map<std::string, InferenceEngine::Parameter> _config;
bool _needPerfCounters = false;
};
} // namespace AutoPlugin
@@ -0,0 +1,39 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "auto_infer_request.hpp"
#include <ie_input_info.hpp>
#include <cpp_interfaces/interface/ie_iinfer_request_internal.hpp>
namespace AutoPlugin {
using namespace InferenceEngine;
AutoInferRequest::AutoInferRequest(const InputsDataMap& networkInputs,
const OutputsDataMap& networkOutputs,
const InferRequest& inferRequest)
: IInferRequestInternal(networkInputs, networkOutputs)
, _inferRequest(inferRequest) {
}
std::map<std::string, InferenceEngine::InferenceEngineProfileInfo> AutoInferRequest::GetPerformanceCounts() const {
return _inferRequest.GetPerformanceCounts();
}
void AutoInferRequest::InferImpl() {
_inferRequest.Infer();
}
void AutoInferRequest::SetBlob(const std::string& name, const InferenceEngine::Blob::Ptr& data) {
_inferRequest.SetBlob(name, data);
}
Blob::Ptr AutoInferRequest::GetBlob(const std::string& name) {
return _inferRequest.GetBlob(name);
}
void AutoInferRequest::Cancel() {
_inferRequest.Cancel();
}
} // namespace AutoPlugin
@@ -0,0 +1,40 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <atomic>
#include <cpp/ie_executable_network.hpp>
#include <cpp/ie_infer_request.hpp>
#include <cpp_interfaces/interface/ie_iinfer_request_internal.hpp>
#include <ie_blob.h>
#include <ie_common.h>
#include <map>
#include <memory>
#include <mutex>
#include <queue>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
namespace AutoPlugin {
class AutoInferRequest : public InferenceEngine::IInferRequestInternal {
public:
using Ptr = std::shared_ptr<AutoInferRequest>;
explicit AutoInferRequest(const InferenceEngine::InputsDataMap& networkInputs,
const InferenceEngine::OutputsDataMap& networkOutputs,
const InferenceEngine::InferRequest& inferRequest);
std::map<std::string, InferenceEngine::InferenceEngineProfileInfo> GetPerformanceCounts() const override;
void InferImpl() override;
void SetBlob(const std::string& name, const InferenceEngine::Blob::Ptr& data) override;
InferenceEngine::Blob::Ptr GetBlob(const std::string& name) override;
void Cancel() override;
private:
InferenceEngine::InferRequest _inferRequest;
};
} // namespace AutoPlugin
@@ -0,0 +1,199 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <string>
#include <vector>
#include <memory>
#include <map>
#include <unordered_set>
#include <ie_metric_helpers.hpp>
#include <ie_core.hpp>
#include <threading/ie_executor_manager.hpp>
#include <ie_algorithm.hpp>
#include "auto_plugin.hpp"
namespace AutoPlugin {
namespace {
ConfigType mergeConfigs(ConfigType config, const ConfigType& local) {
for (auto && kvp : local) {
config[kvp.first] = kvp.second;
}
return config;
}
DeviceInformation SelectDevice(const std::vector<DeviceInformation>& metaDevices) {
for (auto& item : metaDevices) {
if (item.deviceName.find("CPU") == 0) {
return item;
}
}
IE_THROW(NotFound) << "No available device could be used";
}
} // namespace
AutoInferencePlugin::AutoInferencePlugin() {
_pluginName = "AUTO";
}
IE::ExecutableNetworkInternal::Ptr AutoInferencePlugin::LoadExeNetworkImpl(const IE::CNNNetwork& network,
const ConfigType& config) {
if (GetCore() == nullptr) {
IE_THROW() << "Please, work with AUTO device via InferencEngine::Core object";
}
if (network.getFunction() == nullptr) {
IE_THROW() << "AUTO device supports just ngraph network representation";
}
auto fullConfig = mergeConfigs(_config, config);
auto metaDevices = GetDeviceChoice(fullConfig);
// FIXME: always select CPU device now
DeviceInformation selectedDevice = SelectDevice(metaDevices);
IE::ExecutableNetwork executableNetwork;
try {
executableNetwork = GetCore()->LoadNetwork(network, selectedDevice.deviceName, selectedDevice.config);
} catch(const IE::Exception &iie) {
IE_THROW() << "Failed to load network to device named " << selectedDevice.deviceName
<< " with exception " << iie.what();
}
bool enablePerfCounters = false;
try {
enablePerfCounters =
executableNetwork.GetConfig(IE::PluginConfigParams::KEY_PERF_COUNT).as<std::string>() ==
IE::PluginConfigParams::YES;
} catch (...) {
}
return std::make_shared<AutoExecutableNetwork>(executableNetwork,
selectedDevice,
enablePerfCounters);
}
IE::QueryNetworkResult AutoInferencePlugin::QueryNetwork(const IE::CNNNetwork& network, const ConfigType& config) const {
IE::QueryNetworkResult queryResult = {};
if (GetCore() == nullptr) {
IE_THROW() << "Please, work with AUTO device via InferencEngine::Core object";
}
if (network.getFunction() == nullptr) {
IE_THROW() << "AUTO device supports just ngraph network representation";
}
auto fullConfig = mergeConfigs(_config, config);
auto metaDevices = GetDeviceChoice(fullConfig);
std::unordered_set<std::string> supportedLayers;
for (auto&& value : metaDevices) {
try {
auto deviceQr = GetCore()->QueryNetwork(network, value.deviceName, value.config);
std::unordered_set<std::string> deviceSupportedLayers;
for (auto &&layerQr : deviceQr.supportedLayersMap) {
deviceSupportedLayers.emplace(layerQr.first);
}
supportedLayers = supportedLayers.empty()
? deviceSupportedLayers : (deviceSupportedLayers.empty()
? supportedLayers : IE::details::Intersection(
supportedLayers, deviceSupportedLayers));
break;
} catch (...) {
}
}
for (auto&& supportedLayer : supportedLayers) {
queryResult.supportedLayersMap[supportedLayer] = GetName();
}
return queryResult;
}
IE::Parameter AutoInferencePlugin::GetConfig(const std::string& name,
const std::map<std::string, IE::Parameter> & options) const {
auto it = _config.find(name);
if (it == _config.end()) {
IE_THROW() << "Unsupported config key: " << name;
} else {
return { it->second };
}
}
void AutoInferencePlugin::SetConfig(const ConfigType& config) {
for (auto && kvp : config) {
_config[kvp.first] = kvp.second;
}
}
IE::Parameter AutoInferencePlugin::GetMetric(const std::string& name,
const std::map<std::string, IE::Parameter> & options) const {
if (name == METRIC_KEY(SUPPORTED_METRICS)) {
std::vector<std::string> metrics;
metrics.emplace_back(METRIC_KEY(SUPPORTED_METRICS));
metrics.emplace_back(METRIC_KEY(FULL_DEVICE_NAME));
metrics.emplace_back(METRIC_KEY(SUPPORTED_CONFIG_KEYS));
metrics.emplace_back(METRIC_KEY(OPTIMIZATION_CAPABILITIES));
IE_SET_METRIC_RETURN(SUPPORTED_METRICS, metrics);
} else if (name == METRIC_KEY(FULL_DEVICE_NAME)) {
std::string device_name = {"Inference Engine AUTO device"};
IE_SET_METRIC_RETURN(FULL_DEVICE_NAME, device_name);
} else if (name == METRIC_KEY(SUPPORTED_CONFIG_KEYS)) {
std::vector<std::string> configKeys;
IE_SET_METRIC_RETURN(SUPPORTED_CONFIG_KEYS, configKeys);
} else if (name == METRIC_KEY(OPTIMIZATION_CAPABILITIES)) {
std::vector<std::string> capabilities = { "" };
IE_SET_METRIC_RETURN(OPTIMIZATION_CAPABILITIES, capabilities);
} else {
IE_THROW() << "Unsupported metric key " << name;
}
}
std::vector<AutoPlugin::DeviceInformation> AutoInferencePlugin::GetDeviceChoice(const ConfigType& config) const {
std::vector<DeviceInformation> metaDevices;
std::vector<std::string> availableDevices = GetCore()->GetAvailableDevices();
auto getDeviceConfig = [&] (const DeviceName & deviceWithID) {
IE::DeviceIDParser deviceParser(deviceWithID);
std::string deviceName = deviceParser.getDeviceName();
ConfigType tconfig = mergeConfigs(_config, config);
// set device ID if any
std::string deviceIDLocal = deviceParser.getDeviceID();
if (!deviceIDLocal.empty()) {
tconfig[IE::PluginConfigParams::KEY_DEVICE_ID] = deviceIDLocal;
}
return GetSupportedConfig(tconfig, deviceName);
};
for (auto && d : availableDevices) {
if (d != _pluginName) {
metaDevices.push_back({ d, getDeviceConfig(d)});
}
}
if (metaDevices.empty()) {
IE_THROW() << "Please, check environment due to no supported devices can be used";
}
return metaDevices;
}
//////////////////////////////////// private & protected functions ///////////////////
ConfigType AutoInferencePlugin::GetSupportedConfig(const ConfigType& config,
const std::string& deviceName) const {
std::vector<std::string> supportedConfigKeys = GetCore()->GetMetric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS));
ConfigType supportedConfig;
for (auto&& key : supportedConfigKeys) {
auto itKey = config.find(key);
if (config.end() != itKey) {
supportedConfig[key] = itKey->second;
}
}
return supportedConfig;
}
// define CreatePluginEngine to create plugin instance
static const IE::Version version = {{2, 1}, CI_BUILD_NUMBER, "AutoPlugin"};
IE_DEFINE_PLUGIN_CREATE_FUNCTION(AutoInferencePlugin, version)
} // namespace AutoPlugin
@@ -0,0 +1,37 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <map>
#include <vector>
#include <string>
#include <unordered_set>
#include <cpp_interfaces/impl/ie_plugin_internal.hpp>
#include <cpp_interfaces/interface/ie_internal_plugin_config.hpp>
#include "auto_exec_network.hpp"
namespace AutoPlugin {
namespace IE = InferenceEngine;
using ConfigType = std::map<std::string, std::string>;
class AutoInferencePlugin : public IE::InferencePluginInternal {
public:
AutoInferencePlugin();
~AutoInferencePlugin() = default;
IE::ExecutableNetworkInternal::Ptr LoadExeNetworkImpl(const IE::CNNNetwork& network, const ConfigType& config) override;
IE::QueryNetworkResult QueryNetwork(const IE::CNNNetwork& network, const ConfigType& config) const override;
IE::Parameter GetMetric(const std::string& name, const std::map<std::string, IE::Parameter>& options) const override;
IE::Parameter GetConfig(const std::string& name, const std::map<std::string, IE::Parameter> & options) const override;
void SetConfig(const ConfigType& config) override;
private:
std::vector<AutoPlugin::DeviceInformation> GetDeviceChoice(const ConfigType& config) const;
protected:
ConfigType GetSupportedConfig(const ConfigType& config, const AutoPlugin::DeviceName & deviceName) const;
};
} // namespace AutoPlugin
@@ -51,6 +51,9 @@ Parsed<T> parseDeviceNameIntoConfig(const std::string& deviceName, const std::ma
deviceName_ = "MULTI";
config_[InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES] = deviceName.substr(6);
} else {
if (deviceName_.empty()) {
deviceName_ = "AUTO";
}
DeviceIDParser parser(deviceName_);
deviceName_ = parser.getDeviceName();
std::string deviceIDLocal = parser.getDeviceID();
@@ -583,6 +586,15 @@ public:
}
}
// AUTO case
{
if (deviceName.find("AUTO:") == 0) {
IE_THROW()
<< "You can get specific metrics with the GetMetric only for the AUTO itself (without devices). "
"To get individual devices's metrics call GetMetric for each device separately";
}
}
auto parsed = parseDeviceNameIntoConfig(deviceName);
// we need to return a copy of Parameter object which is created on Core side,
@@ -753,7 +765,7 @@ public:
* @brief Sets config values for a plugin or set of plugins
* @param deviceName A device name to set config to
* If empty, config is set for all the plugins / plugin's meta-data
* @note `deviceName` is not allowed in form of MULTI:CPU, HETERO:FPGA,CPU
* @note `deviceName` is not allowed in form of MULTI:CPU, HETERO:FPGA,CPU, AUTO:CPU
* just simple forms like CPU, GPU, MULTU, GPU.0, etc
*/
void SetConfigForPlugins(const std::map<std::string, std::string>& configMap, const std::string& deviceName) {
@@ -909,6 +921,10 @@ RemoteContext::Ptr Core::CreateContext(const std::string& deviceName, const Para
if (deviceName.find("MULTI") == 0) {
IE_THROW() << "MULTI device does not support remote context";
}
if (deviceName.find("AUTO") == 0) {
IE_THROW() << "AUTO device does not support remote context";
}
auto parsed = parseDeviceNameIntoConfig(deviceName, params);
return _impl->GetCPPPluginByName(parsed._deviceName).CreateContext(parsed._config);
@@ -921,6 +937,9 @@ RemoteContext::Ptr Core::GetDefaultContext(const std::string& deviceName) {
if (deviceName.find("MULTI") == 0) {
IE_THROW() << "MULTI device does not support remote context";
}
if (deviceName.find("AUTO") == 0) {
IE_THROW() << "AUTO device does not support remote context";
}
auto parsed = parseDeviceNameIntoConfig(deviceName, ParamMap());
return _impl->GetCPPPluginByName(parsed._deviceName).GetDefaultContext(parsed._config);
@@ -935,6 +954,10 @@ void Core::AddExtension(IExtensionPtr extension, const std::string& deviceName_)
IE_THROW()
<< "MULTI device does not support extensions. Please, set extensions directly to fallback devices";
}
if (deviceName_.find("AUTO") == 0) {
IE_THROW()
<< "AUTO device does not support extensions. Please, set extensions directly to fallback devices";
}
_impl->AddExtension(extension);
}
@@ -954,6 +977,9 @@ ExecutableNetwork Core::ImportNetwork(const std::string& modelFileName, const st
if (deviceName.find("MULTI") == 0) {
IE_THROW() << "MULTI device does not support ImportNetwork";
}
if (deviceName.find("AUTO") == 0) {
IE_THROW() << "AUTO device does not support ImportNetwork";
}
auto parsed = parseDeviceNameIntoConfig(deviceName, config);
return _impl->GetCPPPluginByName(parsed._deviceName).ImportNetwork(modelFileName, parsed._config);
@@ -999,6 +1025,12 @@ void Core::SetConfig(const std::map<std::string, std::string>& config, const std
"You can configure the devices with SetConfig before creating the MULTI on top.";
}
// AUTO case
if (deviceName.find("AUTO:") == 0) {
IE_THROW() << "SetConfig is supported only for AUTO itself (without devices). "
"You can configure the devices with SetConfig before creating the AUTO on top.";
}
// GPU.0, FPGA.1 cases
if (deviceName.find(".") != std::string::npos) {
IE_THROW() << "SetConfig is supported only for device family itself (without particular device .#). "
@@ -1030,6 +1062,14 @@ Parameter Core::GetConfig(const std::string& deviceName, const std::string& name
"GetConfig is also possible for the individual devices before creating the MULTI on top.";
}
}
// AUTO case
{
if (deviceName.find("AUTO:") == 0) {
IE_THROW()
<< "You can only GetConfig of the AUTO itself (without devices). "
"GetConfig is also possible for the individual devices before creating the AUTO on top.";
}
}
auto parsed = parseDeviceNameIntoConfig(deviceName);
@@ -42,6 +42,10 @@ namespace {
{InferenceEngine::PluginConfigParams::KEY_DYN_BATCH_LIMIT, "10"}}
};
const std::vector<std::map<std::string, std::string>> AutoConfigs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, CorrectConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
@@ -56,6 +60,13 @@ namespace {
::testing::ValuesIn(MultiConfigs)),
CorrectConfigTests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, CorrectConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(AutoConfigs)),
CorrectConfigTests::getTestCaseName);
const std::vector<std::map<std::string, std::string>> inconfigs = {
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, "OFF"}},
{{InferenceEngine::PluginConfigParams::KEY_CPU_BIND_THREAD, "OFF"}},
@@ -75,7 +86,6 @@ namespace {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, CorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
@@ -90,6 +100,13 @@ namespace {
::testing::ValuesIn(multiconf)),
CorrectConfigAPITests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, CorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(AutoConfigs)),
CorrectConfigAPITests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, IncorrectConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
@@ -104,6 +121,13 @@ namespace {
::testing::ValuesIn(multiinconfigs)),
IncorrectConfigTests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, IncorrectConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(inconfigs)),
IncorrectConfigTests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, IncorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
@@ -118,4 +142,11 @@ namespace {
::testing::ValuesIn(multiinconfigs)),
IncorrectConfigAPITests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, IncorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(inconfigs)),
IncorrectConfigAPITests::getTestCaseName);
} // namespace
@@ -31,11 +31,11 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P(
smoke_IEClassGetMetricTest, IEClassGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("CPU", "MULTI", "HETERO"));
::testing::Values("CPU", "MULTI", "HETERO", "AUTO"));
INSTANTIATE_TEST_CASE_P(
smoke_IEClassGetMetricTest, IEClassGetMetricTest_SUPPORTED_METRICS,
::testing::Values("CPU", "MULTI", "HETERO"));
::testing::Values("CPU", "MULTI", "HETERO", "AUTO"));
INSTANTIATE_TEST_CASE_P(
smoke_IEClassGetMetricTest, IEClassGetMetricTest_AVAILABLE_DEVICES,
@@ -43,11 +43,11 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P(
smoke_IEClassGetMetricTest, IEClassGetMetricTest_FULL_DEVICE_NAME,
::testing::Values("CPU", "MULTI", "HETERO"));
::testing::Values("CPU", "MULTI", "HETERO", "AUTO"));
INSTANTIATE_TEST_CASE_P(
smoke_IEClassGetMetricTest, IEClassGetMetricTest_OPTIMIZATION_CAPABILITIES,
::testing::Values("CPU"));
::testing::Values("CPU", "AUTO"));
INSTANTIATE_TEST_CASE_P(
smoke_IEClassGetMetricTest, IEClassGetMetricTest_RANGE_FOR_ASYNC_INFER_REQUESTS,
@@ -59,11 +59,11 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P(
smoke_IEClassGetMetricTest, IEClassGetMetricTest_ThrowUnsupported,
::testing::Values("CPU", "MULTI", "HETERO"));
::testing::Values("CPU", "MULTI", "HETERO", "AUTO"));
INSTANTIATE_TEST_CASE_P(
smoke_IEClassGetConfigTest, IEClassGetConfigTest_ThrowUnsupported,
::testing::Values("CPU", "MULTI", "HETERO"));
::testing::Values("CPU", "MULTI", "HETERO", "AUTO"));
INSTANTIATE_TEST_CASE_P(
smoke_IEClassGetAvailableDevices, IEClassGetAvailableDevices,
@@ -83,23 +83,23 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU"));
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO"));
INSTANTIATE_TEST_CASE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU"));
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO"));
INSTANTIATE_TEST_CASE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU"));
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO"));
INSTANTIATE_TEST_CASE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_OPTIMAL_NUMBER_OF_INFER_REQUESTS,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU"));
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO"));
INSTANTIATE_TEST_CASE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_ThrowsUnsupported,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU"));
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO"));
//
// Executable Network GetConfig / SetConfig
@@ -10,6 +10,7 @@ const Params params[] = {
std::tuple<Device, Config>{ CommonTestUtils::DEVICE_CPU, {{ CONFIG_KEY(PERF_COUNT), CONFIG_VALUE(YES) }}},
std::tuple<Device, Config>{ CommonTestUtils::DEVICE_HETERO, {{ "TARGET_FALLBACK", CommonTestUtils::DEVICE_CPU }}},
std::tuple<Device, Config>{ CommonTestUtils::DEVICE_MULTI, {{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_CPU }}},
std::tuple<Device, Config>{ CommonTestUtils::DEVICE_AUTO, {{}}},
};
const Params paramsStreams[] = {
@@ -18,6 +18,9 @@ namespace {
const std::vector<std::map<std::string, std::string>> multiConfigs = {
{{ InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}}
};
const std::vector<std::map<std::string, std::string>> autoConfigs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, ExecGraphTests,
::testing::Combine(
@@ -32,4 +35,11 @@ namespace {
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multiConfigs)),
ExecGraphTests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, ExecGraphTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(autoConfigs)),
ExecGraphTests::getTestCaseName);
} // namespace
@@ -24,6 +24,8 @@ namespace {
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_CPU}}
};
const std::vector<std::map<std::string, std::string>> Autoconfigs = {{}};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, InferRequestTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
@@ -37,4 +39,12 @@ namespace {
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(Multiconfigs)),
InferRequestTests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_AutoPlugin_BehaviorTests, InferRequestTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(Autoconfigs)),
InferRequestTests::getTestCaseName);
} // namespace
@@ -23,6 +23,10 @@ const std::vector<std::map<std::string, std::string>> multiConfigs = {
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_CPU}}
};
const std::vector<std::map<std::string, std::string>> autoConfigs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, CallbackTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
@@ -36,4 +40,11 @@ INSTANTIATE_TEST_CASE_P(smoke_Multi_BehaviorTests, CallbackTests,
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multiConfigs)),
CallbackTests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, CallbackTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(autoConfigs)),
CallbackTests::getTestCaseName);
} // namespace
@@ -48,6 +48,10 @@ namespace {
{InferenceEngine::PluginConfigParams::KEY_DYN_BATCH_LIMIT, "10"}}
};
const std::vector<std::map<std::string, std::string>> autoConfigs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, InferConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
@@ -62,6 +66,13 @@ namespace {
::testing::ValuesIn(multiConfigs)),
InferConfigTests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, InferConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(autoConfigs)),
InferConfigTests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, InferConfigInTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
@@ -75,4 +86,11 @@ namespace {
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(MultiInConfigs)),
InferConfigInTests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, InferConfigInTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(autoConfigs)),
InferConfigInTests::getTestCaseName);
} // namespace
@@ -27,6 +27,10 @@ namespace {
{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}
};
const std::vector<std::map<std::string, std::string>> autoConfigs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, InferRequestInputTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
@@ -41,4 +45,11 @@ namespace {
::testing::ValuesIn(multiConfigs)),
InferRequestInputTests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, InferRequestInputTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(autoConfigs)),
InferRequestInputTests::getTestCaseName);
} // namespace
@@ -23,6 +23,10 @@ namespace {
{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}
};
const std::vector<std::map<std::string, std::string>> autoConfigs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, InferRequestOutputTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
@@ -37,4 +41,11 @@ namespace {
::testing::ValuesIn(multiConfigs)),
InferRequestOutputTests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, InferRequestOutputTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(autoConfigs)),
InferRequestOutputTests::getTestCaseName);
} // namespace
@@ -15,6 +15,10 @@ namespace {
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_CPU}}
};
const std::vector<std::map<std::string, std::string>> Autoconfigs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, PerfCountersTest,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
@@ -29,4 +33,11 @@ namespace {
::testing::ValuesIn(Multiconfigs)),
PerfCountersTest::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, PerfCountersTest,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(Autoconfigs)),
PerfCountersTest::getTestCaseName);
} // namespace
@@ -28,6 +28,10 @@ namespace {
{{ InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}}
};
const std::vector<std::map<std::string, std::string>> autoConfigs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, PreprocessTest,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
@@ -49,6 +53,13 @@ namespace {
::testing::ValuesIn(multiConfigs)),
PreprocessTest::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, PreprocessTest,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(autoConfigs)),
PreprocessTest::getTestCaseName);
const std::vector<InferenceEngine::Precision> ioPrecisions = {
InferenceEngine::Precision::FP32,
@@ -106,4 +117,18 @@ namespace {
::testing::ValuesIn(multiConfigs)),
PreprocessConversionTest::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, PreprocessConversionTest,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::ValuesIn(ioPrecisions),
::testing::ValuesIn(ioPrecisions),
::testing::ValuesIn(netLayouts),
::testing::ValuesIn(ioLayouts),
::testing::ValuesIn(ioLayouts),
::testing::Bool(),
::testing::Bool(),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(autoConfigs)),
PreprocessConversionTest::getTestCaseName);
} // namespace
@@ -39,6 +39,10 @@ namespace {
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}
};
const std::vector<std::map<std::string, std::string>> Autoconfigs = {
{}
};
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, BehaviorTestOutput,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
@@ -53,6 +57,13 @@ namespace {
::testing::ValuesIn(MultiConfigsInputOutput)),
BehaviorTestOutput::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, BehaviorTestOutput,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(Autoconfigs)),
BehaviorTestOutput::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, BehaviorTests,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
@@ -67,6 +78,13 @@ namespace {
::testing::ValuesIn(MultiConfigs)),
BehaviorTests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, BehaviorTests,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(Autoconfigs)),
BehaviorTests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, BehaviorTestInput,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
@@ -81,4 +99,11 @@ namespace {
::testing::ValuesIn(MultiConfigsInputOutput)),
BehaviorTestInput::getTestCaseName);
INSTANTIATE_TEST_CASE_P(smoke_Auto_BehaviorTests, BehaviorTestInput,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(Autoconfigs)),
BehaviorTestInput::getTestCaseName);
} // namespace
@@ -58,7 +58,8 @@ namespace BehaviorTestsDefinitions {
// Create CNNNetwork from ngrpah::Function
InferenceEngine::CNNNetwork cnnNet(function);
if (targetDevice.find(CommonTestUtils::DEVICE_MULTI) == std::string::npos &&
targetDevice.find(CommonTestUtils::DEVICE_HETERO) == std::string::npos) {
targetDevice.find(CommonTestUtils::DEVICE_HETERO) == std::string::npos &&
targetDevice.find(CommonTestUtils::DEVICE_AUTO) == std::string::npos) {
ASSERT_NO_THROW(ie->GetMetric(targetDevice, METRIC_KEY(SUPPORTED_CONFIG_KEYS)));
ASSERT_THROW(ie->SetConfig(configuration, targetDevice),
InferenceEngine::Exception);
@@ -72,12 +72,13 @@ TEST_P(ExecGraphTests, CheckExecGraphInfoBeforeExecution) {
const auto originalLayers = function->get_ops();
std::map<std::string, int> originalLayersMap;
for (const auto &layer : originalLayers) {
if (layer->description() == "Result" && targetDevice != CommonTestUtils::DEVICE_CPU)
if (layer->description() == "Result" &&
targetDevice != CommonTestUtils::DEVICE_CPU &&
targetDevice != CommonTestUtils::DEVICE_AUTO)
continue;
originalLayersMap[layer->get_friendly_name()] = 0;
}
int IteratorForLayersConstant = 0;
if (auto function = execGraph.getFunction()) {
for (const auto & op : function->get_ops()) {
const auto & rtInfo = op->get_rt_info();
@@ -324,7 +324,7 @@ TEST_P(InferRequestTests, canProcessDeallocatedOutputBlobAfterGetBlobForAsync) {
ASSERT_NO_THROW(req.SetBlob(cnnNet.getOutputsInfo().begin()->first, blob));
blob->deallocate();
ASSERT_THROW(req.Infer(), InferenceEngine::Exception);
ASSERT_THROW(req.StartAsync(), InferenceEngine::Exception);
ASSERT_THROW({ req.StartAsync(); req.Wait(); }, InferenceEngine::Exception);
}
TEST_P(InferRequestTests, canProcessDeallocatedOutputBlobAfterGetAndSetBlob) {
@@ -6,6 +6,7 @@
namespace CommonTestUtils {
const char DEVICE_AUTO[] = "AUTO";
const char DEVICE_CPU[] = "CPU";
const char DEVICE_GNA[] = "GNA";
const char DEVICE_GPU[] = "GPU";