Pull Request has been successfully merged by CANN-robot.
(Thank you for huanyongben's contribution.)变更摘要
本 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定位。


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
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


compile


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


compile


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


流水线分析报告 — 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


compile


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


/approve
/lgtm


/approve
/lgtm


/approve


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


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