[GPU] Introduce ov::config_device_id internal property to the new API (#17820)

* [GPU] Introduce ov::config_device_id internal property to the new API. Fix setting property for specific device

* Introduce ov::internal::supported_properties

* Fix caching tests

* Fix win tests

* Fix Proxy tests

* Replace CONFIG_KEY_INTERNAL(CONFIG_DEVICE_ID) by ov::internal::config_device_id in PROXY plugin

* Review comments
This commit is contained in:
Nadezhda Ageeva authored and GitHub committed 2023-07-12 10:03:35 +00:00
1 parent b30bd0d3e4
commit 3330cd69a7
28 files changed
+300 -146

No files matched your search

@@ -38,6 +38,7 @@ class Plugin : public InferenceEngine::IInferencePlugin {
RemoteCLContext::Ptr get_default_context(const std::string& device_id) const;
std::vector<ov::PropertyName> get_supported_properties() const;
std::vector<ov::PropertyName> get_supported_internal_properties() const;
std::vector<std::string> get_device_capabilities(const cldnn::device_info& info) const;
uint32_t get_optimal_batch_size(const std::map<std::string, InferenceEngine::Parameter>& options) const;
uint32_t get_max_batch_size(const std::map<std::string, InferenceEngine::Parameter>& options) const;
@@ -264,7 +264,6 @@ std::vector<std::string> LegacyAPIHelper::get_supported_metrics() {
GPU_METRIC_KEY(UARCH_VERSION),
GPU_METRIC_KEY(EXECUTION_UNITS_COUNT),
GPU_METRIC_KEY(MEMORY_STATISTICS),
ov::caching_properties.name(),
};
return supported_metrics;
+16 -6
View File
@@ -280,9 +280,11 @@ void Plugin::SetConfig(const std::map<std::string, std::string> &config) {
}
};
if (config.find(PluginConfigInternalParams::KEY_CONFIG_DEVICE_ID) != config.end()) {
std::string device_id = config.at(PluginConfigInternalParams::KEY_CONFIG_DEVICE_ID);
update_config(m_configs_map.at(device_id), config);
if (config.find(ov::internal::config_device_id.name()) != config.end()) {
std::string device_id = config.at(ov::internal::config_device_id.name());
auto config_for_device = config;
config_for_device.erase(ov::internal::config_device_id.name());
update_config(m_configs_map.at(device_id), config_for_device);
} else {
std::string device_id = get_device_id_from_config(config);
if (!device_id.empty()) {
@@ -603,6 +605,8 @@ Parameter Plugin::GetMetric(const std::string& name, const std::map<std::string,
// earler than querying actual ID to avoid exceptions when no devices are found
if (name == ov::supported_properties) {
return decltype(ov::supported_properties)::value_type {get_supported_properties()};
} else if (ov::internal::supported_properties == name) {
return decltype(ov::internal::supported_properties)::value_type{get_supported_internal_properties()};
} else if (name == METRIC_KEY(SUPPORTED_METRICS)) {
IE_SET_METRIC_RETURN(SUPPORTED_METRICS, LegacyAPIHelper::get_supported_metrics());
} else if (name == METRIC_KEY(SUPPORTED_CONFIG_KEYS)) {
@@ -612,14 +616,14 @@ Parameter Plugin::GetMetric(const std::string& name, const std::map<std::string,
for (auto const& dev : device_map)
availableDevices.push_back(dev.first);
return decltype(ov::available_devices)::value_type {availableDevices};
} else if (name == ov::caching_properties) {
} else if (name == ov::internal::caching_properties) {
std::vector<ov::PropertyName> cachingProperties;
cachingProperties.push_back(ov::PropertyName(ov::device::architecture.name(), PropertyMutability::RO));
cachingProperties.push_back(ov::PropertyName(ov::intel_gpu::execution_units_count.name(), PropertyMutability::RO));
cachingProperties.push_back(ov::PropertyName(ov::intel_gpu::driver_version.name(), PropertyMutability::RO));
cachingProperties.push_back(ov::PropertyName(ov::hint::inference_precision.name(), PropertyMutability::RW));
cachingProperties.push_back(ov::PropertyName(ov::hint::execution_mode.name(), PropertyMutability::RW));
return decltype(ov::caching_properties)::value_type(cachingProperties);
return decltype(ov::internal::caching_properties)::value_type(cachingProperties);
} else if (name == METRIC_KEY(IMPORT_EXPORT_SUPPORT)) {
IE_SET_METRIC_RETURN(IMPORT_EXPORT_SUPPORT, true);
}
@@ -730,7 +734,6 @@ std::vector<ov::PropertyName> Plugin::get_supported_properties() const {
ov::PropertyName{ov::range_for_streams.name(), PropertyMutability::RO},
ov::PropertyName{ov::optimal_batch_size.name(), PropertyMutability::RO},
ov::PropertyName{ov::max_batch_size.name(), PropertyMutability::RO},
ov::PropertyName{ov::caching_properties.name(), PropertyMutability::RO},
ov::PropertyName{ov::device::architecture.name(), PropertyMutability::RO},
ov::PropertyName{ov::device::full_name.name(), PropertyMutability::RO},
ov::PropertyName{ov::device::uuid.name(), PropertyMutability::RO},
@@ -762,6 +765,13 @@ std::vector<ov::PropertyName> Plugin::get_supported_properties() const {
return supported_properties;
}
std::vector<ov::PropertyName> Plugin::get_supported_internal_properties() const {
static const std::vector<ov::PropertyName> supported_internal_properties = {
ov::PropertyName{ov::internal::caching_properties.name(), ov::PropertyMutability::RO},
ov::PropertyName{ov::internal::config_device_id.name(), ov::PropertyMutability::WO}};
return supported_internal_properties;
}
std::vector<std::string> Plugin::get_device_capabilities(const cldnn::device_info& info) const {
std::vector<std::string> capabilities;
@@ -793,7 +793,7 @@ TEST_P(OVGetMetricPropsTest_CACHING_PROPERTIES, GetMetricAndPrintNoThrow) {
ov::hint::execution_mode.name(),
};
ASSERT_NO_THROW(caching_properties = ie.get_property(target_device, ov::caching_properties));
ASSERT_NO_THROW(caching_properties = ie.get_property(target_device, ov::internal::caching_properties));
std::cout << "GPU Caching properties: " << std::endl;
for (auto& prop : caching_properties) {
@@ -807,7 +807,7 @@ TEST_P(OVGetMetricPropsTest_CACHING_PROPERTIES, GetMetricAndPrintNoThrow) {
caching_properties.end());
}
OV_ASSERT_PROPERTY_SUPPORTED(ov::caching_properties);
OV_ASSERT_PROPERTY_SUPPORTED(ov::internal::caching_properties);
}
INSTANTIATE_TEST_SUITE_P(nightly_OVGetMetricPropsTest,
@@ -816,6 +816,10 @@ INSTANTIATE_TEST_SUITE_P(nightly_OVGetMetricPropsTest,
// GetConfig / SetConfig for specific device
INSTANTIATE_TEST_SUITE_P(nightly_OVClassSpecificDevice0Test, OVSpecificDeviceSetConfigTest, ::testing::Values("GPU.0"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassSpecificDevice1Test, OVSpecificDeviceSetConfigTest, ::testing::Values("GPU.1"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassSpecificDevice0Test, OVSpecificDeviceGetConfigTest, ::testing::Values("GPU.0"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassSpecificDevice1Test, OVSpecificDeviceGetConfigTest, ::testing::Values("GPU.1"));