Pull Request has been successfully merged by CANN-robot.
(Thank you for huanyongben's contribution.)变更摘要
本 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,并新增代码生成检查渲染位置块的用例。


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 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


/approve
/lgtm


/approve


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


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