This commit is contained in:
Karan Jakhar 2024-06-12 03:27:28 +02:00 committed by GitHub
commit 87b9da50c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 0 deletions

View File

@ -222,6 +222,7 @@ ov::Any CompiledModel::get_property(const std::string& name) const {
RO_property(ov::intel_cpu::sparse_weights_decompression_rate.name()),
RO_property(ov::hint::dynamic_quantization_group_size.name()),
RO_property(ov::hint::kv_cache_precision.name()),
RO_property(ov::optimal_batch_size.name()),
};
OPENVINO_SUPPRESS_DEPRECATED_START
@ -299,6 +300,8 @@ ov::Any CompiledModel::get_property(const std::string& name) const {
config.fcDynamicQuantizationGroupSize);
} else if (name == ov::hint::kv_cache_precision) {
return decltype(ov::hint::kv_cache_precision)::value_type(config.kvCachePrecision);
} else if (name == ov::optimal_batch_size.name()) {
return decltype(ov::optimal_batch_size)::value_type(1);
}
OPENVINO_THROW("Unsupported property: ", name);
}

View File

@ -445,6 +445,7 @@ ov::Any Plugin::get_ro_property(const std::string& name, const ov::AnyMap& optio
RO_property(ov::device::capabilities.name()),
RO_property(ov::device::type.name()),
RO_property(ov::device::architecture.name()),
RO_property(ov::optimal_batch_size.name()),
};
// the whole config is RW before model is loaded.
std::vector<ov::PropertyName> rwProperties{
@ -536,6 +537,8 @@ ov::Any Plugin::get_ro_property(const std::string& name, const ov::AnyMap& optio
#else
# error "Undefined system processor"
#endif
} else if (name == ov::optimal_batch_size){
return decltype(ov::optimal_batch_size)::value_type(1);
}
OPENVINO_THROW("Cannot get unsupported property: ", name);

View File

@ -37,6 +37,7 @@ TEST_F(OVClassConfigTestCPU, smoke_PluginAllSupportedPropertiesAreAvailable) {
RO_property(ov::device::capabilities.name()),
RO_property(ov::device::type.name()),
RO_property(ov::device::architecture.name()),
RO_property(ov::optimal_batch_size.name()),
// read write
RW_property(ov::num_streams.name()),
RW_property(ov::affinity.name()),
@ -384,4 +385,14 @@ TEST_F(OVClassConfigTestCPU, smoke_PluginCheckCPUDeviceArchitecture) {
#endif
}
TEST_F(OVClassConfigTestCPU, smoke_CpuExceNetworkCheckCPUOptimalBatchSize) {
ov::Core ie;
ov::Any value;
ov::CompiledModel compiledModel;
ASSERT_NO_THROW(compiledModel = ie.compile_model(model, deviceName));
ASSERT_NO_THROW(value = compiledModel.get_property(ov::optimal_batch_size));
ASSERT_EQ(value.as<unsigned int>(), 1);
}
} // namespace