Merged
[9.2.0] aclnn框架缓存场景日志维测能力增强 #849
ren-botaoAdd on Sep 12
[9.2.0] aclnn框架缓存场景日志维测能力增强 #849
Merged
Merged fromren-botao/opbase9.2.0_add_cache_logintocann/opbase9.2.0
Total: 1 files changed+10-4
| @@ -1086,12 +1086,12 @@ void OpExecCache::MarkOpCacheInvalid() | |||
| 1086 | hashKey_ = 0; | 1086 | hashKey_ = 0; |
| 1087 | // 不释放/置空 buf 仅置 len 为 0,避免 operator== 跨线程读到 buf 为空而 len 非 0 的中间态导致崩溃 | 1087 | // 不释放/置空 buf 仅置 len 为 0,避免 operator== 跨线程读到 buf 为空而 len 非 0 的中间态导致崩溃 |
| 1088 | key_.len = 0; | 1088 | key_.len = 0; |
| 1089 | - OP_LOGI("key_.len: %zu", key_.len); | 1089 | + OP_LOGI("Mark op cache invalid."); |
| 1090 | } | 1090 | } |
| 1091 | 1091 | ||
| 1092 | bool OpExecCache::IsOpCacheValid() | 1092 | bool OpExecCache::IsOpCacheValid() |
| 1093 | { | 1093 | { |
| 1094 | - OP_LOGI("Hash key: %lu, key_.len: %zu", hashKey_, key_.len); | 1094 | + OP_LOGI("Hash key: %lu, OpCacheKey len: %zu", hashKey_, key_.len); |
| 1095 | return hashKey_ || (key_.buf && key_.len); | 1095 | return hashKey_ || (key_.buf && key_.len); |
| 1096 | } | 1096 | } |
| 1097 | 1097 | ||
| @@ -1346,10 +1346,11 @@ bool OpExecCacheManager::AddOpExecCache(OpExecCache* exec) | |||
| 1346 | if (hash && cache_.find(hash) == cache_.end()) { | 1346 | if (hash && cache_.find(hash) == cache_.end()) { |
| 1347 | cache_[hash] = exec; | 1347 | cache_[hash] = exec; |
| 1348 | ret = true; | 1348 | ret = true; |
| 1349 | + OP_LOGI("Add cache to cache v1, hash key: %lu, current size: %zu", hash, cache_.size()); | ||
| 1349 | } | 1350 | } |
| 1350 | 1351 | ||
| 1351 | if (cache2_.size() >= cacheLimit_) { | 1352 | if (cache2_.size() >= cacheLimit_) { |
| 1352 | - OP_LOGW("Op cache2 is full, cache2 size: %zu, limit: %zu", cache2_.size(), cacheLimit_); | 1353 | + OP_LOGW("Cache v2 is full, current size: %zu, limit: %zu", cache2_.size(), cacheLimit_); |
| 1353 | ShrinkCache(K_CACHE_SHRINK_NUM, exec->GetShrinkList()); | 1354 | ShrinkCache(K_CACHE_SHRINK_NUM, exec->GetShrinkList()); |
| 1354 | } | 1355 | } |
| 1355 | OpCacheKey key = exec->GetOpCacheKey(); | 1356 | OpCacheKey key = exec->GetOpCacheKey(); |
| @@ -1357,7 +1358,8 @@ bool OpExecCacheManager::AddOpExecCache(OpExecCache* exec) | |||
| 1357 | OpCacheValue value(exec, key); | 1358 | OpCacheValue value(exec, key); |
| 1358 | cache2_[key] = std::move(value); | 1359 | cache2_[key] = std::move(value); |
| 1359 | ret = true; | 1360 | ret = true; |
| 1360 | - OP_LOGD("Add op cache key %s value %p", key.ToString().GetString(), exec); | 1361 | + OP_LOGI("Add cache to cache v2, current size: %zu, key: %s, value: %p", cache2_.size(), |
| 1362 | + key.ToString().GetString(), exec); | ||
| 1361 | } | 1363 | } |
| 1362 | if (ret) { | 1364 | if (ret) { |
| 1363 | return ret; | 1365 | return ret; |
| @@ -1500,11 +1502,15 @@ bool CheckCacheable() | |||
| 1500 | (op::internal::GetOpProfilingRecordArgFlag() || | 1502 | (op::internal::GetOpProfilingRecordArgFlag() || |
| 1501 | internal::opProfilingSwitch.level2ProfilingFlag)); | 1503 | internal::opProfilingSwitch.level2ProfilingFlag)); |
| 1502 | if (cacheDisable) { | 1504 | if (cacheDisable) { |
| 1505 | + OP_LOGI("Cache is disabled, op dump: %d, record op arg flag: %d, level2ProfilingFlag: %d", | ||
| 1506 | + op::internal::IsDumpEnable(), op::internal::GetOpProfilingRecordArgFlag(), | ||
| 1507 | + internal::opProfilingSwitch.level2ProfilingFlag); | ||
| 1503 | g_opCacheTlsData.threadLocalContext.cacheHasFull_ = true; | 1508 | g_opCacheTlsData.threadLocalContext.cacheHasFull_ = true; |
| 1504 | return false; | 1509 | return false; |
| 1505 | } | 1510 | } |
| 1506 | static const char* pathVar = GetEnvOfDisableL2Cache(); | 1511 | static const char* pathVar = GetEnvOfDisableL2Cache(); |
| 1507 | if (pathVar != nullptr) { | 1512 | if (pathVar != nullptr) { |
| 1513 | + OP_LOGI("Disable L2 cache env is set, so disable cache"); | ||
| 1508 | g_opCacheTlsData.threadLocalContext.cacheHasFull_ = true; | 1514 | g_opCacheTlsData.threadLocalContext.cacheHasFull_ = true; |
| 1509 | return false; | 1515 | return false; |
| 1510 | } | 1516 | } |