Pull Request已成功合入, 合并人@CANN-robot
(感谢 surezz 的贡献)变更摘要
该 PR 修改了 foreachAsin 算子在 Ascend 35 架构下的 tiling 逻辑,核心变更是将平台信息(coreNum、ubSize)的获取方式从"仅依赖编译期信息"改为"编译期信息优先、运行时平台信息回退"的容错机制。新增的 GetPlatformInfoFallback 函数封装了这一回退逻辑,使 tiling 函数在编译信息缺失或无效时仍能通过 PlatformAscendC 运行时接口获取平台参数,提升了算子在多场景下的健壮性。
主要改动
- 新增
GetPlatformInfoFallback回退函数:该函数依次尝试从context->GetCompileInfo()(ForeachAsinCompileInfo结构体)和context->GetPlatformInfo()(PlatformAscendC运行时接口)获取coreNum和ubSize,任一途径成功即返回GRAPH_SUCCESS,两者均失败则返回GRAPH_FAILED。 ForeachAsinTilingFunc中平台信息获取方式重构:原先直接通过GetCompileInfo()强转为ForeachAsinCompileInfo*并做空指针检查后读取,改为调用GetPlatformInfoFallback获取参数,并移除了对compileInfo的强制非空校验(OP_CHECK_NULL_WITH_CONTEXT),使编译信息缺失时不再直接失败。- 初始化方式与错误处理调整:
maxCoreNum和ubSize改为先初始化为 0,再通过GetPlatformInfoFallback的返回值统一判断成功与否,简化了错误处理分支。


代码审查
审查总结
经过对变更文件的逐行审查,共发现 1 个问题:
| 优先级 | 数量 |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 0 |
| P3 | 1 |
已审查文件:
foreach/foreach_asin/op_host/arch35/foreach_asin_tiling_arch35.cpp— 发现 1 个 P3 问题(GetPlatformInfoFallback 缺少具体失败原因日志)
整体风险评估:低风险。 该变更将平台信息获取逻辑抽取为独立的 GetPlatformInfoFallback 函数,增加了 CompileInfo → PlatformInfo 的回退机制,并正确初始化了局部变量(uint64_t ub = 0)。核心逻辑(coreNum/ubSize 的正值校验、DCACHE_SIZE 边界检查、除零保护)均正确,与代码库中其他同类算子(如 foreach_acos)的模式一致。唯一的 P3 问题是新增函数缺少详细的失败日志,不影响运行时正确性,仅降低调试效率。
⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。


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 |
|---|---|---|
| ** | ✅ 陈琦, gcw_kUomxQ2l (2/2) | ✅ gcw_kUomxQ2l (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
surezz, thanks for your pull request. All authors of the commits have signed the CLA. 👍


compile


流水线任务触发成功
任务链接 [d6d403601e584123ad3f48e9798e42fd][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_harmony-infer-chs-nn | ✅ SUCCESS | >>>>> | |
| UT_Test_ophost | ✅ SUCCESS | ||
| UT_Test_opapi | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| UT_Test_opgraph | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> |
[2026-07-10 15:40:02] CI执行结束


流水线任务触发成功
任务链接 [c58ed98be9234cb6957daa55e2a132e7][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_style | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ⚠️ WARNING | >>>>> | >>>>> |
| SCA | ✅ SUCCESS | >>>>> |
[2026-07-10 15:34:49] CI执行结束


/approve


描述
foreach_asin arch35 tiling 添加 GetPlatformInfoFallback逻辑,解决 GetCompileInfo 返回空指针导致 PTA 调用失败问题
关联的Issue
https://gitcode.com/cann/ops-nn/issues/4023
测试
temu脚本调用成功,相关ut脚本调用成功,二级冒烟,david冒烟
文档更新
类型标签
AI/Agent生成声明