Bell/fix priority (#13667)

* debug only

Signed-off-by: fishbell <bell.song@intel.com>

* fix model priority with -d AUTO

Signed-off-by: fishbell <bell.song@intel.com>

* add tests

Signed-off-by: fishbell <bell.song@intel.com>

Signed-off-by: fishbell <bell.song@intel.com>
This commit is contained in:
yanlan song
2022-10-28 09:58:25 +08:00
committed by GitHub
parent 694d2f73eb
commit 3f4c53a779
2 changed files with 9 additions and 3 deletions

View File

@@ -131,6 +131,8 @@ std::vector<DeviceInformation> MultiDeviceInferencePlugin::ParseMetaDevices(cons
return "";
};
auto checkPriorityConfig = [&] (const std::string& priString) {
if (priString.empty())
return false;
std::string::size_type pos = 0;
std::string::size_type endpos = 0;
while ((endpos = priString.find(",", pos)) != std::string::npos) {

View File

@@ -162,11 +162,10 @@ TEST_P(ParseMetaDeviceTest, ParseMetaDevicesNotWithPriority) {
bool throwException;
std::tie(priorityDevices, metaDevices, throwException) = this->GetParam();
EXPECT_CALL(*plugin, ParseMetaDevices(_, _)).Times(1);
EXPECT_CALL(*plugin, ParseMetaDevices(_, _)).Times(1 + !throwException);
EXPECT_CALL(*core, GetMetric(_, _, _)).Times(AnyNumber());
EXPECT_CALL(*core, GetConfig(_, _)).Times(AnyNumber());
EXPECT_CALL(*core, GetAvailableDevices()).Times(1);
EXPECT_CALL(*core, GetSupportedConfig(_, _)).Times(metaDevices.size());
EXPECT_CALL(*core, GetAvailableDevices()).Times(1 + !throwException);
if (throwException) {
ASSERT_ANY_THROW(plugin->ParseMetaDevices(priorityDevices, {}));
} else {
@@ -175,6 +174,11 @@ TEST_P(ParseMetaDeviceTest, ParseMetaDevicesNotWithPriority) {
for (unsigned int i = 0 ; i < result.size(); i++) {
EXPECT_EQ(result[i].devicePriority, 0);
}
auto result2 = plugin->ParseMetaDevices(priorityDevices, {{ov::device::priorities.name(), ""}});
compare(result2, metaDevices);
for (unsigned int i = 0 ; i < result.size(); i++) {
EXPECT_EQ(result2[i].devicePriority, 0);
}
}
}