已合并
[fix]日志整改 #4874
[fix]日志整改 #4874
已合并
devHaven创建于 12 天前
devHaven成员
12 天前

描述

本pr主要是修改错误描述不完整、级别错配、禁止中文、冗余日志和未知缩写等问题,主要涉及experimental、src/base_comm/resources/hccp、src/coll_communicator_mgr、src/legacyascend910/algorithm/impl/coll_executor、src/legacyascend910/framework、src/legacyascend910/platform/commom/adapter、src/legacyascend910/pub_inc、src/legacy/ascend950/service/collective/alg/coll_alg_factory等文件的修改

变更类型

请选择本次引入的变更类型:

关联的Issue

NA

测试

未修改功能逻辑,故不涉及checker和真机用例验证

补充的UT用例:
1.Ut_GetCurLocalRank_When_RankNotInList_Expect_InternalError:增加GetCurLocalRank接口中当curLocalRank无效时返回HCCL_E_INTERNAL
2.Ut_GetSocketDescFromRankInfo_When_ListenPortInvalid_Expect_ParaError:GetSocketDescFromRankInfo 返回 HCCL_E_PARA,验证了 server 端监听端口非法时的错误返回路径

文档更新

NA

合入检查

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 devHaven 的贡献)
DdevHaven成员
12 天前 创建了 pull request,commit 6cc1a710
atomgit-bot
atomgit-bot
12 天前 评论:

变更摘要

该 PR 是一次日志整改(fix/log-warnings-cleanup),针对通信库中错误描述不完整、日志级别错配、日志含中文、冗余日志和未知缩写等问题,对 19 个文件的日志文本、日志级别和日志内容进行了系统性修正。改动不涉及功能逻辑变更,主要覆盖 HCCL_INFO/HCCL_ERROR/hccp_err 等日志宏的调用内容与级别调整,以及 Python 侧 common.log_info/log_error 的中文日志英文化。

主要改动

  • 未知缩写清理:移除日志中的非标准缩写,如 SPKnslbdpNSLBDP-VERSIONrs_ibv_exp_create_cq 等,改为带函数上下文的可读描述;其中 coll_comm_executor.ccGetAdjInfo 将错误分支日志从 HCCL_INFO 提升为 HCCL_WARNING,修正级别错配。
  • 日志内容错误修正:修正日志文本与实际变量/操作不符的问题,如 transport_pub.h 中将误写的 remoteInputMem/remoteOutputMem 改为 localInputMem/localOutputMemrs_rdma.c 中将 addr is NULL 改为 ibMr is NULL 并在 RsMrDereg 中补充 qpn/addr 信息,ccu_context_reduce_mesh1d_two_shot_mem2mem.cc 将日志中的 srcAddr 改为 dstAddrins_temp_reduce_aicpu_reduce.ccBatchSend 改为 BatchRecv
  • 错误描述补全:为报错日志补充取值范围或期望值,如 externalinput.ccHCCL_DETERMINISTIC 错误补充期望值 STRICT/TRUE/FALSEra_adp.c 的 chip id 错误补充 HCCP_MAX_CHIP_ID、HDC 超时错误补充单位 mscluster_monitor.cc/my_rank.cc/group_schedule_mgr.cc 的端口与 rank 校验错误补充最大值/有效区间。
  • 日志英文化exec_realtime_cmd.pysignal_handlerforce_close 等函数的文档字符串与运行日志(如 Ctrl+C 处理、SSH 连接失败、命令执行错误)由中文改为英文,符合禁止中文日志要求。
  • 语义与冗余修正adapter_rts.ccenableP2P/disableP2P 的日志措辞由 fail 改为 ret(避免与 INFO 级别语义冲突),aicpu_zero_copy_exchanger.cc 修复重复方括号并明确 sdma batch copy 语义,host_cpu_roce_channel.cc 在日志中补充 BuildSocket 上下文,rs_drv_rdma.c 区分发送/接收 CQ 的创建日志。
likedislike
不准确?
atomgit-bot
atomgit-bot
12 天前 评论:

代码审查

I have now reviewed all 19 changed files in this PR. This is a pure "日志整改" (log rectification) PR — every hunk modifies only log message text, log levels, or format strings. Let me do the final sweep on the one hunk containing computation (ra_adp.c timeout conversion) and the boundary values:

Final sweep notes:

  • ra_adp.c RaHwInit: timeout * (RA_THREAD_SLEEP_TIME / 1000) = timeout * 2 ms, since RA_THREAD_SLEEP_TIME is 2000µs and timeout (int) starts at RA_THREAD_TRY_TIME=500, max value 1000 — no overflow, math consistent with the usleep(RA_THREAD_SLEEP_TIME) loop. Log-only.
  • ra_adp.c RaHdcServerInit: new message passes chipId (unsigned int) and HCCP_MAX_CHIP_ID for %u — both unsigned, format matches; the gHdcServer[chipId] indexing/short-circuit logic is pre-existing and untouched.
  • group_schedule_mgr.cc: serverToRankSize_ is std::map<uint32_t,uint32_t>, so .at() returns uint32_t for %u — valid range [0, size) message matches the curLocalRank >= size check.
  • cluster_monitor.cc / my_rank.cc: Hccl::MAX_VALUE_TCPPORT is constexpr unsigned int (65535) — %u correct, matches the > MAX checks.
  • rs_rdma.c: gRsSendWrNum is still referenced at line 1054 (gRsSendWrNum++), so removing its log reference does not create dead code; new qpn[%u] addr[0x%llx] args match types (unsigned int, (unsigned long long)(uintptr_t)addr).
  • transport_pub.h: labels now match the data printed (each of the 4 MemDetails logged with its own correct label) — this is a fix, not a regression.
  • ccu_context_reduce_mesh1d_two_shot_mem2mem.cc: log now names dstAddr.size matching the actual check dstAddr.size() != transports.size() + 1 (the Invalid srcAddr size exception string mismatch is pre-existing, unmodified).
  • ins_temp_reduce_aicpu_reduce.cc: Recv failure now logs "BatchRecv failed" — genuine fix.
  • adapter_rts.cc: fail[%d]ret[%d] on unconditional INFO logs — accurate improvement.
  • Python file: docstring/log translations only; syntax intact.

No boundary errors, format-string mismatches, memory issues, or logic regressions were introduced.

关闭总结

审查结论:本 PR 为纯日志整改,共 19 个文件全部逐一审查完毕,未发现值得上报的问题。

按文件确认:

  1. experimental/base_comm/channel/host_cpu_roce_channel.cc — no issues(仅日志文本补充)
  2. experimental/cluster_link_diag/dispatcher/exec_realtime_cmd.py — no issues(中译英日志/文档字符串,语法完整)
  3. src/base_comm/resources/hccp/rdma_agent/adapter/ra_adp.c — no issues(日志消息完善;timeout 换算 ×2msRA_THREAD_SLEEP_TIME=2000us 一致,无溢出)
  4. src/base_comm/resources/hccp/rdma_agent/peer/ra_peer_ctx.c — no issues(格式串参数与类型匹配)
  5. src/base_comm/resources/hccp/rdma_service/rs_drv_rdma.c — no issues(日志加 send/recv 区分)
  6. src/base_comm/resources/hccp/rdma_service/rs_rdma.c — no issues(gRsSendWrNum 仍在别处引用,非死代码)
  7. src/coll_communicator_mgr/communicator/group_schedule_mgr/group_schedule_mgr.cc — no issues(%u 与 map 值类型匹配,范围描述正确)
  8. src/coll_communicator_mgr/dfx/cluster_monitor/cluster_monitor.cc — no issues(MAX_VALUE_TCPPORT 为 unsigned int,格式正确)
  9. src/coll_communicator_mgr/resource_mgr/local/my_rank/my_rank.cc — no issues(同上)
  10. coll_all_reduce_mesh_aiv_executor.cc — no issues(仅移除 "SPK " 前缀)
  11. coll_comm_executor.cc — no issues(INFO→WARNING 级别调整 + 日志标签规范化,无逻辑改动)
  12. coll_reduce_scatter_aiv_deter_small_executor.cc — no issues(仅移除 "SPK " 前缀)
  13. comm_config.cc — no issues(日志标签规范化)
  14. aicpu_zero_copy_exchanger.cc — no issues(错误消息措辞修正,与实际 sdma 操作一致)
  15. adapter_rts.cc — no issues(无条件 INFO 日志 "fail"→"ret",更准确)
  16. externalinput.cc — no issues(补充合法取值说明,字符串拼接正确)
  17. transport_pub.h — no issues(日志标签与所打印字段对齐,属修复)
  18. ccu_context_reduce_mesh1d_two_shot_mem2mem.cc — no issues(日志变量名与检查条件 dstAddr.size() 对齐)
  19. ins_temp_reduce_aicpu_reduce.cc — no issues(Recv 失败日志 "BatchSend"→"BatchRecv",属修复)

风险判断:低风险。所有改动均限定在日志文本与日志级别,无逻辑、内存、安全或接口契约变更;个别格式串修复提升了日志可读性且参数类型均正确。

类型 数量
🔴 阻塞 0
🟡 建议 1

💬 仅评论

likedislike
不准确?
CANN-robotCANN-robot成员
12 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
12 天前 评论:

CLA Signature Pass

devHaven, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
此处折叠了155条消息 查看更多
bz_lee成员
9 天前 评论:

/approve

likedislike
57_Viking
57_Viking成员
9 天前 评论:

/approve

likedislike
philo
philo成员
9 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
9 天前 添加了label:approved
CANN-robotCANN-robot成员
9 天前 合入了pull request