forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AUTO] refine the logic of checking if target device is virtual device (
openvinotoolkit#28307) ### Details: - refine the logic to check if the target device is virtual device. - Fixed the issue that AUTO:NPU,CPU goes to CPU directly (mis-detecting NPU.AUTO_DETECT device as AUTO device, can be reproduced on LNL machince) ### Tickets: - CVS-160153 --------- Co-authored-by: Chen Peter <peter.chen@intel.com>
- Loading branch information
1 parent
c8c1438
commit 308cb00
Showing
7 changed files
with
161 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Copyright (C) 2018-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "include/auto_unit_test.hpp" | ||
|
||
using namespace ov::mock_auto_plugin; | ||
using ConfigParams = std::tuple<std::string, // Priority devices | ||
bool // if throw exception | ||
>; | ||
class IsMetaDeviceInCandidateListTest : public tests::AutoTest, public ::testing::TestWithParam<ConfigParams> { | ||
public: | ||
static std::string getTestCaseName(testing::TestParamInfo<ConfigParams> obj) { | ||
std::string priorityDevices; | ||
bool expectedRet; | ||
std::tie(priorityDevices, expectedRet) = obj.param; | ||
std::ostringstream result; | ||
result << "priorityDevices_" << priorityDevices; | ||
if (expectedRet) { | ||
result << "_expection_true"; | ||
} else { | ||
result << "_expection_false"; | ||
} | ||
return result.str(); | ||
} | ||
|
||
void SetUp() override { | ||
ON_CALL(*plugin, is_meta_device).WillByDefault([this](const std::string& priorityDevices) { | ||
return plugin->Plugin::is_meta_device(priorityDevices); | ||
}); | ||
std::tie(priorityDevices, expectedRet) = GetParam(); | ||
} | ||
|
||
protected: | ||
// get Parameter | ||
std::string priorityDevices; | ||
bool expectedRet; | ||
}; | ||
|
||
TEST_P(IsMetaDeviceInCandidateListTest, CheckMetaDeviceWithPriority) { | ||
EXPECT_CALL(*plugin, is_meta_device(_)).Times(1); | ||
ASSERT_EQ(plugin->is_meta_device(priorityDevices), expectedRet); | ||
} | ||
|
||
const std::vector<ConfigParams> testConfigs = {ConfigParams{"CPU", false}, | ||
ConfigParams{"GPU", false}, | ||
ConfigParams{"OTHER", false}, | ||
ConfigParams{"GPU.0", false}, | ||
ConfigParams{"GPU.1", false}, | ||
ConfigParams{"GPU.AUTO_DETECT", false}, | ||
ConfigParams{"GPU.MULTI_DETECT", false}, | ||
ConfigParams{"OTHER.AUTO_DETECT", false}, | ||
ConfigParams{"CPU,OTHER.AUTO_DETECT", false}, | ||
ConfigParams{"GPU,OTHER.AUTO_DETECT", false}, | ||
ConfigParams{"GPU,OTHER.MULTI_DETECT", false}, | ||
ConfigParams{"AUTO", true}, | ||
ConfigParams{"AUTO,CPU", true}, | ||
ConfigParams{"OTHER,AUTO", true}, | ||
ConfigParams{"AUTO:CPU", true}, | ||
ConfigParams{"AUTO:OTHER", true}, | ||
ConfigParams{"AUTO.AUTO_DETECT", true}, | ||
ConfigParams{"AUTO:AUTO.AUTO_DETECT", true}, | ||
ConfigParams{"CPU,AUTO:AUTO.AUTO_DETECT", true}, | ||
ConfigParams{"MULTI", true}, | ||
ConfigParams{"CPU,MULTI", true}, | ||
ConfigParams{"CPU,MULTI.0", true}, | ||
ConfigParams{"MULTI:CPU", true}, | ||
ConfigParams{"GPU,MULTI:CPU", true}, | ||
ConfigParams{"MULTI:OTHER", true}, | ||
ConfigParams{"MULTI.AUTO_DETECT", true}, | ||
ConfigParams{"MULTI:AUTO.AUTO_DETECT", true}, | ||
ConfigParams{"GPU,MULTI:AUTO.AUTO_DETECT", true}, | ||
ConfigParams{"GPU,MULTI:MULTI.AUTO_DETECT", true}}; | ||
|
||
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, | ||
IsMetaDeviceInCandidateListTest, | ||
::testing::ValuesIn(testConfigs), | ||
IsMetaDeviceInCandidateListTest::getTestCaseName); |