Merged
fix(pypto_pro):add arguments name and type check #6717
huanyongbenAdd on Sep 24
fix(pypto_pro):add arguments name and type check #6717
Merged
huanyongbenAdd on Sep 24
huanyongben
Sep 24

1、增加对部分接口的参数校验
2、修复报错信息中缺少源码位置的报错点

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

变更摘要

本 PR 为 PyPTO Pro 前端引入基于声明签名的参数校验机制,并统一了用户 API 的声明形式。核心是新增 python/pypto_pro/language/parser/_argument_checker.py,在 @_api_decl 声明之上建立两道门:check_declared_params 在参数求值前校验参数名与数量,check_declared_types 在参数解析后校验各参数的 IR 类型。为此在 language/_api.py、_simt_api.py、_vf_api.py 中把大量 Any/Scalar 注解细化为 Tile、Tensor、Union[int, float] 等具体角色并加入位置限定符 /,新增 language/_system_api.py 提供 pl.system.* 的声明;同时把 block.transpose 的 axis1/axis2 属性移除,改为固定交换最后两维,并补充了错误定位(span/source_lines)能力与相应测试。

主要改动

  • 新增参数校验双门: _argument_checker.py 通过 declared_api 解析 _api_decl 声明,check_declared_params 用占位符绑定调用形态以报出缺失/多余/重复/近似关键字参数,check_declared_types 按注解角色匹配解析后的值类型;两道门分别在 _call_parser.py、_op_registry.py、_assignment_parser.py(vf.* 赋值形式)中接入调度点。
  • 用户 API 声明细化: language/_api.py 为 load/store/move/insert/matmul*/min/max 等加入 / 位置限定与 Union[int, float] 等具体类型,新增 Shape、Struct 别名和 wrapper.bind_declared = sig.bind;_vf_api.py 为大量 Vf 操作补充 dtype 参数,_simt_api.py 将 Scalar 细化为 Union[int, float]。
  • 新增 pl.system.* 声明文件: language/_system_api.py 定义 System 类的 bar_*、sync_src/sync_dst、set_cross_core/wait_cross_core、mutex_lock/mutex_unlock、dcci、set_mm_layout_transform 等签名,language/__init__.py 改为从该模块导出 system,并让 mutex 别名复用其声明。
  • block.transpose 接口简化: out_elementwise.cpp 移除 axis1/axis2 属性,描述改为交换最后两维;block_ops.py 的 _ir_transpose 去掉 axis1/axis2 形参并不再传属性,相关单测同步更新。
  • 错误定位能力增强: _errors.py 新增 source_lines_of,_span_tracker.py 新增 call_keyword_name_span 以标记关键字名本身,_ast_parser.py/_expression_parser.py 通过 current_span 发布语句/表达式的环境位置,_type_resolver.py、typing/_tiling.py、runtime/shape_policy.py 为报错补充 span/source_lines 与 locate 定位。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Sep 24 Comments:

代码审查

✅ 未发现问题

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

CLA Signature Pass

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

likedislike
CANN-robot
CANN-robotCollaborators
Sep 24 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-robotCANN-robotCollaborators
Sep 24 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 24 Set TianXL,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gcw_kUomxQ2l,Andy-lb as approver
huanyongbenhuanyongben
Sep 24 Modify description of pull request
huanyongben
huanyongben
Sep 24 Comments:

compile

likedislike
huanyongbenhuanyongben
Sep 24 Pre merge succeeded (commit_id: 1ef38e421dcd4f1cea4f94cb2d7b6a5aa301c8a7)
CANN-robot
CANN-robotCollaborators
Sep 24 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 24 Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 26 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 26 Added label: ci-pipeline-failed
huanyongbenhuanyongben
Sep 27 Associated issue: [Documentation|文档反馈]: pypto_pro.language.jit缺少接口文档
huanyongben
huanyongben
Sep 27 Comments:

compile

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

流水线分析报告 — pypto run#5106

流水线: https://gitcode.com/CANN/pypto/actions/runs/1ad1b88d492c43aaafe1fe2509c22152 | PR#6717 | 2026-09-27 09:47:41 ~ 2026-09-27 09:53:20 | 失败 Job 1 个

定界结论: 代码问题 / SCA检查失败 — 代码开源合规检查未通过
  • 失败类型: 代码问题
  • 根因: SCA 开源合规检查未通过, 扫描发现 4 个未确认合规问题文件
  • 处置建议: 通知 PR 提交者修复
    • SCA 无法本地验证: 请通过 扫描报告 查看报错, 修复引入的合规问题或按规范申请屏蔽
  • 排除项: 其余 Job(CodeCheck/CodeCheck_precommit/Compile/Antipoison 等)全部通过; UT/PreSmoke 等 11 个 Job 因 SCA 前置失败未启动(INIT 级联), 无独立失败

失败根因分析

根因 #1: 代码问题 / SCA检查失败 — 代码开源合规检查未通过
  • 判据: SCA 开源合规检查未通过(见扫描报告)
  • 定位步骤: 1_sca.log
  • 影响 Job: SCA
  • 根因证据(日志原文):
[2026-09-27 09:51:00.390+08:00] 响应内容: {"code":200,"message":"success","data":{"prResult":"https://www.openlibing.com/apps/personalScandTaskInfor/person/c36a71b6-b23e-439a-b2e9-ccef185ab6ff?projectId=300033&codeHostingPlatformFlag=gitcode","unconfirmedFileNum":4,"state":"success"}}
[2026-09-27 09:51:00.390+08:00] [sca check 2026-09-27 09:51:00]代码开源合规检查未通过,如需查看详情或屏蔽,请查看 [扫描报告](https://www.openlibing.com/apps/personalScandTaskInfor/person/c36a71b6-b23e-439a-b2e9-ccef185ab6ff?projectId=300033&codeHostingPlatformFlag=gitcode)
[2026-09-27 09:51:00.543+08:00] [sca check 2026-09-27 09:51:00] query scan issues success, count: 4
  • 补充: 扫描任务本身执行成功(state=success), 但存在 4 个未确认合规问题文件(unconfirmedFileNum=4), 据此判定检查未通过; 日志未列出具体文件名, 需通过扫描报告查看详情

由门禁失败定界分析自动生成 | repo: pypto | run: 1ad1b88d492c43aaafe1fe2509c22152 | PR#6717

likedislike
huanyongben
huanyongben
Sep 27 Comments:

compile

likedislike
CANN-robot
CANN-robotCollaborators
Sep 27 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 27 Removed label: ci-pipeline-failed
CANN-robotCANN-robotCollaborators
Sep 27 Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 27 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 27 Added label: ci-pipeline-passed
gcw_GldIAlFu
gcw_GldIAlFu
Sep 27 Comments:

/approve
/lgtm

likedislike
gaoxiang618
gaoxiang618Collaborators
Sep 27 Comments:

/approve
/lgtm

likedislike
liulun0308
liulun0308Collaborators
Sep 27 Comments:

/approve

likedislike
CANN-robot
CANN-robotCollaborators
Sep 27 Comments:

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

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