!216 hiai接入NPU调度

Merge pull request !216 from wangyifan/master
This commit is contained in:
openharmony_ci 2024-09-02 08:56:13 +00:00 committed by Gitee
commit 17a0cec2f0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 7 additions and 2 deletions

View File

@ -1244,6 +1244,11 @@ OH_NN_ReturnCode Scheduling(Compilation** compilation)
return OH_NN_INVALID_PARAMETER;
}
std::string cachePath = "";
if (compilationImpl->cachePath != nullptr) {
cachePath = compilationImpl->cachePath;
}
bool supportStat = false;
int ret = nnrtService.IsSupportScheduling(&supportStat);
if (ret != static_cast<int>(OH_NN_SUCCESS)) {
@ -1261,7 +1266,7 @@ OH_NN_ReturnCode Scheduling(Compilation** compilation)
}
bool needModelLatency = false;
ret = nnrtService.Scheduling(compilationImpl->hiaiModelId, &needModelLatency);
ret = nnrtService.Scheduling(compilationImpl->hiaiModelId, &needModelLatency, cachePath.c_str());
if (ret != static_cast<int>(OH_NN_SUCCESS)) {
LOGE("Scheduling failed, some error happened when scheduling.");
return static_cast<OH_NN_ReturnCode>(ret);

View File

@ -37,7 +37,7 @@ public:
int (*IsSupportAuthentication)(bool* supportStat) = nullptr;
int (*IsSupportScheduling)(bool* supportStat) = nullptr;
int (*Authentication)(int callingPid) = nullptr;
int (*Scheduling)(uint32_t hiaiModelId, bool* needModelLatency) = 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;