From e394facd5251fc83089115df6e597a3fa1ff6cd3 Mon Sep 17 00:00:00 2001 From: w30052974 Date: Mon, 23 Dec 2024 09:46:37 +0800 Subject: [PATCH 1/3] cache info extension members number added Signed-off-by: w30052974 --- frameworks/native/neural_network_runtime/nncompiler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frameworks/native/neural_network_runtime/nncompiler.cpp b/frameworks/native/neural_network_runtime/nncompiler.cpp index ed72e08..b23cf93 100644 --- a/frameworks/native/neural_network_runtime/nncompiler.cpp +++ b/frameworks/native/neural_network_runtime/nncompiler.cpp @@ -30,6 +30,7 @@ namespace { const int CACHE_INPUT_TENSORDESC_OFFSET = 2; const int CACHE_OUTPUT_TENSORDESC_OFFSET = 1; constexpr int32_t NUMBER_CACHE_INFO_MEMBERS = 3; +constexpr int32_t NUMBER_CACHE_INFO_EXTENSION_MEMBERS = 2; const std::string EXTENSION_KEY_MODEL_NAME = "ModelName"; const std::string EXTENSION_KEY_FM_SHARED = "NPU_FM_SHARED"; const int OPVERSION_SUBSTR_NUM = 2; @@ -668,7 +669,7 @@ OH_NN_ReturnCode NNCompiler::RestoreFromCacheFile() if (currentOpVersion > modelCacheInfo.opVersion) { const size_t cacheNumber = caches.size(); - uint32_t cacheSize = NUMBER_CACHE_INFO_MEMBERS + cacheNumber + 1; + uint32_t cacheSize = NUMBER_CACHE_INFO_MEMBERS + cacheNumber + NUMBER_CACHE_INFO_EXTENSION_MEMBERS; uint32_t infoCharNumber = cacheSize * sizeof(int64_t); std::unique_ptr cacheInfo = CreateUniquePtr(cacheSize); -- Gitee From 9938fb30e29a50c7e798dc57d7484ac24e6a55a1 Mon Sep 17 00:00:00 2001 From: w30052974 Date: Sat, 28 Dec 2024 09:52:43 +0800 Subject: [PATCH 2/3] =?UTF-8?q?nnrt=20=E5=A4=9A=E4=BD=99=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: w30052974 --- frameworks/native/neural_network_runtime/nnexecutor.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/frameworks/native/neural_network_runtime/nnexecutor.cpp b/frameworks/native/neural_network_runtime/nnexecutor.cpp index 0a382f1..a2dce91 100644 --- a/frameworks/native/neural_network_runtime/nnexecutor.cpp +++ b/frameworks/native/neural_network_runtime/nnexecutor.cpp @@ -344,7 +344,6 @@ OH_NN_ReturnCode NNExecutor::CheckInputDimRanges(NN_Tensor* inputTensors[], size std::vector> maxInputDims; OH_NN_ReturnCode oldRet = m_preparedModel->GetInputDimRanges(minInputDims, maxInputDims); if (oldRet != OH_NN_SUCCESS) { - LOGW("NNExecutor::CheckInputDimRanges failed, current version don't support get input dim ranges."); return OH_NN_OPERATION_FORBIDDEN; } -- Gitee From 848322488d149a78ff2fe0817f09f2a699bb255e Mon Sep 17 00:00:00 2001 From: w30052974 Date: Sat, 28 Dec 2024 09:53:52 +0800 Subject: [PATCH 3/3] =?UTF-8?q?nnrt=20=E5=A4=9A=E4=BD=99=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: w30052974 --- frameworks/native/neural_network_runtime/nnexecutor.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/frameworks/native/neural_network_runtime/nnexecutor.cpp b/frameworks/native/neural_network_runtime/nnexecutor.cpp index a2dce91..0a382f1 100644 --- a/frameworks/native/neural_network_runtime/nnexecutor.cpp +++ b/frameworks/native/neural_network_runtime/nnexecutor.cpp @@ -344,6 +344,7 @@ OH_NN_ReturnCode NNExecutor::CheckInputDimRanges(NN_Tensor* inputTensors[], size std::vector> maxInputDims; OH_NN_ReturnCode oldRet = m_preparedModel->GetInputDimRanges(minInputDims, maxInputDims); if (oldRet != OH_NN_SUCCESS) { + LOGW("NNExecutor::CheckInputDimRanges failed, current version don't support get input dim ranges."); return OH_NN_OPERATION_FORBIDDEN; } -- Gitee