add testcase for plugin properties should not be revised by compile_m… (#11842)

* add testcase for plugin properties should not be revised by compile_model

* rename smoke_cpuCompileModelBehaviorTests to smoke_gpuCompileModelBehaviorTests

* remove property EXCLUSIVE_ASYNC_REQUESTS in ov2.0 test

* add testcase for plugin properties should not be revised by loadNetwork
This commit is contained in:
guozhong wang
2022-06-25 16:37:43 +08:00
committed by GitHub
parent 2bbd2b1990
commit c0a2c98a45
8 changed files with 293 additions and 0 deletions

View File

@@ -36,4 +36,41 @@ INSTANTIATE_TEST_SUITE_P(smoke_AutoMultiBehaviorTests, OVPropertiesTests,
::testing::Values(CommonTestUtils::DEVICE_AUTO, CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multi_Auto_properties)),
OVPropertiesTests::getTestCaseName);
const std::vector<ov::AnyMap> cpu_plugin_properties = {
{ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::num_requests(2),
ov::enable_profiling(false)}};
const std::vector<ov::AnyMap> cpu_compileModel_properties = {
{ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY),
ov::hint::num_requests(10),
ov::enable_profiling(true)}};
INSTANTIATE_TEST_SUITE_P(smoke_cpuCompileModelBehaviorTests,
OVSetPropComplieModleGetPropTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(cpu_plugin_properties),
::testing::ValuesIn(cpu_compileModel_properties)),
OVSetPropComplieModleGetPropTests::getTestCaseName);
const std::vector<ov::AnyMap> auto_multi_plugin_properties = {
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::num_requests(2),
ov::hint::allow_auto_batching(false),
ov::enable_profiling(false)}};
const std::vector<ov::AnyMap> auto_multi_compileModel_properties = {
{ov::device::priorities(CommonTestUtils::DEVICE_CPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY),
ov::hint::num_requests(10),
ov::hint::allow_auto_batching(true),
ov::enable_profiling(true)}};
INSTANTIATE_TEST_SUITE_P(smoke_AutoMultiCompileModelBehaviorTests,
OVSetPropComplieModleGetPropTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_AUTO,
CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(auto_multi_plugin_properties),
::testing::ValuesIn(auto_multi_compileModel_properties)),
OVSetPropComplieModleGetPropTests::getTestCaseName);
} // namespace

View File

@@ -262,4 +262,55 @@ namespace {
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(ConfigsCheck)),
CorrectConfigCheck::getTestCaseName);
const std::vector<std::map<std::string, std::string>> cpu_prop_config = {{
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::THROUGHPUT},
{InferenceEngine::PluginConfigParams::KEY_EXCLUSIVE_ASYNC_REQUESTS, InferenceEngine::PluginConfigParams::YES},
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT_NUM_REQUESTS, "2"},
{InferenceEngine::PluginConfigParams::KEY_PERF_COUNT, InferenceEngine::PluginConfigParams::NO},
}};
const std::vector<std::map<std::string, std::string>> cpu_loadNetWork_config = {{
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::LATENCY},
{InferenceEngine::PluginConfigParams::KEY_EXCLUSIVE_ASYNC_REQUESTS, InferenceEngine::PluginConfigParams::NO},
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT_NUM_REQUESTS, "10"},
{InferenceEngine::PluginConfigParams::KEY_PERF_COUNT, InferenceEngine::PluginConfigParams::YES},
}};
const std::vector<std::map<std::string, std::string>> auto_multi_prop_config = {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_CPU},
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::THROUGHPUT},
{InferenceEngine::PluginConfigParams::KEY_EXCLUSIVE_ASYNC_REQUESTS, InferenceEngine::PluginConfigParams::YES},
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT_NUM_REQUESTS, "2"},
{InferenceEngine::PluginConfigParams::KEY_ALLOW_AUTO_BATCHING, InferenceEngine::PluginConfigParams::NO},
{InferenceEngine::PluginConfigParams::KEY_PERF_COUNT, InferenceEngine::PluginConfigParams::NO}}};
const std::vector<std::map<std::string, std::string>> auto_multi_loadNetWork_config = {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_CPU},
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::LATENCY},
{InferenceEngine::PluginConfigParams::KEY_EXCLUSIVE_ASYNC_REQUESTS, InferenceEngine::PluginConfigParams::NO},
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT_NUM_REQUESTS, "10"},
{InferenceEngine::PluginConfigParams::KEY_ALLOW_AUTO_BATCHING, InferenceEngine::PluginConfigParams::YES},
{InferenceEngine::PluginConfigParams::KEY_PERF_COUNT, InferenceEngine::PluginConfigParams::YES}}};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
SetPropLoadNetWorkGetPropTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(cpu_prop_config),
::testing::ValuesIn(cpu_loadNetWork_config)),
SetPropLoadNetWorkGetPropTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests,
SetPropLoadNetWorkGetPropTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(auto_multi_prop_config),
::testing::ValuesIn(auto_multi_loadNetWork_config)),
SetPropLoadNetWorkGetPropTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests,
SetPropLoadNetWorkGetPropTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(auto_multi_prop_config),
::testing::ValuesIn(auto_multi_loadNetWork_config)),
SetPropLoadNetWorkGetPropTests::getTestCaseName);
} // namespace

View File

@@ -36,4 +36,41 @@ INSTANTIATE_TEST_SUITE_P(smoke_AutoMultiBehaviorTests, OVPropertiesTests,
::testing::Values(CommonTestUtils::DEVICE_AUTO, CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(auto_multi_properties)),
OVPropertiesTests::getTestCaseName);
const std::vector<ov::AnyMap> gpu_plugin_properties = {
{ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::num_requests(2),
ov::enable_profiling(false)}};
const std::vector<ov::AnyMap> gpu_compileModel_properties = {
{ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY),
ov::hint::num_requests(10),
ov::enable_profiling(true)}};
INSTANTIATE_TEST_SUITE_P(smoke_gpuCompileModelBehaviorTests,
OVSetPropComplieModleGetPropTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(gpu_plugin_properties),
::testing::ValuesIn(gpu_compileModel_properties)),
OVSetPropComplieModleGetPropTests::getTestCaseName);
const std::vector<ov::AnyMap> auto_multi_plugin_properties = {
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT),
ov::hint::num_requests(2),
ov::hint::allow_auto_batching(false),
ov::enable_profiling(false)}};
const std::vector<ov::AnyMap> auto_multi_compileModel_properties = {
{ov::device::priorities(CommonTestUtils::DEVICE_GPU),
ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY),
ov::hint::num_requests(10),
ov::hint::allow_auto_batching(true),
ov::enable_profiling(true)}};
INSTANTIATE_TEST_SUITE_P(smoke_AutoMultiCompileModelBehaviorTests,
OVSetPropComplieModleGetPropTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_AUTO,
CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(auto_multi_plugin_properties),
::testing::ValuesIn(auto_multi_compileModel_properties)),
OVSetPropComplieModleGetPropTests::getTestCaseName);
} // namespace

View File

@@ -298,4 +298,55 @@ namespace {
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(ExcluAsyncReqConfigs)),
CorrectConfigTests::getTestCaseName);
const std::vector<std::map<std::string, std::string>> gpu_prop_config = {{
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::THROUGHPUT},
{InferenceEngine::PluginConfigParams::KEY_EXCLUSIVE_ASYNC_REQUESTS, InferenceEngine::PluginConfigParams::YES},
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT_NUM_REQUESTS, "2"},
{InferenceEngine::PluginConfigParams::KEY_PERF_COUNT, InferenceEngine::PluginConfigParams::NO},
}};
const std::vector<std::map<std::string, std::string>> gpu_loadNetWork_config = {{
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::LATENCY},
{InferenceEngine::PluginConfigParams::KEY_EXCLUSIVE_ASYNC_REQUESTS, InferenceEngine::PluginConfigParams::NO},
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT_NUM_REQUESTS, "10"},
{InferenceEngine::PluginConfigParams::KEY_PERF_COUNT, InferenceEngine::PluginConfigParams::YES},
}};
const std::vector<std::map<std::string, std::string>> auto_multi_prop_config = {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_GPU},
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::THROUGHPUT},
{InferenceEngine::PluginConfigParams::KEY_EXCLUSIVE_ASYNC_REQUESTS, InferenceEngine::PluginConfigParams::YES},
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT_NUM_REQUESTS, "2"},
{InferenceEngine::PluginConfigParams::KEY_ALLOW_AUTO_BATCHING, InferenceEngine::PluginConfigParams::NO},
{InferenceEngine::PluginConfigParams::KEY_PERF_COUNT, InferenceEngine::PluginConfigParams::NO}}};
const std::vector<std::map<std::string, std::string>> auto_multi_loadNetWork_config = {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_GPU},
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::LATENCY},
{InferenceEngine::PluginConfigParams::KEY_EXCLUSIVE_ASYNC_REQUESTS, InferenceEngine::PluginConfigParams::NO},
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT_NUM_REQUESTS, "10"},
{InferenceEngine::PluginConfigParams::KEY_ALLOW_AUTO_BATCHING, InferenceEngine::PluginConfigParams::YES},
{InferenceEngine::PluginConfigParams::KEY_PERF_COUNT, InferenceEngine::PluginConfigParams::YES}}};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
SetPropLoadNetWorkGetPropTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(gpu_prop_config),
::testing::ValuesIn(gpu_loadNetWork_config)),
SetPropLoadNetWorkGetPropTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests,
SetPropLoadNetWorkGetPropTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(auto_multi_prop_config),
::testing::ValuesIn(auto_multi_loadNetWork_config)),
SetPropLoadNetWorkGetPropTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests,
SetPropLoadNetWorkGetPropTests,
::testing::Combine(::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(auto_multi_prop_config),
::testing::ValuesIn(auto_multi_loadNetWork_config)),
SetPropLoadNetWorkGetPropTests::getTestCaseName);
} // namespace

View File

@@ -47,6 +47,17 @@ public:
using OVPropertiesIncorrectTests = OVPropertiesTests;
using OVPropertiesDefaultTests = OVPropertiesTests;
using CompileModelPropertiesParams = std::tuple<std::string, AnyMap, AnyMap>;
class OVSetPropComplieModleGetPropTests : public testing::WithParamInterface<CompileModelPropertiesParams>,
public OVPropertiesBase {
public:
static std::string getTestCaseName(testing::TestParamInfo<CompileModelPropertiesParams> obj);
void SetUp() override;
AnyMap compileModelProperties;
};
} // namespace behavior
} // namespace test
} // namespace ov

View File

@@ -181,6 +181,51 @@ public:
std::string key;
};
using LoadNetWorkPropertiesParams = std::tuple<
std::string, // Device name
std::map<std::string, std::string>, // Configuration key and its default value
std::map<std::string, std::string> // Configuration key and its default value
>;
class SetPropLoadNetWorkGetPropTests : public testing::WithParamInterface<LoadNetWorkPropertiesParams>,
public ConfigBase {
public:
static std::string getTestCaseName(testing::TestParamInfo<LoadNetWorkPropertiesParams> obj) {
std::string targetDevice;
std::map<std::string, std::string> configuration;
std::map<std::string, std::string> loadNetWorkConfig;
std::tie(targetDevice, configuration, loadNetWorkConfig) = obj.param;
std::ostringstream result;
result << "targetDevice=" << targetDevice << "_";
if (!configuration.empty()) {
result << "configItem=";
for (auto& configItem : configuration) {
result << configItem.first << "_" << configItem.second << "_";
}
}
if (!loadNetWorkConfig.empty()) {
result << "loadNetWorkConfig=";
for (auto& configItem : loadNetWorkConfig) {
result << configItem.first << "_" << configItem.second << "_";
}
}
return result.str();
}
void SetUp() override {
SKIP_IF_CURRENT_TEST_IS_DISABLED();
std::map<std::string, std::string> entry;
std::tie(targetDevice, configuration, loadNetWorkConfig) = this->GetParam();
function = ngraph::builder::subgraph::makeConvPoolRelu();
cnnNet = InferenceEngine::CNNNetwork(function);
}
public:
std::map<std::string, std::string> loadNetWorkConfig;
};
using EmptyConfigTests = BehaviorTestsEmptyConfig;
using CorrectSingleOptionDefaultValueConfigTests = BehaviorTestsSingleOptionDefault;
using CorrectSingleOptionCustomValueConfigTests = BehaviorTestsSingleOptionCustom;

View File

@@ -44,6 +44,28 @@ void OVPropertiesTests::TearDown() {
}
}
std::string OVSetPropComplieModleGetPropTests::getTestCaseName(testing::TestParamInfo<CompileModelPropertiesParams> obj) {
std::string device_name;
AnyMap properties;
AnyMap compileModelProperties;
std::tie(device_name, properties, compileModelProperties) = obj.param;
std::ostringstream result;
result << "device_name=" << device_name << "_";
if (!properties.empty()) {
result << "properties=" << util::join(util::split(util::to_string(properties), ' '), "_");
}
if (!compileModelProperties.empty()) {
result << "_compileModelProp=" << util::join(util::split(util::to_string(compileModelProperties), ' '), "_");
}
return result.str();
}
void OVSetPropComplieModleGetPropTests::SetUp() {
SKIP_IF_CURRENT_TEST_IS_DISABLED();
std::tie(device_name, properties, compileModelProperties) = this->GetParam();
model = ngraph::builder::subgraph::makeConvPoolRelu();
}
TEST_P(OVEmptyPropertiesTests, SetEmptyProperties) {
OV_ASSERT_NO_THROW(core->get_property(device_name, ov::supported_properties));
OV_ASSERT_NO_THROW(core->set_property(device_name, AnyMap{}));
@@ -96,6 +118,26 @@ TEST_P(OVPropertiesDefaultTests, CheckDefaultValues) {
}
}
TEST_P(OVSetPropComplieModleGetPropTests, SetPropertyComplieModelGetProperty) {
OV_ASSERT_NO_THROW(core->set_property(device_name, properties));
ov::CompiledModel exeNetWork;
OV_ASSERT_NO_THROW(exeNetWork = core->compile_model(model, device_name, compileModelProperties));
for (const auto& property_item : compileModelProperties) {
Any exeNetProperty;
OV_ASSERT_NO_THROW(exeNetProperty = exeNetWork.get_property(property_item.first));
ASSERT_EQ(property_item.second.as<std::string>(), exeNetProperty.as<std::string>());
}
//the value of get property should be the same as set property
for (const auto& property_item : properties) {
Any property;
OV_ASSERT_NO_THROW(property = core->get_property(device_name, property_item.first));
ASSERT_EQ(property_item.second.as<std::string>(), property.as<std::string>());
}
}
} // namespace behavior
} // namespace test
} // namespace ov

View File

@@ -191,4 +191,23 @@ TEST_P(ExclusiveAsyncReqTests, excluAsyncReqTests) {
ASSERT_NO_THROW(ie->LoadNetwork(cnnNet, targetDevice, configuration));
}
TEST_P(SetPropLoadNetWorkGetPropTests, SetPropLoadNetWorkGetProperty) {
ASSERT_NO_THROW(ie->SetConfig(configuration, targetDevice));
InferenceEngine::ExecutableNetwork exeNetWork;
ASSERT_NO_THROW(exeNetWork = ie->LoadNetwork(cnnNet, targetDevice, loadNetWorkConfig));
for (const auto& property_item : loadNetWorkConfig) {
InferenceEngine::Parameter exeNetProperty;
ASSERT_NO_THROW(exeNetProperty = exeNetWork.GetConfig(property_item.first));
ASSERT_EQ(property_item.second, exeNetProperty.as<std::string>());
}
// the value of GetConfig should be the same as SetConfig
for (const auto& property_item : configuration) {
InferenceEngine::Parameter property;
ASSERT_NO_THROW(property = ie->GetConfig(targetDevice, property_item.first));
ASSERT_EQ(property_item.second, property.as<std::string>());
}
}
} // namespace BehaviorTestsDefinitions