diff --git a/frameworks/native/neural_network_runtime/nncompiled_cache.cpp b/frameworks/native/neural_network_runtime/nncompiled_cache.cpp index ef71bbf0e3e48c89a8f3a00f84a22c03198a5ac8..92a749f448551d9b33f71439b1754745ee64e576 100644 --- a/frameworks/native/neural_network_runtime/nncompiled_cache.cpp +++ b/frameworks/native/neural_network_runtime/nncompiled_cache.cpp @@ -347,6 +347,10 @@ OH_NN_ReturnCode NNCompiledCache::CheckCacheInfo(NNCompiledCacheInfo& modelCache LOGW("[NNCompiledCache] opVersion failed."); } + if (!infoCacheFile.read(reinterpret_cast(&(modelCacheInfo.isExceedRamLimit)), sizeof(uint64_t))) { + LOGW("[NNCompiledCache] isExceedRamLimit failed."); + } + infoCacheFile.close(); return OH_NN_SUCCESS; } diff --git a/frameworks/native/neural_network_runtime/nncompiler.cpp b/frameworks/native/neural_network_runtime/nncompiler.cpp index 76e817e4f5167641404cf690db76e7d0b0e44f19..388f8d7e83da5a9d231269517dd9b205487b58bf 100644 --- a/frameworks/native/neural_network_runtime/nncompiler.cpp +++ b/frameworks/native/neural_network_runtime/nncompiler.cpp @@ -691,6 +691,12 @@ OH_NN_ReturnCode NNCompiler::RestoreFromCacheFile() *cacheInfoPtr++ = currentOpVersion; + if (modelCacheInfo.isExceedRamLimit) { + *cacheInfoPtr++ = 1; + } else { + *cacheInfoPtr++ = 0; + } + ret = compiledCache.WriteCacheInfo(infoCharNumber, cacheInfo, m_cachePath); if (ret != OH_NN_SUCCESS) { LOGE("[NNCompiledCache] isUpdatable is true to write cache info failed.");