mirror of
https://gitee.com/openharmony/ai_neural_network_runtime
synced 2024-12-04 05:50:44 +00:00
取消DLSA模型加载卸载传递callingpid
Signed-off-by: w30052974 <wangyifan94@huawei.com>
This commit is contained in:
parent
de6bca6ff8
commit
c449355100
@ -42,7 +42,6 @@ struct Compilation {
|
||||
std::unordered_map<std::string, std::vector<char>> configs;
|
||||
size_t nnrtModelID {0};
|
||||
uint32_t hiaiModelId {0};
|
||||
int32_t callingPid {-1};
|
||||
bool isNeedModelLatency {false};
|
||||
|
||||
~Compilation()
|
||||
|
@ -573,7 +573,7 @@ OH_NN_ReturnCode AuthenticateModel(const Compilation* compilation)
|
||||
LOGE("Authentication failed, nnrtService Authentication func is nullptr.");
|
||||
return OH_NN_INVALID_PARAMETER;
|
||||
}
|
||||
ret = nnrtService.Authentication(compilation->callingPid);
|
||||
ret = nnrtService.Authentication();
|
||||
if (ret != static_cast<int>(OH_NN_SUCCESS)) {
|
||||
LOGE("Authentication failed, input model cannot run by npu.");
|
||||
return static_cast<OH_NN_ReturnCode>(ret);
|
||||
@ -595,13 +595,6 @@ OH_NN_ReturnCode Authentication(Compilation** compilation)
|
||||
return OH_NN_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
auto iter = compilationImpl->configs.find("callingPid");
|
||||
if (iter == compilationImpl->configs.end()) {
|
||||
LOGE("missing 'callingPid' parameter in compilation configs.");
|
||||
} else {
|
||||
compilationImpl->callingPid = std::atoi((iter->second).data());
|
||||
}
|
||||
|
||||
const NNRtServiceApi& nnrtService = NNRtServiceApi::GetInstance();
|
||||
if (!nnrtService.IsServiceAvaliable()) {
|
||||
LOGW("Authentication failed, fail to get nnrt service, skip Authentication.");
|
||||
@ -1296,7 +1289,7 @@ OH_NN_ReturnCode SetModelId(const Compilation* compilation)
|
||||
}
|
||||
|
||||
int ret = nnrtService.SetModelID(
|
||||
compilation->callingPid, compilation->hiaiModelId, compilation->nnrtModelID);
|
||||
compilation->hiaiModelId, compilation->nnrtModelID);
|
||||
if (ret != static_cast<int>(OH_NN_SUCCESS)) {
|
||||
LOGE("SetModelId failed, fail to set modelId.");
|
||||
return static_cast<OH_NN_ReturnCode>(ret);
|
||||
@ -1335,8 +1328,8 @@ OH_NN_ReturnCode ExecutorPrepare(Executor** executor, Compilation** compilation)
|
||||
return ret;
|
||||
}
|
||||
|
||||
LOGD("ExecutorPrepare parameter, callingPid: %{public}d, hiaiModelId: %{public}u, nnrtModelId: %{public}zu.",
|
||||
compilationImpl->callingPid, compilationImpl->hiaiModelId, compilationImpl->nnrtModelID);
|
||||
LOGD("ExecutorPrepare parameter, hiaiModelId: %{public}u, nnrtModelId: %{public}zu.",
|
||||
compilationImpl->hiaiModelId, compilationImpl->nnrtModelID);
|
||||
|
||||
ret = Scheduling(&compilationImpl);
|
||||
if (ret != OH_NN_SUCCESS) {
|
||||
@ -1345,11 +1338,6 @@ OH_NN_ReturnCode ExecutorPrepare(Executor** executor, Compilation** compilation)
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, std::vector<char>> configMap;
|
||||
std::string callingPidStr = std::to_string(compilationImpl->callingPid);
|
||||
std::vector<char> vecCallingPid(callingPidStr.begin(), callingPidStr.end());
|
||||
vecCallingPid.emplace_back('\0');
|
||||
configMap["callingPid"] = vecCallingPid;
|
||||
|
||||
std::string hiaiModelIdStr = std::to_string(compilationImpl->hiaiModelId);
|
||||
std::vector<char> vechiaiModelId(hiaiModelIdStr.begin(), hiaiModelIdStr.end());
|
||||
vechiaiModelId.emplace_back('\0');
|
||||
|
@ -33,10 +33,10 @@ public:
|
||||
size_t (*GetNNRtModelIDFromCache)(const char* path, const char* modelName) = nullptr;
|
||||
size_t (*GetNNRtModelIDFromBuffer)(const void* buffer, size_t size) = nullptr;
|
||||
size_t (*GetNNRtModelIDFromModel)(void* model) = nullptr;
|
||||
int (*SetModelID)(int callingPid, uint32_t hiaimodelID, size_t nnrtModelID) = nullptr;
|
||||
int (*SetModelID)(uint32_t hiaimodelID, size_t nnrtModelID) = nullptr;
|
||||
int (*IsSupportAuthentication)(bool* supportStat) = nullptr;
|
||||
int (*IsSupportScheduling)(bool* supportStat) = nullptr;
|
||||
int (*Authentication)(int callingPid) = nullptr;
|
||||
int (*Authentication)() = nullptr;
|
||||
int (*Scheduling)(uint32_t hiaiModelId, bool* needModelLatency, const char* cachePath) = nullptr;
|
||||
int (*UpdateModelLatency)(uint32_t hiaiModelId, int modelLatency) = nullptr;
|
||||
int (*Unload)(uint32_t hiaiModelId) = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user