已合并
foreach_asin arch35 tiling 添加 GetPlatformInfoFallback逻辑,解决 GetCompileInfo 返回空指针导致 PTA 调用失败问题 #7358
surezz创建于 7月10日
foreach_asin arch35 tiling 添加 GetPlatformInfoFallback逻辑,解决 GetCompileInfo 返回空指针导致 PTA 调用失败问题 #7358
已合并
surezz创建于 7月10日
surezz
surezz
7月10日

描述

foreach_asin arch35 tiling 添加 GetPlatformInfoFallback逻辑,解决 GetCompileInfo 返回空指针导致 PTA 调用失败问题

关联的Issue

https://gitcode.com/cann/ops-nn/issues/4023

测试

temu脚本调用成功,相关ut脚本调用成功,二级冒烟,david冒烟

文档更新

类型标签

AI/Agent生成声明

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 surezz 的贡献)
surezzsurezz
7月10日 创建了 pull request,commit 6403238c
atomgit-bot
atomgit-bot
7月10日 评论:

变更摘要

该 PR 修改了 foreachAsin 算子在 Ascend 35 架构下的 tiling 逻辑,核心变更是将平台信息(coreNumubSize)的获取方式从"仅依赖编译期信息"改为"编译期信息优先、运行时平台信息回退"的容错机制。新增的 GetPlatformInfoFallback 函数封装了这一回退逻辑,使 tiling 函数在编译信息缺失或无效时仍能通过 PlatformAscendC 运行时接口获取平台参数,提升了算子在多场景下的健壮性。

主要改动

  • 新增 GetPlatformInfoFallback 回退函数:该函数依次尝试从 context->GetCompileInfo()ForeachAsinCompileInfo 结构体)和 context->GetPlatformInfo()PlatformAscendC 运行时接口)获取 coreNumubSize,任一途径成功即返回 GRAPH_SUCCESS,两者均失败则返回 GRAPH_FAILED
  • ForeachAsinTilingFunc 中平台信息获取方式重构:原先直接通过 GetCompileInfo() 强转为 ForeachAsinCompileInfo* 并做空指针检查后读取,改为调用 GetPlatformInfoFallback 获取参数,并移除了对 compileInfo 的强制非空校验(OP_CHECK_NULL_WITH_CONTEXT),使编译信息缺失时不再直接失败。
  • 初始化方式与错误处理调整maxCoreNumubSize 改为先初始化为 0,再通过 GetPlatformInfoFallback 的返回值统一判断成功与否,简化了错误处理分支。
likedislike
atomgit-bot
atomgit-bot
7月10日 评论:

代码审查

审查总结

经过对变更文件的逐行审查,共发现 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 问题是新增函数缺少详细的失败日志,不影响运行时正确性,仅降低调试效率。

⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。

likedislike
CANN-robotCANN-robot成员
7月10日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
7月10日 评论:

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 /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
CANN-robotCANN-robot成员
7月10日 将crystalhu,yangyang016,fanqirui,chenqi317,liubo75,tangweiwei2,gitcode-chenjiao,gcw_kUomxQ2l,Andy-lb设为评审人
CANN-robotCANN-robot成员
7月10日 将gitcode-chenjiao,gcw_kUomxQ2l,Andy-lb设为审查人
surezzsurezz
7月10日 修改标题为 “foreach_asin arch35 tiling 添加 GetPlatformInfoFallback逻辑,解决 GetCompileInfo 返回空指针导致 PTA 调用失败问题”,原标题为“foreachAsin算子tiling逻辑修改”
surezzsurezz
7月10日 修改了pull request 的描述
surezz
surezz
7月10日 评论:

compile

likedislike
surezzsurezz
7月10日 update merge request[project id: 7665709, iid: 7358, commit_id: e90559cdf59f9f4fe3dabee640b07c1a7a21504d] virtual merging success
CANN-robotCANN-robot成员
7月10日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
7月10日 评论:

流水线任务触发成功
任务链接 [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执行结束

likedislike
CANN-robot
CANN-robot成员
7月10日 评论:

流水线任务触发成功
任务链接 [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执行结束

likedislike
CANN-robotCANN-robot成员
7月10日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
7月10日 添加了label:ci-pipeline-passed
chenqi317成员
7月10日 评论:

/lgtm
/approve

likedislike
liulun0308成员
7月10日 评论:

/approve

likedislike
CANN-robotCANN-robot成员
7月10日 添加了label:lgtmapproved
CANN-robotCANN-robot成员
7月10日 关闭了关联的issue
CANN-robotCANN-robot成员
7月10日 合入了pull request