Pull Request已成功合入, 合并人@CANN-robot
(感谢 duanpengliang 的贡献)变更摘要
本 PR 以「fix magic number」为目标,主要将 ACL 与 Runtime 层日志、错误信息中直接打印的枚举数值(魔法数字)替换为可读的枚举名称描述。改动通过新增 GetStreamAttrDesc、ErrorTypeToString、HostMemMapCapabilityToString 等枚举转字符串工具函数,并在参数校验与错误提示中复用已有的 MemLocationTypeToString、ReduceKindToString 等函数,使日志与报错信息更直观,同时补充了对应的单元测试。
主要改动
- 新增枚举转字符串工具函数: 在
cann_info_utils.cpp中新增GetStreamAttrDesc,在enum_desc.hpp中新增ErrorTypeToString与HostMemMapCapabilityToString,用于将对应枚举值转换为「名称(数值)」形式的可读字符串。 - ACL 流属性日志可读化:
aclrtSetStreamAttributeImpl的日志由stmAttrType = [%u]改为stmAttrType = [%s],使用GetStreamAttrDesc输出属性名称。 - Runtime 参数校验与错误信息可读化:
api_error.cc中MemcpyAsync、MemcpyAsyncPtr、ReduceAsyncV2、MemWriteValue、MemWaitValue等校验消息由裸数值或std::to_string改为MemLocationTypeToString、ReduceKindToString描述,并将部分宏由_WITH_PARAM_DESC调整为_WITH_PARAM_NAME_DESC以携带参数名。 - 设备故障修复错误提示可读化:
api_impl.cc与api_impl_david.cc的RepairError默认分支改用ErrorTypeToString输出错误类型名称,替代原先的数字打印。 - 内存映射能力日志与文案修正:
npu_driver_mem.cc中capabilities=%d改为capabilities=%s并使用HostMemMapCapabilityToString;api_c_memory.cc中错误文案RT_CMO_INVALID(8)改为CMO_INVALID(8)。 - 补充单元测试: 为
GetStreamAttrDesc、ErrorTypeToString、HostMemMapCapabilityToString新增已知值与未知值(UNKNOWN)的断言覆盖。


compile


Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| src/acl | ✅ yanmingxiang, 卢煜坤 (2/2) | ✅ 卢煜坤, yanmingxiang (2/1) |
| src/runtime | ✅ yanmingxiang, 卢煜坤 (2/2) | ✅ yanmingxiang, 卢煜坤 (2/1) |
| tests/ut/acl | ✅ 卢煜坤, yanmingxiang (2/2) | ✅ yanmingxiang, 卢煜坤 (2/1) |
| tests/ut/runtime | ✅ yanmingxiang, 卢煜坤 (2/2) | ✅ yanmingxiang, 卢煜坤 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
duanpengliang, thanks for your pull request. All authors of the commits have signed the CLA. 👍


流水线任务触发成功
任务链接 [083e865f5fea4a04977e507dee1612a4][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test_acl | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_v201 | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_c | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_david | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_910b | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_common | ✅ SUCCESS | >>>>> | |
| UT_Test_platform | ✅ SUCCESS | >>>>> | |
| UT_Test_qs | ✅ SUCCESS | >>>>> | |
| UT_Test_aicpusd | ✅ SUCCESS | >>>>> | |
| UT_Test_tsd | ✅ SUCCESS | >>>>> | |
| UT_Test_error_manager | ✅ SUCCESS | >>>>> | |
| UT_Test_slog | ✅ SUCCESS | >>>>> | |
| UT_Test_atrace | ✅ SUCCESS | >>>>> | |
| UT_Test_msprof_part1 | ✅ SUCCESS | ||
| UT_Test_msprof_part2 | ✅ SUCCESS | ||
| UT_Test_adump | ✅ SUCCESS | >>>>> | |
| UT_Test_mmpa | ✅ SUCCESS | >>>>> | |
| UT_Test_camodel_check | ✅ SUCCESS | ||
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_report | ✅ SUCCESS | >>>>> | |
| UT_Test_msprof_report | ✅ SUCCESS | >>>>> |
[2026-08-13 17:13:47] CI执行结束


流水线任务触发成功
任务链接 [4ba630d906084e88880213be163290d9][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_Check_Pr | ✅ SUCCESS | ||
| codecheck_style | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS |
[2026-08-13 17:03:44] CI执行结束


/lgtm
/approve


严重程度:建议修改。该新增行在 git diff --check origin/master...refs/codex-review/pr-4232-head 中报 trailing whitespace,输出内容带 CRLF/行尾空白。该问题通常不影响运行逻辑,但可能导致仓库格式检查或提交前检查失败,并增加后续 diff 噪声。建议将受影响文件统一转为 LF,例如使用 dos2unix 或在编辑器中选择 LF 并去除行尾空白,然后重新执行 git diff --check origin/master...refs/codex-review/pr-4232-head 验证。


/approve
/lgtm


The MR can not be merged, because of CodeReview discussion not resolved
If you want to solve this problem, you can click here to do it in the FAQs.


Pull Request
描述
修复acl及acl映射的rt枚举打印是数字问题,修复为字符串(数字)形式
变更类型
请选择本次引入的变更类型:
关联的Issue
如何测试
描述测试此变更的步骤和前提条件:
编译执行无问题
核对清单
其他信息
在此添加任何其他关于本次 PR 的说明。