Merged
fix(machine): fix log quality issues in machine module. #5679
chaizhengtongAdd on Aug 25
fix(machine): fix log quality issues in machine module. #5679
Merged
chaizhengtongAdd on Aug 25
Total: 36 files changed+121-90
@@ -564,7 +564,7 @@ class BuildParam(CMakeParam):
564 _p = Path(self.clang_install_path, _b)564 _p = Path(self.clang_install_path, _b)
565 if _p.exists():565 if _p.exists():
566 return True, self._cfg_require(opt=_opt, tv=str(_p))566 return True, self._cfg_require(opt=_opt, tv=str(_p))
567- logging.error("Clang Toolchain %s not exist.", _p)567+ logging.error("Clang Toolchain %s does not exist.", _p)
568 return False, ""568 return False, ""
569 569 
570 def _gen_clang_cmd() -> Tuple[bool, str]:570 def _gen_clang_cmd() -> Tuple[bool, str]:
@@ -1550,7 +1550,7 @@ class BuildCtrl(CMakeParam):
1550 try:1550 try:
1551 _, duration = self.run_build_cmd(cmd=c, update_env=update_env)1551 _, duration = self.run_build_cmd(cmd=c, update_env=update_env)
1552 except subprocess.CalledProcessError as e:1552 except subprocess.CalledProcessError as e:
1553- logging.info("CMake Build(%s/%s) failed, ERROR CODE: %s", i, len(cmd_list), e.returncode)1553+ logging.error("CMake Build(%s/%s) failed, ERROR CODE: %s", i, len(cmd_list), e.returncode)
1554 raise e1554 raise e
1555 logging.info("CMake Build(%s/%s) success, %s", i, len(cmd_list), duration)1555 logging.info("CMake Build(%s/%s) success, %s", i, len(cmd_list), duration)
1556 1556 
@@ -1898,7 +1898,7 @@ class BuildCtrl(CMakeParam):
1898 whl_files = [Path(f) for f in whl_glob]1898 whl_files = [Path(f) for f in whl_glob]
1899 whl_file = whl_files[0] if whl_files else None1899 whl_file = whl_files[0] if whl_files else None
1900 if whl_file:1900 if whl_file:
1901- logging.info("Success find match %s from %s", whl_file, path)1901+ logging.info("Successfully found match %s from %s", whl_file, path)
1902 else:1902 else:
1903 logging.error("Failed to find match %s whl from %s, pattern=%s", name, path, pattern)1903 logging.error("Failed to find match %s whl from %s, pattern=%s", name, path, pattern)
1904 return whl_file1904 return whl_file
@@ -20,6 +20,7 @@ pypto@pypto:
20 - framework/src/cost_model/simulation_pv/20 - framework/src/cost_model/simulation_pv/
21 - framework/src/cann_host_runtime/21 - framework/src/cann_host_runtime/
22 - framework/src/adapter/22 - framework/src/adapter/
23+ - framework/src/utils/host_log/
23 llt:24 llt:
24 ut_check: true25 ut_check: true
25 st_check: false26 st_check: false
@@ -129,7 +129,7 @@ class Exec:
129 else:129 else:
130 break # 排序后, 有耗时预估的会排在前面130 break # 排序后, 有耗时预估的会排在前面
131 normal_cnt = len(case_name_list) - ordered_cnt131 normal_cnt = len(case_name_list) - ordered_cnt
132- logging.info("Determine TestCase Order, OrderdCase(%s), NormalCase(%s)", ordered_cnt, normal_cnt)132+ logging.info("Determine TestCase Order, OrderedCase(%s), NormalCase(%s)", ordered_cnt, normal_cnt)
133 return ordered_cnt, desc_list, desc_dict133 return ordered_cnt, desc_list, desc_dict
134 134 
135 def run(135 def run(
@@ -41,7 +41,7 @@ public:
41 if (!libHandler_.OpenHandler(libName)) {41 if (!libHandler_.OpenHandler(libName)) {
42 return false;42 return false;
43 }43 }
44- ADAPTER_LOGD("Library[%s] has been load.", libName.c_str());44+ ADAPTER_LOGD("Library[%s] has been loaded.", libName.c_str());
45 InitFunctions(funcNameMap);45 InitFunctions(funcNameMap);
46 isInit_ = true;46 isInit_ = true;
47 return true;47 return true;
@@ -61,10 +61,10 @@ private:
61 for (const std::pair<const EnumType, std::string>& item : funcNameMap) {61 for (const std::pair<const EnumType, std::string>& item : funcNameMap) {
62 void* func = libHandler_.GetFunction(item.second);62 void* func = libHandler_.GetFunction(item.second);
63 if (func == nullptr) {63 if (func == nullptr) {
64- ADAPTER_LOGI("Fail to load function[%s]", item.second.c_str());64+ ADAPTER_LOGI("Failed to load function[%s]", item.second.c_str());
65 continue;65 continue;
66 }66 }
67- ADAPTER_LOGD("Function[%s] has been load successfully.", item.second.c_str());67+ ADAPTER_LOGD("Function[%s] has been loaded successfully.", item.second.c_str());
68 functions_[static_cast<size_t>(item.first)] = func;68 functions_[static_cast<size_t>(item.first)] = func;
69 }69 }
70 }70 }
@@ -25,7 +25,7 @@ RtError StubMalloc(void** devPtr, uint64_t size, RtMemType type, const uint16_t
25 (void)type;25 (void)type;
26 (void)moduleId;26 (void)moduleId;
27 if (devPtr == nullptr || size == 0 || size > MAX_MALLOC_SIZE) {27 if (devPtr == nullptr || size == 0 || size > MAX_MALLOC_SIZE) {
28- ADAPTER_LOGW("devPtr is null or size can not be support");28+ ADAPTER_LOGW("devPtr is null or size cannot be supported");
29 return RT_SUCCESS;29 return RT_SUCCESS;
30 }30 }
31 *devPtr = malloc(size);31 *devPtr = malloc(size);
@@ -55,7 +55,7 @@ TypePtr DeduceBlockCreateTileType([[maybe_unused]] const std::vector<ExprPtr>& a
55{55{
56 // make_tile signature: (shape)56 // make_tile signature: (shape)
57 // TileType requires static compile-time constant shapes57 // TileType requires static compile-time constant shapes
58- CHECK(args.size() == 0x2) << "The operator " << op_name << " requires exactly 2 argument, but got " << args.size();58+ CHECK(args.size() == 0x2) << "The operator " << op_name << " requires exactly 2 arguments, but got " << args.size();
59 59 
60 // Extract dtype attribute60 // Extract dtype attribute
61 DataType dtype = GetOpKwarg<DataType>(kwargs, "dtype");61 DataType dtype = GetOpKwarg<DataType>(kwargs, "dtype");
@@ -121,7 +121,7 @@ public:
121 }121 }
122 aicoreHal_.SetParallelDevTaskSize(kernelParallDevTask, parallelCtx->front, parallelCtx->rear);122 aicoreHal_.SetParallelDevTaskSize(kernelParallDevTask, parallelCtx->front, parallelCtx->rear);
123 aicoreHal_.SetParallelDevTaskCtxVersion(coreIdx, parallelCtx->Version());123 aicoreHal_.SetParallelDevTaskCtxVersion(coreIdx, parallelCtx->Version());
124- DEV_VERBOSE_DEBUG("Fill prallel dev task for core %d, ver:%u", coreIdx, parallelCtx->Version());124+ DEV_VERBOSE_DEBUG("Fill parallel dev task for core %d, ver:%u", coreIdx, parallelCtx->Version());
125 }125 }
126 126 
127 inline void SetSchduleContext(SchduleContext* context) { this->context_ = context; }127 inline void SetSchduleContext(SchduleContext* context) { this->context_ = context; }
@@ -753,7 +753,7 @@ private:
753 if (!devTaskCtx->coreTaskFinished[i]) {753 if (!devTaskCtx->coreTaskFinished[i]) {
754 DEV_ERROR(754 DEV_ERROR(
755 SchedErr::TASK_WAIT_TIMEOUT,755 SchedErr::TASK_WAIT_TIMEOUT,
756- "#sche.task.end.sync.timeout: left aic core %d not stop, pending:%x, rungning:%x, regfinishid: %lx,"756+ "#sche.task.end.sync.timeout: left aic core %d not stop, pending:%x, running:%x, regfinishid: %lx,"
757 "core last status:%lu, warning status:%lu, lastword status:%lu",757 "core last status:%lu, warning status:%lu, lastword status:%lu",
758 i, pendingIds_[i], runningIds_[i], aicoreHal_.GetFinishedTask(i), aicoreHal_.GetAicoreStatus(i),758 i, pendingIds_[i], runningIds_[i], aicoreHal_.GetFinishedTask(i), aicoreHal_.GetAicoreStatus(i),
759 aicoreHal_.GetAicoreWarningStatus(i), aicoreHal_.GetAicoreStatusLastWord(i));759 aicoreHal_.GetAicoreWarningStatus(i), aicoreHal_.GetAicoreStatusLastWord(i));
@@ -764,7 +764,7 @@ private:
764 if (!devTaskCtx->coreTaskFinished[i]) {764 if (!devTaskCtx->coreTaskFinished[i]) {
765 DEV_ERROR(765 DEV_ERROR(
766 SchedErr::TASK_WAIT_TIMEOUT,766 SchedErr::TASK_WAIT_TIMEOUT,
767- "#sche.task.end.sync.timeout: left aiv core %d not stop, pending:%x, rungning:%x, regfinishid: %lx,"767+ "#sche.task.end.sync.timeout: left aiv core %d not stop, pending:%x, running:%x, regfinishid: %lx,"
768 "core last status:%lu, warning status:%lu, lastword status:%lu",768 "core last status:%lu, warning status:%lu, lastword status:%lu",
769 i, pendingIds_[i], runningIds_[i], aicoreHal_.GetFinishedTask(i), aicoreHal_.GetAicoreStatus(i),769 i, pendingIds_[i], runningIds_[i], aicoreHal_.GetFinishedTask(i), aicoreHal_.GetAicoreStatus(i),
770 aicoreHal_.GetAicoreWarningStatus(i), aicoreHal_.GetAicoreStatusLastWord(i));770 aicoreHal_.GetAicoreWarningStatus(i), aicoreHal_.GetAicoreStatusLastWord(i));
@@ -1351,7 +1351,7 @@ private:
1351 [[maybe_unused]] uint32_t aicpuCallCode = finTaskRegVal >> 32;1351 [[maybe_unused]] uint32_t aicpuCallCode = finTaskRegVal >> 32;
1352 uint32_t finTaskId = REG_LOW_TASK_ID(finTaskRegVal);1352 uint32_t finTaskId = REG_LOW_TASK_ID(finTaskRegVal);
1353 uint32_t finTaskState = REG_LOW_TASK_STATE(finTaskRegVal);1353 uint32_t finTaskState = REG_LOW_TASK_STATE(finTaskRegVal);
1354- DEV_VERBOSE_DEBUG("reslove task core index: %d, finishtaskid:%x, finishstate: %u.", coreIdx, finTaskId,1354+ DEV_VERBOSE_DEBUG("resolve task core index: %d, finishtaskid:%x, finishstate: %u.", coreIdx, finTaskId,
1355 finTaskState);1355 finTaskState);
1356 1356 
1357 return (this->*releaseCoreByRegValFn_)(type, coreIdx, ctx, finishCnt, resloveParallelIdx, finTaskRegVal,1357 return (this->*releaseCoreByRegValFn_)(type, coreIdx, ctx, finishCnt, resloveParallelIdx, finTaskRegVal,
@@ -70,12 +70,12 @@ int32_t AiCoreProf::DevProfInit(uint32_t type, void* data, uint32_t len)
70void AiCoreProf::RegDevProf()70void AiCoreProf::RegDevProf()
71{71{
72 if (MsprofRegisterCallback == nullptr) {72 if (MsprofRegisterCallback == nullptr) {
73- DEV_DEBUG("MsprofRegister is not supproted");73+ DEV_DEBUG("MsprofRegister is not supported");
74 return;74 return;
75 }75 }
76 int ret = MsprofRegisterCallback(AICPU, DevProfInit);76 int ret = MsprofRegisterCallback(AICPU, DevProfInit);
77 if (ret != 0) {77 if (ret != 0) {
78- DEV_WARN("Pypto Msporf reg not success");78+ DEV_WARN("Pypto Msprof reg not success");
79 }79 }
80}80}
81 81 
@@ -70,7 +70,7 @@ int DeviceExecuteContext::RunInit(DevStartArgs* startArgs, PushTaskEntry tPushTa
70 workspace.InitMetadataSlabAllocator();70 workspace.InitMetadataSlabAllocator();
71 71 
72 PerfEnd(PERF_EVT_CONTROL_FLOW_INIT);72 PerfEnd(PERF_EVT_CONTROL_FLOW_INIT);
73- DEV_INFO("Image size is %lu.", devProg->GetSize());73+ DEV_INFO("Image size is %lu bytes.", devProg->GetSize());
74 return DEVICE_MACHINE_OK;74 return DEVICE_MACHINE_OK;
75}75}
76 76 
@@ -485,7 +485,7 @@ void* DeviceExecuteContext::CallRootFunctionAlloc(uint64_t rootKey)
485{485{
486 int ret = DEVICE_MACHINE_OK;486 int ret = DEVICE_MACHINE_OK;
487 DevAscendFunction* devRoot = devProg->GetFunction(rootKey);487 DevAscendFunction* devRoot = devProg->GetFunction(rootKey);
488- DEV_DEBUG("Slloc one func %lu %p %s.", rootKey, devRoot, devRoot->GetRawName());488+ DEV_DEBUG("Alloc one func %lu %p %s.", rootKey, devRoot, devRoot->GetRawName());
489 const bool stitchByMemoryOnly = devProg->memBudget.tensor.memoryDrivenWorkspace != 0;489 const bool stitchByMemoryOnly = devProg->memBudget.tensor.memoryDrivenWorkspace != 0;
490 const uint16_t realStitchNumThreshold = parallelCtx.isInParallelForScope ? MAX_STITCH_FUNC_NUM :490 const uint16_t realStitchNumThreshold = parallelCtx.isInParallelForScope ? MAX_STITCH_FUNC_NUM :
491 stitchTaskLoopNumThreshold;491 stitchTaskLoopNumThreshold;
@@ -202,7 +202,7 @@ public:
202 if (!firstInit) {202 if (!firstInit) {
203 devProg->ResetRerun(); // Clean the dirty data of cell match table from the last launch203 devProg->ResetRerun(); // Clean the dirty data of cell match table from the last launch
204 }204 }
205- DEV_INFO("ControlFlowCache: cache have no devtask , ignore it");205+ DEV_INFO("ControlFlowCache: cache has no devtask, ignore it");
206 return;206 return;
207 }207 }
208 208 
@@ -283,7 +283,7 @@ public:
283 283 
284 RuntimeDataRingBufferHead* ringBufferHead = devProg->GetRuntimeDataList();284 RuntimeDataRingBufferHead* ringBufferHead = devProg->GetRuntimeDataList();
285 285 
286- DEV_INFO("AllocatePrepare begin runtimedata: %lu, %lu %lu", ringBufferHead->GetIndexFinished(),286+ DEV_INFO("AllocatePrepare begin runtime data: %lu, %lu %lu", ringBufferHead->GetIndexFinished(),
287 ringBufferHead->GetIndexPending(), ringBufferHead->GetRuntimeDataCount());287 ringBufferHead->GetIndexPending(), ringBufferHead->GetRuntimeDataCount());
288 DevStartArgs* devStartArgs = reinterpret_cast<DevStartArgs*>(ringBufferHead->AllocatePrepare());288 DevStartArgs* devStartArgs = reinterpret_cast<DevStartArgs*>(ringBufferHead->AllocatePrepare());
289 DEV_INFO("AllocatePrepare end");289 DEV_INFO("AllocatePrepare end");
@@ -199,7 +199,7 @@ struct PerfEvtMgr {
199 buf[i] = c;199 buf[i] = c;
200 }200 }
201 buf[count] = '\0';201 buf[count] = '\0';
202- DEV_ERROR(0, "%s.", buf);202+ DEV_ERROR(MachineError::UNKNOWN, "%s", buf);
203 }203 }
204 204 
205 void Dump()205 void Dump()
@@ -60,7 +60,7 @@ public:
60 void SetDevSchedSyncMode(uint8_t devScheSyncMode)60 void SetDevSchedSyncMode(uint8_t devScheSyncMode)
61 {61 {
62 devScheSyncMode_ = devScheSyncMode;62 devScheSyncMode_ = devScheSyncMode;
63- DEV_INFO("Current front setted devSchedSynMode is %s", devScheSyncMode == 1 ? "SynMode" : "AsyncMode");63+ DEV_INFO("Current front set devSchedSynMode is %s", devScheSyncMode == 1 ? "SynMode" : "AsyncMode");
64 }64 }
65 65 
66 int RunThread(int threadIdx, DevStartArgs* devStartArgs, DeviceArgs* args, int schedIdx, int arbitratedScheNum)66 int RunThread(int threadIdx, DevStartArgs* devStartArgs, DeviceArgs* args, int schedIdx, int arbitratedScheNum)
@@ -324,7 +324,7 @@ struct DynMachineManager {
324 {324 {
325 RuntimeDataRingBufferHead* runtimeDataList = devProg->GetRuntimeDataList();325 RuntimeDataRingBufferHead* runtimeDataList = devProg->GetRuntimeDataList();
326 runtimeDataList->Deallocate(runtimeDataList->GetRuntimeDataCurrent());326 runtimeDataList->Deallocate(runtimeDataList->GetRuntimeDataCurrent());
327- DEV_INFO("Runtimedata: %lu, %lu", runtimeDataList->GetIndexFinished(), runtimeDataList->GetIndexPending());327+ DEV_INFO("Runtime data: %lu, %lu", runtimeDataList->GetIndexFinished(), runtimeDataList->GetIndexPending());
328 }328 }
329 329 
330 int EntrySplittedStreamCtrl(DeviceKernelArgs* kargs, const KernelCtrlEntry& entry)330 int EntrySplittedStreamCtrl(DeviceKernelArgs* kargs, const KernelCtrlEntry& entry)
@@ -328,7 +328,7 @@ void DeviceTrace::SubmitTraceMsg(const std::string& traceMsg)
328{328{
329 auto pyptoHandle = CreateTraceHandle();329 auto pyptoHandle = CreateTraceHandle();
330 if (pyptoHandle < 0 || traceMsg.empty()) {330 if (pyptoHandle < 0 || traceMsg.empty()) {
331- DEV_WARN("pypto Handle is null or traceMsg is empty, cann't to submit");331+ DEV_WARN("pypto Handle is null or traceMsg is empty, cannot submit");
332 return;332 return;
333 }333 }
334 uint32_t msgSize = static_cast<uint32_t>(traceMsg.size());334 uint32_t msgSize = static_cast<uint32_t>(traceMsg.size());
@@ -229,7 +229,7 @@ void AicpuPerfEventSampler::Dump()
229{229{
230 if (!pmuAvailable || !pmuEnabled || events.GetValidEventCount() == 0) {230 if (!pmuAvailable || !pmuEnabled || events.GetValidEventCount() == 0) {
231 DumpSummary("ExecDyn Summary (PMU unavailable)");231 DumpSummary("ExecDyn Summary (PMU unavailable)");
232- DEV_ERROR(MachineError::UNKNOWN, " Note: PMU events disabled due to permission restrictions");232+ DEV_WARN(" Note: PMU events disabled due to permission restrictions");
233 return;233 return;
234 }234 }
235 235 
@@ -264,37 +264,34 @@ void AicpuPerfEventSampler::DumpSummary(const char* title)
264 264 
265void AicpuPerfEventSampler::DumpReport(const uint64_t* counts)265void AicpuPerfEventSampler::DumpReport(const uint64_t* counts)
266{266{
267- DEV_ERROR(MachineError::UNKNOWN, "[AICPU_PMU] Performance Report");267+ DEV_INFO("[AICPU_PMU] Performance Report");
268- DEV_ERROR(MachineError::UNKNOWN, "============================================================");268+ DEV_INFO("============================================================");
269 DumpElapsedCycles();269 DumpElapsedCycles();
270 DumpRawCounters(counts);270 DumpRawCounters(counts);
271 DumpDerivedMetrics(BuildDerivedMetrics(counts));271 DumpDerivedMetrics(BuildDerivedMetrics(counts));
272- DEV_ERROR(MachineError::UNKNOWN, "============================================================");272+ DEV_INFO("============================================================");
273}273}
274 274 
275-void AicpuPerfEventSampler::DumpElapsedCycles()275+void AicpuPerfEventSampler::DumpElapsedCycles() { DEV_INFO("Elapsed Cycles: %s", FormatNumber(cycles).c_str()); }
276-{
277- DEV_ERROR(MachineError::UNKNOWN, "Elapsed Cycles: %s", FormatNumber(cycles).c_str());
278-}
279 276 
280void AicpuPerfEventSampler::DumpSectionHeader(const char* title)277void AicpuPerfEventSampler::DumpSectionHeader(const char* title)
281{278{
282- DEV_ERROR(MachineError::UNKNOWN, "------------------------------------------------------------");279+ DEV_INFO("------------------------------------------------------------");
283- DEV_ERROR(MachineError::UNKNOWN, "%s", title);280+ DEV_INFO("%s", title);
284- DEV_ERROR(MachineError::UNKNOWN, "------------------------------------------------------------");281+ DEV_INFO("------------------------------------------------------------");
285}282}
286 283 
287void AicpuPerfEventSampler::DumpRawCounters(const uint64_t* counts)284void AicpuPerfEventSampler::DumpRawCounters(const uint64_t* counts)
288{285{
289 DumpSectionHeader("PMU Event Counters");286 DumpSectionHeader("PMU Event Counters");
290- DEV_ERROR(MachineError::UNKNOWN, " CPU Cycles: %s", FormatNumber(counts[IDX_CPU_CYCLES]).c_str());287+ DEV_INFO(" CPU Cycles: %s", FormatNumber(counts[IDX_CPU_CYCLES]).c_str());
291- DEV_ERROR(MachineError::UNKNOWN, " Instructions: %s", FormatNumber(counts[IDX_INSTRUCTIONS]).c_str());288+ DEV_INFO(" Instructions: %s", FormatNumber(counts[IDX_INSTRUCTIONS]).c_str());
292- DEV_ERROR(MachineError::UNKNOWN, " Branch Instructions:%s", FormatNumber(counts[IDX_BRANCH_INST]).c_str());289+ DEV_INFO(" Branch Instructions:%s", FormatNumber(counts[IDX_BRANCH_INST]).c_str());
293- DEV_ERROR(MachineError::UNKNOWN, " Branch Misses: %s", FormatNumber(counts[IDX_BRANCH_MISS]).c_str());290+ DEV_INFO(" Branch Misses: %s", FormatNumber(counts[IDX_BRANCH_MISS]).c_str());
294- DEV_ERROR(MachineError::UNKNOWN, " L1D Cache Refs: %s", FormatNumber(counts[IDX_L1D_CACHE_REFS]).c_str());291+ DEV_INFO(" L1D Cache Refs: %s", FormatNumber(counts[IDX_L1D_CACHE_REFS]).c_str());
295- DEV_ERROR(MachineError::UNKNOWN, " L1D Cache Misses: %s", FormatNumber(counts[IDX_L1D_CACHE_MISSES]).c_str());292+ DEV_INFO(" L1D Cache Misses: %s", FormatNumber(counts[IDX_L1D_CACHE_MISSES]).c_str());
296- DEV_ERROR(MachineError::UNKNOWN, " LL Cache Refs: %s", FormatNumber(counts[IDX_LL_CACHE_REFS]).c_str());293+ DEV_INFO(" LL Cache Refs: %s", FormatNumber(counts[IDX_LL_CACHE_REFS]).c_str());
297- DEV_ERROR(MachineError::UNKNOWN, " LL Cache Misses: %s", FormatNumber(counts[IDX_LL_CACHE_MISSES]).c_str());294+ DEV_INFO(" LL Cache Misses: %s", FormatNumber(counts[IDX_LL_CACHE_MISSES]).c_str());
298}295}
299 296 
300PerfDerivedMetrics AicpuPerfEventSampler::BuildDerivedMetrics(const uint64_t* counts)297PerfDerivedMetrics AicpuPerfEventSampler::BuildDerivedMetrics(const uint64_t* counts)
@@ -310,9 +307,9 @@ PerfCacheMetrics AicpuPerfEventSampler::BuildCacheMetrics(uint64_t refs, uint64_
310void AicpuPerfEventSampler::DumpDerivedMetrics(const PerfDerivedMetrics& metrics)307void AicpuPerfEventSampler::DumpDerivedMetrics(const PerfDerivedMetrics& metrics)
311{308{
312 DumpSectionHeader("Derived Metrics");309 DumpSectionHeader("Derived Metrics");
313- DEV_ERROR(MachineError::UNKNOWN, " IPC: %.2f", metrics.ipc);310+ DEV_INFO(" IPC: %.2f", metrics.ipc);
314- DEV_ERROR(MachineError::UNKNOWN, " CPI: %.2f", metrics.cpi);311+ DEV_INFO(" CPI: %.2f", metrics.cpi);
315- DEV_ERROR(MachineError::UNKNOWN, " Branch Miss Rate: %.2f%%", metrics.branchMissRate);312+ DEV_INFO(" Branch Miss Rate: %.2f%%", metrics.branchMissRate);
316 DumpCacheDerivedMetric("L1D Cache", metrics.l1dCache);313 DumpCacheDerivedMetric("L1D Cache", metrics.l1dCache);
317 DumpCacheDerivedMetric("LL Cache", metrics.llCache);314 DumpCacheDerivedMetric("LL Cache", metrics.llCache);
318}315}
@@ -320,12 +317,12 @@ void AicpuPerfEventSampler::DumpDerivedMetrics(const PerfDerivedMetrics& metrics
320void AicpuPerfEventSampler::DumpCacheDerivedMetric(const char* name, const PerfCacheMetrics& metrics)317void AicpuPerfEventSampler::DumpCacheDerivedMetric(const char* name, const PerfCacheMetrics& metrics)
321{318{
322 if (!metrics.valid) {319 if (!metrics.valid) {
323- DEV_ERROR(MachineError::UNKNOWN, " %s Hit Rate: N/A", name);320+ DEV_INFO(" %s Hit Rate: N/A", name);
324- DEV_ERROR(MachineError::UNKNOWN, " %s Miss Rate:N/A", name);321+ DEV_INFO(" %s Miss Rate:N/A", name);
325 return;322 return;
326 }323 }
327- DEV_ERROR(MachineError::UNKNOWN, " %s Hit Rate: %.2f%%", name, 100.0 - metrics.missRate);324+ DEV_INFO(" %s Hit Rate: %.2f%%", name, 100.0 - metrics.missRate);
328- DEV_ERROR(MachineError::UNKNOWN, " %s Miss Rate:%.2f%%", name, metrics.missRate);325+ DEV_INFO(" %s Miss Rate:%.2f%%", name, metrics.missRate);
329}326}
330 327 
331double AicpuPerfEventSampler::Divide(uint64_t dividend, uint64_t divisor)328double AicpuPerfEventSampler::Divide(uint64_t dividend, uint64_t divisor)
@@ -347,7 +344,7 @@ AicpuPerfScopedSampler::AicpuPerfScopedSampler(const char* sectionName)
347AicpuPerfScopedSampler::~AicpuPerfScopedSampler()344AicpuPerfScopedSampler::~AicpuPerfScopedSampler()
348{345{
349 sampler_.End();346 sampler_.End();
350- DEV_ERROR(MachineError::UNKNOWN, "[AICPU_PMU] %s", sectionName_);347+ DEV_INFO("[AICPU_PMU] %s", sectionName_);
351 sampler_.Dump();348 sampler_.Dump();
352}349}
353 350 
@@ -33,7 +33,7 @@ public:
33 {33 {
34 std::lock_guard<std::mutex> lock(funcLock_);34 std::lock_guard<std::mutex> lock(funcLock_);
35 if (len < minSoLen || firstCreatSo_) {35 if (len < minSoLen || firstCreatSo_) {
36- DEV_WARN("Aicpu so len less than 1, don't to copy");36+ DEV_WARN("Aicpu so len less than 1, no need to copy");
37 return true;37 return true;
38 }38 }
39 if (pyptoServerSoName_.empty()) {39 if (pyptoServerSoName_.empty()) {
@@ -43,7 +43,7 @@ public:
43 std::ofstream file(pyptoServerSoName_, std::ios::out | std::ios::binary);43 std::ofstream file(pyptoServerSoName_, std::ios::out | std::ios::binary);
44 DEV_DEBUG("Begin to create server.so");44 DEV_DEBUG("Begin to create server.so");
45 if (!file) {45 if (!file) {
46- DEV_ERROR(DevCommonErr::FILE_ERROR, "#sche.task.pre.init.resource: Coundn't create file [%s]",46+ DEV_ERROR(DevCommonErr::FILE_ERROR, "#sche.task.pre.init.resource: Couldn't create file [%s]",
47 pyptoServerSoName_.c_str());47 pyptoServerSoName_.c_str());
48 return false;48 return false;
49 }49 }
@@ -523,7 +523,7 @@ static void SetDyndevProgBinary(Function* function, bool disableCtrlFlowCache,
523 if (config::GetPassDefaultConfig(npu::tile_fwk::KEY_PRINT_PROGRAM, false)) {523 if (config::GetPassDefaultConfig(npu::tile_fwk::KEY_PRINT_PROGRAM, false)) {
524 SaveFile(config::LogTopFolder() + "/program.tifwkbin", dynAttrPtr->devProgBinary);524 SaveFile(config::LogTopFolder() + "/program.tifwkbin", dynAttrPtr->devProgBinary);
525 }525 }
526- MACHINE_LOGI("Dev prog binary size is:%zu\n", dynAttrPtr->devProgBinary.size());526+ MACHINE_LOGI("Dev prog binary size is:%zu bytes\n", dynAttrPtr->devProgBinary.size());
527}527}
528 528 
529std::vector<SymbolicExpressionTable*> GetAllExpressionTable(529std::vector<SymbolicExpressionTable*> GetAllExpressionTable(
@@ -664,7 +664,7 @@ static void OverCallOpMaxNum(Function* devRoot, DevAscendFunction* funcBin)
664 uint32_t CallOpmaxSize = MAX_STITCH_LEAFFUNC_NUM;664 uint32_t CallOpmaxSize = MAX_STITCH_LEAFFUNC_NUM;
665 auto funcMagicName = devRoot->GetRawName() + "_" + std::to_string(devRoot->GetFuncMagic());665 auto funcMagicName = devRoot->GetRawName() + "_" + std::to_string(devRoot->GetFuncMagic());
666 MACHINE_LOGE(DevCommonErr::PARAM_CHECK_FAILED,666 MACHINE_LOGE(DevCommonErr::PARAM_CHECK_FAILED,
667- "the loop function operation: %s size is %u hitting the maxinum single-loop-operation limit:%u.\n",667+ "the loop function operation: %s size is %u hitting the maximum single-loop-operation limit:%u.\n",
668 funcMagicName.c_str(), CallOpSize, CallOpmaxSize);668 funcMagicName.c_str(), CallOpSize, CallOpmaxSize);
669 ASSERT(DevCommonErr::PARAM_CHECK_FAILED, CallOpSize <= CallOpmaxSize)669 ASSERT(DevCommonErr::PARAM_CHECK_FAILED, CallOpSize <= CallOpmaxSize)
670 << " loopFunction: " << funcMagicName << " CallOpSize: " << CallOpSize << " CallOpmaxSize: " << CallOpmaxSize;670 << " loopFunction: " << funcMagicName << " CallOpSize: " << CallOpSize << " CallOpmaxSize: " << CallOpmaxSize;
@@ -677,7 +677,7 @@ static void CompileControlFlow(const std::string& aicpuDirPath, const std::strin
677 return;677 return;
678 }678 }
679 std::string controlFlowCompilepath = aicpuDirPath + "/" + funcName + "/aicpu";679 std::string controlFlowCompilepath = aicpuDirPath + "/" + funcName + "/aicpu";
680- MACHINE_LOGD("Dumpath is %s, functionName %s, path is %s", aicpuDirPath.c_str(), funcName.c_str(),680+ MACHINE_LOGD("Dump path is %s, functionName %s, path is %s", aicpuDirPath.c_str(), funcName.c_str(),
681 controlFlowCompilepath.c_str());681 controlFlowCompilepath.c_str());
682 if (!CreateDir(controlFlowCompilepath, true)) {682 if (!CreateDir(controlFlowCompilepath, true)) {
683 MACHINE_LOGE(DevCommonErr::FILE_ERROR, "Creat AicpuCompile dir not success\n");683 MACHINE_LOGE(DevCommonErr::FILE_ERROR, "Creat AicpuCompile dir not success\n");
@@ -1057,7 +1057,7 @@ static void CompileDyndevFunction(Function* function, FunctionCache& cache, [[ma
1057#endif1057#endif
1058 1058 
1059 attr->kernelBinary = ReadFile(kernelPath);1059 attr->kernelBinary = ReadFile(kernelPath);
1060- MACHINE_LOGD("KernelBinary size[%zu].", attr->kernelBinary.size());1060+ MACHINE_LOGD("KernelBinary size[%zu] bytes.", attr->kernelBinary.size());
1061 1061 
1062 RunEncodeStage(function, attr, linker, encodeDevAscendFunctionParam, valDependTensorMeta.disableCtrlFlowCache);1062 RunEncodeStage(function, attr, linker, encodeDevAscendFunctionParam, valDependTensorMeta.disableCtrlFlowCache);
1063}1063}
@@ -314,7 +314,7 @@ void EmitDynloopCondTree(ControlFlowEmitCtx& ctx, const std::shared_ptr<DynloopF
314 EmitDynloopCondTree(ctx, node->branchNodeList[0], condIndent);314 EmitDynloopCondTree(ctx, node->branchNodeList[0], condIndent);
315 return;315 return;
316 }316 }
317- ASSERT(DevCommonErr::PARAM_CHECK_FAILED, false) << "Both conds is nullptr!";317+ ASSERT(DevCommonErr::PARAM_CHECK_FAILED, false) << "Both conds are nullptr!";
318}318}
319 319 
320void EmitDynamicLoopOpen(ControlFlowEmitCtx& ctx, Function* func, const std::shared_ptr<DynloopFunctionAttribute>& attr,320void EmitDynamicLoopOpen(ControlFlowEmitCtx& ctx, Function* func, const std::shared_ptr<DynloopFunctionAttribute>& attr,
@@ -47,7 +47,7 @@ int BundleLaunchAicpu(RtAicpuArgsEx& rtArgs, DevAscendProgram* devProg)
47 const int nrAicpu = static_cast<int>(devProg->devArgs.nrAicpu);47 const int nrAicpu = static_cast<int>(devProg->devArgs.nrAicpu);
48 const bool launchSchedSameCluster = static_cast<int>(devProg->devArgs.launchSchedSameCluster);48 const bool launchSchedSameCluster = static_cast<int>(devProg->devArgs.launchSchedSameCluster);
49 if (launchSchedSameCluster) {49 if (launchSchedSameCluster) {
50- MACHINE_LOGW("When available AICPUs are insufficient, execute export PYPTO_LAUNCH_SCHED_SAME_CLUSTER=false"50+ MACHINE_LOGW("When available AICPUs are insufficient, execute export PYPTO_LAUNCH_SCHED_SAME_CLUSTER=false "
51 "to disable the constraint that forces scheduling threads onto the same cluster.");51 "to disable the constraint that forces scheduling threads onto the same cluster.");
52 }52 }
53 args->kArgs.parameter.ctrlBlockNum = static_cast<int>(devProg->ctrlBlockDim);53 args->kArgs.parameter.ctrlBlockNum = static_cast<int>(devProg->ctrlBlockDim);
@@ -65,7 +65,7 @@ void DistributedContext::FillCommCtxAttr<npu::tile_fwk::HcclCombinOpParamA5>(
65 ctxHost->statusIndex = hcclParamhost->rankNum;65 ctxHost->statusIndex = hcclParamhost->rankNum;
66 ctxHost->debugIndex = hcclParamhost->rankNum * 2;66 ctxHost->debugIndex = hcclParamhost->rankNum * 2;
67 ASSERT(DistributedErrorCode::CONTEXT_CONFIGURE_FAILED, hcclParamhost->winSize > WIN_EXP_SIZE)67 ASSERT(DistributedErrorCode::CONTEXT_CONFIGURE_FAILED, hcclParamhost->winSize > WIN_EXP_SIZE)
68- << "winSize: " << hcclParamhost->winSize << " need greater than WIN_EXP_SIZE: " << WIN_EXP_SIZE;68+ << "winSize: " << hcclParamhost->winSize << " needs to be greater than WIN_EXP_SIZE: " << WIN_EXP_SIZE;
69 ctxHost->winDataSize = hcclParamhost->winSize - WIN_EXP_SIZE;69 ctxHost->winDataSize = hcclParamhost->winSize - WIN_EXP_SIZE;
70 ctxHost->winStatusSize = WIN_EXP_SIZE;70 ctxHost->winStatusSize = WIN_EXP_SIZE;
71 ctxHost->winDebugSize = hcclParamhost->winSize;71 ctxHost->winDebugSize = hcclParamhost->winSize;
@@ -429,7 +429,7 @@ int DeviceLauncher::LaunchAicpuKernel(AicpuLaunchDesc& launchDesc, [[maybe_unuse
429 const bool launchSchedSameCluster = static_cast<int>(429 const bool launchSchedSameCluster = static_cast<int>(
430 DeviceLauncher::GetDevProg(function)->devArgs.launchSchedSameCluster);430 DeviceLauncher::GetDevProg(function)->devArgs.launchSchedSameCluster);
431 if (launchSchedSameCluster) {431 if (launchSchedSameCluster) {
432- MACHINE_LOGW("When available AICPUs are insufficient, execute export PYPTO_LAUNCH_SCHED_SAME_CLUSTER=false"432+ MACHINE_LOGW("When available AICPUs are insufficient, execute export PYPTO_LAUNCH_SCHED_SAME_CLUSTER=false "
433 "to disable the constraint that forces scheduling threads onto the same cluster.");433 "to disable the constraint that forces scheduling threads onto the same cluster.");
434 }434 }
435 args->kArgs.parameter.ctrlBlockNum = static_cast<int>(DeviceLauncher::GetDevProg(function)->ctrlBlockDim);435 args->kArgs.parameter.ctrlBlockNum = static_cast<int>(DeviceLauncher::GetDevProg(function)->ctrlBlockDim);
@@ -314,7 +314,7 @@ void* DevAlloc(const uint64_t size)
314 uint8_t* devPtr = nullptr;314 uint8_t* devPtr = nullptr;
315 DevMemoryPool::Instance().AllocDevAddr(&devPtr, size);315 DevMemoryPool::Instance().AllocDevAddr(&devPtr, size);
316 if (devPtr == nullptr) {316 if (devPtr == nullptr) {
317- MACHINE_LOGE(RtErr::RT_MALLOC_FAILED, "Failed to alloc dev addr of size[%lu].", size);317+ MACHINE_LOGE(RtErr::RT_MALLOC_FAILED, "Failed to alloc dev addr of size[%lu] bytes.", size);
318 return nullptr;318 return nullptr;
319 }319 }
320 if (RuntimeMemset(devPtr, size, 0, size) != RT_SUCCESS) {320 if (RuntimeMemset(devPtr, size, 0, size) != RT_SUCCESS) {
@@ -137,7 +137,7 @@ void GetTensorInfo(uint32_t inputSize, DevTensorData* tensorData, AdxExceptionDu
137 auto l2Offset = GetRuntimeL2Offset();137 auto l2Offset = GetRuntimeL2Offset();
138 if (inputSize > MAX_TENSOR_NUM) {138 if (inputSize > MAX_TENSOR_NUM) {
139 inputSize = MAX_TENSOR_NUM;139 inputSize = MAX_TENSOR_NUM;
140- MACHINE_LOGW("Current funciton input is larger than %d", MAX_TENSOR_NUM);140+ MACHINE_LOGW("Current function input is larger than %d", MAX_TENSOR_NUM);
141 }141 }
142 for (uint32_t i = 0; i < inputSize; i++) {142 for (uint32_t i = 0; i < inputSize; i++) {
143 if (tensorData[i].address == 0) {143 if (tensorData[i].address == 0) {
@@ -186,7 +186,7 @@ int32_t GetDeviceExceptionDumpInfo(RtAicoreExDetailInfo& aicoreExceptionInfo, Ad
186 auto aicoreArgsize = sizeof(void*) * MAX_AICPU_ARG_NUM;186 auto aicoreArgsize = sizeof(void*) * MAX_AICPU_ARG_NUM;
187 // Check it maybe pto187 // Check it maybe pto
188 if (argsSize != aicoreArgsize) {188 if (argsSize != aicoreArgsize) {
189- MACHINE_LOGI("GetDeviceExceptionDumpInfo failed: argsize not from pto info");189+ MACHINE_LOGW("GetDeviceExceptionDumpInfo failed: argsize not from pto info");
190 return 0;190 return 0;
191 }191 }
192 192 
@@ -146,7 +146,7 @@ void DumpAicoreTaskExectInfo(const DeviceArgs& args, const std::vector<void*>& p
146 }146 }
147 std::string jsonFilePath = npu::tile_fwk::config::LogTopFolder() + "/tilefwk_L1_prof_data.json";147 std::string jsonFilePath = npu::tile_fwk::config::LogTopFolder() + "/tilefwk_L1_prof_data.json";
148 if (!SaveFile(jsonFilePath, rootTaskStatus.dump(DUMP_LEVEL_FOUR))) {148 if (!SaveFile(jsonFilePath, rootTaskStatus.dump(DUMP_LEVEL_FOUR))) {
149- MACHINE_LOGW("Contrust custom op json failed");149+ MACHINE_LOGW("Construct custom op json failed");
150 return;150 return;
151 }151 }
152 MACHINE_LOGD("tilefwk_L1_prof_data have saved in: %s", jsonFilePath.c_str());152 MACHINE_LOGD("tilefwk_L1_prof_data have saved in: %s", jsonFilePath.c_str());
@@ -349,7 +349,7 @@ void DumpAicpuPerfInfo(DeviceArgs& args, const std::vector<void*>& perfData, uin
349 std::string aicpuPerfilePath = config::LogTopFolder() + "/machine_trace_perf_data_" +349 std::string aicpuPerfilePath = config::LogTopFolder() + "/machine_trace_perf_data_" +
350 std::to_string(g_last_round_num) + ".json";350 std::to_string(g_last_round_num) + ".json";
351 if (!SaveFile(aicpuPerfilePath, aicpuPrefArray.dump(DUMP_LEVEL_FOUR))) {351 if (!SaveFile(aicpuPerfilePath, aicpuPrefArray.dump(DUMP_LEVEL_FOUR))) {
352- MACHINE_LOGW("Contrust custom op json failed");352+ MACHINE_LOGW("Construct custom op json failed");
353 return;353 return;
354 }354 }
355 355 
@@ -446,7 +446,7 @@ void KernelBinary::InitAiCpuSoBin(DeviceArgs& devArgs)
446 }446 }
447 if (buffer.empty()) {447 if (buffer.empty()) {
448 MACHINE_LOGE(DevCommonErr::FILE_ERROR,448 MACHINE_LOGE(DevCommonErr::FILE_ERROR,
449- "Read bin form tilefwk_backend_server.so failed, please check the so[%s]", source.c_str());449+ "Read bin from tilefwk_backend_server.so failed, please check the so[%s]", source.c_str());
450 return;450 return;
451 }451 }
452 void* devBufferPtr = CopyDataToDevice(buffer.data(), buffer.size());452 void* devBufferPtr = CopyDataToDevice(buffer.data(), buffer.size());
@@ -130,7 +130,7 @@ int LoadAicpuOp::LaunchAicpuServerInit(int64_t* devArgsAddr)
130 launchDesc.blockDim = 1U;130 launchDesc.blockDim = 1U;
131 auto ret = LaunchBuiltInOpWithHostArgs(launchDesc, "PyptoInit");131 auto ret = LaunchBuiltInOpWithHostArgs(launchDesc, "PyptoInit");
132 if (ret != 0) {132 if (ret != 0) {
133- MACHINE_LOGE(0, "kernel_launch init is failed");133+ MACHINE_LOGE(DevCommonErr::INIT_FAILED, "kernel_launch init is failed");
134 return ret;134 return ret;
135 }135 }
136 return RuntimeStreamSynchronize(aicpuStream);136 return RuntimeStreamSynchronize(aicpuStream);
@@ -100,7 +100,7 @@ void PmuCommon::InitPmuEventType(const ArchInfo& archInfo, std::vector<int64_t>&
100 // 获取pmu事件类型环境变量获取方式100 // 获取pmu事件类型环境变量获取方式
101 std::string eventTypeStr = GetEnvVar("PYPTO_PROF_PMU_EVENT_TYPE");101 std::string eventTypeStr = GetEnvVar("PYPTO_PROF_PMU_EVENT_TYPE");
102 if (eventTypeStr.empty()) {102 if (eventTypeStr.empty()) {
103- MACHINE_LOGW("Dont support PYPTO_PROF_PMU_EVENT_TYPE env, use default pmu event type PIPE_UTILIZATION.\n");103+ MACHINE_LOGW("Don't support PYPTO_PROF_PMU_EVENT_TYPE env, use default pmu event type PIPE_UTILIZATION.\n");
104 eventTypeStr = "2";104 eventTypeStr = "2";
105 }105 }
106 int32_t profPmuType = PIPE_UTILIZATION;106 int32_t profPmuType = PIPE_UTILIZATION;
@@ -257,7 +257,7 @@ public:
257 }257 }
258 258 
259 AfterAllocSuccess(cache, obj, objSize);259 AfterAllocSuccess(cache, obj, objSize);
260- DEV_VERBOSE_DEBUG("[SlabWsAllocator]Alloc sucess obj = %p cacheType = %u size = %u .\n", obj, cacheType,260+ DEV_VERBOSE_DEBUG("[SlabWsAllocator]Alloc success obj = %p cacheType = %u size = %u .\n", obj, cacheType,
261 objSize);261 objSize);
262 return static_cast<uint8_t*>(obj) + SLAB_OBJ_META_SIZE;262 return static_cast<uint8_t*>(obj) + SLAB_OBJ_META_SIZE;
263 }263 }
@@ -333,7 +333,7 @@ public:
333 {333 {
334 void* temp = info.heads[i];334 void* temp = info.heads[i];
335 while (temp) {335 while (temp) {
336- DEV_VERBOSE_DEBUG("[SlabWsAllocator]recycle sucess obj = %p cacheType = %d size = %u .\n", temp, i,336+ DEV_VERBOSE_DEBUG("[SlabWsAllocator]recycle success obj = %p cacheType = %d size = %u .\n", temp, i,
337 cache.objSize);337 cache.objSize);
338 temp = *static_cast<void**>(temp);338 temp = *static_cast<void**>(temp);
339 }339 }
@@ -58,12 +58,16 @@ inline bool CheckOffsetAndValidShapeInRawShape(uint64_t offset[DEV_SHAPE_DIM_MAX
58 return clamped;58 return clamped;
59 }59 }
60 if (offset[i] > rawShape[i]) {60 if (offset[i] > rawShape[i]) {
61- DEV_WARN("#ctrl.stitch.bound: action=offset_out_of_range, offset > rawShape");61+ DEV_WARN("#ctrl.stitch.bound: action=offset_out_of_range, offset[%d]=%lu > rawShape[%d]=%lu", i,
62+ static_cast<unsigned long>(offset[i]), i, static_cast<unsigned long>(rawShape[i]));
62 offset[i] = rawShape[i];63 offset[i] = rawShape[i];
63 validShape[i] = 0;64 validShape[i] = 0;
64 clamped = true;65 clamped = true;
65 } else if (validShape[i] > rawShape[i] - offset[i]) {66 } else if (validShape[i] > rawShape[i] - offset[i]) {
66- DEV_WARN("#ctrl.stitch.bound: action=validShape_out_of_range, offset + validShape > rawShape");67+ DEV_WARN("#ctrl.stitch.bound: action=validShape_out_of_range, offset[%d]=%lu + validShape[%d]=%lu > "
68+ "rawShape[%d]=%lu",
69+ i, static_cast<unsigned long>(offset[i]), i, static_cast<unsigned long>(validShape[i]), i,
70+ static_cast<unsigned long>(rawShape[i]));
67 validShape[i] = rawShape[i] - offset[i];71 validShape[i] = rawShape[i] - offset[i];
68 clamped = true;72 clamped = true;
69 }73 }
@@ -301,7 +301,7 @@ static void EncodeRawShape(const SymbolicExpressionTable* expressionTable, DevAs
301 encoded->maxStaticMemReq = AlignUp(DataSizeOf(nelm, rawTensor->GetDataType()), TENSOR_ADDR_ALIGNMENT);301 encoded->maxStaticMemReq = AlignUp(DataSizeOf(nelm, rawTensor->GetDataType()), TENSOR_ADDR_ALIGNMENT);
302 if (nelm > MAX_SHAPE_WARN_THRESHOLE) {302 if (nelm > MAX_SHAPE_WARN_THRESHOLE) {
303 MACHINE_LOGW(303 MACHINE_LOGW(
304- "[workspaceSize] Root=[%s], symbol=[%s],rawmagic=[%d]: staticMemReq=[%lu] is too larger, which might "304+ "[workspaceSize] Root=[%s], symbol=[%s],rawmagic=[%d]: staticMemReq=[%lu] is too large, which might "
305 "indicate an error",305 "indicate an error",
306 rootName.c_str(), rawTensor->symbol.c_str(), rawTensor->GetRawMagic(), encoded->maxStaticMemReq);306 rootName.c_str(), rawTensor->symbol.c_str(), rawTensor->GetRawMagic(), encoded->maxStaticMemReq);
307 }307 }
@@ -1449,7 +1449,7 @@ struct EncodeDevAscendFunctionInfo {
1449 } else {1449 } else {
1450 useList.emplace_back(opIdx, coaIndex, producerOpType, opCode);1450 useList.emplace_back(opIdx, coaIndex, producerOpType, opCode);
1451 }1451 }
1452- MACHINE_LOGD("Outcast oOperandIdx for outcast %d rawtensor maigic %d is %zu.", o->magic, o->GetRawMagic(),1452+ MACHINE_LOGD("Outcast oOperandIdx for outcast %d rawtensor magic %d is %zu.", o->magic, o->GetRawMagic(),
1453 oOperandIdx);1453 oOperandIdx);
1454 auto expr = callAttr->GetOutcastSymbolicExpr(oOperandIdx);1454 auto expr = callAttr->GetOutcastSymbolicExpr(oOperandIdx);
1455 outcastOpAttr.bindTensorExprIndex = -1;1455 outcastOpAttr.bindTensorExprIndex = -1;
@@ -3176,7 +3176,7 @@ static void FinalizeEncodedDevAscendProgram(Function* func, DevAscendProgram* ba
3176 offset = base->GetSize();3176 offset = base->GetSize();
3177 LogWorkspaceEncodeSummary(1, runtimeCfg.stitchNumMax, *base, depthConfig, runtimeCfg.maxWorkspaceBytes,3177 LogWorkspaceEncodeSummary(1, runtimeCfg.stitchNumMax, *base, depthConfig, runtimeCfg.maxWorkspaceBytes,
3178 runtimeCfg.workspaceStitchMin);3178 runtimeCfg.workspaceStitchMin);
3179- MACHINE_LOGD("StitchPool:%lu, aicoreSpilled:%lu.", base->memBudget.metadata.stitchPool,3179+ MACHINE_LOGD("StitchPool:%lu bytes, aicoreSpilled:%lu bytes.", base->memBudget.metadata.stitchPool,
3180 base->memBudget.aicoreSpilled.Total());3180 base->memBudget.aicoreSpilled.Total());
3181 func->GetDyndevAttribute()->maxDynamicAssembleOutcastMem = wsDesc.maxDynamicAssembleOutcastMem;3181 func->GetDyndevAttribute()->maxDynamicAssembleOutcastMem = wsDesc.maxDynamicAssembleOutcastMem;
3182 func->GetDyndevAttribute()->maxDynamicCellMatchTableMem = wsDesc.cellMatch.maxDynamicCellMatchTableMem;3182 func->GetDyndevAttribute()->maxDynamicCellMatchTableMem = wsDesc.cellMatch.maxDynamicCellMatchTableMem;
@@ -165,7 +165,8 @@ uint64_t CalcGeneralMetadataSlotWorkspace(DevAscendProgram* devProg)
165 uint64_t itemPoolMemSize = DeviceWorkspaceAllocator::CalcMetadataItemPoolMemSize(devProg);165 uint64_t itemPoolMemSize = DeviceWorkspaceAllocator::CalcMetadataItemPoolMemSize(devProg);
166 uint64_t vectorMemSize = DeviceWorkspaceAllocator::CalcMetadataVectorMemSize(devProg);166 uint64_t vectorMemSize = DeviceWorkspaceAllocator::CalcMetadataVectorMemSize(devProg);
167 uint64_t slotAllocatorMemSize = DeviceWorkspaceAllocator::CalcMetadataSlotAllocatorMemSize(devProg);167 uint64_t slotAllocatorMemSize = DeviceWorkspaceAllocator::CalcMetadataSlotAllocatorMemSize(devProg);
168- MACHINE_LOGI("[workspaceSize] ItemPoolMemSize is: %lu, vectorMemSize is: %lu, slotAllocatorMemSize is %lu.,",168+ MACHINE_LOGI("[workspaceSize] ItemPoolMemSize is: %lu bytes, vectorMemSize is: %lu bytes, slotAllocatorMemSize is "
169+ "%lu bytes.,",
169 itemPoolMemSize, vectorMemSize, slotAllocatorMemSize);170 itemPoolMemSize, vectorMemSize, slotAllocatorMemSize);
170 static constexpr uint64_t AICPU_SLOT_STATIC_MEMSIZE = 2 * MEBI;171 static constexpr uint64_t AICPU_SLOT_STATIC_MEMSIZE = 2 * MEBI;
171 generalMetadataSlotSize = itemPoolMemSize + vectorMemSize + slotAllocatorMemSize + AICPU_SLOT_STATIC_MEMSIZE;172 generalMetadataSlotSize = itemPoolMemSize + vectorMemSize + slotAllocatorMemSize + AICPU_SLOT_STATIC_MEMSIZE;
@@ -201,7 +202,7 @@ uint64_t CalcGeneralMetadataSlabWorkspace(DevAscendProgram* devProg)
201 MACHINE_LOGI("[workspaceSize] RequiredSlabNum[%d] is %u.", i, requiredSlabNum);202 MACHINE_LOGI("[workspaceSize] RequiredSlabNum[%d] is %u.", i, requiredSlabNum);
202 generalMetadataSlabSize += static_cast<uint64_t>(requiredSlabNum) * slabSize;203 generalMetadataSlabSize += static_cast<uint64_t>(requiredSlabNum) * slabSize;
203 }204 }
204- MACHINE_LOGI("[workspaceSize] General->MetadataSlabSize is %lu.",205+ MACHINE_LOGI("[workspaceSize] General->MetadataSlabSize is %lu bytes.",
205 static_cast<unsigned long>(generalMetadataSlabSize));206 static_cast<unsigned long>(generalMetadataSlabSize));
206 generalMetadataSlabSize = (generalMetadataSlabSize < GENERAL_METADATA_SIZE_MIN) ? GENERAL_METADATA_SIZE_MIN :207 generalMetadataSlabSize = (generalMetadataSlabSize < GENERAL_METADATA_SIZE_MIN) ? GENERAL_METADATA_SIZE_MIN :
207 generalMetadataSlabSize;208 generalMetadataSlabSize;
@@ -495,9 +496,9 @@ static void ProcessDevFunctionOutcasts(WorkspaceDesc::WorkspacePerRootFunctionDe
495 rootMem.rootTotalExclusiveOutcastRawMem = devFunc->exclusiveOutcastWsMemoryRequirement;496 rootMem.rootTotalExclusiveOutcastRawMem = devFunc->exclusiveOutcastWsMemoryRequirement;
496 rootMem.leafPerCoreSpilledMem = static_cast<uint64_t>(devFunc->stackWorkSpaceSize);497 rootMem.leafPerCoreSpilledMem = static_cast<uint64_t>(devFunc->stackWorkSpaceSize);
497 maxExclusiveOutcastMem = std::max(maxExclusiveOutcastMem, maxStaticMemReq);498 maxExclusiveOutcastMem = std::max(maxExclusiveOutcastMem, maxStaticMemReq);
498- MACHINE_LOGD(499+ MACHINE_LOGD("[workspaceSize] RootInnerTensorWsMemoryRequirement is %lu bytes, exclusiveOutcastWsMemoryRequirement "
499- "[workspaceSize] RootInnerTensorWsMemoryRequirement is %lu, exclusiveOutcastWsMemoryRequirement is %lu.",500+ "is %lu bytes.",
500- devFunc->rootInnerTensorWsMemoryRequirement, devFunc->exclusiveOutcastWsMemoryRequirement);501+ devFunc->rootInnerTensorWsMemoryRequirement, devFunc->exclusiveOutcastWsMemoryRequirement);
501}502}
502 503 
503static std::pair<uint64_t, SymbolicScalar> ComputeAssembleOutcastMem(const std::vector<FlexSlotInfo>& slots)504static std::pair<uint64_t, SymbolicScalar> ComputeAssembleOutcastMem(const std::vector<FlexSlotInfo>& slots)
@@ -498,16 +498,16 @@ uint64_t DeviceWorkspaceAllocator::CalcMetadataVectorMemSize(const DevAscendProg
498 // 1. symbolTable498 // 1. symbolTable
499 uint64_t symbolTableCapacity = CalculateVectorCapacity(devProg->symbolTable.size());499 uint64_t symbolTableCapacity = CalculateVectorCapacity(devProg->symbolTable.size());
500 uint64_t symbolTableMemory = symbolTableCapacity * sizeof(int64_t);500 uint64_t symbolTableMemory = symbolTableCapacity * sizeof(int64_t);
501- DEV_DEBUG("symbolTableMemory=%lu.", symbolTableMemory);501+ DEV_DEBUG("symbolTableMemory=%lu bytes.", symbolTableMemory);
502 // 2. slotList_502 // 2. slotList_
503 uint64_t slotListCapacity = CalculateVectorCapacity(devProg->slotSize);503 uint64_t slotListCapacity = CalculateVectorCapacity(devProg->slotSize);
504 uint64_t slotListMemory = slotListCapacity * sizeof(DeviceExecuteSlot);504 uint64_t slotListMemory = slotListCapacity * sizeof(DeviceExecuteSlot);
505- DEV_DEBUG("slotListMemory=%lu.", slotListMemory);505+ DEV_DEBUG("slotListMemory=%lu bytes.", slotListMemory);
506 // 3. rtBoundaryOutcastToBeFree_506 // 3. rtBoundaryOutcastToBeFree_
507 uint64_t boundaryOutcastToFreeListSize = CalculateVectorCapacity(507 uint64_t boundaryOutcastToFreeListSize = CalculateVectorCapacity(
508 devProg->memBudget.tensor.BoundaryAndInnerTemporalOutcastSlotNum());508 devProg->memBudget.tensor.BoundaryAndInnerTemporalOutcastSlotNum());
509 uint64_t boundaryOutcastToFreeMemory = boundaryOutcastToFreeListSize * sizeof(RuntimeOutcastTensor);509 uint64_t boundaryOutcastToFreeMemory = boundaryOutcastToFreeListSize * sizeof(RuntimeOutcastTensor);
510- DEV_DEBUG("boundaryOutcastToFreeMemory=%lu.", boundaryOutcastToFreeMemory);510+ DEV_DEBUG("boundaryOutcastToFreeMemory=%lu bytes.", boundaryOutcastToFreeMemory);
511 // total511 // total
512 uint64_t totalSetupVectorMemory = symbolTableMemory + slotListMemory + boundaryOutcastToFreeMemory;512 uint64_t totalSetupVectorMemory = symbolTableMemory + slotListMemory + boundaryOutcastToFreeMemory;
513 return totalSetupVectorMemory;513 return totalSetupVectorMemory;
@@ -547,7 +547,7 @@ uint32_t DeviceWorkspaceAllocator::CalcStitchSlabMemObjmaxSize(uint32_t* slabCap
547 slabMemObjmaxSize = SlabWsAllocator::CalcSlotStride(slabMemObjmaxSize);547 slabMemObjmaxSize = SlabWsAllocator::CalcSlotStride(slabMemObjmaxSize);
548 slabMemObjmaxSize = AlignUpSlab(slabMemObjmaxSize * ALLOC_NUM_ONE_SLAB + SlabWsAllocator::FirstObjBaseOffset());548 slabMemObjmaxSize = AlignUpSlab(slabMemObjmaxSize * ALLOC_NUM_ONE_SLAB + SlabWsAllocator::FirstObjBaseOffset());
549 slabMemObjmaxSize = std::max(slabMemObjmaxSize, (uint32_t)MEBI);549 slabMemObjmaxSize = std::max(slabMemObjmaxSize, (uint32_t)MEBI);
550- DEV_INFO("Stitch slab size=%u", slabMemObjmaxSize);550+ DEV_INFO("Stitch slab size=%u bytes", slabMemObjmaxSize);
551 devProg_->memBudget.metadata.stitchSlabSize = slabMemObjmaxSize;551 devProg_->memBudget.metadata.stitchSlabSize = slabMemObjmaxSize;
552 size_t j = 0;552 size_t j = 0;
553 for (size_t i = start; i < end; ++i) {553 for (size_t i = start; i < end; ++i) {
@@ -665,7 +665,7 @@ void DeviceWorkspaceAllocator::SlabStageAllocMemSubmmit(DynDeviceTask* devTask)
665 while (!submmitTaskQueue_.TryEnqueue(devTask)) {665 while (!submmitTaskQueue_.TryEnqueue(devTask)) {
666 DeviceTaskMemTryRecycle();666 DeviceTaskMemTryRecycle();
667 667 
668- __PYPTO_TIMEOUT_CHECK(WsErr::SLAB_ADD_CACHE_FAILED, return, "#workspace.submit: SlabStageAllocMemSubmmit.");668+ __PYPTO_TIMEOUT_CHECK(WsErr::SLAB_ADD_CACHE_FAILED, return, "#workspace.submit: SlabStageAllocMemSubmit.");
669 }669 }
670 return;670 return;
671}671}
@@ -121,7 +121,8 @@ static uint64_t WorkspaceTotalFromDesc(const WorkspaceDesc& desc, uint32_t paral
121static uint64_t TensorWorkspaceBytesAtStitchDepth(const WorkspaceDesc& desc, uint32_t stitchDepthK,121static uint64_t TensorWorkspaceBytesAtStitchDepth(const WorkspaceDesc& desc, uint32_t stitchDepthK,
122 uint32_t parallelism, uint64_t aicoreSpilled, uint64_t debugTotal)122 uint32_t parallelism, uint64_t aicoreSpilled, uint64_t debugTotal)
123{123{
124- ASSERT(DevCommonErr::PARAM_CHECK_FAILED, stitchDepthK > 0) << "Invalid stitchDepthK";124+ ASSERT(DevCommonErr::PARAM_CHECK_FAILED, stitchDepthK > 0)
125+ << "Invalid stitchDepthK: " << stitchDepthK << ", must be greater than 0";
125 WorkspaceDesc scratch = desc;126 WorkspaceDesc scratch = desc;
126 BuildTensorWorkspaceFromDescriptor(scratch, stitchDepthK);127 BuildTensorWorkspaceFromDescriptor(scratch, stitchDepthK);
127 return WorkspaceTotalFromDesc(scratch, parallelism, aicoreSpilled, debugTotal);128 return WorkspaceTotalFromDesc(scratch, parallelism, aicoreSpilled, debugTotal);
@@ -263,7 +263,7 @@ void LogManager::ConstructMessage(const LogLevel logLevel, const char* fmt, va_l
263 ConstructMsgHeader(logLevel, logMsg);263 ConstructMsgHeader(logLevel, logMsg);
264 int ret = vsnprintf_truncated_s(logMsg.msg + logMsg.length, MAX_MSG_LENGTH - logMsg.length, fmt, list);264 int ret = vsnprintf_truncated_s(logMsg.msg + logMsg.length, MAX_MSG_LENGTH - logMsg.length, fmt, list);
265 if (ret < 0) {265 if (ret < 0) {
266- std::cerr << "Constrcut message failed: " << ret << std::endl;266+ std::cerr << "Construct message failed: " << ret << std::endl;
267 return;267 return;
268 }268 }
269 logMsg.length += static_cast<size_t>(ret);269 logMsg.length += static_cast<size_t>(ret);
@@ -276,7 +276,7 @@ void LogManager::ConstructMsgHeader(const LogLevel logLevel, LogMsg& logMsg)
276 int ret = snprintf_s(logMsg.msg, MAX_MSG_LENGTH, MAX_MSG_LENGTH - 1, "%s %s(%lu):%s ",276 int ret = snprintf_s(logMsg.msg, MAX_MSG_LENGTH, MAX_MSG_LENGTH - 1, "%s %s(%lu):%s ",
277 GetLogLevelStr(logLevel).c_str(), kModuleName, GetTid(), GetCurrentTime().c_str());277 GetLogLevelStr(logLevel).c_str(), kModuleName, GetTid(), GetCurrentTime().c_str());
278 if (ret < 0) {278 if (ret < 0) {
279- std::cerr << "Construct log msg hader failed: " << ret << std::endl;279+ std::cerr << "Construct log msg header failed: " << ret << std::endl;
280 return;280 return;
281 }281 }
282 logMsg.length = static_cast<size_t>(ret);282 logMsg.length = static_cast<size_t>(ret);
@@ -165,7 +165,7 @@ class TestCaseCreator:
165 with open(json_file, "w", encoding="utf-8") as outfile:165 with open(json_file, "w", encoding="utf-8") as outfile:
166 json.dump(row_data, outfile, ensure_ascii=False, indent=4)166 json.dump(row_data, outfile, ensure_ascii=False, indent=4)
167 except Exception as e:167 except Exception as e:
168- logging.error("Exception occur when writing %s, exception is %s.", json_file, e)168+ logging.error("Exception occurred when writing %s, exception is %s.", json_file, e)
169 test_case["json_file"] = json_file169 test_case["json_file"] = json_file
170 return test_case170 return test_case
171 171 
@@ -312,7 +312,7 @@ class BuildOnlinePyptoImplManager(_BuildOnlineManager):
312 if not src_dir.exists():312 if not src_dir.exists():
313 # 当需要在线编译 pypto_impl 但是 whl 包内没有相关源码时, 不做在线编译.313 # 当需要在线编译 pypto_impl 但是 whl 包内没有相关源码时, 不做在线编译.
314 # 靠外部 import pypto_impl 的报错来暴露原始问题. 此处不截取该异常, 避免对原始问题的掩盖.314 # 靠外部 import pypto_impl 的报错来暴露原始问题. 此处不截取该异常, 避免对原始问题的掩盖.
315- _log.warning("Can't get pypto_impl, but it's src empty.")315+ _log.warning("Can't get pypto_impl, but its src is empty.")
316 return316 return
317 317 
318 # 跨用户协同: 检查是否有人正在往 pkg_dir 编译, 若有则等待共享结果318 # 跨用户协同: 检查是否有人正在往 pkg_dir 编译, 若有则等待共享结果
@@ -0,0 +1,27 @@
1+import logging
2+from pathlib import Path
3+from unittest.mock import patch
4+ 
5+import pytest
6+ 
7+ 
8+@pytest.fixture
9+def manager():
10+ with patch("pypto._build_online.BuildOnlinePyptoImplManager.__init__", lambda self: None):
11+ from pypto._build_online import BuildOnlinePyptoImplManager
12+ mgr = BuildOnlinePyptoImplManager()
13+ mgr._target_compiled = False
14+ mgr.pkg_lib_dir = Path("/nonexistent/pkg/lib")
15+ mgr.pkg_dir = Path("/nonexistent/pkg")
16+ mgr._lock_name = ".test.lock"
17+ mgr._compile_lock = __import__("threading").Lock()
18+ yield mgr
19+ 
20+ 
21+def test_src_dir_not_exists_logs_warning_and_returns(manager, caplog):
22+ with caplog.at_level(logging.WARNING, logger="pypto._build_online"):
23+ with patch.object(manager, "_find_pypto_impl_so", return_value=(False, None)):
24+ manager._ensure_pypto_impl_locked()
25+ 
26+ assert not manager._target_compiled
27+ assert any("Can't get pypto_impl" in record.message for record in caplog.records)