Pull Request has been successfully merged by CANN-robot.
(Thank you for KaranocaVe's contribution.)变更摘要
本 PR 修复了 64 位 Host 上 PyACL Allocator 回调的 size 参数截断问题。在 python/pyACL/rt/rt_allocator.cpp 中,AllocatorAllocFunc 与 AllocatorAllocAdviseFunc 通过 Py_BuildValue 向 Python 侧回调传递 size_t size 时使用了 I 格式项,导致 4 GiB 等大尺寸请求被截断为 0;现将两处格式串改为 K,并将 size 显式转换为 unsigned long long 传入,从而在 Host CPython C-API 下完整保留大尺寸参数。
主要改动
- 修正回调参数格式串: 将
AllocatorAllocFunc中Py_BuildValue("kI", allocator, size)改为Py_BuildValue("kK", allocator, static_cast<unsigned long long>(size)),使 4 GiB 及以上的分配请求不再被截断为 0。 - 修正 Advise 回调参数格式串: 将
AllocatorAllocAdviseFunc中Py_BuildValue("kIk", allocator, size, addr)改为Py_BuildValue("kKk", allocator, static_cast<unsigned long long>(size), addr),保证带地址参数的回调同样按 64 位保留大小。 - 统一大小参数类型传递: 两处均显式将
size_t size转换为unsigned long long,与K格式项的取值要求保持一致,确保在 64 位 Host 上传递行为正确。
🧩 本次 Review 已使用自定义 Skill:




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.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/runtime | ✅ 卢煜坤, zhangpengpeng8 (2/2) | ✅ 卢煜坤 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
KaranocaVe, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


根据 CANN-robot 当前审批进度,该 PR 仍缺少必要的代码检视或合入审批。麻烦 wangtao43 houyanbao ykl999 tingwood zhangpengpeng8 Reyn52166 抽空协助审核;确认无误后请按仓库规则执行 /lgtm 和 /approve,谢谢!


再次提醒:根据 CANN-robot 当前审批进度,该 PR 仍缺少必要的代码检视或合入审批。麻烦 @wangtao43 @houyanbao @ykl999 @tingwood @zhangpengpeng8 @Reyn52166 抽空协助审核;确认无误后请按仓库规则执行 /lgtm 和 /approve,谢谢!


已核对当前头提交 85b695376e2ca53a6e70e63e2b64d181cc9611b6:无冲突,CLA/ci-pipeline-passed 已通过,审批条件状态已满足。当前仅缺少维护者合入权限;尝试用 gc pr test 触发当前头提交检查返回 403 Unauthorized。请维护者按需重跑当前头提交流水线并合入。


/compile


/approve
/lgtm


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


流水线分析报告 — runtime run#6227
流水线: https://gitcode.com/cann/runtime/actions/runs/0cca9c536a8b46518663bc182f8f0688 | PR#5802 | 2026-11-02 11:33:11 ~ 11:45:00 | 失败 Job 1 个
定界结论: 代码问题 / LLT测试失败 — UT 用例 AclJsonChannelReporterFftsProfileTaskOffTest 断言失败
- 失败类型: 代码问题(UT 测试运行失败)
- 根因:
AclJsonProfJsonStest.AclJsonChannelReporterFftsProfileTaskOffTest中MsprofMgr().AclJsonStart(0, data)返回 -1(期望PROFILING_SUCCESS=0),其前置原因是 profiling 数据校验在输出目录中找不到device数据(ffts_profile 通道采集 0 字节)。 - 与 PR 变更关系: PR#5802 仅修改
python/pyACL/rt/rt_allocator.cpp(2 行,Py_BuildValue格式kI→kK),与该 C++ profiling UT 无关联,判定为与本次变更无关的偶发/数据采集类失败。 - 处置建议: 重新触发 UT 验证;若稳定复现,再排查 profiler
ffts_profile(channel 53) 采集 0 字节及data_check对device目录的校验逻辑。 - 排除项: 日志中
AclJsonNanoStest全部为[ SKIPPED ](平台不支持),不是挂起/失败;本 run 仅 1 个失败 Job(UT),无下游级联失败。
失败根因分析
根因 #1: 代码问题 / LLT测试失败 — acljson_prof_json_stest.cpp:63 断言 AclJsonStart 返回 -1
- 判据:
acljson_prof_json_stest.cpp:63: Failure,Expected equality of these values: PROFILING_SUCCESS(0) vs MsprofMgr().AclJsonStart(0, data)(-1) - 定位步骤:
4_ut_acc.log(末尾UT acljson_stest failed, exit code: 1) - 影响 Job: UT
- 根因证据(日志原文):
[ERROR][data_check.cpp:337] Failed to find data pattern : device in path : ./acljsonJsonstest_workspace/output/PROF_000001_20261102114249253_00006872EOKGPQEM
[ERROR][data_check.cpp:286] Failed to read device dir: ./acljsonJsonstest_workspace/output/PROF_000001_20261102114249253_00006872EOKGPQEM
[ERROR][data_check.cpp:223] Fail to get device data path.
acljson_prof_json_stest.cpp:63: Failure
Expected equality of these values:
PROFILING_SUCCESS
Which is: 0
MsprofMgr().AclJsonStart(0, data)
Which is: -1
[ FAILED ] AclJsonProfJsonStest.AclJsonChannelReporterFftsProfileTaskOffTest (1101 ms)
...
[ FAILED ] 1 test, listed below:
[ FAILED ] AclJsonProfJsonStest.AclJsonChannelReporterFftsProfileTaskOffTest
1 FAILED TEST
- 佐证: 同一用例停止采集时
channel: 53, file:data/ffts_profile.data, total_size_channel: 0 bytes, channelReadCnt:0,即 ffts_profile 通道未采到数据,与后续device数据缺失一致;其余 150+ 用例均 PASS。
结构化定界摘要
[{"repo": "runtime", "run_number": 6227, "Failed_Type": "代码问题", "Failed_Sub_Type": "LLT测试失败", "Failed_Reason": "UT 用例 AclJsonChannelReporterFftsProfileTaskOffTest 断言失败: MsprofMgr().AclJsonStart 返回 -1(期望0), 前置为 data_check 在 profiling 输出目录找不到 device 数据(ffts_profile 通道采集0字节); PR 仅改 pyACL rt_allocator.cpp, 与本失败无关联, 疑似偶发", "evidence": "acljson_prof_json_stest.cpp:63: Failure Expected equality: PROFILING_SUCCESS(0) vs MsprofMgr().AclJsonStart(0, data)(-1); [ERROR][data_check.cpp:337] Failed to find data pattern : device in path : ./acljsonJsonstest_workspace/output/PROF_...", "suggestion": "重新触发 UT 验证; 若稳定复现再排查 profiler ffts_profile(channel 53) 采集0字节与 data_check 的 device 目录校验逻辑", "jobs": "UT"}]
由门禁失败定界分析自动生成 | repo: runtime | run: 0cca9c536a8b46518663bc182f8f0688 | PR#5802


/compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


/lgtm


fix(runtime): 修复 PyACL Allocator 回调大小参数截断
在 64 位 Host 上,PyACL 将
size_t size通过Py_BuildValue的I格式项传给 Python Allocator 回调。请求 4 GiB 时回调收到 0,而不是 4294967296;4 KiB 请求不受影响。两处格式串改为K并显式传入unsigned long long后,Host CPython C-API 对照保留了这两个大小。未运行完整 pyACL 构建或设备端测试。关联 Issue: https://gitcode.com/cann/runtime/issues/1251