模型共享内存

Signed-off-by: w30052974 <wangyifan94@huawei.com>
This commit is contained in:
w30052974 2024-08-28 17:21:08 +08:00
parent 9d4639a681
commit 04c99975b7

View File

@ -418,11 +418,10 @@ OH_NN_ReturnCode ParseDynamicDimsFromExtensions(
return OH_NN_SUCCESS;
}
OH_NN_ReturnCode ParseExtensionConfigs(
OH_NN_ReturnCode CheckExtensionConfigs(
const std::unordered_map<std::string, std::vector<std::pair<char*, size_t>>>& extensionMap,
const mindspore::lite::LiteGraph* pLiteGraph, ExtensionConfig& extensionConfig)
ExtensionConfig& extensionConfig)
{
extensionConfig.tuningStrategy = TuningStrategy::ON_DEVICE_PREPROCESS_TUNING;
if (extensionMap.find(EXTENSION_KEY_QUANT_BUFFER) != extensionMap.end()) {
const std::vector<std::pair<char*, size_t>>& value = extensionMap.at(EXTENSION_KEY_QUANT_BUFFER);
if (value.empty()) {
@ -461,6 +460,19 @@ OH_NN_ReturnCode ParseExtensionConfigs(
LOGI("ParseExtensionConfigs opLayout:%{public}s.", ops.c_str());
}
}
return OH_NN_SUCCESS;
}
OH_NN_ReturnCode ParseExtensionConfigs(
const std::unordered_map<std::string, std::vector<std::pair<char*, size_t>>>& extensionMap,
const mindspore::lite::LiteGraph* pLiteGraph, ExtensionConfig& extensionConfig)
{
extensionConfig.tuningStrategy = TuningStrategy::ON_DEVICE_PREPROCESS_TUNING;
OH_NN_ReturnCode ret = CheckExtensionConfigs(extensionMap, extensionConfig);
if (ret != OH_NN_SUCCESS) {
LOGE("CheckExtensionConfigs failed.");
return ret;
}
if (extensionMap.find(EXTENSION_KEY_INPUT_DIMS) != extensionMap.end() &&
extensionMap.find(EXTENSION_KEY_DYNAMIC_DIMS) != extensionMap.end()) {
auto returnCode = ParseDynamicDimsFromExtensions(extensionMap, pLiteGraph, extensionConfig);