This commit is contained in:
YutingGao7 2024-06-12 03:27:51 +02:00 committed by GitHub
commit 777c045b3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 48 additions and 11 deletions

View File

@ -83,6 +83,32 @@ Configuration::Configuration(const ov::AnyMap& config, const Configuration& defa
log_level = value.as<ov::log::Level>();
} else if (ov::hint::model_priority == key) {
model_priority = value.as<ov::hint::Priority>();
} else if (ov::optimal_batch_size == key) {
try {
auto tmp_i = value.as<unsigned int>();
optimal_batch_size = tmp_i;
} catch (const std::exception&) {
OPENVINO_THROW("Incorrect value ", value.as<std::string>(), "for property key ", key);
}
} else if (ov::max_batch_size == key) {
try {
auto tmp_i = value.as<uint32_t>();
max_batch_size = tmp_i;
} catch (const std::exception&) {
OPENVINO_THROW("Incorrect value ", value.as<std::string>(), "for property key ", key);
}
} else if (ov::loaded_from_cache == key) {
loaded_from_cache = value.as<bool>();
} else if (ov::compilation_num_threads == key) {
try {
auto tmp_i = value.as<int32_t>();
if (tmp_i >= 0)
compilation_num_threads = tmp_i;
else
OPENVINO_THROW("Incorrect value, it should be unsigned integer: ", key);
} catch (const std::exception&) {
OPENVINO_THROW("Incorrect value ", value.as<std::string>(), "for property key ", key);
}
} else if (throwOnUnsupported) {
OPENVINO_THROW("Property was not found: ", key);
}
@ -116,6 +142,14 @@ ov::Any Configuration::Get(const std::string& name) const {
return log_level;
} else if (name == ov::hint::model_priority) {
return model_priority;
} else if (name == ov::optimal_batch_size) {
return optimal_batch_size;
} else if (name == ov::max_batch_size) {
return max_batch_size;
} else if (name == ov::loaded_from_cache) {
return loaded_from_cache;
} else if (name == ov::compilation_num_threads) {
return compilation_num_threads;
} else {
OPENVINO_THROW("Property was not found: ", name);
}

View File

@ -47,6 +47,12 @@ struct Configuration {
ov::log::Level log_level = ov::log::Level::NO;
ov::hint::Priority model_priority = ov::hint::Priority::DEFAULT;
int optimal_batch_size = 1;
int max_batch_size = 1;
bool loaded_from_cache = false;
int compilation_num_threads = 1;
int inference_num_threads = 1;
};
// ! [configuration:header]

View File

@ -252,7 +252,10 @@ ov::Any ov::template_plugin::Plugin::get_property(const std::string& name, const
ov::device::capabilities,
ov::device::type,
ov::range_for_async_infer_requests,
ov::execution_devices};
ov::execution_devices,
ov::optimal_batch_size,
ov::max_batch_size,
ov::loaded_from_cache};
return ro_properties;
};
const auto& default_rw_properties = []() {
@ -264,7 +267,10 @@ ov::Any ov::template_plugin::Plugin::get_property(const std::string& name, const
ov::hint::execution_mode,
ov::num_streams,
ov::template_plugin::disable_transformations,
ov::log::level};
ov::log::level,
ov::enable_mmap,
ov::compilation_num_threads,
ov::inference_num_threads};
return rw_properties;
};
if (ov::supported_properties == name) {

View File

@ -359,11 +359,6 @@ OVPropertiesTestsWithCompileModelProps::getRWOptionalPropertiesValues(
}
}
if (props.empty() || std::find(props.begin(), props.end(), ov::enable_mmap.name()) != props.end()) {
res.push_back({ov::enable_mmap(true)});
res.push_back({ov::enable_mmap(false)});
}
if (props.empty() || std::find(props.begin(), props.end(), ov::log::level.name()) != props.end()) {
ov::log::Level log_levels[] = {ov::log::Level::NO , ov::log::Level::ERR, ov::log::Level::WARNING,
ov::log::Level::INFO, ov::log::Level::DEBUG, ov::log::Level::TRACE};
@ -407,10 +402,6 @@ OVPropertiesTestsWithCompileModelProps::getWrongRWOptionalPropertiesValues(
res.push_back({{ov::hint::scheduling_core_type.name(), -1}});
}
if (props.empty() || std::find(props.begin(), props.end(), ov::enable_mmap.name()) != props.end()) {
res.push_back({{ov::enable_mmap.name(), -10}});
}
if (props.empty() || std::find(props.begin(), props.end(), ov::log::level.name()) != props.end()) {
res.push_back({{ov::log::level.name(), -3}});
}