Merged
fix(pypto_pro):fix vf check bug #6760
huanyongbenAdd on Sep 29
fix(pypto_pro):fix vf check bug #6760
Merged
huanyongbenAdd on Sep 29
huanyongben
Sep 29

1、修复vf.gather接口声明中把preg作为必选参数的问题
2、删除部分vf接口声明中新增的dtype参数,和资料保持一致
3、修复codegen报错不显示用户实际代码的问题

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for huanyongben's contribution.)
huanyongbenhuanyongben
Sep 29 Created pull request, commit 0194af2b
atomgit-bot
atomgit-bot
Sep 29 Comments:

变更摘要

本 PR 主要围绕 pypto_pro 的 VF 校验与错误呈现进行修复。一方面从 Vf 相关接口中一致性地移除了 dtype 参数,精简了 API 签名(含比较、移位、归约、算术等算子),并同步更新了调用方与测试;另一方面改进了错误处理链路:jit.py 中 _codegen_target_cce 会将代码生成阶段抛出的裸 RuntimeError 按规范消息重新归类为对应的错误类并附带 span,_errors.py 的 PyptoProError 在缺失源码时会依据 span 中的文件名惰性加载源码,使代码生成检查也能像解析检查一样渲染出位置块与源码预览。

主要改动

  • 移除 Vf 接口的 dtype 参数: 在 python/pypto_pro/language/_vf_api.py 中从 max、add、sub、mul、div、reduce_sum、ge、gt、eq、ne、lt、le、shift_left、shift_right、squeeze、load、move、unsqueeze、mull、select 等大批算子的签名与文档中一致删除 dtype: Optional[DType],目标类型改为从源类型推断,接口更简洁。
  • gather 的谓词参数改为可选: 将 gather 的签名由 preg 改为 preg=None,同时移除其 dtype 参数,调整了该接口的调用形态。
  • 代码生成错误重新归类: 在 python/pypto_pro/runtime/jit.py 的 _codegen_target_cce 中,用 try/except RuntimeError 包裹 generate_single,通过 error_class_of_spec_message 与 span_of_spec_message 将带 C++ 检查首行信息、代码与 DSL 位置的异常转换为对应错误类并携带 span,使其不再以裸 RuntimeError 形式暴露。
  • 错误对象惰性补全源码: 在 python/pypto_pro/_errors.py 的 PyptoProError 中,当 source_lines 为 None 且 span 含 filename 时,调用 source_lines_of(self.span["filename"]) 读取该文件,从而让位置块渲染出源码预览。
  • 测试同步更新: 测试用例删除 squeeze/unsqueeze/shift_right 等调用中的 dtype 参数,移除 kernel_15_cmp_unsqueeze 相关实现与断言,将 SIMT 架构校验的预期异常由 RuntimeError 改为 NotSupported,并新增代码生成检查渲染位置块的用例。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Sep 29 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Sep 29 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Sep 29 Comments:

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
9.2.0 ✅ gcw_kUomxQ2l, gaoxiang618 (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)
likedislike
CANN-robot
CANN-robotCollaborators
Sep 29 Comments:

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
Sep 29 Set xinweiliu,cam_bxh,dai-zhentao,TianXL,lululu40888,shi-dingkun,gguuaanngg,codehjp423,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,tsungl4,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,gcw_kUomxQ2l,Andy-lb,WenboCodes as approver
CANN-robotCANN-robotCollaborators
Sep 29 Set TianXL,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gcw_kUomxQ2l,Andy-lb as approver
huanyongbenhuanyongben
Sep 29 Modify description of pull request
huanyongben
huanyongben
Sep 29 Comments:

compile

likedislike
huanyongbenhuanyongben
Sep 29 Pre merge succeeded (commit_id: ef0cc0a5d133371acff6ed9464d0bd390ca04beb)
CANN-robot
CANN-robotCollaborators
Sep 29 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 29 Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 29 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 29 Added label: ci-pipeline-passed
gaoxiang618
gaoxiang618Collaborators
Sep 29 Comments:

/approve
/lgtm

likedislike
liulun0308
liulun0308Collaborators
Sep 30 Comments:

/approve

likedislike
CANN-robot
CANN-robotCollaborators
Sep 30 Comments:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
/approve: gaoxiang618

likedislike
CANN-robotCANN-robotCollaborators
Sep 30 Added label: lgtmapproved
CANN-robotCANN-robotCollaborators
Sep 30 Merged pull request