the proxy device with id should be also a proxy device. (#21248)

This commit is contained in:
Wang, Yang 2023-11-24 16:09:46 +08:00 committed by GitHub
parent 44310535ff
commit c491381a0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 3 deletions

View File

@ -325,8 +325,9 @@ bool ov::CoreImpl::is_proxy_device(const ov::Plugin& plugin) const {
}
bool ov::CoreImpl::is_proxy_device(const std::string& dev_name) const {
#ifdef PROXY_PLUGIN_ENABLED
return pluginRegistry.find(dev_name) != pluginRegistry.end() &&
pluginRegistry.at(dev_name).pluginCreateFunc == ov::proxy::create_plugin;
auto parsed = ov::parseDeviceNameIntoConfig(dev_name);
return pluginRegistry.find(parsed._deviceName) != pluginRegistry.end() &&
pluginRegistry.at(parsed._deviceName).pluginCreateFunc == ov::proxy::create_plugin;
#else
return false;
#endif

View File

@ -9,7 +9,7 @@
using namespace ov::proxy::tests;
TEST_F(ProxyTests, can_parse_and_inherit_batch_property) {
register_plugin_support_reshape(core, "MOCK_DEVICE", {{ov::proxy::configuration::alias.name(), "ALIAS_MOCK"}});
register_plugin_support_reshape(core, "MOCK_DEVICE", {{ov::proxy::configuration::alias.name(), "MOCK_DEVICE"}});
auto available_devices = core.get_available_devices();
auto model = create_model_with_add();
auto compiled_model_default = core.compile_model(model, "MOCK_DEVICE", ov::hint::performance_mode("THROUGHPUT"));
@ -31,4 +31,29 @@ TEST_F(ProxyTests, can_parse_and_inherit_batch_property) {
ov::hint::performance_mode("THROUGHPUT"),
ov::hint::allow_auto_batching(false));
EXPECT_ANY_THROW(compiled_model_no_batch.get_property(ov::auto_batch_timeout));
}
TEST_F(ProxyTests, can_parse_and_inherit_batch_property_for_device_name_with_id) {
register_plugin_support_reshape(core, "MOCK_DEVICE", {{ov::proxy::configuration::alias.name(), "MOCK_DEVICE"}});
auto available_devices = core.get_available_devices();
auto model = create_model_with_add();
auto compiled_model_default = core.compile_model(model, "MOCK_DEVICE.1", ov::hint::performance_mode("THROUGHPUT"));
#ifdef ENABLE_AUTO_BATCH
EXPECT_NO_THROW(compiled_model_default.get_property(ov::auto_batch_timeout)); // batch enabled by default
EXPECT_EQ(compiled_model_default.get_property(ov::auto_batch_timeout), 1000); // default value
#endif
auto compiled_model_with_batch = core.compile_model(model,
"MOCK_DEVICE.1",
ov::hint::performance_mode("THROUGHPUT"),
ov::hint::allow_auto_batching(true),
ov::auto_batch_timeout(8));
#ifdef ENABLE_AUTO_BATCH
EXPECT_NO_THROW(compiled_model_with_batch.get_property(ov::auto_batch_timeout));
EXPECT_EQ(compiled_model_with_batch.get_property(ov::auto_batch_timeout), 8);
#endif
auto compiled_model_no_batch = core.compile_model(model,
"MOCK_DEVICE.2",
ov::hint::performance_mode("THROUGHPUT"),
ov::hint::allow_auto_batching(false));
EXPECT_ANY_THROW(compiled_model_no_batch.get_property(ov::auto_batch_timeout));
}