Merged
feat(pypto-pro): Support infer kernel type in pypto_compile_op #6614
poorwillAdd on Sep 22
feat(pypto-pro): Support infer kernel type in pypto_compile_op #6614
Merged
Merged fromwangbing110/pyptomasterintocann/pyptomaster
Pull Request has been successfully merged by CANN-robot.
(Thank you for poorwill's contribution.)atomgit-bot
Sep 22 Comments:
Sep 22 Comments:
变更摘要
该 PR 让 pypto_compile_op 不再固定按 KERNEL_TYPE_MIX_AIC_1_2 编译,而是从 codegen 结果与编译配置中推断实际的 kernel 类型(AIC only / AIV only / mix 1:1 / mix 1:2)。改动引入基于核心比值的 KernelMetaType 推断逻辑,并将物理核选择、编译目标命名、编译宏选项、infer 源生成以及 compile_info 元数据都改为随推断出的 kernel 类型变化;同时补充了对推断函数与编译目标生成逻辑的单元测试。
主要改动
- 新增 kernel 类型推断:新增
_kernel_type_from_target/_kernel_type_from_codegen,通过_KERNEL_TYPE_BY_CORE_RATIO将aic_per_block:aiv_per_block比值映射为KernelMetaType,并由get_jit_compile_config().resolve_kernel_target结合has_cube/has_vector得到目标,不支持的比值抛出InvalidVal。 - 编译目标按类型动态选择:将固定双核的
_MIX_CORE_COMPILE_TARGETS替换为_CORE_COMPILE_TARGETS字典,新增_compile_core_names决定所需物理核、_compile_target_name决定目标名(仅 mix 类型追加_mix_aic/_mix_aiv)、_compile_target_options按类型生成编译宏(MIX_CORE_MACRO、__MIX_CORE_AIC_RATION__、C310 相关宏等)。 - infer 源与准备函数携带 kernel 类型:
_gen_infer_cpp新增kernel_type参数、_prepare_infer_cpp改为返回(infer_cpp_path, kernel_type),KERNEL_TASK_TYPE_DEFAULT改用推断出的kernel_type.name,取代硬编码的KERNEL_TYPE_MIX_AIC_1_2。 compile_info与 tiling 配置随类型更新:在pypto_compile_op中写入default_kernel_type、no_set_kernel_type、tiling_key_kernel_type、raw_tiling_key_kernel_type,并按 kernel 类型设置tiling_info.task_ration(1:1 为 1、1:2 为 2);同时逐 key 校验 codegen 推断类型一致,不一致抛InvalidOperation,且仅对实际需要的核生成编译命令与.mk。- 补充单元测试:在
test_generate_binary_headers.py中新增用例,覆盖核心比值到 kernel 类型的映射、codegen 推断、core 名称、编译目标命名、编译选项以及 infer 源使用推断类型等行为。


Incorrect?
atomgit-bot
Sep 22 Comments:
Sep 22 Comments:
Sep 22 Added label: cann-cla/yes
CANN-robot
Sep 22 Comments:
Sep 22 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 |
|---|---|---|
| python/pypto_pro | ✅ gaoxiang618, tsungl4 (2/2) | ✅ gaoxiang618 (1/1) |
| repo-cann/pypto | ✅ tsungl4, gaoxiang618 (2/2) | ✅ tsungl4, gaoxiang618 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
wangbing110, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Sep 22 Set xinweiliu,cam_bxh,dai-zhentao,lululu40888,shi-dingkun,gguuaanngg,codehjp423,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,tsungl4,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,WenboCodes as approver
Sep 22 Set xinweiliu,cam_bxh,dai-zhentao,lululu40888,shi-dingkun,gguuaanngg,codehjp423,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,tsungl4,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,WenboCodes as approver
5 event messages are collapsed here。 See more
Sep 22 Added label: cann-cla/yes
poorwill
Sep 22 Comments:
Sep 22 Comments:
compile


Sep 22 Pre merge succeeded (commit_id: 371ed07764e5a3fa57475009f6b5ed910031c4ff)
CANN-robot
Sep 22 Comments:
Sep 22 Comments:
| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


Sep 22 Added label: ci-pipeline-running
Sep 22 Removed label: ci-pipeline-running
Sep 22 Added label: ci-pipeline-failed
Sep 23 Associated issue: [Task|任务跟踪]: pypto-pro二进制模式支持kernel type探测
poorwill
Sep 23 Comments:
Sep 23 Comments:
compile


Sep 23 Pre merge succeeded (commit_id: 9adaf46977b738e97dc2874a9225b76d629c4f65)
CANN-robot
Sep 23 Comments:
Sep 23 Comments:
| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


Sep 23 Removed label: ci-pipeline-failed
Sep 23 Added label: ci-pipeline-running
Sep 23 Removed label: ci-pipeline-running
Sep 23 Added label: ci-pipeline-passed
gaoxiang618
Sep 23 Comments:
Sep 23 Comments:
/lgtm
/approve


Sep 23 Added label: approved
lidongsheng
Sep 23 Comments:
Sep 23 Comments:
/lgtm
/approve


Sep 23 Added label: lgtm
Sep 23 Merged pull request
feat(pypto-pro): Support infer kernel type in pypto_compile_op